Skip to content

Commit da2b67a

Browse files
Merge pull request #26 from dojo-engineering/develop
VT support
2 parents 22ddbcc + a0b4c31 commit da2b67a

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

ExampleSwift/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PODS:
22
- CocoaDebug (1.7.2)
3-
- dojo-ios-sdk (1.2.0)
4-
- dojo-ios-sdk/dojo-ios-sdk-tests (1.2.0)
3+
- dojo-ios-sdk (1.3.0)
4+
- dojo-ios-sdk/dojo-ios-sdk-tests (1.3.0)
55

66
DEPENDENCIES:
77
- CocoaDebug
@@ -18,7 +18,7 @@ EXTERNAL SOURCES:
1818

1919
SPEC CHECKSUMS:
2020
CocoaDebug: 61cf93ada6ce8f3407507dc01f9b874d91ac1d5c
21-
dojo-ios-sdk: f1e7bf0ed7da53eb4d751aa675e924e824e31f20
21+
dojo-ios-sdk: abbcf8f3d0720b2a25fb3196491890c6fd495fcb
2222

2323
PODFILE CHECKSUM: b2b5d1609b738e12e581a6bfa0dea4faab63e9f4
2424

Sources/dojo-ios-sdk/Classes/DojoSDK.swift

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ protocol DojoSDKProtocol {
1414
debugConfig: DojoSDKDebugConfig?,
1515
fromViewController: UIViewController,
1616
completion: ((Int) -> Void)?)
17+
static func executeVirtualTerminalPayment(token: String,
18+
payload: DojoCardPaymentPayload,
19+
debugConfig: DojoSDKDebugConfig?,
20+
completion: ((Int) -> Void)?)
1721
static func executeSavedCardPayment(token: String,
1822
payload: DojoSavedCardPaymentPayload,
1923
debugConfig: DojoSDKDebugConfig?,
@@ -73,6 +77,22 @@ protocol DojoSDKProtocol {
7377
completion: completion)
7478
}
7579

80+
/// Execute virtual terminal payment
81+
/// - Parameters:
82+
/// - token: Payment secret obtained from a paymentIIntent object.
83+
/// - payload: Payment configuration and data.
84+
/// - debugConfig: optional debug config
85+
/// - completion: Result of the payment.
86+
@objc public static func executeVirtualTerminalPayment(token: String,
87+
payload: DojoCardPaymentPayload,
88+
debugConfig: DojoSDKDebugConfig?,
89+
completion: ((Int) -> Void)?) {
90+
internalExecuteVirtualTerminalPayment(token: token,
91+
payload: payload,
92+
debugConfig: debugConfig,
93+
completion: completion)
94+
}
95+
7696
/// Execute ApplePay payment
7797
/// - Parameters:
7898
/// - paymentIntent: Payment intent [reference](https://docs.dojo.tech/api#tag/Payment-intents)
@@ -196,4 +216,21 @@ private extension DojoSDK {
196216
}
197217
}
198218
}
219+
220+
private static func internalExecuteVirtualTerminalPayment(token: String,
221+
payload: DojoCardPaymentPayloadProtocol,
222+
debugConfig: DojoSDKDebugConfig? = nil,
223+
completion: ((Int) -> Void)?) {
224+
let networkService = NetworkService(timeout: 25)
225+
networkService.performCardPayment(token: token, payload: payload, debugConfig: debugConfig) { cardPaymentResult in
226+
switch cardPaymentResult {
227+
case .threeDSRequired(_, _):
228+
sendCompletionOnMainThread(result: DojoSDKResponseCode.sdkInternalError.rawValue, completion: completion)
229+
case .result(let resultCode):
230+
sendCompletionOnMainThread(result: resultCode, completion: completion)
231+
default:
232+
sendCompletionOnMainThread(result: DojoSDKResponseCode.sdkInternalError.rawValue, completion: completion)
233+
}
234+
}
235+
}
199236
}

dojo-ios-sdk.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'dojo-ios-sdk'
11-
s.version = '1.2.1'
11+
s.version = '1.3.0'
1212
s.summary = 'Dojo Payment SDK'
1313

1414
# This description is used to generate tags and improve search results.

0 commit comments

Comments
 (0)