@@ -19,6 +19,26 @@ const paymentLinkMock = {
1919 url : `https://buy.stripe.com/${ linkId } ` ,
2020} ;
2121
22+ vi . mock ( import ( "../../src/api/functions/stripe.js" ) , async ( importOriginal ) => {
23+ const mod = await importOriginal ( ) ;
24+ return {
25+ ...mod ,
26+ getPaymentMethodForPaymentIntent : vi . fn ( ) . mockImplementation ( async ( ) => {
27+ return {
28+ type : "us_bank_account" ,
29+ us_bank_account : {
30+ bank_name : "ACM Bank N.A." ,
31+ account_type : "checking" ,
32+ last4 : "0123" ,
33+ } ,
34+ } ;
35+ } ) ,
36+ getPaymentMethodDescriptionString : vi . fn ( ) . mockImplementation ( async ( ) => {
37+ return "Your payment method here." ;
38+ } ) ,
39+ } ;
40+ } ) ;
41+
2242const app = await init ( ) ;
2343describe ( "Test Stripe webhooks" , async ( ) => {
2444 test ( "Stripe Payment Link skips non-existing links" , async ( ) => {
@@ -38,6 +58,7 @@ describe("Test Stripe webhooks", async () => {
3858 data : {
3959 object : {
4060 payment_link : linkId ,
61+ payment_intent : "pi_123" ,
4162 amount_total : 10000 ,
4263 currency : "usd" ,
4364 customer_details : {
@@ -81,6 +102,7 @@ describe("Test Stripe webhooks", async () => {
81102 data : {
82103 object : {
83104 payment_link : linkId ,
105+ payment_intent : "pi_123" ,
84106 amount_total : 10000 ,
85107 currency : "usd" ,
86108 customer_details : {
@@ -136,6 +158,7 @@ describe("Test Stripe webhooks", async () => {
136158 object : {
137159 payment_link : linkId ,
138160 amount_total : 10000 ,
161+ payment_intent : "pi_123" ,
139162 currency : "usd" ,
140163 customer_details : {
141164 name : "Test User" ,
0 commit comments