-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
WorldlineConnect
committed
Mar 19, 2024
1 parent
11fd2e2
commit fd19515
Showing
443 changed files
with
68,328 additions
and
26 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.gitattributes export-ignore | ||
.gitignore export-ignore |
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,41 @@ | ||
# Xcode | ||
|
||
## Build generated | ||
build/ | ||
DerivedData/ | ||
|
||
## Various settings | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
xcuserdata/ | ||
|
||
## Other | ||
*.moved-aside | ||
*.xcuserstate | ||
*.iml | ||
|
||
## Obj-C/Swift specific | ||
*.hmap | ||
*.ipa | ||
*.dSYM.zip | ||
*.dSYM | ||
|
||
## Playgrounds | ||
timeline.xctimeline | ||
playground.xcworkspace | ||
|
||
# Carthage | ||
Carthage/ | ||
|
||
# MacOS | ||
.DS_Store | ||
|
||
#Intellij | ||
.idea | ||
|
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,10 @@ | ||
project: WorldlineConnectKit.xcodeproj | ||
schemes: | ||
- WorldlineConnectKit | ||
targets: | ||
- WorldlineConnectKit | ||
- WorldlineConnectKitTests | ||
clean_build: true | ||
retain_public: true | ||
build_arguments: | ||
- platform="iOS Simulator,name=iPhone 15,OS=17.0" |
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,7 @@ | ||
excluded: | ||
- Carthage/* | ||
|
||
disabled_rules: | ||
- file_length | ||
- function_body_length | ||
- type_body_length |
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,3 @@ | ||
github "Alamofire/Alamofire" ~> 5.4 | ||
github "krzyzanowskim/CryptoSwift" ~> 1.5.0 | ||
github "AliSoftware/OHHTTPStubs" ~> 9.0.0 |
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,3 @@ | ||
github "Alamofire/Alamofire" "5.8.1" | ||
github "AliSoftware/OHHTTPStubs" "9.1.0" | ||
github "krzyzanowskim/CryptoSwift" "1.8.0" |
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,54 @@ | ||
# Migration from version 5.x.x to 6.x.x | ||
|
||
## Dependency | ||
The name of the SDK has been modified to `WorldlineConnectKit`. You need to update your dependencies: | ||
|
||
### Cocoapods: | ||
Update your `Podfile` by using the new SDK Pod name: | ||
``` | ||
pod 'WorldlineConnectKit' | ||
``` | ||
|
||
Afterwards, run the following command: | ||
``` | ||
pod install | ||
``` | ||
|
||
### Carthage: | ||
Update your `Cartfile` with the new Github location of the SDK: | ||
``` | ||
github "Worldline-Global-Collect/connect-sdk-client-swift" | ||
``` | ||
|
||
Afterwards, run the following command: | ||
``` | ||
carthage update | ||
``` | ||
|
||
## Imports | ||
Update your imports to the new naming of the SDK and its files. | ||
- `IngenicoConnectKit` becomes `WorldlineConnectKit` | ||
|
||
## Removed | ||
The following enums have been removed: | ||
- `Region` | ||
- `Environment` | ||
- `CurrencyCode` | ||
- `CountryCode` | ||
|
||
The following constructors have been removed: | ||
- `Session(String, String, Region, Environment, String, Bool)` | ||
- `C2SCommunicator(String, String, Region, Environment, String, Util?, Bool)` | ||
- `C2SCommunicator(String, String, Region, Environment, String, String?, Util?, Bool)` | ||
- `PaymentContext(PaymentAmountOfMoney, Bool, CountryCode)` | ||
- `IINDetailsResponse(String, IINStatus, [IINDetail], CountryCode, Bool)` | ||
- `PaymentAmountOfMoney(Int, CurrencyCode)` | ||
|
||
The following functions have been removed: | ||
- `convert(Int, CurrencyCode, CurrencyCode, (Int) -> Void, (Error) -> Void)` in `Session` | ||
- `directory(String, CountryCode, CurrencyCode, (DirectoryEntries) -> Void, (Error) -> Void)` in `Session` | ||
- `C2SBaseURL(Region, Environment)` and `assetsBaseURL(Region, Environment)` in `Util` | ||
|
||
The following properties have been removed: | ||
- `isEnvironmentTypeProduction` in `Session` | ||
- `region`, `environment`, `isEnvironmentTypeProduction` in `C2SCommunicator` |
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,111 @@ | ||
# Migrating from version 5.12 to version 5.13 | ||
This migration guide will help you migrate from version 5.12 to version 5.13. | ||
|
||
For version 5.13, the SDK was updated with a new architecture where initialization and error handling of the SDK have been improved. These changes are *not* mandatory to move to version 5.13 of the SDK. The old architecture has been deprecated, but is still available and will not be removed until a future major version update. | ||
|
||
## Migrating to the new architecture | ||
|
||
> *Note:* The changes described in this section are not breaking at this time. The old architecture of the SDK, using an instance of `Session`, has been deprecated, but will be available until the next major version update. | ||
Major improvements have been made to the SDKs error handling, and to the initialization of the SDK. This is an overview of all architecture changes: | ||
|
||
- The SDK has a new entry point: `ConnectSDK`. Its initialize method should be used to provide `ConnectSDKConfiguration`, containing `SessionConfiguration`, obtained through the Server to Server API, and `PaymentConfiguration`. | ||
- Session has been replaced by `ClientApi`. Once the SDK has been initialized, an instance of `ClientApi` can be obtained by calling `ConnectSDK.clientApi`. | ||
- Error handling has been improved when making requests through `ClientApi`. When making a call, an additional argument must be provided which will be called to handle an API error when one occurs. This means that every call will always require at least the following parameters: | ||
- `success: (_ response: ExpectedResponseType) -> Void` - Called when the request was successful. The response parameter will contain the response object, according to the existing, unchanged domain model. | ||
- `failure: (_ error: Error) -> Void` - Called when an exception occurred while executing the request. The error parameter will contain the `Error` that indicates what went wrong. | ||
- `apiFailure: (_ errorResponse: ApiErrorResponse) -> Void` - Called when the Connect gateway returned an error response. The errorResponse parameter will contain further information on the error, such as the errorId and a list of `ApiErrorItem`s which contains all returned errors. | ||
|
||
### Using the new architecture | ||
|
||
The steps below describe how to migrate to the new SDK architecture in version 5.13 of the SDK. | ||
|
||
1. Upgrade to the latest Swift Connect SDK version in your `Podfile`: | ||
``` | ||
pod 'IngenicoConnectKit', '~> 5.13' | ||
``` | ||
|
||
Afterwards, run the following command: | ||
|
||
``` | ||
$ pod install | ||
``` | ||
|
||
2. Replace `Session` initialization with `ConnectSDK` initialization: | ||
```swift | ||
let sessionConfiguration = SessionConfiguration( | ||
clientSessionId: "e030f01dda4c4f94891c3cb23b3ccf61", | ||
customerId: "9008-9a1e01fbbafd4889a77cbb11abb5e688", | ||
clientApiUrl: "https://ams1.sandbox.api-ingenico.com/client", | ||
assetUrl: "https://assets.pay1.sandbox.secured-by-ingenico.com/" | ||
) | ||
|
||
let connectSDKConfiguration = ConnectSDKConfiguration( | ||
sessionConfiguration: sessionConfiguration, | ||
enableNetworkLogs: true, // should be set to false in production | ||
applicationId: "my-application-id", // optional | ||
ipAddress: nil, // optional | ||
preLoadImages: true // true, by default if parameter is not explicitly set | ||
) | ||
|
||
let paymentConfiguration = PaymentConfiguration( | ||
paymentContext: paymentContext, | ||
groupPaymentProducts: false | ||
) | ||
|
||
ConnectSDK.initialize( | ||
connectSDKConfiguration: connectSDKConfiguration, | ||
paymentConfiguration: paymentConfiguration | ||
) | ||
``` | ||
|
||
`ConnectSDKConfiguration` contains properties that allow you to set additional SDK settings: | ||
|
||
- `enableNetworkLogs` will log all network requests and responses to the console. This setting can be used to investigate issues. Must be set to false in production targets. | ||
- `applicationId` is the identifier or name that you choose for your app. | ||
- `ipAddress` will be included in the client's meta info when encrypting a `PaymentRequest`. | ||
- `preloadImages` determines whether image resources, initially returned by the API as their location, will be retrieved by the SDK, or whether you will retrieve them on the go when required. The SDK loads the images by default, to make sure behaviour is as it used to be. We have added the option to disable preloading to allow you to use frameworks for image loading on demand. | ||
|
||
`PaymentConfiguration` has a property used to determine whether or not to group payment items. | ||
|
||
3. Replace all API calls that were previously called via `Session` with `ConnectSDK.clientApi` calls. API calls now require the additional argument `apiFailure`: | ||
```swift | ||
ConnectSDK.clientApi.paymentItems( | ||
success: { paymentItems in | ||
// display the contents of paymentItems & accountsOnFile to your customer | ||
}, | ||
failure: { error in | ||
// process failure | ||
}, | ||
apiFailure: { errorResponse in | ||
// process api failure | ||
} | ||
) | ||
``` | ||
|
||
4. Implement error handling for the `failure` and `apiFailure` callbacks. | ||
|
||
For more information about version 5.13 or the Swift SDK in general, also review the Swift SDK developer documentation and/or the Swift example apps. | ||
|
||
### Deprecations | ||
|
||
This is the full list of classes that have become deprecated related to the architecture change. Move away from using these classes, as they will be removed or made unavailable in a future major release. | ||
|
||
- `Session` | ||
- `AlamofireWrapper` | ||
- `C2SCommunicator` | ||
- `C2SCommunicatorConfiguration` | ||
- `AssetManager` | ||
- `FileManager` | ||
- `Util` | ||
- `Encryptor` | ||
- `JOSEEncryptor` | ||
- `SessionError` | ||
- `CustomerDetailsError` | ||
|
||
## Relevant links | ||
- [Swift Connect SDK on GitHub](https://github.com/Ingenico-ePayments/connect-sdk-client-swift) | ||
- [SwiftUI example app on GitHub](https://github.com/Ingenico-ePayments/connect-sdk-client-swift-example-swiftui) | ||
- [UIKit example app on GitHub](https://github.com/Ingenico-ePayments/connect-sdk-client-swift-example) | ||
- [Swift SDK documentation](https://docs.connect.worldline-solutions.com/documentation/sdk/mobile/swift/) | ||
- [Client API Reference](https://apireference.connect.worldline-solutions.com/c2sapi/v1/en_US/index.html?paymentPlatform=ALL) |
16 changes: 16 additions & 0 deletions
16
KeychainEntitlementTestApp/KeychainEntitlementTestAppApp.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,16 @@ | ||
// | ||
// KeychainEntitlementTestAppApp.swift | ||
// KeychainEntitlementTestApp | ||
// | ||
// Created for Worldline Global Collect on 22/12/2022. | ||
// Copyright © 2022 Worldline Global Collect. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
@main | ||
struct KeychainEntitlementTestAppApp: App { | ||
var body: some Scene { | ||
WindowGroup {} | ||
} | ||
} |
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,54 @@ | ||
Worldline Connect Swift SDK | ||
======================= | ||
|
||
The Worldline Connect Swift SDK provides a convenient way to support a large number of payment methods inside your iOS app. | ||
It supports iOS 8.0 and up out-of-the-box. | ||
The Swift SDK comes with an [UIKit example app](https://github.com/Worldline-Global-Collect/connect-sdk-client-swift-example) and a [SwiftUI example app](https://github.com/Worldline-Global-Collect/connect-sdk-client-swift-example-swiftui) that illustrate the use of the SDK and the services provided by Worldline Global Collect on the Worldline Global Collect platform. | ||
|
||
See the [Worldline Connect Developer Hub](https://docs.connect.worldline-solutions.com/documentation/sdk/mobile/swift/) for more information on how to use the SDK. | ||
|
||
|
||
Use the SDK with Carthage or CocoaPods | ||
--------------------------------------- | ||
The Worldline Connect Swift SDK is available via two package managers: [CocoaPods](https://cocoapods.org/) or [Carthage](https://github.com/Carthage/Carthage). | ||
|
||
### CocoaPods | ||
|
||
You can add the Swift SDK as a pod to your project by adding the following to your `Podfile`: | ||
|
||
``` | ||
$ pod 'WorldlineConnectKit' | ||
``` | ||
|
||
Afterwards, run the following command: | ||
|
||
``` | ||
$ pod install | ||
``` | ||
|
||
### Carthage | ||
|
||
You can add the Swift SDK with Carthage, by adding the following to your `Cartfile`: | ||
|
||
``` | ||
$ github "Worldline-Global-Collect/connect-sdk-client-swift" | ||
``` | ||
|
||
Afterwards, run the following command: | ||
|
||
``` | ||
$ carthage update --platform ios --use-xcframeworks | ||
``` | ||
|
||
Navigate to the `Carthage/Build` directory, which was created in the same directory as where the `.xcodeproj` or `.xcworkspace` is. Inside this directory the `.xcframework` bundle is stored. Drag the `.xcframework` into the "Framework, Libraries and Embedded Content" section of the desired target. Make sure that it is set to "Embed & Sign". | ||
|
||
Run the SDK locally | ||
------------ | ||
|
||
To obtain the Swift SDK, first clone the code from GitHub: | ||
|
||
``` | ||
$ git clone https://github.com/Worldline-Global-Collect/connect-sdk-client-swift.git | ||
``` | ||
|
||
Open the Xcode project that is included to test the SDK. |
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,22 @@ | ||
Pod::Spec.new do |s| | ||
|
||
s.name = "WorldlineConnectKit" | ||
s.version = "6.0.0" | ||
s.summary = "Worldline Connect Swift SDK" | ||
s.description = <<-DESC | ||
This native Swift SDK facilitates handling payments in your apps | ||
using the Worldline Global Collect platform of Worldline Global Collect. | ||
DESC | ||
|
||
s.homepage = "https://github.com/Worldline-Global-Collect/connect-sdk-client-swift" | ||
s.license = { :type => "MIT", :file => "LICENSE.txt" } | ||
s.author = "Worldline Connect" | ||
s.platform = :ios, "10.0" | ||
s.source = { :git => "https://github.com/Worldline-Global-Collect/connect-sdk-client-swift.git", :tag => s.version } | ||
s.source_files = "WorldlineConnectKit/**/*.swift" | ||
s.resource = "WorldlineConnectKit/WorldlineConnectKit.bundle" | ||
s.swift_version = "5" | ||
|
||
s.dependency 'Alamofire', '~> 5.4' | ||
s.dependency 'CryptoSwift', '1.4.0' | ||
end |
Oops, something went wrong.