diff --git a/server/src/business-layer/services/StripeService.ts b/server/src/business-layer/services/StripeService.ts index 02c333dc..20f065e8 100644 --- a/server/src/business-layer/services/StripeService.ts +++ b/server/src/business-layer/services/StripeService.ts @@ -1,4 +1,5 @@ import { + LODGE_PRICING_TYPE_KEY, MEMBERSHIP_PRODUCT_TYPE_KEY, ProductTypeValues, USER_FIREBASE_EMAIL_KEY, @@ -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) { diff --git a/server/src/service-layer/controllers/PaymentController.ts b/server/src/service-layer/controllers/PaymentController.ts index 3c8696ff..9d2bf758 100644 --- a/server/src/service-layer/controllers/PaymentController.ts +++ b/server/src/service-layer/controllers/PaymentController.ts @@ -117,7 +117,7 @@ export class PaymentController extends Controller { public async getLodgePrices(): Promise { 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) => {