Skip to content

Commit

Permalink
Released version 5.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
y2chaits committed Apr 14, 2016
1 parent 78fb2e0 commit 65a4277
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 23 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2016-04-14
* Released version 5.0.1
* Fixed rare crash on cancelling or ending transactions
* Fixed PaymentInfo.paymentDescription being blank for some swiped cards
* Explicitly emit a card blocked error for some dipped cards
* Removed unsupported Visa Interlink AID from EMV configs

2016-03-30
* Released version 5.0.0
* Fixed issue where card reader was allowing chip cards to be swiped
Expand Down
2 changes: 1 addition & 1 deletion SwiftExample/SwiftApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>5.0.0</string>
<string>5.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.0
5.0.1
4 changes: 2 additions & 2 deletions WePay/Internal/WPClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

@implementation WPClient

static NSString * const SDK_VERSION = @"v5.0.0";
static NSString * const WEPAY_API_VERSION = @"2015-11-18";
static NSString * const SDK_VERSION = @"v5.0.1";
static NSString * const WEPAY_API_VERSION = @"2016-03-30";

#pragma mark config class property

Expand Down
2 changes: 0 additions & 2 deletions WePay/Internal/WPDipConfigHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ - (void)setupKeysValuesForTesting
[[RUAApplicationIdentifier alloc]initWithRID:AID_VISA withPIX:@"1010" withAID:nil withApplicationLabel:nil withTerminalApplicationVersion:TAV_VISA withLowestSupportedICCApplicationVersion:TAV_VISA withPriorityIndex:@"00" withApplicationSelectionFlags:@"01"],
[[RUAApplicationIdentifier alloc]initWithRID:AID_VISA withPIX:@"2010" withAID:nil withApplicationLabel:nil withTerminalApplicationVersion:TAV_VISA withLowestSupportedICCApplicationVersion:TAV_VISA withPriorityIndex:@"00" withApplicationSelectionFlags:@"01"],
[[RUAApplicationIdentifier alloc]initWithRID:AID_VISA withPIX:@"2020" withAID:nil withApplicationLabel:nil withTerminalApplicationVersion:TAV_VISA withLowestSupportedICCApplicationVersion:TAV_VISA withPriorityIndex:@"00" withApplicationSelectionFlags:@"01"],
[[RUAApplicationIdentifier alloc]initWithRID:AID_VISA withPIX:@"3010" withAID:nil withApplicationLabel:nil withTerminalApplicationVersion:TAV_MCRD withLowestSupportedICCApplicationVersion:TAV_MCRD withPriorityIndex:@"00" withApplicationSelectionFlags:@"01"],
[[RUAApplicationIdentifier alloc]initWithRID:AID_VISA withPIX:@"8010" withAID:nil withApplicationLabel:nil withTerminalApplicationVersion:TAV_VISA withLowestSupportedICCApplicationVersion:TAV_VISA withPriorityIndex:@"00" withApplicationSelectionFlags:@"01"],

// Discover
Expand Down Expand Up @@ -449,7 +448,6 @@ - (void)setupKeysValuesForProduction
[[RUAApplicationIdentifier alloc]initWithRID:AID_VISA withPIX:@"1010" withAID:nil withApplicationLabel:nil withTerminalApplicationVersion:TAV_VISA withLowestSupportedICCApplicationVersion:TAV_VISA withPriorityIndex:@"00" withApplicationSelectionFlags:@"01"],
[[RUAApplicationIdentifier alloc]initWithRID:AID_VISA withPIX:@"2010" withAID:nil withApplicationLabel:nil withTerminalApplicationVersion:TAV_VISA withLowestSupportedICCApplicationVersion:TAV_VISA withPriorityIndex:@"00" withApplicationSelectionFlags:@"01"],
[[RUAApplicationIdentifier alloc]initWithRID:AID_VISA withPIX:@"2020" withAID:nil withApplicationLabel:nil withTerminalApplicationVersion:TAV_VISA withLowestSupportedICCApplicationVersion:TAV_VISA withPriorityIndex:@"00" withApplicationSelectionFlags:@"01"],
[[RUAApplicationIdentifier alloc]initWithRID:AID_VISA withPIX:@"3010" withAID:nil withApplicationLabel:nil withTerminalApplicationVersion:TAV_MCRD withLowestSupportedICCApplicationVersion:TAV_MCRD withPriorityIndex:@"00" withApplicationSelectionFlags:@"01"],
[[RUAApplicationIdentifier alloc]initWithRID:AID_VISA withPIX:@"8010" withAID:nil withApplicationLabel:nil withTerminalApplicationVersion:TAV_VISA withLowestSupportedICCApplicationVersion:TAV_VISA withPriorityIndex:@"00" withApplicationSelectionFlags:@"01"],

// Discover
Expand Down
6 changes: 0 additions & 6 deletions WePay/Internal/WPDipTransactionHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
roamDeviceManager:(id<RUADeviceManager>) roamDeviceManager
managerDelegate:(id<WPDeviceManagerDelegate>) managerDeletage
externalDelegate:(id<WPExternalCardReaderDelegate>) externalDelegate;

/**
* Stops the transaction
*/
- (void) stopTransactionWithCompletion:(void (^)(void))completion;

@end

#endif
Expand Down
21 changes: 14 additions & 7 deletions WePay/Internal/WPDipTransactionHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,8 @@ - (WPAuthorizationInfo *) createAuthInfoWithTC:(NSString *)tc creditCardId:(NSSt

- (void) stopTransactionWithCompletion:(void (^)(void))completion
{
NSLog(@"stopTransactionWithCompletion");

id <RUATransactionManager> tmgr = [self.roamDeviceManager getTransactionManager];

[tmgr sendCommand:RUACommandEMVTransactionStop withParameters:nil
Expand Down Expand Up @@ -645,6 +647,8 @@ - (NSError *) validateEMVResponse:(NSDictionary*) responseData
error = [WPError errorCardNotSupported];
} else if ([errorCode isEqualToString:[WPRoamHelper RUAErrorCode_toString:RUAErrorCodeApplicationBlocked]]) {
error = [WPError errorCardBlocked];
} else if ([errorCode isEqualToString:[WPRoamHelper RUAErrorCode_toString:RUAErrorCodeCardBlocked]]) {
error = [WPError errorCardBlocked];
} else if ([errorCode isEqualToString:[WPRoamHelper RUAErrorCode_toString:RUAErrorCodeTimeoutExpired]]) {
error = [WPError errorForCardReaderTimeout];
} else {
Expand Down Expand Up @@ -709,13 +713,16 @@ - (void) reactToError:(NSError *)error

- (void) reactToError:(NSError *)error forPaymentMethod:(NSString *)paymentMethod
{
if ([self.delegate shouldKeepWaitingForCardAfterError:error forPaymentMethod:paymentMethod]) {
// restart transaction
[self startTransaction];
} else {
// stop reader
[self.delegate stopDevice];
}
// stop(end) transaction, then either restart transaction or stop reader
[self stopTransactionWithCompletion:^{
if ([self.delegate shouldKeepWaitingForCardAfterError:error forPaymentMethod:paymentMethod]) {
// restart transaction
[self startTransaction];
} else {
// stop reader
[self.delegate stopDevice];
}
}];
}

- (NSString *) convertToEMVAmount:(NSDecimalNumber *)amount
Expand Down
9 changes: 7 additions & 2 deletions WePay/Internal/WPRP350XManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ - (BOOL) startDevice

- (void) stopDevice
{
NSLog(@"stopDevice");

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
self.readerShouldWaitForCard = NO;

Expand All @@ -116,6 +118,7 @@ - (void) stopDevice
// release and delete the device manager
[self.roamDeviceManager releaseDevice];
self.roamDeviceManager = nil;
NSLog(@"released device manager");

// inform delegate
[self.externalDelegate informExternalCardReader:kWPCardReaderStatusStopped];
Expand Down Expand Up @@ -226,6 +229,7 @@ - (void) fetchDeviceSerialNumber
*/
- (void) stopWaitingForCard
{
NSLog(@"stopWaitingForCard");
// cancel waiting for dip timeout timer
// [self.dipTimeoutTimer invalidate];

Expand All @@ -242,8 +246,9 @@ - (void) stopWaitingForCard
object:kWPCardReaderStatusNotConnected];


// stop transaction if running
[self.dipTransactionHelper stopTransactionWithCompletion:nil];
// cancel transaction in case it is running
id <RUATransactionManager> tmgr = [self.roamDeviceManager getTransactionManager];
[tmgr cancelLastCommand];
}

- (void) fetchAuthInfoForTransaction
Expand Down
46 changes: 45 additions & 1 deletion WePay/Internal/WePay_CardReader.m
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,17 @@ - (void) handleSwipeResponse:(NSDictionary *) responseData
[self.externalHelper informExternalCardReaderFailure:error];
} else {
// extract useful non-encrypted data
NSString *pan = [self sanitizePAN:[responseData objectForKey:@"PAN"]];
NSString *pan = [responseData objectForKey:@"PAN"];
if (pan == nil) {
NSString *track2 = [responseData objectForKey:@"Track2Data"];
if (track2 != nil) {
pan = [self extractPANfromTrack2:track2];
}
}

// pan can still be nil at this point
pan = [self sanitizePAN:pan];

NSDictionary *info = @{@"firstName" : [WPRoamHelper firstNameFromRUAData:responseData],
@"lastName" : [WPRoamHelper lastNameFromRUAData:responseData],
@"paymentDescription": pan ? pan : @"",
Expand Down Expand Up @@ -403,6 +413,40 @@ - (NSString *) sanitizePAN:(NSString *)pan
return result;
}

- (NSString *) extractPANfromTrack2:(NSString *)track2
{
if (track2 == nil) {
return nil;
}

// decode track 2 from hex to ascii string
NSMutableString * decodedTrack2 = [[NSMutableString alloc] init];
int i = 0;
while (i < [track2 length])
{
NSString * hexChar = [track2 substringWithRange: NSMakeRange(i, 2)];
if ([hexChar isEqualToString:@"00"]) {
hexChar = @"30";
}

int value = 0;
sscanf([hexChar cStringUsingEncoding:NSASCIIStringEncoding], "%x", &value);
[decodedTrack2 appendFormat:@"%c", (char)value];
i+=2;
}

// find the PAN
NSRange r1 = [decodedTrack2 rangeOfString:@";"];
NSRange r2 = [decodedTrack2 rangeOfString:@"="];

if (r1.length == 0 || r2.length == 0) {
return nil;
} else {
NSRange rSub = NSMakeRange(r1.location + r1.length, r2.location - r1.location - r1.length);
return [decodedTrack2 substringWithRange:rSub];
}
}


@end

Expand Down
2 changes: 1 addition & 1 deletion WePayExample/WePayExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>5.0.0</string>
<string>5.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
Binary file modified WePayExample/WePayExample/Libs/WePay.framework/Versions/A/WePay
Binary file not shown.
Binary file modified documentation/wepay-ios.pdf
Binary file not shown.

0 comments on commit 65a4277

Please sign in to comment.