Skip to content

Commit

Permalink
iOS13 3DS confirmation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Budnikov Vyacheslav committed Oct 2, 2019
1 parent 425f5ed commit 917ba57
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 49 deletions.
2 changes: 1 addition & 1 deletion ASDKCore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Pod::Spec.new do |s|

s.name = "ASDKCore"
s.version = "1.4.6"
s.version = "1.4.7"
s.summary = "Core library that allows you to use internet acquiring from Tinkoff Bank in your app"
s.description = "Core library that allows you to use internet acquiring from Tinkoff Bank in your app!"

Expand Down
8 changes: 4 additions & 4 deletions ASDKCore.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@
isa = XCBuildConfiguration;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CURRENT_PROJECT_VERSION = 73;
CURRENT_PROJECT_VERSION = 74;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -905,7 +905,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.4.6;
MARKETING_VERSION = 1.4.7;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = ru.tcsbank.ASDKCore;
Expand All @@ -919,7 +919,7 @@
isa = XCBuildConfiguration;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CURRENT_PROJECT_VERSION = 73;
CURRENT_PROJECT_VERSION = 74;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -929,7 +929,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.4.6;
MARKETING_VERSION = 1.4.7;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = ru.tcsbank.ASDKCore;
Expand Down
1 change: 0 additions & 1 deletion ASDKCore/ASDKAcquiringSdk.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@

- (NSString *)domainPath;
- (NSString *)domainPath_v2;
- (NSString *)termPath;
- (SecKeyRef)publicKeyRef;
- (NSInteger)apiRequestsTimeoutInterval;

Expand Down
5 changes: 0 additions & 5 deletions ASDKCore/ASDKAcquiringSdk.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ - (NSString *)domainPath_v2
return [self testDomain] ? kASDKTestDomainName_v2 : kASDKDomainName_v2;
}

- (NSString *)termPath
{
return kASDKAPITermPath;
}

- (SecKeyRef)publicKeyRef
{
id<ASDKAcquiringSdkPublicKeyDataSource> publicKeyDataSource = self.publicKeyDataSource;
Expand Down
2 changes: 0 additions & 2 deletions ASDKCore/ASDKApiKeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
#define kASDKTestDomainName_v2 @"https://rest-api-test.tcsbank.ru/v2/"
#define kASDKDomainName_v2 @"https://securepay.tinkoff.ru/v2/"

#define kASDKAPITermPath @"https://api.tinkoff.ru/v1/3ds"

#define kASDKAPIPathInit @"Init"
#define kASDKAPIPathFinishAuthorize @"FinishAuthorize"
#define kASDKAPIPathCharge @"Charge"
Expand Down
2 changes: 1 addition & 1 deletion ASDKUI.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "ASDKUI"
s.version = "1.4.6"
s.version = "1.4.7"
s.summary = "UI components library for internet acquiring from Tinkoff Bank"
s.description = "UI components library for internet acquiring from Tinkoff Bank!"
s.homepage = "https://www.tinkoff.ru"
Expand Down
8 changes: 4 additions & 4 deletions ASDKUI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CURRENT_PROJECT_VERSION = 73;
CURRENT_PROJECT_VERSION = 74;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -948,7 +948,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.4.6;
MARKETING_VERSION = 1.4.7;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = ru.tcsbank.ASDKUI;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -963,7 +963,7 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CURRENT_PROJECT_VERSION = 73;
CURRENT_PROJECT_VERSION = 74;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -978,7 +978,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.4.6;
MARKETING_VERSION = 1.4.7;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = ru.tcsbank.ASDKUI;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
60 changes: 33 additions & 27 deletions ASDKUI/3DSController/ASDK3DSViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ - (void)setupWebView
{
WKWebViewConfiguration *wkWebConfig = [WKWebViewConfiguration new];
self.webView = [[WKWebView alloc] initWithFrame: CGRectZero configuration: wkWebConfig];
self.webView.UIDelegate = self;
self.webView.navigationDelegate = self;
self.webView.allowsBackForwardNavigationGestures = YES;
[self.view addSubview: self.webView];
Expand Down Expand Up @@ -179,15 +178,15 @@ - (void)viewDidLoad

self.navigationItem.leftBarButtonItem = [[ASDKBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel3DS)];

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:self.threeDsData.ACSUrl];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL: self.threeDsData.ACSUrl];
request.timeoutInterval = _acquiringSdk.apiRequestsTimeoutInterval;
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPMethod:@"POST"];
NSString *dataString = [self stringFromParameters:[self parameters]];
[request setValue: @"application/x-www-form-urlencoded" forHTTPHeaderField: @"Content-Type"];
[request setHTTPMethod: @"POST"];
NSString *dataString = [self stringFromParameters: [self parameters]];

NSData *postData = [dataString dataUsingEncoding:NSUTF8StringEncoding];
NSData *postData = [dataString dataUsingEncoding: NSUTF8StringEncoding];

[request setHTTPBody:postData];
[request setHTTPBody: postData];

[[NSNotificationCenter defaultCenter] postNotificationName:ASDKNotificationShowLoader object:nil];

Expand All @@ -196,7 +195,7 @@ - (void)viewDidLoad

- (NSString *)termUrl
{
return [self.acquiringSdk termPath];
return [NSString stringWithFormat:@"%@%@", [self.acquiringSdk domainPath], kASDKSubmit3DSAuthorization];
}

- (NSDictionary *)parameters
Expand Down Expand Up @@ -236,26 +235,33 @@ - (NSString *)stringFromParameters:(NSDictionary *)parameters

- (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation
{
[webView evaluateJavaScript:@"document.getElementsByName('PaRes')[0].value" completionHandler:^(id _Nullable value, NSError * _Nullable error) {
if (error == nil)
{
NSString *paRes = (NSString *)value;
if (paRes.length > 0)
if (self.webView == webView)
{
[self.webView evaluateJavaScript:@"document.baseURI" completionHandler:^(id _Nullable value, NSError * _Nullable error) {
if (error == nil)
{
switch (self.checkStateType) {
case CheckStateType_payment:
[self checkPaymentState];
break;

default:
[self checkAddCardState];
break;
NSString *termUrl = (NSString *)value;
if ([termUrl rangeOfString:@"cancel.do"].location != NSNotFound)
{
[self cancel3DS];
}
else if ([termUrl rangeOfString:[self termUrl]].location != NSNotFound)
{
switch (self.checkStateType) {
case CheckStateType_payment:
[self checkPaymentState];
break;

default:
[self checkAddCardState];
break;
}
}
}
}
}];

[[NSNotificationCenter defaultCenter] postNotificationName:ASDKNotificationHideLoader object:nil];
}];

[[NSNotificationCenter defaultCenter] postNotificationName:ASDKNotificationHideLoader object:nil];
}
}

#pragma mark - UIWebViewDelegate
Expand Down Expand Up @@ -337,7 +343,7 @@ - (void)checkPaymentState
[[NSNotificationCenter defaultCenter] postNotificationName:ASDKNotificationHideLoader object:nil];

[self closeSelfWithCompletion:^{
if (status == ASDKPaymentStatus_CONFIRMED || status == ASDKPaymentStatus_AUTHORIZED)
if (status == ASDKPaymentStatus_CONFIRMED || status == ASDKPaymentStatus_AUTHORIZED || status == ASDKPaymentStatus_3DS_CHECKED)
{
if (self.onSuccess)
{
Expand All @@ -346,7 +352,7 @@ - (void)checkPaymentState
}
else
{
NSString *details = [NSString stringWithFormat:@"%@",paymentInfo];
NSString *details = [NSString stringWithFormat:@"%@", paymentInfo];

ASDKAcquringSdkError *stateError = [ASDKAcquringSdkError errorWithMessage:nil
details:details
Expand Down
8 changes: 4 additions & 4 deletions SampleProject/ASDKSampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = ASDKSampleApp/ASDKSampleApp.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 73;
CURRENT_PROJECT_VERSION = 74;
DEVELOPMENT_TEAM = 8SEFGGQX9M;
ENABLE_BITCODE = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -790,7 +790,7 @@
INFOPLIST_FILE = "ASDKSampleApp/Supporting files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.4.6;
MARKETING_VERSION = 1.4.7;
PRODUCT_BUNDLE_IDENTIFIER = ru.tcsbank.ASDKSample;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "179273f2-bc09-426b-b1e5-b41e5ca91de9";
Expand All @@ -806,7 +806,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = ASDKSampleApp/ASDKSampleApp.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 73;
CURRENT_PROJECT_VERSION = 74;
DEVELOPMENT_TEAM = 8SEFGGQX9M;
ENABLE_BITCODE = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -817,7 +817,7 @@
INFOPLIST_FILE = "ASDKSampleApp/Supporting files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.4.6;
MARKETING_VERSION = 1.4.7;
PRODUCT_BUNDLE_IDENTIFIER = ru.tcsbank.ASDKSample;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "179273f2-bc09-426b-b1e5-b41e5ca91de9";
Expand Down

0 comments on commit 917ba57

Please sign in to comment.