From 917ba5760371a780afd162cc4985e6de95640f8b Mon Sep 17 00:00:00 2001 From: Budnikov Vyacheslav Date: Wed, 2 Oct 2019 17:40:18 +0300 Subject: [PATCH] iOS13 3DS confirmation fix --- ASDKCore.podspec | 2 +- ASDKCore.xcodeproj/project.pbxproj | 8 +-- ASDKCore/ASDKAcquiringSdk.h | 1 - ASDKCore/ASDKAcquiringSdk.m | 5 -- ASDKCore/ASDKApiKeys.h | 2 - ASDKUI.podspec | 2 +- ASDKUI.xcodeproj/project.pbxproj | 8 +-- ASDKUI/3DSController/ASDK3DSViewController.m | 60 ++++++++++--------- .../ASDKSampleApp.xcodeproj/project.pbxproj | 8 +-- 9 files changed, 47 insertions(+), 49 deletions(-) diff --git a/ASDKCore.podspec b/ASDKCore.podspec index 2e802b6..8730f23 100644 --- a/ASDKCore.podspec +++ b/ASDKCore.podspec @@ -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!" diff --git a/ASDKCore.xcodeproj/project.pbxproj b/ASDKCore.xcodeproj/project.pbxproj index 8cf9f97..7f0daab 100644 --- a/ASDKCore.xcodeproj/project.pbxproj +++ b/ASDKCore.xcodeproj/project.pbxproj @@ -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; @@ -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; @@ -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; @@ -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; diff --git a/ASDKCore/ASDKAcquiringSdk.h b/ASDKCore/ASDKAcquiringSdk.h index e6177cb..9b54c0a 100644 --- a/ASDKCore/ASDKAcquiringSdk.h +++ b/ASDKCore/ASDKAcquiringSdk.h @@ -57,7 +57,6 @@ - (NSString *)domainPath; - (NSString *)domainPath_v2; -- (NSString *)termPath; - (SecKeyRef)publicKeyRef; - (NSInteger)apiRequestsTimeoutInterval; diff --git a/ASDKCore/ASDKAcquiringSdk.m b/ASDKCore/ASDKAcquiringSdk.m index 25fa84e..0129a10 100644 --- a/ASDKCore/ASDKAcquiringSdk.m +++ b/ASDKCore/ASDKAcquiringSdk.m @@ -84,11 +84,6 @@ - (NSString *)domainPath_v2 return [self testDomain] ? kASDKTestDomainName_v2 : kASDKDomainName_v2; } -- (NSString *)termPath -{ - return kASDKAPITermPath; -} - - (SecKeyRef)publicKeyRef { id publicKeyDataSource = self.publicKeyDataSource; diff --git a/ASDKCore/ASDKApiKeys.h b/ASDKCore/ASDKApiKeys.h index 18c56c3..a2a0d82 100644 --- a/ASDKCore/ASDKApiKeys.h +++ b/ASDKCore/ASDKApiKeys.h @@ -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" diff --git a/ASDKUI.podspec b/ASDKUI.podspec index 9e5367e..39aa2a9 100644 --- a/ASDKUI.podspec +++ b/ASDKUI.podspec @@ -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" diff --git a/ASDKUI.xcodeproj/project.pbxproj b/ASDKUI.xcodeproj/project.pbxproj index 00efa71..80ed6ba 100644 --- a/ASDKUI.xcodeproj/project.pbxproj +++ b/ASDKUI.xcodeproj/project.pbxproj @@ -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; @@ -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)"; @@ -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; @@ -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)"; diff --git a/ASDKUI/3DSController/ASDK3DSViewController.m b/ASDKUI/3DSController/ASDK3DSViewController.m index 7491fd8..36ee768 100644 --- a/ASDKUI/3DSController/ASDK3DSViewController.m +++ b/ASDKUI/3DSController/ASDK3DSViewController.m @@ -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]; @@ -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]; @@ -196,7 +195,7 @@ - (void)viewDidLoad - (NSString *)termUrl { - return [self.acquiringSdk termPath]; + return [NSString stringWithFormat:@"%@%@", [self.acquiringSdk domainPath], kASDKSubmit3DSAuthorization]; } - (NSDictionary *)parameters @@ -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 @@ -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) { @@ -346,7 +352,7 @@ - (void)checkPaymentState } else { - NSString *details = [NSString stringWithFormat:@"%@",paymentInfo]; + NSString *details = [NSString stringWithFormat:@"%@", paymentInfo]; ASDKAcquringSdkError *stateError = [ASDKAcquringSdkError errorWithMessage:nil details:details diff --git a/SampleProject/ASDKSampleApp.xcodeproj/project.pbxproj b/SampleProject/ASDKSampleApp.xcodeproj/project.pbxproj index 0cdfb37..03e38b4 100644 --- a/SampleProject/ASDKSampleApp.xcodeproj/project.pbxproj +++ b/SampleProject/ASDKSampleApp.xcodeproj/project.pbxproj @@ -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 = ( @@ -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"; @@ -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 = ( @@ -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";