Skip to content

Commit

Permalink
Update endpoint to use correct methods and update stripeservice for c…
Browse files Browse the repository at this point in the history
…orrect variable names

Used the wrong method for endpoint so fixed that.
  • Loading branch information
jeffplays2005 committed Sep 14, 2024
1 parent e6cf53a commit e3ca801
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions server/src/business-layer/services/StripeService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
LODGE_PRICING_TYPE_KEY,
MEMBERSHIP_PRODUCT_TYPE_KEY,
ProductTypeValues,
USER_FIREBASE_EMAIL_KEY,
Expand Down Expand Up @@ -387,10 +388,8 @@ export default class StripeService {
expand: ["data.default_price"]
})
// Filter products with the required metadata
const lodgeProducts = products.data.filter(
(product) =>
product.metadata[MEMBERSHIP_PRODUCT_TYPE_KEY] ===
ProductTypeValues.BOOKING
const lodgeProducts = products.data.filter((product) =>
Object.keys(product.metadata).includes(LODGE_PRICING_TYPE_KEY)
)
return lodgeProducts
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion server/src/service-layer/controllers/PaymentController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class PaymentController extends Controller {
public async getLodgePrices(): Promise<LodgeStripeProductResponse> {
const stripeService = new StripeService()
try {
const lodgeProducts = await stripeService.getActiveMembershipProducts()
const lodgeProducts = await stripeService.getActiveLodgeProducts()
// Maps the products to the required response type MembershipStripeProductResponse in PaymentResponse

const productsValues = lodgeProducts.map((product) => {
Expand Down

0 comments on commit e3ca801

Please sign in to comment.