Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new TwintSDK integration #1474

Merged
merged 126 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
f1a2774
Testing cocoapods twint sdk integration
neelSharma12 Nov 7, 2023
d875f53
Added Twint as SPM
neelSharma12 Nov 13, 2023
986046d
Fixed syntax
neelSharma12 Nov 13, 2023
c6fc858
updated twitn
neelSharma12 Nov 13, 2023
f4234fe
temp
neelSharma12 Nov 13, 2023
1a0d11d
temp
neelSharma12 Nov 13, 2023
7abfc3e
temp
neelSharma12 Nov 13, 2023
efd5ab4
temp
neelSharma12 Nov 13, 2023
77de274
temp
neelSharma12 Nov 13, 2023
38897a0
temp
neelSharma12 Nov 13, 2023
17fa79e
tempy
neelSharma12 Nov 13, 2023
7fb536f
tempy
neelSharma12 Nov 14, 2023
8482f68
tempy
neelSharma12 Nov 14, 2023
c214d18
Checking change version
neelSharma12 Nov 14, 2023
b9e021d
Revert "Checking change version"
neelSharma12 Nov 14, 2023
c71626b
Updated podspec
neelSharma12 Nov 27, 2023
7218f39
Updated podspec
neelSharma12 Nov 27, 2023
d1f672d
Updated podspec
neelSharma12 Nov 28, 2023
43ac5d2
Updated podspec
neelSharma12 Nov 28, 2023
2a628a1
Updated podspec
neelSharma12 Nov 28, 2023
2e47da9
Renamed Twint moduler
neelSharma12 Nov 29, 2023
a0733b6
Resolved conflicts
neelSharma12 Nov 29, 2023
7a76506
Fixed spell checker job
neelSharma12 Nov 29, 2023
cb331d2
Fixed spell check job
neelSharma12 Nov 30, 2023
17f5f4b
Merge branch 'develop' into feature_Twint
goergisn Dec 8, 2023
16c5afb
Merge branch 'develop' into feature_Twint
goergisn Dec 11, 2023
b82fa4f
Added Twint PM and Twint details
neelSharma12 Dec 11, 2023
07dd59e
Revert "Merge branch 'develop' into feature_Twint"
goergisn Dec 11, 2023
cc13fad
Revert "Merge branch 'develop' into feature_Twint"
goergisn Dec 11, 2023
be5df87
resolve conflict
neelSharma12 Dec 11, 2023
c482150
Revert "Revert "Merge branch 'develop' into feature_Twint""
goergisn Dec 11, 2023
cbddca2
Revert "Revert "Merge branch 'develop' into feature_Twint""
goergisn Dec 11, 2023
f6dbcc1
Merge branch 'develop' of github.com:Adyen/adyen-ios into feature_Twint
neelSharma12 Feb 2, 2024
e9e32e8
Added twint component, twint action component, tests
neelSharma12 Feb 29, 2024
ad671da
Checking for TwintSDK to make native and redirect flow possible
goergisn Feb 29, 2024
f24a93c
Adding Configuration to provide return url for the TwintSDKAction
goergisn Feb 29, 2024
a4a51cb
Better readability
goergisn Feb 29, 2024
ebbd955
Refactoring TwintSDKAction
goergisn Mar 1, 2024
5a8db94
Showing alert without a sheet + cancellation
goergisn Mar 1, 2024
a8a5835
Fixing typo
goergisn Mar 1, 2024
68885c9
[Twint] Checking for TwintSDK to make native and redirect flow possib…
neelSharma12 Mar 1, 2024
3f27167
[Twint] Adding Configuration to provide return url for the TwintSDKAc…
neelSharma12 Mar 1, 2024
9fb42b2
[Twint] Alert presentation fix (#1534)
neelSharma12 Mar 1, 2024
ac96b4c
Fixed DropIn Configuration for Twint
goergisn Mar 4, 2024
893a0df
Fixed DropIn Configuration for Twint (#1535)
neelSharma12 Mar 4, 2024
c258128
Injecting Twint into the TwintSDKActionComponent
goergisn Mar 4, 2024
c5d0cf8
Adding unit tests for the twint sdk action
goergisn Mar 4, 2024
8d97845
Injecting Twint into the TwintSDKActionComponent (#1536)
neelSharma12 Mar 5, 2024
b3e6dbf
Adding unit tests for the twint sdk action (#1537)
neelSharma12 Mar 5, 2024
8b48062
Merge branch 'develop' into feature_Twint
neelSharma12 Mar 5, 2024
745d888
Moving TwintSpy to Test target
goergisn Mar 5, 2024
24d1c01
Moving TwintSpy to Test target (#1538)
neelSharma12 Mar 5, 2024
b660886
handling twint redirect
goergisn Mar 5, 2024
a4b0200
Adding todos
goergisn Mar 5, 2024
e631df3
Reverting redirect handling check
goergisn Mar 6, 2024
ce9086a
handling twint redirect (#1540)
neelSharma12 Mar 6, 2024
ab0f528
ConfigurationConstants.returnUrl now returns a url
goergisn Mar 6, 2024
10f33af
Refactoring tests
goergisn Mar 6, 2024
8e25efd
Fixed tests + added validation
goergisn Mar 6, 2024
de8d739
ConfigurationConstants.returnUrl now returns a url (#1541)
neelSharma12 Mar 6, 2024
201515b
Added Adyen action in AdyenTwint podspec and package
neelSharma12 Mar 6, 2024
56b1c98
Merge branch 'feature_Twint' into twint_action_full_test
goergisn Mar 7, 2024
e7a1777
Fixing some warnings + failure flow tests
goergisn Mar 7, 2024
73f6238
Fixing demo app
goergisn Mar 8, 2024
1de70c0
Twint action full test (#1544)
neelSharma12 Mar 8, 2024
fbed89c
Updating strings
goergisn Mar 12, 2024
1f85375
Updating localization key
goergisn Mar 12, 2024
fe54396
Reverted Configuration
goergisn Mar 12, 2024
8cf8eec
Reverting german build setting
goergisn Mar 12, 2024
c526c9a
added documentation
neelSharma12 Mar 12, 2024
44e0ced
Updating strings (#1547)
neelSharma12 Mar 12, 2024
3cfbad2
Fixed review comments
neelSharma12 Mar 12, 2024
9ffbc90
updated readme file for twint component
neelSharma12 Mar 12, 2024
76dfdd9
added documentation (#1548)
neelSharma12 Mar 12, 2024
c22e137
Merge branch 'develop' of github.com:Adyen/adyen-ios into feature_Twint
neelSharma12 Mar 12, 2024
e30f3f3
Adding AdyenAction tests for Twint
goergisn Mar 13, 2024
09cb8a9
Adding AdyenAction tests for Twint (#1550)
neelSharma12 Mar 13, 2024
48590e7
Removed LocalizationKey from which was not needed
neelSharma12 Mar 25, 2024
83b3677
Resolved conflict
neelSharma12 Mar 25, 2024
4a8fcd3
Added changes related to status api call
neelSharma12 Apr 23, 2024
15fa3ab
Fixed polling tests
goergisn Apr 24, 2024
111814e
Added changes related to status api call (#1644)
neelSharma12 Apr 24, 2024
e1370ba
Merge branch 'develop' into feature_Twint
goergisn Apr 25, 2024
4f41c82
Fixed tests
goergisn Apr 25, 2024
660d4d2
fix: referencing self
goergisn Apr 25, 2024
fd75abc
using canImport(TwintSDK)
goergisn Apr 26, 2024
b69e4f0
Added AdyenTwint to CocoaPods integration test
goergisn Apr 26, 2024
ad4b824
Adding AdyenTwint to SPM integration test
goergisn Apr 26, 2024
05df667
Trying out bundling TwintSDK with AdyenTwint
goergisn Apr 26, 2024
1748514
Improving TWINT code
goergisn Apr 26, 2024
12e5173
Fixing tests
goergisn Apr 26, 2024
fe8b6be
Fixing carthage integration test
goergisn Apr 26, 2024
d8f7e0f
Fixing CancellableMock import
goergisn Apr 26, 2024
99e295c
moving to apple silicon for integration tests
goergisn Apr 26, 2024
3da3f50
fixing project
goergisn Apr 26, 2024
c5f8255
Merge branch 'develop' into feature_Twint
goergisn Apr 30, 2024
9028950
Some fixes
goergisn Apr 30, 2024
6ca3258
Adding WeChatPay scheme back
goergisn Apr 30, 2024
2a7952c
Some more project adjustment
goergisn Apr 30, 2024
27374ab
Fixing tests
goergisn Apr 30, 2024
87f4dd0
Merge branch 'develop' into feature_Twint
goergisn Apr 30, 2024
9523dbe
Fixing tests
goergisn Apr 30, 2024
c94a203
Trying something out
goergisn Apr 30, 2024
958efcc
Fixed package
goergisn Apr 30, 2024
51dc455
Removing unnecessary adyen dependency
goergisn Apr 30, 2024
5d6c493
Trying something
goergisn Apr 30, 2024
1918d92
fixing comma issue
goergisn Apr 30, 2024
c2d989d
trying something out
goergisn Apr 30, 2024
a577432
Trying out more
goergisn Apr 30, 2024
e277bd5
Make Twint work on SPM and CocoaPods
goergisn Apr 30, 2024
afcdd98
Commenting out archiving code
goergisn Apr 30, 2024
34be2f1
updating podspec
goergisn May 1, 2024
0302424
Reverting podspec change
goergisn May 1, 2024
33f8293
Trying to bump the swift tools version
goergisn May 1, 2024
15f7f70
Adding cleanup trap
goergisn May 2, 2024
d39aa4e
Trying out more
goergisn May 2, 2024
95e6ad9
not archiving for x68
goergisn May 2, 2024
62ed314
Only testing build
goergisn May 2, 2024
ba730c4
Maybe this works
goergisn May 2, 2024
8f55c06
actually running the archive code
goergisn May 2, 2024
f1392fb
Merge branch 'develop' into feature_Twint
goergisn May 2, 2024
1b758eb
Merge branch 'develop' into feature_Twint
goergisn May 2, 2024
0e6192f
Trying newer xcode version
goergisn May 2, 2024
4ab1ae1
Merge branch 'feature_Twint' of github.com:Adyen/adyen-ios into featu…
goergisn May 2, 2024
5c28d6e
lets try a newer macos and even newer xcode
goergisn May 2, 2024
74d49d7
Remove AdyenActions dependency from Twint
goergisn May 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Adyen.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ Pod::Spec.new do |s|
plugin.dependency 'CashAppPayKitUI', '0.5.1'
end

s.subspec 'AdyenTwint' do |plugin|
plugin.source_files = 'AdyenTwint/**/*.swift'
plugin.dependency 'Adyen/Core'
plugin.dependency 'Adyen/TwintSDK'
end

s.subspec 'TwintSDK' do |plugin|
plugin.vendored_frameworks = 'XCFramework/Dynamic/TwintSDK.xcframework'
end


s.subspec 'Card' do |plugin|
plugin.dependency 'Adyen/Core'
plugin.dependency 'Adyen/Encryption'
Expand Down
184 changes: 184 additions & 0 deletions Adyen.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions AdyenTwint/AdyenTwint.docc/AdyenTwint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ``AdyenTwint``

<!--@START_MENU_TOKEN@-->Summary<!--@END_MENU_TOKEN@-->

## Overview

<!--@START_MENU_TOKEN@-->Text<!--@END_MENU_TOKEN@-->

## Topics

### <!--@START_MENU_TOKEN@-->Group<!--@END_MENU_TOKEN@-->

- <!--@START_MENU_TOKEN@-->``Symbol``<!--@END_MENU_TOKEN@-->
17 changes: 17 additions & 0 deletions AdyenTwint/AdyenTwint.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// Copyright (c) 2023 Adyen N.V.
//
// This file is open source and available under the MIT license. See the LICENSE file for more info.
//

#import <Foundation/Foundation.h>

//! Project version number for AdyenTwint.
FOUNDATION_EXPORT double AdyenTwintVersionNumber;

//! Project version string for AdyenTwint.
FOUNDATION_EXPORT const unsigned char AdyenTwintVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <AdyenTwint/PublicHeader.h>


20 changes: 20 additions & 0 deletions AdyenTwint/TwintComponent.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// Copyright (c) 2023 Adyen N.V.
//
// This file is open source and available under the MIT license. See the LICENSE file for more info.
//

@_spi(AdyenInternal) import Adyen
import TwintSDK

public final class TwintComponent {

private lazy var formViewController: FormViewController = {

return formViewController
}()

public var requiresModalPresentation: Bool = true

/// Initializes th
}
18 changes: 17 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ let package = Package(
name: "AdyenCashAppPay",
targets: ["AdyenCashAppPay"]
),
.library(
name: "AdyenTwint",
targets: ["AdyenTwint"]
),
.library(
name: "AdyenDelegatedAuthentication",
targets: ["AdyenDelegatedAuthentication"]
Expand Down Expand Up @@ -180,6 +184,18 @@ let package = Package(
],
path: "AdyenCashAppPay"
),
.target(
name: "AdyenTwint",
dependencies: [
.target(name: "Adyen"),
.target(name: "TwintSDK")
],
path: "AdyenTwint"
),
.binaryTarget(
name: "TwintSDK",
path: "XCFramework/Dynamic/TwintSDK.xcframework"
),
.target(
name: "AdyenDelegatedAuthentication",
dependencies: [
Expand All @@ -188,4 +204,4 @@ let package = Package(
path: "AdyenDelegatedAuthentication"
)
]
)
)
40 changes: 40 additions & 0 deletions XCFramework/Dynamic/TwintSDK.xcframework/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>TwintSDK.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>
<key>LibraryPath</key>
<string>TwintSDK.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// TWAppConfiguration.h
// TwintSDK
//
// Created by Patrick Schmid on 11/05/17.
// Copyright (c) 2017 Monexio. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface TWAppConfiguration : NSObject

@property (strong, nonatomic) NSString* appDisplayName;
@property (strong, nonatomic) NSString* appURLScheme;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// TWError.h
// TwintSDK
//
// Created by Loic Pfister on 12/11/14.
// Copyright (c) 2014 Monexio. All rights reserved.
//

#import <UIKit/UIKit.h>

extern NSString *const TwintSDKDomain;

/*
@typedef NS_ENUM (NSUInteger, TWErrorCode)
@abstract Error codes returned by the TwintSDK in NSError.

@discussion
These are valid only in the scope of TwintSDKDomain.
*/
typedef NS_ENUM(NSInteger, TWErrorCode) {
/*
Like nil for TWErrorCode values, represents an error code that
has not been initialized yet.
*/
/* Payment was successful */
TW_B_SUCCESS,

/* Payment failed for various reason */
TW_B_ERROR,

/* The TWINT application is not installed */
TW_B_APP_NOT_INSTALLED,

/* The format of the code is invalid */
TW_T_CODE_FORMAT_INVALID,

/* The URL schema format is wrong */
TW_IOS_SCHEMA_URL_INVALID
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
//
// Twint.h
// TwintSDK
//
// Created by Loic Pfister on 06/11/14.
// Copyright (c) 2014 Monexio. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <TwintSDK/TWAppConfiguration.h>

@interface Twint : NSObject

typedef void(^TWResponseHandler)(NSError *error);

typedef void (^TWInstalledAppFetchHandler)(NSArray<TWAppConfiguration *>* installedAppConfigurations);

typedef void (^TWAppChooserSelectionHandler)(TWAppConfiguration* selectedConfiguration);

typedef void (^TWAppChooserCancelHandler)(void);

/**
* Calls the Twint app to execute a payment for a known code
* @param code The transaction code
* @param appConfiguration The app configuration with which the payment will be executed
* @param callbackAppScheme The callback app scheme invoked once the Twint app is done with the payment
* @return Returns a NSError object which is nil in case of successful call
*/
+ (NSError*)payWithCode:(NSString*)code appConfiguration:(TWAppConfiguration *)appConfiguration callback:(NSString*)callbackAppScheme;

/**
* This method starts the registration process in the Twint app with a given code
* @param code The transaction code
* @param appConfiguration The app configuration with which the registration will be executed
* @param callbackAppScheme The callback app scheme invoked once the Twint app is done with the registration
* @return Returns a NSError object which is nil in case of successful call
*/
+ (NSError *)registerForUOFWithCode:(NSString *)code appConfiguration:(TWAppConfiguration *)appConfiguration callback:(NSString *)callbackAppScheme;

/**
* Fetches all available app configurations from a remote and returns all that are installed on the device. If there is an error during the fetch, the cache will be used. If there is nothing in the cache yet, all Twint apps will be probed until one is found that is installed.
* @param completionHandler The block which will be executed once the fetch or probing is completed
*/
+ (void)fetchInstalledAppConfigurationsWithCompletionHandler:(TWInstalledAppFetchHandler)completionHandler;

/**
* The returned UIAlertController will show the given app configurations and a cancel button. After pressing a button, the corresponding handler will be called.
* @param selectionHandler The block which will be executed once a selection of a Twint app has been made by the user
* @param cancelHandler The block which will be executed once the user hit the cancel button
*/
+ (UIAlertController *)controllerForAppConfigurations:(NSArray<TWAppConfiguration *> *)installedAppConfigurations
selectedConfigurationHandler:(TWAppChooserSelectionHandler)selectionHandler
cancelHandler:(TWAppChooserCancelHandler)cancelHandler;

/**
* Convenience method to handle the callback from the Twint app
* @param url The url sent by the Twint app
* @param handler The block which will be executed once the callback has been analyzed
* @return Returns YES if the library can handle the URL/callback, NO otherwise
*/
+ (BOOL)handleOpenURL:(NSURL*)url withResponseHandler:(TWResponseHandler)handler;

/**
* Returns the SDK version
* @return Returns the SDK version string
*/
+ (NSString*)version;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// TwintSDK.h
// TwintSDK
//
// Created by bacherma on 15/06/16.
// Copyright © 2016 Twint. All rights reserved.
//

#import <TwintSDK/TWError.h>
#import <TwintSDK/Twint.h>
#import <TwintSDK/TWAppConfiguration.h>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
framework module TwintSDK {
umbrella header "TwintSDK.h"

export *
module * { export * }
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// TWAppConfiguration.h
// TwintSDK
//
// Created by Patrick Schmid on 11/05/17.
// Copyright (c) 2017 Monexio. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface TWAppConfiguration : NSObject

@property (strong, nonatomic) NSString* appDisplayName;
@property (strong, nonatomic) NSString* appURLScheme;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// TWError.h
// TwintSDK
//
// Created by Loic Pfister on 12/11/14.
// Copyright (c) 2014 Monexio. All rights reserved.
//

#import <UIKit/UIKit.h>

extern NSString *const TwintSDKDomain;

/*
@typedef NS_ENUM (NSUInteger, TWErrorCode)
@abstract Error codes returned by the TwintSDK in NSError.

@discussion
These are valid only in the scope of TwintSDKDomain.
*/
typedef NS_ENUM(NSInteger, TWErrorCode) {
/*
Like nil for TWErrorCode values, represents an error code that
has not been initialized yet.
*/
/* Payment was successful */
TW_B_SUCCESS,

/* Payment failed for various reason */
TW_B_ERROR,

/* The TWINT application is not installed */
TW_B_APP_NOT_INSTALLED,

/* The format of the code is invalid */
TW_T_CODE_FORMAT_INVALID,

/* The URL schema format is wrong */
TW_IOS_SCHEMA_URL_INVALID
};
Loading