Skip to content

Commit

Permalink
Released version 7.0.0-beta-2
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Alley committed Mar 13, 2017
1 parent d31e978 commit 8342198
Show file tree
Hide file tree
Showing 78 changed files with 2,643 additions and 894 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,22 @@ project.xcworkspace
/SwiftExample/Pods/WePay/RPx_MFI.framework/
/SwiftExample/Pods/WePay/RKI_MFI.framework/
/SwiftExample/Pods/WePay/TrustDefenderMobile.framework/
/SwiftExample/Pods/WePay/TrustDefender.framework/
/WePayExample/WePayExample/Libs/G4XSwiper.framework/
/WePayExample/WePayExample/Libs/RPx.framework/
/WePayExample/WePayExample/Libs/RUA.framework/
/WePayExample/WePayExample/Libs/RUA_MFI.framework/
/WePayExample/WePayExample/Libs/RPx_MFI.framework/
/WePayExample/WePayExample/Libs/RKI_MFI.framework/
/WePayExample/WePayExample/Libs/TrustDefender.framework/
/WePayExample/WePayExample/Libs/TrustDefenderMobile.framework/
/WePay/Libs/G4XSwiper.framework/
/WePay/Libs/RPx.framework/
/WePay/Libs/RUA.framework/
/WePay/Libs/RUA_MFI.framework/
/WePay/Libs/RPx_MFI.framework/
/WePay/Libs/RKI_MFI.framework/
/WePay/Libs/TrustDefender.framework/
/WePay/Libs/TrustDefenderMobile.framework/

# CocoaPods
Expand All @@ -55,4 +58,7 @@ project.xcworkspace
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control?
#
# Pods/
# Pods/

# Arcanist
.arcconfig
13 changes: 13 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
2017-03-13
* Released version 7.0.0-beta-2
* Moved selectEMVApplication:completion: from WPAuthorizationDelegate to WPCardReaderDelegate
* Added selectCardReader:completion: to WPCardReaderDelegate that's called when the SDK finds card readers
* Added new status (kWPCardReaderStatusSearching) that indicates the SDK is searching for card readers
* Changed getCardReaderBatteryLevelWithBatteryLevelDelegate: to getCardReaderBatteryLevelWithCardReaderDelegate:batteryLevelDelegate: in WePay.h so the SDK can call back with the appropriate statuses
* Added getRememberedCardReader in WePay.h to retrieve the name of the most recently connected card reader
* Added forgetRememberedCardReader in WePay.h to tell the SDK to forget the most recently connected card reader name
* Renamed WPConfig.stopCardReaderAfterTransaction to WPConfig.stopCardReaderAfterOperation
* Added WPMockConfig.mockCardReaderIsDetected
* Added new error codes WPErrorInvalidCardReaderSelection and WPErrorCardReaderBatteryTooLow
* The most recently connected card reader is now remembered and used when discovered.

2016-12-22
* Released version 7.0.0-beta-1
* Added support for Moby 3000 bluetooth card reader
Expand Down
65 changes: 53 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ The [SwiftExample app](https://github.com/wepay/wepay-ios/tree/master/SwiftExamp
- UIKit.framework
- libstdc++.6.0.9.dylib
- libstdc++.dylib
- libz.dylib
+ Also include the framework files you copied:
- TrustDefenderMobile.framework
- TrustDefender.framework
- WePay.framework
+ Done!

Expand Down Expand Up @@ -198,6 +199,16 @@ config.useLocation = YES;
// Change this to YES if you want to reset the card reader
completion(NO);
}
- (void) selectCardReader:(NSArray *)cardReaderNames
completion:(void (^)(NSInteger selectedIndex))completion
{
// In production apps, the merchant must choose the card reader they want to use.
// Here, we always select the first card reader in the array
int selectedIndex = 0;
completion(selectedIndex);
}
~~~
+ Implement the WPTokenizationDelegate protocol methods
~~~{.m}
Expand All @@ -218,12 +229,13 @@ config.useLocation = YES;
// Show UI asking the user to insert the card reader and wait for it to be ready
~~~
+ That's it! The following sequence of events will occur:
1. The user inserts the card reader (or it is already inserted)
1. The user inserts the card reader (or it is already inserted), or powers on their Bluetooth card reader.
2. The SDK tries to detect the card reader and initialize it.
- If the card reader is not detected, the `cardReaderDidChangeStatus:` method will be called with `status = kWPCardReaderStatusNotConnected`
- If the card reader is successfully detected, then the `cardReaderDidChangeStatus:` method will be called with `status = kWPCardReaderStatusConnected`.
- Next, if the card reader is successfully initialized, then the `cardReaderDidChangeStatus:` method will be called with `status = kWPCardReaderStatusWaitingForSwipe`
- Otherwise, `didFailToReadPaymentInfoWithError:` will be called with the appropriate error, and processing will stop (the `cardReaderDidChangeStatus:` method will be called with `status = kWPCardReaderStatusStopped`)
- The `cardReaderDidChangeStatus:` method will be called with `status = kWPCardReaderStatusSearching`
- If any card readers are discovered, the `selectCardReader:` method will be called with an array of discovered devices. If anything is plugged into the headphone jack, `"AUDIOJACK"` will be one of the devices discovered.
- If no card readers are detected, the `cardReaderDidChangeStatus:` method will be called with `status = kWPCardReaderStatusNotConnected`
- Once the card reader selection completion block is called, the SDK will attempt to to connect to the selected card reader.
- If the card reader is successfully connected, then the `cardReaderDidChangeStatus:` method will be called with `status = kWPCardReaderStatusConnected`.
3. If the card reader successfully initialized, it will wait for the user to swipe a card
4. If a recoverable error occurs during swiping, the `didFailToReadPaymentInfoWithError:` method will be called. After a few seconds, the `cardReaderDidChangeStatus:` method will be called with `status = kWPCardReaderStatusWaitingForSwipe` and the card reader will again wait for the user to swipe a card
5. If an unrecoverable error occurs during swiping, or the user does not swipe, the `didFailToReadPaymentInfoWithError:` method will be called, and processing will stop
Expand Down Expand Up @@ -289,10 +301,13 @@ didFailAuthorization:(NSError *)error
// Show UI asking the user to insert the card reader and wait for it to be ready
~~~
+ That's it! The following sequence of events will occur:
1. The user inserts the card reader (or it is already inserted)
1. The user inserts the card reader (or it is already inserted), or powers on their Bluetooth card reader.
2. The SDK tries to detect the card reader and initialize it.
- If the card reader is not detected, the `cardReaderDidChangeStatus:` method will be called with `status = kWPCardReaderStatusNotConnected`
- If the card reader is successfully detected, then the `cardReaderDidChangeStatus:` method will be called with `status = kWPCardReaderStatusConnected`.
- The `cardReaderDidChangeStatus:` method will be called with `status = kWPCardReaderStatusSearching`
- If any card readers are discovered, the `selectCardReader:` method will be called with an array of discovered devices. If anything is plugged into the headphone jack, `"AUDIOJACK"` will be one of the devices discovered.
- If no card readers are detected, the `cardReaderDidChangeStatus:` method will be called with `status = kWPCardReaderStatusNotConnected`
- Once the card reader selection completion block is called, the SDK will attempt to to connect to the selected card reader.
- If the card reader is successfully connected, then the `cardReaderDidChangeStatus:` method will be called with `status = kWPCardReaderStatusConnected`.
3. Next, the SDK checks if the card reader is correctly configured (the `cardReaderDidChangeStatus:` method will be called with `status = kWPCardReaderStatusCheckingReader`).
- If the card reader is already configured, the App is given a chance to force configuration. The SDK calls the `shouldResetCardReaderWithCompletion:` method, and the app must execute the completion method, telling the SDK whether or not the reader should be reset.
- If the reader was not configured, or the app requested a reset, the card reader is configured (the `cardReaderDidChangeStatus:` method will be called with `status = kWPCardReaderStatusConfiguringReader`)
Expand Down Expand Up @@ -418,15 +433,41 @@ UIImage *signature = [UIImage imageNamed:@"dd_signature.png"];
}
~~~
+ Make the WePay API call, passing in the instance of the class that implemented the WPBatteryLevelDelegate protocol
+ Make the WePay API call, passing in the instance(s) of the class(es) that implemented the WPCardReaderDelegate and WPBatteryLevelDelegate protocols
~~~{.m}
[self.wepay getCardReaderBatteryLevelWithBatteryLevelDelegate:self];
[self.wepay getCardReaderBatteryLevelWithCardReaderDelegate:self batteryLevelDelegate:self];
~~~
+ That's it! The following sequence of events will occur:
1. The SDK will attempt to read the battery level of the card reader
2. If the operation succeeds, WPBatteryLevelDelegate's `didGetBatteryLevel:` method will be called with the result
3. Otherwise, if the operation fails, WPBatteryLevelDelegate's `didFailToGetBatteryLevelwithError:` method will be called with the appropriate error
4. The card reader must be plugged in before attempting to get battery level, otherwise the process will fail

### Configuring the SDK

The experiences described above can be modified by utilizing the configuration options available on the WPConfig object. Detailed descriptions for each configurable property is available in the documentation for WPConfig.

### Test/develop using mock card reader and mock WepayClient

+ To use mock card reader implementation instead of using the real reader, instantiate a MockConfig object and pass it to Config:
~~~{.m}
WPMockConfig *mockConfig = [[WPMockConfig alloc] init];
config.mockConfig = mockConfig;
~~~
+ To use mock WepayClient implementation instead of interacting with the real WePay server, set the corresponding option on the mockConfig object:
~~~{.m}
mockConfig.useMockWepayClient = YES;
~~~
+ Other options are also available:
~~~{.m}
mockConfig.mockPaymentMethod = kWPPaymentMethodSwipe; // Payment method to mock; Defaults to SWIPE.
mockConfig.cardReadTimeOut = YES; // To mock a card reader timeout; Defaults to NO.
mockConfig.cardReadFailure = YES; // To mock a failure for card reading; Defaults to NO.
mockConfig.cardTokenizationFailure = YES; // To mock a failure for card tokenization; Defaults to NO.
mockConfig.EMVAuthFailure = YES; // To mock a failure for EMV authorization; Defaults to NO.
mockConfig.multipleEMVApplication = YES; // To mock multiple EMV applications on card to choose from; Defaults to NO.
mockConfig.batteryLevelError = YES; // To mock an error while fetching battery level; Defaults to NO.
mockConfig.mockCardReaderIsDetected = NO; // To mock a card reader being available for connection; Defaults to YES.
~~~

### Integration tests and unit tests
All the integration tests and unit tests are located in the `/WePayTests/` directory.
Expand Down
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'
pod 'WePay', '~> 7.0.0-beta-2'
end

target 'SwiftAppTests' do
Expand Down
2 changes: 1 addition & 1 deletion SwiftExample/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ DEPENDENCIES:
SPEC CHECKSUMS:
WePay: a90b5b55ab791ea7bcf8b8569144f804836b7310

PODFILE CHECKSUM: e4425fd186f4f3b4eca2c87775a734030ea0c160
PODFILE CHECKSUM: cd2753153abca6c71051e0756ff94861488aa30f

COCOAPODS: 1.1.1
2 changes: 1 addition & 1 deletion SwiftExample/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 16 additions & 14 deletions SwiftExample/SwiftApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
34B1BC5A0894C3E910E7697C /* Pods_SwiftAppTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C59561954F7549913A9145D9 /* Pods_SwiftAppTests.framework */; };
01CBD2BB0755F96D9ECC9A21 /* Pods_SwiftAppTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E8CF737205FC70D5AC48EF2 /* Pods_SwiftAppTests.framework */; };
8D130FFD1BEABA1300F21F86 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 8D130FFC1BEABA1300F21F86 /* Settings.bundle */; };
8DAB3F6D1BDEE40400B8BA98 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DAB3F6C1BDEE40400B8BA98 /* AppDelegate.swift */; };
8DAB3F6F1BDEE40400B8BA98 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DAB3F6E1BDEE40400B8BA98 /* ViewController.swift */; };
Expand All @@ -16,6 +16,8 @@
8DAB3F771BDEE40400B8BA98 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8DAB3F751BDEE40400B8BA98 /* LaunchScreen.storyboard */; };
8DAB3F821BDEE40400B8BA98 /* SwiftAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DAB3F811BDEE40400B8BA98 /* SwiftAppTests.swift */; };
9A7915757E84A3ECDF17164F /* Pods_SwiftApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 462228E5D58440F523F244A5 /* Pods_SwiftApp.framework */; };
C3526B4E1E6A1360003E814B /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = C3526B4D1E6A1360003E814B /* libz.tbd */; };
C3526B501E6A137A003E814B /* libstdc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = C3526B4F1E6A137A003E814B /* libstdc++.tbd */; };
D730C58B1D95FC32008BB3DC /* libstdc++.6.0.9.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = D730C58A1D95FC32008BB3DC /* libstdc++.6.0.9.tbd */; };
/* End PBXBuildFile section */

Expand All @@ -31,6 +33,7 @@

/* Begin PBXFileReference section */
462228E5D58440F523F244A5 /* Pods_SwiftApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftApp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4E8CF737205FC70D5AC48EF2 /* Pods_SwiftAppTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftAppTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8D130FFC1BEABA1300F21F86 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = Settings.bundle; path = ../Settings.bundle; sourceTree = "<group>"; };
8D8033951C7B9F43004CEB7A /* SwiftApp-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SwiftApp-Bridging-Header.h"; sourceTree = "<group>"; };
8DAB3F691BDEE40400B8BA98 /* SwiftApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -44,11 +47,9 @@
8DAB3F811BDEE40400B8BA98 /* SwiftAppTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftAppTests.swift; sourceTree = "<group>"; };
8DAB3F831BDEE40400B8BA98 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A607ECA502BAA465D28BD72A /* Pods-SwiftApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftApp.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftApp/Pods-SwiftApp.release.xcconfig"; sourceTree = "<group>"; };
C59561954F7549913A9145D9 /* Pods_SwiftAppTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftAppTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C3526B4D1E6A1360003E814B /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
C3526B4F1E6A137A003E814B /* libstdc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libstdc++.tbd"; path = "usr/lib/libstdc++.tbd"; sourceTree = SDKROOT; };
D730C58A1D95FC32008BB3DC /* libstdc++.6.0.9.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libstdc++.6.0.9.tbd"; path = "usr/lib/libstdc++.6.0.9.tbd"; sourceTree = SDKROOT; };
D730C58C1D95FD4C008BB3DC /* G4XSwiper.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = G4XSwiper.framework; path = Pods/WePay/G4XSwiper.framework; sourceTree = "<group>"; };
D730C58D1D95FD4C008BB3DC /* RPx.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RPx.framework; path = Pods/WePay/RPx.framework; sourceTree = "<group>"; };
D730C58E1D95FD4C008BB3DC /* RUA.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RUA.framework; path = Pods/WePay/RUA.framework; sourceTree = "<group>"; };
DA565C9F9F967F98E02D1A19 /* Pods-SwiftApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftApp.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftApp/Pods-SwiftApp.debug.xcconfig"; sourceTree = "<group>"; };
F72E6616DC2591FFE3DE2921 /* Pods-SwiftAppTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftAppTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftAppTests/Pods-SwiftAppTests.release.xcconfig"; sourceTree = "<group>"; };
FBED3BAC0AD084CA81B03640 /* Pods-SwiftAppTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftAppTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftAppTests/Pods-SwiftAppTests.debug.xcconfig"; sourceTree = "<group>"; };
Expand All @@ -59,7 +60,9 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C3526B4E1E6A1360003E814B /* libz.tbd in Frameworks */,
D730C58B1D95FC32008BB3DC /* libstdc++.6.0.9.tbd in Frameworks */,
C3526B501E6A137A003E814B /* libstdc++.tbd in Frameworks */,
9A7915757E84A3ECDF17164F /* Pods_SwiftApp.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -68,7 +71,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
34B1BC5A0894C3E910E7697C /* Pods_SwiftAppTests.framework in Frameworks */,
01CBD2BB0755F96D9ECC9A21 /* Pods_SwiftAppTests.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -133,12 +136,11 @@
F9FD45A6F0BF43BA8C726C11 /* Frameworks */ = {
isa = PBXGroup;
children = (
D730C58C1D95FD4C008BB3DC /* G4XSwiper.framework */,
D730C58D1D95FD4C008BB3DC /* RPx.framework */,
D730C58E1D95FD4C008BB3DC /* RUA.framework */,
C3526B4F1E6A137A003E814B /* libstdc++.tbd */,
C3526B4D1E6A1360003E814B /* libz.tbd */,
D730C58A1D95FC32008BB3DC /* libstdc++.6.0.9.tbd */,
462228E5D58440F523F244A5 /* Pods_SwiftApp.framework */,
C59561954F7549913A9145D9 /* Pods_SwiftAppTests.framework */,
4E8CF737205FC70D5AC48EF2 /* Pods_SwiftAppTests.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down Expand Up @@ -427,7 +429,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -467,7 +469,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand All @@ -488,7 +490,7 @@
"$(PROJECT_DIR)/Pods/WePay",
);
INFOPLIST_FILE = SwiftApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_CFLAGS = (
"$(inherited)",
Expand Down Expand Up @@ -539,7 +541,7 @@
"$(PROJECT_DIR)/Pods/WePay",
);
INFOPLIST_FILE = SwiftApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_CFLAGS = (
"$(inherited)",
Expand Down
Loading

0 comments on commit 8342198

Please sign in to comment.