Skip to content

Commit

Permalink
feat: update to latest version of Netcetera SDK (#32)
Browse files Browse the repository at this point in the history
* Added 3DS SDK 2.4.00

* Update version string for 3DS SDK

* Update initialization

* Update example app

* Code cleanup

* Add customizationMap to satisf
y warnings

* final cleanup
  • Loading branch information
NQuinn27 authored Dec 14, 2023
1 parent 8fb64b3 commit cf40003
Show file tree
Hide file tree
Showing 92 changed files with 15,293 additions and 15,528 deletions.
9 changes: 5 additions & 4 deletions Example/Primer3DS/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ class ViewController: UIViewController {
let primer3DS = Primer3DS(environment: .staging)

do {
try primer3DS.initializeSDK(licenseKey: "")
let transaction = try primer3DS.createTransaction(directoryServerId: "", supportedThreeDsProtocolVersions: [""])
try primer3DS.initializeSDK(apiKey: "")
_ = try primer3DS.createTransaction(directoryServerId: "", supportedThreeDsProtocolVersions: [""])

primer3DS.performChallenge(threeDSAuthData: ThreeDSAuth(), threeDsAppRequestorUrl: URL(string: ""), presentOn: self) { (sdkAuthCompletion, err) in

primer3DS.performChallenge(threeDSAuthData: ThreeDSAuth(),
threeDsAppRequestorUrl: URL(string: ""),
presentOn: self) { (sdkAuthCompletion, err) in
}
} catch {
print(error)
Expand Down
2 changes: 1 addition & 1 deletion Example/Tests/Primer3DSChallengeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ final class Primer3DSChallengeTests: XCTestCase {
sdkProvider.transactions = ["\(directoryServerId):\(protocolVersion)": transaction]
}

try primer3DS.initializeSDK(licenseKey: "LicenseKey")
try primer3DS.initializeSDK(apiKey: "ApiKey")
_ = try primer3DS.createTransaction(directoryServerId: directoryServerId, supportedThreeDsProtocolVersions: [protocolVersion])
}

Expand Down
15 changes: 8 additions & 7 deletions Example/Tests/Primer3DSTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,24 @@ final class Primer3DSTests: XCTestCase {

func testSDKInitialization_Success() throws {

let licenseKey = "LicenseKey"
let apiKey = "ApiKey"

// SDK Setup
let certificate = MockCertificate(cardScheme: "CardScheme", encryptionKey: "EncryptionKey", rootCertificate: "RootCertificate")
XCTAssertTrue(primer3DS.isWeakValidationEnabled)
let certificate = MockCertificate(cardScheme: "CardScheme",
encryptionKey: "EncryptionKey",
rootCertificate: "RootCertificate")

let expectation = self.expectation(description: "Expect initialized configuration with expected values")

sdkProvider.onInitializeCalled = { config, _, _ in
XCTAssertEqual(try config.getParamValue(group: nil, paramName: "license-key"), licenseKey)
XCTAssertEqual(try config.getParamValue(group: nil, paramName: "api-key"), apiKey)
XCTAssertEqual(try config.getParamValue(group: "schema_ds_ids", paramName: "cardscheme"), Primer3DS.supportedSchemeId)
XCTAssertEqual(try config.getParamValue(group: "schema_root_public_key", paramName: "cardscheme"), certificate.rootCertificate)
XCTAssertEqual(try config.getParamValue(group: "schema_public_key", paramName: "cardscheme"), certificate.encryptionKey)
expectation.fulfill()
}

try primer3DS.initializeSDK(licenseKey: licenseKey, certificates: [certificate], enableWeakValidation: true)
try primer3DS.initializeSDK(apiKey: apiKey, certificates: [certificate])

wait(for: [expectation], timeout: 60.0)
}
Expand All @@ -52,7 +53,7 @@ final class Primer3DSTests: XCTestCase {
sdkProvider.warnings = warnings

do {
try primer3DS.initializeSDK(licenseKey: "LicenseKey")
try primer3DS.initializeSDK(apiKey: "LicenseKey")
} catch let error as Primer3DSError {
XCTAssertEqual(error.errorDescription, "Primer3DS SDK init failed with warnings '[WarningMessage]'.")
XCTAssertEqual(error.errorId, "3ds-sdk-init-failed")
Expand All @@ -77,7 +78,7 @@ final class Primer3DSTests: XCTestCase {
let transaction = MockTransaction()
sdkProvider.transactions = ["\(directoryServerId):\(protocolVersion)": transaction]

try primer3DS.initializeSDK(licenseKey: "LicenseKey")
try primer3DS.initializeSDK(apiKey: "ApiKey")
let authResult = try primer3DS.createTransaction(directoryServerId: directoryServerId, supportedThreeDsProtocolVersions: [protocolVersion])

XCTAssertEqual(authResult.authData.sdkAppId, transaction.mockAuthRequestParameters.getSDKAppID())
Expand Down
10 changes: 5 additions & 5 deletions Sources/Frameworks/ThreeDS_SDK.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@
<array>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>ThreeDS_SDK.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>ThreeDS_SDK.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ SWIFT_CLASS_NAMED("Customization")
///
/// throws:
/// InvalidInput
- (BOOL)setDarkTextColorWithHexColorCode:(NSString * _Nonnull)hexColorCode error:(NSError * _Nullable * _Nullable)error;
- (BOOL)setDarkTextColorWithHexColorCode:(NSString * _Nonnull)hexColorCode error:(NSError * _Nullable * _Nullable)error SWIFT_DEPRECATED_MSG("\n Starting with protocol version 2.3.1, for dark mode UI customization,\n the integrators shall use setTextColor(...) and insert\n the UiCustomization object into the uiCustomizationMap with key \"DARK\".\n ");
/// Setter fot the text font size
/// \param fontSize the font size given as an integer value
///
Expand Down Expand Up @@ -363,7 +363,7 @@ SWIFT_CLASS_NAMED("ButtonCustomization")
/// Set the dark background color of the button.
/// \param hexColorCode Color code in Hex format.
///
- (BOOL)setDarkBackgroundColorWithHexColorCode:(NSString * _Nonnull)hexColorCode error:(NSError * _Nullable * _Nullable)error;
- (BOOL)setDarkBackgroundColorWithHexColorCode:(NSString * _Nonnull)hexColorCode error:(NSError * _Nullable * _Nullable)error SWIFT_DEPRECATED_MSG("\n Starting with protocol version 2.3.1, for dark mode UI customization,\n the integrators shall use setBackgroundColor(...) and insert\n the UiCustomization object into the uiCustomizationMap with key \"DARK\".\n ");
/// Sets the radius of the button corners.
/// \param cornerRadius Radius (integer value) for the button corners.
///
Expand Down Expand Up @@ -506,28 +506,33 @@ SWIFT_CLASS_NAMED("ConfigurationBuilder")
@interface NCAConfigurationBuilder : NSObject
/// Create an emprty object with clean config parameters.
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
/// Add a license key to the ConfigParam object.
/// \param key Value for the key.
/// Add an api key to the ConfigParam object.
/// \param key Value for the key as UUID string.
///
- (BOOL)licenseWithKey:(NSString * _Nonnull)key error:(NSError * _Nullable * _Nullable)error;
- (BOOL)apiWithKey:(NSString * _Nonnull)key error:(NSError * _Nullable * _Nullable)error;
/// Add restricted device info parameters to the ConfigParameters.
/// \param parameters List of parameters.
///
- (BOOL)restrictedParameters:(NSArray<NSString *> * _Nonnull)parameters error:(NSError * _Nullable * _Nullable)error;
/// Add a scheme object to the configuration.
/// Integrator defined SchemeConfiguration takes priority over prebundled 3DS SDK SchemeConfiguration for use during EMVCo Authentication. If the integrator wishes to utilise the automatic updates of SchemeConfiguration provided by the 3DS SDK, custom encryption certificates for the SDK should not be added/overriden.
/// \param scheme Scheme object.
///
- (BOOL)add:(NCAScheme * _Nonnull)scheme error:(NSError * _Nullable * _Nullable)error;
/// Specify the log level.
/// \param level The desired log level.
///
- (BOOL)logTo:(enum NCALogLevel)level error:(NSError * _Nullable * _Nullable)error;
/// Modifies the support for sending and receiving bridging message extensions. By default the support is disabled.
/// \param enabled Boolean that decides whether bridging message extension is enabled or disabled.
///
- (BOOL)bridgingMessageExtensionEnabled:(BOOL)enabled error:(NSError * _Nullable * _Nullable)error;
/// Modifies the level of validation of the challenge response parameters. If the passed value is equal to true, the 3DS SDK will use weak validation for some of the challenge response parameters. The weak validation removes the mandatory status and the string length validation of several challenge response parameters.
/// note:
/// By using this method the Netcetera 3DS SDK will no longer be compliant with the latest bulletin of the EMVCo Protocol and Core Functions Specification. If any legal actions or consequences arise, the responsibility falls on the integrator of the Netcetera iOS 3DS SDK.
/// \param value Decides whether weak validation should be enabled.
///
- (BOOL)weakValidationEnabled:(BOOL)value error:(NSError * _Nullable * _Nullable)error;
- (BOOL)weakValidationEnabled:(BOOL)value error:(NSError * _Nullable * _Nullable)error SWIFT_DEPRECATED_MSG("The Weak Validation configuration has been restructured and incorporated into the default behaviour of the SDK. As a result, this method should no longer be used and will be removed in the next iteration of the SDK.");
/// Return a created ConfigParameters object.
- (NCAConfigParameters * _Nonnull)configParameters SWIFT_WARN_UNUSED_RESULT;
@end
Expand Down Expand Up @@ -556,6 +561,8 @@ SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _No
+ (NSString * _Nonnull)jcb SWIFT_WARN_UNUSED_RESULT;
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull cartesBancaires;)
+ (NSString * _Nonnull)cartesBancaires SWIFT_WARN_UNUSED_RESULT;
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull eftpos;)
+ (NSString * _Nonnull)eftpos SWIFT_WARN_UNUSED_RESULT;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end

Expand Down Expand Up @@ -635,7 +642,7 @@ SWIFT_CLASS_NAMED("LabelCustomization")
///
/// throws:
/// InvalidInputExcpetion
- (BOOL)setHeadingDarkTextColorWithHexColorCode:(NSString * _Nonnull)hexColorCode error:(NSError * _Nullable * _Nullable)error;
- (BOOL)setHeadingDarkTextColorWithHexColorCode:(NSString * _Nonnull)hexColorCode error:(NSError * _Nullable * _Nullable)error SWIFT_DEPRECATED_MSG("\n Starting with protocol version 2.3.1, for dark mode UI customization,\n the integrators shall use setHeadingTextColor(...) and insert\n the UiCustomization object into the uiCustomizationMap with key \"DARK\".\n ");
/// Sets the font type of the heading label text.
/// \param fontName Font type for the heading label text.
///
Expand Down Expand Up @@ -841,7 +848,7 @@ SWIFT_CLASS_NAMED("TextBoxCustomization")
///
/// throws:
/// InvalidInput
- (BOOL)setDarkBorderColorWithHexColorCode:(NSString * _Nonnull)hexColorCode error:(NSError * _Nullable * _Nullable)error;
- (BOOL)setDarkBorderColorWithHexColorCode:(NSString * _Nonnull)hexColorCode error:(NSError * _Nullable * _Nullable)error SWIFT_DEPRECATED_MSG("\n Starting with protocol version 2.3.1, for dark mode UI customization,\n the integrators shall use setBorderColor(...) and insert\n the UiCustomization object into the uiCustomizationMap with key \"DARK\".\n ");
/// Sets the corner radius of the text box corners.
/// \param cornerRadius Radius (integer value) for the text box corners.
///
Expand Down Expand Up @@ -913,7 +920,32 @@ SWIFT_PROTOCOL_NAMED("ThreeDS2Service")
///
/// throws:
/// InvalidInput, SDKAlreadyInitialized, SDKRuntime
- (BOOL)initialize:(NCAConfigParameters * _Nonnull)configParameters locale:(NSString * _Nullable)locale uiCustomization:(NCAUiCustomization * _Nullable)uiCustomization error:(NSError * _Nullable * _Nullable)error;
- (BOOL)initialize:(NCAConfigParameters * _Nonnull)configParameters locale:(NSString * _Nullable)locale uiCustomization:(NCAUiCustomization * _Nullable)uiCustomization error:(NSError * _Nullable * _Nullable)error SWIFT_DEPRECATED_MSG("Starting with protocol version 2.3.1, integrators should pass the UICustomization as a map.");
/// Initializes the 3DS SDK instance.
/// \param configParameters Configuration information that shall be used during initialization.
///
/// \param locale String that represents the locale for the app’s user interface.
///
/// \param uiCustomizationMap UI configuration information that is used to specify the UI layout and theme. For example, font style and font size.
/// Use UICustomizationType raw values as String keys for the uiCustomization dictionary. Each key represents a UI customization for a particular iOS appearance.
///
///
/// throws:
/// InvalidInput, SDKAlreadyInitialized, SDKRuntime
- (BOOL)initialize:(NCAConfigParameters * _Nonnull)configParameters locale:(NSString * _Nullable)locale uiCustomizationMap:(NSDictionary<NSString *, NCAUiCustomization *> * _Nullable)uiCustomizationMap error:(NSError * _Nullable * _Nullable)error;
/// Initializes the 3DS SDK instance.
/// \param configParameters Configuration information that shall be used during initialization.
///
/// \param locale String that represents the locale for the app’s user interface.
///
/// \param uiCustomizationMap UI configuration information that is used to specify the UI layout and theme. For example, font style and font size.
/// Use UICustomizationType raw values as String keys for the uiCustomization dictionary. Each key represents a UI customization for a particular iOS appearance.
///
/// \param success A closure that is called when the initialization finishes successfully.
///
/// \param failure A closure that is called when the initialization finishes unsuccessfully. The failure closure takes an Error parameter that contains the failure details.
///
- (void)initialize:(NCAConfigParameters * _Nonnull)configParameters locale:(NSString * _Nullable)locale uiCustomizationMap:(NSDictionary<NSString *, NCAUiCustomization *> * _Nullable)uiCustomizationMap success:(void (^ _Nonnull)(void))success failure:(void (^ _Nonnull)(NSError * _Nonnull))failure;
/// Creates an instance of Transaction through which the 3DS Requestor App gets the data that
/// is required to perform the transaction.
/// \param directoryServerId Registered Application Provider Identifier (RID) that is unique to
Expand Down Expand Up @@ -961,6 +993,8 @@ SWIFT_CLASS_NAMED("ThreeDS2ServiceSDK")
/// The resources will be taken from the main application bundle.
- (nonnull instancetype)init;
- (BOOL)initialize:(NCAConfigParameters * _Nonnull)configParameters locale:(NSString * _Nullable)locale uiCustomization:(NCAUiCustomization * _Nullable)uiCustomization error:(NSError * _Nullable * _Nullable)error;
- (BOOL)initialize:(NCAConfigParameters * _Nonnull)configParameters locale:(NSString * _Nullable)locale uiCustomizationMap:(NSDictionary<NSString *, NCAUiCustomization *> * _Nullable)uiCustomizationMap error:(NSError * _Nullable * _Nullable)error;
- (void)initialize:(NCAConfigParameters * _Nonnull)configParameters locale:(NSString * _Nullable)locale uiCustomizationMap:(NSDictionary<NSString *, NCAUiCustomization *> * _Nullable)uiCustomizationMap success:(void (^ _Nonnull)(void))success failure:(void (^ _Nonnull)(NSError * _Nonnull))failure;
- (id <NCATransaction> _Nullable)createTransactionWithDirectoryServerId:(NSString * _Nonnull)directoryServerId messageVersion:(NSString * _Nullable)messageVersion error:(NSError * _Nullable * _Nullable)error SWIFT_WARN_UNUSED_RESULT;
- (NSArray<NCAWarning *> * _Nullable)getWarningsAndReturnError:(NSError * _Nullable * _Nullable)error SWIFT_WARN_UNUSED_RESULT;
- (NSString * _Nullable)getSDKVersionAndReturnError:(NSError * _Nullable * _Nullable)error SWIFT_WARN_UNUSED_RESULT;
Expand Down Expand Up @@ -1032,7 +1066,7 @@ SWIFT_CLASS_NAMED("ToolbarCustomization")
///
/// throws:
/// InvalidInputExpection
- (BOOL)setDarkBackgroundColorWithHexColorCode:(NSString * _Nonnull)hexColorCode error:(NSError * _Nullable * _Nullable)error;
- (BOOL)setDarkBackgroundColorWithHexColorCode:(NSString * _Nonnull)hexColorCode error:(NSError * _Nullable * _Nullable)error SWIFT_DEPRECATED_MSG("\n Starting with protocol version 2.3.1, for dark mode UI customization,\n the integrators shall use setBackgroundColor(...) and insert\n the UiCustomization object into the uiCustomizationMap with key \"DARK\".\n ");
/// Sets the header text of the toolbar.
/// \param headerText Text for the header.
///
Expand Down Expand Up @@ -1106,6 +1140,12 @@ SWIFT_PROTOCOL_NAMED("Transaction")









enum NCAButtonType : NSInteger;

/// Provides the functionality required for 3DS SDK UI customization.
Expand Down Expand Up @@ -1195,6 +1235,12 @@ SWIFT_CLASS_NAMED("UiCustomization")
/// <li>
/// RESEND: Resend button
/// </li>
/// <li>
/// ADD_CH: Additional choice button
/// </li>
/// <li>
/// OPEN_OOB_APP: OOB app button
/// </li>
/// </ul>
typedef SWIFT_ENUM_NAMED(NSInteger, NCAButtonType, "ButtonType", open) {
NCAButtonTypeSUBMIT = 0,
Expand All @@ -1206,6 +1252,12 @@ typedef SWIFT_ENUM_NAMED(NSInteger, NCAButtonType, "ButtonType", open) {
NCAButtonTypeOPEN_OOB_APP = 6,
};

/// Enumeration represeting the UI Customization types
typedef SWIFT_ENUM_NAMED(NSInteger, NCAUICustomizationType, "UICustomizationType", open) {
NCAUICustomizationTypeDEFAULT = 0,
NCAUICustomizationTypeDARK = 1,
NCAUICustomizationTypeMONOCHROME = 2,
};


/// Represent a warning that is produced by the 3DS SDK while performing security checks during initialization.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>22F66</string>
<string>22G90</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand All @@ -17,13 +17,13 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.3.74</string>
<string>2.4.00</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CFBundleVersion</key>
<string>57</string>
<string>60</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
Expand Down
Binary file not shown.
Loading

0 comments on commit cf40003

Please sign in to comment.