fix(payment): resume QRIS after closing dialog
This commit is contained in:
@@ -59,13 +59,17 @@ export function SubscriptionCheckoutButton({
|
||||
subscriptionType,
|
||||
});
|
||||
|
||||
const isLoading = payment.isCreatingOrder || payment.isPollingOrder;
|
||||
const isResumingQris = paymentLaunch.hasHiddenQrisPayment;
|
||||
const isLoading =
|
||||
payment.isCreatingOrder || (payment.isPollingOrder && !isResumingQris);
|
||||
const readyLabel = "Pay and Top Up";
|
||||
const label = payment.isPollingOrder
|
||||
? "Processing payment..."
|
||||
: payment.isCreatingOrder
|
||||
? "Creating order..."
|
||||
: readyLabel;
|
||||
const label = isResumingQris
|
||||
? "Resume QRIS payment"
|
||||
: payment.isPollingOrder
|
||||
? "Processing payment..."
|
||||
: payment.isCreatingOrder
|
||||
? "Creating order..."
|
||||
: readyLabel;
|
||||
|
||||
const startCheckout = () => {
|
||||
if (disabled || isLoading) return;
|
||||
@@ -74,6 +78,10 @@ export function SubscriptionCheckoutButton({
|
||||
};
|
||||
|
||||
const handleClick = () => {
|
||||
if (isResumingQris) {
|
||||
paymentLaunch.handleQrisResume();
|
||||
return;
|
||||
}
|
||||
if (disabled || isLoading) return;
|
||||
if (
|
||||
payment.payChannel === "stripe" &&
|
||||
@@ -99,7 +107,7 @@ export function SubscriptionCheckoutButton({
|
||||
type="button"
|
||||
data-analytics-key="subscription.checkout"
|
||||
data-analytics-label="Start subscription checkout"
|
||||
disabled={disabled}
|
||||
disabled={disabled && !isResumingQris}
|
||||
isLoading={isLoading}
|
||||
onClick={handleClick}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user