-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Cardinal UI Type and Render Types (#1134)
* Add uiType to BTThreeDSecureRequest * Add renderTypes to BTThreeDSecureRequest * Set default parameters in Demo app (from Cardinal docs) * Add unit tests * Android PR for this change: Add Cardinal UI Type and Render Type braintree_android#738 - we finally heard back from the merchants that these worked as expected, so exposing them on iOS
- Loading branch information
1 parent
74f056a
commit 93d3321
Showing
8 changed files
with
137 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,6 +98,8 @@ class ThreeDSecureViewController: PaymentButtonBaseViewController { | |
request.requestedExemptionType = .lowValue | ||
request.email = "[email protected]" | ||
request.shippingMethod = .sameDay | ||
request.uiType = .both | ||
request.renderTypes = [.otp, .singleSelect, .multiSelect, .oob, .html] | ||
|
||
let billingAddress = BTThreeDSecurePostalAddress() | ||
billingAddress.givenName = "Jill" | ||
|
44 changes: 44 additions & 0 deletions
44
Sources/BraintreeThreeDSecure/BTThreeDSecureRenderType.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import Foundation | ||
import CardinalMobile | ||
|
||
/// Render types that the device supports for displaying specific challenge user interfaces within the 3D Secure challenge. | ||
@objcMembers public class BTThreeDSecureRenderType: NSObject, OptionSet { | ||
|
||
public let rawValue: Int | ||
|
||
required public init(rawValue: Int) { | ||
self.rawValue = rawValue | ||
} | ||
|
||
/// OTP | ||
public static let otp = BTThreeDSecureRenderType(rawValue: 1) | ||
|
||
/// HTML | ||
public static let html = BTThreeDSecureRenderType(rawValue: 2) | ||
|
||
/// Single select | ||
public static let singleSelect = BTThreeDSecureRenderType(rawValue: 3) | ||
|
||
/// Multi Select | ||
public static let multiSelect = BTThreeDSecureRenderType(rawValue: 4) | ||
|
||
/// OOB | ||
public static let oob = BTThreeDSecureRenderType(rawValue: 5) | ||
|
||
var cardinalValue: String { | ||
switch self { | ||
case .otp: | ||
return CardinalSessionRenderTypeOTP | ||
case .html: | ||
return CardinalSessionRenderTypeHTML | ||
case .singleSelect: | ||
return CardinalSessionRenderTypeSingleSelect | ||
case .multiSelect: | ||
return CardinalSessionRenderTypeMultiSelect | ||
case .oob: | ||
return CardinalSessionRenderTypeOOB | ||
default: | ||
return "" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Foundation | ||
import CardinalMobile | ||
|
||
/// The interface types that the device supports for displaying specific challenge user interfaces within the 3D Secure challenge. | ||
@objc public enum BTThreeDSecureUIType: Int { | ||
|
||
/// Native | ||
case native | ||
|
||
/// HTML | ||
case html | ||
|
||
/// Both | ||
case both | ||
|
||
var cardinalValue: CardinalSessionUIType { | ||
switch self { | ||
case .native: | ||
return .native | ||
case .html: | ||
return .HTML | ||
case .both: | ||
return .both | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters