feat(payment): implement coffee tip plans and update payment flow

This commit is contained in:
2026-07-14 11:48:46 +08:00
parent f9c15bd91f
commit 3a4f24cb06
30 changed files with 632 additions and 56 deletions
+5
View File
@@ -18,6 +18,7 @@ import {
paidVoiceHistoryResponse,
paidPaymentOrderStatusResponse,
paymentPlansResponse,
tipPaymentPlansResponse,
refreshedEmailLoginResponse,
refreshedGuestLoginResponse,
userEntitlementsResponse,
@@ -189,6 +190,10 @@ export async function mockCoreApis(
await route.fulfill({ json: apiEnvelope(paymentPlansResponse) });
});
await page.route("**/api/payment/tip-plans**", async (route) => {
await route.fulfill({ json: apiEnvelope(tipPaymentPlansResponse) });
});
await page.route("**/api/payment/create-order", async (route) => {
await route.fulfill({ json: apiEnvelope(createPaymentOrderResponse) });
});
+41
View File
@@ -336,6 +336,47 @@ export const paymentPlansResponse = {
],
};
export const tipPaymentPlansResponse = {
plans: [
{
planId: "tip_coffee_usd_4_99",
planName: "Small Coffee",
orderType: "tip",
tipType: "coffee_small",
description: "Buy Elio a small coffee",
amountCents: 499,
currency: "USD",
autoRenew: false,
isFirstRechargeOffer: false,
firstRechargeDiscountPercent: 0,
},
{
planId: "tip_coffee_usd_9_99",
planName: "Medium Coffee",
orderType: "tip",
tipType: "coffee_medium",
description: "Buy Elio a medium coffee",
amountCents: 999,
currency: "USD",
autoRenew: false,
isFirstRechargeOffer: false,
firstRechargeDiscountPercent: 0,
},
{
planId: "tip_coffee_usd_19_99",
planName: "Large Coffee",
orderType: "tip",
tipType: "coffee_large",
description: "Buy Elio a large coffee",
amountCents: 1999,
currency: "USD",
autoRenew: false,
isFirstRechargeOffer: false,
firstRechargeDiscountPercent: 0,
},
],
};
export const paymentOrderId = "order_e2e_vip_monthly";
export const createPaymentOrderResponse = {