Skip to content

Commit

Permalink
Prepare Release 1.1.0 (#14)
Browse files Browse the repository at this point in the history
* chore: Include swiftlint

* feat: Plugin init + Setup Configurations (#1)

Initialise plugin with required structure.
Create structure to deal with Apple Pay. Despite being ready to deal with any kind of dictionary, provide an accelerator to read the configuration from the main bundle.
Add Nimble and Quick through Cocoapods to use BDD for unit testing.

* feat: Check Wallet and Payment Availability (#2)

Add verification for wallet and payment availability. Payment verification is enhanced by also checking it against the configured payment networks and supported capabilities.

* feat: Set Details and Trigger Payment (#3)

Configure the missing payment details and, by mixing it with the configuration info, trigger the payment request.

* refactor: Add DocC documentation and minor fixes. (#4)

Add DocC documentation.
Add empty value check and mandatory fields when fetching configuration properties.

* fix: Payment Setup Verification Failed on Invalid Configuration (#5)

Fix error when verifying payment setup on ReadyToPay method. If some payment network or merchant capabilities are missing, return the associated error.

* fix: Errors and Contact Management (#6)

Clean errors and its codes and messages accordingly.
New OSPMTContact struct that allows the management of the correct shipping and billing information to use on a payment request. This is required due to a limitation on OutSystems related with nullable lists.
Change the OSPMTConfigurationDelegate to OSPMTConfigurationModel, in order to comply with the new OutSystems structure.
Clean code (privatise local methods and make OSPMTPayment's delegate property weak, in order to avoid possible retain cycles).

* fix: Check if GivenName and FamilyName are empty (#7)

* chore: Add Unreleased Section

* Chore: Add Podspec (#9)

* refactor: Simply Generic Method

* chore: Add public podspec

Add public podspec. This implies also updating the readme.md file to something more descriptive and user-friendly.

* feat: Add Stripe as First Payment Gateway (#11)

Add all necessary logic and changes to make payment processing using Stripe including Protocols, Factories and Models to deal with the StripePayments pod. Unit tests are included.

* Feat: Add Gateway property to OSPMTDetailsModel (#12)

Add `gateway` property to `OSPMTDetailsModel` struct. When authorising payment, confirm that this property corresponds to a configured gateway (on plist).

* feat: Add AccessToken to Full Payment Process (#13)

Add the optional parameter `accessToken` to the `OSPMTActionDelegate`'s `set` method and the `OSPMTStripeWrapper`'s `processPaymentWithDetails` method. Apply consequent changes to it.
In case of a full payment is triggered but no access token is passed, a `tokenIssue` is returned.

* chore: Set Release Tag

Set release tag on the repo's CHANGELOG file.
  • Loading branch information
OS-ricardomoreirasilva committed Apr 11, 2024
1 parent 6029966 commit a0ee57a
Show file tree
Hide file tree
Showing 590 changed files with 50,845 additions and 1,761 deletions.
70 changes: 7 additions & 63 deletions OSPaymentsLib.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
7509DC7F28996482005BA0D4 /* OSPMTApplePayConfigurationSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7509DC7E28996482005BA0D4 /* OSPMTApplePayConfigurationSpec.swift */; };
7509DC81289967A6005BA0D4 /* PKPaymentNetwork+Adapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7509DC80289967A6005BA0D4 /* PKPaymentNetwork+Adapter.swift */; };
751B1DB2293A2744009A00B2 /* OSPMTStripeRequestParametersModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 751B1DB1293A2744009A00B2 /* OSPMTStripeRequestParametersModel.swift */; };
753CDB1C2BC55BEE005EAA76 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 753CDB1B2BC55BEE005EAA76 /* PrivacyInfo.xcprivacy */; };
7556EA952934DAC600FF4044 /* OSPMTRequestParametersModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7556EA942934DAC600FF4044 /* OSPMTRequestParametersModel.swift */; };
7556EA982934E10D00FF4044 /* OSPMTStripeAPIDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7556EA972934E10D00FF4044 /* OSPMTStripeAPIDelegate.swift */; };
7556EA9A2934E4AB00FF4044 /* OSPMTStripeWrapperSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7556EA992934E4AB00FF4044 /* OSPMTStripeWrapperSpec.swift */; };
Expand All @@ -29,7 +28,6 @@
755A8060289BD54E00426EAA /* OSPMTDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 755A805F289BD54E00426EAA /* OSPMTDataModel.swift */; };
755A8062289BD56300426EAA /* OSPMTAddressModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 755A8061289BD56300426EAA /* OSPMTAddressModel.swift */; };
755A8064289BD58900426EAA /* OSPMTContactInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 755A8063289BD58900426EAA /* OSPMTContactInfoModel.swift */; };
755DF3F0297FF02800140860 /* StripePayments in Frameworks */ = {isa = PBXBuildFile; productRef = 755DF3EF297FF02800140860 /* StripePayments */; };
756931E62937A9200014618D /* OSPMTTokenInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 756931E52937A9200014618D /* OSPMTTokenInfoModel.swift */; };
75760F78289C102D001BDCEC /* OSPMTAddressModelSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75760F77289C102D001BDCEC /* OSPMTAddressModelSpec.swift */; };
75760F7A289C17AB001BDCEC /* OSPMTContactInfoModelSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75760F79289C17AB001BDCEC /* OSPMTContactInfoModelSpec.swift */; };
Expand Down Expand Up @@ -77,7 +75,6 @@
7509DC7E28996482005BA0D4 /* OSPMTApplePayConfigurationSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTApplePayConfigurationSpec.swift; sourceTree = "<group>"; };
7509DC80289967A6005BA0D4 /* PKPaymentNetwork+Adapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PKPaymentNetwork+Adapter.swift"; sourceTree = "<group>"; };
751B1DB1293A2744009A00B2 /* OSPMTStripeRequestParametersModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTStripeRequestParametersModel.swift; sourceTree = "<group>"; };
753CDB1B2BC55BEE005EAA76 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
7556EA942934DAC600FF4044 /* OSPMTRequestParametersModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTRequestParametersModel.swift; sourceTree = "<group>"; };
7556EA972934E10D00FF4044 /* OSPMTStripeAPIDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTStripeAPIDelegate.swift; sourceTree = "<group>"; };
7556EA992934E4AB00FF4044 /* OSPMTStripeWrapperSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTStripeWrapperSpec.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -125,7 +122,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
755DF3F0297FF02800140860 /* StripePayments in Frameworks */,
8DB1869BE6C7A0D7D44D4C34 /* Pods_OSPaymentsLib.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -183,7 +179,6 @@
75EC4D132894142000CF50E2 /* Protocols */,
75EC4D1D289416B600CF50E2 /* OSPMTApplePayHandler.swift */,
75EC4D112893FC3C00CF50E2 /* OSPMTPayments.swift */,
753CDB1B2BC55BEE005EAA76 /* PrivacyInfo.xcprivacy */,
);
path = OSPaymentsLib;
sourceTree = "<group>";
Expand Down Expand Up @@ -317,16 +312,13 @@
7507FC0E27FC2AAE003809F6 /* Sources */,
7507FC0F27FC2AAE003809F6 /* Frameworks */,
7507FC1027FC2AAE003809F6 /* Resources */,
75895022289989D200670171 /* Run Script */,
75895022289989D200670171 /* ShellScript */,
);
buildRules = (
);
dependencies = (
);
name = OSPaymentsLib;
packageProductDependencies = (
755DF3EF297FF02800140860 /* StripePayments */,
);
productName = OSPaymentsLib;
productReference = 7507FC1227FC2AAE003809F6 /* OSPaymentsLib.framework */;
productType = "com.apple.product-type.framework";
Expand Down Expand Up @@ -359,7 +351,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1330;
LastUpgradeCheck = 1510;
LastUpgradeCheck = 1330;
TargetAttributes = {
7507FC1127FC2AAE003809F6 = {
CreatedOnToolsVersion = 13.3;
Expand All @@ -379,9 +371,6 @@
Base,
);
mainGroup = 7507FC0827FC2AAE003809F6;
packageReferences = (
755DF3EE297FF02800140860 /* XCRemoteSwiftPackageReference "stripe-ios-spm" */,
);
productRefGroup = 7507FC1327FC2AAE003809F6 /* Products */;
projectDirPath = "";
projectRoot = "";
Expand All @@ -397,7 +386,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
753CDB1C2BC55BEE005EAA76 /* PrivacyInfo.xcprivacy in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -450,7 +438,7 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
75895022289989D200670171 /* Run Script */ = {
75895022289989D200670171 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
Expand All @@ -460,7 +448,6 @@
);
inputPaths = (
);
name = "Run Script";
outputFileListPaths = (
);
outputPaths = (
Expand Down Expand Up @@ -598,7 +585,6 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -662,7 +648,6 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand All @@ -689,33 +674,26 @@
buildSettings = {
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = EVSWK8BA55;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.2.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.outsystems.rd.payments.OSPaymentsLib;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand All @@ -729,33 +707,26 @@
buildSettings = {
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = EVSWK8BA55;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.2.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.outsystems.rd.payments.OSPaymentsLib;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -770,13 +741,9 @@
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = EVSWK8BA55;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.outsystems.payments.OSPaymentsLibTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -791,13 +758,9 @@
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = EVSWK8BA55;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.outsystems.payments.OSPaymentsLibTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down Expand Up @@ -835,25 +798,6 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
755DF3EE297FF02800140860 /* XCRemoteSwiftPackageReference "stripe-ios-spm" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/stripe/stripe-ios-spm";
requirement = {
kind = exactVersion;
version = 23.26.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
755DF3EF297FF02800140860 /* StripePayments */ = {
isa = XCSwiftPackageProductDependency;
package = 755DF3EE297FF02800140860 /* XCRemoteSwiftPackageReference "stripe-ios-spm" */;
productName = StripePayments;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 7507FC0927FC2AAE003809F6 /* Project object */;
}
2 changes: 1 addition & 1 deletion OSPaymentsLib/Gateways/Stripe/OSPMTStripeAPIDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PassKit
@_implementationOnly import StripePayments
import StripePayments

/// Delegate class containing the required calls for Stripe's SDK to process.
protocol OSPMTStripeAPIDelegate: AnyObject {
Expand Down
2 changes: 1 addition & 1 deletion OSPaymentsLib/Gateways/Stripe/OSPMTStripeWrapper.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PassKit
@_implementationOnly import StripeCore
import StripeCore

/// Object responsible for making a Stripe payment process. The Wrapper deals with all calls that are required to Stripe's SDK.
final class OSPMTStripeWrapper: OSPMTGatewayDelegate {
Expand Down
77 changes: 74 additions & 3 deletions OSPaymentsLib/Models/OSPMTConfigurationModel.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,43 @@
import PassKit

/// Protocol that contains all properties needed to configure a payment service.
/// Model that manages the Payment Service Provider's configuration.
struct OSPMTGatewayModel: Encodable {
let gateway: String
let publishableKey: String?
let requestURL: String

/// Keys used to encode and decode the model.
enum CodingKeys: String, CodingKey {
case gateway
case publishableKey
case requestURL
}

/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)

try container.encode(gateway, forKey: .gateway)
try container.encodeIfPresent(publishableKey, forKey: .publishableKey)
try container.encode(requestURL, forKey: .requestURL)
}
}

extension OSPMTGatewayModel {
var gatewayEnum: OSPMTGateway? {
return OSPMTGateway.convert(from: self.gateway)
}
}

/// Model that contains all properties needed to configure a payment service.
class OSPMTConfigurationModel: Encodable {
// MARK: Merchant Information
var merchantID: String?
Expand All @@ -18,6 +55,9 @@ class OSPMTConfigurationModel: Encodable {
// MARK: Billing Information
var billingSupportedContacts: [String]?

// MARK: Payment Service Provider Information
var gatewayModel: OSPMTGatewayModel?

/// Keys used to encode and decode the model.
enum CodingKeys: String, CodingKey {
case merchantID
Expand All @@ -28,6 +68,7 @@ class OSPMTConfigurationModel: Encodable {
case paymentSupportedCardCountries
case shippingSupportedContacts
case billingSupportedContacts
case gatewayModel = "tokenization"
}

/// Constructor method.
Expand All @@ -40,7 +81,18 @@ class OSPMTConfigurationModel: Encodable {
/// - paymentSupportedCardCountries: Payment Support Card Countries configured
/// - shippingSupportedContacts: Shipping Supported Contacts configured
/// - billingSupportedContacts: Billing Supported Contacts configured
init(merchantID: String?, merchantName: String?, merchantCountryCode: String?, paymentAllowedNetworks: [String]?, paymentSupportedCapabilities: [String]?, paymentSupportedCardCountries: [String]?, shippingSupportedContacts: [String]?, billingSupportedContacts: [String]?) {
/// - tokenization: Payment Service Gateway configured
init(
merchantID: String?,
merchantName: String?,
merchantCountryCode: String?,
paymentAllowedNetworks: [String]?,
paymentSupportedCapabilities: [String]?,
paymentSupportedCardCountries: [String]?,
shippingSupportedContacts: [String]?,
billingSupportedContacts: [String]?,
gatewayModel: OSPMTGatewayModel?
) {
self.merchantID = merchantID
self.merchantName = merchantName
self.merchantCountryCode = merchantCountryCode
Expand All @@ -49,6 +101,7 @@ class OSPMTConfigurationModel: Encodable {
self.paymentSupportedCardCountries = paymentSupportedCardCountries
self.shippingSupportedContacts = shippingSupportedContacts
self.billingSupportedContacts = billingSupportedContacts
self.gatewayModel = gatewayModel
}

/// Encodes this value into the given encoder.
Expand Down Expand Up @@ -78,6 +131,9 @@ class OSPMTConfigurationModel: Encodable {

// MARK: Billing Information
try container.encodeIfPresent(billingSupportedContacts, forKey: .billingSupportedContacts)

// MARK: Payment Service Provider Information
try container.encodeIfPresent(gatewayModel, forKey: .gatewayModel)
}
}

Expand All @@ -97,6 +153,11 @@ class OSPMTApplePayConfiguration: OSPMTConfigurationModel {
static let shippingSupportedContacts = "ApplePayShippingSupportedContacts"

static let billingSupportedContacts = "ApplePayBillingSupportedContacts"

static let paymentGateway = "ApplePayPaymentGateway"
static let paymentGatewayName = "ApplePayPaymentGatewayName"
static let paymentRequestURL = "ApplePayRequestURL"
static let stripePublishableKey = "ApplePayStripePublishableKey"
}

/// Constructor method.
Expand All @@ -120,6 +181,15 @@ class OSPMTApplePayConfiguration: OSPMTConfigurationModel {
// MARK: Billing Information
let billingSupportedContacts: [String]? = Self.getProperty(forSource: source, andKey: ConfigurationKeys.billingSupportedContacts)

// MARK: Payment Service Provider Information
var gatewayModel: OSPMTGatewayModel?
if let providerGateway: [String: Any] = Self.getProperty(forSource: source, andKey: ConfigurationKeys.paymentGateway),
let providerGatewayName = providerGateway[ConfigurationKeys.paymentGatewayName] as? String,
let requestURL = providerGateway[ConfigurationKeys.paymentRequestURL] as? String {
let publishableKey = providerGateway[ConfigurationKeys.stripePublishableKey] as? String
gatewayModel = OSPMTGatewayModel(gateway: providerGatewayName, publishableKey: publishableKey, requestURL: requestURL)
}

self.init(
merchantID: merchantID,
merchantName: merchantName,
Expand All @@ -128,7 +198,8 @@ class OSPMTApplePayConfiguration: OSPMTConfigurationModel {
paymentSupportedCapabilities: paymentSupportedCapabilities,
paymentSupportedCardCountries: paymentSupportedCardCountries,
shippingSupportedContacts: shippingSupportedContacts,
billingSupportedContacts: billingSupportedContacts
billingSupportedContacts: billingSupportedContacts,
gatewayModel: gatewayModel
)
}
}
Expand Down
Loading

0 comments on commit a0ee57a

Please sign in to comment.