-
Notifications
You must be signed in to change notification settings - Fork 628
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for selecting saved PM in
CustomerSheet
. (#8259)
* Add test for selecting saved PM in `CustomerSheet`. * Clear preferences before confirming selection in `CustomerSheetTest`
- Loading branch information
1 parent
a6f60e4
commit 2f39506
Showing
6 changed files
with
184 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
paymentsheet/src/androidTest/java/com/stripe/android/paymentsheet/utils/PrefsTestStore.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.stripe.android.paymentsheet.utils | ||
|
||
import android.content.Context | ||
import android.content.SharedPreferences | ||
import com.stripe.android.paymentsheet.DefaultPrefsRepository | ||
|
||
class PrefsTestStore( | ||
context: Context, | ||
) { | ||
private val prefs: SharedPreferences by lazy { | ||
context.getSharedPreferences(DefaultPrefsRepository.PREF_FILE, Context.MODE_PRIVATE) | ||
} | ||
|
||
fun clear() { | ||
prefs.edit().clear().apply() | ||
} | ||
} |
101 changes: 101 additions & 0 deletions
101
paymentsheet/src/androidTest/resources/payment-methods-get-success.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{ | ||
"object": "list", | ||
"data": [ | ||
{ | ||
"id": "pm_12345", | ||
"object": "payment_method", | ||
"billing_details": { | ||
"address": { | ||
"city": null, | ||
"country": "US", | ||
"line1": null, | ||
"line2": null, | ||
"postal_code": "12342", | ||
"state": null | ||
}, | ||
"email": null, | ||
"name": null, | ||
"phone": null | ||
}, | ||
"card": { | ||
"brand": "visa", | ||
"checks": { | ||
"address_line1_check": null, | ||
"address_postal_code_check": null, | ||
"cvc_check": null | ||
}, | ||
"country": "US", | ||
"display_brand": "visa", | ||
"exp_month": 12, | ||
"exp_year": 2035, | ||
"fingerprint": "IMwEhnDXJXJa55oU", | ||
"funding": "debit", | ||
"generated_from": null, | ||
"last4": "5556", | ||
"networks": { | ||
"available": [ | ||
"visa" | ||
], | ||
"preferred": null | ||
}, | ||
"three_d_secure_usage": { | ||
"supported": true | ||
}, | ||
"wallet": null | ||
}, | ||
"created": 1712746197, | ||
"customer": "cus_1", | ||
"livemode": false, | ||
"type": "card" | ||
}, | ||
{ | ||
"id": "pm_67890", | ||
"object": "payment_method", | ||
"billing_details": { | ||
"address": { | ||
"city": null, | ||
"country": "AE", | ||
"line1": null, | ||
"line2": null, | ||
"postal_code": null, | ||
"state": null | ||
}, | ||
"email": null, | ||
"name": "CustomerSheet Testing", | ||
"phone": null | ||
}, | ||
"card": { | ||
"brand": "visa", | ||
"checks": { | ||
"address_line1_check": null, | ||
"address_postal_code_check": null, | ||
"cvc_check": null | ||
}, | ||
"country": "US", | ||
"display_brand": "visa", | ||
"exp_month": 12, | ||
"exp_year": 2034, | ||
"fingerprint": "LzD7yFi1Cp2DJQs7", | ||
"funding": "credit", | ||
"generated_from": null, | ||
"last4": "4242", | ||
"networks": { | ||
"available": [ | ||
"visa" | ||
], | ||
"preferred": null | ||
}, | ||
"three_d_secure_usage": { | ||
"supported": true | ||
}, | ||
"wallet": null | ||
}, | ||
"created": 1712554485, | ||
"customer": "cus_1", | ||
"livemode": false, | ||
"type": "card" | ||
} | ||
], | ||
"has_more": false, | ||
"url": "/v1/payment_methods" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters