diff --git a/src/components/Payment/Payment.tsx b/src/components/Payment/Payment.tsx index cfd6c774a..f94a8fbc3 100644 --- a/src/components/Payment/Payment.tsx +++ b/src/components/Payment/Payment.tsx @@ -90,28 +90,38 @@ const Payment = ({ - ) : null} + ) : ( +
+

{t('user:payment.no_payment_methods')}

+
+ )}

{t('user:payment.transactions')}

- {transactions?.map((transaction) => ( -
-

- {transaction.offerTitle}
- {t('user:payment.price_payed_with', { - price: formatPrice(parseInt(transaction.transactionPriceInclTax), transaction.transactionCurrency, transaction.customerCountry), - method: transaction.paymentMethod, - })} -

-

- {transaction.transactionId} -
- {formatDate(transaction.transactionDate)} -

+ {transactions?.length ? ( + transactions?.map((transaction) => ( +
+

+ {transaction.offerTitle}
+ {t('user:payment.price_payed_with', { + price: formatPrice(parseInt(transaction.transactionPriceInclTax), transaction.transactionCurrency, transaction.customerCountry), + method: transaction.paymentMethod, + })} +

+

+ {transaction.transactionId} +
+ {formatDate(transaction.transactionDate)} +

+
+ )) + ) : ( +
+

{t('user:payment.no_transactions')}

- ))} + )}
{isLoading && } diff --git a/src/containers/Subscription/SubscriptionContainer.ts b/src/containers/Subscription/SubscriptionContainer.ts index 114cc6a63..1cd8136fb 100644 --- a/src/containers/Subscription/SubscriptionContainer.ts +++ b/src/containers/Subscription/SubscriptionContainer.ts @@ -40,10 +40,10 @@ const SubscriptionContainer = ({ children }: Props): JSX.Element => { activeSubscription: subscriptions?.responseData?.items.find( (subscription) => subscription.status !== 'expired' && subscription.status !== 'terminated', ), - activePaymentDetail: paymentDetails?.responseData.paymentDetails.find((paymentDetails) => paymentDetails.active), - subscriptions: subscriptions?.responseData.items, - paymentDetails: paymentDetails?.responseData.paymentDetails, - transactions: transactions?.responseData.items, + activePaymentDetail: paymentDetails?.responseData?.paymentDetails.find((paymentDetails) => paymentDetails.active), + subscriptions: subscriptions?.responseData?.items, + paymentDetails: paymentDetails?.responseData?.paymentDetails, + transactions: transactions?.responseData?.items, isLoading: isSubscriptionsLoading || isPaymentDetailsLoading || isTransactionsLoading, } as ChildrenParams); }; diff --git a/src/i18n/locales/en_US/user.json b/src/i18n/locales/en_US/user.json index 8f5564a3c..930bb3f75 100644 --- a/src/i18n/locales/en_US/user.json +++ b/src/i18n/locales/en_US/user.json @@ -40,7 +40,9 @@ "expiry_date": "Expiry date", "monthly_subscription": "Monthly subscription", "next_billing_date_on": "Next billing date is on {{date}}", + "no_payment_methods": "No payment methods", "no_subscription": "You have no subscription. Complete your subscription to start watching all movies and series.", + "no_transactions": "No transactions", "payment_method": "Payment method", "price_payed_with": "{{price}} payed with {{method}}", "renew_subscription": "Renew subscription", diff --git a/src/i18n/locales/nl_NL/user.json b/src/i18n/locales/nl_NL/user.json index 36f2d6826..800137b0c 100644 --- a/src/i18n/locales/nl_NL/user.json +++ b/src/i18n/locales/nl_NL/user.json @@ -40,7 +40,9 @@ "expiry_date": "", "monthly_subscription": "", "next_billing_date_on": "", + "no_payment_methods": "", "no_subscription": "", + "no_transactions": "", "payment_method": "", "price_payed_with": "", "renew_subscription": "",