-
Notifications
You must be signed in to change notification settings - Fork 295
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
[V7] Add Encodable
protocol for PayPal Vault
#1492
base: paypal-checkout-encodable
Are you sure you want to change the base?
Conversation
… and Vault encodable objects
@@ -401,6 +403,21 @@ import BraintreeDataCollector | |||
} | |||
} | |||
} | |||
|
|||
private func encodedPostBody(fromRequest payPalRequest: BTPayPalRequest, configuration: BTConfiguration) -> Encodable? { |
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.
private func encodedPostBody(fromRequest payPalRequest: BTPayPalRequest, configuration: BTConfiguration) -> Encodable? { | |
private func encodedPostBody(from payPalRequest: BTPayPalRequest, configuration: BTConfiguration) -> Encodable? { |
@@ -401,6 +403,21 @@ import BraintreeDataCollector | |||
} | |||
} | |||
} | |||
|
|||
private func encodedPostBody(fromRequest payPalRequest: BTPayPalRequest, configuration: BTConfiguration) -> Encodable? { | |||
if let checkoutRequest = payPalRequest as? BTPayPalCheckoutRequest { |
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.
Could we instead do a switch here on payPalRequest.paymentType
?
@@ -114,6 +119,8 @@ public enum BTPayPalError: Error, CustomNSError, LocalizedError, Equatable { | |||
return "Missing BA Token for PayPal App Switch." | |||
case .missingPayPalRequest: | |||
return "The PayPal Request was missing or invalid." | |||
case .failedToCreateEncodable: | |||
return "Unable to create Encodable object" |
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.
This may make it a bit more clear, but take it or leave it:
return "Unable to create Encodable object" | |
return "The request was not a Checkout or Vault request." |
@@ -350,19 +350,21 @@ import BraintreeDataCollector | |||
|
|||
self.isConfigFromCache = configuration.isFromCache | |||
|
|||
guard json["paypalEnabled"].isTrue else { | |||
guard configuration.isPayPalEnabled else { |
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 also remove let json = configuration.json
above on line 346
Summary of changes
post
bodies used in the PayPal Vault flow.Checklist
[ ] Added a changelog entryAuthors