├── .gitignore ├── AcceptSDKSampleApp.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── AcceptSDKSampleApp.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ ├── AcceptSDKSampleApp.xcscmblueprint │ └── IDEWorkspaceChecks.plist ├── AcceptSDKSampleApp ├── AcceptSDKSampleApp.entitlements ├── AppDelegate.swift ├── ApplePayViewController.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── ApplePayBTN_64pt__black_textLogo_.imageset │ │ ├── ApplePayBTN_64pt__black_textLogo_@2x.png │ │ ├── ApplePayBTN_64pt__black_textLogo_@3x.png │ │ └── Contents.json │ ├── BackButton.imageset │ │ ├── BackButton.png │ │ ├── BackButton@2x.png │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist └── ViewController.swift ├── AcceptSDKSampleAppTests ├── AcceptSDKSampleAppTests.swift └── Info.plist ├── LICENSE ├── Podfile ├── Podfile.lock ├── Pods ├── AuthorizeNetAccept │ ├── AcceptSDK │ │ ├── AcceptBuilder │ │ │ ├── AcceptSDKBaseInterfaceBuilder.swift │ │ │ ├── AcceptSDKBaseURLBuilder.swift │ │ │ ├── AcceptSDKTokenAPIBuilder.swift │ │ │ └── AcceptSDKTokenInterfaceBuilder.swift │ │ ├── AcceptSDKHandler.swift │ │ ├── AcceptSDKInternal.swift │ │ ├── AcceptSDKSettings.swift │ │ ├── Interface │ │ │ ├── AcceptSDKBaseInterface.swift │ │ │ └── AcceptSDKTokenInterface.swift │ │ ├── Network │ │ │ ├── AccepSDKtHttp.swift │ │ │ └── AcceptSDKHttpConnection.swift │ │ ├── Request │ │ │ ├── AcceptSDKPaymentRequest.swift │ │ │ ├── FingerPrint.swift │ │ │ ├── MerchantAuthenticaton.swift │ │ │ └── SecurePaymentContainerRequest.swift │ │ ├── Response │ │ │ ├── AcceptSDKErrorResponse.swift │ │ │ └── AcceptSDKTokenResponse.swift │ │ └── Validators │ │ │ ├── AcceptSDKCardFieldsValidator.swift │ │ │ └── AcceptSDKStringValidator.swift │ ├── LICENSE │ ├── LICENSE.md │ └── README.md ├── Local Podspecs │ └── AuthorizeNetAccept.podspec.json ├── Manifest.lock ├── Pods.xcodeproj │ └── project.pbxproj └── Target Support Files │ ├── AuthorizeNetAccept │ ├── AuthorizeNetAccept-Info.plist │ ├── AuthorizeNetAccept-dummy.m │ ├── AuthorizeNetAccept-prefix.pch │ ├── AuthorizeNetAccept-umbrella.h │ ├── AuthorizeNetAccept.modulemap │ ├── AuthorizeNetAccept.xcconfig │ └── Info.plist │ └── Pods-AcceptSDKSampleApp │ ├── Info.plist │ ├── Pods-AcceptSDKSampleApp-Info.plist │ ├── Pods-AcceptSDKSampleApp-acknowledgements.markdown │ ├── Pods-AcceptSDKSampleApp-acknowledgements.plist │ ├── Pods-AcceptSDKSampleApp-dummy.m │ ├── Pods-AcceptSDKSampleApp-frameworks.sh │ ├── Pods-AcceptSDKSampleApp-resources.sh │ ├── Pods-AcceptSDKSampleApp-umbrella.h │ ├── Pods-AcceptSDKSampleApp.debug.xcconfig │ ├── Pods-AcceptSDKSampleApp.modulemap │ └── Pods-AcceptSDKSampleApp.release.xcconfig ├── README.md ├── screenshot1.png └── screenshot2.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | ## Playgrounds 31 | timeline.xctimeline 32 | playground.xcworkspace 33 | 34 | # Swift Package Manager 35 | # 36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 37 | # Packages/ 38 | .build/ 39 | 40 | # CocoaPods 41 | # 42 | # We recommend against adding the Pods directory to your .gitignore. However 43 | # you should judge for yourself, the pros and cons are mentioned at: 44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 45 | # 46 | # Pods/ 47 | 48 | # Carthage 49 | # 50 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 51 | # Carthage/Checkouts 52 | 53 | Carthage/Build 54 | 55 | # fastlane 56 | # 57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 58 | # screenshots whenever they are needed. 59 | # For more information about the recommended setup visit: 60 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 61 | 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | -------------------------------------------------------------------------------- /AcceptSDKSampleApp.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A027CA3E1D38C06D007A8D73 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A027CA3D1D38C06D007A8D73 /* AppDelegate.swift */; }; 11 | A027CA401D38C06D007A8D73 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A027CA3F1D38C06D007A8D73 /* ViewController.swift */; }; 12 | A027CA431D38C06D007A8D73 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A027CA411D38C06D007A8D73 /* Main.storyboard */; }; 13 | A027CA451D38C06D007A8D73 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A027CA441D38C06D007A8D73 /* Assets.xcassets */; }; 14 | A027CA481D38C06D007A8D73 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A027CA461D38C06D007A8D73 /* LaunchScreen.storyboard */; }; 15 | A027CA531D38C06E007A8D73 /* AcceptSDKSampleAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A027CA521D38C06E007A8D73 /* AcceptSDKSampleAppTests.swift */; }; 16 | A092D5051D5315F8002E03D4 /* ApplePayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A092D5041D5315F8002E03D4 /* ApplePayViewController.swift */; }; 17 | E9E520B001B8BAC8EEB135F5 /* Pods_AcceptSDKSampleApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C4C47B3628E1BE9719F6CD55 /* Pods_AcceptSDKSampleApp.framework */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | A027CA4F1D38C06D007A8D73 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = A027CA321D38C06D007A8D73 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = A027CA391D38C06D007A8D73; 26 | remoteInfo = AcceptSDKSampleApp; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 3B5A864FFEC8E2816003516F /* Pods-AcceptSDKSampleApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AcceptSDKSampleApp.debug.xcconfig"; path = "Pods/Target Support Files/Pods-AcceptSDKSampleApp/Pods-AcceptSDKSampleApp.debug.xcconfig"; sourceTree = ""; }; 32 | 8D409E63A011A45B7BAA14D9 /* Pods-AcceptSDKSampleApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AcceptSDKSampleApp.release.xcconfig"; path = "Pods/Target Support Files/Pods-AcceptSDKSampleApp/Pods-AcceptSDKSampleApp.release.xcconfig"; sourceTree = ""; }; 33 | A027CA3A1D38C06D007A8D73 /* AcceptSDKSampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AcceptSDKSampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | A027CA3D1D38C06D007A8D73 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 35 | A027CA3F1D38C06D007A8D73 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 36 | A027CA421D38C06D007A8D73 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 37 | A027CA441D38C06D007A8D73 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 38 | A027CA471D38C06D007A8D73 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 39 | A027CA491D38C06D007A8D73 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 40 | A027CA4E1D38C06D007A8D73 /* AcceptSDKSampleAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AcceptSDKSampleAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | A027CA521D38C06E007A8D73 /* AcceptSDKSampleAppTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AcceptSDKSampleAppTests.swift; sourceTree = ""; }; 42 | A027CA541D38C06E007A8D73 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | A092D5041D5315F8002E03D4 /* ApplePayViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApplePayViewController.swift; sourceTree = ""; }; 44 | A092D5061D5320BD002E03D4 /* AcceptSDKSampleApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = AcceptSDKSampleApp.entitlements; sourceTree = ""; }; 45 | C4C47B3628E1BE9719F6CD55 /* Pods_AcceptSDKSampleApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AcceptSDKSampleApp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | A027CA371D38C06D007A8D73 /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | E9E520B001B8BAC8EEB135F5 /* Pods_AcceptSDKSampleApp.framework in Frameworks */, 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | A027CA4B1D38C06D007A8D73 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | /* End PBXFrameworksBuildPhase section */ 65 | 66 | /* Begin PBXGroup section */ 67 | 5788523755E2681C255F7A7E /* Pods */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | 3B5A864FFEC8E2816003516F /* Pods-AcceptSDKSampleApp.debug.xcconfig */, 71 | 8D409E63A011A45B7BAA14D9 /* Pods-AcceptSDKSampleApp.release.xcconfig */, 72 | ); 73 | name = Pods; 74 | sourceTree = ""; 75 | }; 76 | 98E87C9AC6FF1BA561EE7DE2 /* Frameworks */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | C4C47B3628E1BE9719F6CD55 /* Pods_AcceptSDKSampleApp.framework */, 80 | ); 81 | name = Frameworks; 82 | sourceTree = ""; 83 | }; 84 | A027CA311D38C06D007A8D73 = { 85 | isa = PBXGroup; 86 | children = ( 87 | A027CA3C1D38C06D007A8D73 /* AcceptSDKSampleApp */, 88 | A027CA511D38C06D007A8D73 /* AcceptSDKSampleAppTests */, 89 | A027CA3B1D38C06D007A8D73 /* Products */, 90 | 5788523755E2681C255F7A7E /* Pods */, 91 | 98E87C9AC6FF1BA561EE7DE2 /* Frameworks */, 92 | ); 93 | sourceTree = ""; 94 | }; 95 | A027CA3B1D38C06D007A8D73 /* Products */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | A027CA3A1D38C06D007A8D73 /* AcceptSDKSampleApp.app */, 99 | A027CA4E1D38C06D007A8D73 /* AcceptSDKSampleAppTests.xctest */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | A027CA3C1D38C06D007A8D73 /* AcceptSDKSampleApp */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | A092D5061D5320BD002E03D4 /* AcceptSDKSampleApp.entitlements */, 108 | A027CA3D1D38C06D007A8D73 /* AppDelegate.swift */, 109 | A092D5041D5315F8002E03D4 /* ApplePayViewController.swift */, 110 | A027CA3F1D38C06D007A8D73 /* ViewController.swift */, 111 | A027CA411D38C06D007A8D73 /* Main.storyboard */, 112 | A027CA441D38C06D007A8D73 /* Assets.xcassets */, 113 | A027CA461D38C06D007A8D73 /* LaunchScreen.storyboard */, 114 | A027CA491D38C06D007A8D73 /* Info.plist */, 115 | ); 116 | path = AcceptSDKSampleApp; 117 | sourceTree = ""; 118 | }; 119 | A027CA511D38C06D007A8D73 /* AcceptSDKSampleAppTests */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | A027CA521D38C06E007A8D73 /* AcceptSDKSampleAppTests.swift */, 123 | A027CA541D38C06E007A8D73 /* Info.plist */, 124 | ); 125 | path = AcceptSDKSampleAppTests; 126 | sourceTree = ""; 127 | }; 128 | /* End PBXGroup section */ 129 | 130 | /* Begin PBXNativeTarget section */ 131 | A027CA391D38C06D007A8D73 /* AcceptSDKSampleApp */ = { 132 | isa = PBXNativeTarget; 133 | buildConfigurationList = A027CA571D38C06E007A8D73 /* Build configuration list for PBXNativeTarget "AcceptSDKSampleApp" */; 134 | buildPhases = ( 135 | 67AB9BAA6BE5A493D2AC7AFF /* [CP] Check Pods Manifest.lock */, 136 | A027CA361D38C06D007A8D73 /* Sources */, 137 | A027CA371D38C06D007A8D73 /* Frameworks */, 138 | A027CA381D38C06D007A8D73 /* Resources */, 139 | 10CEDF34052E61EAAE002DC6 /* [CP] Embed Pods Frameworks */, 140 | ); 141 | buildRules = ( 142 | ); 143 | dependencies = ( 144 | ); 145 | name = AcceptSDKSampleApp; 146 | productName = AcceptSDKSampleApp; 147 | productReference = A027CA3A1D38C06D007A8D73 /* AcceptSDKSampleApp.app */; 148 | productType = "com.apple.product-type.application"; 149 | }; 150 | A027CA4D1D38C06D007A8D73 /* AcceptSDKSampleAppTests */ = { 151 | isa = PBXNativeTarget; 152 | buildConfigurationList = A027CA5A1D38C06E007A8D73 /* Build configuration list for PBXNativeTarget "AcceptSDKSampleAppTests" */; 153 | buildPhases = ( 154 | A027CA4A1D38C06D007A8D73 /* Sources */, 155 | A027CA4B1D38C06D007A8D73 /* Frameworks */, 156 | A027CA4C1D38C06D007A8D73 /* Resources */, 157 | ); 158 | buildRules = ( 159 | ); 160 | dependencies = ( 161 | A027CA501D38C06D007A8D73 /* PBXTargetDependency */, 162 | ); 163 | name = AcceptSDKSampleAppTests; 164 | productName = AcceptSDKSampleAppTests; 165 | productReference = A027CA4E1D38C06D007A8D73 /* AcceptSDKSampleAppTests.xctest */; 166 | productType = "com.apple.product-type.bundle.unit-test"; 167 | }; 168 | /* End PBXNativeTarget section */ 169 | 170 | /* Begin PBXProject section */ 171 | A027CA321D38C06D007A8D73 /* Project object */ = { 172 | isa = PBXProject; 173 | attributes = { 174 | LastSwiftUpdateCheck = 0730; 175 | LastUpgradeCheck = 0800; 176 | ORGANIZATIONNAME = "Ramamurthy, Rakesh Ramamurthy"; 177 | TargetAttributes = { 178 | A027CA391D38C06D007A8D73 = { 179 | CreatedOnToolsVersion = 7.3; 180 | DevelopmentTeam = 8WQ4DJVQC2; 181 | LastSwiftMigration = 0900; 182 | SystemCapabilities = { 183 | com.apple.OMC = { 184 | enabled = 1; 185 | }; 186 | }; 187 | }; 188 | A027CA4D1D38C06D007A8D73 = { 189 | CreatedOnToolsVersion = 7.3; 190 | LastSwiftMigration = 0900; 191 | TestTargetID = A027CA391D38C06D007A8D73; 192 | }; 193 | }; 194 | }; 195 | buildConfigurationList = A027CA351D38C06D007A8D73 /* Build configuration list for PBXProject "AcceptSDKSampleApp" */; 196 | compatibilityVersion = "Xcode 3.2"; 197 | developmentRegion = English; 198 | hasScannedForEncodings = 0; 199 | knownRegions = ( 200 | English, 201 | en, 202 | Base, 203 | ); 204 | mainGroup = A027CA311D38C06D007A8D73; 205 | productRefGroup = A027CA3B1D38C06D007A8D73 /* Products */; 206 | projectDirPath = ""; 207 | projectRoot = ""; 208 | targets = ( 209 | A027CA391D38C06D007A8D73 /* AcceptSDKSampleApp */, 210 | A027CA4D1D38C06D007A8D73 /* AcceptSDKSampleAppTests */, 211 | ); 212 | }; 213 | /* End PBXProject section */ 214 | 215 | /* Begin PBXResourcesBuildPhase section */ 216 | A027CA381D38C06D007A8D73 /* Resources */ = { 217 | isa = PBXResourcesBuildPhase; 218 | buildActionMask = 2147483647; 219 | files = ( 220 | A027CA481D38C06D007A8D73 /* LaunchScreen.storyboard in Resources */, 221 | A027CA451D38C06D007A8D73 /* Assets.xcassets in Resources */, 222 | A027CA431D38C06D007A8D73 /* Main.storyboard in Resources */, 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | A027CA4C1D38C06D007A8D73 /* Resources */ = { 227 | isa = PBXResourcesBuildPhase; 228 | buildActionMask = 2147483647; 229 | files = ( 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | }; 233 | /* End PBXResourcesBuildPhase section */ 234 | 235 | /* Begin PBXShellScriptBuildPhase section */ 236 | 10CEDF34052E61EAAE002DC6 /* [CP] Embed Pods Frameworks */ = { 237 | isa = PBXShellScriptBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | ); 241 | inputPaths = ( 242 | "${PODS_ROOT}/Target Support Files/Pods-AcceptSDKSampleApp/Pods-AcceptSDKSampleApp-frameworks.sh", 243 | "${BUILT_PRODUCTS_DIR}/AuthorizeNetAccept/AuthorizeNetAccept.framework", 244 | ); 245 | name = "[CP] Embed Pods Frameworks"; 246 | outputPaths = ( 247 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AuthorizeNetAccept.framework", 248 | ); 249 | runOnlyForDeploymentPostprocessing = 0; 250 | shellPath = /bin/sh; 251 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AcceptSDKSampleApp/Pods-AcceptSDKSampleApp-frameworks.sh\"\n"; 252 | showEnvVarsInLog = 0; 253 | }; 254 | 67AB9BAA6BE5A493D2AC7AFF /* [CP] Check Pods Manifest.lock */ = { 255 | isa = PBXShellScriptBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | ); 259 | inputPaths = ( 260 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 261 | "${PODS_ROOT}/Manifest.lock", 262 | ); 263 | name = "[CP] Check Pods Manifest.lock"; 264 | outputPaths = ( 265 | "$(DERIVED_FILE_DIR)/Pods-AcceptSDKSampleApp-checkManifestLockResult.txt", 266 | ); 267 | runOnlyForDeploymentPostprocessing = 0; 268 | shellPath = /bin/sh; 269 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 270 | showEnvVarsInLog = 0; 271 | }; 272 | /* End PBXShellScriptBuildPhase section */ 273 | 274 | /* Begin PBXSourcesBuildPhase section */ 275 | A027CA361D38C06D007A8D73 /* Sources */ = { 276 | isa = PBXSourcesBuildPhase; 277 | buildActionMask = 2147483647; 278 | files = ( 279 | A027CA401D38C06D007A8D73 /* ViewController.swift in Sources */, 280 | A092D5051D5315F8002E03D4 /* ApplePayViewController.swift in Sources */, 281 | A027CA3E1D38C06D007A8D73 /* AppDelegate.swift in Sources */, 282 | ); 283 | runOnlyForDeploymentPostprocessing = 0; 284 | }; 285 | A027CA4A1D38C06D007A8D73 /* Sources */ = { 286 | isa = PBXSourcesBuildPhase; 287 | buildActionMask = 2147483647; 288 | files = ( 289 | A027CA531D38C06E007A8D73 /* AcceptSDKSampleAppTests.swift in Sources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | /* End PBXSourcesBuildPhase section */ 294 | 295 | /* Begin PBXTargetDependency section */ 296 | A027CA501D38C06D007A8D73 /* PBXTargetDependency */ = { 297 | isa = PBXTargetDependency; 298 | target = A027CA391D38C06D007A8D73 /* AcceptSDKSampleApp */; 299 | targetProxy = A027CA4F1D38C06D007A8D73 /* PBXContainerItemProxy */; 300 | }; 301 | /* End PBXTargetDependency section */ 302 | 303 | /* Begin PBXVariantGroup section */ 304 | A027CA411D38C06D007A8D73 /* Main.storyboard */ = { 305 | isa = PBXVariantGroup; 306 | children = ( 307 | A027CA421D38C06D007A8D73 /* Base */, 308 | ); 309 | name = Main.storyboard; 310 | sourceTree = ""; 311 | }; 312 | A027CA461D38C06D007A8D73 /* LaunchScreen.storyboard */ = { 313 | isa = PBXVariantGroup; 314 | children = ( 315 | A027CA471D38C06D007A8D73 /* Base */, 316 | ); 317 | name = LaunchScreen.storyboard; 318 | sourceTree = ""; 319 | }; 320 | /* End PBXVariantGroup section */ 321 | 322 | /* Begin XCBuildConfiguration section */ 323 | A027CA551D38C06E007A8D73 /* Debug */ = { 324 | isa = XCBuildConfiguration; 325 | buildSettings = { 326 | ALWAYS_SEARCH_USER_PATHS = NO; 327 | CLANG_ANALYZER_NONNULL = YES; 328 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 329 | CLANG_CXX_LIBRARY = "libc++"; 330 | CLANG_ENABLE_MODULES = YES; 331 | CLANG_ENABLE_OBJC_ARC = YES; 332 | CLANG_WARN_BOOL_CONVERSION = YES; 333 | CLANG_WARN_CONSTANT_CONVERSION = YES; 334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INFINITE_RECURSION = YES; 338 | CLANG_WARN_INT_CONVERSION = YES; 339 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 340 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 341 | CLANG_WARN_UNREACHABLE_CODE = YES; 342 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 343 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 344 | COPY_PHASE_STRIP = NO; 345 | DEBUG_INFORMATION_FORMAT = dwarf; 346 | ENABLE_STRICT_OBJC_MSGSEND = YES; 347 | ENABLE_TESTABILITY = YES; 348 | GCC_C_LANGUAGE_STANDARD = gnu99; 349 | GCC_DYNAMIC_NO_PIC = NO; 350 | GCC_NO_COMMON_BLOCKS = YES; 351 | GCC_OPTIMIZATION_LEVEL = 0; 352 | GCC_PREPROCESSOR_DEFINITIONS = ( 353 | "DEBUG=1", 354 | "$(inherited)", 355 | ); 356 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 357 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 358 | GCC_WARN_UNDECLARED_SELECTOR = YES; 359 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 360 | GCC_WARN_UNUSED_FUNCTION = YES; 361 | GCC_WARN_UNUSED_VARIABLE = YES; 362 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 363 | MTL_ENABLE_DEBUG_INFO = YES; 364 | ONLY_ACTIVE_ARCH = YES; 365 | SDKROOT = iphoneos; 366 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 367 | TARGETED_DEVICE_FAMILY = "1,2"; 368 | }; 369 | name = Debug; 370 | }; 371 | A027CA561D38C06E007A8D73 /* Release */ = { 372 | isa = XCBuildConfiguration; 373 | buildSettings = { 374 | ALWAYS_SEARCH_USER_PATHS = NO; 375 | CLANG_ANALYZER_NONNULL = YES; 376 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 377 | CLANG_CXX_LIBRARY = "libc++"; 378 | CLANG_ENABLE_MODULES = YES; 379 | CLANG_ENABLE_OBJC_ARC = YES; 380 | CLANG_WARN_BOOL_CONVERSION = YES; 381 | CLANG_WARN_CONSTANT_CONVERSION = YES; 382 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 383 | CLANG_WARN_EMPTY_BODY = YES; 384 | CLANG_WARN_ENUM_CONVERSION = YES; 385 | CLANG_WARN_INFINITE_RECURSION = YES; 386 | CLANG_WARN_INT_CONVERSION = YES; 387 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 388 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 389 | CLANG_WARN_UNREACHABLE_CODE = YES; 390 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 391 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 392 | COPY_PHASE_STRIP = NO; 393 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 394 | ENABLE_NS_ASSERTIONS = NO; 395 | ENABLE_STRICT_OBJC_MSGSEND = YES; 396 | GCC_C_LANGUAGE_STANDARD = gnu99; 397 | GCC_NO_COMMON_BLOCKS = YES; 398 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 399 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 400 | GCC_WARN_UNDECLARED_SELECTOR = YES; 401 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 402 | GCC_WARN_UNUSED_FUNCTION = YES; 403 | GCC_WARN_UNUSED_VARIABLE = YES; 404 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 405 | MTL_ENABLE_DEBUG_INFO = NO; 406 | SDKROOT = iphoneos; 407 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 408 | TARGETED_DEVICE_FAMILY = "1,2"; 409 | VALIDATE_PRODUCT = YES; 410 | }; 411 | name = Release; 412 | }; 413 | A027CA581D38C06E007A8D73 /* Debug */ = { 414 | isa = XCBuildConfiguration; 415 | baseConfigurationReference = 3B5A864FFEC8E2816003516F /* Pods-AcceptSDKSampleApp.debug.xcconfig */; 416 | buildSettings = { 417 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 418 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 419 | CODE_SIGN_ENTITLEMENTS = AcceptSDKSampleApp/AcceptSDKSampleApp.entitlements; 420 | CODE_SIGN_IDENTITY = "iPhone Developer"; 421 | INFOPLIST_FILE = AcceptSDKSampleApp/Info.plist; 422 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 423 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 424 | PRODUCT_BUNDLE_IDENTIFIER = net.authorize.AuthnetLab; 425 | PRODUCT_NAME = "$(TARGET_NAME)"; 426 | SWIFT_VERSION = 5.0; 427 | }; 428 | name = Debug; 429 | }; 430 | A027CA591D38C06E007A8D73 /* Release */ = { 431 | isa = XCBuildConfiguration; 432 | baseConfigurationReference = 8D409E63A011A45B7BAA14D9 /* Pods-AcceptSDKSampleApp.release.xcconfig */; 433 | buildSettings = { 434 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 435 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 436 | CODE_SIGN_ENTITLEMENTS = AcceptSDKSampleApp/AcceptSDKSampleApp.entitlements; 437 | CODE_SIGN_IDENTITY = "iPhone Developer"; 438 | INFOPLIST_FILE = AcceptSDKSampleApp/Info.plist; 439 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 440 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 441 | PRODUCT_BUNDLE_IDENTIFIER = net.authorize.AuthnetLab; 442 | PRODUCT_NAME = "$(TARGET_NAME)"; 443 | SWIFT_VERSION = 5.0; 444 | }; 445 | name = Release; 446 | }; 447 | A027CA5B1D38C06E007A8D73 /* Debug */ = { 448 | isa = XCBuildConfiguration; 449 | buildSettings = { 450 | BUNDLE_LOADER = "$(TEST_HOST)"; 451 | INFOPLIST_FILE = AcceptSDKSampleAppTests/Info.plist; 452 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 453 | PRODUCT_BUNDLE_IDENTIFIER = com.visa.com.AcceptSDKSampleAppTests; 454 | PRODUCT_NAME = "$(TARGET_NAME)"; 455 | SWIFT_VERSION = 4.0; 456 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AcceptSDKSampleApp.app/AcceptSDKSampleApp"; 457 | }; 458 | name = Debug; 459 | }; 460 | A027CA5C1D38C06E007A8D73 /* Release */ = { 461 | isa = XCBuildConfiguration; 462 | buildSettings = { 463 | BUNDLE_LOADER = "$(TEST_HOST)"; 464 | INFOPLIST_FILE = AcceptSDKSampleAppTests/Info.plist; 465 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 466 | PRODUCT_BUNDLE_IDENTIFIER = com.visa.com.AcceptSDKSampleAppTests; 467 | PRODUCT_NAME = "$(TARGET_NAME)"; 468 | SWIFT_VERSION = 4.0; 469 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AcceptSDKSampleApp.app/AcceptSDKSampleApp"; 470 | }; 471 | name = Release; 472 | }; 473 | /* End XCBuildConfiguration section */ 474 | 475 | /* Begin XCConfigurationList section */ 476 | A027CA351D38C06D007A8D73 /* Build configuration list for PBXProject "AcceptSDKSampleApp" */ = { 477 | isa = XCConfigurationList; 478 | buildConfigurations = ( 479 | A027CA551D38C06E007A8D73 /* Debug */, 480 | A027CA561D38C06E007A8D73 /* Release */, 481 | ); 482 | defaultConfigurationIsVisible = 0; 483 | defaultConfigurationName = Release; 484 | }; 485 | A027CA571D38C06E007A8D73 /* Build configuration list for PBXNativeTarget "AcceptSDKSampleApp" */ = { 486 | isa = XCConfigurationList; 487 | buildConfigurations = ( 488 | A027CA581D38C06E007A8D73 /* Debug */, 489 | A027CA591D38C06E007A8D73 /* Release */, 490 | ); 491 | defaultConfigurationIsVisible = 0; 492 | defaultConfigurationName = Release; 493 | }; 494 | A027CA5A1D38C06E007A8D73 /* Build configuration list for PBXNativeTarget "AcceptSDKSampleAppTests" */ = { 495 | isa = XCConfigurationList; 496 | buildConfigurations = ( 497 | A027CA5B1D38C06E007A8D73 /* Debug */, 498 | A027CA5C1D38C06E007A8D73 /* Release */, 499 | ); 500 | defaultConfigurationIsVisible = 0; 501 | defaultConfigurationName = Release; 502 | }; 503 | /* End XCConfigurationList section */ 504 | }; 505 | rootObject = A027CA321D38C06D007A8D73 /* Project object */; 506 | } 507 | -------------------------------------------------------------------------------- /AcceptSDKSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AcceptSDKSampleApp.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /AcceptSDKSampleApp.xcworkspace/xcshareddata/AcceptSDKSampleApp.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "DF815FF68C3885B7743314C7EB31B4140DE92A60", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | 5 | }, 6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 7 | "A768CDC7591A233EE9A4FDFE5C49981C0B636613" : 0, 8 | "DF815FF68C3885B7743314C7EB31B4140DE92A60" : 0 9 | }, 10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "7A28174A-7403-4B54-94D4-6A07B8BD3760", 11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 12 | "A768CDC7591A233EE9A4FDFE5C49981C0B636613" : "accept-sdk-ios\/", 13 | "DF815FF68C3885B7743314C7EB31B4140DE92A60" : "accept-sample-ios-1\/" 14 | }, 15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "AcceptSDKSampleApp", 16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "AcceptSDKSampleApp.xcworkspace", 18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 19 | { 20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/kbollepa\/accept-sdk-ios.git", 21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "A768CDC7591A233EE9A4FDFE5C49981C0B636613" 23 | }, 24 | { 25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/kbollepa\/accept-sample-ios.git", 26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "DF815FF68C3885B7743314C7EB31B4140DE92A60" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /AcceptSDKSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AcceptSDKSampleApp/AcceptSDKSampleApp.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.developer.in-app-payments 6 | 7 | merchant.authorize.net.test.dev15 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /AcceptSDKSampleApp/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // AcceptSDKSampleApp 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/15/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // 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. 24 | // 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. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // 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. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /AcceptSDKSampleApp/ApplePayViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ApplePayViewController.swift 3 | // AcceptSDKSampleApp 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 8/4/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import PassKit 11 | 12 | class ApplePayViewController:UIViewController, PKPaymentAuthorizationViewControllerDelegate { 13 | 14 | @IBOutlet weak var applePayButton:UIButton! 15 | @IBOutlet weak var headerView:UIView! 16 | 17 | @objc let SupportedPaymentNetworks = [PKPaymentNetwork.visa, PKPaymentNetwork.masterCard, PKPaymentNetwork.amex] 18 | 19 | override func viewDidLoad() { 20 | super.viewDidLoad() 21 | self.headerView.backgroundColor = UIColor.init(red: 48.0/255.0, green: 85.0/255.0, blue: 112.0/255.0, alpha: 1.0) 22 | // self.applePayButton.hidden = !PKPaymentAuthorizationViewController.canMakePaymentsUsingNetworks(SupportedPaymentNetworks) 23 | } 24 | 25 | @IBAction func payWithApplePay(_ sender: AnyObject) { 26 | 27 | let supportedNetworks = [ PKPaymentNetwork.amex, PKPaymentNetwork.masterCard, PKPaymentNetwork.visa ] 28 | 29 | if PKPaymentAuthorizationViewController.canMakePayments() == false { 30 | let alert = UIAlertController(title: "Apple Pay is not available", message: nil, preferredStyle: .alert) 31 | alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: nil)) 32 | return self.present(alert, animated: true, completion: nil) 33 | } 34 | 35 | if PKPaymentAuthorizationViewController.canMakePayments(usingNetworks: supportedNetworks) == false { 36 | let alert = UIAlertController(title: "No Apple Pay payment methods available", message: nil, preferredStyle: .alert) 37 | alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: nil)) 38 | return self.present(alert, animated: true, completion: nil) 39 | } 40 | 41 | let request = PKPaymentRequest() 42 | request.currencyCode = "USD" 43 | request.countryCode = "US" 44 | request.merchantIdentifier = "merchant.authorize.net.test.dev15" 45 | request.supportedNetworks = SupportedPaymentNetworks 46 | // DO NOT INCLUDE PKMerchantCapability.capabilityEMV 47 | request.merchantCapabilities = PKMerchantCapability.capability3DS 48 | 49 | request.paymentSummaryItems = [ 50 | PKPaymentSummaryItem(label: "Total", amount: 254.00) 51 | ] 52 | 53 | let applePayController = PKPaymentAuthorizationViewController(paymentRequest: request) 54 | applePayController?.delegate = self 55 | 56 | self.present(applePayController!, animated: true, completion: nil) 57 | } 58 | 59 | func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment, completion: (@escaping (PKPaymentAuthorizationStatus) -> Void)) { 60 | print("paymentAuthorizationViewController delegates called") 61 | 62 | if payment.token.paymentData.count > 0 { 63 | let base64str = self.base64forData(payment.token.paymentData) 64 | let messsage = String(format: "Data Value: %@", base64str) 65 | let alert = UIAlertController(title: "Authorization Success", message: messsage, preferredStyle: .alert) 66 | alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: nil)) 67 | return self.performApplePayCompletion(controller, alert: alert) 68 | } else { 69 | let alert = UIAlertController(title: "Authorization Failed!", message: nil, preferredStyle: .alert) 70 | alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil)) 71 | return self.performApplePayCompletion(controller, alert: alert) 72 | } 73 | } 74 | 75 | @objc func performApplePayCompletion(_ controller: PKPaymentAuthorizationViewController, alert: UIAlertController) { 76 | controller.dismiss(animated: true, completion: {() -> Void in 77 | self.present(alert, animated: false, completion: nil) 78 | }) 79 | } 80 | 81 | func paymentAuthorizationViewControllerDidFinish(_ controller: PKPaymentAuthorizationViewController) { 82 | controller.dismiss(animated: true, completion: nil) 83 | print("paymentAuthorizationViewControllerDidFinish called") 84 | } 85 | 86 | @objc func base64forData(_ theData: Data) -> String { 87 | let charSet = CharacterSet.urlQueryAllowed 88 | 89 | let paymentString = NSString(data: theData, encoding: String.Encoding.utf8.rawValue)!.addingPercentEncoding(withAllowedCharacters: charSet) 90 | 91 | return paymentString! 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /AcceptSDKSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "83.5x83.5", 66 | "scale" : "2x" 67 | } 68 | ], 69 | "info" : { 70 | "version" : 1, 71 | "author" : "xcode" 72 | } 73 | } -------------------------------------------------------------------------------- /AcceptSDKSampleApp/Assets.xcassets/ApplePayBTN_64pt__black_textLogo_.imageset/ApplePayBTN_64pt__black_textLogo_@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AuthorizeNet/accept-sample-ios/eb10e4eb0c3097bf885c0452dcff46ef69064746/AcceptSDKSampleApp/Assets.xcassets/ApplePayBTN_64pt__black_textLogo_.imageset/ApplePayBTN_64pt__black_textLogo_@2x.png -------------------------------------------------------------------------------- /AcceptSDKSampleApp/Assets.xcassets/ApplePayBTN_64pt__black_textLogo_.imageset/ApplePayBTN_64pt__black_textLogo_@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AuthorizeNet/accept-sample-ios/eb10e4eb0c3097bf885c0452dcff46ef69064746/AcceptSDKSampleApp/Assets.xcassets/ApplePayBTN_64pt__black_textLogo_.imageset/ApplePayBTN_64pt__black_textLogo_@3x.png -------------------------------------------------------------------------------- /AcceptSDKSampleApp/Assets.xcassets/ApplePayBTN_64pt__black_textLogo_.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "ApplePayBTN_64pt__black_textLogo_@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "ApplePayBTN_64pt__black_textLogo_@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /AcceptSDKSampleApp/Assets.xcassets/BackButton.imageset/BackButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AuthorizeNet/accept-sample-ios/eb10e4eb0c3097bf885c0452dcff46ef69064746/AcceptSDKSampleApp/Assets.xcassets/BackButton.imageset/BackButton.png -------------------------------------------------------------------------------- /AcceptSDKSampleApp/Assets.xcassets/BackButton.imageset/BackButton@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AuthorizeNet/accept-sample-ios/eb10e4eb0c3097bf885c0452dcff46ef69064746/AcceptSDKSampleApp/Assets.xcassets/BackButton.imageset/BackButton@2x.png -------------------------------------------------------------------------------- /AcceptSDKSampleApp/Assets.xcassets/BackButton.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "BackButton.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "BackButton@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /AcceptSDKSampleApp/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /AcceptSDKSampleApp/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /AcceptSDKSampleApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /AcceptSDKSampleApp/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/11/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import AuthorizeNetAccept 11 | 12 | fileprivate func < (lhs: T?, rhs: T?) -> Bool { 13 | switch (lhs, rhs) { 14 | case let (l?, r?): 15 | return l < r 16 | case (nil, _?): 17 | return true 18 | default: 19 | return false 20 | } 21 | } 22 | 23 | fileprivate func > (lhs: T?, rhs: T?) -> Bool { 24 | switch (lhs, rhs) { 25 | case let (l?, r?): 26 | return l > r 27 | default: 28 | return rhs < lhs 29 | } 30 | } 31 | 32 | fileprivate func >= (lhs: T?, rhs: T?) -> Bool { 33 | switch (lhs, rhs) { 34 | case let (l?, r?): 35 | return l >= r 36 | default: 37 | return !(lhs < rhs) 38 | } 39 | } 40 | 41 | fileprivate func <= (lhs: T?, rhs: T?) -> Bool { 42 | switch (lhs, rhs) { 43 | case let (l?, r?): 44 | return l <= r 45 | default: 46 | return !(rhs < lhs) 47 | } 48 | } 49 | 50 | 51 | 52 | let kClientName = "5KP3u95bQpv" 53 | let kClientKey = "5FcB6WrfHGS76gHW3v7btBCE3HuuBuke9Pj96Ztfn5R32G5ep42vne7MCWZtAucY" 54 | 55 | let kAcceptSDKDemoCreditCardLength:Int = 16 56 | let kAcceptSDKDemoCreditCardLengthPlusSpaces:Int = (kAcceptSDKDemoCreditCardLength + 3) 57 | let kAcceptSDKDemoExpirationLength:Int = 4 58 | let kAcceptSDKDemoExpirationMonthLength:Int = 2 59 | let kAcceptSDKDemoExpirationYearLength:Int = 2 60 | let kAcceptSDKDemoExpirationLengthPlusSlash:Int = kAcceptSDKDemoExpirationLength + 1 61 | let kAcceptSDKDemoCVV2Length:Int = 4 62 | 63 | let kAcceptSDKDemoCreditCardObscureLength:Int = (kAcceptSDKDemoCreditCardLength - 4) 64 | 65 | let kAcceptSDKDemoSpace:String = " " 66 | let kAcceptSDKDemoSlash:String = "/" 67 | 68 | 69 | class ViewController: UIViewController, UITextFieldDelegate { 70 | 71 | @IBOutlet weak var cardNumberTextField:UITextField! 72 | @IBOutlet weak var expirationMonthTextField:UITextField! 73 | @IBOutlet weak var expirationYearTextField:UITextField! 74 | @IBOutlet weak var cardVerificationCodeTextField:UITextField! 75 | @IBOutlet weak var getTokenButton:UIButton! 76 | @IBOutlet weak var activityIndicatorAcceptSDKDemo:UIActivityIndicatorView! 77 | @IBOutlet weak var textViewShowResults:UITextView! 78 | @IBOutlet weak var headerView:UIView! 79 | 80 | fileprivate var cardNumber:String! 81 | fileprivate var cardExpirationMonth:String! 82 | fileprivate var cardExpirationYear:String! 83 | fileprivate var cardVerificationCode:String! 84 | fileprivate var cardNumberBuffer:String! 85 | 86 | override func viewDidLoad() { 87 | super.viewDidLoad() 88 | self.headerView.backgroundColor = UIColor.init(red: 48.0/255.0, green: 85.0/255.0, blue: 112.0/255.0, alpha: 1.0) 89 | self.setUIControlsTagValues() 90 | self.initializeUIControls() 91 | self.initializeMembers() 92 | 93 | self.updateTokenButton(false) 94 | } 95 | 96 | override func didReceiveMemoryWarning() { 97 | super.didReceiveMemoryWarning() 98 | } 99 | 100 | func setUIControlsTagValues() { 101 | self.cardNumberTextField.tag = 1 102 | self.expirationMonthTextField.tag = 2 103 | self.expirationYearTextField.tag = 3 104 | self.cardVerificationCodeTextField.tag = 4 105 | } 106 | 107 | func initializeUIControls() { 108 | self.cardNumberTextField.text = "" 109 | self.expirationMonthTextField.text = "" 110 | self.expirationYearTextField.text = "" 111 | self.cardVerificationCodeTextField.text = "" 112 | self.textChangeDelegate(self.cardNumberTextField) 113 | self.textChangeDelegate(self.expirationMonthTextField) 114 | self.textChangeDelegate(self.expirationYearTextField) 115 | self.textChangeDelegate(self.cardVerificationCodeTextField) 116 | 117 | self.cardNumberTextField.delegate = self 118 | self.expirationMonthTextField.delegate = self 119 | self.expirationYearTextField.delegate = self 120 | self.cardVerificationCodeTextField.delegate = self 121 | } 122 | 123 | func initializeMembers() { 124 | self.cardNumber = nil 125 | self.cardExpirationMonth = nil 126 | self.cardExpirationYear = nil 127 | self.cardVerificationCode = nil 128 | self.cardNumberBuffer = "" 129 | } 130 | 131 | func darkBlueColor() -> UIColor { 132 | let color = UIColor.init(red: 51.0/255.0, green: 102.0/255.0, blue: 153.0/255.0, alpha: 1.0) 133 | return color 134 | } 135 | 136 | @IBAction func getTokenButtonTapped(_ sender: AnyObject) { 137 | self.activityIndicatorAcceptSDKDemo.startAnimating() 138 | self.updateTokenButton(false) 139 | 140 | self.getToken() 141 | } 142 | 143 | @IBAction func backButtonButtonTapped(_ sender: AnyObject) { 144 | self.navigationController?.popViewController(animated: true) 145 | } 146 | 147 | func updateTokenButton(_ isEnable: Bool) { 148 | self.getTokenButton.isEnabled = isEnable 149 | if isEnable { 150 | self.getTokenButton.backgroundColor = UIColor.init(red: 48.0/255.0, green: 85.0/255.0, blue: 112.0/255.0, alpha: 1.0) 151 | } else { 152 | self.getTokenButton.backgroundColor = UIColor.init(red: 48.0/255.0, green: 85.0/255.0, blue: 112.0/255.0, alpha: 0.2) 153 | } 154 | } 155 | 156 | func getToken() { 157 | 158 | let handler = AcceptSDKHandler(environment: AcceptSDKEnvironment.ENV_TEST) 159 | 160 | let request = AcceptSDKRequest() 161 | request.merchantAuthentication.name = kClientName 162 | request.merchantAuthentication.clientKey = kClientKey 163 | 164 | request.securePaymentContainerRequest.webCheckOutDataType.token.cardNumber = self.cardNumberBuffer 165 | request.securePaymentContainerRequest.webCheckOutDataType.token.expirationMonth = self.cardExpirationMonth 166 | request.securePaymentContainerRequest.webCheckOutDataType.token.expirationYear = self.cardExpirationYear 167 | request.securePaymentContainerRequest.webCheckOutDataType.token.cardCode = self.cardVerificationCode 168 | 169 | handler!.getTokenWithRequest(request, successHandler: { (inResponse:AcceptSDKTokenResponse) -> () in 170 | DispatchQueue.main.async(execute: { 171 | self.updateTokenButton(true) 172 | 173 | self.activityIndicatorAcceptSDKDemo.stopAnimating() 174 | print("Token--->%@", inResponse.getOpaqueData().getDataValue()) 175 | var output = String(format: "Response: %@\nData Value: %@ \nDescription: %@", inResponse.getMessages().getResultCode(), inResponse.getOpaqueData().getDataValue(), inResponse.getOpaqueData().getDataDescriptor()) 176 | output = output + String(format: "\nMessage Code: %@\nMessage Text: %@", inResponse.getMessages().getMessages()[0].getCode(), inResponse.getMessages().getMessages()[0].getText()) 177 | self.textViewShowResults.text = output 178 | self.textViewShowResults.textColor = UIColor.green 179 | }) 180 | }) { (inError:AcceptSDKErrorResponse) -> () in 181 | self.activityIndicatorAcceptSDKDemo.stopAnimating() 182 | self.updateTokenButton(true) 183 | 184 | let output = String(format: "Response: %@\nError code: %@\nError text: %@", inError.getMessages().getResultCode(), inError.getMessages().getMessages()[0].getCode(), inError.getMessages().getMessages()[0].getText()) 185 | self.textViewShowResults.text = output 186 | self.textViewShowResults.textColor = UIColor.red 187 | print(output) 188 | } 189 | } 190 | 191 | func scrollTextViewToBottom(_ textView:UITextView) { 192 | if(textView.text.count > 0 ) 193 | { 194 | let bottom = NSMakeRange(textView.text.count-1, 1) 195 | textView.scrollRangeToVisible(bottom) 196 | } 197 | } 198 | 199 | func updateTextViewWithMessage(_ message:String) { 200 | if message.count > 0 { 201 | self.textViewShowResults.text = self.textViewShowResults.text + message 202 | self.textViewShowResults.text = self.textViewShowResults.text + "\n" 203 | } else { 204 | self.textViewShowResults.text = self.textViewShowResults.text + "Empty Message\n" 205 | } 206 | 207 | self.scrollTextViewToBottom(self.textViewShowResults) 208 | } 209 | 210 | @IBAction func hideKeyBoard(_ sender: AnyObject) { 211 | self.view.endEditing(true) 212 | } 213 | 214 | func formatCardNumber(_ textField:UITextField) { 215 | var value = String() 216 | 217 | if textField == self.cardNumberTextField { 218 | let length = self.cardNumberBuffer.count 219 | 220 | for (i, _) in self.cardNumberBuffer.enumerated() { 221 | 222 | // Reveal only the last character. 223 | if (length <= kAcceptSDKDemoCreditCardObscureLength) { 224 | if (i == (length - 1)) { 225 | let charIndex = self.cardNumberBuffer.index(self.cardNumberBuffer.startIndex, offsetBy: i) 226 | let tempStr = String(self.cardNumberBuffer.suffix(from: charIndex)) 227 | //let singleCharacter = String(tempStr.characters.first) 228 | 229 | value = value + tempStr 230 | } else { 231 | value = value + "●" 232 | } 233 | } else { 234 | if (i < kAcceptSDKDemoCreditCardObscureLength) { 235 | value = value + "●" 236 | } else { 237 | let charIndex = self.cardNumberBuffer.index(self.cardNumberBuffer.startIndex, offsetBy: i) 238 | let tempStr = String(self.cardNumberBuffer.suffix(from: charIndex)) 239 | //let singleCharacter = String(tempStr.characters.first) 240 | //let singleCharacter = String(tempStr.characters.suffix(1)) 241 | 242 | value = value + tempStr 243 | break 244 | } 245 | } 246 | 247 | //After 4 characters add a space 248 | if (((i + 1) % 4 == 0) && (value.count < kAcceptSDKDemoCreditCardLengthPlusSpaces)) { 249 | value = value + kAcceptSDKDemoSpace 250 | } 251 | } 252 | } 253 | 254 | textField.text = value 255 | } 256 | 257 | func isMaxLength(_ textField:UITextField) -> Bool { 258 | var result = false 259 | 260 | if (textField.tag == self.cardNumberTextField.tag && textField.text?.count > kAcceptSDKDemoCreditCardLengthPlusSpaces) 261 | { 262 | result = true 263 | } 264 | 265 | if (textField == self.expirationMonthTextField && textField.text?.count > kAcceptSDKDemoExpirationMonthLength) 266 | { 267 | result = true 268 | } 269 | 270 | if (textField == self.expirationYearTextField && textField.text?.count > kAcceptSDKDemoExpirationYearLength) 271 | { 272 | result = true 273 | } 274 | if (textField == self.cardVerificationCodeTextField && textField.text?.count > kAcceptSDKDemoCVV2Length) 275 | { 276 | result = true 277 | } 278 | 279 | return result 280 | } 281 | 282 | 283 | // MARK: 284 | // MARK: UITextViewDelegate delegate methods 285 | // MARK: 286 | 287 | func textFieldDidBeginEditing(_ textField:UITextField) { 288 | } 289 | 290 | func textFieldShouldBeginEditing(_ textField:UITextField) -> Bool { 291 | return true 292 | } 293 | 294 | func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { 295 | let result = true 296 | 297 | switch (textField.tag) 298 | { 299 | case 1: 300 | if (string.count > 0) 301 | { 302 | if (self.isMaxLength(textField)) { 303 | return false 304 | } 305 | 306 | self.cardNumberBuffer = String(format: "%@%@", self.cardNumberBuffer, string) 307 | } 308 | else 309 | { 310 | if (self.cardNumberBuffer.count > 1) 311 | { 312 | let length = self.cardNumberBuffer.count - 1 313 | 314 | //self.cardNumberBuffer = self.cardNumberBuffer[self.cardNumberBuffer.index(self.cardNumberBuffer.startIndex, offsetBy: 0)...self.cardNumberBuffer.index(self.cardNumberBuffer.startIndex, offsetBy: length-1)] 315 | 316 | self.cardNumberBuffer = String(self.cardNumberBuffer[self.cardNumberBuffer.index(self.cardNumberBuffer.startIndex, offsetBy: 0)...self.cardNumberBuffer.index(self.cardNumberBuffer.startIndex, offsetBy: length - 1)]) 317 | } 318 | else 319 | { 320 | self.cardNumberBuffer = "" 321 | } 322 | } 323 | self.formatCardNumber(textField) 324 | return false 325 | case 2: 326 | 327 | if (string.count > 0) { 328 | if (self.isMaxLength(textField)) { 329 | return false 330 | } 331 | } 332 | 333 | break 334 | case 3: 335 | 336 | if (string.count > 0) { 337 | if (self.isMaxLength(textField)) { 338 | return false 339 | } 340 | } 341 | 342 | break 343 | case 4: 344 | 345 | if (string.count > 0) { 346 | if (self.isMaxLength(textField)) { 347 | return false 348 | } 349 | } 350 | 351 | break 352 | 353 | default: 354 | break 355 | } 356 | 357 | return result 358 | } 359 | 360 | func validInputs() -> Bool { 361 | var inputsAreOKToProceed = false 362 | 363 | let validator = AcceptSDKCardFieldsValidator() 364 | 365 | if (validator.validateSecurityCodeWithString(self.cardVerificationCodeTextField.text!) && validator.validateExpirationDate(self.expirationMonthTextField.text!, inYear: self.expirationYearTextField.text!) && validator.validateCardWithLuhnAlgorithm(self.cardNumberBuffer)) { 366 | inputsAreOKToProceed = true 367 | } 368 | 369 | return inputsAreOKToProceed 370 | } 371 | 372 | 373 | func textFieldDidEndEditing(_ textField: UITextField) { 374 | let validator = AcceptSDKCardFieldsValidator() 375 | 376 | switch (textField.tag) 377 | { 378 | 379 | case 1: 380 | 381 | self.cardNumber = self.cardNumberBuffer 382 | 383 | let luhnResult = validator.validateCardWithLuhnAlgorithm(self.cardNumberBuffer) 384 | 385 | if ((luhnResult == false) || (textField.text?.count < AcceptSDKCardFieldsValidatorConstants.kInAppSDKCardNumberCharacterCountMin)) 386 | { 387 | self.cardNumberTextField.textColor = UIColor.red 388 | } 389 | else 390 | { 391 | self.cardNumberTextField.textColor = self.darkBlueColor() //[UIColor greenColor] 392 | } 393 | 394 | if (self.validInputs()) 395 | { 396 | self.updateTokenButton(true) 397 | } 398 | else 399 | { 400 | self.updateTokenButton(false) 401 | } 402 | 403 | break 404 | case 2: 405 | self.validateMonth(textField) 406 | if let expYear = self.expirationYearTextField.text { 407 | self.validateYear(expYear) 408 | } 409 | 410 | break 411 | case 3: 412 | 413 | self.validateYear(textField.text!) 414 | 415 | break 416 | case 4: 417 | 418 | self.cardVerificationCode = textField.text 419 | 420 | if (validator.validateSecurityCodeWithString(self.cardVerificationCodeTextField.text!)) 421 | { 422 | self.cardVerificationCodeTextField.textColor = self.darkBlueColor() 423 | } 424 | else 425 | { 426 | self.cardVerificationCodeTextField.textColor = UIColor.red 427 | } 428 | 429 | if (self.validInputs()) 430 | { 431 | self.updateTokenButton(true) 432 | } 433 | else 434 | { 435 | self.updateTokenButton(false) 436 | } 437 | 438 | break 439 | 440 | default: 441 | break 442 | } 443 | } 444 | 445 | func textFieldShouldClear(_ textField: UITextField) -> Bool { 446 | if (textField == self.cardNumberTextField) 447 | { 448 | self.cardNumberBuffer = String() 449 | } 450 | 451 | return true 452 | } 453 | 454 | func validateYear(_ textFieldText: String) { 455 | 456 | self.cardExpirationYear = textFieldText 457 | let validator = AcceptSDKCardFieldsValidator() 458 | 459 | let newYear = Int(textFieldText) 460 | if ((newYear >= validator.cardExpirationYearMin()) && (newYear <= AcceptSDKCardFieldsValidatorConstants.kInAppSDKCardExpirationYearMax)) 461 | { 462 | self.expirationYearTextField.textColor = self.darkBlueColor() //[UIColor greenColor] 463 | } 464 | else 465 | { 466 | self.expirationYearTextField.textColor = UIColor.red 467 | } 468 | 469 | if (self.expirationYearTextField.text?.count == 0) 470 | { 471 | return 472 | } 473 | if (self.expirationMonthTextField.text?.count == 0) 474 | { 475 | return 476 | } 477 | if (validator.validateExpirationDate(self.expirationMonthTextField.text!, inYear: self.expirationYearTextField.text!)) 478 | { 479 | self.expirationMonthTextField.textColor = self.darkBlueColor() 480 | self.expirationYearTextField.textColor = self.darkBlueColor() 481 | } 482 | else 483 | { 484 | self.expirationMonthTextField.textColor = UIColor.red 485 | self.expirationYearTextField.textColor = UIColor.red 486 | } 487 | 488 | if (self.validInputs()) 489 | { 490 | self.updateTokenButton(true) 491 | } 492 | else 493 | { 494 | self.updateTokenButton(false) 495 | } 496 | } 497 | 498 | func validateMonth(_ textField: UITextField) { 499 | 500 | self.cardExpirationMonth = textField.text 501 | 502 | if (self.expirationMonthTextField.text?.count == 1) 503 | { 504 | if ((textField.text == "0") == false) { 505 | self.expirationMonthTextField.text = "0" + self.expirationMonthTextField.text! 506 | } 507 | } 508 | 509 | let newMonth = Int(textField.text!) 510 | 511 | if ((newMonth >= AcceptSDKCardFieldsValidatorConstants.kInAppSDKCardExpirationMonthMin) && (newMonth <= AcceptSDKCardFieldsValidatorConstants.kInAppSDKCardExpirationMonthMax)) 512 | { 513 | self.expirationMonthTextField.textColor = self.darkBlueColor() //[UIColor greenColor] 514 | 515 | } 516 | else 517 | { 518 | self.expirationMonthTextField.textColor = UIColor.red 519 | } 520 | 521 | if (self.validInputs()) 522 | { 523 | self.updateTokenButton(true) 524 | } 525 | else 526 | { 527 | self.updateTokenButton(false) 528 | } 529 | } 530 | 531 | func textChangeDelegate(_ textField: UITextField) { 532 | NotificationCenter.default.addObserver(forName: UITextField.textDidChangeNotification, object: textField, queue: nil, using: { note in 533 | if (self.validInputs()) { 534 | self.updateTokenButton(true) 535 | } else { 536 | self.updateTokenButton(false) 537 | } 538 | }) 539 | } 540 | } 541 | 542 | -------------------------------------------------------------------------------- /AcceptSDKSampleAppTests/AcceptSDKSampleAppTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AcceptSDKSampleAppTests.swift 3 | // AcceptSDKSampleAppTests 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/15/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import AcceptSDKSampleApp 11 | 12 | class AcceptSDKSampleAppTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /AcceptSDKSampleAppTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Authorize.Net 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | 3 | 4 | platform :ios, '8.4' 5 | use_frameworks! 6 | 7 | target 'AcceptSDKSampleApp' do 8 | pod 'AuthorizeNetAccept' 9 | end 10 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AuthorizeNetAccept (0.4.0) 3 | 4 | DEPENDENCIES: 5 | - AuthorizeNetAccept 6 | 7 | SPEC REPOS: 8 | https://github.com/cocoapods/specs.git: 9 | - AuthorizeNetAccept 10 | 11 | SPEC CHECKSUMS: 12 | AuthorizeNetAccept: b945d10faa950bbb0cce3aefb9295e065ed0aa48 13 | 14 | PODFILE CHECKSUM: dcb412dd371fb5b1b5f9e4dd990639acda242ab2 15 | 16 | COCOAPODS: 1.7.3 17 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/AcceptBuilder/AcceptSDKBaseInterfaceBuilder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AcceptSDKBaseInterfaceBuilder.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/11/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class AcceptSDKBaseInterfaceBuilder { 12 | } -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/AcceptBuilder/AcceptSDKBaseURLBuilder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AcceptSDKBaseURLBuilder.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/11/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class AcceptSDKBaseURLBuilder { 12 | fileprivate var baseurl:String! 13 | fileprivate var scheme:String! 14 | fileprivate var environmentURL:String! 15 | fileprivate var type:String! 16 | fileprivate var version:String! 17 | 18 | init(){ 19 | self.scheme = "https" 20 | self.environmentURL = AcceptSDKSettings.sharedInstance.acceptSDKEnvironment 21 | self.type = "xml" 22 | self.version = "v1" 23 | self.baseurl = String(format: "%@://%@/%@/%@", arguments: [self.scheme, self.environmentURL, self.type, self.version]) 24 | } 25 | 26 | func getBaseURL()->String { 27 | return self.baseurl 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/AcceptBuilder/AcceptSDKTokenAPIBuilder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AcceptSDKTokenAPIBuilder.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/11/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | private struct AcceptSDKTokenAPIBuilderKeys { 12 | static let kTokenAPI = "request.api" 13 | } 14 | 15 | class AcceptSDKTokenAPIBuilder: AcceptSDKBaseURLBuilder { 16 | 17 | override init() { 18 | super.init() 19 | } 20 | 21 | func getTokenAPIUrl()->String { 22 | return super.getBaseURL()+"/"+AcceptSDKTokenAPIBuilderKeys.kTokenAPI 23 | } 24 | } -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/AcceptBuilder/AcceptSDKTokenInterfaceBuilder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AcceptSDKTokenInterfaceBuilder.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/11/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct AcceptSDKTokenAPIRequest{ 12 | static let kSecurePaymentContainerRequestKey = "securePaymentContainerRequest" 13 | static let kMerchantAuthenticationKey = "merchantAuthentication" 14 | static let kNameKey = "name" 15 | static let kClientKeyKey = "clientKey" 16 | static let kDataKey = "data" 17 | static let kTypeKey = "type" 18 | static let kIdKey = "id" 19 | static let kTokenKey = "token" 20 | static let kCardNumberKey = "cardNumber" 21 | static let kExpirationDateKey = "expirationDate" 22 | static let kFingerPrintKey = "fingerPrint" 23 | static let kHashValueKey = "hashValue" 24 | static let kSequenceKey = "sequence" 25 | static let kTimestampKey = "timestamp" 26 | static let kCurrencyCodeKey = "currencyCode" 27 | static let kAmountKey = "amount" 28 | static let kCardCodeKey = "cardCode" 29 | static let kZipKey = "zip" 30 | static let kFullNameKey = "fullName" 31 | static let kClientId = "clientId" 32 | } 33 | 34 | class AcceptSDKTokenInterfaceBuilder: AcceptSDKBaseInterfaceBuilder { 35 | 36 | var name:String? 37 | var clientKey:String? 38 | var requestType:String? 39 | var merchantId:String? 40 | var cardNumber:String? 41 | var expirationDate:String? 42 | 43 | func withName(_ inName:String)-> Self { 44 | self.name = inName 45 | return self 46 | } 47 | 48 | func withClientKey(_ inClientKey:String)-> Self { 49 | self.clientKey = inClientKey 50 | return self 51 | } 52 | 53 | func withRequestType(_ inRequestType:String)-> Self { 54 | self.requestType = inRequestType 55 | return self 56 | } 57 | 58 | func withMerchantId(_ inMerchantId:String)-> Self { 59 | self.merchantId = inMerchantId 60 | return self 61 | } 62 | 63 | func withCardNumber(_ inCardNumber:String)-> Self { 64 | self.cardNumber = inCardNumber 65 | return self 66 | } 67 | 68 | func withExpirationDate(_ inExpirationDate:String)-> Self { 69 | self.expirationDate = inExpirationDate 70 | return self 71 | } 72 | 73 | func buildInterface()->AcceptSDKTokenInterface { 74 | let acceptSDKInterface = AcceptSDKTokenInterface() 75 | 76 | return acceptSDKInterface 77 | } 78 | 79 | func getRequestJSONString(_ request: AcceptSDKRequest) -> String { 80 | var jsonStr: String = String("") 81 | 82 | let nameKeyValueStr = self.createJSONString(AcceptSDKTokenAPIRequest.kNameKey, value: request.merchantAuthentication.name) 83 | 84 | //fingerprint 85 | var fingerPrintArrayStr = String() 86 | var fingerPrintDictKeyValueStr = String() 87 | 88 | var clientKeyValueStr = String() 89 | if let clientStr = request.merchantAuthentication.clientKey { 90 | clientKeyValueStr = self.createJSONString(AcceptSDKTokenAPIRequest.kClientKeyKey, value: clientStr) 91 | } else { 92 | var sequenceStr = String() 93 | var currenctCodeStr = String() 94 | var amountStr = String() 95 | 96 | let hashValueStr = self.createJSONString(AcceptSDKTokenAPIRequest.kHashValueKey, value: request.merchantAuthentication.fingerPrint!.fingerPrintHashValue) 97 | sequenceStr = self.createJSONString(AcceptSDKTokenAPIRequest.kSequenceKey, value: request.merchantAuthentication.fingerPrint!.sequence) 98 | 99 | // if let seq = request.merchantAuthentication.fingerPrint!.sequence { 100 | // sequenceStr = self.createJSONString(AcceptSDKTokenAPIRequest.kSequenceKey, value: seq) 101 | // } 102 | let timestampStr = self.createJSONString(AcceptSDKTokenAPIRequest.kTimestampKey, value: request.merchantAuthentication.fingerPrint!.timestamp) 103 | if let currenctCode = request.merchantAuthentication.fingerPrint!.currencyCode { 104 | currenctCodeStr = self.createJSONString(AcceptSDKTokenAPIRequest.kCurrencyCodeKey, value: currenctCode) 105 | } 106 | 107 | amountStr = self.createJSONString(AcceptSDKTokenAPIRequest.kAmountKey, value: request.merchantAuthentication.fingerPrint!.amount) 108 | 109 | // if let amt = request.merchantAuthentication.fingerPrint!.amount { 110 | // amountStr = self.createJSONString(AcceptSDKTokenAPIRequest.kAmountKey, value: amt) 111 | // } 112 | 113 | fingerPrintArrayStr = self.createJSONArray(NSArray(arrayLiteral: hashValueStr, sequenceStr, timestampStr, currenctCodeStr, amountStr) as! Array) 114 | fingerPrintDictKeyValueStr = self.createJSONDict(AcceptSDKTokenAPIRequest.kFingerPrintKey, valueString: fingerPrintArrayStr) 115 | } 116 | 117 | var authenticationArrayStr = String() 118 | 119 | authenticationArrayStr = self.createJSONArray(NSArray(arrayLiteral: nameKeyValueStr, clientKeyValueStr, fingerPrintDictKeyValueStr) as! Array) 120 | 121 | let merchantAuthenticationDictStr = self.createJSONDict(AcceptSDKTokenAPIRequest.kMerchantAuthenticationKey, valueString: authenticationArrayStr) 122 | 123 | let typeKeyValueStr = self.createJSONString(AcceptSDKTokenAPIRequest.kTypeKey, value: request.securePaymentContainerRequest.webCheckOutDataType.type) 124 | let idKeyValueStr = self.createJSONString(AcceptSDKTokenAPIRequest.kIdKey, value: request.securePaymentContainerRequest.webCheckOutDataType.id) 125 | 126 | //token dict 127 | let cardNumberKeyValueStr = self.createJSONString(AcceptSDKTokenAPIRequest.kCardNumberKey, value: (request.securePaymentContainerRequest.webCheckOutDataType.token.cardNumber)) 128 | 129 | let expiryDate = (request.securePaymentContainerRequest.webCheckOutDataType.token.expirationMonth + request.securePaymentContainerRequest.webCheckOutDataType.token.expirationYear) 130 | let expirationDateKeyValueStr = self.createJSONString(AcceptSDKTokenAPIRequest.kExpirationDateKey, value: expiryDate) 131 | 132 | var cvvKeyValueStr = String() 133 | if let ccode = request.securePaymentContainerRequest.webCheckOutDataType.token.cardCode { 134 | cvvKeyValueStr = self.createJSONString(AcceptSDKTokenAPIRequest.kCardCodeKey, value: ccode) 135 | } 136 | var zipKeyValueStr = String() 137 | var fullNameKeyValueStr = String() 138 | if let zip = request.securePaymentContainerRequest.webCheckOutDataType.token.zip { 139 | zipKeyValueStr = self.createJSONString(AcceptSDKTokenAPIRequest.kZipKey, value: zip) 140 | } 141 | if let fName = request.securePaymentContainerRequest.webCheckOutDataType.token.fullName { 142 | fullNameKeyValueStr = self.createJSONString(AcceptSDKTokenAPIRequest.kFullNameKey, value: fName) 143 | } 144 | let cardDetailsArrayStr = self.createJSONArray(NSArray(arrayLiteral: cardNumberKeyValueStr, expirationDateKeyValueStr, cvvKeyValueStr, zipKeyValueStr, fullNameKeyValueStr) as! Array) 145 | let tokenDictKeyValueStr = self.createJSONDict(AcceptSDKTokenAPIRequest.kTokenKey, valueString: cardDetailsArrayStr) 146 | 147 | let dataArrayStr = self.createJSONArray(NSArray(arrayLiteral: typeKeyValueStr, idKeyValueStr, tokenDictKeyValueStr) as! Array) 148 | let dataDictStr = self.createJSONDict(AcceptSDKTokenAPIRequest.kDataKey, valueString: dataArrayStr) 149 | 150 | let clientIdKeyValueStr = self.createJSONString(AcceptSDKTokenAPIRequest.kClientId, value: request.clientId) 151 | let finalArrayStr = self.createJSONArray(NSArray(arrayLiteral: merchantAuthenticationDictStr, clientIdKeyValueStr, dataDictStr) as! Array) 152 | jsonStr = self.createJSONFinalDict(AcceptSDKTokenAPIRequest.kSecurePaymentContainerRequestKey, valueString: finalArrayStr) 153 | 154 | return jsonStr 155 | } 156 | 157 | func createJSONString(_ withKey: String, value: String) -> String { 158 | let jsonStr = String(format: "\"%@\":\"%@\"", withKey, value) 159 | 160 | return jsonStr 161 | } 162 | 163 | func createJSONArray(_ arrayOfKeyValuePairs: Array) -> String { 164 | var jsonStr:String = "" 165 | 166 | var index = 1 167 | 168 | for pair in arrayOfKeyValuePairs { 169 | if pair.count > 0 { 170 | if index < arrayOfKeyValuePairs.count { 171 | jsonStr = jsonStr + pair + "," 172 | } else { 173 | jsonStr = jsonStr + pair 174 | } 175 | } 176 | index += 1 177 | } 178 | 179 | let lastChar = jsonStr.last! 180 | if lastChar == "," { 181 | jsonStr = String(jsonStr[.. String { 188 | let jsonStr = String(format: "\"%@\":{ %@ }", key, valueString) 189 | 190 | return jsonStr 191 | } 192 | 193 | func createJSONFinalDict(_ key: String, valueString: String) -> String { 194 | let jsonStr = String(format: "{\"%@\":{ %@ }}", key, valueString) 195 | 196 | return jsonStr 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/AcceptSDKHandler.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AcceptSDKHandler.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/11/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | @objc public enum AcceptSDKEnvironment: Int { 12 | case ENV_LIVE //= "api.authorize.net" 13 | case ENV_TEST //= "apitest.authorize.net" 14 | 15 | public typealias RawValue = String 16 | 17 | public var rawValue: RawValue { 18 | switch self { 19 | case .ENV_LIVE: 20 | return "api.authorize.net" 21 | case .ENV_TEST: 22 | return "apitest.authorize.net" 23 | } 24 | } 25 | 26 | public init?(rawValue: RawValue) { 27 | switch rawValue { 28 | case "api.authorize.net": 29 | self = .ENV_LIVE 30 | case "apitest.authorize.net": 31 | self = .ENV_TEST 32 | default: 33 | self = .ENV_LIVE 34 | } 35 | } 36 | 37 | } 38 | 39 | open class AcceptSDKHandler : NSObject { 40 | 41 | public override init() { 42 | super.init() 43 | } 44 | 45 | @objc public init?(environment: AcceptSDKEnvironment) { 46 | super.init() 47 | 48 | let settings = AcceptSDKSettings.sharedInstance 49 | settings.acceptSDKEnvironment = environment.rawValue 50 | } 51 | 52 | @objc open func getTokenWithRequest(_ inRequest: AcceptSDKRequest, successHandler:@escaping (AcceptSDKTokenResponse)->(),failureHandler:@escaping (AcceptSDKErrorResponse)->()) { 53 | 54 | inRequest.validate({ (isSuccess) -> () in 55 | let sdkInternal = AcceptSDKInternal() 56 | sdkInternal.getToken(inRequest, success: successHandler, failure: failureHandler) 57 | }, failureHandler: failureHandler) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/AcceptSDKInternal.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AcceptSDKInternal.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/11/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class AcceptSDKInternal { 12 | func getToken(_ paymentRequest: AcceptSDKRequest, success:@escaping (AcceptSDKTokenResponse)->(), failure:@escaping (AcceptSDKErrorResponse)->()) { 13 | let acceptSDKInteface = self.getTokenInterface() 14 | 15 | acceptSDKInteface.getToken(paymentRequest, success: {(response:AcceptSDKTokenResponse)->() in 16 | success(response) 17 | }, failure: {(inError:AcceptSDKErrorResponse)->() in 18 | failure(inError) 19 | }) 20 | } 21 | 22 | func getTokenInterface()->AcceptSDKTokenInterface { 23 | let interfaceBuilder = AcceptSDKTokenInterface() 24 | return interfaceBuilder 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/AcceptSDKSettings.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AcceptSDKSettings.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/11/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | open class AcceptSDKSettings : NSObject { 12 | 13 | @objc static let sharedInstance = AcceptSDKSettings() 14 | 15 | @objc var acceptSDKEnvironment : String? 16 | 17 | @objc static func setAcceptSDKEnvironment(_ environment: String) { 18 | sharedInstance.acceptSDKEnvironment = environment; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/Interface/AcceptSDKBaseInterface.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AcceptSDKBaseInterface.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/11/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct AcceptSDKResponse { 12 | static let kResultCodeKey = "resultCode" 13 | static let kResultCodeOkValueKey = "Ok" 14 | static let kResultCodeErrorValueKey = "Error" 15 | static let kErrorKey = "errors" 16 | static let kStatusCode = "code" 17 | static let kStatusTextKey = "text" 18 | static let kMessagesKey = "messages" 19 | } 20 | 21 | struct AcceptSDKCompletionHandlers { 22 | typealias AcceptSDKSuccessHandler = (_ withResponse:AcceptSDKTokenResponse)->() 23 | typealias AcceptSDKValidationSuccessHandler = (_ isSuccess:Bool)->() 24 | typealias AcceptSDKFailureHandler = (_ withResponse:AcceptSDKErrorResponse)->() 25 | } 26 | 27 | struct AcceptSDKFailureHandlers { 28 | } 29 | 30 | class AcceptSDKBaseInterface { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/Interface/AcceptSDKTokenInterface.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AcceptSDKTokenInterface.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/11/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class AcceptSDKTokenInterface: AcceptSDKBaseInterface { 12 | 13 | func getToken(_ paymentRequest: AcceptSDKRequest, success:@escaping AcceptSDKCompletionHandlers.AcceptSDKSuccessHandler, failure:@escaping (AcceptSDKErrorResponse)->()) { 14 | let tokenAPIBuilder = AcceptSDKTokenAPIBuilder() 15 | let urlString = tokenAPIBuilder.getTokenAPIUrl() 16 | 17 | let interfaceBuilder = AcceptSDKTokenInterfaceBuilder() 18 | 19 | let bodyParameterDictionary = interfaceBuilder.getRequestJSONString(paymentRequest) 20 | 21 | let httpConnection = HttpConnection() 22 | httpConnection.performPostRequest(urlString, httpHeaders: nil, bodyParameters: bodyParameterDictionary, 23 | success: { (inDict:Dictionary) -> () in 24 | self.handleResponse(inDict, 25 | successHandler: { (isSuccess) -> () in 26 | success(AcceptSDKTokenResponse(inDict:inDict)) 27 | }, 28 | failureHandler: { (isSuccess) -> () in 29 | failure(AcceptSDKErrorResponse(inMappingErrorDict: inDict)) 30 | })}, 31 | failure: { (inError:NSError) -> () in 32 | failure(AcceptSDKErrorResponse(inError: inError)) 33 | }) 34 | } 35 | 36 | fileprivate func handleResponse(_ response:Dictionary,successHandler:(_ isSuccess:Bool)->(),failureHandler:(_ isSuccess:Bool)->()) { 37 | let messagesDict = response[AcceptSDKResponse.kMessagesKey] 38 | let statusCode = messagesDict![AcceptSDKResponse.kResultCodeKey] as? String 39 | if statusCode == AcceptSDKResponse.kResultCodeOkValueKey { 40 | successHandler(true) 41 | } else if statusCode == AcceptSDKResponse.kResultCodeErrorValueKey { 42 | failureHandler(false) 43 | } else { 44 | //some thing is missing! 45 | print("error handling missing!!!") 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/Network/AccepSDKtHttp.swift: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // IAPHttp.swift 4 | // AcceptSDK 5 | // 6 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/11/16. 7 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 8 | // 9 | 10 | import Foundation 11 | 12 | let HTTP_TIMEOUT = TimeInterval(30) 13 | 14 | private struct HTTPStatusCode { 15 | static let kHTTPSuccessCode = 200 16 | static let kHTTPCreationSuccessCode = 201 17 | } 18 | 19 | class HttpRequest { 20 | var method : String? 21 | var url : String? 22 | var httpHeaders : Dictionary ? 23 | var bodyParameters: String? 24 | 25 | init(httMethod : String, url : String, httpHeaders : Dictionary ?, bodyParameters : String?){ 26 | self.method = httMethod 27 | self.url = url 28 | 29 | if let parameters = httpHeaders { 30 | self.httpHeaders = parameters 31 | } 32 | 33 | if let parameters = bodyParameters { 34 | self.bodyParameters = parameters 35 | } 36 | } 37 | 38 | internal func urlRequest () -> NSMutableURLRequest { 39 | let result = NSMutableURLRequest(url: URL(string: self.url!)!) 40 | // result.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") 41 | result.setValue("application/json", forHTTPHeaderField: "Accept") 42 | result.timeoutInterval = HTTP_TIMEOUT 43 | result.httpMethod = self.method! 44 | 45 | if let parameters = self.bodyParameters { 46 | result.setBodyContent(parameters) 47 | } 48 | 49 | if let parameters = self.httpHeaders { 50 | for (headerField, value) in parameters { 51 | result.setValue(value as? String, forHTTPHeaderField: headerField) 52 | } 53 | } 54 | 55 | return result 56 | } 57 | } 58 | 59 | private struct HTTPErrorKeys { 60 | static let kErrorsKey = "errors" 61 | static let kErrorTypeKey = "type" 62 | static let kErrorMessageKey = "message" 63 | } 64 | 65 | struct HTTPErrorResponseCode { 66 | static let apiErrorResponseCode = 4000 67 | static let kErrorDictionaryKey = "Error_Info_Dict" 68 | } 69 | 70 | class HTTPResponse { 71 | var code : Int? 72 | var body : Dictionary ? 73 | var error : NSError? 74 | 75 | init () { 76 | } 77 | } 78 | 79 | class HTTP: NSObject, URLSessionDelegate { 80 | 81 | func request(_ request : HttpRequest) -> HTTPResponse { 82 | 83 | let urlRequest : NSMutableURLRequest = request.urlRequest() 84 | 85 | return self.requestSynchronousData(urlRequest as URLRequest) 86 | 87 | } 88 | 89 | fileprivate func requestSynchronousData(_ request: URLRequest) -> HTTPResponse { 90 | let httpResponse = HTTPResponse() 91 | 92 | let semaphore: DispatchSemaphore = DispatchSemaphore(value: 0) 93 | 94 | let sessionConfiguration = URLSessionConfiguration.ephemeral 95 | let session = URLSession(configuration: sessionConfiguration, delegate: self, delegateQueue: nil) 96 | 97 | let task = session.dataTask(with: request, completionHandler: { 98 | taskData, response, error -> () in 99 | if (error != nil) { 100 | httpResponse.error = error as NSError? 101 | } 102 | else if let castedResponse = response as? HTTPURLResponse { 103 | let bodyDict = self.deserializeData(taskData!) 104 | 105 | if HTTPStatusCode.kHTTPSuccessCode == castedResponse.statusCode || HTTPStatusCode.kHTTPCreationSuccessCode == castedResponse.statusCode { 106 | httpResponse.body = bodyDict 107 | } else { 108 | let (errorMessage) = self.getErrorResponse(bodyDict!) 109 | if let message = errorMessage { 110 | httpResponse.error = NSError(domain: message, code: castedResponse.statusCode, userInfo:[NSLocalizedDescriptionKey:message,HTTPErrorResponseCode.kErrorDictionaryKey:bodyDict!]) 111 | }else { 112 | httpResponse.error = NSError(domain: "BadResponse", code: castedResponse.statusCode, userInfo:nil) 113 | } 114 | } 115 | } 116 | 117 | semaphore.signal(); 118 | }) 119 | task.resume() 120 | _ = semaphore.wait(timeout: DispatchTime.distantFuture) 121 | return httpResponse 122 | } 123 | 124 | fileprivate func getErrorResponse(_ responseDict:Dictionary)->String? { 125 | var errorMessage:String? 126 | if let errorArray = responseDict[HTTPErrorKeys.kErrorsKey] as? [[String:String]] { 127 | if let error = errorArray.first { 128 | errorMessage = error[HTTPErrorKeys.kErrorMessageKey] 129 | } 130 | } 131 | return errorMessage 132 | } 133 | 134 | fileprivate func serializeJson (_ json : Dictionary ) -> Data? { 135 | let result : Data? = try! JSONSerialization.data(withJSONObject: json, options: []) 136 | 137 | return result; 138 | } 139 | 140 | fileprivate func deserializeData (_ data : Data) -> Dictionary? { 141 | var jsonDict:Dictionary = [:] 142 | do{ 143 | jsonDict = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.mutableContainers) as! Dictionary 144 | } 145 | catch _ as NSError{ 146 | //todo handle error 147 | } 148 | return jsonDict 149 | 150 | } 151 | } 152 | 153 | extension NSMutableURLRequest { 154 | @objc func setBodyContent(_ contentStr: String?) { 155 | self.httpBody = contentStr!.data(using: String.Encoding.utf8) 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/Network/AcceptSDKHttpConnection.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HttpConnection.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/11/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class HttpConnection{ 12 | var http : HTTP? 13 | 14 | fileprivate let requestQueue : DispatchQueue 15 | fileprivate let responseQueue : DispatchQueue 16 | 17 | init () { 18 | self.requestQueue = DispatchQueue(label: "AcceptSDKRequestQueue", attributes: []) 19 | self.responseQueue = DispatchQueue.main 20 | self.http = HTTP() 21 | } 22 | 23 | func performPostRequest(_ url : String, httpHeaders : Dictionary?, bodyParameters:String?, success : @escaping (Dictionary) -> (), failure : @escaping (NSError) -> ()) { 24 | self.performRequestAsynchronously(url, method: "POST", httpHeaders: httpHeaders, bodyParameters: bodyParameters, success: success, failure: failure) 25 | } 26 | 27 | func performRequestAsynchronously (_ url : String, method : String, httpHeaders : Dictionary?, bodyParameters:String?, success : @escaping (Dictionary) -> (), failure : @escaping (NSError) -> ()) { 28 | 29 | self.requestQueue.async(execute: { 30 | 31 | let request = HttpRequest(httMethod: method, url: url, httpHeaders: httpHeaders, bodyParameters:bodyParameters) 32 | 33 | let response : HTTPResponse = self.http!.request(request) 34 | 35 | self.responseQueue.async(execute: { 36 | if response.error != nil { 37 | failure(response.error!) 38 | } 39 | else { 40 | success(response.body!) 41 | } 42 | }) 43 | }) 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/Request/AcceptSDKPaymentRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AcceptSDKPaymentRequest.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/11/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | open class AcceptSDKRequest: NSObject { 12 | @objc open var merchantAuthentication:MerchantAuthenticaton = MerchantAuthenticaton() 13 | @objc open var securePaymentContainerRequest:SecurePaymentContainerRequest = SecurePaymentContainerRequest() 14 | @objc let clientId = "accept-sdk-ios-1.0.0" 15 | 16 | @objc func validate(_ successHandler:@escaping (_ isSuccess:Bool)->(),failureHandler:@escaping (_ withResponse:AcceptSDKErrorResponse)->()) { 17 | self.merchantAuthentication.validate({_ in 18 | self.securePaymentContainerRequest.validate(successHandler, failureHandler: failureHandler) 19 | }, failureHandler: failureHandler) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/Request/FingerPrint.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FingerPrint.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/16/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | fileprivate func < (lhs: T?, rhs: T?) -> Bool { 11 | switch (lhs, rhs) { 12 | case let (l?, r?): 13 | return l < r 14 | case (nil, _?): 15 | return true 16 | default: 17 | return false 18 | } 19 | } 20 | 21 | fileprivate func > (lhs: T?, rhs: T?) -> Bool { 22 | switch (lhs, rhs) { 23 | case let (l?, r?): 24 | return l > r 25 | default: 26 | return rhs < lhs 27 | } 28 | } 29 | 30 | 31 | open class FingerPrint: NSObject { 32 | @objc open var fingerPrintHashValue:String = String() 33 | @objc open var sequence:String = String() 34 | @objc open var timestamp:String = String() 35 | @objc open var currencyCode:String? 36 | @objc open var amount:String = String() 37 | 38 | @objc public init?(inHashValue: String, inSequence: String, inTimestamp: String, inCurrencyCode: String?, inAmount: String?) { 39 | // guard inHashValue.characters.count > 0 else {return nil} 40 | // guard inTimestamp.characters.count > 0 else {return nil} 41 | 42 | self.fingerPrintHashValue = inHashValue 43 | self.timestamp = inTimestamp 44 | self.sequence = inSequence 45 | if let unwrappedCurrencyCode = inCurrencyCode { 46 | self.currencyCode = unwrappedCurrencyCode 47 | } 48 | if let unwrappedAmount = inAmount { 49 | self.amount = unwrappedAmount 50 | } 51 | } 52 | 53 | @objc func validate(_ successHandler:(_ isSuccess:Bool)->(),failureHandler:(_ withResponse:AcceptSDKErrorResponse)->()) { 54 | 55 | if self.fingerPrintHashValue.isEmpty == false { 56 | if isValidTimestamp() { 57 | if self.sequence.isEmpty == false { 58 | if self.isValidAmount() { 59 | successHandler(true) 60 | } else { 61 | failureHandler(self.getSDKErrorResponse("E_WC_13", message: "Invalid Fingerprint.")) 62 | } 63 | } else { 64 | failureHandler(self.getSDKErrorResponse("E_WC_12", message: "Sequence attribute should not be blank.")) 65 | } 66 | } else { 67 | failureHandler(self.getSDKErrorResponse("E_WC_11", message: "Please provide valid timestamp in utc.")) 68 | } 69 | } else { 70 | failureHandler(self.getSDKErrorResponse("E_WC_09", message: "Fingerprint hash should not be blank.")) 71 | } 72 | } 73 | 74 | @objc func isValidTimestamp() -> Bool { 75 | var isValid = false 76 | 77 | if ((self.timestamp.count > 0) && AcceptSDKStringValidator.isAlphanumeric(self.timestamp) == false) && (AcceptSDKStringValidator.isStringIsNegativeNumber(self.timestamp) == false) && (AcceptSDKStringValidator.isStringContainsDecimalCharacter(self.timestamp) == false) { 78 | isValid = true 79 | } 80 | 81 | return isValid 82 | } 83 | 84 | @objc func isValidAmount() -> Bool { 85 | var isValid = false 86 | 87 | /* 88 | if let indexForCharacterInString = inAmount.characters.indexOf(".") { 89 | let subStr = inAmount.substringFromIndex(indexForCharacterInString) 90 | 91 | if (subStr.characters.count - 1) == 2{ 92 | isValid = true 93 | } 94 | } 95 | */ 96 | 97 | let amt = Double(self.amount) 98 | if AcceptSDKStringValidator.isAlphanumeric(self.amount) == false && amt > 0 { 99 | isValid = true 100 | } 101 | 102 | return isValid 103 | } 104 | 105 | 106 | @objc func getSDKErrorResponse(_ withCode: String, message:String) -> AcceptSDKErrorResponse { 107 | let message = Message(inErrorCode: withCode, inErrorMessage: message) 108 | return AcceptSDKErrorResponse(withMessage: message) 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/Request/MerchantAuthenticaton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MerchantAuthenticaton.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/16/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | open class MerchantAuthenticaton: NSObject { 13 | @objc open var name = String() 14 | @objc open var fingerPrint: FingerPrint? 15 | @objc open var clientKey: String? 16 | @objc open var mobileDeviceId:String? 17 | 18 | @objc func validate(_ successHandler:@escaping (_ isSuccess:Bool)->(),failureHandler:@escaping (_ withResponse:AcceptSDKErrorResponse)->()) { 19 | 20 | if ((self.clientKey?.isEmpty) == nil && self.fingerPrint == nil) { 21 | failureHandler(self.getSDKErrorResponse("E_WC_18", message: "Client key is required.")) 22 | return 23 | } 24 | 25 | if let key = self.clientKey { 26 | //todo change this..redundant check 27 | if key.count > 0 { 28 | if let errorResponse = self.validateOptionalFileds(self.name, inDeviceId: self.mobileDeviceId) { 29 | failureHandler(errorResponse) 30 | } else { 31 | successHandler(true) 32 | } 33 | } 34 | } else { 35 | self.fingerPrint!.validate({ (isSuccess) -> () in 36 | if let errorResponse = self.validateOptionalFileds(self.name, inDeviceId: self.mobileDeviceId) { 37 | failureHandler(errorResponse) 38 | } else { 39 | successHandler(true) 40 | } 41 | }, failureHandler: failureHandler) 42 | } 43 | } 44 | 45 | @objc func validateOptionalFileds(_ inName: String?, inDeviceId: String?) -> AcceptSDKErrorResponse? { 46 | 47 | var errorResponse:AcceptSDKErrorResponse? 48 | 49 | if let validName = inName { 50 | if isValidName(validName) { 51 | } else { 52 | errorResponse = self.getSDKErrorResponse("E_WC_10", message: "Please provide valid apiloginid.") 53 | } 54 | } 55 | 56 | if let deviceId = inDeviceId { 57 | if isValidMobileDeviceId(deviceId) { 58 | } else { 59 | errorResponse = self.getSDKErrorResponse("E_WC_04", message: "Please provide mandatory fileds") 60 | } 61 | } 62 | 63 | return errorResponse 64 | } 65 | 66 | @objc func isValidName(_ inName:String) -> Bool { 67 | var isValid = false 68 | 69 | if inName.count >= 1 && inName.count <= 25 { 70 | isValid = true 71 | } 72 | 73 | return isValid 74 | } 75 | 76 | @objc func isValidMobileDeviceId(_ inValidMobileDeviceId:String) -> Bool { 77 | var isValid = false 78 | 79 | if inValidMobileDeviceId.count >= 1 && inValidMobileDeviceId.count <= 60 { 80 | isValid = true 81 | } 82 | 83 | return isValid 84 | } 85 | 86 | @objc func getSDKErrorResponse(_ withCode: String, message:String) -> AcceptSDKErrorResponse { 87 | let message = Message(inErrorCode: withCode, inErrorMessage: message) 88 | return AcceptSDKErrorResponse(withMessage: message) 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/Request/SecurePaymentContainerRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SecurePaymentContainerRequest.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/16/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | enum WebCheckOutTypeEnum: String { 13 | //case kPAN = "PAN" 14 | case kToken = "TOKEN" 15 | } 16 | 17 | open class SecurePaymentContainerRequest: NSObject { 18 | @objc open var webCheckOutDataType:WebCheckOutDataType = WebCheckOutDataType() 19 | 20 | @objc func validate(_ successHandler:@escaping (_ isSuccess:Bool)->(),failureHandler:(_ withResponse:AcceptSDKErrorResponse)->()) { 21 | self.webCheckOutDataType.validate(successHandler, failureHandler: failureHandler) 22 | } 23 | } 24 | 25 | open class WebCheckOutDataType: NSObject { 26 | @objc var type = WebCheckOutTypeEnum.kToken.rawValue 27 | @objc var id = UIDevice.current.identifierForVendor!.uuidString 28 | @objc open var token:Token = Token() 29 | 30 | @objc func validate(_ successHandler:@escaping (_ isSuccess:Bool)->(),failureHandler:(_ withResponse:AcceptSDKErrorResponse)->()) { 31 | 32 | if isValidType() { 33 | if (isValidId()) { 34 | self.token.validate({ (isSuccess) -> () in 35 | successHandler(true) 36 | }, failureHandler: failureHandler) 37 | } else { 38 | failureHandler(self.getSDKErrorResponse("E_WC_04", message: "Invalid id")) 39 | } 40 | } else { 41 | failureHandler(self.getSDKErrorResponse("E_WC_04", message: "Invalid type")) 42 | return 43 | } 44 | 45 | } 46 | 47 | @objc func isValidType() -> Bool { 48 | var isValid = false 49 | 50 | if self.type.count > 0 { 51 | isValid = true 52 | } 53 | 54 | return isValid 55 | } 56 | 57 | @objc func isValidId() -> Bool { 58 | var isValid = false 59 | 60 | if self.id.count >= 1 && self.id.count <= 64 { 61 | isValid = true 62 | } 63 | 64 | return isValid 65 | } 66 | 67 | @objc func getSDKErrorResponse(_ withCode: String, message:String) -> AcceptSDKErrorResponse { 68 | let message = Message(inErrorCode: withCode, inErrorMessage: message) 69 | return AcceptSDKErrorResponse(withMessage: message) 70 | } 71 | } 72 | 73 | open class Token: NSObject { 74 | @objc open var cardNumber:String = String() 75 | // public var expirationDate:String = String() 76 | @objc open var expirationMonth = String() 77 | @objc open var expirationYear = String() 78 | @objc open var cardCode:String? 79 | @objc open var zip:String? 80 | @objc open var fullName:String? 81 | 82 | @objc func validate(_ successHandler:(_ isSuccess:Bool)->(),failureHandler:(_ withResponse:AcceptSDKErrorResponse)->()) { 83 | if isValidCardNumber() { 84 | if isValidExpirationMonth() { 85 | if isValidExpirationYear() { 86 | if isValidExpirationDate() { 87 | var intermediateResult = true 88 | var errorResponse:AcceptSDKErrorResponse? 89 | 90 | if let zipCode = self.zip { 91 | if isValidZip(zipCode) { 92 | } else { 93 | intermediateResult = false 94 | errorResponse = self.getSDKErrorResponse("E_WC_16", message: "Please provide valid Zip code.") 95 | } 96 | } 97 | if let fName = self.fullName { 98 | if isValidFullName(fName) { 99 | } else { 100 | intermediateResult = false 101 | errorResponse = self.getSDKErrorResponse("E_WC_17", message: "Please provide valid card holder name.") 102 | } 103 | } 104 | if let code = self.cardCode { 105 | if isValidCardCode(code) { 106 | } else { 107 | intermediateResult = false 108 | errorResponse = self.getSDKErrorResponse("E_WC_15", message: "Please provide valid CVV.") 109 | } 110 | } 111 | 112 | if intermediateResult { 113 | successHandler(true) 114 | } else { 115 | failureHandler(errorResponse!) 116 | } 117 | } else { 118 | failureHandler(self.getSDKErrorResponse("E_WC_08", message: "Expiration date must be in the future.")) 119 | } 120 | } else { 121 | failureHandler(self.getSDKErrorResponse("E_WC_07", message: "Please provide valid expiration year.")) 122 | } 123 | } else { 124 | failureHandler(self.getSDKErrorResponse("E_WC_06", message: "Please provide valid expiration month.")) 125 | } 126 | } else { 127 | failureHandler(self.getSDKErrorResponse("E_WC_05", message: "Please provide valid credit card number.")) 128 | } 129 | } 130 | 131 | @objc func isValidCardNumber() -> Bool { 132 | var isValid = false 133 | let validator = AcceptSDKCardFieldsValidator() 134 | 135 | if ((AcceptSDKStringValidator.isAlphanumeric(self.cardNumber) == false) && (AcceptSDKStringValidator.isStringContainsDecimalCharacter(self.cardNumber) == false) && (AcceptSDKStringValidator.isStringIsNegativeNumber(self.cardNumber) == false) && self.cardNumber.count >= 4 && self.cardNumber.count <= 16 && validator.validateCardWithLuhnAlgorithm(self.cardNumber)) { 136 | isValid = true 137 | } 138 | 139 | return isValid 140 | } 141 | 142 | @objc func isValidExpirationMonth() -> Bool { 143 | 144 | if (self.expirationMonth.count == 1) 145 | { 146 | if ((self.expirationMonth == "0") == false) { 147 | self.expirationMonth = "0" + self.expirationMonth 148 | } 149 | } 150 | 151 | var isValid = false 152 | let validator = AcceptSDKCardFieldsValidator() 153 | 154 | if self.expirationMonth.count >= 1 && self.expirationMonth.count <= 2 && validator.validateMonthWithString(self.expirationMonth) { 155 | isValid = true 156 | } 157 | 158 | return isValid 159 | } 160 | 161 | @objc func isValidExpirationYear() -> Bool { 162 | var isValid = false 163 | let validator = AcceptSDKCardFieldsValidator() 164 | 165 | if validator.validateYearWithString(self.expirationYear) { 166 | isValid = true 167 | } 168 | 169 | return isValid 170 | } 171 | 172 | @objc func isValidExpirationDate() -> Bool { 173 | var isValid = false 174 | let validator = AcceptSDKCardFieldsValidator() 175 | 176 | if /*inDateStr.characters.count >= 4 && inDateStr.characters.count <= 7 && */validator.validateExpirationDate(self.expirationMonth, inYear:self.expirationYear) { 177 | isValid = true 178 | } 179 | 180 | return isValid 181 | } 182 | 183 | @objc func isValidZip(_ inZip:String) -> Bool { 184 | var isValid = false 185 | 186 | if inZip.count >= 1 && inZip.count <= 20 && (AcceptSDKStringValidator.isStringContainsOnlySpaces(inZip) == false) && (AcceptSDKStringValidator.isStringContainsSpaceAtBeginningAndEnd(inZip) == false) { 187 | isValid = true 188 | } 189 | 190 | return isValid 191 | } 192 | 193 | @objc func isValidFullName(_ inFullName:String) -> Bool { 194 | var isValid = false 195 | 196 | if inFullName.count >= 1 && inFullName.count <= 64 && (AcceptSDKStringValidator.isStringContainsOnlySpaces(inFullName) == false) { 197 | isValid = true 198 | } 199 | 200 | return isValid 201 | } 202 | 203 | @objc func isValidCardCode(_ inCardCode:String) -> Bool { 204 | var isValid = false 205 | let validator = AcceptSDKCardFieldsValidator() 206 | 207 | if validator.validateSecurityCodeWithString(inCardCode) { 208 | isValid = true 209 | } 210 | 211 | return isValid 212 | } 213 | 214 | @objc func getSDKErrorResponse(_ withCode: String, message:String) -> AcceptSDKErrorResponse { 215 | let message = Message(inErrorCode: withCode, inErrorMessage: message) 216 | return AcceptSDKErrorResponse(withMessage: message) 217 | } 218 | 219 | } 220 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/Response/AcceptSDKErrorResponse.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AcceptSDKErrorResponse.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/13/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | open class AcceptSDKErrorResponse: NSObject { 12 | fileprivate var messages:Messages! 13 | 14 | @objc convenience init(inDict:Dictionary) { 15 | self.init() 16 | 17 | if let messagesDict = inDict[AcceptSDKTokenResponseKeys.kMessagesKey] as? Dictionary { 18 | self.messages = Messages(inDict: messagesDict) 19 | } 20 | } 21 | 22 | @objc convenience init(inMappingErrorDict:Dictionary) { 23 | self.init() 24 | 25 | if let messagesDict = inMappingErrorDict[AcceptSDKTokenResponseKeys.kMessagesKey] as? Dictionary { 26 | self.messages = Messages(inMappingErrorDict: messagesDict) 27 | } 28 | } 29 | 30 | @objc convenience init(inError: NSError) { 31 | self.init() 32 | 33 | self.messages = Messages(inError: inError) 34 | } 35 | 36 | @objc convenience init(withMessage: Message) { 37 | self.init() 38 | 39 | self.messages = Messages(withMessage: withMessage) 40 | } 41 | 42 | @objc open func getMessages() -> Messages { 43 | return self.messages 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/Response/AcceptSDKTokenResponse.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AcceptSDKTokenResposnse.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/11/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct AcceptSDKTokenResponseKeys { 12 | static let kOpaqueDataKey = "opaqueData" 13 | static let kDataDescriptorKey = "dataDescriptor" 14 | static let kDataValueKey = "dataValue" 15 | static let kMessagesKey = "messages" 16 | static let kResultCodeKey = "resultCode" 17 | static let kMessageKey = "message" 18 | static let kCodeKey = "code" 19 | static let kTextKey = "text" 20 | } 21 | 22 | open class AcceptSDKTokenResponse: NSObject { 23 | fileprivate var opaqueData:OpaqueData! 24 | fileprivate var messages:Messages! 25 | 26 | @objc convenience init(inDict:Dictionary) { 27 | self.init() 28 | 29 | if let opaqueDataDict = inDict[AcceptSDKTokenResponseKeys.kOpaqueDataKey] as? Dictionary { 30 | self.opaqueData = OpaqueData(inDict:opaqueDataDict) 31 | } 32 | 33 | if let messagesDict = inDict[AcceptSDKTokenResponseKeys.kMessagesKey] as? Dictionary { 34 | self.messages = Messages(inDict: messagesDict) 35 | } 36 | } 37 | 38 | @objc open func getOpaqueData() -> OpaqueData { 39 | return self.opaqueData 40 | } 41 | 42 | @objc open func getMessages() -> Messages { 43 | return self.messages 44 | } 45 | } 46 | 47 | open class OpaqueData: NSObject { 48 | fileprivate var dataDescriptor:String? 49 | fileprivate var dataValue:String? 50 | 51 | @objc convenience init (inDict:Dictionary) { 52 | self.init() 53 | 54 | if let descriptor = inDict[AcceptSDKTokenResponseKeys.kDataDescriptorKey] as? String { 55 | self.dataDescriptor = descriptor 56 | } 57 | if let value = inDict[AcceptSDKTokenResponseKeys.kDataValueKey] as? String { 58 | self.dataValue = value 59 | } 60 | } 61 | 62 | @objc open func getDataDescriptor()->String { 63 | return self.dataDescriptor! 64 | } 65 | 66 | @objc open func getDataValue() -> String { 67 | return self.dataValue! 68 | } 69 | } 70 | 71 | open class Messages: NSObject { 72 | fileprivate var resultCode: String! 73 | fileprivate var messages: Array = [] 74 | 75 | @objc convenience init (inDict:Dictionary) { 76 | self.init() 77 | 78 | if let code = inDict[AcceptSDKTokenResponseKeys.kResultCodeKey] as? String { 79 | self.resultCode = code 80 | } 81 | 82 | if let messageArr = inDict[AcceptSDKTokenResponseKeys.kMessageKey] as? Array> { 83 | for message in messageArr { 84 | let messageDict = message as Dictionary 85 | self.messages.append(Message(inDict: messageDict)) 86 | } 87 | } 88 | } 89 | 90 | @objc convenience init (inMappingErrorDict:Dictionary) { 91 | self.init() 92 | 93 | if let code = inMappingErrorDict[AcceptSDKTokenResponseKeys.kResultCodeKey] as? String { 94 | self.resultCode = code 95 | } 96 | 97 | if let messageArr = inMappingErrorDict[AcceptSDKTokenResponseKeys.kMessageKey] as? Array> { 98 | for message in messageArr { 99 | let messageDict = message as Dictionary 100 | self.messages.append(Message(inMappingErrorDict: messageDict)) 101 | } 102 | } 103 | } 104 | 105 | @objc convenience init (inError: NSError) { 106 | self.init() 107 | 108 | self.resultCode = AcceptSDKResponse.kResultCodeErrorValueKey 109 | 110 | self.messages.append(Message(inError: inError)) 111 | } 112 | 113 | // convenience init (inError: Messages) { 114 | // self.init() 115 | // 116 | // self.resultCode = AcceptSDKResponse.kResultCodeErrorValueKey 117 | // 118 | // self.messages.append(inError.messages[0]) 119 | // } 120 | 121 | @objc convenience init (withMessage: Message) { 122 | self.init() 123 | 124 | self.resultCode = AcceptSDKResponse.kResultCodeErrorValueKey 125 | 126 | self.messages.append(withMessage) 127 | } 128 | 129 | @objc open func getResultCode() -> String { 130 | return self.resultCode 131 | } 132 | 133 | @objc open func getMessages() -> Array { 134 | return self.messages 135 | } 136 | } 137 | 138 | open class Message: NSObject { 139 | fileprivate var code:String! 140 | fileprivate var text:String! 141 | 142 | @objc convenience init (inDict:Dictionary) { 143 | self.init() 144 | 145 | if let code = inDict[AcceptSDKTokenResponseKeys.kCodeKey] as? String { 146 | if code == "I00001" { 147 | self.code = "I_WC_01" 148 | } else { 149 | self.code = code 150 | } 151 | } 152 | if let text = inDict[AcceptSDKTokenResponseKeys.kTextKey] as? String { 153 | self.text = text 154 | } 155 | } 156 | 157 | @objc convenience init (inMappingErrorDict:Dictionary) { 158 | self.init() 159 | 160 | if (inMappingErrorDict[AcceptSDKTokenResponseKeys.kCodeKey] as? String) != nil { 161 | self.code = "E_WC_14" 162 | } 163 | if let text = inMappingErrorDict[AcceptSDKTokenResponseKeys.kTextKey] as? String { 164 | self.text = text 165 | } 166 | } 167 | 168 | @objc convenience init (inError: NSError) { 169 | self.init() 170 | 171 | self.code = "E_WC_02"//(inError.code as NSNumber).stringValue 172 | self.text = inError.localizedDescription 173 | } 174 | 175 | @objc convenience init (inErrorCode:String, inErrorMessage:String) { 176 | self.init() 177 | 178 | self.code = inErrorCode 179 | self.text = inErrorMessage 180 | } 181 | 182 | @objc open func getCode() -> String { 183 | return self.code 184 | } 185 | 186 | @objc open func getText() -> String { 187 | return self.text 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/Validators/AcceptSDKCardFieldsValidator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AcceptSDKCardFieldsValidator.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/13/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | fileprivate func < (lhs: T?, rhs: T?) -> Bool { 11 | switch (lhs, rhs) { 12 | case let (l?, r?): 13 | return l < r 14 | case (nil, _?): 15 | return true 16 | default: 17 | return false 18 | } 19 | } 20 | 21 | fileprivate func >= (lhs: T?, rhs: T?) -> Bool { 22 | switch (lhs, rhs) { 23 | case let (l?, r?): 24 | return l >= r 25 | default: 26 | return !(lhs < rhs) 27 | } 28 | } 29 | 30 | fileprivate func <= (lhs: T?, rhs: T?) -> Bool { 31 | switch (lhs, rhs) { 32 | case let (l?, r?): 33 | return l <= r 34 | default: 35 | return !(rhs < lhs) 36 | } 37 | } 38 | 39 | fileprivate func > (lhs: T?, rhs: T?) -> Bool { 40 | switch (lhs, rhs) { 41 | case let (l?, r?): 42 | return l > r 43 | default: 44 | return rhs < lhs 45 | } 46 | } 47 | 48 | 49 | public struct AcceptSDKCardFieldsValidatorConstants { 50 | public static let kInAppSDKCardNumberCharacterCountMin:Int = 12 51 | public static let kInAppSDKCardNumberCharacterCountMax:Int = 19 52 | public static let kInAppSDKCardExpirationMonthMin:Int = 1 53 | public static let kInAppSDKCardExpirationMonthMax:Int = 12 54 | public static let kInAppSDKCardExpirationYearMax:Int = 99 55 | public static let kInAppSDKSecurityCodeCharacterCountMin:Int = 3 56 | public static let kInAppSDKSecurityCodeCharacterCountMax:Int = 4 57 | public static let kInAppSDKZipCodeCharacterCountMax:Int = 5 58 | } 59 | 60 | open class AcceptSDKCardFieldsValidator: NSObject { 61 | 62 | public override init() { 63 | } 64 | 65 | @objc open func cardExpirationYearMin() -> Int { 66 | let gregorian = Calendar(identifier: Calendar.Identifier.gregorian) 67 | let components = (gregorian as NSCalendar?)?.components(.year, from: Date()) 68 | return (components?.year)! % 100 69 | } 70 | 71 | @objc func validateCardNumberWithString(_ inCardNumber: String) -> Bool { 72 | var result = false 73 | 74 | let tempCardNumber = inCardNumber.replacingOccurrences(of: String.space(), with: String()) 75 | 76 | if AcceptSDKStringValidator.isNumber(tempCardNumber) { 77 | if ((tempCardNumber.count >= AcceptSDKCardFieldsValidatorConstants.kInAppSDKCardNumberCharacterCountMin) && 78 | tempCardNumber.count <= AcceptSDKCardFieldsValidatorConstants.kInAppSDKCardNumberCharacterCountMax) { 79 | result = true 80 | } 81 | } 82 | return result 83 | } 84 | 85 | @objc func validateMonthWithString(_ inMonth: String) -> Bool { 86 | var result = false 87 | 88 | if AcceptSDKStringValidator.isNumber(inMonth) { 89 | let monthNumber = Int(inMonth) 90 | 91 | if ((monthNumber >= AcceptSDKCardFieldsValidatorConstants.kInAppSDKCardExpirationMonthMin) && 92 | (monthNumber <= AcceptSDKCardFieldsValidatorConstants.kInAppSDKCardExpirationMonthMax)) { 93 | result = true 94 | } 95 | } 96 | 97 | return result 98 | } 99 | 100 | @objc func validateYearWithString(_ inYear: String) -> Bool { 101 | var result = false 102 | 103 | if ((inYear.count != 2) || (inYear.count != 4)) { 104 | result = false 105 | } 106 | 107 | if inYear.count == 2 { 108 | if AcceptSDKStringValidator.isNumber(inYear) { 109 | let yearNumber = Int(inYear) 110 | 111 | if ((yearNumber >= self.cardExpirationYearMin()%100) && 112 | (yearNumber <= AcceptSDKCardFieldsValidatorConstants.kInAppSDKCardExpirationYearMax)) { 113 | result = true 114 | } 115 | } 116 | } else if inYear.count == 4 { 117 | if AcceptSDKStringValidator.isNumber(inYear) { 118 | let yearNumber = Int(inYear) 119 | 120 | if yearNumber >= self.cardExpirationYearMin() { 121 | result = true 122 | } 123 | } 124 | } else { 125 | result = false 126 | } 127 | 128 | return result 129 | } 130 | 131 | @objc open func validateSecurityCodeWithString(_ inSecurityCode: String) -> Bool { 132 | var result = false 133 | 134 | if AcceptSDKStringValidator.isNumber(inSecurityCode) { 135 | if ((inSecurityCode.count == AcceptSDKCardFieldsValidatorConstants.kInAppSDKSecurityCodeCharacterCountMin) || 136 | (inSecurityCode.count == AcceptSDKCardFieldsValidatorConstants.kInAppSDKSecurityCodeCharacterCountMax)) { 137 | result = true 138 | } 139 | } 140 | 141 | return result 142 | } 143 | 144 | @objc func validateZipCodeWithString(_ inZipCode: String) -> Bool { 145 | var result = false 146 | 147 | if AcceptSDKStringValidator.isNumber(inZipCode) { 148 | if (inZipCode.count == AcceptSDKCardFieldsValidatorConstants.kInAppSDKZipCodeCharacterCountMax) { 149 | result = true 150 | } 151 | } 152 | 153 | return result 154 | } 155 | 156 | //!--------------------------------------------- advance validation ----------------------------------- 157 | 158 | @objc open func validateCardWithLuhnAlgorithm(_ inCardNumber: String) -> Bool { 159 | var result = false 160 | 161 | let tempCardNumber = inCardNumber.replacingOccurrences(of: String.space(), with: String()) 162 | 163 | if inCardNumber.count > 0 { 164 | let elementsCount = tempCardNumber.count 165 | var arrayOfIntegers = [Int?](repeating: nil, count: elementsCount) 166 | 167 | for (index, _) in tempCardNumber.enumerated() { 168 | let charIndex = tempCardNumber.index(tempCardNumber.startIndex, offsetBy: index) 169 | let tempStr = String(tempCardNumber.suffix(from: charIndex)) 170 | let singleCharacter = String(tempStr.prefix(1))//String(tempStr.characters.first) 171 | 172 | arrayOfIntegers[tempCardNumber.count - 1 - index] = Int(singleCharacter) 173 | } 174 | 175 | for (index, _) in tempCardNumber.enumerated() { 176 | if index%2 != 0 { 177 | arrayOfIntegers[index] = arrayOfIntegers[index]! * 2 178 | } 179 | } 180 | 181 | var theSum = 0 182 | for (index, _) in tempCardNumber.enumerated() { 183 | if arrayOfIntegers[index] > 9 { 184 | theSum += arrayOfIntegers[index]! / 10 185 | theSum += arrayOfIntegers[index]! % 10 186 | } else { 187 | theSum += arrayOfIntegers[index]! 188 | } 189 | } 190 | 191 | if ((theSum != 0) && ((theSum % 10) == 0)) { 192 | result = true 193 | } 194 | } 195 | return result 196 | } 197 | 198 | @objc open func validateExpirationDate(_ inMonth: String, inYear:String) -> Bool { 199 | var result = false 200 | 201 | if (self.validateMonthWithString(inMonth) && self.validateYearWithString(inYear)) { 202 | //--- now date 203 | let nowDate = Date() 204 | 205 | //--- date expiration 206 | var comps = DateComponents() 207 | comps.day = 1 208 | comps.month = Int(inMonth)! 209 | if inYear.count == 2 { 210 | comps.year = 2000+Int(inYear)! 211 | } else if inYear.count == 4 { 212 | comps.year = Int(inYear)! 213 | } 214 | 215 | let expirationDate = Calendar.current.date(from: comps) 216 | 217 | //--- next month after expiration 218 | var monthComponents = DateComponents() 219 | monthComponents.month = 1 220 | 221 | let nextDayAfterExpirationDate = (Calendar.current as NSCalendar).date(byAdding: monthComponents, to: expirationDate!, options: NSCalendar.Options(rawValue: 0)) 222 | 223 | let timeIntervalSinceDate = nextDayAfterExpirationDate!.timeIntervalSince(nowDate) 224 | result = (timeIntervalSinceDate > 0) 225 | } 226 | 227 | return result 228 | } 229 | 230 | @objc func validateExpirationDate(_ inExpirationDate: String) -> Bool { 231 | var result = false 232 | 233 | let monthRange = inExpirationDate.startIndex.. Character { 250 | return self[self.index(self.startIndex, offsetBy: i)] 251 | } 252 | 253 | subscript (i: Int) -> String { 254 | return String(self[i] as Character) 255 | } 256 | 257 | subscript (r: Range) -> String { 258 | let start = index(startIndex, offsetBy: r.lowerBound) 259 | let end = index(start, offsetBy: r.upperBound - r.lowerBound) 260 | return String(self[start ..< end]) 261 | } 262 | } 263 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/AcceptSDK/Validators/AcceptSDKStringValidator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AcceptSDKStringValidator.swift 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/13/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension String { 12 | static func space() -> String { 13 | return " " 14 | } 15 | 16 | static func comma() -> String { 17 | return "," 18 | } 19 | 20 | static func dot() -> String { 21 | return "." 22 | } 23 | 24 | static func percent() -> String { 25 | return "%" 26 | } 27 | 28 | static func newLine() -> String { 29 | return "\n" 30 | } 31 | 32 | static func carriageReturn() -> String { 33 | return "\r" 34 | } 35 | 36 | static func qrCodeItemSeparator() -> String { 37 | return "<|>" 38 | } 39 | 40 | static func addressPartsSeparator() -> String { 41 | return ", " 42 | } 43 | 44 | static func stateAndZipCodeSeparator() -> String { 45 | return String.space() 46 | } 47 | 48 | static func underline() -> String { 49 | return "_" 50 | } 51 | 52 | static func passwordDot() -> String { 53 | let kUnichar:UniChar = 0x00B7 54 | return String(kUnichar) 55 | } 56 | } 57 | 58 | 59 | class AcceptSDKStringValidator { 60 | 61 | class func isEmpty(_ paramString:String) -> Bool { 62 | var result = false 63 | 64 | if paramString.isEmpty { 65 | result = true 66 | } else { 67 | let tempString = paramString.replacingOccurrences(of: String.space(), with: String()) 68 | if tempString.count < 0 { 69 | result = true 70 | } 71 | } 72 | return result; 73 | } 74 | 75 | class func isNumber(_ paramString:String) -> Bool { 76 | var result = true 77 | 78 | if paramString.count == 0 { 79 | result = false 80 | } else { 81 | let tempString = paramString.trimmingCharacters(in: CharacterSet.decimalDigits) 82 | 83 | if tempString.count > 0 { 84 | result = false 85 | } 86 | } 87 | 88 | return result; 89 | } 90 | 91 | class func isAlphanumeric(_ paramString:String) -> Bool { 92 | var result = true 93 | 94 | if paramString.count == 0 { 95 | result = false 96 | } else { 97 | if self.isNumber(paramString) { 98 | result = false 99 | } else { 100 | let trimmedString = paramString.trimmingCharacters(in: CharacterSet.alphanumerics) 101 | 102 | if trimmedString.count > 0 { 103 | result = false 104 | } 105 | } 106 | } 107 | 108 | return result; 109 | } 110 | 111 | class func isStringContainsOnlySpaces(_ inString: String) -> Bool { 112 | var result = true 113 | 114 | let trimmedStr = inString.trimmingCharacters(in: CharacterSet.whitespaces) 115 | 116 | if trimmedStr.count > 0 { 117 | result = false 118 | } 119 | 120 | return result 121 | } 122 | 123 | class func isStringContainsSpaceAtBeginningAndEnd(_ inString: String) -> Bool { 124 | var result = false 125 | 126 | let startStr = String(inString[inString.startIndex]) 127 | let endStr = String(inString[inString.index(before: inString.endIndex)]) 128 | 129 | if startStr == String.space() || endStr == String.space() { 130 | result = true 131 | } 132 | 133 | return result 134 | } 135 | 136 | class func isStringContainsDecimalCharacter(_ inString: String) -> Bool { 137 | var result = false 138 | 139 | let trimmedStr = inString.trimmingCharacters(in: CharacterSet.decimalDigits) 140 | 141 | if trimmedStr.count > 0 { 142 | result = true 143 | } 144 | 145 | return result 146 | } 147 | 148 | class func isStringIsNegativeNumber(_ inString: String) -> Bool { 149 | var result = false 150 | 151 | if inString.count > 0 { 152 | let startStr = String(inString[inString.startIndex]) 153 | 154 | if startStr == "-" { 155 | result = true 156 | } 157 | } 158 | 159 | return result 160 | } 161 | } 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Authorize.Net 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/LICENSE.md: -------------------------------------------------------------------------------- 1 | SDK LICENSE AGREEMENT 2 | This Software Development Kit (“SDK”) License Agreement (“Agreement”) is between you (both the individual downloading the SDK and any legal entity on behalf of which such individual is acting) (“You” or “Your”) and Authorize.Net LLC (“Authorize.Net’). 3 | IT IS IMPORTANT THAT YOU READ CAREFULLY AND UNDERSTAND THIS AGREEMENT. BY CLICKING THE “I ACCEPT” BUTTON OR AN EQUIVALENT INDICATOR OR BY DOWNLOADING, INSTALLING OR USING THE SDK OR THE DOCUMENTATION, YOU AGREE TO BE BOUND BY THIS AGREEMENT. 4 | 5 | 1. DEFINITIONS 6 | 1.1 “Application(s)” means software programs that You develop to operate with the Gateway using components of the Software. 7 | 1.2 “Documentation” means the materials made available to You in connection with the Software by or on behalf of Authorize.Net pursuant to this Agreement. 8 | 1.3 “Gateway” means any electronic payment platform maintained and operated by Authorize.Net and any of its affiliates. 9 | 1.4 “Software” means all of the software included in the software development kit made available to You by or on behalf of Authorize.Net pursuant to this Agreement, including but not limited to sample source code, code snippets, software tools, code libraries, sample applications, Documentation and any upgrades, modified versions, updates, and/or additions thereto, if any, made available to You by or on behalf of Authorize.Net pursuant to this Agreement. 10 | 2. GRANT OF LICENSE; RESTRICTIONS 11 | 2.1 Limited License. Subject to and conditioned upon Your compliance with the terms of this Agreement, Authorize.Net hereby grants to You a limited, revocable, non-exclusive, non-transferable, royalty-free license during the term of this Agreement to: (a) in any country worldwide, use, reproduce, modify, and create derivative works of the components of the Software solely for the purpose of developing, testing and manufacturing Applications; (b) distribute, sell or otherwise provide Your Applications that include components of the Software to Your end users; and (c) use the Documentation in connection with the foregoing activities. The license to distribute Applications that include components of the Software as set forth in subsection (b) above includes the right to grant sublicenses to Your end users to use such components of the Software as incorporated into such Applications, subject to the limitations and restrictions set forth in this Agreement. 12 | 2.2 Restrictions. You shall not (and shall have no right to): (a) make or distribute copies of the Software or the Documentation, in whole or in part, except as expressly permitted pursuant to Section 2.1; (b) alter or remove any copyright, trademark, trade name or other proprietary notices, legends, symbols or labels appearing on or in the Software or Documentation; (c) sublicense (or purport to sublicense) the Software or the Documentation, in whole or in part, to any third party except as expressly permitted pursuant to Section 2.1; (d) distribute or otherwise provide all or any portion of the Software (including as incorporated into Applications) in any country listed in Appendix 1; (e) engage in any activity with the Software, including the development or distribution of an Application, that interferes with, disrupts, damages, or accesses in an unauthorized manner the Gateway or platform, servers, or systems of Authorize.Net, any of its affiliates, or any third party; (f) make any statements that Your Application is “certified” or otherwise endorsed, or that its performance is guaranteed, by Authorize.Net or any of its affiliates; or (g) otherwise use or exploit the Software or the Documentation for any purpose other than to develop and distribute Applications as expressly permitted by this Agreement. 13 | 2.3 Ownership. You shall retain ownership of Your Applications developed in accordance with this Agreement, subject to Authorize.Net’s ownership of the Software and Documentation (including Authorize.Net’s ownership of any portion of the Software or Documentation incorporated in Your Applications). You acknowledge and agree that all right, title and interest in and to the Software and Documentation shall, at all times, be and remain the exclusive property of Authorize.Net and that You do not have or acquire any rights, express or implied, in the Software or Documentation except those rights expressly granted under this Agreement. 14 | 2.4 No Support. Authorize.Net has no obligation to provide support, maintenance, upgrades, modifications or new releases of the Software. 15 | 2.5 Open Source Software. You hereby acknowledge that the Software may contain software that is distributed under “open source” license terms (“Open Source Software”). You shall review the Documentation in order to determine which portions of the Software are Open Source Software and are licensed under such Open Source Software license terms. To the extent any such license requires that Authorize.Net provide You any rights with respect to such Open Source Software that are inconsistent with the limited rights granted to You in this Agreement, then such rights in the applicable Open Source Software license shall take precedence over the rights and restrictions granted in this Agreement, but solely with respect to such Open Source Software. You acknowledge that the Open Source Software license is solely between You and the applicable licensor of the Open Source Software and that Your use, reproduction and distribution of Open Source Software shall be in compliance with applicable Open Source Software license. You understand and agree that Authorize.Net is not liable for any loss or damage that You may experience as a result of Your use of Open Source Software and that You will look solely to the licensor of the Open Source Software in the event of any such loss or damage. 16 | 2.6 License to Authorize.Net. In the event You choose to submit any suggestions, feedback or other information or materials related to the Software or Documentation or Your use thereof (collectively, “Feedback”) to Authorize.Net, You hereby grant to Authorize.Net a worldwide, non-exclusive, royalty-free, transferable, sublicensable, perpetual and irrevocable license to use and otherwise exploit such Feedback in connection with the Software, Documentation, and other products and services. 17 | 2.7 Use. 18 | (a) You represent, warrant and agree to use the Software and write Applications only for purposes permitted by (i) this Agreement; (ii) applicable law and regulation, including, without limitation, the Payment Card Industry Data Security Standard (PCI DSS); and (iii) generally accepted practices or guidelines in the relevant jurisdictions. You represent, warrant and agree that if You use the Software to develop Applications for general public end users, that You will protect the privacy and legal rights of those users. If the Application receives or stores personal or sensitive information provided by end users, it must do so securely and in compliance with all applicable laws and regulations, including card association regulations. If the Application receives Authorize.Net account information, the Application may only use that information to access the end user's Authorize.Net account. You represent, warrant and agree that You are solely responsible for (and that neither Authorize.Net nor its affiliates have any responsibility to You or to any third party for): (i) any data, content, or resources that You obtain, transmit or display through the Application; and (ii) any breach of Your obligations under this Agreement, any applicable third party license, or any applicable law or regulation, and for the consequences of any such breach. 19 | 3. WARRANTY DISCLAIMER; LIMITATION OF LIABILITY 20 | 3.1 Disclaimer. THE SOFTWARE AND THE DOCUMENTATION ARE PROVIDED ON AN “AS IS” AND “AS AVAILABLE” BASIS WITH NO WARRANTY. YOU AGREE THAT YOUR USE OF THE SOFTWARE AND THE DOCUMENTATION IS AT YOUR SOLE RISK AND YOU ARE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF DATA THAT RESULTS FROM SUCH USE. TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, AUTHORIZE.NET AND ITS AFFILIATES EXPRESSLY DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE AND THE DOCUMENTATION, INCLUDING ALL WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, SATISFACTORY QUALITY, ACCURACY, TITLE AND NON-INFRINGEMENT, AND ANY WARRANTIES THAT MAY ARISE OUT OF COURSE OF PERFORMANCE, COURSE OF DEALING OR USAGE OF TRADE. NEITHER AUTHORIZE.NET NOR ITS AFFILIATES WARRANT THAT THE FUNCTIONS OR INFORMATION CONTAINED IN THE SOFTWARE OR THE DOCUMENTATION WILL MEET ANY REQUIREMENTS OR NEEDS YOU MAY HAVE, OR THAT THE SOFTWARE OR DOCUMENTATION WILL OPERATE ERROR FREE, OR THAT THE SOFTWARE OR DOCUMENTATION IS COMPATIBLE WITH ANY PARTICULAR OPERATING SYSTEM.  21 | 3.2 Limitation of Liability. IN NO EVENT SHALL AUTHORIZE.NET AND ITS AFFILIATES BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL OR PUNITIVE DAMAGES, OR DAMAGES FOR LOSS OF PROFITS, REVENUE, BUSINESS, SAVINGS, DATA, USE OR COST OF SUBSTITUTE PROCUREMENT, INCURRED BY YOU OR ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT, EVEN IF AUTHORIZE.NET HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR IF SUCH DAMAGES ARE FORESEEABLE. IN NO EVENT SHALL THE ENTIRE LIABILITY OF AUTHORIZE.NET AND AFFILIATES ARISING FROM OR RELATING TO THIS AGREEMENT OR THE SUBJECT MATTER HEREOF EXCEED ONE HUNDRED U.S. DOLLARS ($100). THE PARTIES ACKNOWLEDGE THAT THE LIMITATIONS OF LIABILITY IN THIS SECTION 3.2 AND IN THE OTHER PROVISIONS OF THIS AGREEMENT AND THE ALLOCATION OF RISK HEREIN ARE AN ESSENTIAL ELEMENT OF THE BARGAIN BETWEEN THE PARTIES, WITHOUT WHICH AUTHORIZE.NET WOULD NOT HAVE ENTERED INTO THIS AGREEMENT. 22 | 4. INDEMNIFICATION. You shall indemnify, hold harmless and, at Authorize.Net’s request, defend Authorize.Net and its affiliates and their officers, directors, employees, and agents from and against any claim, suit or proceeding, and any associated liabilities, costs, damages and expenses, including reasonable attorneys’ fees, that arise out of relate to: (i) Your Applications or the use or distribution thereof and Your use or distribution of the Software or the Documentation (or any portion thereof including Open Source Software), including, but not limited to, any allegation that any such Application or any such use or distribution infringes, misappropriates or otherwise violates any intellectual property (including, without limitation, copyright, patent, and trademark), privacy, publicity or other rights of any third party, or has caused the death or injury of any person or damage to any property; (ii) Your alleged or actual breach of this Agreement; (iii) the alleged or actual breach of this Agreement by any party to whom you have provided Your Applications, the Software or the Documentation or (iii) Your alleged or actual violation of or non-compliance with any applicable laws, legislation, policies, rules, regulations or governmental requirements (including, without limitation, any laws, legislation, policies, rules, regulations or governmental requirements related to privacy and data collection). 23 | 5. TERMINATION. This Agreement and the licenses granted to you herein are effective until terminated. Authorize.Net may terminate this Agreement and the licenses granted to You at any time. Upon termination of this Agreement, You shall cease all use of the Software and the Documentation, return to Authorize.Net or destroy all copies of the Software and Documentation and related materials in Your possession, and so certify to Authorize.Net. Except for the license to You granted herein, the terms of this Agreement shall survive termination. 24 | 6. CONFIDENTIAL INFORMATION 25 | a. You hereby agree (i) to hold Authorize.Net’s Confidential Information in strict confidence and to take reasonable precautions to protect such Confidential Information (including, without limitation, all precautions You employ with respect to Your own confidential materials), (ii) not to divulge any such Confidential Information to any third person; (iii) not to make any use whatsoever at any time of such Confidential Information except as strictly licensed hereunder, (iv) not to remove or export from the United States or re-export any such Confidential Information or any direct product thereof, except in compliance with, and with all licenses and approvals required under applicable U.S. and foreign export laws and regulations, including, without limitation, those of the U.S. Department of Commerce. 26 | b. “Confidential Information” shall mean any data or information, oral or written, treated as confidential that relates to Authorize.Net’s past, present, or future research, development or business activities, including without limitation any unannounced products and services, any information relating to services, developments, inventions, processes, plans, financial information, customer data, revenue, transaction volume, forecasts, projections, application programming interfaces, Software and Documentation. 27 | 7. General Terms 28 | 7.1 Law. This Agreement and all matters arising out of or relating to this Agreement shall be governed by the internal laws of the State of California without giving effect to any choice of law rule. This Agreement shall not be governed by the United Nations Convention on Contracts for the International Sales of Goods, the application of which is expressly excluded. In the event of any controversy, claim or dispute between the parties arising out of or relating to this Agreement, such controversy, claim or dispute shall be resolved in the state or federal courts in Santa Clara County, California, and the parties hereby irrevocably consent to the jurisdiction and venue of such courts. 29 | 7.2 Logo License. Authorize.Net hereby grants to You the right to use, reproduce, publish, perform and display Authorize.Net logo solely in accordance with the current Authorize.Net brand guidelines. 30 | 7.3 Severability and Waiver. If any provision of this Agreement is held to be illegal, invalid or otherwise unenforceable, such provision shall be enforced to the extent possible consistent with the stated intention of the parties, or, if incapable of such enforcement, shall be deemed to be severed and deleted from this Agreement, while the remainder of this Agreement shall continue in full force and effect. The waiver by either party of any default or breach of this Agreement shall not constitute a waiver of any other or subsequent default or breach. 31 | 7.4 No Assignment. You may not assign, sell, transfer, delegate or otherwise dispose of, whether voluntarily or involuntarily, by operation of law or otherwise, this Agreement or any rights or obligations under this Agreement without the prior written consent of Authorize.Net, which may be withheld in Authorize.Net’s sole discretion. Any purported assignment, transfer or delegation by You shall be null and void. Subject to the foregoing, this Agreement shall be binding upon and shall inure to the benefit of the parties and their respective successors and assigns. 32 | 7.5 Government Rights. If You (or any person or entity to whom you provide the Software or Documentation) are an agency or instrumentality of the United States Government, the Software and Documentation are “commercial computer software” and “commercial computer software documentation,” and pursuant to FAR 12.212 or DFARS 227.7202, and their successors, as applicable, use, reproduction and disclosure of the Software and Documentation are governed by the terms of this Agreement. 33 | 7.6 Export Administration. You shall comply fully with all relevant export laws and regulations of the United States, including, without limitation, the U.S. Export Administration Regulations (collectively “Export Controls”). Without limiting the generality of the foregoing, You shall not, and You shall require Your representatives not to, export, direct or transfer the Software or the Documentation, or any direct product thereof, to any destination, person or entity restricted or prohibited by the Export Controls. 34 | 7.7 Privacy. In order to continually innovate and improve the Software, Licensee understands and agrees that Authorize.Net may collect certain usage statistics including but not limited to a unique identifier, associated IP address, version number of software, and information on which tools and/or services in the Software are being used and how they are being used. 35 | 7.8 Entire Agreement; Amendments. This Agreement constitutes the entire agreement between the parties and supersedes all prior or contemporaneous agreements or representations, written or oral, concerning the subject matter of this Agreement. Authorize.Net may make changes to this Agreement, Software or Documentation in its sole discretion. When these changes are made, Authorize.Net will make a new version of the Agreement, Software or Documentation available on the website where the Software is available. This Agreement may not be modified or amended by You except in a writing signed by a duly authorized representative of each party. You acknowledge and agree that 36 | Authorize.Net has not made any representations, warranties or agreements of any kind, except as expressly set forth herein. 37 | 38 | 39 | Authorize.Net Software Development Kit (SDK) License Agreement 40 | v. December 12, 2013 41 | 1 42 | 43 | 44 | -------------------------------------------------------------------------------- /Pods/AuthorizeNetAccept/README.md: -------------------------------------------------------------------------------- 1 | # Authorize.Net Accept Mobile SDK for iOS 2 | 3 | This SDK allows mobile developers to provide credit card payment functionality within their iOS applications, without having to pass sensitive card data back to their application backend servers. For more information on including payments in your mobile application see our [InApp Payments Guide](http://developer.authorize.net/api/reference/features/in-app.html) 4 | 5 | ## SDK Installation 6 | 7 | ### CocoaPods 8 | ``` 9 | pod 'AuthorizeNetAccept' 10 | ``` 11 | 12 | ### Manual Installation 13 | 14 | Include the ```AcceptSDK.framework``` in the application. In Xcode, select the main project file for the target. In the "General" section of the project's properties, scroll down to "Embedded Binaries", press the plus sign (+), and select the framework. 15 | 16 | Once included, make sure in “Build Settings” tab, in section “Search Paths”, the path to these frameworks are added correctly. 17 | 18 | ## SDK Usage 19 | ### Initialize the SDK and set the data to be dispatched directly to Authorize.Net 20 | ```swift 21 | 22 | let handler = AcceptSDKHandler(environment: AcceptSDKEnvironment.ENV_TEST) 23 | 24 | let request = AcceptSDKRequest() 25 | request.merchantAuthentication.name = kClientName 26 | request.merchantAuthentication.clientKey = kClientKey 27 | 28 | request.securePaymentContainerRequest.webCheckOutDataType.token.cardNumber = self.cardNumberBuffer 29 | request.securePaymentContainerRequest.webCheckOutDataType.token.expirationMonth = self.cardExpirationMonth 30 | request.securePaymentContainerRequest.webCheckOutDataType.token.expirationYear = self.cardExpirationYear 31 | request.securePaymentContainerRequest.webCheckOutDataType.token.cardCode = self.cardVerificationCode 32 | ``` 33 | ### Register the callback and call getTokenWithRequest 34 | ```swift 35 | handler!.getTokenWithRequest(request, successHandler: { (inResponse:AcceptSDKTokenResponse) -> () in 36 | dispatch_async(dispatch_get_main_queue(),{ 37 | self.updateTokenButton(true) 38 | 39 | self.activityIndicatorAcceptSDKDemo.stopAnimating() 40 | print("Token--->%@", inResponse.getOpaqueData().getDataValue()) 41 | var output = String(format: "Response: %@\nData Value: %@ \nDescription: %@", inResponse.getMessages().getResultCode(), inResponse.getOpaqueData().getDataValue(), inResponse.getOpaqueData().getDataDescriptor()) 42 | output = output + String(format: "\nMessage Code: %@\nMessage Text: %@", inResponse.getMessages().getMessages()[0].getCode(), inResponse.getMessages().getMessages()[0].getText()) 43 | self.textViewShowResults.text = output 44 | self.textViewShowResults.textColor = UIColor.greenColor() 45 | }) 46 | }) { (inError:AcceptSDKErrorResponse) -> () in 47 | self.activityIndicatorAcceptSDKDemo.stopAnimating() 48 | self.updateTokenButton(true) 49 | 50 | let output = String(format: "Response: %@\nError code: %@\nError text: %@", inError.getMessages().getResultCode(), inError.getMessages().getMessages()[0].getCode(), inError.getMessages().getMessages()[0].getText()) 51 | self.textViewShowResults.text = output 52 | self.textViewShowResults.textColor = UIColor.redColor() 53 | print(output) 54 | } 55 | 56 | ``` 57 | ### Using the Accept Payment Token to Create a Transaction Request 58 | Your server constructs a transaction request using the [Authorize.Net API](https://developer.authorize.net/api/reference/#payment-transactions-create-an-accept-payment-transaction), placing the encrypted payment information that it received in previous step in the opaqueData element. 59 | ```json 60 | { 61 | "createTransactionRequest": { 62 | "merchantAuthentication": { 63 | "name": "YOUR_API_LOGIN_ID", 64 | "transactionKey": "YOUR_TRANSACTION_KEY" 65 | }, 66 | "refId": "123456", 67 | "transactionRequest": { 68 | "transactionType": "authCaptureTransaction", 69 | "amount": "5", 70 | "payment": { 71 | "opaqueData": { 72 | "dataDescriptor": "COMMON.ACCEPT.INAPP.PAYMENT", 73 | "dataValue": "PAYMENT_NONCE_GOES_HERE" 74 | } 75 | } 76 | } 77 | } 78 | } 79 | ``` 80 | ### Using from Objective-C 81 | Calling the SDK from Objective-C should be simple and intuitive: 82 | 83 | ```objective-c 84 | 85 | AcceptSDKHandler *handler = [[AcceptSDKHandler alloc] initWithEnvironment:AcceptSDKEnvironmentENV_TEST]; 86 | AcceptSDKRequest *request = [[AcceptSDKRequest alloc] init]; 87 | request.merchantAuthentication.name = @""; //name 88 | request.merchantAuthentication.clientKey = @""; //clientkey 89 | 90 | request.securePaymentContainerRequest.webCheckOutDataType.token.cardNumber = @""; //cardnumber 91 | request.securePaymentContainerRequest.webCheckOutDataType.token.expirationMonth = @""; 92 | request.securePaymentContainerRequest.webCheckOutDataType.token.expirationYear = @""; 93 | request.securePaymentContainerRequest.webCheckOutDataType.token.cardCode = @""; 94 | 95 | [handler getTokenWithRequest:request successHandler:^(AcceptSDKTokenResponse * _Nonnull token) { 96 | NSLog(@"success %@", token.getOpaqueData.getDataValue); 97 | } failureHandler:^(AcceptSDKErrorResponse * _Nonnull error) { 98 | NSLog(@"failed... ); 99 | }]; 100 | ``` 101 | ## Sample Application 102 | We have a sample application which demonstrates the SDK usage: 103 | https://github.com/AuthorizeNet/accept-sample-ios 104 | 105 | 106 | ## Apple In-App Purchase API 107 | Please remember that you are required to use Apple’s In-App Purchase API to sell virtual goods such as premium content for your app, and subscriptions for digital content. Specifically, Apple’s developer terms require that the In-App Purchase API must be used for digital “content, functionality, or services” such as premium features or credits. See https://developer.apple.com/app-store/review/guidelines/ for more details. 108 | -------------------------------------------------------------------------------- /Pods/Local Podspecs/AuthorizeNetAccept.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "AuthorizeNetAccept", 3 | "authors": "Authorize.Net", 4 | "version": "0.4.0", 5 | "summary": "Authorize.Net Accept SDK for iOS", 6 | "homepage": "https://developer.authorize.net", 7 | "license": "https://github.com/AuthorizeNet/accept-sdk-ios/blob/master/LICENSE.md", 8 | "platforms": { 9 | "ios": "8.4" 10 | }, 11 | "source": { 12 | "git": "https://github.com/AuthorizeNet/accept-sdk-ios.git", 13 | "tag": "0.4.0" 14 | }, 15 | "requires_arc": true, 16 | "module_name": "AuthorizeNetAccept", 17 | "source_files": "AcceptSDK/**/*.{swift}" 18 | } 19 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AuthorizeNetAccept (0.4.0) 3 | 4 | DEPENDENCIES: 5 | - AuthorizeNetAccept 6 | 7 | SPEC REPOS: 8 | https://github.com/cocoapods/specs.git: 9 | - AuthorizeNetAccept 10 | 11 | SPEC CHECKSUMS: 12 | AuthorizeNetAccept: b945d10faa950bbb0cce3aefb9295e065ed0aa48 13 | 14 | PODFILE CHECKSUM: dcb412dd371fb5b1b5f9e4dd990639acda242ab2 15 | 16 | COCOAPODS: 1.7.3 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/AuthorizeNetAccept/AuthorizeNetAccept-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 0.4.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/AuthorizeNetAccept/AuthorizeNetAccept-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_AuthorizeNetAccept : NSObject 3 | @end 4 | @implementation PodsDummy_AuthorizeNetAccept 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/AuthorizeNetAccept/AuthorizeNetAccept-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/AuthorizeNetAccept/AuthorizeNetAccept-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double AuthorizeNetAcceptVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char AuthorizeNetAcceptVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/AuthorizeNetAccept/AuthorizeNetAccept.modulemap: -------------------------------------------------------------------------------- 1 | framework module AuthorizeNetAccept { 2 | umbrella header "AuthorizeNetAccept-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/AuthorizeNetAccept/AuthorizeNetAccept.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/AuthorizeNetAccept 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/AuthorizeNetAccept 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/AuthorizeNetAccept/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 0.3.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKSampleApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKSampleApp/Pods-AcceptSDKSampleApp-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKSampleApp/Pods-AcceptSDKSampleApp-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## AuthorizeNetAccept 5 | 6 | The MIT License (MIT) 7 | 8 | Copyright (c) 2016 Authorize.Net 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | Generated by CocoaPods - https://cocoapods.org 29 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKSampleApp/Pods-AcceptSDKSampleApp-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | The MIT License (MIT) 18 | 19 | Copyright (c) 2016 Authorize.Net 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy 22 | of this software and associated documentation files (the "Software"), to deal 23 | in the Software without restriction, including without limitation the rights 24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | copies of the Software, and to permit persons to whom the Software is 26 | furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | SOFTWARE. 38 | 39 | License 40 | https://github.com/AuthorizeNet/accept-sdk-ios/blob/master/LICENSE.md 41 | Title 42 | AuthorizeNetAccept 43 | Type 44 | PSGroupSpecifier 45 | 46 | 47 | FooterText 48 | Generated by CocoaPods - https://cocoapods.org 49 | Title 50 | 51 | Type 52 | PSGroupSpecifier 53 | 54 | 55 | StringsTable 56 | Acknowledgements 57 | Title 58 | Acknowledgements 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKSampleApp/Pods-AcceptSDKSampleApp-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_AcceptSDKSampleApp : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_AcceptSDKSampleApp 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKSampleApp/Pods-AcceptSDKSampleApp-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | function on_error { 7 | echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" 8 | } 9 | trap 'on_error $LINENO' ERR 10 | 11 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 12 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 13 | # frameworks to, so exit 0 (signalling the script phase was successful). 14 | exit 0 15 | fi 16 | 17 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 19 | 20 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 21 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 22 | 23 | # Used as a return value for each invocation of `strip_invalid_archs` function. 24 | STRIP_BINARY_RETVAL=0 25 | 26 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 27 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 28 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 29 | 30 | # Copies and strips a vendored framework 31 | install_framework() 32 | { 33 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 34 | local source="${BUILT_PRODUCTS_DIR}/$1" 35 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 36 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 37 | elif [ -r "$1" ]; then 38 | local source="$1" 39 | fi 40 | 41 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 42 | 43 | if [ -L "${source}" ]; then 44 | echo "Symlinked..." 45 | source="$(readlink "${source}")" 46 | fi 47 | 48 | # Use filter instead of exclude so missing patterns don't throw errors. 49 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 50 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 51 | 52 | local basename 53 | basename="$(basename -s .framework "$1")" 54 | binary="${destination}/${basename}.framework/${basename}" 55 | 56 | if ! [ -r "$binary" ]; then 57 | binary="${destination}/${basename}" 58 | elif [ -L "${binary}" ]; then 59 | echo "Destination binary is symlinked..." 60 | dirname="$(dirname "${binary}")" 61 | binary="${dirname}/$(readlink "${binary}")" 62 | fi 63 | 64 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 65 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 66 | strip_invalid_archs "$binary" 67 | fi 68 | 69 | # Resign the code if required by the build settings to avoid unstable apps 70 | code_sign_if_enabled "${destination}/$(basename "$1")" 71 | 72 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 73 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 74 | local swift_runtime_libs 75 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) 76 | for lib in $swift_runtime_libs; do 77 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 78 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 79 | code_sign_if_enabled "${destination}/${lib}" 80 | done 81 | fi 82 | } 83 | 84 | # Copies and strips a vendored dSYM 85 | install_dsym() { 86 | local source="$1" 87 | if [ -r "$source" ]; then 88 | # Copy the dSYM into a the targets temp dir. 89 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 90 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 91 | 92 | local basename 93 | basename="$(basename -s .framework.dSYM "$source")" 94 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 95 | 96 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 97 | if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then 98 | strip_invalid_archs "$binary" 99 | fi 100 | 101 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 102 | # Move the stripped file into its final destination. 103 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 104 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 105 | else 106 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 107 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 108 | fi 109 | fi 110 | } 111 | 112 | # Copies the bcsymbolmap files of a vendored framework 113 | install_bcsymbolmap() { 114 | local bcsymbolmap_path="$1" 115 | local destination="${BUILT_PRODUCTS_DIR}" 116 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" 117 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" 118 | } 119 | 120 | # Signs a framework with the provided identity 121 | code_sign_if_enabled() { 122 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 123 | # Use the current code_sign_identity 124 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 125 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 126 | 127 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 128 | code_sign_cmd="$code_sign_cmd &" 129 | fi 130 | echo "$code_sign_cmd" 131 | eval "$code_sign_cmd" 132 | fi 133 | } 134 | 135 | # Strip invalid architectures 136 | strip_invalid_archs() { 137 | binary="$1" 138 | # Get architectures for current target binary 139 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 140 | # Intersect them with the architectures we are building for 141 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 142 | # If there are no archs supported by this binary then warn the user 143 | if [[ -z "$intersected_archs" ]]; then 144 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 145 | STRIP_BINARY_RETVAL=0 146 | return 147 | fi 148 | stripped="" 149 | for arch in $binary_archs; do 150 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 151 | # Strip non-valid architectures in-place 152 | lipo -remove "$arch" -output "$binary" "$binary" 153 | stripped="$stripped $arch" 154 | fi 155 | done 156 | if [[ "$stripped" ]]; then 157 | echo "Stripped $binary of architectures:$stripped" 158 | fi 159 | STRIP_BINARY_RETVAL=1 160 | } 161 | 162 | 163 | if [[ "$CONFIGURATION" == "Debug" ]]; then 164 | install_framework "${BUILT_PRODUCTS_DIR}/AuthorizeNetAccept/AuthorizeNetAccept.framework" 165 | fi 166 | if [[ "$CONFIGURATION" == "Release" ]]; then 167 | install_framework "${BUILT_PRODUCTS_DIR}/AuthorizeNetAccept/AuthorizeNetAccept.framework" 168 | fi 169 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 170 | wait 171 | fi 172 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKSampleApp/Pods-AcceptSDKSampleApp-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | case "${TARGETED_DEVICE_FAMILY}" in 12 | 1,2) 13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 14 | ;; 15 | 1) 16 | TARGET_DEVICE_ARGS="--target-device iphone" 17 | ;; 18 | 2) 19 | TARGET_DEVICE_ARGS="--target-device ipad" 20 | ;; 21 | 3) 22 | TARGET_DEVICE_ARGS="--target-device tv" 23 | ;; 24 | 4) 25 | TARGET_DEVICE_ARGS="--target-device watch" 26 | ;; 27 | *) 28 | TARGET_DEVICE_ARGS="--target-device mac" 29 | ;; 30 | esac 31 | 32 | install_resource() 33 | { 34 | if [[ "$1" = /* ]] ; then 35 | RESOURCE_PATH="$1" 36 | else 37 | RESOURCE_PATH="${PODS_ROOT}/$1" 38 | fi 39 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 40 | cat << EOM 41 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 42 | EOM 43 | exit 1 44 | fi 45 | case $RESOURCE_PATH in 46 | *.storyboard) 47 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 48 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 49 | ;; 50 | *.xib) 51 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 52 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 53 | ;; 54 | *.framework) 55 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 56 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 57 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 58 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 59 | ;; 60 | *.xcdatamodel) 61 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" 62 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 63 | ;; 64 | *.xcdatamodeld) 65 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" 66 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 67 | ;; 68 | *.xcmappingmodel) 69 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" 70 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 71 | ;; 72 | *.xcassets) 73 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 74 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 75 | ;; 76 | *) 77 | echo "$RESOURCE_PATH" 78 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 79 | ;; 80 | esac 81 | } 82 | 83 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 84 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 85 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 86 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 87 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 88 | fi 89 | rm -f "$RESOURCES_TO_COPY" 90 | 91 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 92 | then 93 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 94 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 95 | while read line; do 96 | if [[ $line != "${PODS_ROOT}*" ]]; then 97 | XCASSET_FILES+=("$line") 98 | fi 99 | done <<<"$OTHER_XCASSETS" 100 | 101 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 102 | fi 103 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKSampleApp/Pods-AcceptSDKSampleApp-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_AcceptSDKSampleAppVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_AcceptSDKSampleAppVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKSampleApp/Pods-AcceptSDKSampleApp.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AuthorizeNetAccept" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AuthorizeNetAccept/AuthorizeNetAccept.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "AuthorizeNetAccept" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKSampleApp/Pods-AcceptSDKSampleApp.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_AcceptSDKSampleApp { 2 | umbrella header "Pods-AcceptSDKSampleApp-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKSampleApp/Pods-AcceptSDKSampleApp.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AuthorizeNetAccept" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AuthorizeNetAccept/AuthorizeNetAccept.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "AuthorizeNetAccept" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Sample Application for the Authorize.Net Accept Mobile SDK 2 | 3 | This is a sample iOS application, demonstrating usage of the [Accept Mobile SDK for iOS](https://github.com/AuthorizeNet/accept-sdk-ios) 4 | 5 | ## Usage 6 | 7 | Clone this repository 8 | ```` 9 | git clone https://github.com/AuthorizeNet/accept-sample-ios.git 10 | ```` 11 | 12 | Open the project XCode and run. 13 | 14 | ## Examples 15 | 16 | Sample app demonstrates usage of Apple Pay and the Accept Mobile SDK 17 | 18 | ![Apple Pay](screenshot2.png?raw=true "Apple Pay") ![Accept Token](screenshot1.png?raw=true "Accept Token") 19 | -------------------------------------------------------------------------------- /screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AuthorizeNet/accept-sample-ios/eb10e4eb0c3097bf885c0452dcff46ef69064746/screenshot1.png -------------------------------------------------------------------------------- /screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AuthorizeNet/accept-sample-ios/eb10e4eb0c3097bf885c0452dcff46ef69064746/screenshot2.png --------------------------------------------------------------------------------