Skip to content

Commit

Permalink
refactor from property to init
Browse files Browse the repository at this point in the history
  • Loading branch information
Makarov Dmitriy Aleksandrovich committed Nov 15, 2019
1 parent 334c5b0 commit eccfadf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
7 changes: 7 additions & 0 deletions ASDKCore/API Objects/Response/Charge/ASDKChargeResponse.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions ASDKCore/API Objects/Response/Charge/ASDKChargeResponse.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions ASDKCore/ASDKAcquiringApi.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit eccfadf

Please sign in to comment.