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

[v7] Update BTThreeDSecureRequest Parameters #1452

Open
wants to merge 11 commits into
base: v7
Choose a base branch
from

Conversation

agedd
Copy link
Contributor

@agedd agedd commented Nov 1, 2024

Summary of changes

  • Update BTThreeDSecureRequest properties to have everything in the init vs using dot syntax
  • Update related unit tests
  • Confirmed with the gateway on questions around required vs optional parameters

Checklist

  • Added a changelog entry

Authors

List GitHub usernames for everyone who contributed to this pull request.

@agedd agedd marked this pull request as ready for review November 5, 2024 17:48
@agedd agedd requested a review from a team as a code owner November 5, 2024 17:48
@agedd agedd changed the title Update BTThreeDSecureRequest Required Parameters Update BTThreeDSecureRequest Parameters Nov 5, 2024
@agedd agedd changed the title Update BTThreeDSecureRequest Parameters [v7] Update BTThreeDSecureRequest Parameters Nov 5, 2024
@agedd agedd added the v7 label Nov 5, 2024
Copy link
Contributor

@warmkesselj warmkesselj left a comment

Choose a reason for hiding this comment

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

One comment but it's not a blocker. Approving ahead of time.

Sources/BraintreeThreeDSecure/BTThreeDSecureRequest.swift Outdated Show resolved Hide resolved
Sources/BraintreeThreeDSecure/BTThreeDSecureRequest.swift Outdated Show resolved Hide resolved
Sources/BraintreeThreeDSecure/BTThreeDSecureRequest.swift Outdated Show resolved Hide resolved
Sources/BraintreeThreeDSecure/BTThreeDSecureRequest.swift Outdated Show resolved Hide resolved
public init(
accountType: BTThreeDSecureAccountType = .unspecified,
additionalInformation: BTThreeDSecureAdditionalInformation? = nil,
amount: NSDecimalNumber? = 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Based on this logic it looks like both amount and the delegate may be required:

if request.amount?.decimalValue.isNaN == true || request.amount == nil {
NSLog("%@ BTThreeDSecureRequest amount can not be nil or NaN.", BTLogLevelDescription.string(for: .critical))
let error = BTThreeDSecureError.configuration("BTThreeDSecureRequest amount can not be nil or NaN.")
notifyFailure(with: error, completion: completion)
return
}
if request.threeDSecureRequestDelegate == nil {
let message = "Configuration Error: threeDSecureRequestDelegate can not be nil when versionRequested is 2."
let error = BTThreeDSecureError.configuration(message)
notifyFailure(with: error, completion: completion)
return
}

Copy link
Contributor Author

@agedd agedd Nov 12, 2024

Choose a reason for hiding this comment

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

ahh yep, good catch! the amount does seem to be required (i've also confirmed this by raising a BT 3D Secure General Inquiry workflow request) - as for the delegate, it seems that it was also previously optional so i wonder if it's okay to leave that as is 👀

CHANGELOG.md Outdated Show resolved Hide resolved
accountType: BTThreeDSecureAccountType = .unspecified,
additionalInformation: BTThreeDSecureAdditionalInformation? = nil,
billingAddress: BTThreeDSecurePostalAddress? = nil,
_cardAddChallenge: BTThreeDSecureCardAddChallenge = .unspecified,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we can probably just leave this out of the init for now then remove it in the ticket to remove the property completely. If that's more work than it's worth though, feel free to leave and we can hopefully pick up that cleanup ticket soon!

/// - uiType: Optional: Sets all UI types that the device supports for displaying specific challenge user interfaces in the 3D Secure challenge. Defaults to `.both`
/// - v2UICustomization: Optional. UI Customization for 3DS2 challenge views.
public init(
amount: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 I am getting an error with the amount as a string in the demo app. Are we sure this is valid? It looks like a Double works as expected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm yea i'm a bit confused on this - i also feel amount as Double makes more sense (and this aligns with what is mentioned in our iOS BT Dev Docs) but after asking here #bt-service-3dsecure and checking the android equivalent it looks like they define amount as a string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants