@@ -1093,9 +1093,9 @@ def self.mock_balance_transaction(params = {})
1093
1093
end
1094
1094
1095
1095
def self . mock_subscription_item ( params = { } )
1096
- iid = params [ :id ] || 'test_txn_default'
1096
+ id = params [ :id ] || 'test_txn_default'
1097
1097
{
1098
- id : iid ,
1098
+ id : id ,
1099
1099
object : 'subscription_item' ,
1100
1100
created : 1504716183 ,
1101
1101
metadata : {
@@ -1188,29 +1188,64 @@ def self.mock_payment_intent(params = {})
1188
1188
end
1189
1189
1190
1190
def self . mock_payment_method ( params = { } )
1191
- payment_method_id = params [ :id ] || "pm_1ExEuFL2DI6wht39WNJgbybl"
1192
- {
1193
- id : payment_method_id ,
1194
- object : "payment_method" ,
1195
- type : "card" ,
1196
- billing_details : { } ,
1197
- card : {
1198
- brand : "visa" ,
1199
- checks : { address_line1_check : nil , address_postal_code_check : nil , cvc_check : "pass" } ,
1200
- country : "FR" ,
1201
- exp_month : 2 ,
1202
- exp_year : 2022 ,
1203
- fingerprint : "Hr3Ly5z5IYxsokWA" ,
1204
- funding : "credit" ,
1205
- last4 : "3155" ,
1206
- three_d_secure_usage : { supported : true }
1191
+ payment_method_id = params [ :id ] || 'pm_1ExEuFL2DI6wht39WNJgbybl'
1192
+
1193
+ type = params [ :type ] . to_sym
1194
+ data = {
1195
+ card : {
1196
+ brand : 'visa' ,
1197
+ checks : {
1198
+ address_line1_check : nil ,
1199
+ address_postal_code_check : nil ,
1200
+ cvc_check : 'pass'
1207
1201
} ,
1208
- customer : params [ :customer ] || nil ,
1209
- metadata : {
1210
- order_id : "123456789"
1211
- }
1202
+ country : 'FR' ,
1203
+ exp_month : 2 ,
1204
+ exp_year : 2022 ,
1205
+ fingerprint : 'Hr3Ly5z5IYxsokWA' ,
1206
+ funding : 'credit' ,
1207
+ generated_from : nil ,
1208
+ last4 : '3155' ,
1209
+ three_d_secure_usage : { supported : true } ,
1210
+ wallet : nil
1211
+ } ,
1212
+ ideal : {
1213
+ bank : 'ing' ,
1214
+ bic : 'INGBNL2A' ,
1215
+ iban_last4 : '****' ,
1216
+ verified_name : 'JENNY ROSEN'
1217
+ } ,
1218
+ sepa_debit : {
1219
+ bank_code : '37040044' ,
1220
+ branch_code : '' ,
1221
+ country : 'DE' ,
1222
+ fingerprint : 'FD81kbVPe7M05BMj' ,
1223
+ last4 : '3000'
1224
+ }
1225
+ }
1212
1226
1213
- } . merge ( params )
1227
+ {
1228
+ id : payment_method_id ,
1229
+ object : 'payment_method' ,
1230
+ type : params [ :type ] ,
1231
+ billing_details : {
1232
+ address : {
1233
+ city : 'New Orleans' ,
1234
+ country : 'US' ,
1235
+ line1 : 'Bourbon Street 23' ,
1236
+ line2 : nil ,
1237
+ postal_code : '10000' ,
1238
+ state : nil
1239
+ } ,
1240
+
1241
+ name : 'John Dolton' ,
1242
+ phone : nil
1243
+ } ,
1244
+ customer : params [ :customer ] || nil ,
1245
+ metadata : {
1246
+ order_id : '123456789'
1247
+ }
1248
+ } . merge ( type => data [ type ] ) . merge ( params )
1214
1249
end
1215
1250
1216
1251
def self . mock_setup_intent ( params = { } )
0 commit comments