Skip to content

Commit da00221

Browse files
committed
Updating to latest applepay capabilities code.
1 parent fd6a746 commit da00221

File tree

8 files changed

+24
-9
lines changed

8 files changed

+24
-9
lines changed

TapApplePayKit-Example/EssentialSetupViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class EssentialSetupViewController: UIViewController {
2121
super.viewDidLoad()
2222
loadingIndicator.isHidden = true
2323
// First define your environment
24-
TapApplePay.sdkMode = .production
24+
TapApplePay.sdkMode = .sandbox
2525
// Second define your transaction & merchant details
2626
setupApplePayRequest()
2727
// Do any additional setup after loading the view.
@@ -30,7 +30,7 @@ class EssentialSetupViewController: UIViewController {
3030
/// Call this to first define your transaction & merchant details
3131
func setupApplePayRequest() {
3232
myTapApplePayRequest.build(paymentAmount: 0.1, applePayMerchantID: "merchant.tap.gosell")
33-
myTapApplePayRequest.build(paymentNetworks: [.Mada,.Visa,.MasterCard], paymentItems: [], paymentAmount:0.1, currencyCode: .KWD,applePayMerchantID:"merchant.tap.gosell", merchantCapabilities: [.capability3DS,.capabilityCredit,.capabilityDebit,.capabilityEMV])
33+
myTapApplePayRequest.build(paymentNetworks: [.Visa,.MasterCard], paymentItems: [], paymentAmount:0.1, currencyCode: .KWD,applePayMerchantID:"merchant.tap.gosell", merchantCapabilities: [.threeDSecure,.credit,.debit,.emv])
3434
}
3535

3636

TapApplePayKit-Example/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ViewController: UIViewController {
2727
// Do any additional setup after loading the view.
2828

2929
myTapApplePayRequest.build(paymentAmount: 0.1, applePayMerchantID: "merchant.tap.gosell")
30-
myTapApplePayRequest.build(paymentNetworks: [.Mada,.Visa,.MasterCard], paymentItems: [], paymentAmount:0.1, currencyCode: .KWD,applePayMerchantID:"merchant.tap.gosell", merchantCapabilities: [.capability3DS,.capabilityCredit,.capabilityDebit,.capabilityEMV])
30+
myTapApplePayRequest.build(paymentNetworks: [.Visa,.MasterCard], paymentItems: [], paymentAmount:0.1, currencyCode: .KWD,applePayMerchantID:"merchant.tap.gosell", merchantCapabilities: [.threeDSecure,.credit,.debit,.emv])
3131
featuresTableView.dataSource = self
3232
featuresTableView.delegate = self
3333

TapApplePayKit-iOS.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |spec|
1616
#
1717

1818
spec.name = "TapApplePayKit-iOS"
19-
spec.version = "1.0.26"
19+
spec.version = "1.0.27"
2020
spec.summary = "Provide an interface and an easy wrapper for Apple Pay functionalities."
2121

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

TapApplePayKit-iOS.xcodeproj/xcuserdata/osamarabie.xcuserdatad/xcschemes/xcschememanagement.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
<key>TapApplePayKit-Example.xcscheme_^#shared#^_</key>
88
<dict>
99
<key>orderHint</key>
10-
<integer>16</integer>
10+
<integer>17</integer>
1111
</dict>
1212
<key>TapApplePayKit-iOS.xcscheme_^#shared#^_</key>
1313
<dict>
1414
<key>orderHint</key>
15-
<integer>17</integer>
15+
<integer>16</integer>
1616
</dict>
1717
</dict>
1818
</dict>
Binary file not shown.

TapApplePayKit-iOS/Core/private/Network/NetworkManagerExtension.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,19 @@ Hj+N6UWFOYK98Xi+sQIDAQAB
139139
simCountryISO = carrier.isoCountryCode
140140
}
141141

142+
let result2: [String: String] = [
143+
Constants.HTTPHeaderValueKey.appID: bundleID,
144+
Constants.HTTPHeaderValueKey.requirer:Constants.HTTPHeaderValueKey.requirerValue,
145+
Constants.HTTPHeaderValueKey.requirerVersion:requirerVersion,
146+
Constants.HTTPHeaderValueKey.requirerOS: osName,
147+
Constants.HTTPHeaderValueKey.requirerOSVersion: osVersion,
148+
Constants.HTTPHeaderValueKey.requirerDeviceName: deviceNameFiltered,
149+
Constants.HTTPHeaderValueKey.requirerDeviceType: deviceType,
150+
Constants.HTTPHeaderValueKey.requirerDeviceModel: deviceModel,
151+
Constants.HTTPHeaderValueKey.requirerSimNetworkName: simNetWorkName ?? "",
152+
Constants.HTTPHeaderValueKey.requirerSimCountryIso: simCountryISO ?? ""
153+
]
154+
142155

143156
let result: [String: String] = [
144157
Constants.HTTPHeaderValueKey.appID: Crypter.encrypt(bundleID, using: NetworkManager.headersEncryptionPublicKey) ?? "",
0 Bytes
Binary file not shown.

TapApplePayKit-iOS/Core/public/Models/TapApplePayRequest.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import enum CommonDataModelsKit_iOS.TapCurrencyCode
2424
public lazy var paymentAmount:Double = 0
2525
/// The apple pay merchant identefier
2626
public lazy var applePayMerchantID:String = ""
27+
/// The apple pay merchant identefier
28+
public lazy var merchantCapabilities:PKMerchantCapability = [.credit,.debit,.threeDSecure]
2729

2830
/// The actual apple pay request
2931
public lazy var appleRequest:PKPaymentRequest = .init()
@@ -40,13 +42,13 @@ import enum CommonDataModelsKit_iOS.TapCurrencyCode
4042
- Parameter applePayMerchantID: The apple pay merchant identefier default ""
4143
- Parameter recurringPaymentRequest: Defines the recurring payment request Please check [Apple Pay docs](https://developer.apple.com/documentation/passkit/pkrecurringpaymentrequest). NOTE: This will only be availble for iOS 16+ and subscripion parameter is on.
4244
**/
43-
public func build(paymentNetworks:[TapApplePayPaymentNetwork] = [.Amex,.Visa,.MasterCard], paymentItems:[PKPaymentSummaryItem] = [], paymentAmount:Double,currencyCode:TapCurrencyCode = .USD,applePayMerchantID:String,merchantCapabilities:PKMerchantCapability = [.capability3DS,.capabilityCredit,.capabilityDebit,.capabilityEMV], recurringPaymentRequest:Any? = nil) {
45+
public func build(paymentNetworks:[TapApplePayPaymentNetwork] = [.Amex,.Visa,.MasterCard], paymentItems:[PKPaymentSummaryItem] = [], paymentAmount:Double,currencyCode:TapCurrencyCode = .USD,applePayMerchantID:String,merchantCapabilities:PKMerchantCapability = [.credit,.debit,.emv,.threeDSecure], recurringPaymentRequest:Any? = nil) {
4446
self.paymentNetworks = paymentNetworks
4547
self.paymentItems = paymentItems
4648
self.paymentAmount = paymentAmount
4749
self.currencyCode = currencyCode
4850
self.applePayMerchantID = applePayMerchantID
49-
51+
self.merchantCapabilities = merchantCapabilities
5052
// Correctly define the recurring request
5153
if #available(iOS 16.0, *),
5254
let correctRecurring:PKRecurringPaymentRequest = recurringPaymentRequest as? PKRecurringPaymentRequest {
@@ -74,7 +76,7 @@ import enum CommonDataModelsKit_iOS.TapCurrencyCode
7476
appleRequest.paymentSummaryItems.append(.init(label: "\(TapApplePay.intitModelResponse?.data.merchant?.name ?? "")", amount: NSDecimalNumber(value: paymentAmount)))
7577
appleRequest.supportedNetworks = paymentNetworks.map{ $0.applePayNetwork! }
7678
appleRequest.merchantIdentifier = applePayMerchantID
77-
appleRequest.merchantCapabilities = [.capability3DS]
79+
appleRequest.merchantCapabilities = merchantCapabilities
7880
// Check subscription details
7981
if #available(iOS 16.0, *),
8082
let correctRecurring:PKRecurringPaymentRequest = recurringPaymentRequest as? PKRecurringPaymentRequest {

0 commit comments

Comments
 (0)