Skip to content

Commit

Permalink
Released version 7.0.0-prerelease-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Alley committed Apr 18, 2017
1 parent 8342198 commit 7d7432c
Show file tree
Hide file tree
Showing 50 changed files with 874 additions and 504 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2017-04-18
* Released version 7.0.0-prerelease-1
* Added logLevel property to WPConfig
* Added logLevel parameter to designated initializer in WPConfig
* Added new error code WPErrorCardReaderUnableToConnect to WPError.h

2017-03-13
* Released version 7.0.0-beta-2
* Moved selectEMVApplication:completion: from WPAuthorizationDelegate to WPCardReaderDelegate
Expand Down
200 changes: 90 additions & 110 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion SwiftExample/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ platform :ios, '8.0'
use_frameworks!

target 'SwiftApp' do
pod 'WePay', '~> 7.0.0-beta-2'
pod 'WePay', '~> 7.0.0-prerelease-1'
end

target 'SwiftAppTests' do
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.0.0-beta-2
7.0.0-prerelease-1
2 changes: 1 addition & 1 deletion WePay.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "WePay"
s.version = "7.0.0-beta-2"
s.version = "7.0.0-prerelease-1"
s.summary = "WePay binary for both simulator and iOS devices"
s.description = "A library that helps WePay partners develop their own iOS apps aimed at merchants and/or consumers for collection of payments via various payment methods"
s.homepage = "http://github.com/wepay/wepay-ios"
Expand Down
116 changes: 69 additions & 47 deletions WePay.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions WePay/Internal/WPClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

@implementation WPClient

static NSString * const SDK_VERSION = @"v7.0.0-beta-2";
static NSString * const SDK_VERSION = @"v7.0.0-prerelease-1";
static NSString * const WEPAY_API_VERSION = @"2016-03-30";

#pragma mark config class property
Expand Down Expand Up @@ -186,7 +186,7 @@ + (void) processResponse: (NSURLResponse *) response

#ifdef DEBUG
// Log response only when in debug builds
NSLog(@"[WPClient] error: %@, response: %@, data: %@",error,response, dictionary);
WPLog(@"[WPClient] error: %@, response: %@, data: %@",error,response, dictionary);
#endif

if (dictionary != nil && error == nil) {
Expand Down
2 changes: 1 addition & 1 deletion WePay/Internal/WPClientHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ + (NSDictionary *) createCardRequestParamsForPaymentInfo:(WPPaymentInfo *)paymen
[requestParams setObject:fallback forKey:@"emv_fallback"];
}

NSLog(@"%@", requestParams);
WPLog(@"%@", requestParams);

return requestParams;
}
Expand Down
5 changes: 5 additions & 0 deletions WePay/Internal/WPDipTransactionHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
roamDeviceManager:(id<RUADeviceManager>) roamDeviceManager
cardReaderRequest:(CardReaderRequest)request;

/**
* Stops the transaction on the card reader
*/
- (void) stopTransaction;

@end

#endif
Expand Down
54 changes: 33 additions & 21 deletions WePay/Internal/WPDipTransactionHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ - (NSDictionary *) getEMVStartTransactionParameters
[transactionParameters setObject:@"000000000000" forKey:[NSNumber numberWithInt:RUAParameterAmountOtherNumeric]];
[transactionParameters setObject:@"01" forKey:[NSNumber numberWithInt:RUAParameterExtraProgressMessageFlag]];

NSLog(@"getEMVStartTransactionParameters:\n%@", transactionParameters);
WPLog(@"getEMVStartTransactionParameters:\n%@", transactionParameters);

return transactionParameters;
}
Expand All @@ -119,7 +119,7 @@ - (void) performEMVTransactionStartCommandWithAmount:(NSDecimalNumber *)amount
cardReaderRequest:(CardReaderRequest)request

{
NSLog(@"performEMVTransactionStartCommand");
WPLog(@"performEMVTransactionStartCommand");

// save transaction info
self.amount = amount;
Expand All @@ -131,11 +131,21 @@ - (void) performEMVTransactionStartCommandWithAmount:(NSDecimalNumber *)amount
[self startTransaction];
}

- (void) startTransaction
- (void) stopTransaction
{
[self resetStates];
}

- (void) resetStates {
self.shouldReportSwipedEMVCard = NO;
self.isFallbackSwipe = NO;
self.shouldIssueReversal = NO;
self.isWaitingForCardRemoval = NO;
}

- (void) startTransaction
{
[self resetStates];

self.paymentInfo = nil;
self.selectedAID = nil;
Expand All @@ -155,7 +165,7 @@ - (void) startTransaction
[tmgr sendCommand:RUACommandEMVStartTransaction
withParameters:params
progress: ^(RUAProgressMessage messageType, NSString* additionalMessage) {
NSLog(@"RUAProgressMessage: %@",[WPRoamHelper RUAProgressMessage_toString:messageType]);
WPLog(@"RUAProgressMessage: %@",[WPRoamHelper RUAProgressMessage_toString:messageType]);
switch (messageType) {
case RUAProgressMessagePleaseInsertCard:
if (self.shouldReportSwipedEMVCard) {
Expand Down Expand Up @@ -193,7 +203,7 @@ - (void) startTransaction
response: ^(RUAResponse *ruaResponse) {
NSMutableDictionary *responseData = [[WPRoamHelper RUAResponse_toDictionary:ruaResponse] mutableCopy];
NSError *error = [self validateEMVResponse:responseData];
NSLog(@"RUAResponse: %@", responseData);
WPLog(@"RUAResponse: %@", responseData);

if (error != nil) {
if ([self shouldReactToError:error]) {
Expand All @@ -202,6 +212,7 @@ - (void) startTransaction
[self reactToError:error];
} else {
// Nothing to do here, the flow will continue elsewhere.
WPLog(@"Ignoring error: %@", error);
}
} else {
if ([ruaResponse responseType] == RUAResponseTypeMagneticCardData) {
Expand Down Expand Up @@ -298,16 +309,16 @@ - (void) performSelectAppIdCommand:(RUAApplicationIdentifier *)selectedAppId {
id <RUATransactionManager> tmgr = [self.roamDeviceManager getTransactionManager];
NSDictionary *params = @{[NSNumber numberWithInt:RUAParameterApplicationIdentifier]: selectedAppId.aid};

NSLog(@"performSelectAppIdCommandParameters:\n%@", params);
WPLog(@"performSelectAppIdCommandParameters:\n%@", params);

[tmgr sendCommand:RUACommandEMVFinalApplicationSelection
withParameters:params
progress: ^(RUAProgressMessage messageType, NSString* additionalMessage) {
NSLog(@"RUAProgressMessage: %@",[WPRoamHelper RUAProgressMessage_toString:messageType]);
WPLog(@"RUAProgressMessage: %@",[WPRoamHelper RUAProgressMessage_toString:messageType]);
}

response: ^(RUAResponse *ruaResponse) {
NSLog(@"RUAResponse: %@", [WPRoamHelper RUAResponse_toDictionary:ruaResponse]);
WPLog(@"RUAResponse: %@", [WPRoamHelper RUAResponse_toDictionary:ruaResponse]);
[self handleEMVStartTransactionResponse:ruaResponse];
}
];
Expand Down Expand Up @@ -338,25 +349,25 @@ - (NSDictionary *) getEMVTransactionDataParameters {
[transactionParameters setObject:tacOnline forKey:[NSNumber numberWithInt:RUAParameterTerminalActionCodeOnline]];
[transactionParameters setObject:tacDefault forKey:[NSNumber numberWithInt:RUAParameterTerminalActionCodeDefault]];

NSLog(@"getEMVTransactionDataParameters:\n%@", transactionParameters);
WPLog(@"getEMVTransactionDataParameters:\n%@", transactionParameters);

return transactionParameters;
}


- (void) performEMVTransactionDataCommand {
NSLog(@"performEMVTransactionDataCommand");
WPLog(@"performEMVTransactionDataCommand");

id <RUATransactionManager> tmgr = [self.roamDeviceManager getTransactionManager];
NSDictionary *params = [self getEMVTransactionDataParameters];

[tmgr sendCommand:RUACommandEMVTransactionData withParameters:params
progress: ^(RUAProgressMessage messageType, NSString* additionalMessage) {
NSLog(@"RUAProgressMessage: %@ %@", [WPRoamHelper RUAProgressMessage_toString:messageType], additionalMessage);
WPLog(@"RUAProgressMessage: %@ %@", [WPRoamHelper RUAProgressMessage_toString:messageType], additionalMessage);
}

response: ^(RUAResponse *ruaResponse) {
NSLog(@"RUAResponse: %@", [WPRoamHelper RUAResponse_toString:ruaResponse]);
WPLog(@"RUAResponse: %@", [WPRoamHelper RUAResponse_toString:ruaResponse]);

[self handleEMVTransactionDataResponse:ruaResponse];
}
Expand Down Expand Up @@ -456,7 +467,7 @@ - (void) handleEMVTransactionDataResponse:(RUAResponse *) ruaResponse
}];

} else {
NSLog(@"[performEMVTransactionDataCommand] Stopping, unhandled response");
WPLog(@"[performEMVTransactionDataCommand] Stopping, unhandled response");
NSError *error = [WPError errorInvalidCardData];
[self reportAuthorizationSuccess:nil orError:error forPaymentInfo:self.paymentInfo];
[self reactToError:error];
Expand Down Expand Up @@ -557,7 +568,7 @@ - (NSDictionary *) getEMVCompleteTransactionParameters {
}
}

NSLog(@"getEMVCompleteTransactionParameters:\n%@", transactionParameters);
WPLog(@"getEMVCompleteTransactionParameters:\n%@", transactionParameters);
return transactionParameters;
}

Expand All @@ -566,18 +577,18 @@ - (NSDictionary *) getEMVCompleteTransactionParameters {
*/
- (void) performEMVCompleteTransactionCommand
{
NSLog(@"performEMVCompleteTransactionCommand");
WPLog(@"performEMVCompleteTransactionCommand");

id <RUATransactionManager> tmgr = [self.roamDeviceManager getTransactionManager];
NSDictionary *params = [self getEMVCompleteTransactionParameters];

[tmgr sendCommand:RUACommandEMVCompleteTransaction
withParameters:params
progress: ^(RUAProgressMessage messageType, NSString* additionalMessage) {
NSLog(@"onCompleteTX RUAProgressMessage: %@ %@", [WPRoamHelper RUAProgressMessage_toString:messageType], additionalMessage);
WPLog(@"onCompleteTX RUAProgressMessage: %@ %@", [WPRoamHelper RUAProgressMessage_toString:messageType], additionalMessage);
}
response: ^(RUAResponse *ruaResponse) {
NSLog(@"onCompleteTX RUAResponse: %@", [WPRoamHelper RUAResponse_toString:ruaResponse]);
WPLog(@"onCompleteTX RUAResponse: %@", [WPRoamHelper RUAResponse_toString:ruaResponse]);

[self handleEMVCompleteTransactionResponse:ruaResponse];
}
Expand Down Expand Up @@ -638,19 +649,19 @@ - (WPAuthorizationInfo *) createAuthInfoWithTC:(NSString *)tc creditCardId:(NSSt

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

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

[tmgr sendCommand:RUACommandEMVTransactionStop withParameters:nil
progress: ^(RUAProgressMessage messageType, NSString* additionalMessage) {
NSLog(@"onStopTX RUAProgressMessage: %@",[WPRoamHelper RUAProgressMessage_toString:messageType]);
WPLog(@"onStopTX RUAProgressMessage: %@",[WPRoamHelper RUAProgressMessage_toString:messageType]);
if (messageType == RUAProgressMessagePleaseRemoveCard) {
self.isWaitingForCardRemoval = YES;
}
}
response: ^(RUAResponse *ruaResponse) {
NSLog(@"onStopTX RUAResponseMessage: %@",[WPRoamHelper RUAResponse_toDictionary:ruaResponse]);
WPLog(@"onStopTX RUAResponseMessage: %@",[WPRoamHelper RUAResponse_toDictionary:ruaResponse]);
if (completion != nil) {
completion();
}
Expand Down Expand Up @@ -788,7 +799,8 @@ - (BOOL) shouldReactToError:(NSError *) error
{
BOOL isWhitelistError = NO;
NSArray *const whitelistedMessages = @[[WPRoamHelper RUAErrorCode_toString:RUAErrorCodeReaderDisconnected],
[WPRoamHelper RUAErrorCode_toString:RUAErrorCodeCommandCancelledUponReceiptOfACancelWaitCommand]];
[WPRoamHelper RUAErrorCode_toString:RUAErrorCodeCommandCancelledUponReceiptOfACancelWaitCommand],
[WPRoamHelper RUAErrorCode_toString:RUAErrorCodeReaderDisconnected]];

if (error) {
for (NSString *message in whitelistedMessages) {
Expand Down
7 changes: 7 additions & 0 deletions WePay/Internal/WPError+internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,11 @@
*/
+ (NSError *) errorInvalidCardReaderSelection;

/**
* Creates an NSError object representing inability to connect to card reader.
*
* @return object representing the error.
*/
+ (NSError *) errorCardReaderUnableToConnect;

@end
17 changes: 13 additions & 4 deletions WePay/Internal/WPError+internal.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ + (NSError *) errorWithApiResponseData:(NSDictionary *)data;

#ifdef DEBUG
// Log unknown error only when in debug builds
NSLog(@"[WPError] unknown api error: %@", data);
WPLog(@"[WPError] unknown api error: %@", data);
#endif
}

Expand Down Expand Up @@ -99,7 +99,7 @@ + (NSError *) errorWithCardReaderResponseData:(NSDictionary *)data;

#ifdef DEBUG
// Log unknown error only when in debug builds
NSLog(@"[WPError] unknown card reader error: %@", data);
WPLog(@"[WPError] unknown card reader error: %@", data);
#endif

}
Expand Down Expand Up @@ -144,7 +144,7 @@ + (NSError *) errorForCardReaderStatusErrorWithMessage:(NSString *)message
{
#ifdef DEBUG
// Log status error only when in debug builds
NSLog(@"[WPError] card reader status error: %@", message);
WPLog(@"[WPError] card reader status error: %@", message);
#endif

return [WPError makeErrorWithCode:WPErrorCardReaderStatusError
Expand Down Expand Up @@ -193,7 +193,7 @@ + (NSError *) errorForEMVTransactionErrorWithMessage:(NSString *)message
{
#ifdef DEBUG
// Log status error only when in debug builds
NSLog(@"[WPError] card reader emv transaction error: %@", message);
WPLog(@"[WPError] card reader emv transaction error: %@", message);
#endif

return [WPError makeErrorWithCode:WPErrorEMVTransactionError
Expand Down Expand Up @@ -355,5 +355,14 @@ + (NSError *) errorInvalidCardReaderSelection
domain:kWPErrorSDKDomain];
}

+ (NSError *) errorCardReaderUnableToConnect
{
NSString *errorText = WPErrorCardReaderUnableToConnectErrorMessage
return [WPError makeErrorWithCode:WPErrorCardReaderUnableToConnect
text:errorText
category:kWPErrorCategoryCardReader
domain:kWPErrorSDKDomain];
}


@end
11 changes: 11 additions & 0 deletions WePay/Internal/WPGlobals.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// WPGlobals.h
// WePay
//
// Created by Zach Vega-Perkins on 3/28/17.
// Copyright © 2017 WePay. All rights reserved.
//

#import <Foundation/Foundation.h>

extern NSString *globalLogLevel;
13 changes: 13 additions & 0 deletions WePay/Internal/WPGlobals.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// WPGlobals.m
// WePay
//
// Created by Zach Vega-Perkins on 3/28/17.
// Copyright © 2017 WePay. All rights reserved.
//

#import "WPGlobals.h"

// Initialized to empty string for sake of tests that don't initialize WePay object.
// This lets thoese tests compile
NSString *globalLogLevel = @"";
File renamed without changes.
Loading

0 comments on commit 7d7432c

Please sign in to comment.