-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NT-262] Remember this card added to mutation (#856)
* Ensure initial card selected notifies delegate * Add reusable param to CreatePaymentSourceInput * Don't be silly * Switch off by default * Combine delegate methods, update tests, move constructor to extension * Put dismissal back * Use .values()
- Loading branch information
1 parent
57ddae9
commit 39dc6dd
Showing
36 changed files
with
186 additions
and
77 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Foundation | ||
import KsApi | ||
|
||
extension CreatePaymentSourceInput { | ||
internal static func input( | ||
fromToken token: String, | ||
stripeCardId: String, | ||
reusable: Bool | ||
) -> CreatePaymentSourceInput { | ||
return CreatePaymentSourceInput( | ||
paymentType: PaymentType.creditCard, | ||
reusable: reusable, | ||
stripeToken: token, | ||
stripeCardId: stripeCardId | ||
) | ||
} | ||
} |
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,33 @@ | ||
import Foundation | ||
@testable import KsApi | ||
@testable import Library | ||
import Prelude | ||
import XCTest | ||
|
||
final class CreatePaymentSourceInput_ConstructorTests: TestCase { | ||
func testCreatePaymentSourceInput_Reusable() { | ||
let input = CreatePaymentSourceInput.input( | ||
fromToken: "token", | ||
stripeCardId: "cardId", | ||
reusable: true | ||
) | ||
|
||
XCTAssertEqual(input.paymentType, PaymentType.creditCard) | ||
XCTAssertEqual(input.stripeToken, "token") | ||
XCTAssertEqual(input.stripeCardId, "cardId") | ||
XCTAssertEqual(input.reusable, true) | ||
} | ||
|
||
func testCreatePaymentSourceInput_SingleUse() { | ||
let input = CreatePaymentSourceInput.input( | ||
fromToken: "token", | ||
stripeCardId: "cardId", | ||
reusable: false | ||
) | ||
|
||
XCTAssertEqual(input.paymentType, PaymentType.creditCard) | ||
XCTAssertEqual(input.stripeToken, "token") | ||
XCTAssertEqual(input.stripeCardId, "cardId") | ||
XCTAssertEqual(input.reusable, false) | ||
} | ||
} |
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.