@@ -1159,6 +1159,29 @@ test('fintoc.v2.checkoutSessions.expire()', async (t) => {
11591159 t . is ( checkoutSession . url , `v2/checkout_sessions/${ checkoutSessionId } /expire` ) ;
11601160} ) ;
11611161
1162+ test ( 'fintoc.v2.invoices.list()' , async ( t ) => {
1163+ const ctx : any = t . context ;
1164+ const invoices = await ctx . fintoc . v2 . invoices . list ( ) ;
1165+
1166+ let count = 0 ;
1167+ for await ( const invoice of invoices ) {
1168+ count += 1 ;
1169+ t . is ( invoice . method , 'get' ) ;
1170+ t . is ( invoice . url , 'v2/invoices' ) ;
1171+ }
1172+
1173+ t . true ( count > 0 ) ;
1174+ } ) ;
1175+
1176+ test ( 'fintoc.v2.invoices.get()' , async ( t ) => {
1177+ const ctx : any = t . context ;
1178+ const invoiceId = 'invoice_id' ;
1179+ const invoice = await ctx . fintoc . v2 . invoices . get ( invoiceId ) ;
1180+
1181+ t . is ( invoice . method , 'get' ) ;
1182+ t . is ( invoice . url , `v2/invoices/${ invoiceId } ` ) ;
1183+ } ) ;
1184+
11621185test ( 'fintoc.v2.paymentIntents.list()' , async ( t ) => {
11631186 const ctx : any = t . context ;
11641187 const paymentIntents = await ctx . fintoc . v2 . paymentIntents . list ( ) ;
@@ -1197,3 +1220,58 @@ test('fintoc.v2.paymentIntents.create()', async (t) => {
11971220 t . is ( paymentIntent . json . currency , paymentIntentData . currency ) ;
11981221 t . is ( paymentIntent . json . payment_method , paymentIntentData . payment_method ) ;
11991222} ) ;
1223+
1224+ test ( 'fintoc.v2.paymentMethods.list()' , async ( t ) => {
1225+ const ctx : any = t . context ;
1226+ const paymentMethods = await ctx . fintoc . v2 . paymentMethods . list ( ) ;
1227+
1228+ let count = 0 ;
1229+ for await ( const paymentMethod of paymentMethods ) {
1230+ count += 1 ;
1231+ t . is ( paymentMethod . method , 'get' ) ;
1232+ t . is ( paymentMethod . url , 'v2/payment_methods' ) ;
1233+ }
1234+
1235+ t . true ( count > 0 ) ;
1236+ } ) ;
1237+
1238+ test ( 'fintoc.v2.paymentMethods.get()' , async ( t ) => {
1239+ const ctx : any = t . context ;
1240+ const paymentMethodId = 'payment_method_id' ;
1241+ const paymentMethod = await ctx . fintoc . v2 . paymentMethods . get ( paymentMethodId ) ;
1242+
1243+ t . is ( paymentMethod . method , 'get' ) ;
1244+ t . is ( paymentMethod . url , `v2/payment_methods/${ paymentMethodId } ` ) ;
1245+ } ) ;
1246+
1247+ test ( 'fintoc.v2.subscriptions.list()' , async ( t ) => {
1248+ const ctx : any = t . context ;
1249+ const subscriptions = await ctx . fintoc . v2 . subscriptions . list ( ) ;
1250+
1251+ let count = 0 ;
1252+ for await ( const subscription of subscriptions ) {
1253+ count += 1 ;
1254+ t . is ( subscription . method , 'get' ) ;
1255+ t . is ( subscription . url , 'v2/subscriptions' ) ;
1256+ }
1257+
1258+ t . true ( count > 0 ) ;
1259+ } ) ;
1260+
1261+ test ( 'fintoc.v2.subscriptions.get()' , async ( t ) => {
1262+ const ctx : any = t . context ;
1263+ const subscriptionId = 'subscription_id' ;
1264+ const subscription = await ctx . fintoc . v2 . subscriptions . get ( subscriptionId ) ;
1265+
1266+ t . is ( subscription . method , 'get' ) ;
1267+ t . is ( subscription . url , `v2/subscriptions/${ subscriptionId } ` ) ;
1268+ } ) ;
1269+
1270+ test ( 'fintoc.v2.subscriptions.cancel()' , async ( t ) => {
1271+ const ctx : any = t . context ;
1272+ const subscriptionId = 'subscription_id' ;
1273+ const subscription = await ctx . fintoc . v2 . subscriptions . cancel ( subscriptionId ) ;
1274+
1275+ t . is ( subscription . method , 'post' ) ;
1276+ t . is ( subscription . url , `v2/subscriptions/${ subscriptionId } /cancel` ) ;
1277+ } ) ;
0 commit comments