feat: wire payment return url payloads

This commit is contained in:
IanShaw027
2026-04-20 20:19:23 +08:00
parent 7826e9880c
commit b51bc7ee24
8 changed files with 215 additions and 21 deletions

View File

@@ -267,6 +267,7 @@ import PaymentMethodSelector from '@/components/payment/PaymentMethodSelector.vu
import { METHOD_ORDER, POPUP_WINDOW_FEATURES, STRIPE_POPUP_WINDOW_FEATURES } from '@/components/payment/providerConfig'
import {
PAYMENT_RECOVERY_STORAGE_KEY,
buildCreateOrderPayload,
clearPaymentRecoverySnapshot,
decidePaymentLaunch,
getVisibleMethods,
@@ -563,12 +564,14 @@ async function createOrder(orderAmount: number, orderType: OrderType, planId?: n
submitting.value = true
errorMessage.value = ''
try {
const result = await paymentStore.createOrder({
const result = await paymentStore.createOrder(buildCreateOrderPayload({
amount: orderAmount,
payment_type: selectedMethod.value,
order_type: orderType,
plan_id: planId,
}) as CreateOrderResult & { resume_token?: string }
paymentType: selectedMethod.value,
orderType,
planId,
origin: typeof window !== 'undefined' ? window.location.origin : '',
isWechatBrowser: typeof window !== 'undefined' && /MicroMessenger/i.test(window.navigator.userAgent),
})) as CreateOrderResult & { resume_token?: string }
const openWindow = (url: string, features = POPUP_WINDOW_FEATURES) => {
const win = window.open(url, 'paymentPopup', features)
if (!win || win.closed) {