-
Notifications
You must be signed in to change notification settings - Fork 30
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
FPTI Updates #208
FPTI Updates #208
Conversation
Co-authored-by: Justin Warmkessel <[email protected]>
The API requests in the CardModule also return a riskCorrelationID as a response header (see Android). Should we also log the correlationID in the card module where possible? It also looks like we're mis-aligned with Android since they return riskCorrelationID in merchant-facing errors and iOS is not (slightly separate concern though). |
Adding breakpoints in the request/response I am not seeing those headers. Additionally looking at
The networking layers and confirm payment source request/response parsing on Android and iOS are pretty divergent right now. I put up this commit which extracts the correlation/debug ID from the
I think we can probably punt on this for now. We should align card as a whole more closely across the platforms as they are pretty different right now. |
let httpResponseBodyJSON = try? JSONSerialization.jsonObject(with: httpResponse.body ?? Data()) as? [String: Any] | ||
correlationID = httpResponseBodyJSON?["debug_id"] as? String | ||
|
||
return try HTTPResponseParser().parseREST(httpResponse, as: ConfirmPaymentSourceResponse.self) |
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 should 🏈 do this work in a separate PR/ workstream (for parsing out the riskCorrelationID from the body or response headers). If it's in the body, this should be included in the call on line 49, and added to ConfirmPaymentSourceResponse
model.
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.
If it's in the body, this should be included in the call on like 49, and added to ConfirmPaymentSourceResponse model.
Yeah - that's why I mentioned the entire layer would likely need to be rewritten. It's only returned when there is an error, so we don't actually return a ConfirmPaymentSourceResponse
when a debug_id
is present since the SDK throws an error as part of the try at that point. Adding it to the response would mean it's always nil
since we only get a ConfirmPaymentSourceResponse
on success (and there is no debug_id
on success according to PPaaS)
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.
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.
Maybe in another ticket we can dig into when we expect that value to come in the error body, or in the response headers and which to prefer when 🏈
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.
Yeah - If we add it to those thrown errors (from here), we'd end up needing to parse the error again on the client to extract out the debug ID from the thrown error. It could make more sense to return a result object or closure as part of parseREST
as well as update CheckoutOrdersAPI
to do the same. Or we can take the same approach as web and just return it with all errors.
It's certainly a bit of an odd series of events and would be a good opportunity to align with Android on! Looking between the two codebases for this certainly illustrated how different this layer is in particular. I'll revert this for now in any case!
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.
Reverted: b031319
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.
Actual changes look good! Thanks for entertaining all of my ❓s!
Reason for changes
Update component name to match Braintree formatting (BT PR with this change) as will as send correlation ID where possible (BT PR with this change)
Feedback: currently the correlation ID was only added to the MXO flow. On BT PayPal Web we pull this value from the request (if present) or the Data Collector (source code). PPCP PayPal Web does not have the Data Collector as a dependency - we should consider if we want to add this dependency in a future PR or leave the correlation ID as is - only existing in NXO.
Note: We will make this same change on Android as well.
Summary of changes
component
fromppcpmobilesdk
toppcpclientsdk
AnalyticsService
to accept an optionalcorrelationID
parametercorrelationID
& send in analytics forPayPalNativeCheckoutClient
when presentChecklist
Authors