This repository has been archived by the owner on Jan 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 554
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore standard github repo structure
- Loading branch information
Dave Goldman
committed
Jun 18, 2014
1 parent
a3dd00e
commit e9c4597
Showing
22 changed files
with
1,090 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// CardIO.h | ||
// Version 3.8.0 | ||
// | ||
// Copyright (c) 2011-2014 PayPal. All rights reserved. | ||
// | ||
|
||
// All-in-one header file for card.io sdk. | ||
#import "CardIOCreditCardInfo.h" | ||
#import "CardIOView.h" | ||
#import "CardIOViewDelegate.h" | ||
#import "CardIOPaymentViewController.h" | ||
#import "CardIOPaymentViewControllerDelegate.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// | ||
// CardIOCreditCardInfo.h | ||
// Version 3.8.0 | ||
// | ||
// Copyright (c) 2011-2014 PayPal. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <UIKit/UIKit.h> | ||
|
||
/// CardIOCreditCardType Identifies type of card. | ||
typedef NS_ENUM(NSInteger, CardIOCreditCardType) { | ||
/// Deprecated. | ||
/// @see CardIOCreditCardTypeUnrecognized, CardIOCreditCardTypeAmbiguous | ||
CardIOCreditCardTypeUnknown __attribute__((deprecated("Use CardIOCreditCardTypeUnrecognized or CardIOCreditCardTypeAmbiguous instead."))) = 0, | ||
/// The card number does not correspond to any recognizable card type. | ||
CardIOCreditCardTypeUnrecognized = 0, | ||
/// The card number corresponds to multiple card types (e.g., when only a few digits have been entered). | ||
CardIOCreditCardTypeAmbiguous = 1, | ||
/// American Express | ||
CardIOCreditCardTypeAmex = '3', | ||
/// Japan Credit Bureau | ||
CardIOCreditCardTypeJCB = 'J', | ||
/// VISA | ||
CardIOCreditCardTypeVisa = '4', | ||
/// MasterCard | ||
CardIOCreditCardTypeMastercard = '5', | ||
/// Discover Card | ||
CardIOCreditCardTypeDiscover = '6' | ||
}; | ||
|
||
|
||
/// Container for the information about a card. | ||
@interface CardIOCreditCardInfo : NSObject<NSCopying> | ||
|
||
/// Card number. | ||
@property(nonatomic, copy, readwrite) NSString *cardNumber; | ||
|
||
/// Card number with all but the last four digits obfuscated. | ||
@property(nonatomic, copy, readonly) NSString *redactedCardNumber; | ||
|
||
/// January == 1 | ||
/// @note expiryMonth & expiryYear may be 0, if expiry information was not requested. | ||
@property(nonatomic, assign, readwrite) NSUInteger expiryMonth; | ||
|
||
/// The full four digit year. | ||
/// @note expiryMonth & expiryYear may be 0, if expiry information was not requested. | ||
@property(nonatomic, assign, readwrite) NSUInteger expiryYear; | ||
|
||
/// Security code (aka CSC, CVV, CVV2, etc.) | ||
/// @note May be nil, if security code was not requested. | ||
@property(nonatomic, copy, readwrite) NSString *cvv; | ||
|
||
/// Postal code. Format is country dependent. | ||
/// @note May be nil, if postal code information was not requested. | ||
@property(nonatomic, copy, readwrite) NSString *postalCode; | ||
|
||
/// Deprecated. | ||
/// @see postalCode | ||
@property(nonatomic, copy, readwrite, getter=postalCode, setter=setPostalCode:) NSString *zip __attribute__((deprecated("Use postalCode instead."))); | ||
|
||
/// Was the card number scanned (as opposed to entered manually)? | ||
@property(nonatomic, assign, readwrite) BOOL scanned; | ||
|
||
|
||
/// Derived from cardNumber. | ||
/// @note CardIOCreditInfo objects returned by either of the delegate methods | ||
/// userDidProvideCreditCardInfo:inPaymentViewController: | ||
/// or cardIOView:didScanCard: | ||
/// will never return a cardType of CardIOCreditCardTypeAmbiguous. | ||
@property(nonatomic, assign, readonly) CardIOCreditCardType cardType; | ||
|
||
/// Convenience method which returns a card type string suitable for display (e.g. "Visa", "American Express", "JCB", "MasterCard", or "Discover"). | ||
/// Where appropriate, this string will be translated into the language specified. | ||
/// @param cardType The card type. | ||
/// @param languageOrLocale See CardIOPaymentViewController.h for a detailed explanation of languageOrLocale. | ||
/// @return Card type string suitable for display. | ||
+ (NSString *)displayStringForCardType:(CardIOCreditCardType)cardType usingLanguageOrLocale:(NSString *)languageOrLocale; | ||
|
||
/// Returns a 36x25 credit card logo, at a resolution appropriate for the device. | ||
/// @param cardType The card type. | ||
/// @return 36x25 credit card logo. | ||
+ (UIImage *)logoForCardType:(CardIOCreditCardType)cardType; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
// | ||
// CardIOPaymentViewController.h | ||
// Version 3.8.0 | ||
// | ||
// Copyright (c) 2011-2014 PayPal. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import "CardIOPaymentViewControllerDelegate.h" | ||
|
||
/// CardIOPaymentViewController is one of two main entry points into the card.io SDK. | ||
/// @see CardIOView | ||
@interface CardIOPaymentViewController : UINavigationController | ||
|
||
/// Initializer for scanning. | ||
/// If scanning is not supported by the user's device, card.io will offer manual entry. | ||
/// @param aDelegate Your CardIOPaymentViewControllerDelegate (typically a UIViewController). | ||
/// @return Properly initialized CardIOPaymentViewController. | ||
- (id)initWithPaymentDelegate:(id<CardIOPaymentViewControllerDelegate>)aDelegate; | ||
|
||
/// Initializer for scanning, with extra hooks for controlling whether the camera will | ||
/// be displayed (useful for testing). | ||
/// @param aDelegate Your CardIOPaymentViewControllerDelegate (typically a UIViewController). | ||
/// @param scanningEnabled If scanningEnabled is NO, card.io will offer manual entry, | ||
/// regardless of whether scanning is supported by the user's device. | ||
/// @return Properly initialized CardIOPaymentViewController. | ||
- (id)initWithPaymentDelegate:(id<CardIOPaymentViewControllerDelegate>)aDelegate scanningEnabled:(BOOL)scanningEnabled; | ||
|
||
/// The application token you obtained from the card.io website. | ||
/// If not set before presenting the view controller, an exception will be thrown. | ||
@property(nonatomic, copy, readwrite) NSString *appToken; | ||
|
||
/// The preferred language for all strings appearing in the user interface. | ||
/// If not set, or if set to nil, defaults to the device's current language setting. | ||
/// | ||
/// Can be specified as a language code ("en", "fr", "zh-Hans", etc.) or as a locale ("en_AU", "fr_FR", "zh-Hant_HK", etc.). | ||
/// If card.io does not contain localized strings for a specified locale, then it will fall back to the language. E.g., "es_CO" -> "es". | ||
/// If card.io does not contain localized strings for a specified language, then it will fall back to American English. | ||
/// | ||
/// If you specify only a language code, and that code matches the device's currently preferred language, | ||
/// then card.io will attempt to use the device's current region as well. | ||
/// E.g., specifying "en" on a device set to "English" and "United Kingdom" will result in "en_GB". | ||
/// | ||
/// These localizations are currently included: | ||
/// ar,da,de,en,en_AU,en_GB,en_SE,es,es_MX,fr,he,it,ja,ko,ms,nb,nl,pl,pt,pt_BR,ru,sv,th,tr,zh-Hans,zh-Hant,zh-Hant_TW. | ||
@property(nonatomic, copy, readwrite) NSString *languageOrLocale; | ||
|
||
/// If YES, the status bar's style will be kept as whatever your app has set it to. | ||
/// If NO, the status bar style will be set to the default style. | ||
/// Defaults to NO. | ||
@property(nonatomic, assign, readwrite) BOOL keepStatusBarStyle; | ||
|
||
/// The default appearance of the navigation bar is navigationBarStyle == UIBarStyleDefault; | ||
/// tintColor == nil (pre-iOS 7), barTintColor == nil (iOS 7). | ||
/// Set either or both of these properties if you want to override these defaults. | ||
/// @see navigationBarTintColor | ||
@property(nonatomic, assign, readwrite) UIBarStyle navigationBarStyle; | ||
/// The default appearance of the navigation bar is navigationBarStyle == UIBarStyleDefault; | ||
/// tintColor == nil (pre-iOS 7), barTintColor == nil (iOS 7). | ||
/// Set either or both of these properties if you want to override these defaults. | ||
/// @see navigationBarStyle | ||
@property(nonatomic, retain, readwrite) UIColor *navigationBarTintColor; | ||
|
||
/// Normally, card.io blurs the screen when the app is backgrounded, | ||
/// to obscure card details in the iOS-saved screenshot. | ||
/// If your app already does its own blurring upon backgrounding, | ||
/// you might choose to disable this behavior. | ||
/// Defaults to NO. | ||
@property(nonatomic, assign, readwrite) BOOL disableBlurWhenBackgrounding; | ||
|
||
/// Alter the card guide (bracket) color. Opaque colors recommended. | ||
/// Defaults to nil; if nil, will use card.io green. | ||
@property(nonatomic, retain, readwrite) UIColor *guideColor; | ||
|
||
/// If YES, don't have the user confirm the scanned card, just return the results immediately. | ||
/// Defaults to NO. | ||
@property(nonatomic, assign, readwrite) BOOL suppressScanConfirmation; | ||
|
||
/// If YES, instead of displaying the image of the scanned card, | ||
/// present the manual entry screen with the scanned card number prefilled. | ||
/// Defaults to NO. | ||
@property(nonatomic, assign, readwrite) BOOL suppressScannedCardImage; | ||
|
||
/// Mask the card number digits as they are manually entered by the user. Defaults to NO. | ||
@property(nonatomic, assign, readwrite) BOOL maskManualEntryDigits; | ||
|
||
/// Set to NO if you don't need to collect the card expiration. Defaults to YES. | ||
@property(nonatomic, assign, readwrite) BOOL collectExpiry; | ||
|
||
/// Set to NO if you don't need to collect the CVV from the user. Defaults to YES. | ||
@property(nonatomic, assign, readwrite) BOOL collectCVV; | ||
|
||
/// Set to YES if you need to collect the billing postal code. Defaults to NO. | ||
@property(nonatomic, assign, readwrite) BOOL collectPostalCode; | ||
/// Deprecated. | ||
/// @see collectPostalCode | ||
@property(nonatomic, assign, readwrite, getter=collectPostalCode, setter=setCollectPostalCode:) BOOL collectZip __attribute__((deprecated("Use collectPostalCode instead."))); | ||
|
||
/// Set to YES to show the card.io logo over the camera view instead of the PayPal logo. Defaults to NO. | ||
@property(nonatomic, assign, readwrite) BOOL useCardIOLogo; | ||
|
||
/// By default, in camera view the card guide and the buttons always rotate to match the device's orientation. | ||
/// All four orientations are permitted, regardless of any app or viewcontroller constraints. | ||
/// If you wish, the card guide and buttons can instead obey standard iOS constraints, including | ||
/// the UISupportedInterfaceOrientations settings in your app's plist. | ||
/// Set to NO to follow standard iOS constraints. Defaults to YES. (Does not affect the manual entry screen.) | ||
@property(nonatomic, assign, readwrite) BOOL allowFreelyRotatingCardGuide; | ||
|
||
/// Set to YES to prevent card.io from showing its "Enter Manually" button. Defaults to NO. | ||
/// | ||
/// @note If +canReadCardWithCamera returns false, then if card.io is presented it will | ||
/// automatically display its manual entry screen. | ||
/// Therefore, if you want to prevent users from *ever* seeing card.io's manual entry screen, | ||
/// you should first check +canReadCardWithCamera before initing the view controller. | ||
@property(nonatomic, assign, readwrite) BOOL disableManualEntryButtons; | ||
|
||
/// Access to the delegate. | ||
@property(nonatomic, weak, readwrite) id<CardIOPaymentViewControllerDelegate> paymentDelegate; | ||
|
||
/// Determine whether this device supports camera-based card scanning, considering | ||
/// factors such as hardware support and OS version. | ||
/// | ||
/// card.io automatically provides manual entry of cards as a fallback, | ||
/// so it is not typically necessary for your app to check this. | ||
/// | ||
/// @return YES iff the user's device supports camera-based card scanning. | ||
+ (BOOL)canReadCardWithCamera; | ||
|
||
/// Please send the output of this method with any technical support requests. | ||
/// @return Human-readable version of this library. | ||
+ (NSString *)libraryVersion; | ||
|
||
/// Previous versions of card.io provided an informative message when the user first launched card.io. | ||
@property(nonatomic, assign, readwrite) BOOL showsFirstUseAlert __attribute__((deprecated("The former first-time alert is no more."))); | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// CardIOPaymentViewControllerDelegate.h | ||
// Version 3.8.0 | ||
// | ||
// Copyright (c) 2011-2014 PayPal. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@class CardIOPaymentViewController; | ||
@class CardIOCreditCardInfo; | ||
|
||
/// The receiver will be notified when the CardIOPaymentViewController flow completes, due to either success or user-cancellation. | ||
/// | ||
/// Exactly one of these delegate methods will be called. | ||
/// | ||
/// Each of them MUST dismiss the CardIOPaymentViewController. | ||
@protocol CardIOPaymentViewControllerDelegate<NSObject> | ||
|
||
@required | ||
|
||
/// This method will be called if the user cancels the scan. You MUST dismiss paymentViewController. | ||
/// @param paymentViewController The active CardIOPaymentViewController. | ||
- (void)userDidCancelPaymentViewController:(CardIOPaymentViewController *)paymentViewController; | ||
|
||
/// This method will be called when there is a successful scan (or manual entry). You MUST dismiss paymentViewController. | ||
/// @param cardInfo The results of the scan. | ||
/// @param paymentViewController The active CardIOPaymentViewController. | ||
- (void)userDidProvideCreditCardInfo:(CardIOCreditCardInfo *)cardInfo inPaymentViewController:(CardIOPaymentViewController *)paymentViewController; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// | ||
// CardIOView.h | ||
// Version 3.8.0 | ||
// | ||
// Copyright (c) 2011-2014 PayPal. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import "CardIOViewDelegate.h" | ||
|
||
/// CardIOView is one of two main entry points into the card.io SDK. | ||
/// @see CardIOPaymentViewController | ||
@interface CardIOView : UIView | ||
|
||
/// Determine whether this device supports camera-based card scanning, considering | ||
/// factors such as hardware support and OS version. | ||
/// @return YES iff the user's device supports camera-based card scanning. | ||
+ (BOOL)canReadCardWithCamera; | ||
|
||
|
||
#pragma mark - Properties you MUST set | ||
|
||
/// Your app token. MUST be set before the CardIOView appears. | ||
@property(nonatomic, copy, readwrite) NSString *appToken; | ||
|
||
/// Typically, your view controller will set itself as this delegate. | ||
@property(nonatomic, strong, readwrite) id<CardIOViewDelegate> delegate; | ||
|
||
|
||
#pragma mark - Properties you MAY set | ||
|
||
/// The preferred language for all strings appearing in the user interface. | ||
/// If not set, or if set to nil, defaults to the device's current language setting. | ||
/// | ||
/// Can be specified as a language code ("en", "fr", "zh-Hans", etc.) or as a locale ("en_AU", "fr_FR", "zh-Hant_HK", etc.). | ||
/// If card.io does not contain localized strings for a specified locale, then it will fall back to the language. E.g., "es_CO" -> "es". | ||
/// If card.io does not contain localized strings for a specified language, then it will fall back to American English. | ||
/// | ||
/// If you specify only a language code, and that code matches the device's currently preferred language, | ||
/// then card.io will attempt to use the device's current region as well. | ||
/// E.g., specifying "en" on a device set to "English" and "United Kingdom" will result in "en_GB". | ||
/// | ||
/// These localizations are currently included: | ||
/// ar,da,de,en,en_AU,en_GB,en_SE,es,es_MX,fr,he,it,ja,ko,ms,nb,nl,pl,pt,pt_BR,ru,sv,th,tr,zh-Hans,zh-Hant,zh-Hant_TW. | ||
@property(nonatomic, copy, readwrite) NSString *languageOrLocale; | ||
|
||
/// Alter the card guide (bracket) color. Opaque colors recommended. | ||
/// Defaults to nil; if nil, will use card.io green. | ||
@property(nonatomic, retain, readwrite) UIColor *guideColor; | ||
|
||
/// Set to YES to show the card.io logo over the camera instead of the PayPal logo. Defaults to NO. | ||
@property(nonatomic, assign, readwrite) BOOL useCardIOLogo; | ||
|
||
/// By default, in camera view the card guide and the buttons always rotate to match the device's orientation. | ||
/// All four orientations are permitted, regardless of any app or viewcontroller constraints. | ||
/// If you wish, the card guide and buttons can instead obey standard iOS constraints, including | ||
/// the UISupportedInterfaceOrientations settings in your app's plist. | ||
/// Set to NO to follow standard iOS constraints. Defaults to YES. (Does not affect the manual entry screen.) | ||
@property(nonatomic, assign, readwrite) BOOL allowFreelyRotatingCardGuide; | ||
|
||
/// After a successful scan, the CardIOView will briefly display an image of the card with | ||
/// the computed card number superimposed. This property controls how long (in seconds) | ||
/// that image will be displayed. | ||
/// Set this to 0.0 to suppress the display entirely. | ||
/// Defaults to 1.0. | ||
@property(nonatomic, assign, readwrite) CGFloat scannedImageDuration; | ||
|
||
|
||
#pragma mark - Property you MAY get | ||
|
||
/// The actual camera preview area within the CardIOView. Location is relative to the CardIOView's origin. | ||
/// You might want to use this, for example, when adjusting your view controller's view layout. | ||
@property(nonatomic, assign, readonly) CGRect cameraPreviewFrame; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// CardIOViewDelegate.h | ||
// Version 3.8.0 | ||
// | ||
// Copyright (c) 2011-2014 PayPal. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@class CardIOCreditCardInfo; | ||
@class CardIOView; | ||
|
||
/// The receiver will be notified when the CardIOView completes it work. | ||
@protocol CardIOViewDelegate<NSObject> | ||
|
||
@required | ||
|
||
/// This method will be called when the CardIOView completes its work. | ||
/// It is up to you to hide or remove the CardIOView. | ||
/// At a minimum, you should give the user an opportunity to confirm that the card information was captured correctly. | ||
/// @param cardIOView The active CardIOView. | ||
/// @param cardInfo The results of the scan. | ||
/// @note cardInfo will be nil if exiting due to a problem (e.g., no available camera, or an invalid appToken). | ||
- (void)cardIOView:(CardIOView *)cardIOView didScanCard:(CardIOCreditCardInfo *)cardInfo; | ||
|
||
@end |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Credit card scanning example for iOS card.io | ||
============================================ | ||
|
||
To give this a try: | ||
|
||
1. Download an archive of [the most recent release](https://github.com/card-io/card.io-iOS-SDK/releases) of the card.io SDK. | ||
2. [Sign up for a developer account](https://www.card.io/accounts/register/developer) and [get an app token](https://www.card.io/apps/). | ||
3. Set your credentials: | ||
1. In `ScanExample/Constants.h`, set the value of `APP_TOKEN_FROM_WEBSITE` to your app token. | ||
2. Run `sh ignore.sh ignore` so that git will ignore your change to `ScanExample/Constants.h` | ||
4. Using Xcode 5.0 or newer, open `ScanExample.xcodeproj`, build and run. | ||
|
||
That's it!! | ||
|
||
Questions? Comments? Email support@card.io |
Oops, something went wrong.