-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update
Bacs
UI and add support to PaymentSheet
& FlowController
.
- Loading branch information
1 parent
4cd5ca9
commit 2505f06
Showing
64 changed files
with
756 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -263,6 +263,105 @@ class PaymentMethodCreateParamsTest { | |
) | ||
} | ||
|
||
@Test | ||
fun `createBacsFromParams should return a 'BacsDebit' instance correctly`() { | ||
val params = PaymentMethodCreateParams.create( | ||
bacsDebit = PaymentMethodCreateParams.BacsDebit( | ||
accountNumber = "00012345", | ||
sortCode = "108800" | ||
), | ||
billingDetails = PaymentMethod.BillingDetails() | ||
) | ||
|
||
assertThat( | ||
PaymentMethodCreateParams.createBacsFromParams(params) | ||
).isEqualTo( | ||
PaymentMethodCreateParams.BacsDebit( | ||
accountNumber = "00012345", | ||
sortCode = "108800" | ||
) | ||
) | ||
|
||
val overrideParams = PaymentMethodCreateParams.createWithOverride( | ||
code = "bacs_debit", | ||
overrideParamMap = mapOf( | ||
"bacs_debit" to mapOf( | ||
"account_number" to "00012345", | ||
"sort_code" to "108800" | ||
) | ||
), | ||
productUsage = setOf(), | ||
requiresMandate = false | ||
) | ||
|
||
assertThat( | ||
PaymentMethodCreateParams.createBacsFromParams(overrideParams) | ||
).isEqualTo( | ||
PaymentMethodCreateParams.BacsDebit( | ||
accountNumber = "00012345", | ||
sortCode = "108800" | ||
) | ||
) | ||
} | ||
|
||
@Test | ||
fun `getNameFromOverrideParams should return name from billing details if available`() { | ||
val params = PaymentMethodCreateParams.create( | ||
card = PaymentMethodCreateParams.Card(), | ||
billingDetails = PaymentMethod.BillingDetails( | ||
name = "John Doe" | ||
) | ||
) | ||
|
||
assertThat( | ||
PaymentMethodCreateParams.getNameFromParams(params) | ||
).isEqualTo("John Doe") | ||
|
||
val overrideParams = PaymentMethodCreateParams.createWithOverride( | ||
code = "bacs_debit", | ||
overrideParamMap = mapOf( | ||
"billing_details" to mapOf( | ||
"name" to "John Doe" | ||
) | ||
), | ||
productUsage = setOf(), | ||
requiresMandate = false | ||
) | ||
|
||
assertThat( | ||
PaymentMethodCreateParams.getNameFromParams(overrideParams) | ||
).isEqualTo("John Doe") | ||
} | ||
|
||
@Test | ||
fun `getEmailFromOverrideParams should return email from billing details if available`() { | ||
val params = PaymentMethodCreateParams.create( | ||
card = PaymentMethodCreateParams.Card(), | ||
billingDetails = PaymentMethod.BillingDetails( | ||
email = "[email protected]" | ||
) | ||
) | ||
|
||
assertThat( | ||
PaymentMethodCreateParams.getEmailFromParams(params) | ||
).isEqualTo("[email protected]") | ||
|
||
val overrideParams = PaymentMethodCreateParams.createWithOverride( | ||
code = "card", | ||
overrideParamMap = mapOf( | ||
"billing_details" to mapOf( | ||
"email" to "[email protected]" | ||
) | ||
), | ||
productUsage = setOf(), | ||
requiresMandate = false | ||
) | ||
|
||
assertThat( | ||
PaymentMethodCreateParams.getEmailFromParams(overrideParams) | ||
).isEqualTo("[email protected]") | ||
} | ||
|
||
private fun createFpx(): PaymentMethodCreateParams { | ||
return PaymentMethodCreateParams.create( | ||
PaymentMethodCreateParams.Fpx(bank = "hsbc"), | ||
|
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
Oops, something went wrong.