Skip to content

Commit 8ad3c09

Browse files
Merge pull request #2048 from lumi-tip/development-lumi-9234
🐛 allowing cancelling subscription when payment issue
2 parents be1448c + a4da6f6 commit 8ad3c09

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

src/components/Profile/Subscriptions/SubsriptionButton.jsx

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,37 @@ function SubsriptionButton({
125125
text: t('subscription.contact-support'),
126126
isComponent: true,
127127
component: (
128-
<Button onClick={manageActionBasedOnLocation} marginTop="5px" textAlign="center" userSelect="none" justifyContent="center" fontSize="sm" fontWeight={700} color="blue.1000" width="100%" _hover="none" _active="none" background="auto" height="none">
129-
{router.pathname === '/profile/[slug]' ? t('subscription.contact-support') : t('subscription.manage-subscription')}
130-
</Button>
128+
<>
129+
{isPaymentIssue && (
130+
<Button
131+
onClick={() => {
132+
setSubscriptionProps(subscription);
133+
if (isCancelled) {
134+
handleReactivatePlan();
135+
} else {
136+
onOpenCancelSubscription();
137+
}
138+
}}
139+
marginTop="5px"
140+
textAlign="center"
141+
userSelect="none"
142+
justifyContent="center"
143+
fontSize="sm"
144+
fontWeight={700}
145+
color="blue.1000"
146+
width="100%"
147+
_hover="none"
148+
_active="none"
149+
background="auto"
150+
height="none"
151+
>
152+
{isCancelled ? t('subscription.reactivate-subscription') : t('subscription.cancel')}
153+
</Button>
154+
)}
155+
<Button onClick={manageActionBasedOnLocation} marginTop="5px" textAlign="center" userSelect="none" justifyContent="center" fontSize="sm" fontWeight={700} color="blue.1000" width="100%" _hover="none" _active="none" background="auto" height="none">
156+
{router.pathname === '/profile/[slug]' ? t('subscription.contact-support') : t('subscription.manage-subscription')}
157+
</Button>
158+
</>
131159
),
132160
};
133161
}
@@ -153,11 +181,11 @@ function SubsriptionButton({
153181
<Button
154182
isLoading={isLoading}
155183
onClick={() => {
184+
setSubscriptionProps(subscription);
156185
if (isPlanFinancingExpired) handlePlanOffer();
157186
if ((['FREE_TRIAL', 'PAYMENT_ISSUE'].includes(status)) || (['ACTIVE', 'FULLY_PAID'].includes(status) && subscription?.planOffer?.slug)) handlePlanOffer();
158187
if (['ACTIVE', 'FULLY_PAID'].includes(status) && subscription?.type !== 'plan_financing' && !subscription?.planOffer?.slug) onOpenCancelSubscription();
159188
if (['CANCELLED'].includes(status)) handleReactivatePlan();
160-
setSubscriptionProps(subscription);
161189
}}
162190
color="blue.default"
163191
margin="auto 0 0 0"

0 commit comments

Comments
 (0)