-
Notifications
You must be signed in to change notification settings - Fork 975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Multibanco bindings and PaymentSheet support #3531
Conversation
StripePayments+ @objc final public let entity: Swift.String
+ @objc final public let reference: Swift.String
+ @objc final public let expiresAt: Foundation.Date
+ @objc final public let hostedVoucherURL: Foundation.URL
+ @objc public var allResponseFields: [Swift.AnyHashable : Any] {
+ get
+ }
+ @objc override dynamic public var description: Swift.String {
+ @objc get
+ }
+ @objc public static func decodedObject(fromAPIResponse response: [Swift.AnyHashable : Any]?) -> Self?
+ @objc deinit
+ @objc public var multibanco: StripePayments.STPPaymentMethodMultibanco? {
+ get
+ }
+ case multibanco
+ @objc public var multibanco: StripePayments.STPPaymentMethodMultibancoParams?
+ @objc convenience public init(multibanco: StripePayments.STPPaymentMethodMultibancoParams, billingDetails: StripePayments.STPPaymentMethodBillingDetails?, metadata: [Swift.String : Swift.String]?)
+ @objc public var allResponseFields: [Swift.AnyHashable : Any] {
+ get
+ }
+ @objc override dynamic public var description: Swift.String {
+ @objc get
+ }
+ @objc public static func decodedObject(fromAPIResponse response: [Swift.AnyHashable : Any]?) -> Self?
+ @objc deinit
+ case multibancoDisplayDetails
+ @objc final public let multibancoDisplayDetails: StripePayments.STPIntentActionMultibancoDisplayDetails?
+ @objc public var additionalAPIParameters: [Swift.AnyHashable : Any]
+ @objc public static func rootObjectName() -> Swift.String?
+ @objc public static func propertyNamesToFormFieldNamesMapping() -> [Swift.String : Swift.String]
+ @objc override dynamic public init()
+ @objc deinit If you are adding a new public API consider the following:
If you are modifying or removing a public API:
If you confirm these APIs need to be added/updated and have undergone necessary review, add the label |
createExpectation.fulfill() | ||
clientSecret = createdClientSecret |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fulfill should probably happen after
clientSecret = createdClientSecret
let client = STPAPIClient(publishableKey: STPTestingDefaultPublishableKey) | ||
let expectation = self.expectation(description: "Payment Intent confirm") | ||
|
||
let paymentIntentParams = STPPaymentIntentParams(clientSecret: clientSecret!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid clientSecret!
:
waitForExpectations(...)
guard let clientSecret = clientSecret else {
XCTFail("")
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used XCTUnwrap
!
paymentIntentParams.returnURL = "example-app-scheme://unused" | ||
client.confirmPaymentIntent(with: paymentIntentParams) { paymentIntent, error in | ||
XCTAssertNil(error, "With valid key + secret, should be able to confirm the intent") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might better to:
guard let paymentIntent= paymentIntent else {
XCTFail()
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried to use XCTUnwrap
but the complier complains for some reason inside of a closure.
case .amazonPay: | ||
self.amazonPay = STPPaymentMethodAmazonPayParams() | ||
case .alma: | ||
self.alma = STPPaymentMethodAlmaParams() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops -- i guess this was broken before. Thanks for fixing.
self.alma = STPPaymentMethodAlmaParams() | ||
case .multibanco: | ||
self.multibanco = STPPaymentMethodMultibancoParams() | ||
self.billingDetails = paymentMethod.billingDetails |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.billingDetails = paymentMethod.billingDetails
is being set prior to the case statement. this doesn't seem needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, didn't see that
@@ -264,6 +274,10 @@ public class STPIntentAction: NSObject { | |||
if let swishHandleRedirect = swishHandleRedirect { | |||
props.append("swishHandleRedirect = \(swishHandleRedirect)") | |||
} | |||
case .multibancoDisplayDetails: | |||
if let multibancoDisplayDetails = multibancoDisplayDetails { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we can get away with just if let multibancoDisplayDetails {
self | ||
), | ||
// MultibancoDisplayDetails | ||
"number = \(String(describing: entity))", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is calling the entity
a 'number' intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope! Good catch.
Summary
Bindings
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-04-22.at.10.51.31.mp4
PaymentSheet
Simulator.Screen.Recording.-.iPhone.15.Plus.-.2024-04-23.at.09.26.24.mp4
Motivation
https://docs.google.com/document/d/1QVT2zuwkz9IFTBNyjsYV_zzfeOsWva8gpSz2vXPHfW8/edit
Testing
Changelog
See diff