Skip to content

Commit

Permalink
feat: remove pricing on payment page for granted subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
MelissaDTH authored and ChristiaanScheermeijer committed May 30, 2023
1 parent f978779 commit 9745686
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/components/Payment/Payment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const Payment = ({
const hasMoreTransactions = hiddenTransactionsCount > 0;
const navigate = useNavigate();
const location = useLocation();
const isGrantedSubscription = activeSubscription?.period === 'granted';

function onCompleteSubscriptionClick() {
navigate(addQueryParam(location, 'u', 'choose-offer'));
Expand Down Expand Up @@ -92,16 +93,18 @@ const Payment = ({
<div className={styles.infoBox} key={activeSubscription.subscriptionId}>
<p>
<strong>{getTitle(activeSubscription.period)}</strong> <br />
{activeSubscription.status === 'active' && activeSubscription.period !== 'granted'
{activeSubscription.status === 'active' && !isGrantedSubscription
? t('user:payment.next_billing_date_on', { date: formatDate(activeSubscription.expiresAt) })
: t('user:payment.subscription_expires_on', { date: formatDate(activeSubscription.expiresAt) })}
</p>
<p className={styles.price}>
<strong>{formatPrice(activeSubscription.nextPaymentPrice, activeSubscription.nextPaymentCurrency, customer.country)}</strong>
<small>/{t(`account:periods.${activeSubscription.period}`)}</small>
</p>
{!isGrantedSubscription && (
<p className={styles.price}>
<strong>{formatPrice(activeSubscription.nextPaymentPrice, activeSubscription.nextPaymentCurrency, customer.country)}</strong>
<small>/{t(`account:periods.${activeSubscription.period}`)}</small>
</p>
)}
</div>
{activeSubscription.status === 'active' && activeSubscription.period !== 'granted' ? (
{activeSubscription.status === 'active' && !isGrantedSubscription ? (
<Button label={t('user:payment.cancel_subscription')} onClick={onCancelSubscriptionClick} />
) : canRenewSubscription ? (
<Button label={t('user:payment.renew_subscription')} onClick={onRenewSubscriptionClick} />
Expand Down Expand Up @@ -156,10 +159,11 @@ const Payment = ({
<div className={styles.infoBox} key={transaction.transactionId}>
<p className="transactionItem">
<strong>{transaction.offerTitle}</strong> <br />
{t('user:payment.price_payed_with', {
price: formatPrice(parseFloat(transaction.transactionPriceInclTax), transaction.transactionCurrency, transaction.customerCountry),
method: transaction.paymentMethod,
})}
{!isGrantedSubscription &&
t('user:payment.price_payed_with', {
price: formatPrice(parseFloat(transaction.transactionPriceInclTax), transaction.transactionCurrency, transaction.customerCountry),
method: transaction.paymentMethod,
})}
</p>
<p>
{transaction.transactionId}
Expand Down

0 comments on commit 9745686

Please sign in to comment.