Skip to content

Commit e7c2c53

Browse files
committed
Add snapshot tests for setup debit pi and si
1 parent e7e31ea commit e7c2c53

6 files changed

+338
-0
lines changed

StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/PaymentSheetSnapshotTests.swift

+50
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,56 @@ class PaymentSheetSnapshotTests: STPSnapshotTestCase {
786786
verify(paymentSheet.bottomSheetViewController.view!)
787787
}
788788

789+
func testPaymentSheet_LPM_sepaDebit_paymentIntent_customerSession() {
790+
stubSessions(
791+
fileMock: .elementsSessions_customerSessionsMobilePaymentElement_200,
792+
responseCallback: { data in
793+
return self.updatePaymentMethodDetail(
794+
data: data,
795+
variables: [
796+
"<paymentMethods>": "\"sepa_debit\"",
797+
"<currency>": "\"eur\"",
798+
]
799+
)
800+
}
801+
)
802+
preparePaymentSheet(
803+
currency: "eur",
804+
override_payment_methods_types: ["sepa_debit"],
805+
automaticPaymentMethods: false,
806+
useLink: false
807+
)
808+
presentPaymentSheet(darkMode: false)
809+
verify(paymentSheet.bottomSheetViewController.view!)
810+
}
811+
812+
func testPaymentSheet_LPM_sepaDebit_setupIntent_customerSession() {
813+
stubSessions(
814+
fileMock: .elementsSessions_customerSessionsMobilePaymentElement_setupIntent_200,
815+
responseCallback: { data in
816+
return self.updatePaymentMethodDetail(
817+
data: data,
818+
variables: [
819+
"<paymentMethods>": "\"sepa_debit\"",
820+
"<currency>": "\"eur\"",
821+
]
822+
)
823+
}
824+
)
825+
let intentConfig = PaymentSheet.IntentConfiguration(mode: .setup(currency: "eur", setupFutureUsage: .offSession),
826+
paymentMethodTypes: ["sepa_debit"],
827+
confirmHandler: confirmHandler(_:_:_:),
828+
requireCVCRecollection: false)
829+
preparePaymentSheet(
830+
currency: "eur",
831+
override_payment_methods_types: ["sepa_debit"],
832+
automaticPaymentMethods: false,
833+
useLink: false,
834+
intentConfig: intentConfig
835+
)
836+
presentPaymentSheet(darkMode: false)
837+
verify(paymentSheet.bottomSheetViewController.view!)
838+
}
789839
func testPaymentSheet_LPM_sepaDebit_only() {
790840
stubSessions(
791841
fileMock: .elementsSessionsPaymentMethod_200,

StripePaymentSheet/StripePaymentSheetTests/PaymentSheet/Stubbed/StubbedBackend.swift

+2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ public class ClassForBundle {}
7171
case saved_payment_methods_withSepa_200 = "MockFiles/saved_payment_methods_withSepa_200"
7272

7373
case elementsSessionsPaymentMethod_200 = "MockFiles/elements_sessions_paymentMethod_200"
74+
case elementsSessions_customerSessionsMobilePaymentElement_200 = "MockFiles/elements_sessions_customerSessionMobilePaymentElement_200"
75+
case elementsSessions_customerSessionsMobilePaymentElement_setupIntent_200 = "MockFiles/elements_sessions_customerSessionMobilePaymentElement_setupIntent_200"
7476
case elementsSessions_customerSessionsCustomerSheet_200 = "MockFiles/elements_sessions_customerSessionCustomerSheet_200"
7577
case elementsSessions_customerSessionsCustomerSheetWithSavedPM_200 = "MockFiles/elements_sessions_customerSessionCustomerSheetWithSavedPM_200"
7678

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
{
2+
"apple_pay_preference": "enabled",
3+
"business_name": "Mobile Example Account",
4+
"customer": {
5+
"customer_session": {
6+
"id": "cuss_1PK3MvL654321654",
7+
"object": "customer_session",
8+
"api_key": "ek_test_YWNjdF8xSHZUSTdMdT",
9+
"api_key_expiry": 1716580929,
10+
"components": {
11+
"buy_button": {
12+
"enabled": false
13+
},
14+
"payment_element": {
15+
"enabled": false
16+
},
17+
"payment_sheet": {
18+
"enabled": false
19+
},
20+
"mobile_payment_element": {
21+
"enabled": true,
22+
"features": {
23+
"payment_method_save": "enabled",
24+
"payment_method_remove": "enabled"
25+
}
26+
},
27+
"customer_sheet": {
28+
"enabled": false
29+
},
30+
"pricing_table": {
31+
"enabled": false
32+
}
33+
},
34+
"customer": "cus_123456",
35+
"livemode": false
36+
},
37+
"default_payment_method": null,
38+
"payment_methods": [],
39+
"payment_methods_with_link_details": []
40+
},
41+
"experiments": {
42+
"miui_payment_element_aa_experiment": "control"
43+
},
44+
"flags": {
45+
"elements_include_payment_intent_id_in_analytics_events": true,
46+
"elements_enable_mx_card_installments": false,
47+
"elements_enable_br_card_installments": false
48+
},
49+
"google_pay_preference": "disabled",
50+
"link_consumer_info": null,
51+
"link_settings": {
52+
"instant_debits_inline_institution": true,
53+
"link_bank_onboarding_enabled": false,
54+
"link_financial_incentives_experiment_enabled": false,
55+
"link_local_storage_login_enabled": true
56+
},
57+
"merchant_country": "US",
58+
"merchant_currency": <currency>,
59+
"merchant_id": "acct_1",
60+
"order": null,
61+
"ordered_payment_method_types_and_wallets": [
62+
<paymentMethods>
63+
],
64+
"payment_method_preference": {
65+
"object": "payment_method_preference",
66+
"country_code": "US",
67+
"ordered_payment_method_types": [
68+
<paymentMethods>
69+
],
70+
"payment_intent": {
71+
"id": "pi_3Kth",
72+
"object": "payment_intent",
73+
"amount": 5099,
74+
"automatic_payment_methods": null,
75+
"canceled_at": null,
76+
"cancellation_reason": null,
77+
"capture_method": "automatic",
78+
"client_secret": "pi_3Kth_secret_EAG4KQ6JmW",
79+
"confirmation_method": "automatic",
80+
"created": 1651191113,
81+
"currency": <currency>,
82+
"description": null,
83+
"last_payment_error": null,
84+
"livemode": false,
85+
"next_action": null,
86+
"payment_method": null,
87+
"payment_method_types": [
88+
<paymentMethods>
89+
],
90+
"processing": null,
91+
"receipt_email": null,
92+
"setup_future_usage": null,
93+
"shipping": {
94+
"address": {
95+
"city": "San Francisco",
96+
"country": "US",
97+
"line1": "510 Townsend St",
98+
"line2": null,
99+
"postal_code": "94102",
100+
"state": "California"
101+
},
102+
"carrier": null,
103+
"name": "John Doe",
104+
"phone": null,
105+
"tracking_number": null
106+
},
107+
"source": null,
108+
"status": "requires_payment_method"
109+
},
110+
"type": "payment_intent"
111+
},
112+
"session_id": "123",
113+
"shipping_address_settings": {
114+
"autocomplete_allowed": false
115+
},
116+
"unactivated_payment_method_types": [
117+
118+
]
119+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
{
2+
"account_id": "acct_1Hv",
3+
"apple_pay_merchant_token_webhook_url": "https://pm-hooks.stripe.com/apple_pay/merchant_token/pDq7tf9uieoQWMVJixFwuOve/acct_1Hv/",
4+
"apple_pay_preference": "enabled",
5+
"business_name": "Mobile Example Account",
6+
"capability_enabled_card_networks": [
7+
"cartes_bancaires"
8+
],
9+
"card_brand_choice": {
10+
"eligible": false,
11+
"preferred_networks": [
12+
"cartes_bancaires"
13+
],
14+
"supported_cobranded_networks": {
15+
"cartes_bancaires": true
16+
}
17+
},
18+
"card_installments_enabled": false,
19+
"custom_payment_method_data": null,
20+
"customer": {
21+
"customer_session": {
22+
"id": "cuss_1QpC",
23+
"object": "customer_session",
24+
"api_key": "ek_test_YWNjdF8xS",
25+
"api_key_expiry": 1738780224,
26+
"components": {
27+
"buy_button": {
28+
"enabled": false
29+
},
30+
"customer_sheet": {
31+
"enabled": false,
32+
"features": null
33+
},
34+
"mobile_payment_element": {
35+
"enabled": true,
36+
"features": {
37+
"payment_method_allow_redisplay_filters": [
38+
"always"
39+
],
40+
"payment_method_redisplay": "enabled",
41+
"payment_method_remove": "enabled",
42+
"payment_method_remove_last": "enabled",
43+
"payment_method_save": "enabled",
44+
"payment_method_save_allow_redisplay_override": null,
45+
"payment_method_set_as_default": "disabled"
46+
}
47+
},
48+
"payment_element": {
49+
"enabled": false,
50+
"features": null
51+
},
52+
"pricing_table": {
53+
"enabled": false
54+
}
55+
},
56+
"customer": "cus_RiHO0Q5uMhLQF6",
57+
"livemode": false
58+
},
59+
"default_payment_method": "pm_1QoqqLLu5o3P18ZpXPopo6B5",
60+
"payment_methods": [
61+
],
62+
"payment_methods_with_link_details": [
63+
]
64+
},
65+
"customer_error": null,
66+
"experiments": {
67+
"miui_payment_element_aa_experiment": "control"
68+
},
69+
"experiments_data": {
70+
"arb_id": "949448d1-44fe-4fc6-a356-2d5aaa9b24e5",
71+
"experiment_assignments": {
72+
"default_values_prefill_holdback": "control",
73+
"elements_merchant_ui_api_srv": "control",
74+
"link_global_holdback": "control",
75+
"link_global_holdback_aa": "control",
76+
"link_popup_webview_option_ios": "control",
77+
"ocs_buyer_xp_elements_lpm_holdback": "control"
78+
},
79+
"experiment_metadata": {
80+
"seed": "20a743d3101f6866ca9c40097c896eb99e7287093f060bfc904d",
81+
"semi_dominant_payment_methods": []
82+
}
83+
},
84+
"external_payment_method_data": null,
85+
"flags": {
86+
},
87+
"google_pay_preference": "enabled",
88+
"klarna_express_config": {
89+
"klarna_mid": null
90+
},
91+
"legacy_customer": null,
92+
"link_purchase_protections_data": {
93+
"is_eligible": false,
94+
"type": null
95+
},
96+
"lpm_promotions": null,
97+
"merchant_country": "US",
98+
"merchant_currency": <currency>,
99+
"merchant_id": "acct_1HvTI7L",
100+
"merchant_logo_url": null,
101+
"meta_pay_signed_container_context": null,
102+
"order": null,
103+
"ordered_payment_method_types_and_wallets": [
104+
<paymentMethods>
105+
],
106+
"passive_captcha": {
107+
"rqdata": null,
108+
"site_key": "20000000-ffff-ffff-ffff-000000000002"
109+
},
110+
"payment_method_preference": {
111+
"object": "payment_method_preference",
112+
"country_code": "US",
113+
"ordered_payment_method_types": [
114+
<paymentMethods>
115+
],
116+
"setup_intent": {
117+
"id": "seti_1QpCtfLu5o3P18ZpdEABNMyd",
118+
"object": "setup_intent",
119+
"automatic_payment_methods": {
120+
"allow_redirects": "always",
121+
"enabled": true
122+
},
123+
"cancellation_reason": null,
124+
"client_secret": "seti_1QpCtfLu5oEABNMyd_secret_RieC2mUW2zQojb97pNv",
125+
"created": 1738778423,
126+
"description": null,
127+
"last_setup_error": null,
128+
"livemode": false,
129+
"next_action": null,
130+
"payment_method": null,
131+
"payment_method_configuration_details": {
132+
"id": "pmc_1JcZxfLu5o3P18Zp6oYzNhiP",
133+
"parent": null
134+
},
135+
"payment_method_options": {
136+
},
137+
"payment_method_types": [
138+
<paymentMethods>
139+
],
140+
"status": "requires_payment_method",
141+
"usage": "off_session"
142+
},
143+
"type": "setup_intent"
144+
},
145+
"paypal_express_config": {
146+
"client_id": null,
147+
"paypal_merchant_id": null
148+
},
149+
"prefill_selectors": {
150+
"default_values": {
151+
"email": [],
152+
"merchant_provides_default_values_on_update": true
153+
}
154+
},
155+
"sepa_debit_info": {
156+
"creditor_id": "DE16ZZZ000019",
157+
"creditor_name": "Mobile Example Account"
158+
},
159+
"session_id": "elements_session_0lvIyTkmVBs",
160+
"shipping_address_settings": {
161+
"autocomplete_allowed": true
162+
},
163+
"unactivated_payment_method_types": [],
164+
"unverified_payment_methods_on_domain": [
165+
"apple_pay"
166+
]
167+
}

0 commit comments

Comments
 (0)