mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-07 08:52:26 +00:00
feat(payment): add mobile Alipay precreate deep link
This commit is contained in:
1 parent
60013c5f10
commit
7914433011
33 files changed
+1085
-117
No files matched your search
@@ -16,12 +16,16 @@
|
||||
<template v-if="paymentPhase === 'paying'">
|
||||
<PaymentStatusPanel
|
||||
:order-id="paymentState.orderId"
|
||||
:amount="paymentState.amount"
|
||||
:pay-amount="paymentState.payAmount"
|
||||
:qr-code="paymentState.qrCode"
|
||||
:expires-at="paymentState.expiresAt"
|
||||
:payment-type="paymentState.paymentType"
|
||||
:pay-url="paymentState.payUrl"
|
||||
:order-type="paymentState.orderType"
|
||||
:currency="paymentState.currency || selectedCurrency"
|
||||
:out-trade-no="paymentState.outTradeNo"
|
||||
:mobile-alipay-deep-link="paymentState.alipayMobilePrecreateDeepLink"
|
||||
@done="onPaymentDone"
|
||||
@success="onPaymentSuccess"
|
||||
@settled="onPaymentSettled"
|
||||
@@ -360,6 +364,7 @@ function emptyPaymentState(): PaymentRecoverySnapshot {
|
||||
orderType: '',
|
||||
paymentMode: '',
|
||||
resumeToken: '',
|
||||
alipayMobilePrecreateDeepLink: false,
|
||||
createdAt: 0,
|
||||
}
|
||||
}
|
||||
@@ -480,12 +485,14 @@ function onPaymentDone() {
|
||||
}
|
||||
}
|
||||
|
||||
function onPaymentSuccess() {
|
||||
async function onPaymentSuccess() {
|
||||
const completedPayment = { ...paymentState.value }
|
||||
removeRecoverySnapshot()
|
||||
authStore.refreshUser()
|
||||
if (paymentState.value.orderType === 'subscription') {
|
||||
subscriptionStore.fetchActiveSubscriptions(true).catch(() => {})
|
||||
}
|
||||
await redirectToPaymentResult(completedPayment)
|
||||
}
|
||||
|
||||
function onPaymentSettled() {
|
||||
@@ -772,6 +779,7 @@ async function createOrder(orderAmount: number, orderType: OrderType, planId?: n
|
||||
isMobile: isMobileDevice(),
|
||||
isWechatBrowser: typeof window !== 'undefined' && /MicroMessenger/i.test(window.navigator.userAgent),
|
||||
forceQRCode: !!(checkout.value.alipay_force_qrcode && normalizeVisibleMethod(requestType) === 'alipay'),
|
||||
mobilePrecreateDeepLink: checkout.value.alipay_mobile_precreate_deep_link === true,
|
||||
})
|
||||
if (options.openid) {
|
||||
payload.openid = options.openid
|
||||
@@ -820,6 +828,7 @@ async function createOrder(orderAmount: number, orderType: OrderType, planId?: n
|
||||
isMobile: isMobileDevice(),
|
||||
isWechatBrowser: typeof window !== 'undefined' && /MicroMessenger/i.test(window.navigator.userAgent),
|
||||
forceQRCode: !!(checkout.value.alipay_force_qrcode && visibleMethod === 'alipay'),
|
||||
mobilePrecreateDeepLink: checkout.value.alipay_mobile_precreate_deep_link === true,
|
||||
stripePopupUrl: stripeRouteUrl,
|
||||
stripeRouteUrl,
|
||||
airwallexRouteUrl,
|
||||
|
||||
Reference in new issue
Block a user