Skip to content

Commit

Permalink
Add customFields for 3DS verifyCard (#1339)
Browse files Browse the repository at this point in the history
* Add customFields for 3DS verifyCard

* update changelog

* Update changelog

* Use [String : String] property for customFields
  • Loading branch information
warmkesselj authored Jul 2, 2024
1 parent 256b178 commit 8bff398
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Braintree iOS SDK Release Notes

## unreleased
* BraintreeThreeDSecure
* Add `customFields` param to `BTThreeDSecureRequest`
* BraintreeCore
* For analytics, only call `fetchOrReturnRemoteConfig()` when batch uploading, not on each analytic event enqueue
* For analytics, add additional metrics on networking timing
Expand Down
7 changes: 7 additions & 0 deletions Demo/Application/Features/ThreeDSecureViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ class ThreeDSecureViewController: PaymentButtonBaseViewController {

private func createThreeDSecureRequest(with nonce: String) -> BTThreeDSecureRequest {
let request = BTThreeDSecureRequest()

let customFields = [
"test" : "test",
"test1": "test1",
]

request.customFields = customFields
request.threeDSecureRequestDelegate = self
request.amount = 10.32
request.nonce = nonce
Expand Down
3 changes: 2 additions & 1 deletion Sources/BraintreeThreeDSecure/BTThreeDSecureClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ import BraintreeCore
"challengeRequested": request.challengeRequested,
"exemptionRequested": request.exemptionRequested,
"requestedExemptionType": request.requestedExemptionType.stringValue,
"dataOnlyRequested": request.dataOnlyRequested
"dataOnlyRequested": request.dataOnlyRequested,
"customFields": request.customFields
]

if request._cardAddChallenge == .requested || request.cardAddChallengeRequested == true {
Expand Down
3 changes: 3 additions & 0 deletions Sources/BraintreeThreeDSecure/BTThreeDSecureRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import BraintreeCore

/// A nonce to be verified by ThreeDSecure
public var nonce: String?

/// Object where each key is the name of a custom field which has been configured in the Control Panel. In the Control Panel you can configure 3D Secure Rules which trigger on certain values.
public var customFields: [String: String]? = nil

/// The amount for the transaction
public var amount: NSDecimalNumber? = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ class BTThreeDSecureRequest_Tests: XCTestCase {

// MARK: - accountTypeAsString

func testCustomFields_notNil() {
let request = BTThreeDSecureRequest()
XCTAssertNil(request.customFields)

request.customFields = ["test": "test"]
XCTAssertNotNil(request.customFields)
}

func testAccountTypeAsString_whenAccountTypeIsCredit_returnsCredit() {
let request = BTThreeDSecureRequest()
request.accountType = .credit
Expand Down

0 comments on commit 8bff398

Please sign in to comment.