diff --git a/CardIO/CardIO.h b/CardIO/CardIO.h new file mode 100644 index 0000000..e322f34 --- /dev/null +++ b/CardIO/CardIO.h @@ -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" diff --git a/CardIO/CardIOCreditCardInfo.h b/CardIO/CardIOCreditCardInfo.h new file mode 100644 index 0000000..ca0d68f --- /dev/null +++ b/CardIO/CardIOCreditCardInfo.h @@ -0,0 +1,85 @@ +// +// CardIOCreditCardInfo.h +// Version 3.8.0 +// +// Copyright (c) 2011-2014 PayPal. All rights reserved. +// + +#import +#import + +/// 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 + +/// 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 diff --git a/CardIO/CardIOPaymentViewController.h b/CardIO/CardIOPaymentViewController.h new file mode 100644 index 0000000..c5f9556 --- /dev/null +++ b/CardIO/CardIOPaymentViewController.h @@ -0,0 +1,135 @@ +// +// CardIOPaymentViewController.h +// Version 3.8.0 +// +// Copyright (c) 2011-2014 PayPal. All rights reserved. +// + +#import +#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)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)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 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 \ No newline at end of file diff --git a/CardIO/CardIOPaymentViewControllerDelegate.h b/CardIO/CardIOPaymentViewControllerDelegate.h new file mode 100644 index 0000000..dec0a15 --- /dev/null +++ b/CardIO/CardIOPaymentViewControllerDelegate.h @@ -0,0 +1,31 @@ +// +// CardIOPaymentViewControllerDelegate.h +// Version 3.8.0 +// +// Copyright (c) 2011-2014 PayPal. All rights reserved. +// + +#import + +@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 + +@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 \ No newline at end of file diff --git a/CardIO/CardIOView.h b/CardIO/CardIOView.h new file mode 100644 index 0000000..26a7020 --- /dev/null +++ b/CardIO/CardIOView.h @@ -0,0 +1,75 @@ +// +// CardIOView.h +// Version 3.8.0 +// +// Copyright (c) 2011-2014 PayPal. All rights reserved. +// + +#import +#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 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 diff --git a/CardIO/CardIOViewDelegate.h b/CardIO/CardIOViewDelegate.h new file mode 100644 index 0000000..802f9b2 --- /dev/null +++ b/CardIO/CardIOViewDelegate.h @@ -0,0 +1,26 @@ +// +// CardIOViewDelegate.h +// Version 3.8.0 +// +// Copyright (c) 2011-2014 PayPal. All rights reserved. +// + +#import + +@class CardIOCreditCardInfo; +@class CardIOView; + +/// The receiver will be notified when the CardIOView completes it work. +@protocol CardIOViewDelegate + +@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 \ No newline at end of file diff --git a/CardIO/libCardIO.a b/CardIO/libCardIO.a new file mode 100644 index 0000000..e2ffe4c Binary files /dev/null and b/CardIO/libCardIO.a differ diff --git a/SampleApp/Default-568h@2x.png b/SampleApp/Default-568h@2x.png new file mode 100644 index 0000000..0891b7a Binary files /dev/null and b/SampleApp/Default-568h@2x.png differ diff --git a/SampleApp/README.md b/SampleApp/README.md new file mode 100644 index 0000000..1928cae --- /dev/null +++ b/SampleApp/README.md @@ -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 diff --git a/SampleApp/ScanExample.xcodeproj/project.pbxproj b/SampleApp/ScanExample.xcodeproj/project.pbxproj new file mode 100644 index 0000000..f71bae0 --- /dev/null +++ b/SampleApp/ScanExample.xcodeproj/project.pbxproj @@ -0,0 +1,392 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 0A2C90381564175A000727BC /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A2C90371564175A000727BC /* UIKit.framework */; }; + 0A2C903A1564175A000727BC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A2C90391564175A000727BC /* Foundation.framework */; }; + 0A2C90421564175A000727BC /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0A2C90401564175A000727BC /* InfoPlist.strings */; }; + 0A2C90441564175A000727BC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A2C90431564175A000727BC /* main.m */; }; + 0A2C90481564175A000727BC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A2C90471564175A000727BC /* AppDelegate.m */; }; + 0A2C904B1564175A000727BC /* MainStoryboard_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0A2C90491564175A000727BC /* MainStoryboard_iPhone.storyboard */; }; + 0A2C904E1564175A000727BC /* MainStoryboard_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0A2C904C1564175A000727BC /* MainStoryboard_iPad.storyboard */; }; + 0A2C90511564175A000727BC /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A2C90501564175A000727BC /* ViewController.m */; }; + 0A96B63B156447A300DBA017 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A96B63A156447A300DBA017 /* AVFoundation.framework */; }; + 0A96B63D156447AC00DBA017 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A96B63C156447AC00DBA017 /* AudioToolbox.framework */; }; + 0A96B63F156447B400DBA017 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A96B63E156447B400DBA017 /* CoreMedia.framework */; }; + 0A96B641156447BC00DBA017 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A96B640156447BC00DBA017 /* CoreVideo.framework */; }; + 0A96B645156447CD00DBA017 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A96B644156447CD00DBA017 /* MobileCoreServices.framework */; }; + 0A96B647156447D400DBA017 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A96B646156447D400DBA017 /* QuartzCore.framework */; }; + 0A96B649156447DB00DBA017 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A96B648156447DB00DBA017 /* Security.framework */; }; + 2680866116FFAC7A0058FD24 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2680866016FFAC7A0058FD24 /* Default-568h@2x.png */; }; + 2680867016FFB2A00058FD24 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2680866F16FFB2A00058FD24 /* OpenGLES.framework */; }; + 3EB7592518341EE80008860A /* libCardIO.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EB7592318341EB80008860A /* libCardIO.a */; }; + 3ED76B6417ECF9F50014F059 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3ED76B6317ECF9F50014F059 /* CoreGraphics.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 0A2C90331564175A000727BC /* ScanExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ScanExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 0A2C90371564175A000727BC /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 0A2C90391564175A000727BC /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 0A2C903F1564175A000727BC /* ScanExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ScanExample-Info.plist"; sourceTree = ""; }; + 0A2C90411564175A000727BC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 0A2C90431564175A000727BC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 0A2C90451564175A000727BC /* ScanExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ScanExample-Prefix.pch"; sourceTree = ""; }; + 0A2C90461564175A000727BC /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 0A2C90471564175A000727BC /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 0A2C904A1564175A000727BC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard_iPhone.storyboard; sourceTree = ""; }; + 0A2C904D1564175A000727BC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard_iPad.storyboard; sourceTree = ""; }; + 0A2C904F1564175A000727BC /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 0A2C90501564175A000727BC /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 0A96B63A156447A300DBA017 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + 0A96B63C156447AC00DBA017 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + 0A96B63E156447B400DBA017 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + 0A96B640156447BC00DBA017 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; + 0A96B644156447CD00DBA017 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; + 0A96B646156447D400DBA017 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 0A96B648156447DB00DBA017 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; + 2680866016FFAC7A0058FD24 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "../Default-568h@2x.png"; sourceTree = ""; }; + 2680866E16FFB0EA0058FD24 /* Constants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Constants.h; sourceTree = ""; }; + 2680866F16FFB2A00058FD24 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; + 3EB7591D18341EB80008860A /* CardIO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CardIO.h; sourceTree = ""; }; + 3EB7591E18341EB80008860A /* CardIOCreditCardInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CardIOCreditCardInfo.h; sourceTree = ""; }; + 3EB7591F18341EB80008860A /* CardIOPaymentViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CardIOPaymentViewController.h; sourceTree = ""; }; + 3EB7592018341EB80008860A /* CardIOPaymentViewControllerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CardIOPaymentViewControllerDelegate.h; sourceTree = ""; }; + 3EB7592118341EB80008860A /* CardIOView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CardIOView.h; sourceTree = ""; }; + 3EB7592218341EB80008860A /* CardIOViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CardIOViewDelegate.h; sourceTree = ""; }; + 3EB7592318341EB80008860A /* libCardIO.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libCardIO.a; sourceTree = ""; }; + 3ED76B6317ECF9F50014F059 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 0A2C90301564175A000727BC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3EB7592518341EE80008860A /* libCardIO.a in Frameworks */, + 0A96B63D156447AC00DBA017 /* AudioToolbox.framework in Frameworks */, + 0A96B63B156447A300DBA017 /* AVFoundation.framework in Frameworks */, + 3ED76B6417ECF9F50014F059 /* CoreGraphics.framework in Frameworks */, + 0A96B63F156447B400DBA017 /* CoreMedia.framework in Frameworks */, + 0A96B641156447BC00DBA017 /* CoreVideo.framework in Frameworks */, + 0A2C903A1564175A000727BC /* Foundation.framework in Frameworks */, + 0A96B645156447CD00DBA017 /* MobileCoreServices.framework in Frameworks */, + 2680867016FFB2A00058FD24 /* OpenGLES.framework in Frameworks */, + 0A96B647156447D400DBA017 /* QuartzCore.framework in Frameworks */, + 0A96B649156447DB00DBA017 /* Security.framework in Frameworks */, + 0A2C90381564175A000727BC /* UIKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0A2C90281564175A000727BC = { + isa = PBXGroup; + children = ( + 0A2C903D1564175A000727BC /* ScanExample */, + 3EB7591C18341EB80008860A /* CardIO */, + 0A2C90361564175A000727BC /* Frameworks */, + 0A2C90341564175A000727BC /* Products */, + ); + sourceTree = ""; + }; + 0A2C90341564175A000727BC /* Products */ = { + isa = PBXGroup; + children = ( + 0A2C90331564175A000727BC /* ScanExample.app */, + ); + name = Products; + sourceTree = ""; + }; + 0A2C90361564175A000727BC /* Frameworks */ = { + isa = PBXGroup; + children = ( + 0A96B63C156447AC00DBA017 /* AudioToolbox.framework */, + 0A96B63A156447A300DBA017 /* AVFoundation.framework */, + 3ED76B6317ECF9F50014F059 /* CoreGraphics.framework */, + 0A96B63E156447B400DBA017 /* CoreMedia.framework */, + 0A96B640156447BC00DBA017 /* CoreVideo.framework */, + 0A2C90391564175A000727BC /* Foundation.framework */, + 0A96B644156447CD00DBA017 /* MobileCoreServices.framework */, + 2680866F16FFB2A00058FD24 /* OpenGLES.framework */, + 0A96B646156447D400DBA017 /* QuartzCore.framework */, + 0A96B648156447DB00DBA017 /* Security.framework */, + 0A2C90371564175A000727BC /* UIKit.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 0A2C903D1564175A000727BC /* ScanExample */ = { + isa = PBXGroup; + children = ( + 0A2C903E1564175A000727BC /* Supporting Files */, + 2680866E16FFB0EA0058FD24 /* Constants.h */, + 0A2C90461564175A000727BC /* AppDelegate.h */, + 0A2C90471564175A000727BC /* AppDelegate.m */, + 0A2C90491564175A000727BC /* MainStoryboard_iPhone.storyboard */, + 0A2C904C1564175A000727BC /* MainStoryboard_iPad.storyboard */, + 0A2C904F1564175A000727BC /* ViewController.h */, + 0A2C90501564175A000727BC /* ViewController.m */, + ); + path = ScanExample; + sourceTree = ""; + }; + 0A2C903E1564175A000727BC /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 2680866016FFAC7A0058FD24 /* Default-568h@2x.png */, + 0A2C903F1564175A000727BC /* ScanExample-Info.plist */, + 0A2C90401564175A000727BC /* InfoPlist.strings */, + 0A2C90431564175A000727BC /* main.m */, + 0A2C90451564175A000727BC /* ScanExample-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 3EB7591C18341EB80008860A /* CardIO */ = { + isa = PBXGroup; + children = ( + 3EB7591D18341EB80008860A /* CardIO.h */, + 3EB7591E18341EB80008860A /* CardIOCreditCardInfo.h */, + 3EB7591F18341EB80008860A /* CardIOPaymentViewController.h */, + 3EB7592018341EB80008860A /* CardIOPaymentViewControllerDelegate.h */, + 3EB7592118341EB80008860A /* CardIOView.h */, + 3EB7592218341EB80008860A /* CardIOViewDelegate.h */, + 3EB7592318341EB80008860A /* libCardIO.a */, + ); + name = CardIO; + path = ../CardIO; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 0A2C90321564175A000727BC /* ScanExample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 0A2C90541564175A000727BC /* Build configuration list for PBXNativeTarget "ScanExample" */; + buildPhases = ( + 0A2C902F1564175A000727BC /* Sources */, + 0A2C90301564175A000727BC /* Frameworks */, + 0A2C90311564175A000727BC /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ScanExample; + productName = ScanExample; + productReference = 0A2C90331564175A000727BC /* ScanExample.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 0A2C902A1564175A000727BC /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0500; + ORGANIZATIONNAME = card.io; + }; + buildConfigurationList = 0A2C902D1564175A000727BC /* Build configuration list for PBXProject "ScanExample" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 0A2C90281564175A000727BC; + productRefGroup = 0A2C90341564175A000727BC /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 0A2C90321564175A000727BC /* ScanExample */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 0A2C90311564175A000727BC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0A2C90421564175A000727BC /* InfoPlist.strings in Resources */, + 0A2C904B1564175A000727BC /* MainStoryboard_iPhone.storyboard in Resources */, + 0A2C904E1564175A000727BC /* MainStoryboard_iPad.storyboard in Resources */, + 2680866116FFAC7A0058FD24 /* Default-568h@2x.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 0A2C902F1564175A000727BC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0A2C90441564175A000727BC /* main.m in Sources */, + 0A2C90481564175A000727BC /* AppDelegate.m in Sources */, + 0A2C90511564175A000727BC /* ViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 0A2C90401564175A000727BC /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 0A2C90411564175A000727BC /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 0A2C90491564175A000727BC /* MainStoryboard_iPhone.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 0A2C904A1564175A000727BC /* en */, + ); + name = MainStoryboard_iPhone.storyboard; + sourceTree = ""; + }; + 0A2C904C1564175A000727BC /* MainStoryboard_iPad.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 0A2C904D1564175A000727BC /* en */, + ); + name = MainStoryboard_iPad.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 0A2C90521564175A000727BC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 0A2C90531564175A000727BC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + ONLY_ACTIVE_ARCH = NO; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 0A2C90551564175A000727BC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "ScanExample/ScanExample-Prefix.pch"; + INFOPLIST_FILE = "ScanExample/ScanExample-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/../CardIO", + ); + OTHER_LDFLAGS = "-lc++"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + 0A2C90561564175A000727BC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "ScanExample/ScanExample-Prefix.pch"; + INFOPLIST_FILE = "ScanExample/ScanExample-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/../CardIO", + ); + OTHER_LDFLAGS = "-lc++"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 0A2C902D1564175A000727BC /* Build configuration list for PBXProject "ScanExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0A2C90521564175A000727BC /* Debug */, + 0A2C90531564175A000727BC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 0A2C90541564175A000727BC /* Build configuration list for PBXNativeTarget "ScanExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0A2C90551564175A000727BC /* Debug */, + 0A2C90561564175A000727BC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 0A2C902A1564175A000727BC /* Project object */; +} diff --git a/SampleApp/ScanExample/AppDelegate.h b/SampleApp/ScanExample/AppDelegate.h new file mode 100644 index 0000000..640dc6c --- /dev/null +++ b/SampleApp/ScanExample/AppDelegate.h @@ -0,0 +1,14 @@ +// +// AppDelegate.h +// ScanExample +// +// Copyright (c) 2012 PayPal. All rights reserved. +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@end diff --git a/SampleApp/ScanExample/AppDelegate.m b/SampleApp/ScanExample/AppDelegate.m new file mode 100644 index 0000000..741e37e --- /dev/null +++ b/SampleApp/ScanExample/AppDelegate.m @@ -0,0 +1,17 @@ +// +// AppDelegate.m +// ScanExample +// +// Copyright (c) 2012 PayPal. All rights reserved. +// + +#import "AppDelegate.h" + +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + +@end diff --git a/SampleApp/ScanExample/Constants.h b/SampleApp/ScanExample/Constants.h new file mode 100644 index 0000000..8baa22d --- /dev/null +++ b/SampleApp/ScanExample/Constants.h @@ -0,0 +1,14 @@ +// +// Constants.h +// ScanExample +// +// Copyright (c) 2013 PayPal. All rights reserved. +// + +#ifndef ScanExample_Constants_h +#define ScanExample_Constants_h + +// get your app token from the card.io website +#define CardIOAppToken @"APP_TOKEN_FROM_WEBSITE" + +#endif diff --git a/SampleApp/ScanExample/ScanExample-Info.plist b/SampleApp/ScanExample/ScanExample-Info.plist new file mode 100644 index 0000000..95042bd --- /dev/null +++ b/SampleApp/ScanExample/ScanExample-Info.plist @@ -0,0 +1,47 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + org.my.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UIMainStoryboardFile + MainStoryboard_iPhone + UIMainStoryboardFile~ipad + MainStoryboard_iPad + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/SampleApp/ScanExample/ScanExample-Prefix.pch b/SampleApp/ScanExample/ScanExample-Prefix.pch new file mode 100644 index 0000000..76df86e --- /dev/null +++ b/SampleApp/ScanExample/ScanExample-Prefix.pch @@ -0,0 +1,14 @@ +// +// Prefix header for all source files of the 'ScanExample' target in the 'ScanExample' project +// + +#import + +#ifndef __IPHONE_5_0 +#warning "This project uses features only available in iOS SDK 5.0 and later." +#endif + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/SampleApp/ScanExample/ViewController.h b/SampleApp/ScanExample/ViewController.h new file mode 100644 index 0000000..e4e09ab --- /dev/null +++ b/SampleApp/ScanExample/ViewController.h @@ -0,0 +1,13 @@ +// +// ViewController.h +// ScanExample +// +// Copyright (c) 2012 PayPal. All rights reserved. +// + +#import +#import "CardIOPaymentViewControllerDelegate.h" + +@interface ViewController : UIViewController + +@end \ No newline at end of file diff --git a/SampleApp/ScanExample/ViewController.m b/SampleApp/ScanExample/ViewController.m new file mode 100644 index 0000000..5ac2859 --- /dev/null +++ b/SampleApp/ScanExample/ViewController.m @@ -0,0 +1,53 @@ +// +// ViewController.m +// ScanExample +// +// Copyright (c) 2012 PayPal. All rights reserved. +// + +#import "ViewController.h" + +#import "Constants.h" +#import "CardIO.h" + +@interface ViewController () + +@property (weak, nonatomic) IBOutlet UILabel *infoLabel; + +@end + +@implementation ViewController + +#pragma mark - View Lifecycle +#pragma mark - + +- (void)viewDidLoad { + [super viewDidLoad]; + self.infoLabel.text = @""; +} + +#pragma mark - User Actions + +- (void)scanCardClicked:(id)sender { + CardIOPaymentViewController *scanViewController = [[CardIOPaymentViewController alloc] initWithPaymentDelegate:self]; + scanViewController.modalPresentationStyle = UIModalPresentationFormSheet; + scanViewController.appToken = CardIOAppToken; // see Constants.h + [self presentViewController:scanViewController animated:YES completion:nil]; +} + +#pragma mark - CardIOPaymentViewControllerDelegate + +- (void)userDidProvideCreditCardInfo:(CardIOCreditCardInfo *)info inPaymentViewController:(CardIOPaymentViewController *)paymentViewController { + NSLog(@"Scan succeeded with info: %@", info); + // Do whatever needs to be done to deliver the purchased items. + [self dismissViewControllerAnimated:YES completion:nil]; + + self.infoLabel.text = [NSString stringWithFormat:@"Received card info. Number: %@, expiry: %02lu/%lu, cvv: %@.", info.redactedCardNumber, (unsigned long)info.expiryMonth, (unsigned long)info.expiryYear, info.cvv]; +} + +- (void)userDidCancelPaymentViewController:(CardIOPaymentViewController *)paymentViewController { + NSLog(@"User cancelled scan"); + [self dismissViewControllerAnimated:YES completion:nil]; +} + +@end diff --git a/SampleApp/ScanExample/en.lproj/InfoPlist.strings b/SampleApp/ScanExample/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/SampleApp/ScanExample/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/SampleApp/ScanExample/en.lproj/MainStoryboard_iPad.storyboard b/SampleApp/ScanExample/en.lproj/MainStoryboard_iPad.storyboard new file mode 100644 index 0000000..7a41824 --- /dev/null +++ b/SampleApp/ScanExample/en.lproj/MainStoryboard_iPad.storyboard @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SampleApp/ScanExample/en.lproj/MainStoryboard_iPhone.storyboard b/SampleApp/ScanExample/en.lproj/MainStoryboard_iPhone.storyboard new file mode 100644 index 0000000..b102348 --- /dev/null +++ b/SampleApp/ScanExample/en.lproj/MainStoryboard_iPhone.storyboard @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SampleApp/ScanExample/main.m b/SampleApp/ScanExample/main.m new file mode 100644 index 0000000..03a043c --- /dev/null +++ b/SampleApp/ScanExample/main.m @@ -0,0 +1,17 @@ +// +// main.m +// ScanExample +// +// Copyright (c) 2012 PayPal. All rights reserved. +// + +#import + +#import "AppDelegate.h" + +int main(int argc, char *argv[]) +{ + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/SampleApp/ignore.sh b/SampleApp/ignore.sh new file mode 100755 index 0000000..2a43b30 --- /dev/null +++ b/SampleApp/ignore.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# Set Git to ignore locally changed Constants.h after the default is set + +case "$1" in + ignore) + git update-index --assume-unchanged ScanExample/Constants.h + ;; + unignore) + git update-index --no-assume-unchanged ScanExample/Constants.h + ;; + *) + echo "Usage: `basename $0` { ignore | unignore }" + ;; +esac +