Skip to content

Commit

Permalink
v 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Budnikov Vyacheslav committed Nov 15, 2016
2 parents 228b7f4 + b5f5e97 commit 3ae5a6f
Show file tree
Hide file tree
Showing 99 changed files with 1,529 additions and 432 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.0.3"
s.version = "1.1.0"
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
12 changes: 8 additions & 4 deletions ASDKCore.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
Expand All @@ -703,7 +704,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -736,6 +737,7 @@
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_BITCODE = NO;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
Expand All @@ -746,7 +748,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -764,11 +766,12 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = ASDKCore/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
ONLY_ACTIVE_ARCH = NO;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = ru.tcsbank.ASDKCore;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -785,11 +788,12 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = ASDKCore/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
ONLY_ACTIVE_ARCH = NO;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = ru.tcsbank.ASDKCore;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
3 changes: 2 additions & 1 deletion ASDKCore/API Objects/Card/ASDKCard.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ typedef enum
{
ASDKCardTypeVisa = '4',
ASDKCardTypeMastercard = '5',
ASDKCardTypeMaestro = '6'
ASDKCardTypeMaestro = '6',
ASDKCardTypeMIR = '2'
} ASDKCardType;

@interface ASDKCard : ASDKBaseObject
Expand Down
29 changes: 24 additions & 5 deletions ASDKCore/API Objects/Card/ASDKCard.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,38 @@ - (ASDKCardType)cardType
break;
}
case ASDKCardTypeMastercard:
{
_cardType = ASDKCardTypeMastercard;
break;
}
case ASDKCardTypeMIR:
if ([cardNumber length] >= 4)
{
NSString *headNumbers = [cardNumber substringToIndex:4];
if ([headNumbers length] == 4)
{
NSRegularExpression *regExp = [NSRegularExpression regularExpressionWithPattern:@"^220[0-4]" options:NSRegularExpressionCaseInsensitive error:nil];

__block NSTextCheckingType checkingType;
[regExp enumerateMatchesInString:cardNumber options:0 range:NSMakeRange(0, cardNumber.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop){
checkingType = result.resultType;
}];

if (checkingType == NSTextCheckingTypeRegularExpression)
{
_cardType = ASDKCardTypeMIR;
}
}
}
break;

case ASDKCardTypeMaestro:
{
_cardType = ASDKCardTypeMaestro;
break;
}



}
}
return _cardType;
}

Expand Down
4 changes: 2 additions & 2 deletions ASDKCore/API Objects/Request/Charge/ASDKChargeRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

@interface ASDKChargeRequest : ASDKAcquiringRequest

@property (nonatomic, strong) NSNumber *paymentId;
@property (nonatomic, strong) NSString *paymentId;
@property (nonatomic, strong) NSNumber *rebillId;

- (ASDKChargeRequest *)initWithTerminalKey:(NSString *)terminalKey
paymentId:(NSNumber *)paymentId
paymentId:(NSString *)paymentId
rebillId:(NSNumber *)rebillId
token:(NSString *)token;

Expand Down
2 changes: 1 addition & 1 deletion ASDKCore/API Objects/Request/Charge/ASDKChargeRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@implementation ASDKChargeRequest

- (ASDKChargeRequest *)initWithTerminalKey:(NSString *)terminalKey
paymentId:(NSNumber *)paymentId
paymentId:(NSString *)paymentId
rebillId:(NSNumber *)rebillId
token:(NSString *)token
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@

@interface ASDKFinishAuthorizeRequest : ASDKAcquiringRequest

@property (nonatomic, strong) NSNumber *paymentId;
@property (nonatomic, strong) NSString *paymentId;
@property (nonatomic, strong) NSString *sendEmail;
@property (nonatomic, strong) NSString *cardData;
@property (nonatomic, strong) NSString *infoEmail;
@property (nonatomic, strong) NSString *encryptedPaymentData;

- (ASDKFinishAuthorizeRequest *)initWithTerminalKey:(NSString *)terminalKey
paymentId:(NSNumber *)paymentId
paymentId:(NSString *)paymentId
sendEmail:(NSString *)sendEmail
cardData:(NSString *)cardData
infoEmail:(NSString *)infoEmail
token:(NSString *)token;
token:(NSString *)token
encryptedPaymentData:(NSString *)encryptedPaymentData;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
@implementation ASDKFinishAuthorizeRequest

- (ASDKFinishAuthorizeRequest *)initWithTerminalKey:(NSString *)terminalKey
paymentId:(NSNumber *)paymentId
paymentId:(NSString *)paymentId
sendEmail:(NSString *)sendEmail
cardData:(NSString *)cardData
infoEmail:(NSString *)infoEmail
token:(NSString *)token
token:(NSString *)token
encryptedPaymentData:(NSString *)encryptedPaymentData
{
ASDKFinishAuthorizeRequest *request = [[ASDKFinishAuthorizeRequest alloc] init];

Expand All @@ -39,8 +40,9 @@ - (ASDKFinishAuthorizeRequest *)initWithTerminalKey:(NSString *)terminalKey
request.cardData = cardData;
request.infoEmail = infoEmail;
request.token = token;
request.encryptedPaymentData = encryptedPaymentData;
}

return request;
}

Expand Down
4 changes: 2 additions & 2 deletions ASDKCore/API Objects/Request/GetState/ASDKGetStateRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

@interface ASDKGetStateRequest : ASDKAcquiringRequest

@property (nonatomic, strong) NSNumber *paymentId;
@property (nonatomic, strong) NSString *paymentId;

- (ASDKGetStateRequest *)initWithTerminalKey:(NSString *)terminalKey
paymentId:(NSNumber *)paymentId
paymentId:(NSString *)paymentId
token:(NSString *)token;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@implementation ASDKGetStateRequest

- (ASDKGetStateRequest *)initWithTerminalKey:(NSString *)terminalKey
paymentId:(NSNumber *)paymentId
paymentId:(NSString *)paymentId
token:(NSString *)token
{
ASDKGetStateRequest *request = [[ASDKGetStateRequest alloc] init];
Expand Down
2 changes: 2 additions & 0 deletions ASDKCore/API Objects/Request/Init/ASDKInitRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

@interface ASDKInitRequest : ASDKAcquiringRequest

@property (nonatomic, copy) NSString *payType;
@property (nonatomic, strong) NSNumber *amount;
@property (nonatomic, copy) NSString *orderId;
@property (nonatomic, copy) NSString *customerKey;
Expand All @@ -35,6 +36,7 @@
description:(NSString *)description
token:(NSString *)token
payForm:(NSString *)payForm
payType:(NSString *)payType
customerKey:(NSString *)customerKey
recurrent:(BOOL)recurrent;

Expand Down
3 changes: 3 additions & 0 deletions ASDKCore/API Objects/Request/Init/ASDKInitRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ - (ASDKInitRequest *)initWithTerminalKey:(NSString *)terminalKey
description:(NSString *)description
token:(NSString *)token
payForm:(NSString *)payForm
payType:(NSString *)payType
customerKey:(NSString *)customerKey
recurrent:(BOOL)recurrent
{
Expand All @@ -36,11 +37,13 @@ - (ASDKInitRequest *)initWithTerminalKey:(NSString *)terminalKey
if (request)
{
request.terminalKey = terminalKey;
request.payType = payType;
request.amount = amount;
request.orderId = orderId;
request.requestDescription = description;
request.token = token;
request.payForm = payForm;
request.payType = payType;
request.customerKey = customerKey;
request.recurrent = recurrent;
}
Expand Down
2 changes: 1 addition & 1 deletion ASDKCore/API Objects/Response/Init/ASDKInitResponse.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@

@property (nonatomic, strong) NSNumber *amount;
@property (nonatomic, copy) NSString *orderId;
@property (nonatomic, strong) NSNumber *paymentId;
@property (nonatomic, strong) NSString *paymentId;

@end
14 changes: 7 additions & 7 deletions ASDKCore/API Objects/Response/Init/ASDKInitResponse.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ - (void)clearAllProperties
_orderId = nil;
}

- (NSNumber *)paymentId
- (NSString *)paymentId
{
if (!_paymentId)
{
_paymentId =_dictionary[kASDKPaymentId];
if (![_paymentId isKindOfClass:[NSNumber class]])
{
_paymentId = [NSNumber numberWithDouble:_paymentId.doubleValue];
}
_paymentId =[_dictionary objectForKey:kASDKPaymentId];

//if (![_paymentId isKindOfClass:[NSNumber class]])
//{
// _paymentId = [NSNumber numberWithDouble:_paymentId.doubleValue];
//}
}

return _paymentId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

@interface ASDKPaymentInfo : ASDKBaseObject

@property (nonatomic, strong) NSNumber *paymentId;
@property (nonatomic, strong) NSString *paymentId;
@property (nonatomic, copy) NSString *orderId;
@property (nonatomic, strong) NSNumber *amount;

Expand Down
12 changes: 6 additions & 6 deletions ASDKCore/API Objects/Response/PaymentInfo/ASDKPaymentInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@

@implementation ASDKPaymentInfo

- (NSNumber *)paymentId
- (NSString *)paymentId
{
if (!_paymentId)
{
_paymentId =_dictionary[kASDKPaymentId];
_paymentId = [_dictionary objectForKey:kASDKPaymentId];

if (![_paymentId isKindOfClass:[NSNumber class]])
{
_paymentId = [NSNumber numberWithDouble:_paymentId.doubleValue];
}
//if (![_paymentId isKindOfClass:[NSNumber class]])
//{
// _paymentId = [NSNumber numberWithDouble:_paymentId.doubleValue];
//}
}

return _paymentId;
Expand Down
21 changes: 11 additions & 10 deletions ASDKCore/ASDKAcquiringApi.m
Original file line number Diff line number Diff line change
Expand Up @@ -236,20 +236,21 @@ - (void)finishAuthorizeWithRequest:(ASDKFinishAuthorizeRequest *)request
success:(void (^)(ASDKThreeDsData *data, ASDKPaymentInfo *paymentInfo, ASDKPaymentStatus status))success
failure:(void (^)(ASDKAcquringApiError *error))failure
{
NSMutableDictionary *parameters = @{kASDKTerminalKey : request.terminalKey,
kASDKPaymentId : request.paymentId,
kASDKCardData : request.cardData,
kASDKSendEmail : request.sendEmail,
kASDKToken : request.token
}.mutableCopy;

NSMutableDictionary *parameters = [NSMutableDictionary new];

[parameters setObject:request.terminalKey forKey:kASDKTerminalKey];
[parameters setObject:request.paymentId forKey:kASDKPaymentId];
if ([request.cardData length] > 0) {[parameters setObject:request.cardData forKey:kASDKCardData];}
if ([request.sendEmail length] > 0) {[parameters setObject:request.sendEmail forKey:kASDKSendEmail];}
[parameters setObject:request.token forKey:kASDKToken];
if ([request.encryptedPaymentData length] > 0) {[parameters setObject:request.encryptedPaymentData forKey:@"EncryptedPaymentData"];}

if (request.infoEmail && [request.sendEmail boolValue])
{
[parameters setObject:request.infoEmail forKey:kASDKInfoEmail];
}

[self path:kASDKAPIPathFinishAuthorize
parameters:parameters

[self path:kASDKAPIPathFinishAuthorize parameters:parameters
success:^(NSDictionary *responseDictionary, NSURLResponse *response)
{
ASDKFinishAuthorizeResponse *responseObject = [[ASDKFinishAuthorizeResponse alloc] initWithDictionary:responseDictionary];
Expand Down
13 changes: 5 additions & 8 deletions ASDKCore/ASDKAcquiringSdk.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,10 @@
- (SecKeyRef)publicKeyRef;

+ (ASDKAcquiringSdk *)acquiringSdkWithTerminalKey:(NSString *)terminalKey
payType:(NSString *)payType
password:(NSString *)password
publicKeyDataSource:(id<ASDKAcquiringSdkPublicKeyDataSource>)publicKeyDataSource;

//+ (ASDKAcquiringSdk *)acquiringSdkWithTerminalKey:(NSString *)terminalKey
// password:(NSString *)password
// publicKey:(SecKeyRef)publicKey;


- (void)initWithAmount:(NSNumber *)amount
orderId:(NSString *)orderId
description:(NSString *)description
Expand All @@ -70,18 +66,19 @@
success:(void (^)(ASDKInitResponse *response))success
failure:(void (^)(ASDKAcquringSdkError *error))failure;

- (void)finishAuthorizeWithPaymentId:(NSNumber *)paymentId
- (void)finishAuthorizeWithPaymentId:(NSString *)paymentId
encryptedPaymentData:(NSString *)encryptedPaymentData
cardData:(NSString *)cardData
infoEmail:(NSString *)infoEmail
success:(void (^)(ASDKThreeDsData *data, ASDKPaymentInfo *paymentInfo, ASDKPaymentStatus status))success
failure:(void (^)(ASDKAcquringSdkError *error))failure;

- (void)chargeWithPaymentId:(NSNumber *)paymentId
- (void)chargeWithPaymentId:(NSString *)paymentId
rebillId:(NSNumber *)rebillId
success:(void (^)(ASDKThreeDsData *data, ASDKPaymentInfo *paymentInfo))success
failure:(void (^)(ASDKAcquringSdkError *error))failure;

- (void)getStateWithPaymentId:(NSNumber *)paymentId
- (void)getStateWithPaymentId:(NSString *)paymentId
success:(void (^)(ASDKPaymentInfo *paymentInfo, ASDKPaymentStatus status))success
failure:(void (^)(ASDKAcquringSdkError *error))failure;

Expand Down
Loading

0 comments on commit 3ae5a6f

Please sign in to comment.