From 334c5b031dbc264a664616f5c444fc424011eee9 Mon Sep 17 00:00:00 2001 From: Makarov Dmitriy Aleksandrovich Date: Mon, 11 Nov 2019 17:53:52 +0700 Subject: [PATCH 1/3] add rebill id into output --- ASDKCore/API Objects/Response/PaymentInfo/ASDKPaymentInfo.h | 1 + ASDKCore/ASDKAcquiringApi.m | 1 + 2 files changed, 2 insertions(+) diff --git a/ASDKCore/API Objects/Response/PaymentInfo/ASDKPaymentInfo.h b/ASDKCore/API Objects/Response/PaymentInfo/ASDKPaymentInfo.h index bfb4bfb..2de2d62 100644 --- a/ASDKCore/API Objects/Response/PaymentInfo/ASDKPaymentInfo.h +++ b/ASDKCore/API Objects/Response/PaymentInfo/ASDKPaymentInfo.h @@ -27,5 +27,6 @@ @property (nonatomic, copy) NSString *orderId; @property (nonatomic, strong) NSNumber *amount; @property (nonatomic, strong) NSString *status; +@property (nonatomic, strong) NSNumber *rebillId; @end diff --git a/ASDKCore/ASDKAcquiringApi.m b/ASDKCore/ASDKAcquiringApi.m index 64911a1..6f64052 100644 --- a/ASDKCore/ASDKAcquiringApi.m +++ b/ASDKCore/ASDKAcquiringApi.m @@ -356,6 +356,7 @@ - (void)chargeWithRequest:(ASDKChargeRequest *)request success:^(NSDictionary *responseDictionary, NSURLResponse *response) { ASDKChargeResponse *responseObject = [[ASDKChargeResponse alloc] initWithDictionary:responseDictionary]; + responseObject.paymentInfo.rebillId = request.rebillId; success(responseObject.paymentInfo, responseObject.status); } failure:^(ASDKAcquringApiError *error) From eccfadf1e29443d175f02a445e53c25c7cf09d7c Mon Sep 17 00:00:00 2001 From: Makarov Dmitriy Aleksandrovich Date: Fri, 15 Nov 2019 12:50:37 +0700 Subject: [PATCH 2/3] refactor from property to init --- .../API Objects/Response/Charge/ASDKChargeResponse.h | 7 +++++++ .../API Objects/Response/Charge/ASDKChargeResponse.m | 10 ++++++++++ ASDKCore/ASDKAcquiringApi.m | 3 +-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ASDKCore/API Objects/Response/Charge/ASDKChargeResponse.h b/ASDKCore/API Objects/Response/Charge/ASDKChargeResponse.h index 47e7db0..8e64969 100644 --- a/ASDKCore/API Objects/Response/Charge/ASDKChargeResponse.h +++ b/ASDKCore/API Objects/Response/Charge/ASDKChargeResponse.h @@ -22,9 +22,16 @@ #import "ASDKPaymentInfo.h" #import "ASDKThreeDsData.h" +NS_ASSUME_NONNULL_BEGIN + @interface ASDKChargeResponse : ASDKAcquiringResponse +- (instancetype)initWithDictionary:(NSDictionary *)dictionary + rebillId:(nullable NSNumber *)rebillId; + @property (nonatomic, strong) ASDKPaymentInfo *paymentInfo; @property (nonatomic, strong) ASDKThreeDsData *threeDsData; @end + +NS_ASSUME_NONNULL_END diff --git a/ASDKCore/API Objects/Response/Charge/ASDKChargeResponse.m b/ASDKCore/API Objects/Response/Charge/ASDKChargeResponse.m index 6c69a0d..c8c0931 100644 --- a/ASDKCore/API Objects/Response/Charge/ASDKChargeResponse.m +++ b/ASDKCore/API Objects/Response/Charge/ASDKChargeResponse.m @@ -23,6 +23,16 @@ @implementation ASDKChargeResponse +-(instancetype)initWithDictionary:(NSDictionary *)dictionary + rebillId:(NSNumber *)rebillId { + self = [super initWithDictionary:dictionary]; + if (!self) { + return nil; + } + _paymentInfo.rebillId = rebillId; + return self; +} + - (ASDKThreeDsData *)threeDsData { if (!_threeDsData) diff --git a/ASDKCore/ASDKAcquiringApi.m b/ASDKCore/ASDKAcquiringApi.m index 6f64052..30f1a62 100644 --- a/ASDKCore/ASDKAcquiringApi.m +++ b/ASDKCore/ASDKAcquiringApi.m @@ -355,8 +355,7 @@ - (void)chargeWithRequest:(ASDKChargeRequest *)request [self apiVersion:APIVersion_v2 path:kASDKAPIPathCharge parameters:parameters success:^(NSDictionary *responseDictionary, NSURLResponse *response) { - ASDKChargeResponse *responseObject = [[ASDKChargeResponse alloc] initWithDictionary:responseDictionary]; - responseObject.paymentInfo.rebillId = request.rebillId; + ASDKChargeResponse *responseObject = [[ASDKChargeResponse alloc] initWithDictionary:responseDictionary rebillId:request.rebillId]; success(responseObject.paymentInfo, responseObject.status); } failure:^(ASDKAcquringApiError *error) From 879154c33b68dceecf71f4d5c4704295a278af64 Mon Sep 17 00:00:00 2001 From: Makarov Dmitriy Aleksandrovich Date: Thu, 21 Nov 2019 13:36:06 +0700 Subject: [PATCH 3/3] create payment info in init for ASDKChargeResponse --- ASDKCore/API Objects/Response/Charge/ASDKChargeResponse.m | 1 + 1 file changed, 1 insertion(+) diff --git a/ASDKCore/API Objects/Response/Charge/ASDKChargeResponse.m b/ASDKCore/API Objects/Response/Charge/ASDKChargeResponse.m index c8c0931..0661ac5 100644 --- a/ASDKCore/API Objects/Response/Charge/ASDKChargeResponse.m +++ b/ASDKCore/API Objects/Response/Charge/ASDKChargeResponse.m @@ -29,6 +29,7 @@ -(instancetype)initWithDictionary:(NSDictionary *)dictionary if (!self) { return nil; } + _paymentInfo = [[ASDKPaymentInfo alloc] initWithDictionary:_dictionary]; _paymentInfo.rebillId = rebillId; return self; }