Skip to content
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

3DS Result Object Refactor #845

Merged
merged 16 commits into from
Dec 12, 2023
Merged

3DS Result Object Refactor #845

merged 16 commits into from
Dec 12, 2023

Conversation

sarahkoop
Copy link
Contributor

Summary of changes

  • Refactor all public methods in 3DS module to have single parameter callbacks with single result objects.
  • This is a bit more complex than other modules because the previous ThreeDSecureResult object was used throughout the flow to contain the lookup and nonce after the initial lookup call, and after the completion of authentication flow.
  • Update to make the previous ThreeDSecureResult object into a ThreeDSecureParams class - used to launch the ThreeDSecureLauncher, and made all fields except ThreeDSecureLookup private on that class (so merchants can still access intermediate lookup params if desired).
  • Added ThreeDSecurePaymentAuthRequest object with a ReadyToLaunch state that contains the ThreeDSecureParams, and a LaunchNotRequired state that represents a successful 3DS flow where no additional authentication challenge was required. The LaunchNotRequired contains nonce and lookup. The nonce and lookup also do exist on the ThreeDSecureParams object, but for integration clarity they are separated.
  • Add ThreeDSecureResult for the completion of tokenization (full auth challenge completion), which just returns a nonce on success - through testing it appears that we don't receive the lookup from this API call, so it is not returned again here.

Open to suggestions on any changes to make the integration pattern more clear

Checklist

  • Added a changelog entry

Authors

@sarahkoop sarahkoop requested a review from a team as a code owner December 6, 2023 21:32
@@ -0,0 +1,46 @@
{
"formatVersion": 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember seeing this json schema file in another PR. Is it supposed to be in this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah no - it was merged in with another PR so now removed 👍

private void handlePaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
super.onPaymentMethodNonceCreated(paymentMethodNonce);

final FragmentActivity activity = getActivity();
if (!threeDSecureRequested && paymentMethodNonce instanceof CardNonce &&
Settings.isThreeDSecureEnabled(activity)) {
Settings.isThreeDSecureEnabled(activity) && !(paymentMethodNonce instanceof ThreeDSecureNonce)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

random: Always felt like it would make sense to give 3DSecure its own Demo fragment one day.

Copy link
Contributor

@sshropshire sshropshire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌊

Copy link
Collaborator

@tdchow tdchow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loving the single result object in favor of the result and error params 🙌

v5_MIGRATION_GUIDE.md Outdated Show resolved Hide resolved
@sarahkoop sarahkoop merged commit 91217f7 into v5 Dec 12, 2023
2 checks passed
@sarahkoop sarahkoop deleted the 3ds_result_object branch December 12, 2023 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants