Skip to content

Commit

Permalink
feat: add a payment link for pending subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
lukicenturi authored and kelsos committed Apr 4, 2024
1 parent b465b12 commit 31776fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 13 additions & 1 deletion components/account/home/SubscriptionTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ watch(pending, (pending) => {
onUnmounted(() => pause());
function isPending(sub: Subscription) {
return sub.status === 'Pending';
}
function hasAction(sub: Subscription, action: 'renew' | 'cancel') {
if (action === 'cancel')
return sub.status !== 'Pending' && sub.actions.includes('cancel');
Expand All @@ -126,7 +130,7 @@ function hasAction(sub: Subscription, action: 'renew' | 'cancel') {
}
function displayActions(sub: Subscription) {
return hasAction(sub, 'renew') || hasAction(sub, 'cancel');
return hasAction(sub, 'renew') || hasAction(sub, 'cancel') || isPending(sub);
}
function getChipStatusColor(status: string): ContextColorsType | undefined {
Expand Down Expand Up @@ -202,6 +206,14 @@ async function cancelSubscription(sub: Subscription) {
>
{{ t('actions.renew') }}
</ButtonLink>
<ButtonLink
v-if="isPending(row)"
:disabled="cancelling"
:to="{ path: '/checkout/pay/method' }"
color="primary"
>
{{ t('account.subscriptions.payment_detail') }}
</ButtonLink>
</div>
<div
v-else
Expand Down
1 change: 1 addition & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
"cost_in_symbol_per_period": "Cost in {symbol} per period"
},
"no_subscriptions_found": "No subscriptions found",
"payment_detail": "Payment Details",
"title": "Subscription History"
},
"tabs": {
Expand Down

0 comments on commit 31776fb

Please sign in to comment.