Skip to content

Commit

Permalink
Release 6.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
WorldlineConnect committed Mar 19, 2024
1 parent 11fd2e2 commit fd19515
Show file tree
Hide file tree
Showing 443 changed files with 68,328 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.gitattributes export-ignore
.gitignore export-ignore
41 changes: 41 additions & 0 deletions .gitignore
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

10 changes: 10 additions & 0 deletions .periphery.yml
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"
7 changes: 7 additions & 0 deletions .swiftlint.yml
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
3 changes: 3 additions & 0 deletions Cartfile
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
3 changes: 3 additions & 0 deletions Cartfile.resolved
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"
54 changes: 54 additions & 0 deletions Documentation/Migration Guide v5 to v6.md
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`
111 changes: 111 additions & 0 deletions Documentation/Migration Guide v5.12 to v5.13.md
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 KeychainEntitlementTestApp/KeychainEntitlementTestAppApp.swift
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 {}
}
}
52 changes: 26 additions & 26 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
Copyright (c) 2014 Worldline Global Collect B.V.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.


*** Notices for Alamofire

Copyright (c) 2014 Worldline Global Collect B.V.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*** Notices for Alamofire
Copyright (c) 2014-2022 Alamofire Software Foundation (http://alamofire.org/)

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
54 changes: 54 additions & 0 deletions README.md
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.
22 changes: 22 additions & 0 deletions WorldlineConnectKit.podspec
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
Loading

0 comments on commit fd19515

Please sign in to comment.