Skip to content

Commit

Permalink
Bug fixes (#158)
Browse files Browse the repository at this point in the history
* bug fixes

- Result field returns wrong enum value
- Payment/PreAuth method - security code missing

* Small fixes
  • Loading branch information
stefan-tudor authored Sep 16, 2022
1 parent f020ed8 commit ce66150
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.1.3;
MARKETING_VERSION = 3.1.4;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.judo.JudoPayDemoObjC;
PRODUCT_NAME = "Judopay demo";
Expand All @@ -1116,7 +1116,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.1.3;
MARKETING_VERSION = 3.1.4;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.judo.JudoPayDemoObjC;
PRODUCT_NAME = "Judopay demo";
Expand Down
2 changes: 1 addition & 1 deletion Examples/ObjectiveCExampleApp/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ target 'ObjectiveCExampleApp' do
pod 'Judo3DS2_iOS', '1.1.1'

pod 'JudoKit-iOS', :path => '../../'
# pod 'JudoKit-iOS', '3.1.3'
# pod 'JudoKit-iOS', '3.1.4'

pod 'MaterialComponents/Snackbar'
pod 'InAppSettingsKit', '3.3.6'
Expand Down
6 changes: 3 additions & 3 deletions Examples/ObjectiveCExampleApp/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PODS:
- OpenSSL-Universal (~> 1.1.180)
- InAppSettingsKit (3.3.6)
- Judo3DS2_iOS (1.1.1)
- JudoKit-iOS (3.1.3):
- JudoKit-iOS (3.1.4):
- DeviceDNA (~> 2.0.0)
- Judo3DS2_iOS (~> 1.1.1)
- TrustKit
Expand Down Expand Up @@ -121,14 +121,14 @@ SPEC CHECKSUMS:
DeviceDNA: 9ff289d1fb983937754b324fa0adade2081210c4
InAppSettingsKit: 37df0b44132380d4c7db6fc7cded92997e29873a
Judo3DS2_iOS: 1699474533e69b69593c6a76b42645cb240f618a
JudoKit-iOS: 5cf695508b309a32de91cf295dd6ad1dbd6da7b7
JudoKit-iOS: b27be15d89a866fc631cb41e8b1bf858bd7ef922
MaterialComponents: 1a9b2d9d45b1601ae544de85089adc4c464306d4
MDFInternationalization: d697c55307816222a55685c4ccb1044ffb030c12
MDFTextAccessibility: f4bb4cc2194286651b59a215fdeaa0e05dc90ba5
OpenSSL-Universal: ee0a7a25f2042782e2df405e66db3e429198e392
TrustKit: 610b8c71c07914756dd74c380040a3408a747798
ZappMerchantLib: b14bc5814840426d351190309250347ca9b0983d

PODFILE CHECKSUM: 329b62a1c91d513968575fafa51d80b66ae2b98c
PODFILE CHECKSUM: ab6d39957f7926b3c432c44c02a79a5b0569bf12

COCOAPODS: 1.11.3
4 changes: 2 additions & 2 deletions Examples/SwiftExampleApp/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PODS:
- OpenSSL-Universal (~> 1.1.180)
- InAppSettingsKit (3.3.6)
- Judo3DS2_iOS (1.1.1)
- JudoKit-iOS (3.1.3):
- JudoKit-iOS (3.1.4):
- DeviceDNA (~> 2.0.0)
- Judo3DS2_iOS (~> 1.1.1)
- TrustKit
Expand Down Expand Up @@ -41,7 +41,7 @@ SPEC CHECKSUMS:
DeviceDNA: 9ff289d1fb983937754b324fa0adade2081210c4
InAppSettingsKit: 37df0b44132380d4c7db6fc7cded92997e29873a
Judo3DS2_iOS: 1699474533e69b69593c6a76b42645cb240f618a
JudoKit-iOS: 3d32a771a931398754d256a1f174e8510e5446f4
JudoKit-iOS: b27be15d89a866fc631cb41e8b1bf858bd7ef922
OpenSSL-Universal: ee0a7a25f2042782e2df405e66db3e429198e392
SwiftLint: 32ee33ded0636d0905ef6911b2b67bbaeeedafa5
TrustKit: dad4c3a08248c21fcb9a3b5be3c2e2b9d4f9b973
Expand Down
2 changes: 1 addition & 1 deletion JudoKit-iOS.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'JudoKit-iOS'
s.version = '3.1.3'
s.version = '3.1.4'
s.summary = 'Judo Pay Full iOS Client Kit'
s.homepage = 'https://www.judopay.com/'
s.license = 'MIT'
Expand Down
2 changes: 1 addition & 1 deletion Source/JudoKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@protocol JPAuthorization;

static NSString *__nonnull const JudoKitName = @"JudoKit_iOS";
static NSString *__nonnull const JudoKitVersion = @"3.1.3";
static NSString *__nonnull const JudoKitVersion = @"3.1.4";

@interface JudoKit : NSObject

Expand Down
2 changes: 1 addition & 1 deletion Source/Models/ApplePayWrappers/JPApplePayWrappers.m
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ + (PKShippingType)pkShippingTypeForConfiguration:(JPConfiguration *)configuratio
if (cardNetworks & JPCardNetworkTypeMasterCard) {
[pkPaymentNetworks addObject:PKPaymentNetworkMasterCard];
}

if (cardNetworks & JPCardNetworkTypeAMEX) {
[pkPaymentNetworks addObject:PKPaymentNetworkAmex];
}
Expand Down
51 changes: 43 additions & 8 deletions Source/Models/Response/JPResponse.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@
#import "JPConsumer.h"
#import "JPOrderDetails.h"

static NSString *const kStatusDeclined = @"declined";
static NSString *const kStatusSuccess = @"success";
static NSString *const kStatusError = @"error";

static NSString *const kTransactionTypePayment = @"payment";
static NSString *const kTransactionTypePreAuth = @"preauth";
static NSString *const kTransactionTypeRegister = @"register";
static NSString *const kTransactionTypeRegisterCard = @"registercard";
static NSString *const kTransactionTypeSaveCard = @"save";
static NSString *const kTransactionTypeCheckCard = @"checkcard";

@implementation JPResponse

- (instancetype)initWithDictionary:(NSDictionary *)dictionary {
Expand Down Expand Up @@ -112,23 +123,47 @@ - (void)setupIDEALFromDictionary:(NSDictionary *)dictionary {
}

- (JPTransactionResult)transactionResultForString:(NSString *)resultString {
if ([resultString isEqualToString:@"Declined"]) {
NSString *result = resultString.lowercaseString;

if ([result isEqualToString:kStatusSuccess]) {
return JPTransactionResultSuccess;
}

if ([result isEqualToString:kStatusDeclined]) {
return JPTransactionResultDeclined;
}
return JPTransactionResultSuccess;

if ([result isEqualToString:kStatusError]) {
return JPTransactionResultError;
}

return JPTransactionResultUnknown;
}

- (JPTransactionType)transactionTypeForString:(NSString *)typeString {
if ([typeString isEqualToString:@"PreAuth"]) {
NSString *type = typeString.lowercaseString;

if ([type isEqualToString:kTransactionTypePayment]) {
return JPTransactionTypePayment;
}

if ([type isEqualToString:kTransactionTypePreAuth]) {
return JPTransactionTypePreAuth;
} else if ([typeString isEqualToString:@"RegisterCard"]) {
}

if ([type isEqualToString:kTransactionTypeRegister] || [type isEqualToString:kTransactionTypeRegisterCard]) {
return JPTransactionTypeRegisterCard;
} else if ([typeString isEqualToString:@"Save"]) {
return JPTransactionTypeSaveCard;
} else if ([typeString isEqualToString:@"CheckCard"]) {
}

if ([type isEqualToString:kTransactionTypeCheckCard]) {
return JPTransactionTypeCheckCard;
}
return JPTransactionTypePayment;

if ([type isEqualToString:kTransactionTypeSaveCard]) {
return JPTransactionTypeSaveCard;
}

return JPTransactionTypeUnknown;
}

@end
7 changes: 4 additions & 3 deletions Source/Models/Transaction/JPTransactionResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
#import <Foundation/Foundation.h>

typedef NS_ENUM(NSUInteger, JPTransactionResult) {
JPTransactionResultSuccess,
JPTransactionResultDeclined,
JPTransactionResultError
JPTransactionResultError = 0,
JPTransactionResultSuccess = 1,
JPTransactionResultDeclined = 2,
JPTransactionResultUnknown = NSUIntegerMax
};
11 changes: 6 additions & 5 deletions Source/Models/Transaction/JPTransactionType.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
* An enum that defines the transaction type
*/
typedef NS_ENUM(NSUInteger, JPTransactionType) {
JPTransactionTypePayment,
JPTransactionTypePreAuth,
JPTransactionTypeRegisterCard,
JPTransactionTypeCheckCard,
JPTransactionTypeSaveCard
JPTransactionTypePayment = 1,
JPTransactionTypePreAuth = 2,
JPTransactionTypeRegisterCard = 3,
JPTransactionTypeCheckCard = 4,
JPTransactionTypeSaveCard = 5,
JPTransactionTypeUnknown = NSUIntegerMax
};
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ - (void)paymentTransactionWithStoredCardDetails:(JPStoredCardDetails *)details
JPCardTransactionDetails *transactionDetails = [[JPCardTransactionDetails alloc] initWithConfiguration:self.configuration
andStoredCardDetails:details];

transactionDetails.secureCode = securityCode;

switch (self.transactionMode) {
case JPTransactionTypePreAuth:
[self.transactionService invokePreAuthTokenPaymentWithDetails:transactionDetails andCompletion:completion];
Expand Down
4 changes: 2 additions & 2 deletions Source/Services/CardValidation/JPCardValidationService.m
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ - (JPValidationResult *)validateFifthExpiryDigitInput:(NSString *)input {
int currentYear = 0;
int inputMonth = 0;
int inputYear = 0;

if (currentDateComponents.count == 2) {
currentMonth = currentDateComponents.firstObject.intValue;
currentYear = currentDateComponents.lastObject.intValue;
Expand All @@ -370,7 +370,7 @@ - (JPValidationResult *)validateFifthExpiryDigitInput:(NSString *)input {
inputMonth = inputDateComponents.firstObject.intValue;
inputYear = inputDateComponents.lastObject.intValue;
}

if (inputYear < currentYear) {
self.lastExpiryDateValidationResult = [JPValidationResult validationWithResult:NO
inputAllowed:YES
Expand Down

0 comments on commit ce66150

Please sign in to comment.