├── License.md ├── PayMillSDK.podspec ├── README.md ├── macos ├── PayMillSDK.framework │ ├── Headers │ ├── PayMillSDK │ └── Versions │ │ ├── A │ │ ├── Headers │ │ │ ├── PMClient.h │ │ │ ├── PMError.h │ │ │ ├── PMFactory.h │ │ │ ├── PMManager.h │ │ │ ├── PMPayment.h │ │ │ ├── PMPaymentMethod.h │ │ │ ├── PMPaymentParams.h │ │ │ ├── PMPreauthorization.h │ │ │ ├── PMRefund.h │ │ │ ├── PMSDK.h │ │ │ └── PMTransaction.h │ │ └── PayMillSDK │ │ └── Current └── library_versions │ ├── PayMillSDK_arm64 │ ├── PayMillSDK_armv7 │ ├── PayMillSDK_i386 │ └── PayMillSDK_x86_64 └── samples └── vouchermill ├── .gitignore ├── Default-568h@2x.png ├── Default.png ├── Default@2x.png ├── Icon.png ├── Icon@2x.png ├── MBProgressHUD ├── MBProgressHUD.h └── MBProgressHUD.m ├── PayMillSDK └── PayMillSDK.framework │ ├── Headers │ ├── PayMillSDK │ └── Versions │ ├── A │ ├── Headers │ │ ├── PMClient.h │ │ ├── PMError.h │ │ ├── PMFactory.h │ │ ├── PMManager.h │ │ ├── PMPayment.h │ │ ├── PMPaymentMethod.h │ │ ├── PMPaymentParams.h │ │ ├── PMPreauthorization.h │ │ ├── PMRefund.h │ │ ├── PMSDK.h │ │ └── PMTransaction.h │ └── PayMillSDK │ └── Current ├── PaymentScreens ├── CardsData.plist ├── PMCreditCardTypeParser.h ├── PMCreditCardTypeParser.m ├── PMCreditCardView.h ├── PMCreditCardView.m ├── PMCreditCardView.xib ├── PMDirectDebitView.h ├── PMDirectDebitView.m ├── PMDirectDebitView.xib ├── PMPaymentDataValidator.h ├── PMPaymentDataValidator.m ├── PMPaymentMethodsListCell.h ├── PMPaymentMethodsListCell.m ├── PMPaymentMethodsListCell.xib ├── PMPaymentMethodsListViewController.h ├── PMPaymentMethodsListViewController.m ├── PMPaymentMethodsListViewController.xib ├── PMPaymentScreen.xib ├── PMPaymentView.h ├── PMPaymentView.m ├── PMPaymentViewController.h ├── PMPaymentViewController.m ├── PMPaymentViewController.xib ├── PMTextField.h ├── PMTextField.m └── Resources │ ├── Cards │ ├── American Express - tst.png │ ├── americanExpress.png │ ├── americanExpress@2x.png │ ├── cvc-amex.png │ ├── cvc-amex@2x.png │ ├── cvc.png │ ├── cvc@2x.png │ ├── diners.png │ ├── dinersClub.png │ ├── dinersClub@2x.png │ ├── discover-tst.png │ ├── discover-tst@2x.png │ ├── discover.png │ ├── discover@2x.png │ ├── instantPayments.png │ ├── instantPayments@2x.png │ ├── jcb-tst.png │ ├── jcb.png │ ├── jcb@2x.png │ ├── laser.png │ ├── laser@2x.png │ ├── maestro.png │ ├── maestro@2x.png │ ├── masterCard.png │ ├── masterCard@2x.png │ ├── mastercard-tst.png │ ├── placeholder.png │ ├── placeholder@2x.png │ ├── unionPay.png │ ├── unionPay@2x.png │ ├── visa-tst.png │ ├── visa.png │ └── visa@2x.png │ ├── button_backgroundimage.png │ ├── button_backgroundimage@2x.png │ ├── divider_selected.png │ ├── divider_selected@2x.png │ ├── selectedbutton_backgroundimage.png │ └── selectedbutton_backgroundimage@2x.png ├── README.md ├── VoucherMill.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── VoucherMill.xccheckout ├── VoucherMill ├── App Delegate │ ├── PMAppDelegate.h │ └── PMAppDelegate.m ├── Constants.h ├── Dashboard │ ├── PMDashboardViewCell.h │ ├── PMDashboardViewCell.m │ ├── PMDashboardViewController.h │ └── PMDashboardViewController.m ├── DataBase │ ├── OfflineVoucher.h │ ├── OfflineVoucher.m │ ├── PMDataBaseManager.h │ ├── PMDataBaseManager.m │ └── VoucherMill.xcdatamodeld │ │ └── VoucherMill.xcdatamodel │ │ └── contents ├── Details │ ├── DetailsViewController.h │ └── DetailsViewController.m ├── Lists │ ├── PMListViewController.h │ └── PMListViewController.m ├── Login │ ├── PMLoginButtonCell.h │ ├── PMLoginButtonCell.m │ ├── PMLoginSegmentedControlCell.h │ ├── PMLoginSegmentedControlCell.m │ ├── PMLoginTextFieldCell.h │ ├── PMLoginTextFieldCell.m │ ├── PMLoginViewController.h │ ├── PMLoginViewController.m │ └── Settings │ │ ├── PMSettingsViewController.h │ │ └── PMSettingsViewController.m ├── Model │ ├── PMVoucher.h │ └── PMVoucher.m ├── Navigation │ ├── PMNavigationController.h │ └── PMNavigationController.m ├── Purchases │ ├── PMButtonCell.h │ ├── PMButtonCell.m │ ├── PMButtonCell.xib │ ├── PMBuyChildCustomCell.h │ ├── PMBuyChildCustomCell.m │ ├── PMBuyChildCustomCell.xib │ ├── PMBuyContainerController.h │ ├── PMBuyContainerController.m │ ├── PMBuyDetailsErrorMessageCell.h │ ├── PMBuyDetailsErrorMessageCell.m │ ├── PMBuyDetailsViewController.h │ ├── PMBuyDetailsViewController.m │ ├── PMBuyTableViewController.h │ ├── PMBuyTableViewController.m │ ├── PMBuyTableViewController.xib │ ├── PMImageViewCell.h │ ├── PMImageViewCell.m │ ├── PMImageViewCell.xib │ ├── PMVoucherParams.h │ └── PMVoucherParams.m ├── Resources │ ├── Icon-120.png │ ├── Icon-152.png │ ├── Icon-60.png │ ├── Icon-76.png │ ├── Icon-Small.png │ ├── Icon-Small@2x.png │ ├── burger.png │ ├── burger@2x.png │ ├── burger_big.png │ ├── burger_big@2x.png │ ├── button_backgroundimage.png │ ├── button_backgroundimage@2x.png │ ├── buy_voucher.png │ ├── buy_voucher@2x.png │ ├── buy_voucher_pressed.png │ ├── buy_voucher_pressed@2x.png │ ├── custom.png │ ├── custom@2x.png │ ├── custom_big.png │ ├── custom_big@2x.png │ ├── divider_selected.png │ ├── divider_selected@2x.png │ ├── logo.png │ ├── logo@2x.png │ ├── not_consumed.png │ ├── not_consumed@2x.png │ ├── not_consumed_pressed.png │ ├── not_consumed_pressed@2x.png │ ├── offline_vouchers.png │ ├── offline_vouchers@2x.png │ ├── offline_vouchers_pressed.png │ ├── offline_vouchers_pressed@2x.png │ ├── online_vouchers.png │ ├── online_vouchers@2x.png │ ├── online_vouchers_pressed.png │ ├── online_vouchers_pressed@2x.png │ ├── selectedbutton_backgroundimage.png │ ├── selectedbutton_backgroundimage@2x.png │ ├── tickets.png │ ├── tickets@2x.png │ ├── tickets_big.png │ ├── tickets_big@2x.png │ ├── tyre.png │ ├── tyre@2x.png │ ├── tyre_big.png │ └── tyre_big@2x.png ├── Storyboards │ └── MainStoryboard.storyboard ├── Utils │ ├── PMConstants.h │ ├── PMConstants.m │ ├── PMUISupport.h │ ├── PMUISupport.m │ ├── PMUserDefaultsManager.h │ ├── PMUserDefaultsManager.m │ ├── PMVoucherUtils.h │ └── PMVoucherUtils.m ├── VoucherMill-Info.plist ├── VoucherMill-Prefix.pch ├── en.lproj │ └── InfoPlist.strings └── main.m └── snippets ├── PMPaymentScreensSnippet.h ├── PMPaymentScreensSnippet.m ├── PMSDKSnippets.h └── PMSDKSnippets.m /License.md: -------------------------------------------------------------------------------- 1 | Commercial. Copyright by PAYMILL GmbH. 2 | Further terms and conditions on using PAYMILL can be found here - https://www.paymill.com/en-gb/terms-conditions/ . -------------------------------------------------------------------------------- /PayMillSDK.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'PayMillSDK' 3 | s.version = '2.2.0' 4 | s.summary = "PAYMILL iOS SDK enables processing of payments for iOS applications. Visit http://www.paymill.com for more information." 5 | s.homepage = "https://www.paymill.com/en-gb/documentation-3/reference/mobile-sdk/" 6 | s.license = 'Commercial, :file => License.md' 7 | s.author = { "Paymill GmbH" => "support@paymill.de" } 8 | s.source = { :git => "https://github.com/paymill/paymill-ios.git", :tag => '2.2.0' } 9 | s.ios.deployment_target = '6.0' 10 | s.osx.deployment_target = '10.8' 11 | s.ios.public_header_files = 'samples/vouchermill/PayMillSDK/PayMillSDK.framework/Versions/A/Headers/*.h' 12 | s.osx.public_header_files = 'macos/PayMillSDK.framework/Versions/A/Headers/*.h' 13 | s.ios.preserve_paths = 'samples/vouchermill/PayMillSDK/PayMillSDK.framework' 14 | s.osx.preserve_paths = 'macos/PayMillSDK.framework' 15 | s.ios.vendored_frameworks = 'samples/vouchermill/PayMillSDK/PayMillSDK.framework' 16 | s.osx.vendored_frameworks = 'macos/PayMillSDK.framework' 17 | s.requires_arc = true 18 | s.framework = 'Security' 19 | s.xcconfig = { 'OTHER_LDFLAGS' => '-ObjC' } 20 | end 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![PAYMILL icon](https://static.paymill.com/r/335f99eb3914d517bf392beb1adaf7cccef786b6/img/logo-download_Light.png) 2 | # PAYMILL iOS/MacOS SDK 3 | 4 | The iOS/MacOS SDK provides a flexible and easy to integrate payment solution for your iOS/MacOS applications. 5 | 6 | ## Sample App for iOS 7 | 8 | View our open source sample / demo app [VoucherMill](/samples/vouchermill). 9 | 10 | ## Tutorial 11 | 12 | In the [Honey Store tutorial](https://github.com/paymill/paymill-example-ios-parse-honeystore) we show you how to use the iOS SDK together with your backend, enabling returning (1-click) payments. In addition, we integrated the free [card.io](https://www.card.io/) library for card scanning. 13 | 14 | ## Getting started 15 | 16 | - Start with the [SDK guide](https://www.paymill.com/en-gb/documentation-3/reference/mobile-sdk/). 17 | - Install the latest release. 18 | - If you want to create transaction and preauthorizations directly from within your app, [install](https://paymill.com/mobile-app-install/) the PAYMILL mobile app. 19 | - Check the sample / demo app [VoucherMill](/samples/vouchermill) for a showcase and stylable payment screens. 20 | - Check the [full API documentation](http://paymill.github.io/paymill-ios/docs/sdk/). 21 | 22 | ## Requirements 23 | 24 | iOS 6.0 or later / OS X 10.6 or later. 25 | 26 | ## Installation 27 | 28 | - Xcode users add 'PayMillSDK' folder to their project. 29 | - CocoaPods users add this dependency to their `Podfile`: 30 | ``` 31 | pod 'PayMillSDK', '~> 2.2.0' 32 | ``` 33 | 34 | *In cases Cocoapods central repository is not available, you can add folowing line to your `Podfile`:* 35 | ``` 36 | pod 'PayMillSDK', :git=>'https://github.com/paymill/paymill-ios.git', :branch=>'master', :tag=>'2.2.0' 37 | ``` 38 | 39 | ## Working with the SDK 40 | 41 | 42 | ### PMPayment, PMParams and PMFactory 43 | 44 | 45 | A [PMPayment](http://paymill.github.io/paymill-ios/docs/sdk/Classes/PMPayment.html) object contains the credit card or bank account information of a customer. A [PMPaymentParams](http://paymill.github.io/paymill-ios/docs/sdk/Classes/PMPaymentParams.html) object contains the parameters of a payment - amount, currency, description. Both must always be created with the [PMFactory](http://paymill.github.io/paymill-ios/docs/sdk/Classes/PMFactory.html) class. 46 | 47 | ### Generate a token 48 | 49 | Create [PMPayment](http://paymill.github.io/paymill-ios/docs/sdk/Classes/PMPayment.html) and [PMPaymentParams](http://paymill.github.io/paymill-ios/docs/sdk/Classes/PMPaymentParams.html) and call [PMManager generateTokenWithMethod](http://paymill.github.io/paymill-ios/docs/sdk/Classes/PMManager.html#//api/name/generateTokenWithPublicKey:testMode:method:parameters:success:failure:) with your PAYMILL public key and mode. 50 | 51 | ```objective-c 52 | NSError *error; 53 | PMPaymentParams *params; 54 | id paymentMethod = [PMFactory genCardPaymentWithAccHolder:@"Max Musterman" 55 | cardNumber:@"4711100000000000" expiryMonth:@"12" expiryYear:@"2014" 56 | verification:@"333" error:&error]; 57 | 58 | if(!error) { 59 | params = [PMFactory genPaymentParamsWithCurrency:@"EUR" amount:100 60 | description:@"Description" error:&error]; 61 | } 62 | 63 | if(!error) { 64 | //generate token with PAYMILL public key 65 | [PMManager generateTokenWithPublicKey:myPublicKey testMode:YES 66 | method:paymentMethod parameters:params 67 | success:^(NSString *token) { 68 | //token successfully created 69 | } 70 | failure:^(NSError *error) { 71 | //token generation failed 72 | }]; 73 | } 74 | 75 | ``` 76 | ### Create a transaction 77 | 78 | To create transactions and preauthorizations directly from the SDK you first need to install the Mobile App. In the code you will have to initialize the SDK, by calling [PMManger initWithTestMode](http://paymill.github.io/paymill-ios/docs/sdk/Classes/PMManager.html#//api/name/initWithTestMode:merchantPublicKey:newDeviceId:init:) method with your PAYMILL public key and mode. 79 | 80 | ```objective-c 81 | //init with PAYMILL public key 82 | [PMManager initWithTestMode:YES merchantPublicKey:myPublicKey newDeviceId:nil init:^(BOOL success, NSError *error) { 83 | if(success) { 84 | // init successfull 85 | // start using the SDK 86 | } 87 | }]; 88 | 89 | NSError *error; 90 | PMPaymentParams *params; 91 | id paymentMethod = [PMFactory genCardPaymentWithAccHolder:@"Max Musterman" cardNumber:@"4711100000000000" expiryMonth:@"12" expiryYear:@"2014" 92 | verification:@"333" error:&error]; 93 | 94 | if(!error) { 95 | params = [PMFactory genPaymentParamsWithCurrency:@"EUR" amount:100 description:@"Description" error:&error]; 96 | } 97 | 98 | if(!error) { 99 | [PMManager transactionWithMethod:paymentMethod parameters:params consumable:TRUE success:^(PMTransaction *transaction) { 100 | // transaction successfully created 101 | } 102 | failure:^(NSError *error) { 103 | // transaction creation failed 104 | }]; 105 | } 106 | 107 | ``` 108 | 109 | 110 | ## Release notes 111 | 112 | ###2.2.0 113 | + iOS10.3 supoort added 114 | 115 | ###2.1.1 116 | * Bug fixes 117 | 118 | ###2.1.0 119 | + Added new methods to create transactions and preauthorizations with a payment object. 120 | + Added a Safe Store to securely save payment objects with a user password. 121 | 122 | ###2.0.3 123 | * Bug fixes 124 | 125 | ###2.0.2 126 | * Mandatory changes in infrastructure 127 | * Bug fixes 128 | 129 | ###2.0.1 130 | + MacOS Support 131 | * Bug fixes 132 | 133 | ### 2.0.0 134 | + Added new method to generate Payments using IBAN and BIC in the [PMFactory](http://paymill.github.io/paymill-ios/docs/sdk/Classes/PMFactory.html). 135 | + Added new methods to generate token without amount and currency in the 136 | [PMFactory](http://paymill.github.io/paymill-ios/docs/sdk/Classes/PMManager.html). 137 | * All failure callbacks are now returning NSError instead PMError. Check PMError.h to see returned error codes. 138 | * Improved error handling. BRIDGE error type added in PMError. You can use this to give the user concrete information, why his card is rejected. 139 | * ARM 64 support 140 | 141 | ### 1.0.3 142 | 143 | * PMErrorType documented 144 | * Bug fixes 145 | 146 | ### 1.0.2 147 | 148 | * Bridge error response fixed 149 | * Credit card holder issue fixed 150 | * Appledoc improved 151 | 152 | 153 | ### 1.0.1 154 | * Typos in headers and appledoc fixed 155 | * Linkage issue fixed 156 | 157 | ### 1.0 158 | + First live release. 159 | + Added the possiblity to generate tokens without initializing the SDK. The method can be used exactly like the JS-Bridge and does not require extra activation for mobile. 160 | + Added getVersion for the SDK. 161 | * Bug fixes 162 | -------------------------------------------------------------------------------- /macos/PayMillSDK.framework/Headers: -------------------------------------------------------------------------------- 1 | Versions/Current/Headers -------------------------------------------------------------------------------- /macos/PayMillSDK.framework/PayMillSDK: -------------------------------------------------------------------------------- 1 | Versions/Current/PayMillSDK -------------------------------------------------------------------------------- /macos/PayMillSDK.framework/Versions/A/Headers/PMClient.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMClient.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 3/20/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | /** 9 | This object represents Client PayMill API Object. 10 | */ 11 | @interface PMClient : NSObject 12 | /** 13 | id 14 | */ 15 | @property(nonatomic, strong) NSString *id; 16 | /** 17 | email 18 | */ 19 | @property(nonatomic, strong) NSString *email; 20 | /** 21 | description 22 | */ 23 | @property(nonatomic, strong) NSString *description; 24 | /** 25 | created_at 26 | */ 27 | @property(nonatomic, strong) NSString *created_at; 28 | /** 29 | updated_at 30 | */ 31 | @property(nonatomic, strong) NSString *updated_at; 32 | /** 33 | payments 34 | */ 35 | @property(nonatomic, strong) NSArray *payments; 36 | /** 37 | subscription 38 | */ 39 | @property(nonatomic, strong) NSString *subsctription; 40 | @end 41 | -------------------------------------------------------------------------------- /macos/PayMillSDK.framework/Versions/A/Headers/PMError.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMError.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 2/20/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | #import 9 | 10 | /** 11 | NSError object is returned in every unsuccessful asynchronous callback by the SDK. There are several types of this error. 12 | A detail message may also exist. 13 | All enums and constants below are related to how-to use the NSError message returned from the PAYMILL SDK. 14 | */ 15 | 16 | 17 | /** 18 | PAYMILL error domain 19 | */ 20 | FOUNDATION_EXPORT NSString * const PMErrorDomain; 21 | 22 | /** 23 | Error type 24 | */ 25 | 26 | typedef enum PMErrorType : NSInteger 27 | { 28 | UNKNOWN = 0, /*Initial value*/ 29 | WRONG_PARMETERS = 1, /*You have supplied wrong parameters. You use message for details.*/ 30 | HTTP_CONNECTION = 2, /*There was an error while connecting to the PayMill Service.*/ 31 | API = 3, /*The PAYMILL API returned an unexpected result.*/ 32 | SAFESTORE = 4, /*The PAYMILL safe store returned an error. Check the PMSafeStoreErrorCodeKey in the user info dictionary for the specific error. */ 33 | BRIDGE = 5, /*The PAYMILL JS-Bridge returned an a payment method related error code. Check the PMBridgeErrorCodeKey in the user info dictionary for the specific error. */ 34 | NOT_INIT = 6, /*You did not initialize the SDK.*/ 35 | INTERNAL = 7, /*This should never happen. If you encounter it, please send email support@paymill.com .*/ 36 | }PMErrorType; 37 | 38 | 39 | /* 40 | PAYMILL API developers message 41 | */ 42 | FOUNDATION_EXPORT NSString * const PMErrorMessageKey; 43 | 44 | /* 45 | PAYMILL SAFESTORE will have an PMSafeStoreErrorCodeKey in the userInfo dictionary. This gives more information about the error type and could be handled to create user messages. 46 | */ 47 | FOUNDATION_EXPORT NSString * const PMSafeStoreErrorCodeKey; 48 | /* 49 | PAYMILL BRIDGE will have an PMBridgeErrorCodeKey in the userInfo dictionary. This gives more information about the error type and could be handled to create user messages. 50 | */ 51 | FOUNDATION_EXPORT NSString * const PMBridgeErrorCodeKey; 52 | 53 | /* 54 | These are possible values for the PMBridgeErrorCodeKey in the userInfo dictionary 55 | of an NSError returned by this library. These error keys might be returned after an unsuccessfull try to generate a token from the PAYMILL BRIDGE */ 56 | 57 | /** 58 | For credit cards: invalid card number. For direct debit: invalid account number. 59 | */ 60 | FOUNDATION_EXPORT NSString * const PMInvalidNumber; 61 | /** 62 | For credit cards: invalid cardholder. For direct debit: invalid account holder 63 | */ 64 | FOUNDATION_EXPORT NSString * const PMInvalidHolder; 65 | 66 | /** 67 | These values will be returned for invalid credit card relevant fields 68 | */ 69 | FOUNDATION_EXPORT NSString * const PMCCInvalidCVC; 70 | FOUNDATION_EXPORT NSString * const PMCCInvalidExp; 71 | FOUNDATION_EXPORT NSString * const PMCCInvalidExpYear; 72 | FOUNDATION_EXPORT NSString * const PMCCInvalidExpMonth; 73 | FOUNDATION_EXPORT NSString * const PMUnknownError; 74 | 75 | 76 | /* 77 | These are possible values for the PMSafeStoreErrorCodeKey in the userInfo dictionary 78 | of an NSError returned by this library. These error keys might be returned when user entered his password incorrectly */ 79 | FOUNDATION_EXPORT NSString * const PMSafeStoreIncorrectPassword; 80 | FOUNDATION_EXPORT NSString * const PMSafeStoreBlocked; 81 | -------------------------------------------------------------------------------- /macos/PayMillSDK.framework/Versions/A/Headers/PMFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMFactory.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 3/1/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | #import 9 | #import "PMPaymentMethod.h" 10 | #import "PMPaymentParams.h" 11 | #import "PMError.h" 12 | /** 13 | Use only this factory class to create a PMPaymentMethod and PMPaymentParams. 14 | */ 15 | @interface PMFactory : NSObject 16 | /** 17 | Generates a PaymentMethod from credit card details. 18 | @param accHolder credit card account holder 19 | @param cardNumber credit card number 20 | @param expiryMonth credit card expiry month 21 | @param expiryYear credit card expiry year 22 | @param verification credit card verification number 23 | @param error NSError object 24 | @return PMPaymentMethod successfully created object 25 | */ 26 | + (id)genCardPaymentWithAccHolder:(NSString*)accHolder cardNumber:(NSString*)cardNumber expiryMonth:(NSString*) expiryMonth expiryYear:(NSString*)expiryYear verification:(NSString*)verification error:(NSError **)error; 27 | /** 28 | Generates a PaymentMethod from direct debit payment details. 29 | @param accountNumber account number 30 | @param accountBank bank code 31 | @param accountHolder first and second name of the account holder 32 | @param accountCountry ISO 3166-2 formatted country code 33 | @param error NSError object 34 | @return PMPaymentMethod successfully created object 35 | */ 36 | + (id)genNationalPaymentWithAccNumber:(NSString *)accountNumber accBank:(NSString *)accountBank accHolder:(NSString *)accountHolder accCountry:(NSString *)accountCountry error:(NSError **)error; 37 | /** 38 | Use this method to generate the PaymentParams object, needed for creating transactions, preauthorizations and tokens. 39 | @param currency Three character ISO 4217 formatted currency code. 40 | @param amount amount (in cents) which will be charged 41 | @param description a short description for the transaction (e.g. shopping cart ID) or empty string or null. 42 | Note: You don't need to supply a description parameter when generating a token 43 | @param error NSError object 44 | @return PMPaymentParams successfully created object 45 | */ 46 | + (PMPaymentParams*)genPaymentParamsWithCurrency:(NSString*)currency amount:(int)amount description:(NSString*)description error:(NSError **)error; 47 | /** 48 | Generates a PaymentMethod from direct debit payment details. 49 | @param accountIban account IBAN number, as defined in ISO 13616 50 | @param accountBic account BIC number, as defined in ISO 9362 51 | @param accountHolder first and second name of the account holder 52 | @param error NSError object 53 | @return PMPaymentMethod successfully created object 54 | */ 55 | + (id)genNationalPaymentWithIban:(NSString *)accountIban andBic:(NSString *)accountBic accHolder:(NSString *)accountHolder error:(NSError **)error; 56 | @end 57 | -------------------------------------------------------------------------------- /macos/PayMillSDK.framework/Versions/A/Headers/PMPayment.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMPayment.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 2/8/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | /** 9 | This object represents Payment PayMill API Object. 10 | */ 11 | @interface PMPayment : NSObject 12 | /** 13 | id 14 | */ 15 | @property(nonatomic, strong) NSString *id; 16 | /** 17 | type 18 | */ 19 | @property(nonatomic, strong) NSString *type; 20 | /** 21 | client 22 | */ 23 | @property(nonatomic, strong) NSString *client; 24 | /** 25 | card_type 26 | */ 27 | @property(nonatomic, strong) NSString *card_type; 28 | /** 29 | country 30 | */ 31 | @property(nonatomic, strong) NSString *country; 32 | /** 33 | expire_month 34 | */ 35 | @property(nonatomic, strong) NSString *expire_month; 36 | /** 37 | expire_year 38 | */ 39 | @property(nonatomic, strong) NSString *expire_year; 40 | /** 41 | card_holder 42 | */ 43 | @property(nonatomic, strong) NSString *card_holder; 44 | /** 45 | last4 46 | */ 47 | @property(nonatomic, strong) NSString *last4; 48 | /** 49 | created_at 50 | */ 51 | @property(nonatomic, strong) NSString *created_at; 52 | /** 53 | updated_at 54 | */ 55 | @property(nonatomic, strong) NSString *updated_at; 56 | /** 57 | code 58 | */ 59 | @property(nonatomic, strong) NSString *code; 60 | /** 61 | holder 62 | */ 63 | @property(nonatomic, strong) NSString *holder; 64 | /** 65 | account 66 | */ 67 | @property(nonatomic, strong) NSString *account; 68 | /** 69 | bic 70 | */ 71 | @property(nonatomic, strong) NSString *bic; 72 | /** 73 | iban 74 | */ 75 | @property(nonatomic, strong) NSString *iban; 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /macos/PayMillSDK.framework/Versions/A/Headers/PMPaymentMethod.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMPaymentMethod.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 1/25/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | /** 9 | Object representing the payment method needed to create new Transactions and Preauthorizations. Never extend this interface yourself, instead use the static methods in PMFactory . 10 | */ 11 | 12 | #import 13 | 14 | @protocol PMPaymentMethod 15 | - (NSString *) toUrlParams; 16 | - (NSDictionary*)newDictionaryParams; 17 | @end 18 | -------------------------------------------------------------------------------- /macos/PayMillSDK.framework/Versions/A/Headers/PMPaymentParams.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMPaymentParams.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 3/1/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | /** 9 | Object representing the parameters needed to create new Transactions and Preauthorizations. Never extend this interface yourself, instead use the static methods in PMFactory. 10 | */ 11 | #import 12 | #import "PMError.h" 13 | 14 | @interface PMPaymentParams : NSObject 15 | /** 16 | Three character ISO 4217 formatted currency code. 17 | */ 18 | @property(nonatomic, strong) NSString *currency; 19 | /** 20 | amount (in cents) which will be charged 21 | */ 22 | @property(nonatomic) int amount; 23 | /** 24 | a short description for the transaction (e.g. shopping cart ID) or empty string or null. 25 | */ 26 | @property(nonatomic, strong) NSString *description; 27 | /** 28 | Use this method to generate the PaymentParams object, needed for creating transactions, preauthorizations and tokens. 29 | @param currency Three character ISO 4217 formatted currency code. 30 | @param amount amount (in cents) which will be charged 31 | @param description a short description for the transaction (e.g. shopping cart ID) or empty string or null. 32 | Note: You don't need to supply a description parameter when generating a token 33 | @param error PMError object 34 | @return PMPaymentParams successfully created object 35 | */ 36 | + (PMPaymentParams*)paymentParamsWithCurrency:(NSString*)currency amount:(int)amount description:(NSString*)description error:(NSError **)error; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /macos/PayMillSDK.framework/Versions/A/Headers/PMPreauthorization.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMPreauthorization.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 3/20/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | #import "PMPayment.h" 9 | #import "PMClient.h" 10 | /** 11 | This object represents Preauthorization PayMill API Object. 12 | */ 13 | @interface PMPreauthorization : NSObject 14 | /** 15 | id 16 | */ 17 | @property(nonatomic, strong) NSString *id; 18 | /** 19 | amount 20 | */ 21 | @property(nonatomic, strong) NSString *amount; 22 | /** 23 | currency 24 | */ 25 | @property(nonatomic, strong) NSString *currency; 26 | /** 27 | status 28 | */ 29 | @property(nonatomic, strong) NSString *status; 30 | /** 31 | livemode 32 | */ 33 | @property(nonatomic) bool livemode; 34 | /** 35 | created_at 36 | */ 37 | @property(nonatomic, strong) NSString *created_at; 38 | /** 39 | updated_at 40 | */ 41 | @property(nonatomic, strong) NSString *updated_at; 42 | /** 43 | PMPayment payment 44 | */ 45 | @property(nonatomic, strong) PMPayment *payment; 46 | /** 47 | PMClient client 48 | */ 49 | @property(nonatomic, strong) PMClient *client; 50 | @end 51 | -------------------------------------------------------------------------------- /macos/PayMillSDK.framework/Versions/A/Headers/PMRefund.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMRefund.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 3/20/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | /** 9 | This object represents Refund PayMill API Object. 10 | */ 11 | @interface PMRefund : NSObject 12 | /** 13 | id 14 | */ 15 | @property(nonatomic, strong) NSString *id; 16 | /** 17 | amount 18 | */ 19 | @property(nonatomic, strong) NSString *amount; 20 | /** 21 | status 22 | */ 23 | @property(nonatomic, strong) NSString *status; 24 | /** 25 | description 26 | */ 27 | @property(nonatomic, strong) NSString *description; 28 | /** 29 | livemode 30 | */ 31 | @property(nonatomic) bool livemode; 32 | /** 33 | created_at 34 | */ 35 | @property(nonatomic) int created_at; 36 | /** 37 | updated_at 38 | */ 39 | @property(nonatomic) int updated_at; 40 | /** 41 | response_code 42 | */ 43 | @property(nonatomic) int response_code; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /macos/PayMillSDK.framework/Versions/A/Headers/PMSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMSDK.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 4/3/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | 9 | #ifndef PayMillSDK_PMSDK_h 10 | #define PayMillSDK_PMSDK_h 11 | 12 | #import "PMManager.h" 13 | #import "PMFactory.h" 14 | #import "PMPaymentMethod.h" 15 | #import "PMPaymentParams.h" 16 | #import "PMError.h" 17 | #import "PMTransaction.h" 18 | #import "PMPayment.h" 19 | #import "PMPreauthorization.h" 20 | #import "PMClient.h" 21 | #import "PMRefund.h" 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /macos/PayMillSDK.framework/Versions/A/Headers/PMTransaction.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMTransaction.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 2/5/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | #import "PMPreauthorization.h" 9 | /** 10 | This object represents Transaction PayMill API Object. 11 | */ 12 | @interface PMTransaction : NSObject 13 | /** 14 | id 15 | */ 16 | @property(nonatomic, strong) NSString *id; 17 | /** 18 | amount 19 | */ 20 | @property(nonatomic, strong) NSString *amount; 21 | /** 22 | origin_amount 23 | */ 24 | @property(nonatomic) int origin_amount; 25 | /** 26 | currency 27 | */ 28 | @property(nonatomic, strong) NSString *currency; 29 | /** 30 | status 31 | */ 32 | @property(nonatomic, strong) NSString *status; 33 | /** 34 | description 35 | */ 36 | @property(nonatomic, strong) NSString *description; 37 | /** 38 | livemode 39 | */ 40 | @property(nonatomic) bool livemode; 41 | /** 42 | refunds 43 | */ 44 | @property(nonatomic, strong) NSArray *refunds; 45 | /** 46 | created_at 47 | */ 48 | @property(nonatomic) int created_at; 49 | /** 50 | updated_at 51 | */ 52 | @property(nonatomic) int updated_at; 53 | /** 54 | response_code 55 | */ 56 | @property(nonatomic) int response_code; 57 | /** 58 | invoices 59 | */ 60 | @property(nonatomic, strong) NSArray *invoices; 61 | /** 62 | PMPayment payment 63 | */ 64 | @property(nonatomic, strong) PMPayment *payment; 65 | /** 66 | PMClient client 67 | */ 68 | @property(nonatomic, strong) PMClient *client; 69 | /** 70 | PMPreauthorization preauthorization 71 | */ 72 | @property(nonatomic, strong) PMPreauthorization *preauthorization; 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /macos/PayMillSDK.framework/Versions/A/PayMillSDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/macos/PayMillSDK.framework/Versions/A/PayMillSDK -------------------------------------------------------------------------------- /macos/PayMillSDK.framework/Versions/Current: -------------------------------------------------------------------------------- 1 | A -------------------------------------------------------------------------------- /macos/library_versions/PayMillSDK_arm64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/macos/library_versions/PayMillSDK_arm64 -------------------------------------------------------------------------------- /macos/library_versions/PayMillSDK_armv7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/macos/library_versions/PayMillSDK_armv7 -------------------------------------------------------------------------------- /macos/library_versions/PayMillSDK_i386: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/macos/library_versions/PayMillSDK_i386 -------------------------------------------------------------------------------- /macos/library_versions/PayMillSDK_x86_64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/macos/library_versions/PayMillSDK_x86_64 -------------------------------------------------------------------------------- /samples/vouchermill/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | # Exclude the build directory 3 | build/* 4 | 5 | # Exclude temp nibs and swap files 6 | *~.nib 7 | *.swp 8 | 9 | # Exclude OS X folder attributes 10 | .DS_Store 11 | 12 | # Exclude user-specific XCode 3 and 4 files 13 | *.mode1 14 | *.mode1v3 15 | *.mode2v3 16 | *.perspective 17 | *.perspectivev3 18 | *.pbxuser 19 | xcuserdata 20 | */UserInterfaceState.xcuserstate 21 | *.xcuserdatad -------------------------------------------------------------------------------- /samples/vouchermill/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/Default-568h@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/Default.png -------------------------------------------------------------------------------- /samples/vouchermill/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/Default@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/Icon.png -------------------------------------------------------------------------------- /samples/vouchermill/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/Icon@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/PayMillSDK/PayMillSDK.framework/Headers: -------------------------------------------------------------------------------- 1 | Versions/Current/Headers -------------------------------------------------------------------------------- /samples/vouchermill/PayMillSDK/PayMillSDK.framework/PayMillSDK: -------------------------------------------------------------------------------- 1 | Versions/Current/PayMillSDK -------------------------------------------------------------------------------- /samples/vouchermill/PayMillSDK/PayMillSDK.framework/Versions/A/Headers/PMClient.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMClient.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 3/20/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | /** 9 | This object represents Client PayMill API Object. 10 | */ 11 | @interface PMClient : NSObject 12 | /** 13 | id 14 | */ 15 | @property(nonatomic, strong) NSString *id; 16 | /** 17 | email 18 | */ 19 | @property(nonatomic, strong) NSString *email; 20 | /** 21 | description 22 | */ 23 | @property(nonatomic, strong) NSString *description; 24 | /** 25 | created_at 26 | */ 27 | @property(nonatomic, strong) NSString *created_at; 28 | /** 29 | updated_at 30 | */ 31 | @property(nonatomic, strong) NSString *updated_at; 32 | /** 33 | payments 34 | */ 35 | @property(nonatomic, strong) NSArray *payments; 36 | /** 37 | subscription 38 | */ 39 | @property(nonatomic, strong) NSString *subsctription; 40 | @end 41 | -------------------------------------------------------------------------------- /samples/vouchermill/PayMillSDK/PayMillSDK.framework/Versions/A/Headers/PMError.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMError.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 2/20/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | #import 9 | 10 | /** 11 | NSError object is returned in every unsuccessful asynchronous callback by the SDK. There are several types of this error. 12 | A detail message may also exist. 13 | All enums and constants below are related to how-to use the NSError message returned from the PAYMILL SDK. 14 | */ 15 | 16 | 17 | /** 18 | PAYMILL error domain 19 | */ 20 | FOUNDATION_EXPORT NSString * const PMErrorDomain; 21 | 22 | /** 23 | Error type 24 | */ 25 | 26 | typedef enum PMErrorType : NSInteger 27 | { 28 | UNKNOWN = 0, /*Initial value*/ 29 | WRONG_PARMETERS = 1, /*You have supplied wrong parameters. You use message for details.*/ 30 | HTTP_CONNECTION = 2, /*There was an error while connecting to the PayMill Service.*/ 31 | API = 3, /*The PAYMILL API returned an unexpected result.*/ 32 | SAFESTORE = 4, /*The PAYMILL safe store returned an error. Check the PMSafeStoreErrorCodeKey in the user info dictionary for the specific error. */ 33 | BRIDGE = 5, /*The PAYMILL JS-Bridge returned an a payment method related error code. Check the PMBridgeErrorCodeKey in the user info dictionary for the specific error. */ 34 | NOT_INIT = 6, /*You did not initialize the SDK.*/ 35 | INTERNAL = 7, /*This should never happen. If you encounter it, please send email support@paymill.com .*/ 36 | }PMErrorType; 37 | 38 | 39 | /* 40 | PAYMILL API developers message 41 | */ 42 | FOUNDATION_EXPORT NSString * const PMErrorMessageKey; 43 | 44 | /* 45 | PAYMILL SAFESTORE will have an PMSafeStoreErrorCodeKey in the userInfo dictionary. This gives more information about the error type and could be handled to create user messages. 46 | */ 47 | FOUNDATION_EXPORT NSString * const PMSafeStoreErrorCodeKey; 48 | /* 49 | PAYMILL BRIDGE will have an PMBridgeErrorCodeKey in the userInfo dictionary. This gives more information about the error type and could be handled to create user messages. 50 | */ 51 | FOUNDATION_EXPORT NSString * const PMBridgeErrorCodeKey; 52 | 53 | /* 54 | These are possible values for the PMBridgeErrorCodeKey in the userInfo dictionary 55 | of an NSError returned by this library. These error keys might be returned after an unsuccessfull try to generate a token from the PAYMILL BRIDGE */ 56 | 57 | /** 58 | For credit cards: invalid card number. For direct debit: invalid account number. 59 | */ 60 | FOUNDATION_EXPORT NSString * const PMInvalidNumber; 61 | /** 62 | For credit cards: invalid cardholder. For direct debit: invalid account holder 63 | */ 64 | FOUNDATION_EXPORT NSString * const PMInvalidHolder; 65 | 66 | /** 67 | These values will be returned for invalid credit card relevant fields 68 | */ 69 | FOUNDATION_EXPORT NSString * const PMCCInvalidCVC; 70 | FOUNDATION_EXPORT NSString * const PMCCInvalidExp; 71 | FOUNDATION_EXPORT NSString * const PMCCInvalidExpYear; 72 | FOUNDATION_EXPORT NSString * const PMCCInvalidExpMonth; 73 | FOUNDATION_EXPORT NSString * const PMUnknownError; 74 | 75 | 76 | /* 77 | These are possible values for the PMSafeStoreErrorCodeKey in the userInfo dictionary 78 | of an NSError returned by this library. These error keys might be returned when user entered his password incorrectly */ 79 | FOUNDATION_EXPORT NSString * const PMSafeStoreIncorrectPassword; 80 | FOUNDATION_EXPORT NSString * const PMSafeStoreBlocked; 81 | -------------------------------------------------------------------------------- /samples/vouchermill/PayMillSDK/PayMillSDK.framework/Versions/A/Headers/PMFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMFactory.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 3/1/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | #import 9 | #import "PMPaymentMethod.h" 10 | #import "PMPaymentParams.h" 11 | #import "PMError.h" 12 | /** 13 | Use only this factory class to create a PMPaymentMethod and PMPaymentParams. 14 | */ 15 | @interface PMFactory : NSObject 16 | /** 17 | Generates a PaymentMethod from credit card details. 18 | @param accHolder credit card account holder 19 | @param cardNumber credit card number 20 | @param expiryMonth credit card expiry month 21 | @param expiryYear credit card expiry year 22 | @param verification credit card verification number 23 | @param error NSError object 24 | @return PMPaymentMethod successfully created object 25 | */ 26 | + (id)genCardPaymentWithAccHolder:(NSString*)accHolder cardNumber:(NSString*)cardNumber expiryMonth:(NSString*) expiryMonth expiryYear:(NSString*)expiryYear verification:(NSString*)verification error:(NSError **)error; 27 | /** 28 | Generates a PaymentMethod from direct debit payment details. 29 | @param accountNumber account number 30 | @param accountBank bank code 31 | @param accountHolder first and second name of the account holder 32 | @param accountCountry ISO 3166-2 formatted country code 33 | @param error NSError object 34 | @return PMPaymentMethod successfully created object 35 | */ 36 | + (id)genNationalPaymentWithAccNumber:(NSString *)accountNumber accBank:(NSString *)accountBank accHolder:(NSString *)accountHolder accCountry:(NSString *)accountCountry error:(NSError **)error; 37 | /** 38 | Use this method to generate the PaymentParams object, needed for creating transactions, preauthorizations and tokens. 39 | @param currency Three character ISO 4217 formatted currency code. 40 | @param amount amount (in cents) which will be charged 41 | @param description a short description for the transaction (e.g. shopping cart ID) or empty string or null. 42 | Note: You don't need to supply a description parameter when generating a token 43 | @param error NSError object 44 | @return PMPaymentParams successfully created object 45 | */ 46 | + (PMPaymentParams*)genPaymentParamsWithCurrency:(NSString*)currency amount:(int)amount description:(NSString*)description error:(NSError **)error; 47 | /** 48 | Generates a PaymentMethod from direct debit payment details. 49 | @param accountIban account IBAN number, as defined in ISO 13616 50 | @param accountBic account BIC number, as defined in ISO 9362 51 | @param accountHolder first and second name of the account holder 52 | @param error NSError object 53 | @return PMPaymentMethod successfully created object 54 | */ 55 | + (id)genNationalPaymentWithIban:(NSString *)accountIban andBic:(NSString *)accountBic accHolder:(NSString *)accountHolder error:(NSError **)error; 56 | @end 57 | -------------------------------------------------------------------------------- /samples/vouchermill/PayMillSDK/PayMillSDK.framework/Versions/A/Headers/PMPayment.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMPayment.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 2/8/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | /** 9 | This object represents Payment PayMill API Object. 10 | */ 11 | @interface PMPayment : NSObject 12 | /** 13 | id 14 | */ 15 | @property(nonatomic, strong) NSString *id; 16 | /** 17 | type 18 | */ 19 | @property(nonatomic, strong) NSString *type; 20 | /** 21 | client 22 | */ 23 | @property(nonatomic, strong) NSString *client; 24 | /** 25 | card_type 26 | */ 27 | @property(nonatomic, strong) NSString *card_type; 28 | /** 29 | country 30 | */ 31 | @property(nonatomic, strong) NSString *country; 32 | /** 33 | expire_month 34 | */ 35 | @property(nonatomic, strong) NSString *expire_month; 36 | /** 37 | expire_year 38 | */ 39 | @property(nonatomic, strong) NSString *expire_year; 40 | /** 41 | card_holder 42 | */ 43 | @property(nonatomic, strong) NSString *card_holder; 44 | /** 45 | last4 46 | */ 47 | @property(nonatomic, strong) NSString *last4; 48 | /** 49 | created_at 50 | */ 51 | @property(nonatomic, strong) NSString *created_at; 52 | /** 53 | updated_at 54 | */ 55 | @property(nonatomic, strong) NSString *updated_at; 56 | /** 57 | code 58 | */ 59 | @property(nonatomic, strong) NSString *code; 60 | /** 61 | holder 62 | */ 63 | @property(nonatomic, strong) NSString *holder; 64 | /** 65 | account 66 | */ 67 | @property(nonatomic, strong) NSString *account; 68 | /** 69 | bic 70 | */ 71 | @property(nonatomic, strong) NSString *bic; 72 | /** 73 | iban 74 | */ 75 | @property(nonatomic, strong) NSString *iban; 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /samples/vouchermill/PayMillSDK/PayMillSDK.framework/Versions/A/Headers/PMPaymentMethod.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMPaymentMethod.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 1/25/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | /** 9 | Object representing the payment method needed to create new Transactions and Preauthorizations. Never extend this interface yourself, instead use the static methods in PMFactory . 10 | */ 11 | 12 | #import 13 | 14 | @protocol PMPaymentMethod 15 | - (NSString *) toUrlParams; 16 | - (NSDictionary*)newDictionaryParams; 17 | @end 18 | -------------------------------------------------------------------------------- /samples/vouchermill/PayMillSDK/PayMillSDK.framework/Versions/A/Headers/PMPaymentParams.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMPaymentParams.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 3/1/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | /** 9 | Object representing the parameters needed to create new Transactions and Preauthorizations. Never extend this interface yourself, instead use the static methods in PMFactory. 10 | */ 11 | #import 12 | #import "PMError.h" 13 | 14 | @interface PMPaymentParams : NSObject 15 | /** 16 | Three character ISO 4217 formatted currency code. 17 | */ 18 | @property(nonatomic, strong) NSString *currency; 19 | /** 20 | amount (in cents) which will be charged 21 | */ 22 | @property(nonatomic) int amount; 23 | /** 24 | a short description for the transaction (e.g. shopping cart ID) or empty string or null. 25 | */ 26 | @property(nonatomic, strong) NSString *description; 27 | /** 28 | Use this method to generate the PaymentParams object, needed for creating transactions, preauthorizations and tokens. 29 | @param currency Three character ISO 4217 formatted currency code. 30 | @param amount amount (in cents) which will be charged 31 | @param description a short description for the transaction (e.g. shopping cart ID) or empty string or null. 32 | Note: You don't need to supply a description parameter when generating a token 33 | @param error PMError object 34 | @return PMPaymentParams successfully created object 35 | */ 36 | + (PMPaymentParams*)paymentParamsWithCurrency:(NSString*)currency amount:(int)amount description:(NSString*)description error:(NSError **)error; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /samples/vouchermill/PayMillSDK/PayMillSDK.framework/Versions/A/Headers/PMPreauthorization.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMPreauthorization.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 3/20/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | #import "PMPayment.h" 9 | #import "PMClient.h" 10 | /** 11 | This object represents Preauthorization PayMill API Object. 12 | */ 13 | @interface PMPreauthorization : NSObject 14 | /** 15 | id 16 | */ 17 | @property(nonatomic, strong) NSString *id; 18 | /** 19 | amount 20 | */ 21 | @property(nonatomic, strong) NSString *amount; 22 | /** 23 | currency 24 | */ 25 | @property(nonatomic, strong) NSString *currency; 26 | /** 27 | status 28 | */ 29 | @property(nonatomic, strong) NSString *status; 30 | /** 31 | livemode 32 | */ 33 | @property(nonatomic) bool livemode; 34 | /** 35 | created_at 36 | */ 37 | @property(nonatomic, strong) NSString *created_at; 38 | /** 39 | updated_at 40 | */ 41 | @property(nonatomic, strong) NSString *updated_at; 42 | /** 43 | PMPayment payment 44 | */ 45 | @property(nonatomic, strong) PMPayment *payment; 46 | /** 47 | PMClient client 48 | */ 49 | @property(nonatomic, strong) PMClient *client; 50 | @end 51 | -------------------------------------------------------------------------------- /samples/vouchermill/PayMillSDK/PayMillSDK.framework/Versions/A/Headers/PMRefund.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMRefund.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 3/20/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | /** 9 | This object represents Refund PayMill API Object. 10 | */ 11 | @interface PMRefund : NSObject 12 | /** 13 | id 14 | */ 15 | @property(nonatomic, strong) NSString *id; 16 | /** 17 | amount 18 | */ 19 | @property(nonatomic, strong) NSString *amount; 20 | /** 21 | status 22 | */ 23 | @property(nonatomic, strong) NSString *status; 24 | /** 25 | description 26 | */ 27 | @property(nonatomic, strong) NSString *description; 28 | /** 29 | livemode 30 | */ 31 | @property(nonatomic) bool livemode; 32 | /** 33 | created_at 34 | */ 35 | @property(nonatomic) int created_at; 36 | /** 37 | updated_at 38 | */ 39 | @property(nonatomic) int updated_at; 40 | /** 41 | response_code 42 | */ 43 | @property(nonatomic) int response_code; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /samples/vouchermill/PayMillSDK/PayMillSDK.framework/Versions/A/Headers/PMSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMSDK.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 4/3/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | 9 | #ifndef PayMillSDK_PMSDK_h 10 | #define PayMillSDK_PMSDK_h 11 | 12 | #import "PMManager.h" 13 | #import "PMFactory.h" 14 | #import "PMPaymentMethod.h" 15 | #import "PMPaymentParams.h" 16 | #import "PMError.h" 17 | #import "PMTransaction.h" 18 | #import "PMPayment.h" 19 | #import "PMPreauthorization.h" 20 | #import "PMClient.h" 21 | #import "PMRefund.h" 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /samples/vouchermill/PayMillSDK/PayMillSDK.framework/Versions/A/Headers/PMTransaction.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMTransaction.h 3 | // PayMillSDK 4 | // 5 | // Created by PayMill on 2/5/13. 6 | // Copyright (c) 2013 PayMill. All rights reserved. 7 | // 8 | #import "PMPreauthorization.h" 9 | /** 10 | This object represents Transaction PayMill API Object. 11 | */ 12 | @interface PMTransaction : NSObject 13 | /** 14 | id 15 | */ 16 | @property(nonatomic, strong) NSString *id; 17 | /** 18 | amount 19 | */ 20 | @property(nonatomic, strong) NSString *amount; 21 | /** 22 | origin_amount 23 | */ 24 | @property(nonatomic) int origin_amount; 25 | /** 26 | currency 27 | */ 28 | @property(nonatomic, strong) NSString *currency; 29 | /** 30 | status 31 | */ 32 | @property(nonatomic, strong) NSString *status; 33 | /** 34 | description 35 | */ 36 | @property(nonatomic, strong) NSString *description; 37 | /** 38 | livemode 39 | */ 40 | @property(nonatomic) bool livemode; 41 | /** 42 | refunds 43 | */ 44 | @property(nonatomic, strong) NSArray *refunds; 45 | /** 46 | created_at 47 | */ 48 | @property(nonatomic) int created_at; 49 | /** 50 | updated_at 51 | */ 52 | @property(nonatomic) int updated_at; 53 | /** 54 | response_code 55 | */ 56 | @property(nonatomic) int response_code; 57 | /** 58 | invoices 59 | */ 60 | @property(nonatomic, strong) NSArray *invoices; 61 | /** 62 | PMPayment payment 63 | */ 64 | @property(nonatomic, strong) PMPayment *payment; 65 | /** 66 | PMClient client 67 | */ 68 | @property(nonatomic, strong) PMClient *client; 69 | /** 70 | PMPreauthorization preauthorization 71 | */ 72 | @property(nonatomic, strong) PMPreauthorization *preauthorization; 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /samples/vouchermill/PayMillSDK/PayMillSDK.framework/Versions/A/PayMillSDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PayMillSDK/PayMillSDK.framework/Versions/A/PayMillSDK -------------------------------------------------------------------------------- /samples/vouchermill/PayMillSDK/PayMillSDK.framework/Versions/Current: -------------------------------------------------------------------------------- 1 | A -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/CardsData.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Cards 6 | 7 | 8 | pattern 9 | 0 10 | numLength 11 | 12 | 15 13 | 14 | luhn 15 | 16 | cardName 17 | American Express 18 | cvcMinLength 19 | 3 20 | cvcMaxLength 21 | 4 22 | imageName 23 | americanExpress 24 | 25 | 26 | pattern 27 | 1 28 | luhn 29 | 30 | numLength 31 | 32 | 16 33 | 34 | cardName 35 | Discover 36 | cvcMinLength 37 | 3 38 | cvcMaxLength 39 | 3 40 | imageName 41 | discover 42 | 43 | 44 | pattern 45 | 2 46 | luhn 47 | 48 | numLength 49 | 50 | 16 51 | 17 52 | 18 53 | 19 54 | 55 | cardName 56 | Union Pay 57 | cvcMinLength 58 | 3 59 | cvcMaxLength 60 | 3 61 | imageName 62 | unionPay 63 | 64 | 65 | pattern 66 | 3 67 | numLength 68 | 69 | 14 70 | 71 | luhn 72 | 73 | cardName 74 | Diners Club 75 | cvcMinLength 76 | 3 77 | cvcMaxLength 78 | 3 79 | imageName 80 | dinersClub 81 | 82 | 83 | pattern 84 | 4 85 | numLength 86 | 87 | 16 88 | 89 | luhn 90 | 91 | cardName 92 | Instant Payments 93 | cvcMinLength 94 | 3 95 | cvcMaxLength 96 | 3 97 | imageName 98 | instantPayments 99 | 100 | 101 | pattern 102 | 5 103 | numLength 104 | 105 | 16 106 | 107 | luhn 108 | 109 | cardName 110 | JCB 111 | cvcMinLength 112 | 3 113 | cvcMaxLength 114 | 3 115 | imageName 116 | jcb 117 | 118 | 119 | pattern 120 | 6 121 | luhn 122 | 123 | numLength 124 | 125 | 16 126 | 17 127 | 18 128 | 19 129 | 130 | cardName 131 | Laser 132 | cvcMinLength 133 | 3 134 | cvcMaxLength 135 | 3 136 | imageName 137 | laser 138 | 139 | 140 | pattern 141 | 7 142 | numLength 143 | 144 | 12 145 | 13 146 | 14 147 | 15 148 | 16 149 | 17 150 | 18 151 | 19 152 | 153 | luhn 154 | 155 | cardName 156 | Maestro 157 | cvcMinLength 158 | 3 159 | cvcMaxLength 160 | 3 161 | imageName 162 | maestro 163 | 164 | 165 | pattern 166 | 8 167 | luhn 168 | 169 | numLength 170 | 171 | 16 172 | 173 | cardName 174 | MasterCard 175 | cvcMinLength 176 | 3 177 | cvcMaxLength 178 | 3 179 | imageName 180 | masterCard 181 | 182 | 183 | pattern 184 | 9 185 | numLength 186 | 187 | 13 188 | 16 189 | 190 | luhn 191 | 192 | cardName 193 | Visa 194 | cvcMinLength 195 | 3 196 | cvcMaxLength 197 | 3 198 | imageName 199 | visa 200 | 201 | 202 | 203 | 204 | -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/PMCreditCardTypeParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMCreditCardTypeParser.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 09/01/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger, PMCardCheckResult) 12 | { 13 | VALID, 14 | NOT_YET_KNOWN, 15 | INVALID 16 | }; 17 | 18 | @interface PMCreditCardCheck : NSObject 19 | 20 | @property (nonatomic, strong) NSString *type; 21 | @property (nonatomic, strong) NSString *imageName; 22 | @property (nonatomic, strong) NSString *pattern; 23 | @property (nonatomic, strong) NSString *subPatterns; 24 | @property (nonatomic) BOOL luhn; 25 | @property (nonatomic) NSInteger cvcMinLength; 26 | @property (nonatomic) NSInteger cvcMaxLength; 27 | @property (nonatomic, strong) NSArray *numLength; 28 | @property (nonatomic) PMCardCheckResult result; 29 | @end 30 | 31 | 32 | @interface PMCreditCardTypeParser : NSObject 33 | +(id)instance; 34 | -(PMCreditCardCheck *)checkExpression:(NSString *)expression; 35 | @property (nonatomic, strong) NSArray *ccChecks; 36 | @property (nonatomic, strong) NSArray *expressionPatterns; 37 | @property (nonatomic, strong) NSArray *expressionSubPatterns; 38 | @property (nonatomic, strong) NSArray *cardTypes; 39 | @end 40 | -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/PMCreditCardTypeParser.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMCreditCardParser.m 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 10/16/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMCreditCardTypeParser.h" 10 | 11 | @implementation PMCreditCardCheck 12 | @synthesize subPatterns, pattern, cvcMaxLength, cvcMinLength, luhn, numLength, type, result, imageName; 13 | @end 14 | 15 | @implementation PMCreditCardTypeParser 16 | @synthesize ccChecks, expressionPatterns, expressionSubPatterns, cardTypes; 17 | static PMCreditCardTypeParser *sharedInstance; 18 | 19 | +(id)instance 20 | { 21 | //Singleton pattern 22 | //Static local predicate must be initialized to 0 23 | 24 | static dispatch_once_t onceToken = 0; 25 | dispatch_once(&onceToken, ^{ 26 | sharedInstance = [[PMCreditCardTypeParser alloc] init]; 27 | }); 28 | 29 | return sharedInstance; 30 | } 31 | 32 | -(NSArray *)ccChecks { 33 | //numLength values must be initialized in ascend order! 34 | 35 | NSString* path = [[NSBundle mainBundle] pathForResource:@"CardsData" 36 | ofType:@"plist"]; 37 | NSDictionary* data = [[NSDictionary alloc] initWithContentsOfFile:path]; 38 | NSArray* cards = [data objectForKey:@"Cards"]; 39 | NSMutableArray* ccData = [NSMutableArray array]; 40 | //loop over credit paymentType array and create the types conditionally 41 | for (NSString* cardType in cardTypes) { 42 | ccChecks = [NSMutableArray arrayWithCapacity:[cardTypes count]]; 43 | NSDictionary* cc = [self findDataForCCName:cardType inCards:cards]; 44 | if(cc){ 45 | [ccData addObject:cc]; 46 | } 47 | } 48 | NSMutableArray *checks = [NSMutableArray array]; 49 | for(NSDictionary *ccc in ccData) 50 | { 51 | NSString *name = [ccc valueForKey:@"cardName"]; 52 | PMCreditCardCheck *ccCheck = [[PMCreditCardCheck alloc]init]; 53 | ccCheck.type = name; 54 | ccCheck.imageName = [ccc valueForKey:@"imageName"]; 55 | NSString *pattern = [ccc valueForKey:@"pattern"]; 56 | ccCheck.pattern = [self.expressionPatterns objectAtIndex:pattern.intValue]; 57 | ccCheck.subPatterns = [self.expressionPatterns objectAtIndex:pattern.intValue]; 58 | ccCheck.cvcMaxLength = [[ccc valueForKey:@"cvcMaxLength"] integerValue]; 59 | ccCheck.cvcMinLength = [[ccc valueForKey:@"cvcMinLength"] integerValue]; 60 | ccCheck.numLength = [ccc valueForKey:@"numLength"]; 61 | ccCheck.luhn = [[ccc valueForKey:@"luhn"] boolValue]; 62 | 63 | [checks addObject:ccCheck]; 64 | } 65 | 66 | ccChecks = checks; 67 | return ccChecks; 68 | } 69 | 70 | -(NSArray *)expressionPatterns 71 | { 72 | if(!expressionPatterns) { 73 | expressionPatterns = [NSArray arrayWithObjects:\ 74 | @"^3[47]", \ 75 | @"^(6011|622[126-925]|64[4-9]|65)", \ 76 | @"^62", \ 77 | @"^(30[0-5]|36|38)", \ 78 | @"^63[7-9]", \ 79 | @"^35([3-8][0-9]|2[8-9])", \ 80 | @"^(6704|6706|6771|6709)", \ 81 | @"^(5018|5020|5038|5893|6304|6331|6759|676[1-3]|6799|0604)", \ 82 | @"^(5[1-5])", \ 83 | @"^4", \ 84 | nil]; 85 | } 86 | return expressionPatterns; 87 | } 88 | 89 | -(NSArray *)expressionSubPatterns { 90 | if(!expressionSubPatterns) { 91 | expressionSubPatterns = [NSArray arrayWithObjects: \ 92 | @"^4", \ 93 | @"^5(?![^1-5])", \ 94 | @"^5(?![^08])(0?(?![^123])(1?(?![^8])|2?(?![^0])|3?(?![^8]))|(? 10 | #import "PMPaymentView.h" 11 | 12 | @interface PMCreditCardView : PMPaymentView 13 | 14 | + (id)creditCardView; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/PMDirectDebitView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMDirectDebitView.h 3 | // VoucherMill 4 | // 5 | // Created by gabi on 2/23/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PMPaymentView.h" 11 | 12 | @interface PMDirectDebitView : PMPaymentView 13 | 14 | + (id)directDebitView; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/PMDirectDebitView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMDirectDebitView.m 3 | // VoucherMill 4 | // 5 | // Created by gabi on 2/23/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMDirectDebitView.h" 10 | #import "PMTextField.h" 11 | 12 | /**************************************/ 13 | #pragma mark - Class Extension 14 | /**************************************/ 15 | @interface PMDirectDebitView () 16 | 17 | @property (weak, nonatomic) IBOutlet PMTextField *accountHolderTextField; 18 | @property (weak, nonatomic) IBOutlet PMTextField *ibanTextField; 19 | @property (weak, nonatomic) IBOutlet PMTextField *bicTextField; 20 | 21 | @property (weak, nonatomic) IBOutlet UILabel *accountHolderLabel; 22 | @property (weak, nonatomic) IBOutlet UILabel *ibanLabel; 23 | @property (weak, nonatomic) IBOutlet UILabel *bicLabel; 24 | 25 | @end 26 | 27 | /**************************************/ 28 | #pragma mark - Class Implementation 29 | /**************************************/ 30 | @implementation PMDirectDebitView 31 | 32 | /**************************************/ 33 | #pragma mark - Class methods 34 | /**************************************/ 35 | + (id)directDebitView 36 | { 37 | PMDirectDebitView* directDebitView = [[[NSBundle mainBundle] loadNibNamed:@"PMDirectDebitView" owner:nil options:nil] lastObject]; 38 | 39 | if ([directDebitView isKindOfClass:[PMDirectDebitView class]]) { 40 | return directDebitView; 41 | } 42 | else { 43 | return nil; 44 | } 45 | } 46 | 47 | /**************************************/ 48 | #pragma mark - View Lifecycle Methods 49 | /**************************************/ 50 | - (void)awakeFromNib 51 | { 52 | [super awakeFromNib]; 53 | 54 | [self configureView]; 55 | 56 | if ( nil != self.style ) { 57 | [self customizeControls]; 58 | } 59 | else { 60 | [self setDefaultStyle]; 61 | } 62 | } 63 | 64 | /**************************************/ 65 | #pragma mark - Helper Methods 66 | /**************************************/ 67 | - (void)customizeControls 68 | { 69 | [self customizeTextField:self.accountHolderTextField]; 70 | [self customizeTextField:self.ibanTextField]; 71 | [self customizeTextField:self.bicTextField]; 72 | 73 | [self customizeLabel:self.accountHolderLabel]; 74 | [self customizeLabel:self.ibanLabel]; 75 | [self customizeLabel:self.bicLabel]; 76 | } 77 | 78 | - (void)configureView 79 | { 80 | self.accountHolderTextField.keyboardType = UIKeyboardTypeNamePhonePad; 81 | self.ibanTextField.keyboardType = UIKeyboardTypeNamePhonePad; 82 | self.bicTextField.keyboardType = UIKeyboardTypeNamePhonePad; 83 | 84 | self.accountHolderTextField.tag = PMTextFieldTypeAccountHolder; 85 | self.ibanTextField.tag = PMTextFieldTypeIBANNumber; 86 | self.bicTextField.tag = PMTextFieldTypeBIC; 87 | } 88 | 89 | /**************************************/ 90 | #pragma mark - Virtual Methods 91 | /**************************************/ 92 | - (void)setTextFieldsDelegate:(id)delegate 93 | { 94 | self.accountHolderTextField.delegate = delegate; 95 | self.ibanTextField.delegate = delegate; 96 | self.bicTextField.delegate = delegate; 97 | } 98 | 99 | - (void)setDefaultStyle 100 | { 101 | [self setTextFieldDefaultStyle:self.accountHolderTextField]; 102 | [self setTextFieldDefaultStyle:self.ibanTextField]; 103 | [self setTextFieldDefaultStyle:self.bicTextField]; 104 | } 105 | 106 | - (void)setStyle:(PMStyle *)style 107 | { 108 | [super setStyle:style]; 109 | 110 | [self customizeControls]; 111 | } 112 | 113 | - (void)clearData 114 | { 115 | [self.accountHolderTextField setText:@""]; 116 | [self.ibanTextField setText:@""]; 117 | [self.bicTextField setText:@""]; 118 | } 119 | 120 | - (void)setUIEnabled:(BOOL)enabled 121 | { 122 | self.accountHolderTextField.enabled = enabled; 123 | self.bicTextField.enabled = enabled; 124 | self.ibanTextField.enabled = enabled; 125 | } 126 | 127 | - (CGSize)viewContentSize 128 | { 129 | return CGSizeMake(CGRectGetWidth(self.bounds),CGRectGetMaxY(self.bicTextField.frame) + 20.0); 130 | } 131 | 132 | - (void)updateData 133 | { 134 | [self.accountHolderTextField setText:((PMPaymentDataValidator*)self.accountHolderTextField.delegate).accountHolderStr]; 135 | [self.ibanTextField setText:((PMPaymentDataValidator*)self.accountHolderTextField.delegate).ibanStr]; 136 | [self.bicTextField setText:((PMPaymentDataValidator*)self.accountHolderTextField.delegate).bicStr]; 137 | } 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/PMPaymentDataValidator.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMPaymentDataValidator.h 3 | // VoucherMill 4 | // 5 | // Created by gabi on 2/25/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum PMPaymentDataType : NSInteger 12 | { 13 | PMPaymentDataTypeNone = 0, 14 | PMPaymentDataTypeCreditCard = 1, 15 | PMPaymentDataTypeDirectDebit = 2, 16 | }PMPaymentDataType; 17 | 18 | typedef enum PMTextFieldType : NSInteger 19 | { 20 | PMTextFieldTypeNone = 0, 21 | PMTextFieldTypeCardAccountHolder = 1, 22 | PMTextFieldTypeCardNumber = 2, 23 | PMTextFieldTypeExpDate = 3, 24 | PMTextFieldTypeCVC = 4, 25 | PMTextFieldTypeAccountHolder = 5, 26 | PMTextFieldTypeIBANNumber = 6, 27 | PMTextFieldTypeBIC = 7, 28 | }PMTextFieldType; 29 | 30 | /**************************************/ 31 | #pragma mark - 32 | /**************************************/ 33 | @protocol PMPaymentDataValidatorUIRepresentationDelegate; 34 | 35 | /**************************************/ 36 | #pragma mark - Class Interface 37 | /**************************************/ 38 | @interface PMPaymentDataValidator:NSObject 39 | 40 | @property (nonatomic, assign) PMPaymentDataType paymentDataType; 41 | 42 | @property (nonatomic, strong, readonly) NSString* accountHolderStr; 43 | @property (nonatomic, strong, readonly) NSString* ibanStr; 44 | @property (nonatomic, strong, readonly) NSString* cardNumberStr; 45 | @property (nonatomic, strong, readonly) NSString* bicStr; 46 | @property (nonatomic, strong, readonly) NSString* cvcStr; 47 | @property (nonatomic, strong, readonly) NSString* expiryMonth; 48 | @property (nonatomic, strong, readonly) NSString* expiryYear; 49 | 50 | 51 | - (void)registerDelegate:(id)delegate; 52 | - (void)unregisterDelegate:(id)delegate; 53 | - (void)validateObject; 54 | - (NSString*)dateString; 55 | 56 | @end 57 | 58 | /*************************************************************/ 59 | #pragma mark - PMPaymentDataValidatorUIRepresentationDelegate 60 | /*************************************************************/ 61 | @protocol PMPaymentDataValidatorUIRepresentationDelegate 62 | 63 | @optional 64 | - (void)paymentDataValidator:(PMPaymentDataValidator*)paymentDataValidator didRecognizeCCNumberWithImageName:(NSString*)imageName; 65 | - (void)paymentDataValidator:(PMPaymentDataValidator*)paymentDataValidator didChangeActiveTextField:(UITextField*)textField; 66 | - (void)paymentDataValidator:(PMPaymentDataValidator*)paymentDataValidator didCheckDateExpiration:(BOOL)isExpired; 67 | - (void)paymentDataValidator:(PMPaymentDataValidator*)paymentDataValidator didValidateObjectWithError:(NSError*)error; 68 | - (NSString*)paymentDataValidator:(PMPaymentDataValidator*)paymentDataValidator didChangeDateExpiratioTextFieldValue:(UITextField*)textField; 69 | 70 | @end -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/PMPaymentMethodsListCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMPaymentMethodsListCell.h 3 | // VoucherMill 4 | // 5 | // Created by gabi on 3/14/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PMPaymentMethodsListCell : UITableViewCell 12 | 13 | @property (nonatomic, strong) UIImage* logoImage; 14 | @property (nonatomic, strong) NSString* numberStr; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/PMPaymentMethodsListCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMPaymentMethodsListCell.m 3 | // VoucherMill 4 | // 5 | // Created by gabi on 3/14/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMPaymentMethodsListCell.h" 10 | /**************************************/ 11 | #pragma mark - Class Extension 12 | /**************************************/ 13 | @interface PMPaymentMethodsListCell () 14 | 15 | @property (weak, nonatomic) IBOutlet UIImageView *logoImgView; 16 | @property (weak, nonatomic) IBOutlet UILabel *cardNumberLabel; 17 | 18 | @end 19 | 20 | /**************************************/ 21 | #pragma mark - Class Implementation 22 | /**************************************/ 23 | @implementation PMPaymentMethodsListCell 24 | 25 | /**************************************/ 26 | #pragma mark - View Lifecycle Methods 27 | /**************************************/ 28 | - (void)layoutSubviews 29 | { 30 | [super layoutSubviews]; 31 | 32 | self.logoImgView.image = self.logoImage; 33 | self.cardNumberLabel.text = self.numberStr; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/PMPaymentMethodsListCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/PMPaymentMethodsListViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMPaymentMethodsListViewController.h 3 | // VoucherMill 4 | // 5 | // Created by gabi on 3/14/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "PMPaymentViewController.h" 12 | 13 | //Block callbacks 14 | 15 | typedef void(^OnPaymentListSuccess)(id); 16 | typedef void(^OnPaymentListFailure)(NSError *); 17 | 18 | /**************************************/ 19 | #pragma mark - Class Interface 20 | /**************************************/ 21 | @interface PMPaymentMethodsListViewController : UIViewController 22 | 23 | - (PMPaymentMethodsListViewController *)initWithParams:(PMPaymentParams*)pmParams 24 | paymentsArr:(NSArray *)payments 25 | pmSettings:(PMSettings *)settings 26 | successBlock:(void (^)(id))success 27 | andFailureBlock:(void (^)(NSError *))failure; 28 | 29 | - (void)setSafestorePassword:(NSString*)password; 30 | 31 | @end -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/PMPaymentMethodsListViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 48 | 49 | 50 | 51 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/PMPaymentScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/PMPaymentView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMDebitView.h 3 | // VoucherMill 4 | // 5 | // Created by gabi on 2/24/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PMTextField.h" 11 | #import "PMPaymentDataValidator.h" 12 | 13 | /**************************************/ 14 | #pragma mark - PMStyle interface 15 | /**************************************/ 16 | 17 | /** 18 | This class is intended for set style properties to the payment screen. 19 | */ 20 | @interface PMStyle : NSObject 21 | /** 22 | backgroundColor 23 | */ 24 | @property (nonatomic) UIColor *backgroundColor; 25 | /** 26 | navbarColor 27 | */ 28 | @property (nonatomic) UIColor *navbarColor; 29 | /** 30 | inputFieldBackgroundColor 31 | */ 32 | @property (nonatomic) UIColor *inputFieldBackgroundColor; 33 | /** 34 | inputFieldTextColor 35 | */ 36 | @property (nonatomic) UIColor *inputFieldTextColor; 37 | /** 38 | inputFieldTitleColor 39 | */ 40 | @property (nonatomic) UIColor *inputFieldTitleColor; 41 | /** 42 | inputFieldBorderColor 43 | */ 44 | @property (nonatomic) UIColor *inputFieldBorderColor; 45 | /** 46 | inputFieldConfirmColor 47 | */ 48 | @property (nonatomic) UIColor *inputFieldConfirmColor; 49 | /** 50 | inputFieldNonConfirmColor 51 | */ 52 | @property (nonatomic) UIColor *inputFieldNonConfirmColor; 53 | /** 54 | inputFieldWrongColor 55 | */ 56 | @property (nonatomic) UIColor *inputFieldWrongColor; 57 | /** 58 | buttonBackgroundColor 59 | */ 60 | @property (nonatomic) UIColor *buttonBackgroundColor; 61 | /** 62 | buttonTitleColor 63 | */ 64 | @property (nonatomic) UIColor *buttonTitleColor; 65 | /** 66 | segmentColor 67 | */ 68 | @property (nonatomic) UIColor *segmentColor; 69 | /** 70 | modalTransitonStyle 71 | */ 72 | @property (nonatomic) UIModalTransitionStyle modalTransitonStyle; 73 | /** 74 | inputFieldBorderStyle 75 | */ 76 | @property(nonatomic) UITextBorderStyle inputFieldBorderStyle; 77 | 78 | /** 79 | inputAutocapitalizationType 80 | */ 81 | @property(nonatomic) UITextAutocapitalizationType inputFieldAutocapitalizationType; 82 | 83 | /** 84 | inputFieldAutocorrectionType 85 | */ 86 | @property(nonatomic) UITextAutocorrectionType inputFieldAutocorrectionType; 87 | 88 | /** 89 | inputFieldClearButtonMode 90 | */ 91 | @property(nonatomic) UITextFieldViewMode inputFieldClearButtonMode; 92 | 93 | /** 94 | inputFieldCornerRadius 95 | */ 96 | @property(nonatomic) CGFloat inputFieldCornerRadius; 97 | 98 | /** 99 | inputFieldBorderWidth 100 | */ 101 | @property(nonatomic) CGFloat inputFieldBorderWidth; 102 | 103 | 104 | @end 105 | 106 | /**************************************/ 107 | #pragma mark - PMDebitView interface 108 | /**************************************/ 109 | @interface PMPaymentView : UIView 110 | 111 | @property (weak, nonatomic) IBOutlet UIScrollView *scrollView; 112 | @property (nonatomic, strong) UITextField* activeTextField; 113 | @property (nonatomic, strong) PMStyle* style; 114 | 115 | - (void)setTextFieldsDelegate:(id)delegate; 116 | - (void)customizeTextField:(PMTextField*)textField; 117 | - (void)customizeLabel:(UILabel*)label; 118 | - (void)setTextFieldDefaultStyle:(UITextField*)textField; 119 | - (void)resignKeyboard; 120 | - (void)clearData; 121 | - (void)updateData; 122 | - (void)setUIEnabled:(BOOL)enabled; 123 | - (CGSize)viewContentSize; 124 | 125 | @end 126 | -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/PMPaymentView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMDebitView.m 3 | // VoucherMill 4 | // 5 | // Created by gabi on 2/24/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMPaymentView.h" 10 | 11 | /**************************************/ 12 | #pragma mark - PMStyle Implementation 13 | /**************************************/ 14 | @implementation PMStyle : NSObject 15 | 16 | @end 17 | 18 | /**************************************/ 19 | #pragma mark - Class Extension 20 | /**************************************/ 21 | @interface PMPaymentView () 22 | 23 | @property (nonatomic, strong) UIToolbar *keyBar; 24 | 25 | @end 26 | 27 | /**************************************/ 28 | #pragma mark - Class Implementation 29 | /**************************************/ 30 | @implementation PMPaymentView 31 | 32 | /**************************************/ 33 | #pragma mark - Class Method 34 | /**************************************/ 35 | + (id)debitView 36 | { 37 | NSAssert(0, @"This is a virtual method. Override me!!!"); 38 | 39 | return nil; 40 | } 41 | 42 | /**************************************/ 43 | #pragma mark - View Lifecycle Methods 44 | /**************************************/ 45 | - (void)awakeFromNib 46 | { 47 | [super awakeFromNib]; 48 | 49 | [self createKeyBoardToolbar]; 50 | } 51 | 52 | 53 | /**************************************/ 54 | #pragma mark - Helper Methods 55 | /**************************************/ 56 | - (void)createKeyBoardToolbar 57 | { 58 | //Create Prev/Next+Done tab bar to keyboard 59 | self.keyBar = [[UIToolbar alloc] init]; 60 | [self.keyBar setBarStyle:UIBarStyleBlackTranslucent]; 61 | [self.keyBar sizeToFit]; 62 | 63 | UISegmentedControl *segControl = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:kPMStringPrevious, kPMStringNext, nil]]; 64 | [segControl setSegmentedControlStyle:UISegmentedControlStyleBar]; 65 | segControl.selectedSegmentIndex = -1; 66 | [segControl addTarget:self action:@selector(segSelected:) forControlEvents:UIControlEventValueChanged]; 67 | 68 | UIBarButtonItem *segButton = [[UIBarButtonItem alloc] initWithCustomView:segControl]; 69 | UIBarButtonItem *flexButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil]; 70 | UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(resignKeyboard)]; 71 | 72 | NSArray *itemArray = [NSArray arrayWithObjects:segButton, flexButton, doneButton, nil]; 73 | 74 | [self.keyBar setItems:itemArray]; 75 | } 76 | 77 | /**************************************/ 78 | #pragma mark - Virtual Methods 79 | /**************************************/ 80 | - (void)customizeTextField:(PMTextField*)textField 81 | { 82 | textField.inputFieldBorderWidth = self.style.inputFieldBorderWidth; 83 | textField.inputFieldCornerRadius = self.style.inputFieldCornerRadius; 84 | 85 | textField.inputFieldTextColor = self.style.inputFieldTextColor; 86 | textField.inputFieldBackgroundColor = self.style.inputFieldBackgroundColor; 87 | textField.inputFieldBorderColor = self.style.inputFieldBorderColor; 88 | textField.inputFieldConfirmColor = self.style.inputFieldConfirmColor; 89 | textField.inputFieldNonConfirmColor = self.style.inputFieldNonConfirmColor; 90 | textField.inputFieldWrongColor = self.style.inputFieldWrongColor; 91 | 92 | [textField setInputAccessoryView:self.keyBar]; 93 | } 94 | 95 | - (void)customizeLabel:(UILabel *)label 96 | { 97 | label.font = [UIFont boldSystemFontOfSize:17.0]; 98 | label.backgroundColor = [UIColor clearColor]; 99 | label.textColor = self.style.inputFieldTitleColor; 100 | } 101 | 102 | - (void)setTextFieldDefaultStyle:(UITextField*)textField 103 | { 104 | textField.borderStyle = UITextBorderStyleRoundedRect; 105 | [textField setInputAccessoryView:self.keyBar]; 106 | } 107 | 108 | - (void)setStyle:(PMStyle *)style 109 | { 110 | _style = style; 111 | } 112 | 113 | - (CGSize)viewContentSize 114 | { 115 | NSAssert(0, @"This is a virtual method. Override me!!!"); 116 | 117 | return CGSizeMake(0,0); 118 | } 119 | 120 | - (void)clearData 121 | { 122 | NSAssert(0, @"This is a virtual method. Override me!!!"); 123 | } 124 | 125 | - (void)updateData 126 | { 127 | NSAssert(0, @"This is a virtual method. Override me!!!"); 128 | } 129 | 130 | - (void)setTextFieldsDelegate:(id)delegate 131 | { 132 | NSAssert(0, @"This is a virtual method. Override me!!!"); 133 | } 134 | 135 | - (void)setUIEnabled:(BOOL)enabled 136 | { 137 | NSAssert(0, @"This is a virtual method. Override me!!!"); 138 | } 139 | 140 | /****************************************/ 141 | #pragma mark - UISegmentedControl Action 142 | /****************************************/ 143 | - (void)segSelected:(UISegmentedControl*)segmentedCtrl 144 | { 145 | if ( nil != self.activeTextField ) { 146 | int newTag = (int)self.activeTextField.tag; 147 | 148 | if( [segmentedCtrl selectedSegmentIndex] ) { 149 | newTag += 1; 150 | } 151 | else { 152 | if ( newTag > 0 ) { 153 | newTag -= 1; 154 | } 155 | } 156 | 157 | PMTextField* textField = (PMTextField*)[self viewWithTag:newTag]; 158 | 159 | if ( [textField isKindOfClass:[PMTextField class]] ) { 160 | self.activeTextField = textField; 161 | [self.activeTextField becomeFirstResponder]; 162 | } 163 | else { 164 | [self resignKeyboard]; 165 | } 166 | } 167 | 168 | segmentedCtrl.selectedSegmentIndex = -1; 169 | } 170 | 171 | /**************************************/ 172 | #pragma mark - UIBarButtonItem Actions 173 | /**************************************/ 174 | - (void)resignKeyboard 175 | { 176 | [self.activeTextField resignFirstResponder]; 177 | } 178 | 179 | /*********************************************************************/ 180 | #pragma mark - PMPaymentDataValidatorUIRepresentationDelegate Methods 181 | /*********************************************************************/ 182 | - (void)paymentDataValidator:(PMPaymentDataValidator *)paymentDataValidator didChangeActiveTextField:(UITextField *)textField 183 | { 184 | self.activeTextField = textField; 185 | } 186 | 187 | @end 188 | -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/PMPaymentViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMPaymentViewController.h 3 | // VoucherMill 4 | // 5 | // Created by PayMill on 3/26/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "PMPaymentView.h" 12 | 13 | typedef NS_ENUM(NSInteger, PMPaymentType) 14 | { 15 | TOKEN, 16 | TRANSACTION, 17 | PREAUTHORIZATION, 18 | TOKEN_WO_INIT //GenetareTokenWithPublicKey 19 | }; 20 | 21 | //Block callbacks 22 | typedef void(^OnCompletionSuccess)(id); 23 | typedef void(^OnCompletionFailure)(NSError *); 24 | 25 | 26 | /** 27 | This class is used to set different settings for screen according to payment requirements 28 | */ 29 | @interface PMSettings : NSObject 30 | 31 | /** 32 | paymentType 33 | */ 34 | @property(nonatomic) PMPaymentType paymentType; 35 | 36 | /** 37 | All credit cards are allowed. 38 | */ 39 | + (id)settingsWithPaymentType:(PMPaymentType)type directDebitCountry:(NSString*)ddCountry testMode:(BOOL)testMode safeStoreEnabled:(BOOL)enabled andConsumable:(BOOL)consumable; 40 | 41 | /** 42 | Disables all credit card types 43 | */ 44 | - (void)disableAllCreditCards; 45 | /** 46 | Enables all credit card types 47 | */ 48 | - (void)enableAllCreditCards; 49 | /** 50 | Enables a specific credit card type. 51 | */ 52 | - (void)enableCreditCardType:(NSString*)cardType; 53 | /** 54 | Disables a credit card type 55 | */ 56 | - (void)disableCreditCardType:(NSString*)cardType; 57 | /** 58 | Convenience method for pre-filling the payment screens. This is usefull for integrating card scanning services. 59 | @param accHolder account holder. 60 | @param cardNumber credit card number. 61 | @param expiryMonth expiration month. 62 | @param expiryYear expiration year. 63 | @param verification credit card verification code. 64 | */ 65 | -(void)prefillCreditCardDataWithAccHolder:(NSString*)accHolder cardNumber:(NSString*)cardNumber expiryMonth:(NSString*) expiryMonth expiryYear:(NSString*)expiryYear verification:(NSString*)verification; 66 | @end 67 | 68 | 69 | /**************************************/ 70 | #pragma mark - 71 | /**************************************/ 72 | @interface PMPaymentViewController : UIViewController 73 | 74 | /** 75 | Designated initializers for creating PMPaymentViewController. 76 | @param params PMPaymentParams created with PMFactory. 77 | @param publicKey Paymill merchant public key. 78 | @param settings Style settings. 79 | @param success a block callback that is executed when the requested Paymill operation returns success. 80 | @param failure a block callback that is executed when the requested Paymill operation returns error. 81 | */ 82 | - (PMPaymentViewController *)initWithParams:(PMPaymentParams*)pmParams publicKey:(NSString *)pubKey settings:(PMSettings *)pmSettings style:(PMStyle *)pmStyle success:(void (^)(id))success failure:(void (^)(NSError *))failure; 83 | 84 | - (PMPaymentViewController *)initWithParams:(PMPaymentParams*)pmParams publicKey:(NSString *)pubKey settings:(PMSettings *)pmSettings success:(void (^)(id))success failure:(void (^)(NSError *))failure; 85 | 86 | @end 87 | 88 | -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/PMPaymentViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/PMTextField.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMTextField.h 3 | // VoucherMill 4 | // 5 | // Created by gabi on 2/24/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PMTextField : UITextField 12 | 13 | /** 14 | inputFieldBackgroundColor 15 | */ 16 | @property (nonatomic, strong) UIColor *inputFieldBackgroundColor; 17 | /** 18 | inputFieldTextColor 19 | */ 20 | @property (nonatomic, strong) UIColor *inputFieldTextColor; 21 | /** 22 | inputFieldBorderColor 23 | */ 24 | @property (nonatomic, strong) UIColor *inputFieldBorderColor; 25 | /** 26 | inputFieldConfirmColor 27 | */ 28 | @property (nonatomic, strong) UIColor *inputFieldConfirmColor; 29 | /** 30 | inputFieldNonConfirmColor 31 | */ 32 | @property (nonatomic, strong) UIColor *inputFieldNonConfirmColor; 33 | /** 34 | inputFieldWrongColor 35 | */ 36 | @property (nonatomic, strong) UIColor *inputFieldWrongColor; 37 | 38 | /** 39 | inputFieldTextAlignment 40 | */ 41 | @property(nonatomic) NSTextAlignment inputFieldTextAlignment; 42 | 43 | /** 44 | inputFieldContentVerticalAlignment 45 | */ 46 | @property(nonatomic) UIControlContentVerticalAlignment inputFieldContentVerticalAlignment; 47 | 48 | /** 49 | inputFieldBorderStyle 50 | */ 51 | @property(nonatomic) UITextBorderStyle inputFieldBorderStyle; 52 | 53 | /** 54 | inputAutocapitalizationType 55 | */ 56 | @property(nonatomic) UITextAutocapitalizationType inputFieldAutocapitalizationType; 57 | 58 | /** 59 | inputFieldAutocorrectionType 60 | */ 61 | @property(nonatomic) UITextAutocorrectionType inputFieldAutocorrectionType; 62 | 63 | /** 64 | inputFieldClearButtonMode 65 | */ 66 | @property(nonatomic) UITextFieldViewMode inputFieldClearButtonMode; 67 | 68 | /** 69 | inputFieldCornerRadius 70 | */ 71 | @property(nonatomic) CGFloat inputFieldCornerRadius; 72 | 73 | /** 74 | inputFieldBorderWidth 75 | */ 76 | @property(nonatomic) CGFloat inputFieldBorderWidth; 77 | 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/PMTextField.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMTextField.m 3 | // VoucherMill 4 | // 5 | // Created by gabi on 2/24/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMTextField.h" 10 | #import 11 | 12 | /**************************************/ 13 | #pragma mark - Class Implementation 14 | /**************************************/ 15 | @implementation PMTextField 16 | 17 | /**************************************/ 18 | #pragma mark - Init 19 | /**************************************/ 20 | - (id)initWithFrame:(CGRect)frame 21 | { 22 | self = [super initWithFrame:frame]; 23 | if ( nil != self ) { 24 | [self defaultInitialization]; 25 | } 26 | 27 | return self; 28 | } 29 | 30 | /**************************************/ 31 | #pragma mark - Helper Methods 32 | /**************************************/ 33 | - (void)defaultInitialization 34 | { 35 | self.textAlignment = NSTextAlignmentLeft; 36 | self.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; 37 | 38 | self.adjustsFontSizeToFitWidth = YES; 39 | 40 | self.textColor = [UIColor blackColor]; 41 | self.backgroundColor = [UIColor whiteColor]; 42 | 43 | self.borderStyle = UITextBorderStyleRoundedRect; 44 | 45 | self.autocapitalizationType = UITextAutocapitalizationTypeNone; 46 | self.autocorrectionType = UITextAutocorrectionTypeNo; 47 | self.clearButtonMode = UITextFieldViewModeNever; 48 | } 49 | 50 | /**************************************/ 51 | #pragma mark - Setters 52 | /**************************************/ 53 | - (void)setInputBorderColor:(UIColor *)inputBorderColor 54 | { 55 | self.layer.borderColor = inputBorderColor.CGColor; 56 | } 57 | 58 | - (void)setInputTextAlignment:(NSTextAlignment)inputTextAlignment 59 | { 60 | self.textAlignment = inputTextAlignment; 61 | } 62 | 63 | - (void)setInputContentVerticalAlignment:(UIControlContentVerticalAlignment)inputContentVerticalAlignment 64 | { 65 | self.contentVerticalAlignment = inputContentVerticalAlignment; 66 | } 67 | 68 | - (void)setInputFieldTextColor:(UIColor *)inputFieldTextColor 69 | { 70 | self.textColor = inputFieldTextColor; 71 | } 72 | 73 | - (void)setInputFieldBackgroundColor:(UIColor *)inputFieldBackgroundColor 74 | { 75 | self.backgroundColor = inputFieldBackgroundColor; 76 | } 77 | 78 | - (void)setInputFieldBorderStyle:(UITextBorderStyle)inputFieldBorderStyle 79 | { 80 | self.borderStyle = inputFieldBorderStyle; 81 | } 82 | 83 | - (void)setInputFieldBorderColor:(UIColor *)inputFieldBorderColor 84 | { 85 | self.layer.borderColor = inputFieldBorderColor.CGColor; 86 | } 87 | 88 | - (void)setInputFieldBorderWidth:(CGFloat)inputFieldBorderWidth 89 | { 90 | self.layer.borderWidth = inputFieldBorderWidth; 91 | } 92 | 93 | - (void)setInputFieldCornerRadius:(CGFloat)inputFieldCornerRadius 94 | { 95 | self.layer.cornerRadius = inputFieldCornerRadius; 96 | } 97 | 98 | - (void)setInputFieldAutocapitalizationType:(UITextAutocapitalizationType)inputFieldAutocapitalizationType 99 | { 100 | self.autocapitalizationType = inputFieldAutocapitalizationType; 101 | } 102 | 103 | - (void)setInputFieldAutocorrectionType:(UITextAutocorrectionType)inputFieldAutocorrectionType 104 | { 105 | self.autocorrectionType = inputFieldAutocorrectionType; 106 | } 107 | 108 | - (void)setInputFieldClearButtonMode:(UITextFieldViewMode)inputFieldClearButtonMode 109 | { 110 | self.clearButtonMode = inputFieldClearButtonMode; 111 | } 112 | 113 | @end 114 | -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/American Express - tst.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/American Express - tst.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/americanExpress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/americanExpress.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/americanExpress@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/americanExpress@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/cvc-amex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/cvc-amex.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/cvc-amex@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/cvc-amex@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/cvc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/cvc.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/cvc@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/cvc@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/diners.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/diners.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/dinersClub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/dinersClub.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/dinersClub@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/dinersClub@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/discover-tst.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/discover-tst.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/discover-tst@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/discover-tst@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/discover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/discover.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/discover@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/discover@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/instantPayments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/instantPayments.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/instantPayments@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/instantPayments@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/jcb-tst.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/jcb-tst.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/jcb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/jcb.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/jcb@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/jcb@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/laser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/laser.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/laser@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/laser@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/maestro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/maestro.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/maestro@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/maestro@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/masterCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/masterCard.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/masterCard@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/masterCard@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/mastercard-tst.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/mastercard-tst.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/placeholder.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/placeholder@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/placeholder@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/unionPay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/unionPay.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/unionPay@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/unionPay@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/visa-tst.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/visa-tst.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/visa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/visa.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/Cards/visa@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/Cards/visa@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/button_backgroundimage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/button_backgroundimage.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/button_backgroundimage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/button_backgroundimage@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/divider_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/divider_selected.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/divider_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/divider_selected@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/selectedbutton_backgroundimage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/selectedbutton_backgroundimage.png -------------------------------------------------------------------------------- /samples/vouchermill/PaymentScreens/Resources/selectedbutton_backgroundimage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/PaymentScreens/Resources/selectedbutton_backgroundimage@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/README.md: -------------------------------------------------------------------------------- 1 | # VoucherMill 2 | 3 | ## Using the payment screens 4 | 5 | 6 | ### Installation 7 | 8 | 9 | To use the payment screens you need to copy the whole `PaymentScreens` directory into your project. 10 | 11 | You should make sure that all included images are added to your project's `Bundle Resources`. 12 | 13 | 14 | ### Styling the payment screens 15 | If you like the layout of the payment screens and you simply want to change the colors, you can set them using the [PMStyle](http://paymill.github.io/paymill-ios/docs/sdk/Classes/PMStyle.html) class. 16 | 17 | ### Work with the Payment View Controller 18 | 19 | 20 | API Docs for the Payment View Controller are available [here](http://paymill.github.io/paymill-ios/docs/sdk/) . 21 | 22 | - Create the `PMPaymentParams` object that describes the amount, currency and description. Note, that you need to specify one, even if only generate a token. 23 | 24 | ```objective-c 25 | NSError *error; 26 | PMPaymentParams *pmParams = [PMFactory genPaymentParamsWithCurrency:@"EUR" amount:100 description:@"Description" error:&error]; 27 | ``` 28 | 29 | - Create and configure a [PMSettings](http://paymill.github.io/paymill-ios/docs/sdk/Classes/PMSettings.html) object. 30 | 31 | ```objective-c 32 | //set payment view settings 33 | PMSettings pmSettings= [[PMSettings alloc] init]; 34 | pmSettings.paymentType = TOKEN; 35 | pmSettings.cardTypes = [NSArray arrayWithObjects:@"American Express", @"Visa", nil];//switch on American Expres and Visa 36 | pmSettings.directDebitCountry = @"DE"; //switch on direct debit for Germany 37 | pmSettings.isTestMode = YES; 38 | pmSettings.consumable = YES; 39 | ``` 40 | - Call the [PMPaymentViewController](http://paymill.github.io/paymill-ios/docs/sdk/Classes/PMPaymentViewController.html) designated initializer to create it. 41 | 42 | ```objective-c 43 | id paymentViewController = [PMPaymentViewController alloc] initWithParams:pmParams publicKey:publicKey settings:pmSetings style:pmStyle 44 | success:^(id) { 45 | //handle success 46 | } failure:^(NSError *) { 47 | //handle error 48 | }]; 49 | ``` 50 | - Push or present the view controller modally. 51 | 52 | 53 | Complete example: 54 | 55 | ```objective-c 56 | -(void)test { 57 | //create payment params 58 | NSError *error; 59 | PMPaymentParams *pmParams = [PMFactory genPaymentParamsWithCurrency:@"EUR" amount:100 description:@"Description" error:&error]; 60 | //create payment settings 61 | PMSettings pmSettings= [[PMSettings alloc] init]; 62 | pmSettings.paymentType = TOKEN; 63 | pmSettings.cardTypes = [NSArray arrayWithObjects:@"American Express", @"Visa", nil];//switch on American Expres and Visa 64 | pmSettings.directDebitCountry = @"DE"; //switch on direct debit for Germany 65 | pmSettings.isTestMode = YES; 66 | pmSettings.consumable = YES; 67 | //create the payment view controller 68 | id paymentViewController = [PMPaymentViewController alloc] initWithParams:pmParams publicKey:publicKey settings:pmSetings style:pmStyle 69 | success:^(id resObject) { 70 | //handle success 71 | //since the payment type set in the settings is TOKEN, we expect a NSString to come back from PAYMILL 72 | token = (NSString*)resObject; 73 | } failure:^(NSError *) { 74 | //handle error 75 | }]; 76 | //present the view controller modally 77 | [self presentViewController:paymentViewController animated:YES completion:nil]; 78 | } 79 | ``` 80 | 81 | 82 | 83 | ## Issues 84 | 85 | 86 | If you find a bug, please use the [issue tracker](https://github.com/paymill/paymill-ios/issues) to create a ticket. 87 | 88 | ## Developers 89 | 90 | 91 | If you want to contribute your code, fork the repository, commit your changes and create a pull request. Please make sure you include a detailed description of your changes. 92 | 93 | 94 | ## License 95 | 96 | The MIT License (MIT) 97 | 98 | Copyright (c) [2013] [PAYMILL GmbH] 99 | 100 | Permission is hereby granted, free of charge, to any person obtaining a copy of 101 | this software and associated documentation files (the "Software"), to deal in 102 | the Software without restriction, including without limitation the rights to 103 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 104 | the Software, and to permit persons to whom the Software is furnished to do so, 105 | subject to the following conditions: 106 | 107 | The above copyright notice and this permission notice shall be included in all 108 | copies or substantial portions of the Software. 109 | 110 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 111 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 112 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 113 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 114 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 115 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 116 | 117 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill.xcodeproj/project.xcworkspace/xcshareddata/VoucherMill.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 1EBFEBCC-E361-4367-9ACB-20509FB65C54 9 | IDESourceControlProjectName 10 | VoucherMill 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 0C4D83A9-A283-4165-8766-E68CDE7E7945 14 | ssh://bitbucket.org/QaiWare/paymill-ios-test.git 15 | 16 | IDESourceControlProjectPath 17 | VoucherMill.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 0C4D83A9-A283-4165-8766-E68CDE7E7945 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://bitbucket.org/QaiWare/paymill-ios-test.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | 0C4D83A9-A283-4165-8766-E68CDE7E7945 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 0C4D83A9-A283-4165-8766-E68CDE7E7945 36 | IDESourceControlWCCName 37 | paymill-ios-test-dev 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/App Delegate/PMAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMAppDelegate.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 1/22/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PMAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/App Delegate/PMAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMAppDelegate.m 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 1/22/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMAppDelegate.h" 10 | #define lightOrangeColor [UIColor colorWithRed:239.0/255.0 green:80/255.0 blue:0/255.0 alpha:1.0] 11 | 12 | @implementation PMAppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | // Override point for customization after application launch. 17 | [[UIBarButtonItem appearance] setTintColor:lightOrangeColor]; 18 | [[UIPageControl appearance] setPageIndicatorTintColor:lightOrangeColor]; 19 | 20 | if ( [[[[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@"."] objectAtIndex:0] integerValue] >= 7 ) { 21 | NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys: 22 | lightOrangeColor,UITextAttributeTextColor, 23 | nil]; 24 | 25 | [[UIBarButtonItem appearance] setTitleTextAttributes:attributes 26 | forState:UIControlStateNormal]; 27 | } 28 | 29 | UINavigationController* navCtrl = (UINavigationController*)[self.window rootViewController]; 30 | navCtrl.navigationBar.translucent = NO; 31 | navCtrl.view.backgroundColor = [UIColor whiteColor]; 32 | 33 | return YES; 34 | } 35 | 36 | + (void)initFromUserDefaults 37 | { 38 | NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults]; 39 | //Get the bundle path 40 | NSString *bPath = [[NSBundle mainBundle] bundlePath]; 41 | NSString *settingsPath = [bPath stringByAppendingPathComponent:@"Settings.bundle"]; 42 | NSString *plistFile = [settingsPath stringByAppendingPathComponent:@"Root.plist"]; 43 | 44 | //Get the Preferences Array from the dictionary 45 | NSDictionary *settingsDictionary = [NSDictionary dictionaryWithContentsOfFile:plistFile]; 46 | NSArray *preferencesArray = [settingsDictionary objectForKey:@"PreferenceSpecifiers"]; 47 | 48 | //Loop through the array 49 | NSDictionary *item; 50 | for(item in preferencesArray) 51 | { 52 | //Get the key of the item. 53 | NSString *keyValue = [item objectForKey:@"Key"]; 54 | 55 | //Get the default value specified in the plist file. 56 | id defaultValue = [item objectForKey:@"DefaultValue"]; 57 | 58 | if (keyValue && defaultValue) 59 | [standardUserDefaults setObject:defaultValue forKey:keyValue]; 60 | } 61 | [standardUserDefaults synchronize]; 62 | } 63 | 64 | - (void)applicationWillResignActive:(UIApplication *)application 65 | { 66 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 67 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 68 | } 69 | 70 | - (void)applicationDidEnterBackground:(UIApplication *)application 71 | { 72 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 73 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 74 | } 75 | 76 | - (void)applicationWillEnterForeground:(UIApplication *)application 77 | { 78 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 79 | } 80 | 81 | - (void)applicationDidBecomeActive:(UIApplication *)application 82 | { 83 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 84 | } 85 | 86 | - (void)applicationWillTerminate:(UIApplication *)application 87 | { 88 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 89 | } 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Constants.h: -------------------------------------------------------------------------------- 1 | // 2 | // Constants.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 7/17/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #ifndef VoucherMill_Constants_h 10 | #define VoucherMill_Constants_h 11 | 12 | #define PM_SAFE_BLOCK_CALL(block, /* block arguments */ ...) if ( nil != block ) { block(__VA_ARGS__); } 13 | #define darkOrangeColor [UIColor colorWithRed:149.0/255.0 green:0/255.0 blue:11.0/255.0 alpha:1.0] 14 | #define lightOrangeColor [UIColor colorWithRed:239.0/255.0 green:80/255.0 blue:0/255.0 alpha:1.0] 15 | #define kBUYVOUCHER @"BuyVoucherSegue" 16 | #define kONLINEVOUCHERS @"OnlineVouchersSegue" 17 | #define kOFFLINEVOUCHERS @"OfflineVouchersSegue" 18 | #define kNOTCONSUMED @"NotConsumedSegue" 19 | #define kBuyDetailsSuccess @"BuyDetailsSuccessSegue" 20 | #define kBuyDetailsError @"BuyDetailsErrorSegue" 21 | #define kBOUGHT @"Bought" 22 | #define kRESERVED @"Reserved" 23 | #define kGENERATETOKEN @"GenerateTokenSegue" 24 | #define kLabelFontSize 14 25 | #define kTickets @"tickets" 26 | #define kBurger @"burger" 27 | #define kCustom @"custom" 28 | #define kTyre @"tyre" 29 | #define kTicketsBig @"tickets_big" 30 | #define kBurgerBig @"burger_big" 31 | #define kCustomBig @"custom_big" 32 | #define kTyreBig @"tyre_big" 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Dashboard/PMDashboardViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMDashboardViewCell.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 6/11/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PMDashboardViewCell : UICollectionViewCell 12 | @property(weak) IBOutlet UIImageView *imageView; 13 | @property (weak, nonatomic) IBOutlet UILabel *cellLabel; 14 | @end 15 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Dashboard/PMDashboardViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMDashboardViewCell.m 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 6/11/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMDashboardViewCell.h" 10 | 11 | @implementation PMDashboardViewCell 12 | 13 | @synthesize imageView, cellLabel; 14 | 15 | - (id)initWithFrame:(CGRect)frame 16 | { 17 | self = [super initWithFrame:frame]; 18 | if (self) { 19 | // Initialization code 20 | } 21 | return self; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Dashboard/PMDashboardViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMDashboardViewController.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 6/8/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PMDashboardViewController : UICollectionViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/DataBase/OfflineVoucher.h: -------------------------------------------------------------------------------- 1 | // 2 | // OfflineVoucher.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 7/1/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | @interface OfflineVoucher : NSManagedObject 14 | 15 | @property (nonatomic, retain) NSString * amount; 16 | @property (nonatomic, retain) NSString * currency; 17 | @property (nonatomic, retain) NSString * descript; 18 | @property (nonatomic, retain) NSString * transactionId; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/DataBase/OfflineVoucher.m: -------------------------------------------------------------------------------- 1 | // 2 | // OfflineVoucher.m 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 7/1/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import "OfflineVoucher.h" 10 | 11 | 12 | @implementation OfflineVoucher 13 | 14 | @dynamic amount; 15 | @dynamic currency; 16 | @dynamic descript; 17 | @dynamic transactionId; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/DataBase/PMDataBaseManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMDataBaseManager.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 9/11/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "OfflineVoucher.h" 11 | #import "PMVoucher.h" 12 | 13 | typedef void (^PMDataCompletionHandler)(NSError* err); 14 | 15 | @interface PMDataBaseManager : NSObject 16 | 17 | @property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext; 18 | @property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; 19 | @property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; 20 | 21 | + (id)instance; 22 | 23 | - (void)insertNewOfflineVoucherWithAmount:(NSString*)amount 24 | currency:(NSString*)currency 25 | description:(NSString*)description 26 | transactionId:(NSString*)transactionId 27 | andCompletionHandler:(PMDataCompletionHandler)completionHandler; 28 | 29 | - (void)insertNewOfflineVoucherWithVoucher:(PMVoucher *)voucher 30 | andCompletionHandler:(PMDataCompletionHandler)completionHandler; 31 | 32 | - (NSArray*)allOfflineVouchersWithCompletionHandler:(PMDataCompletionHandler)completionHandler; 33 | 34 | -(OfflineVoucher *)findVoucherByTransactionId:(NSString *)transactionId andCompletionHandler:(PMDataCompletionHandler)completionHandler; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/DataBase/VoucherMill.xcdatamodeld/VoucherMill.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Details/DetailsViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DetailsViewController.h 3 | // VoucherMill 4 | // 5 | // Created by Oleg Ivanov on 6/27/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PMVoucher.h" 11 | 12 | @protocol PMDetailsViewDelegate 13 | -(void)reloadTable; 14 | @end 15 | 16 | @interface DetailsViewController : UIViewController 17 | 18 | @property (nonatomic, strong) PMVoucher *theVoucher; 19 | @property (nonatomic, weak) IBOutlet UITableView *detailsTable; 20 | @property (strong, nonatomic) IBOutlet UIImageView *voucherImage; 21 | @property (strong, nonatomic) NSMutableArray *detailsList; 22 | @property (strong, nonatomic) id delegate; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Details/DetailsViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DetailsViewController.m 3 | // VoucherMill 4 | // 5 | // Created by Oleg Ivanov on 6/27/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import "DetailsViewController.h" 10 | #import 11 | #import "MBProgressHUD.h" 12 | 13 | #define kLabelFontSize 14 14 | #define darkOrangeColor [UIColor colorWithRed:149.0/255.0 green:0/255.0 blue:11.0/255.0 alpha:1.0] 15 | #define lightOrangeColor [UIColor colorWithRed:239.0/255.0 green:80/255.0 blue:0/255.0 alpha:1.0] 16 | 17 | @interface DetailsViewController () 18 | -(IBAction)consumeAction:(id)sender; 19 | @end 20 | 21 | @implementation DetailsViewController 22 | 23 | @synthesize theVoucher, detailsTable, detailsList, voucherImage, delegate; 24 | 25 | 26 | - (void)viewDidLoad 27 | { 28 | NSMutableArray *arrayOfSections; 29 | [super viewDidLoad]; 30 | if (theVoucher.voucherType == Online) { 31 | self.title = @"Online Details"; 32 | } else { 33 | self.title = @"NC Details"; 34 | } 35 | if(theVoucher.voucherType == NotConsumed) { 36 | UIBarButtonItem *consumeButton = [[UIBarButtonItem alloc]initWithTitle:@"Consume" style:UIBarButtonItemStyleDone target:self action:@selector(consumeAction:)]; 37 | self.navigationItem.rightBarButtonItem = consumeButton; 38 | } 39 | voucherImage.image = theVoucher.voucherBigImage; 40 | [detailsTable setBackgroundView:nil]; 41 | [detailsTable setBackgroundColor:[UIColor clearColor]]; 42 | UIColor *color = [[UIColor alloc]initWithRed:149/255.0f green:0/255.0f blue:11/255.0f alpha:1 ]; 43 | [detailsTable setSeparatorColor:color]; 44 | NSString *amountCurrency = [NSString stringWithFormat:@"%ld%@", (long)[theVoucher.voucherAmount integerValue], theVoucher.voucherCurrency]; 45 | NSArray *firstSection = [NSArray arrayWithObjects:amountCurrency, theVoucher.voucherCreationDate, theVoucher.voucherDescrpition, theVoucher.voucherStatus, nil]; 46 | NSArray *secondSection = [NSArray arrayWithObjects:theVoucher.voucherCreditCardNumber, theVoucher.voucherCreditCardType, nil]; 47 | NSArray *thirdSection = [NSArray arrayWithObjects:theVoucher.voucherAccount, theVoucher.voucherBankCode, nil]; 48 | if (theVoucher.isCreditCard) { 49 | arrayOfSections = [[NSMutableArray alloc] initWithObjects:firstSection, secondSection, nil]; 50 | } else { 51 | arrayOfSections = [[NSMutableArray alloc] initWithObjects:firstSection, thirdSection, nil]; 52 | } 53 | [self setDetailsList:arrayOfSections]; 54 | 55 | self.navigationController.navigationBar.translucent = NO; 56 | } 57 | 58 | -(IBAction)consumeAction:(id)sender 59 | { 60 | [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES]; 61 | 62 | [PMManager consumeTransactionForId:theVoucher.transactionId success:^(NSString *id) { 63 | [MBProgressHUD hideAllHUDsForView:self.navigationController.view animated:YES]; 64 | [delegate reloadTable]; 65 | } failure:^(NSError *error) { 66 | [MBProgressHUD hideAllHUDsForView:self.navigationController.view animated:YES]; 67 | }]; 68 | 69 | [self.navigationController popViewControllerAnimated:YES]; 70 | } 71 | 72 | - (void)didReceiveMemoryWarning 73 | { 74 | [super didReceiveMemoryWarning]; 75 | // Dispose of any resources that can be recreated. 76 | } 77 | 78 | #pragma mark - Table view data source 79 | 80 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 81 | { 82 | return [self.detailsList count]; 83 | } 84 | 85 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 86 | { 87 | NSArray *sectionContents = [self.detailsList objectAtIndex:section]; 88 | return [sectionContents count]; 89 | } 90 | 91 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 92 | { 93 | static NSString *CellIdentifier = @"DetailsCell"; 94 | 95 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 96 | 97 | cell.backgroundColor = lightOrangeColor; 98 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 99 | NSArray *sectionContents = [self.detailsList objectAtIndex:[indexPath section]]; 100 | cell.detailTextLabel.text = [sectionContents objectAtIndex:[indexPath row]]; 101 | cell.detailTextLabel.textColor = darkOrangeColor; 102 | cell.detailTextLabel.font = [UIFont boldSystemFontOfSize:kLabelFontSize]; 103 | // check number of objects to determine the section, then set correct title for every row 104 | if (sectionContents.count > 2) { 105 | switch (indexPath.row) { 106 | case 0: 107 | cell.textLabel.text = @"Amount:"; 108 | break; 109 | case 1: 110 | cell.textLabel.text = @"Created at:"; 111 | break; 112 | case 2: 113 | cell.textLabel.text = @"Description:"; 114 | break; 115 | case 3: 116 | cell.textLabel.text = @"Status:"; 117 | break; 118 | } 119 | } else { 120 | switch (indexPath.row) { 121 | case 0: 122 | if (theVoucher.isCreditCard) { 123 | cell.textLabel.text = @"Credit Card:"; 124 | } else { 125 | cell.textLabel.text = @"Account:"; 126 | } 127 | break; 128 | case 1: 129 | if (theVoucher.isCreditCard) { 130 | cell.textLabel.text = @"Type:"; 131 | } else { 132 | cell.textLabel.text = @"Bank code:"; 133 | } 134 | break; 135 | } 136 | } 137 | cell.textLabel.textColor = [UIColor whiteColor]; 138 | cell.textLabel.font = [UIFont boldSystemFontOfSize:kLabelFontSize]; 139 | return cell; 140 | } 141 | 142 | @end -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Lists/PMListViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMListViewController.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 6/13/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "PMVoucher.h" 12 | #import "DetailsViewController.h" 13 | 14 | @interface PMListViewController : UIViewController 15 | 16 | @property (nonatomic, strong) NSMutableArray *items; 17 | @property (nonatomic, strong) NSMutableArray *boughtItems; 18 | @property (nonatomic, strong) NSMutableArray *reservedItems; 19 | @property (weak, nonatomic) IBOutlet UITableView *theTableView; 20 | @property (nonatomic, strong) NSMutableArray *segments; 21 | @property (nonatomic) VoucherStateType voucherState; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Login/PMLoginButtonCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMLoginButtonCell.h 3 | // VoucherMill 4 | // 5 | // Created by Oleg Ivanov on 7/3/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PMLoginButtonCell : UITableViewCell 12 | 13 | @property (nonatomic, strong) NSString *loginButtonTitle; 14 | @property (nonatomic) NSInteger loginButtonTag; 15 | @end 16 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Login/PMLoginButtonCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMLoginButtonCell.m 3 | // VoucherMill 4 | // 5 | // Created by Oleg Ivanov on 7/3/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMLoginButtonCell.h" 10 | #import 11 | @interface PMLoginButtonCell () 12 | 13 | @property (weak, nonatomic) IBOutlet UIButton *loginButton; 14 | 15 | @end 16 | @implementation PMLoginButtonCell 17 | 18 | @synthesize loginButton, loginButtonTitle, loginButtonTag; 19 | 20 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 21 | { 22 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 23 | if (self) { 24 | } 25 | return self; 26 | } 27 | 28 | 29 | -(void)awakeFromNib 30 | { 31 | [super awakeFromNib]; 32 | 33 | [self.loginButton setAutoresizingMask:UIViewAutoresizingNone]; 34 | UIColor *color = [[UIColor alloc]initWithRed:149/255.0f green:0/255.0f blue:11/255.0f alpha:1 ]; 35 | [self.loginButton.titleLabel setFont:[UIFont boldSystemFontOfSize:20.0f]]; 36 | [self.loginButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 37 | [self.loginButton setBackgroundImage:[UIImage imageNamed:@"button_backgroundimage"] forState:UIControlStateNormal]; 38 | [self.loginButton setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted]; 39 | [self.loginButton setBackgroundImage:[UIImage imageNamed:@"selectedbutton_backgroundimage"] forState:UIControlStateHighlighted]; 40 | [self.loginButton.layer setMasksToBounds:YES]; 41 | [self.loginButton.layer setBorderWidth:2.0f]; 42 | [self.loginButton.layer setBorderColor:color.CGColor]; 43 | [self.loginButton.layer setCornerRadius:10.0f]; 44 | } 45 | 46 | /**************************************/ 47 | #pragma mark - 48 | /**************************************/ 49 | -(void)layoutSubviews 50 | { 51 | [super layoutSubviews]; 52 | 53 | [self.loginButton setTitle:self.loginButtonTitle forState:UIControlStateNormal]; 54 | [self.loginButton setTag:self.loginButtonTag]; 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Login/PMLoginSegmentedControlCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMLoginSegmentedControlCell.h 3 | // VoucherMill 4 | // 5 | // Created by Oleg Ivanov on 7/3/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PMLoginSegmentedControlCell : UITableViewCell 12 | 13 | @property (nonatomic) NSInteger PMMode; 14 | @end 15 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Login/PMLoginSegmentedControlCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMLoginSegmentedControlCell.m 3 | // VoucherMill 4 | // 5 | // Created by Oleg Ivanov on 7/3/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMLoginSegmentedControlCell.h" 10 | #import 11 | 12 | @interface PMLoginSegmentedControlCell () 13 | @property (nonatomic, strong) NSMutableArray *loginSegments; 14 | @property (nonatomic,weak) IBOutlet UISegmentedControl *segmentedControl; 15 | 16 | @end 17 | @implementation PMLoginSegmentedControlCell 18 | 19 | @synthesize loginSegments, segmentedControl, PMMode; 20 | 21 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 22 | { 23 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 24 | if (self) { 25 | } 26 | return self; 27 | } 28 | /**************************************/ 29 | #pragma mark - 30 | /**************************************/ 31 | - (void)awakeFromNib 32 | { 33 | [super awakeFromNib]; 34 | 35 | [segmentedControl setAutoresizingMask:UIViewAutoresizingNone]; 36 | UIColor *borderColor = [[UIColor alloc]initWithRed:149/255.0f green:0/255.0f blue:11/255.0f alpha:1 ]; 37 | UIFont *font = [UIFont boldSystemFontOfSize:20.0f]; 38 | UIColor *color = [UIColor whiteColor]; 39 | NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:font, UITextAttributeFont, color, UITextAttributeTextColor,nil]; 40 | [segmentedControl setTitleTextAttributes:attrs forState:UIControlStateNormal]; 41 | segmentedControl.selectedSegmentIndex = 0; 42 | segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar; 43 | [segmentedControl setBackgroundImage:[UIImage imageNamed:@"button_backgroundimage"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; 44 | [segmentedControl setBackgroundImage:[UIImage imageNamed:@"selectedbutton_backgroundimage"] forState:UIControlStateSelected barMetrics:UIBarMetricsDefault]; 45 | [segmentedControl setDividerImage:[UIImage imageNamed:@"divider_selected"] forLeftSegmentState:UIControlStateSelected rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; 46 | [segmentedControl.layer setMasksToBounds:YES]; 47 | [segmentedControl.layer setBorderWidth:2.0f]; 48 | [segmentedControl.layer setBorderColor:borderColor.CGColor]; 49 | [segmentedControl.layer setCornerRadius:10.0f]; 50 | } 51 | 52 | /**************************************/ 53 | #pragma mark - 54 | /**************************************/ 55 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 56 | { 57 | [super setSelected:selected animated:animated]; 58 | 59 | // Configure the view for the selected state 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Login/PMLoginTextFieldCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMLoginTextFieidCell.h 3 | // VoucherMill 4 | // 5 | // Created by Oleg Ivanov on 7/3/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | @protocol PMLoginTextFieldCellDelegate 11 | 12 | -(void)loginText:(NSString *)text; 13 | 14 | @end 15 | 16 | @interface PMLoginTextFieldCell : UITableViewCell 17 | @property (nonatomic, strong) id delegate; 18 | @end 19 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Login/PMLoginTextFieldCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMLoginTextFieidCell.m 3 | // VoucherMill 4 | // 5 | // Created by Oleg Ivanov on 7/3/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMLoginTextFieldCell.h" 10 | @interface PMLoginTextFieldCell () 11 | 12 | @property (nonatomic, weak) IBOutlet UITextField *publicKey; 13 | @property (strong, nonatomic) UIToolbar *keyBar; 14 | 15 | @end 16 | 17 | @implementation PMLoginTextFieldCell 18 | 19 | @synthesize publicKey, keyBar, delegate; 20 | 21 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 22 | { 23 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 24 | if (self) { 25 | //this method is never called with prototype cells with reuse identifiers 26 | } 27 | return self; 28 | } 29 | 30 | /**************************************/ 31 | #pragma mark - 32 | /**************************************/ 33 | -(void)awakeFromNib 34 | { 35 | [super awakeFromNib]; 36 | 37 | [publicKey setBorderStyle:UITextBorderStyleRoundedRect]; 38 | [publicKey setAutoresizingMask:UIViewAutoresizingNone]; 39 | [publicKey setFont:[UIFont systemFontOfSize:15.0]]; 40 | [publicKey setTextColor:[UIColor blackColor]]; 41 | [publicKey setTextAlignment:NSTextAlignmentCenter]; 42 | [publicKey setBackgroundColor:[UIColor clearColor]]; 43 | publicKey.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; 44 | UIColor *color = [[UIColor alloc]initWithRed:149/255.0f green:0/255.0f blue:11/255.0f alpha:1 ]; 45 | publicKey.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"Enter your public key here" attributes:@{NSForegroundColorAttributeName: color}]; 46 | 47 | // Do any additional setup after loading the view 48 | //Create Prev/Next+Done tab bar to keyboard 49 | self.keyBar = [[UIToolbar alloc] init]; 50 | [self.keyBar setBarStyle:UIBarStyleBlackTranslucent]; 51 | [self.keyBar sizeToFit]; 52 | 53 | UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(resignKeyBoard)]; 54 | 55 | NSArray *itemArray = [NSArray arrayWithObjects:doneButton, nil]; 56 | 57 | [keyBar setItems:itemArray]; 58 | 59 | [publicKey setInputAccessoryView:keyBar]; 60 | 61 | publicKey.delegate = self; 62 | 63 | publicKey.keyboardType = UIKeyboardAppearanceDefault; 64 | 65 | publicKey.keyboardAppearance = UIKeyboardAppearanceDefault; 66 | } 67 | 68 | /**************************************/ 69 | #pragma mark - 70 | /**************************************/ 71 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 72 | { 73 | [super setSelected:selected animated:animated]; 74 | 75 | // Configure the view for the selected state 76 | } 77 | 78 | #pragma mark - 79 | #pragma mark UITextFieldDelegate 80 | 81 | - (BOOL)textFieldShouldReturn:(UITextField *)textField 82 | { 83 | // the user pressed the "Done" button, so dismiss the keyboard 84 | [textField resignFirstResponder]; 85 | return YES; 86 | } 87 | 88 | -(void)resignKeyBoard { 89 | [delegate loginText:publicKey.text]; 90 | [self textFieldShouldReturn:self.publicKey]; 91 | } 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Login/PMLoginViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMLoginViewController.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 6/5/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PMLoginTextFieldCell.h" 11 | #import "PMLoginSegmentedControlCell.h" 12 | 13 | @interface PMLoginViewController : UIViewController 14 | 15 | @end -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Login/Settings/PMSettingsViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMSettingsViewController.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 7/4/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PMSettingsViewController : UITableViewController 12 | 13 | @property(nonatomic, strong) NSArray *ccItems; 14 | @property(nonatomic, strong) NSArray *ddItems; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Model/PMVoucher.h: -------------------------------------------------------------------------------- 1 | // 2 | // Voucher.h 3 | // VoucherMill 4 | // 5 | // Created by Oleg Ivanov on 6/27/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger, VoucherStateType) 12 | { 13 | Online, 14 | Offline, 15 | NotConsumed 16 | }; 17 | 18 | @interface PMVoucher : NSObject 19 | 20 | //@property (nonatomic, strong) Transaction *transaction; 21 | @property (nonatomic) BOOL isCreditCard; 22 | @property (nonatomic, strong) UIImage *voucherImage; 23 | @property (nonatomic, strong) UIImage *voucherBigImage; 24 | @property (nonatomic, strong) NSString *voucherAmount; 25 | @property (nonatomic, strong) NSString *voucherCurrency; 26 | @property (nonatomic, strong) NSString *voucherDescrpition; 27 | @property (nonatomic, strong) NSString *voucherCreationDate; 28 | @property (nonatomic, strong) NSString *voucherStatus; 29 | @property (nonatomic, strong) NSString *voucherCreditCardNumber; 30 | @property (nonatomic, strong) NSString *voucherCreditCardType; 31 | @property (nonatomic, strong) NSString *voucherAccount; 32 | @property (nonatomic, strong) NSString *voucherBankCode; 33 | @property (nonatomic, strong) NSString *transactionId; 34 | @property (nonatomic) VoucherStateType voucherType; 35 | 36 | - (id)initWithVoucherAmount:(NSString *)aVoucherAmount andCurrency:(NSString *)aVoucherCurrency andImage:(UIImage *)aVoucherImage andBigImage:(UIImage *)aVoucherBigImage andDescription:(NSString *)aVoucherDescrpition andDate:(NSString *) aVoucherCreationDate andStatus:(NSString *)aVoucherStatus andIsCreditCard:(BOOL) aIsCreditCard andCreditCardNumber:(NSString *)aVoucherCreditCardNumber andCreditCardType:(NSString *)aVoucherCreditCardType andVoucherAccount:(NSString *)aVoucherAccount andVoucherBankCode:(NSString *)aVoucherBankCode; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Model/PMVoucher.m: -------------------------------------------------------------------------------- 1 | // 2 | // Voucher.m 3 | // VoucherMill 4 | // 5 | // Created by Oleg Ivanov on 6/27/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMVoucher.h" 10 | 11 | @implementation PMVoucher 12 | 13 | @synthesize voucherImage,voucherType, isCreditCard, voucherAccount, voucherAmount, voucherBankCode, voucherBigImage, voucherCreationDate, voucherCreditCardNumber, voucherCreditCardType, voucherCurrency, voucherDescrpition, voucherStatus, transactionId; 14 | 15 | - (id)initWithVoucherAmount:(NSString *)aVoucherAmount andCurrency:(NSString *)aVoucherCurrency andImage:(UIImage *)aVoucherImage andBigImage:(UIImage *)aVoucherBigImage andDescription:(NSString *)aVoucherDescrpition andDate:(NSString *) aVoucherCreationDate andStatus:(NSString *) aVoucherStatus andIsCreditCard:(BOOL) aIsCreditCard andCreditCardNumber:(NSString *)aVoucherCreditCardNumber andCreditCardType:(NSString *)aVoucherCreditCardType andVoucherAccount:(NSString *)aVoucherAccount andVoucherBankCode:(NSString *)aVoucherBankCode 16 | { 17 | self = [super init]; 18 | if (self) { 19 | self.voucherAmount = aVoucherAmount; 20 | self.voucherCurrency = aVoucherCurrency; 21 | self.voucherImage = aVoucherImage; 22 | self.voucherBigImage = aVoucherBigImage; 23 | self.voucherDescrpition = aVoucherDescrpition; 24 | self.voucherCreationDate = aVoucherCreationDate; 25 | self.voucherStatus = aVoucherStatus; 26 | self.isCreditCard = aIsCreditCard; 27 | self.voucherCreditCardNumber = aVoucherCreditCardNumber; 28 | self.voucherCreditCardType = aVoucherCreditCardType; 29 | self.voucherAccount = aVoucherAccount; 30 | self.voucherBankCode = aVoucherBankCode; 31 | } 32 | return self; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Navigation/PMNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMNavigationController.h 3 | // VoucherMill 4 | // 5 | // Created by Oleg Ivanov on 7/2/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PMNavigationController : UINavigationController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Navigation/PMNavigationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMNavigationController.m 3 | // VoucherMill 4 | // 5 | // Created by Oleg Ivanov on 7/2/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMNavigationController.h" 10 | #define lightOrangeColor [UIColor colorWithRed:239.0/255.0 green:80/255.0 blue:0/255.0 alpha:1.0] 11 | 12 | @interface PMNavigationController () 13 | 14 | @end 15 | 16 | @implementation PMNavigationController 17 | 18 | - (void)viewDidLoad 19 | { 20 | [super viewDidLoad]; 21 | [self.navigationBar setTintColor:[UIColor whiteColor]]; 22 | UIFont *font = [UIFont boldSystemFontOfSize:20.0f]; 23 | NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:font, UITextAttributeFont, lightOrangeColor, UITextAttributeTextColor,nil]; 24 | [self.navigationBar setTitleTextAttributes:attrs]; 25 | 26 | } 27 | 28 | - (void)didReceiveMemoryWarning 29 | { 30 | [super didReceiveMemoryWarning]; 31 | // Dispose of any resources that can be recreated. 32 | } 33 | 34 | - (BOOL)shouldAutorotate 35 | { 36 | return YES; 37 | } 38 | 39 | - (NSUInteger)supportedInterfaceOrientations 40 | { 41 | return UIInterfaceOrientationMaskAll; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Purchases/PMButtonCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMButtonCell.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 9/5/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PMButtonCell : UITableViewCell 12 | 13 | @property (weak, nonatomic) IBOutlet UIButton *submitButton; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Purchases/PMButtonCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMButtonCell.m 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 9/5/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMButtonCell.h" 10 | #import 11 | #import "Constants.h" 12 | 13 | /**************************************/ 14 | #pragma mark - Class Implementation 15 | /**************************************/ 16 | @implementation PMButtonCell 17 | 18 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 19 | { 20 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 21 | if (self) { 22 | // Initialization code 23 | } 24 | return self; 25 | } 26 | 27 | /**************************************/ 28 | #pragma mark - 29 | /**************************************/ 30 | - (void)awakeFromNib 31 | { 32 | [super awakeFromNib]; 33 | 34 | [self.submitButton setTitle:@"Submit" forState:UIControlStateNormal]; 35 | [self.submitButton.titleLabel setFont:[UIFont boldSystemFontOfSize:20.0f]]; 36 | [self.submitButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 37 | [self.submitButton setBackgroundImage:[UIImage imageNamed:@"button_backgroundimage"] forState:UIControlStateNormal]; 38 | [self.submitButton setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted]; 39 | [self.submitButton setBackgroundImage:[UIImage imageNamed:@"selectedbutton_backgroundimage"] forState:UIControlStateHighlighted]; 40 | [self.submitButton.layer setMasksToBounds:YES]; 41 | [self.submitButton.layer setBorderWidth:2.0f]; 42 | [self.submitButton.layer setBorderColor:darkOrangeColor.CGColor]; 43 | [self.submitButton.layer setCornerRadius:10.0f]; 44 | } 45 | 46 | /**************************************/ 47 | #pragma mark - 48 | /**************************************/ 49 | - (void)layoutSubviews 50 | { 51 | [super layoutSubviews]; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Purchases/PMBuyChildCustomCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMBuyChildCustomCell.h 3 | // VoucherMill 4 | // 5 | // Created by Oleg Ivanov on 8/8/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol PMBuyChildCustomCellDelegate; 12 | 13 | @interface PMBuyChildCustomCell : UITableViewCell 14 | 15 | @property (weak, nonatomic) IBOutlet UITextField *customValue; 16 | @property (nonatomic, strong) NSString *customValueLabelTitle; 17 | @property (nonatomic, weak) NSObject * delegate; 18 | 19 | @end 20 | 21 | @protocol PMBuyChildCustomCellDelegate 22 | 23 | @optional 24 | 25 | - (void)buyChildCustomCell:(PMBuyChildCustomCell*)buyChildCustomCell 26 | doneButtonWasSelected:(UIBarButtonItem*)button; 27 | 28 | @end -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Purchases/PMBuyChildCustomCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMBuyChildCustomCell.m 3 | // VoucherMill 4 | // 5 | // Created by Oleg Ivanov on 8/8/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMBuyChildCustomCell.h" 10 | #import 11 | #import "Constants.h" 12 | #define kLabelFontSize 14 13 | @interface PMBuyChildCustomCell () 14 | 15 | @property (weak, nonatomic) IBOutlet UILabel *customValueLabel; 16 | @property (strong, nonatomic) UIToolbar *keyBar; 17 | @property (strong, nonatomic) UITextField *editedField; 18 | @property (nonatomic) NSInteger lastSegmentIndex; 19 | 20 | @end 21 | 22 | @implementation PMBuyChildCustomCell 23 | 24 | @synthesize customValue, customValueLabel, customValueLabelTitle, keyBar, editedField, lastSegmentIndex; 25 | 26 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 27 | { 28 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 29 | if (self) { 30 | //this method is never called with prototype cells with reuse identifiers 31 | } 32 | 33 | return self; 34 | } 35 | 36 | - (void)awakeFromNib 37 | { 38 | [super awakeFromNib]; 39 | 40 | [customValueLabel setTextColor:lightOrangeColor]; 41 | [customValueLabel setFont:[UIFont boldSystemFontOfSize:kLabelFontSize]]; 42 | [customValue setBorderStyle:UITextBorderStyleRoundedRect]; 43 | [customValue setFont:[UIFont systemFontOfSize:15.0]]; 44 | [customValue setTextColor:[UIColor blackColor]]; 45 | [customValue setTextAlignment:NSTextAlignmentCenter]; 46 | [customValue setBackgroundColor:[UIColor clearColor]]; 47 | 48 | customValue.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; 49 | UIColor *color = [[UIColor alloc]initWithRed:149/255.0f green:0/255.0f blue:11/255.0f alpha:1 ]; 50 | customValue.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"Enter custom value" attributes:@{NSForegroundColorAttributeName: color}]; 51 | 52 | // Do any additional setup after loading the view 53 | //Create Prev/Next+Done tab bar to keyboard 54 | self.keyBar = [[UIToolbar alloc] init]; 55 | [self.keyBar setBarStyle:UIBarStyleBlackTranslucent]; 56 | [self.keyBar sizeToFit]; 57 | 58 | UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done:)]; 59 | 60 | UISegmentedControl *segControl = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"Previous", @"Next", nil]]; 61 | [segControl setSegmentedControlStyle:UISegmentedControlStyleBar]; 62 | segControl.selectedSegmentIndex = -1; 63 | [segControl addTarget:self action:@selector(segSelected:) forControlEvents:UIControlEventValueChanged]; 64 | 65 | UIBarButtonItem *flexButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil]; 66 | 67 | UIBarButtonItem* segButton = [[UIBarButtonItem alloc] initWithCustomView:segControl]; 68 | 69 | NSArray *itemArray = [NSArray arrayWithObjects:segButton, flexButton, doneButton, nil]; 70 | 71 | [keyBar setItems:itemArray]; 72 | 73 | [customValue setInputAccessoryView:keyBar]; 74 | 75 | //customValue.delegate = self; 76 | 77 | customValue.keyboardType = UIKeyboardTypeDefault; 78 | 79 | keyBar.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 80 | } 81 | 82 | 83 | -(void)layoutSubviews 84 | { 85 | [super layoutSubviews]; 86 | 87 | [customValueLabel setText:customValueLabelTitle]; 88 | } 89 | 90 | -(void)segSelected:(id)sender 91 | { 92 | UISegmentedControl *segCtlr = (UISegmentedControl *)sender; 93 | 94 | int newtag = (int)self.tag; 95 | if(segCtlr.selectedSegmentIndex == 1) { 96 | newtag += 1; 97 | } 98 | else { 99 | if(newtag > 0) 100 | newtag -= 1; 101 | } 102 | 103 | PMBuyChildCustomCell *nextCell = (PMBuyChildCustomCell *)[self.superview viewWithTag:newtag]; 104 | if([nextCell isKindOfClass:[PMBuyChildCustomCell class]]) { 105 | [nextCell.customValue becomeFirstResponder]; 106 | } 107 | else { 108 | [self.customValue resignFirstResponder]; 109 | } 110 | 111 | segCtlr.selectedSegmentIndex = -1; 112 | //lastSegmentIndex = segCtlr.selectedSegmentIndex; 113 | } 114 | 115 | 116 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 117 | { 118 | [super setSelected:selected animated:animated]; 119 | 120 | // Configure the view for the selected state 121 | } 122 | 123 | -(void)done:(id)sender 124 | { 125 | if ([self.delegate respondsToSelector:@selector(buyChildCustomCell:doneButtonWasSelected:)]) { 126 | [self.delegate buyChildCustomCell:self doneButtonWasSelected:sender]; 127 | } 128 | } 129 | 130 | @end 131 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Purchases/PMBuyContainerController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMBuyViewController.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 7/3/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PMBuyTableViewController.h" 11 | 12 | @interface PMBuyContainerController : UIViewController 13 | 14 | - (PMBuyTableViewController *)viewControllerAtIndex:(NSUInteger)pageIndex; 15 | 16 | @property (nonatomic, strong) UIPageViewController *pageVC; 17 | @property (nonatomic) BOOL isToken; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Purchases/PMBuyDetailsErrorMessageCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMBuyDetailsErrorMessageCell.h 3 | // VoucherMill 4 | // 5 | // Created by Oleg Ivanov on 7/15/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PMBuyDetailsErrorMessageCell : UITableViewCell 12 | 13 | @property (nonatomic, strong) NSString* cellText; 14 | @property (nonatomic, strong) NSString* titleText; 15 | @property (nonatomic, strong) UIFont* font; 16 | 17 | 18 | + (CGSize)labelSizeForText:(NSString*)text 19 | maxWidth:(CGFloat)width; 20 | @end 21 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Purchases/PMBuyDetailsErrorMessageCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMBuyDetailsErrorMessageCell.m 3 | // VoucherMill 4 | // 5 | // Created by Oleg Ivanov on 7/15/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMBuyDetailsErrorMessageCell.h" 10 | 11 | /**************************************/ 12 | #pragma mark - Class Extension 13 | /**************************************/ 14 | @interface PMBuyDetailsErrorMessageCell () 15 | 16 | @property (weak, nonatomic) IBOutlet UILabel *cellTitle; 17 | @property (weak, nonatomic) IBOutlet UILabel *cellMessage; 18 | 19 | @end 20 | 21 | /**************************************/ 22 | #pragma mark - Class Implementation 23 | /**************************************/ 24 | @implementation PMBuyDetailsErrorMessageCell 25 | 26 | @synthesize titleText, cellText, font; 27 | 28 | + (CGSize)labelSizeForText:(NSString*)text 29 | maxWidth:(CGFloat)width 30 | { 31 | CGSize maximumSize = CGSizeMake(width, 10000); 32 | CGSize labelHeightSize = [text sizeWithFont:[UIFont systemFontOfSize:20.0f] 33 | constrainedToSize:maximumSize 34 | lineBreakMode:NSLineBreakByWordWrapping]; 35 | labelHeightSize.height = MAX(labelHeightSize.height, 44.0); 36 | return labelHeightSize; 37 | } 38 | 39 | /**************************************/ 40 | #pragma mark - Init 41 | /**************************************/ 42 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 43 | { 44 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 45 | if (self) { 46 | // Initialization code 47 | } 48 | return self; 49 | } 50 | 51 | /**************************************/ 52 | #pragma mark - 53 | /**************************************/ 54 | - (void)awakeFromNib 55 | { 56 | [super awakeFromNib]; 57 | 58 | UIFont* labelFont = [UIFont boldSystemFontOfSize:15.0f]; 59 | 60 | self.cellTitle.font = labelFont; 61 | self.cellMessage.font = labelFont; 62 | self.cellTitle.textColor = [UIColor whiteColor]; 63 | self.cellMessage.textColor = [UIColor colorWithRed:149.0/255.0 green:0/255.0 blue:11.0/255.0 alpha:1.0]; 64 | } 65 | 66 | /**************************************/ 67 | #pragma mark - 68 | /**************************************/ 69 | - (void)layoutSubviews 70 | { 71 | [super layoutSubviews]; 72 | 73 | self.cellTitle.text = self.titleText; 74 | self.cellMessage.text = self.cellText; 75 | 76 | CGRect frame = self.cellMessage.frame; 77 | frame.size.height = [PMBuyDetailsErrorMessageCell labelSizeForText:self.cellText 78 | maxWidth:CGRectGetWidth(self.cellMessage.bounds)].height; 79 | self.cellMessage.frame = frame; 80 | } 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Purchases/PMBuyDetailsViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMBuyDetailsViewController.h 3 | // VoucherMill 4 | // 5 | // Created by Oleg Ivanov on 7/15/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PMVoucher.h" 11 | #import 12 | 13 | @interface PMBuyDetailsViewController : UIViewController 14 | 15 | @property (nonatomic, strong) NSError *buyError; 16 | @property (nonatomic, strong) PMVoucher *buyVoucher; 17 | @property (nonatomic, strong) NSString *token; 18 | @property (nonatomic, weak) IBOutlet UITableView *detailsTable; 19 | @property (strong, nonatomic) NSMutableArray *detailsList; 20 | @property (weak, nonatomic) IBOutlet UILabel *resultLabel; 21 | 22 | - (IBAction)donePressed:(UIBarButtonItem *)sender; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Purchases/PMBuyTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMBuyTableViewController.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 9/5/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PMBuyChildCustomCell.h" 11 | #import "PMPaymentViewController.h" 12 | #import "PMBuyChildCustomCell.h" 13 | 14 | @interface PMBuyTableViewController : UITableViewController 15 | 16 | @property (nonatomic) NSUInteger index; 17 | @property (nonatomic) PMPaymentType PMAction; 18 | @property (nonatomic) BOOL isVisible; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Purchases/PMImageViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMImageViewCell.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 8/22/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PMImageViewCell : UITableViewCell 12 | @property UIImage *image; 13 | @end 14 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Purchases/PMImageViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMImageViewCell.m 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 8/22/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMImageViewCell.h" 10 | @interface PMImageViewCell () 11 | @property (weak, nonatomic) IBOutlet UIImageView *customImageView; 12 | @end 13 | @implementation PMImageViewCell 14 | 15 | @synthesize image, customImageView; 16 | 17 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 18 | { 19 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 20 | if (self) { 21 | //this method is never called with prototype cells with reuse identifiers 22 | } 23 | return self; 24 | } 25 | 26 | -(void)layoutSubviews 27 | { 28 | [super layoutSubviews]; 29 | [customImageView setImage:image]; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Purchases/PMImageViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Purchases/PMVoucherParams.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMPayParams.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 5/9/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PMPaymentViewController.h" 11 | 12 | @interface PMVoucherParams : NSObject 13 | //@property (nonatomic) bool isPreuthorization; 14 | @property (nonatomic) PMPaymentType action; 15 | @property (nonatomic) int voucherValue; 16 | @property (nonatomic, strong) NSString *currency; 17 | @property (nonatomic, strong) NSString *publicKey; 18 | @property (nonatomic, strong) NSString *description; 19 | @property (nonatomic) BOOL isTestMode; 20 | + (PMVoucherParams*) instance; 21 | @end 22 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Purchases/PMVoucherParams.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMVoucherParams.m 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 5/9/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMVoucherParams.h" 10 | 11 | @implementation PMVoucherParams 12 | 13 | @synthesize action; 14 | @synthesize voucherValue; 15 | @synthesize currency; 16 | @synthesize description; 17 | @synthesize publicKey; 18 | @synthesize isTestMode; 19 | static PMVoucherParams *params = nil; 20 | 21 | +(PMVoucherParams*) instance 22 | { 23 | //Singleton pattern 24 | //Static local predicate must be initialized to 0 25 | 26 | static dispatch_once_t onceToken = 0; 27 | dispatch_once(&onceToken, ^{ 28 | params = [[PMVoucherParams alloc] init]; 29 | }); 30 | 31 | return params; 32 | } 33 | @end 34 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/Icon-120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/Icon-120.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/Icon-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/Icon-152.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/Icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/Icon-60.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/Icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/Icon-76.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/Icon-Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/Icon-Small.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/Icon-Small@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/burger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/burger.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/burger@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/burger@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/burger_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/burger_big.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/burger_big@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/burger_big@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/button_backgroundimage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/button_backgroundimage.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/button_backgroundimage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/button_backgroundimage@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/buy_voucher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/buy_voucher.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/buy_voucher@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/buy_voucher@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/buy_voucher_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/buy_voucher_pressed.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/buy_voucher_pressed@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/buy_voucher_pressed@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/custom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/custom.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/custom@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/custom@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/custom_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/custom_big.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/custom_big@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/custom_big@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/divider_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/divider_selected.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/divider_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/divider_selected@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/logo.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/logo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/logo@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/not_consumed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/not_consumed.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/not_consumed@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/not_consumed@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/not_consumed_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/not_consumed_pressed.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/not_consumed_pressed@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/not_consumed_pressed@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/offline_vouchers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/offline_vouchers.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/offline_vouchers@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/offline_vouchers@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/offline_vouchers_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/offline_vouchers_pressed.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/offline_vouchers_pressed@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/offline_vouchers_pressed@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/online_vouchers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/online_vouchers.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/online_vouchers@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/online_vouchers@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/online_vouchers_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/online_vouchers_pressed.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/online_vouchers_pressed@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/online_vouchers_pressed@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/selectedbutton_backgroundimage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/selectedbutton_backgroundimage.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/selectedbutton_backgroundimage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/selectedbutton_backgroundimage@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/tickets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/tickets.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/tickets@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/tickets@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/tickets_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/tickets_big.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/tickets_big@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/tickets_big@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/tyre.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/tyre.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/tyre@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/tyre@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/tyre_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/tyre_big.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Resources/tyre_big@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paymill/paymill-ios/0fcfea42a88ef2f9de14320968c792c1f51e3809/samples/vouchermill/VoucherMill/Resources/tyre_big@2x.png -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Utils/PMConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMConstants.h 3 | // VoucherMill 4 | // 5 | // Created by gabi on 6/24/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | /**************************************/ 11 | #pragma mark - PAYMILL 12 | /**************************************/ 13 | extern NSString* const myPublicKey; 14 | 15 | /**************************************/ 16 | #pragma mark - UI 17 | /**************************************/ 18 | extern NSString* const kPMStringOk; 19 | extern NSString* const kPMStringNo; 20 | extern NSString* const kPMStringYes; 21 | extern NSString* const kPMStringForgot; 22 | extern NSString* const kPMStringSubmit; 23 | extern NSString* const kPMStringCancel; 24 | extern NSString* const kPMStringError; 25 | 26 | extern NSString* const kPMTitleCreditCard; 27 | extern NSString* const kPMTitleDirectDebit; 28 | 29 | extern NSString* const kPMStringPrevious; 30 | extern NSString* const kPMStringNext; 31 | extern NSString* const kPMStringBack; 32 | extern NSString* const kPMStringErrorType; 33 | 34 | extern NSString* const kPMPaymentTypeCreditCard; 35 | 36 | extern NSString* const kPMCardTypeVisa; 37 | extern NSString* const kPMCardTypeMasterCard; 38 | extern NSString* const kPMCardTypeMaestro; 39 | extern NSString* const kPMCardTypeAmExp; 40 | extern NSString* const kPMCardTypeJCB; 41 | extern NSString* const kPMCardTypeDiners; 42 | extern NSString* const kPMCardTypeDiscover; 43 | extern NSString* const kPMCardTypeUnionPay; 44 | extern NSString* const kPMTypeAmericanExp; 45 | 46 | extern NSString* const kPMSafeStoreResetMessage; 47 | extern NSString* const kPMPaymentNotDeletedMessage; 48 | extern NSString* const kPMDeletePaymentMessage; 49 | extern NSString* const kPMPaymentSavedMessage; 50 | extern NSString* const kPMIncorrectPasswordMessage; 51 | extern NSString* const kPMInvalidPasswordMessage; 52 | 53 | extern NSString* const kPMEnterNameMessage; 54 | extern NSString* const kPMIncorrectCCNumberMessage; 55 | extern NSString* const kPMIncorrectCVCMessage; 56 | extern NSString* const kPMIncorrectExpDateMessage; 57 | extern NSString* const kPMIncorrectIBANMessage; 58 | extern NSString* const kPMIncorrectBICMessage; 59 | extern NSString* const kPMLongCCNumberMessage; 60 | extern NSString* const kPMEnterPasswordMessage; 61 | extern NSString* const kPMSavePaymentMessage; 62 | extern NSString* const kPMUseExistingPaymentMessage; 63 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Utils/PMConstants.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMConstants.m 3 | // VoucherMill 4 | // 5 | // Created by gabi on 6/24/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMConstants.h" 10 | 11 | NSString* const myPublicKey = @"4369741839217a7d10cbed5d417715f4";//@""; 12 | 13 | NSString* const kPMStringOk = @"Ok"; 14 | NSString* const kPMStringNo = @"No"; 15 | NSString* const kPMStringYes = @"Yes"; 16 | NSString* const kPMStringForgot = @"Forgot"; 17 | NSString* const kPMStringSubmit = @"Submit"; 18 | NSString* const kPMStringCancel = @"Cancel"; 19 | NSString* const kPMStringError = @"Error"; 20 | 21 | NSString* const kPMTitleCreditCard = @"Credit Card"; 22 | NSString* const kPMTitleDirectDebit = @"Direct Debit"; 23 | 24 | NSString* const kPMStringPrevious = @"Previous"; 25 | NSString* const kPMStringNext = @"Next"; 26 | NSString* const kPMStringBack = @"Back"; 27 | NSString* const kPMStringErrorType = @"ErrorType"; 28 | 29 | NSString* const kPMPaymentTypeCreditCard = @"creditcard"; 30 | 31 | NSString* const kPMCardTypeVisa = @"visa"; 32 | NSString* const kPMCardTypeMasterCard = @"mastercard"; 33 | NSString* const kPMCardTypeMaestro = @"maestro"; 34 | NSString* const kPMCardTypeAmExp = @"amex"; 35 | NSString* const kPMCardTypeJCB = @"jcb"; 36 | NSString* const kPMCardTypeDiners = @"diners"; 37 | NSString* const kPMCardTypeDiscover = @"discover"; 38 | NSString* const kPMCardTypeUnionPay = @"china_union_pay"; 39 | NSString* const kPMTypeAmericanExp = @"American Express"; 40 | 41 | NSString* const kPMSafeStoreResetMessage = @"Safe Store reset successful!"; 42 | NSString* const kPMPaymentNotDeletedMessage = @"Incorrect password! Payment not deleted!"; 43 | NSString* const kPMDeletePaymentMessage = @"Are you sure you want to delete this payment?"; 44 | NSString* const kPMPaymentSavedMessage = @"Your payment is saved successfully!"; 45 | NSString* const kPMIncorrectPasswordMessage = @"Incorrect password! Try again!"; 46 | NSString* const kPMInvalidPasswordMessage = @"Invalid password!"; 47 | NSString* const kPMEnterNameMessage = @"Please enter a name!"; 48 | NSString* const kPMIncorrectCCNumberMessage = @"Incorrect credit card number!"; 49 | NSString* const kPMIncorrectCVCMessage = @"Incorrect card verification code!"; 50 | NSString* const kPMIncorrectExpDateMessage = @"Incorrect expiration date!"; 51 | NSString* const kPMIncorrectIBANMessage = @"Incorrect IBAN number!"; 52 | NSString* const kPMIncorrectBICMessage = @"Incorrect BIC code"; 53 | NSString* const kPMLongCCNumberMessage = @"Credit card number is too long for recognized credit card type"; 54 | NSString* const kPMEnterPasswordMessage = @"Enter your password!"; 55 | NSString* const kPMSavePaymentMessage = @"Do you want to save this payment?"; 56 | NSString* const kPMUseExistingPaymentMessage = @"Do you want to use an existing payment?"; 57 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Utils/PMUISupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMUISupport.h 3 | // VoucherMill 4 | // 5 | // Created by gabi on 3/19/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum PMAlertType : NSInteger 12 | { 13 | PMAlertTypeNone = 0, 14 | PMAlertTypeEnterPassword = 1, 15 | PMAlertTypeEnterPasswordForMethosList = 2, 16 | PMAlertTypeSavePayment = 3, 17 | PMAlertTypeExistingPayment = 4, 18 | PMAlertTypeDeletePayment = 5 19 | }PMAlertType; 20 | 21 | @interface PMUISupport : NSObject 22 | 23 | + (void)showYesNOAlertWithMessage:(NSString*)message tag:(NSInteger)tag andDelegate:(id)delegate; 24 | + (void)showPasswordAlertWithMessage:(NSString *)message tag:(NSInteger)tag andDelegate:(id)delegate;; 25 | + (void)showAlertWithMessage:(NSString *)message; 26 | + (void)showErrorAlertWithMessage:(NSString *)message; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Utils/PMUISupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMUISupport.m 3 | // VoucherMill 4 | // 5 | // Created by gabi on 3/19/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMUISupport.h" 10 | 11 | @implementation PMUISupport 12 | 13 | + (void)showYesNOAlertWithMessage:(NSString*)message tag:(NSInteger)tag andDelegate:(id)delegate; 14 | { 15 | 16 | UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"" 17 | message:message 18 | delegate:delegate 19 | cancelButtonTitle:kPMStringNo 20 | otherButtonTitles:kPMStringYes, nil]; 21 | alert.tag = tag; 22 | 23 | [alert show]; 24 | } 25 | 26 | + (void)showPasswordAlertWithMessage:(NSString *)message tag:(NSInteger)tag andDelegate:(id)delegate 27 | { 28 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" 29 | message:message 30 | delegate:delegate 31 | cancelButtonTitle:kPMStringForgot 32 | otherButtonTitles:kPMStringOk, nil]; 33 | alert.tag = tag; 34 | alert.alertViewStyle = UIAlertViewStyleSecureTextInput; 35 | [alert show]; 36 | } 37 | 38 | + (void)showAlertWithMessage:(NSString *)message 39 | { 40 | UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"" 41 | message:message 42 | delegate:nil 43 | cancelButtonTitle:kPMStringOk 44 | otherButtonTitles:nil]; 45 | 46 | [alert show]; 47 | } 48 | 49 | + (void)showErrorAlertWithMessage:(NSString *)message 50 | { 51 | UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Error" 52 | message:message 53 | delegate:nil 54 | cancelButtonTitle:kPMStringOk 55 | otherButtonTitles:nil]; 56 | 57 | [alert show]; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Utils/PMUserDefaultsManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMUserDefaultsManager.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 9/12/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PMUserDefaultsManager : NSObject 12 | 13 | + (id)instance; 14 | 15 | - (BOOL)isAutoConsumed; 16 | 17 | - (NSArray *)getActiveCards; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Utils/PMUserDefaultsManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMUserDefaultsManager.m 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 9/12/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMUserDefaultsManager.h" 10 | 11 | @implementation PMUserDefaultsManager 12 | static PMUserDefaultsManager* sharedInstance; 13 | 14 | /**************************************/ 15 | #pragma mark - instance 16 | /**************************************/ 17 | + (id)instance 18 | { 19 | static dispatch_once_t onceToken; 20 | dispatch_once(&onceToken, ^{ 21 | sharedInstance = [[self alloc] init]; 22 | }); 23 | 24 | return sharedInstance; 25 | } 26 | 27 | + (id)alloc 28 | { 29 | if (!sharedInstance) { 30 | sharedInstance = [ super alloc ]; 31 | } 32 | 33 | return sharedInstance; 34 | } 35 | 36 | - (id)init 37 | { 38 | if ( nil != sharedInstance ) 39 | return sharedInstance; 40 | 41 | if ( nil != (self = [super init])) { 42 | } 43 | 44 | return self; 45 | } 46 | 47 | /**************************************/ 48 | #pragma mark - 49 | /**************************************/ 50 | - (BOOL)isAutoConsumed 51 | { 52 | return [[NSUserDefaults standardUserDefaults] objectForKey:@"auto-consume"] == nil ? YES : [[NSUserDefaults standardUserDefaults] boolForKey:@"auto-consume"]; 53 | } 54 | 55 | - (NSArray *)getActiveCards 56 | { 57 | NSMutableArray *activeCards = [NSMutableArray array]; 58 | NSString* path = [[NSBundle mainBundle] pathForResource:@"CardsData" 59 | ofType:@"plist"]; 60 | NSDictionary* data = [[NSDictionary alloc] initWithContentsOfFile:path]; 61 | 62 | NSArray *cards = [data objectForKey:@"Cards"]; 63 | 64 | for (NSDictionary *cc in cards) { 65 | NSString *cardName = [cc valueForKey:@"cardName"]; 66 | BOOL active = [[NSUserDefaults standardUserDefaults] objectForKey:cardName] == nil ? YES : [[NSUserDefaults standardUserDefaults] boolForKey:cardName]; 67 | if(active) { 68 | [activeCards addObject:cardName]; 69 | } 70 | } 71 | 72 | return activeCards; 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Utils/PMVoucherUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMVoucherUtils.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 9/11/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PMVoucher.h" 11 | #import 12 | #import "Constants.h" 13 | #import "OfflineVoucher.h" 14 | @interface PMVoucherUtils : NSObject 15 | +(NSString*)timeStampAsString:(NSInteger)timestamp; 16 | +(PMVoucher *)voucherFromPMObject:(id)pmObject; 17 | +(PMVoucher *)voucherFromOfflineVoucher:(OfflineVoucher *)offlineVoucher; 18 | +(void)showErrorAlertWithTitle:(NSString*)title errorType:(PMErrorType)type errorMessage:(NSString*)message; 19 | @end 20 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/Utils/PMVoucherUtils.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMVoucherUtils.m 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 9/11/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMVoucherUtils.h" 10 | 11 | @implementation PMVoucherUtils 12 | +(NSString*)timeStampAsString:(NSInteger)timestamp { 13 | NSDate *createdAtDate = [NSDate dateWithTimeIntervalSince1970:timestamp]; 14 | NSDateFormatter *formatter; 15 | NSString *dateString; 16 | formatter = [[NSDateFormatter alloc] init]; 17 | [formatter setDateFormat:@"dd-MM-yyyy HH:mm"]; 18 | dateString = [formatter stringFromDate:createdAtDate]; 19 | return dateString; 20 | } 21 | +(PMVoucher *)voucherFromPMObject:(id)pmObject { 22 | PMVoucher *voucher; 23 | UIImage *image; 24 | UIImage *bigImage; 25 | NSString *desc = @"preauth"; 26 | NSString *currency; 27 | NSString *amount; 28 | NSString *status; 29 | NSString *createdAt; 30 | NSString *creditCardNumber; 31 | NSString *creditCardType; 32 | NSString *account; 33 | NSString *bankCode; 34 | 35 | if([pmObject isKindOfClass:[PMPreauthorization class]]) { 36 | currency = ((PMPreauthorization *)pmObject).currency; 37 | amount = ((PMPreauthorization *)pmObject).amount; 38 | status = ((PMPreauthorization *)pmObject).status; 39 | createdAt = [PMVoucherUtils timeStampAsString:((PMPreauthorization *)pmObject).created_at.intValue]; 40 | creditCardNumber = ((PMPreauthorization *)pmObject).payment.last4; 41 | creditCardType = ((PMPreauthorization *)pmObject).payment.card_type; 42 | account = ((PMPreauthorization *)pmObject).payment.account; 43 | bankCode = ((PMPreauthorization *)pmObject).payment.code; 44 | } else if([pmObject isKindOfClass:[PMTransaction class]]) { 45 | desc = ((PMTransaction *)pmObject).description; 46 | currency = ((PMTransaction *)pmObject).currency; 47 | amount = ((PMTransaction *)pmObject).amount; 48 | status = ((PMTransaction *)pmObject).status; 49 | createdAt = [PMVoucherUtils timeStampAsString:((PMTransaction *)pmObject).created_at]; 50 | creditCardNumber = ((PMTransaction *)pmObject).payment.last4; 51 | creditCardType = ((PMTransaction *)pmObject).payment.card_type; 52 | account = ((PMTransaction *)pmObject).payment.account; 53 | bankCode = ((PMTransaction *)pmObject).payment.code; 54 | } 55 | else { 56 | return nil; 57 | } 58 | if([desc isEqualToString:@"preauth"]) { 59 | image = [UIImage imageNamed:kCustom]; 60 | bigImage = [UIImage imageNamed:kCustomBig]; 61 | } 62 | else if([desc isEqualToString:kTickets]) { 63 | image = [UIImage imageNamed:kTickets]; 64 | bigImage = [UIImage imageNamed:kTicketsBig]; 65 | } 66 | else if([desc isEqualToString:kBurger]) { 67 | image = [UIImage imageNamed:kBurger]; 68 | bigImage = [UIImage imageNamed:kBurgerBig]; 69 | } 70 | else if([desc isEqualToString:kTyre]) { 71 | image = [UIImage imageNamed:kTyre]; 72 | bigImage = [UIImage imageNamed:kTyreBig]; 73 | } 74 | else if([desc isEqualToString:kCustom]){ 75 | image = [UIImage imageNamed:kCustom]; 76 | bigImage = [UIImage imageNamed:kCustomBig]; 77 | } 78 | 79 | voucher = [[PMVoucher alloc] initWithVoucherAmount:amount andCurrency:currency andImage:image andBigImage:bigImage andDescription:desc andDate:createdAt andStatus:status /*only temporary!!!*/andIsCreditCard:YES andCreditCardNumber:creditCardNumber andCreditCardType:creditCardType andVoucherAccount:account andVoucherBankCode:bankCode]; 80 | 81 | if([pmObject isKindOfClass:[PMTransaction class]]){ 82 | voucher.transactionId = ((PMTransaction *)pmObject).id; 83 | } 84 | 85 | return voucher; 86 | } 87 | 88 | +(PMVoucher *)voucherFromOfflineVoucher:(OfflineVoucher *)offlineVoucher { 89 | UIImage *image; 90 | UIImage *bigImage; 91 | NSString *currency = offlineVoucher.currency; 92 | NSString *amount = offlineVoucher.amount; 93 | NSString *desc = offlineVoucher.descript; 94 | 95 | if([desc isEqualToString:kTickets]) { 96 | image = [UIImage imageNamed:kTickets]; 97 | bigImage = [UIImage imageNamed:kTicketsBig]; 98 | } 99 | else if([desc isEqualToString:kBurger]) { 100 | image = [UIImage imageNamed:kBurger]; 101 | bigImage = [UIImage imageNamed:kBurgerBig]; 102 | } 103 | else if([desc isEqualToString:kTyre]) { 104 | image = [UIImage imageNamed:kTyre]; 105 | bigImage = [UIImage imageNamed:kTyreBig]; 106 | } 107 | else if([desc isEqualToString:kCustom]){ 108 | image = [UIImage imageNamed:kCustom]; 109 | bigImage = [UIImage imageNamed:kCustomBig]; 110 | } 111 | 112 | PMVoucher* voucher = [[PMVoucher alloc] initWithVoucherAmount:amount andCurrency:currency andImage:image andBigImage:bigImage andDescription:desc andDate:nil andStatus:nil /*only temporary!!!*/andIsCreditCard:YES andCreditCardNumber:nil andCreditCardType:nil andVoucherAccount:nil andVoucherBankCode:nil]; 113 | 114 | return voucher; 115 | } 116 | 117 | +(void)showErrorAlertWithTitle:(NSString*)title errorType:(PMErrorType)type errorMessage:(NSString*)message { 118 | 119 | UIAlertView *plistAlert = [[UIAlertView alloc] 120 | initWithTitle:[NSString stringWithFormat:@"%@ %ld", title, type] 121 | message:message 122 | delegate:nil 123 | cancelButtonTitle:nil 124 | otherButtonTitles:@"OK",nil]; 125 | [plistAlert show]; 126 | 127 | } 128 | 129 | @end 130 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/VoucherMill-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFiles 12 | 13 | Icon-60.png 14 | Icon-76.png 15 | Icon-120.png 16 | Icon-152.png 17 | 18 | CFBundleIcons 19 | 20 | CFBundlePrimaryIcon 21 | 22 | CFBundleIconFiles 23 | 24 | Icon.png 25 | Icon@2x.png 26 | 27 | UIPrerenderedIcon 28 | 29 | 30 | 31 | CFBundleIdentifier 32 | com.paymill.vouchermill 33 | CFBundleInfoDictionaryVersion 34 | 6.0 35 | CFBundleName 36 | ${PRODUCT_NAME} 37 | CFBundlePackageType 38 | APPL 39 | CFBundleShortVersionString 40 | 1.0 41 | CFBundleSignature 42 | ???? 43 | CFBundleVersion 44 | 1.0 45 | LSRequiresIPhoneOS 46 | 47 | UIMainStoryboardFile 48 | MainStoryboard 49 | UIPrerenderedIcon 50 | 51 | UIRequiredDeviceCapabilities 52 | 53 | armv7 54 | 55 | UISupportedInterfaceOrientations 56 | 57 | UIInterfaceOrientationPortrait 58 | UIInterfaceOrientationPortraitUpsideDown 59 | UIInterfaceOrientationLandscapeLeft 60 | UIInterfaceOrientationLandscapeRight 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/VoucherMill-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'VoucherMill' target in the 'VoucherMill' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #import 15 | #import "Utils/PMConstants.h" 16 | #endif 17 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /samples/vouchermill/VoucherMill/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 1/22/13. 6 | // Copyright (c) 2013 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "PMAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([PMAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /samples/vouchermill/snippets/PMPaymentScreensSnippet.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMPaymentScreensSnippet.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 6/30/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PMPaymentScreensSnippet : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /samples/vouchermill/snippets/PMPaymentScreensSnippet.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMPaymentScreensSnippet.m 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 6/30/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMPaymentScreensSnippet.h" 10 | #import 11 | #import "PMPaymentViewController.h" 12 | #import "PMConstants.h" 13 | 14 | NSString *currency = @"EU"; 15 | NSInteger amount = 100; 16 | NSString *description = @"product description"; 17 | BOOL isTestMode = YES; 18 | BOOL safeStoreEnabled = YES; 19 | BOOL isAutoConsumed = YES; 20 | 21 | @implementation PMPaymentScreensSnippet 22 | -(void)createTokenWithPaymentScreenSnippet { 23 | NSError *error; 24 | //set payment view settings 25 | id pmViewSettings = [PMSettings settingsWithPaymentType:TOKEN directDebitCountry:@"DE" testMode:YES safeStoreEnabled:YES andConsumable:isAutoConsumed]; 26 | 27 | //Create payment parameters 28 | id params = [PMFactory genPaymentParamsWithCurrency:@"EU" amount:100 description:@"Desc" error:&error]; 29 | 30 | 31 | 32 | //check for errors 33 | if(!error){ 34 | //create the payment view controller 35 | id payViewNav = [[PMPaymentViewController alloc] initWithParams:params 36 | publicKey:myPublicKey 37 | settings:pmViewSettings 38 | style:[self customStyle] 39 | 40 | success:^(id resObject) { 41 | //show succes screen 42 | } 43 | 44 | failure:^(NSError *error) { 45 | //show failure screen 46 | }]; 47 | //present the payment view controller 48 | UINavigationController* navCtrl = [[UINavigationController alloc] initWithRootViewController:payViewNav]; 49 | [self presentViewController:navCtrl animated:YES completion:nil]; 50 | } 51 | } 52 | 53 | #pragma mark - PMStyle 54 | - (PMStyle*)customStyle 55 | { 56 | UIColor *mainColor = [UIColor colorWithRed:239.0/255.0 green:80/255.0 blue:0/255.0 alpha:1.0]; 57 | PMStyle* style = [PMStyle new]; 58 | style.backgroundColor = [UIColor whiteColor]; 59 | style.navbarColor = [UIColor whiteColor]; 60 | style.inputFieldTextColor = [UIColor darkTextColor]; 61 | style.inputFieldBackgroundColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:0.1]; 62 | style.inputFieldTitleColor = mainColor; 63 | style.inputFieldBorderColor = [UIColor colorWithRed:149.0/255.0 green:0/255.0 blue:11.0/255.0 alpha:1.0]; 64 | style.inputFieldBorderWidth = 2.0; 65 | style.inputFieldBorderStyle = UITextBorderStyleRoundedRect; 66 | style.inputFieldCornerRadius = 8.0; 67 | style.inputFieldConfirmColor = [UIColor darkTextColor]; 68 | style.inputFieldWrongColor = [UIColor redColor]; 69 | style.buttonBackgroundColor = mainColor; 70 | style.buttonTitleColor = [UIColor whiteColor]; 71 | style.segmentColor = [UIColor whiteColor]; 72 | 73 | return style; 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /samples/vouchermill/snippets/PMSDKSnippets.h: -------------------------------------------------------------------------------- 1 | // 2 | // PMSDKSnippets.h 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 6/30/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PMSDKSnippets : NSObject 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /samples/vouchermill/snippets/PMSDKSnippets.m: -------------------------------------------------------------------------------- 1 | // 2 | // PMSDKSnippets.m 3 | // VoucherMill 4 | // 5 | // Created by Aleksandar Yalnazov on 6/30/14. 6 | // Copyright (c) 2014 Paymill. All rights reserved. 7 | // 8 | 9 | #import "PMSDKSnippets.h" 10 | #import 11 | #import "PMDataBaseManager.h" 12 | #import "PMVoucher.h" 13 | #import "PMVoucherUtils.h" 14 | #import "PMConstants.h" 15 | 16 | @implementation PMSDKSnippets 17 | 18 | -(void)generateTokenWithPublicKeySnippet { 19 | 20 | NSError *error; 21 | PMPaymentParams *params; 22 | id paymentMethod = [PMFactory genCardPaymentWithAccHolder:@"Max Musterman" cardNumber:@"4711100000000000" expiryMonth:@"12" expiryYear:@"2014" 23 | verification:@"333" error:&error]; 24 | 25 | if(!error) { 26 | params = [PMFactory genPaymentParamsWithCurrency:@"EUR" amount:100 description:@"Description" error:&error]; 27 | } 28 | 29 | if(!error) { 30 | [PMManager generateTokenWithPublicKey:myPublicKey testMode:YES method:paymentMethod parameters:params 31 | success:^(NSString *token) { 32 | //token successfully created 33 | } 34 | failure:^(NSError *error) { 35 | //token generation failed 36 | }]; 37 | } 38 | } 39 | 40 | -(void)createTransactionSnippet { 41 | //init with PAYMILL public key 42 | [PMManager initWithTestMode:YES merchantPublicKey:myPublicKey newDeviceId:nil init:^(BOOL success, NSError *error) { 43 | if(success) { 44 | // init successfull 45 | // start using the SDK 46 | } 47 | }]; 48 | 49 | NSError *error; 50 | PMPaymentParams *params; 51 | id paymentMethod = [PMFactory genCardPaymentWithAccHolder:@"Max Musterman" cardNumber:@"4711100000000000" expiryMonth:@"12" expiryYear:@"2014" 52 | verification:@"333" error:&error]; 53 | 54 | if(!error) { 55 | params = [PMFactory genPaymentParamsWithCurrency:@"EUR" amount:100 description:@"Description" error:&error]; 56 | } 57 | 58 | if(!error) { 59 | [PMManager transactionWithMethod:paymentMethod parameters:params consumable:YES 60 | 61 | success:^(PMTransaction *transaction) { 62 | // transaction successfully created 63 | } 64 | failure:^(NSError *error) { 65 | // transaction creation failed 66 | }]; 67 | } 68 | } 69 | 70 | -(void)recoverWithTransactionId:(NSString *)transactionId andVoucher:(PMVoucher *)voucher { 71 | if (nil == [[PMDataBaseManager instance] findVoucherByTransactionId:transactionId andCompletionHandler:nil]) { 72 | //we haven't saved this transaction yet 73 | [[PMDataBaseManager instance] insertNewOfflineVoucherWithVoucher:voucher andCompletionHandler:^(NSError *error) { 74 | 75 | if(error) { 76 | [PMVoucherUtils showErrorAlertWithTitle:@"Error inserting offline voucher" errorType:INTERNAL errorMessage:error.description]; 77 | } 78 | else { 79 | //transaction saved, now consume the transaction 80 | [PMManager consumeTransactionForId:transactionId success:^(NSString *id) { 81 | // 82 | } failure:^(NSError *error) { 83 | // 84 | }]; 85 | } 86 | }]; 87 | } 88 | } 89 | 90 | @end 91 | --------------------------------------------------------------------------------