├── .gitignore ├── .swift-version ├── AcceptSDK-Framework └── AcceptSDK.framework │ ├── AcceptSDK │ ├── Headers │ ├── AcceptSDK-Swift.h │ └── AcceptSDK.h │ ├── Info.plist │ └── Modules │ ├── AcceptSDK.swiftmodule │ ├── arm.swiftdoc │ ├── arm.swiftmodule │ ├── arm64.swiftdoc │ ├── arm64.swiftmodule │ ├── i386.swiftdoc │ ├── i386.swiftmodule │ ├── x86_64.swiftdoc │ └── x86_64.swiftmodule │ └── module.modulemap ├── AcceptSDK.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── AcceptSDK.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── AcceptSDK ├── AcceptBuilder │ ├── AcceptSDKBaseInterfaceBuilder.swift │ ├── AcceptSDKBaseURLBuilder.swift │ ├── AcceptSDKTokenAPIBuilder.swift │ └── AcceptSDKTokenInterfaceBuilder.swift ├── AcceptSDK.h ├── AcceptSDKHandler.swift ├── AcceptSDKInternal.swift ├── AcceptSDKSettings.swift ├── Info.plist ├── 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 ├── AcceptSDKTests ├── FingerPrintTests.swift ├── Info.plist ├── MerchantAuthenticationTests.swift ├── TokenDataTests.swift └── WebCheckOutDataTypeTests.swift ├── AuthorizeNetAccept.podspec ├── LICENSE ├── LICENSE.md ├── Podfile ├── Podfile.lock ├── Pods ├── Manifest.lock ├── Pods.xcodeproj │ └── project.pbxproj └── Target Support Files │ ├── Pods-AcceptSDK │ ├── Info.plist │ ├── Pods-AcceptSDK-acknowledgements.markdown │ ├── Pods-AcceptSDK-acknowledgements.plist │ ├── Pods-AcceptSDK-dummy.m │ ├── Pods-AcceptSDK-resources.sh │ ├── Pods-AcceptSDK-umbrella.h │ ├── Pods-AcceptSDK.debug.xcconfig │ ├── Pods-AcceptSDK.modulemap │ └── Pods-AcceptSDK.release.xcconfig │ └── Pods-AcceptSDKTests │ ├── Info.plist │ ├── Pods-AcceptSDKTests-acknowledgements.markdown │ ├── Pods-AcceptSDKTests-acknowledgements.plist │ ├── Pods-AcceptSDKTests-dummy.m │ ├── Pods-AcceptSDKTests-frameworks.sh │ ├── Pods-AcceptSDKTests-resources.sh │ ├── Pods-AcceptSDKTests-umbrella.h │ ├── Pods-AcceptSDKTests.debug.xcconfig │ ├── Pods-AcceptSDKTests.modulemap │ └── Pods-AcceptSDKTests.release.xcconfig ├── README.md └── createUniversalArchive.sh /.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 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 4.0 2 | -------------------------------------------------------------------------------- /AcceptSDK-Framework/AcceptSDK.framework/AcceptSDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AuthorizeNet/accept-sdk-ios/05a2451b9906c84de2a8adf135c84d783be3bd91/AcceptSDK-Framework/AcceptSDK.framework/AcceptSDK -------------------------------------------------------------------------------- /AcceptSDK-Framework/AcceptSDK.framework/Headers/AcceptSDK-Swift.h: -------------------------------------------------------------------------------- 1 | // Generated by Apple Swift version 4.1 (swiftlang-902.0.48 clang-902.0.37.1) 2 | #pragma clang diagnostic push 3 | #pragma clang diagnostic ignored "-Wgcc-compat" 4 | 5 | #if !defined(__has_include) 6 | # define __has_include(x) 0 7 | #endif 8 | #if !defined(__has_attribute) 9 | # define __has_attribute(x) 0 10 | #endif 11 | #if !defined(__has_feature) 12 | # define __has_feature(x) 0 13 | #endif 14 | #if !defined(__has_warning) 15 | # define __has_warning(x) 0 16 | #endif 17 | 18 | #if __has_include() 19 | # include 20 | #endif 21 | 22 | #pragma clang diagnostic ignored "-Wauto-import" 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #if !defined(SWIFT_TYPEDEFS) 29 | # define SWIFT_TYPEDEFS 1 30 | # if __has_include() 31 | # include 32 | # elif !defined(__cplusplus) 33 | typedef uint_least16_t char16_t; 34 | typedef uint_least32_t char32_t; 35 | # endif 36 | typedef float swift_float2 __attribute__((__ext_vector_type__(2))); 37 | typedef float swift_float3 __attribute__((__ext_vector_type__(3))); 38 | typedef float swift_float4 __attribute__((__ext_vector_type__(4))); 39 | typedef double swift_double2 __attribute__((__ext_vector_type__(2))); 40 | typedef double swift_double3 __attribute__((__ext_vector_type__(3))); 41 | typedef double swift_double4 __attribute__((__ext_vector_type__(4))); 42 | typedef int swift_int2 __attribute__((__ext_vector_type__(2))); 43 | typedef int swift_int3 __attribute__((__ext_vector_type__(3))); 44 | typedef int swift_int4 __attribute__((__ext_vector_type__(4))); 45 | typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2))); 46 | typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3))); 47 | typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4))); 48 | #endif 49 | 50 | #if !defined(SWIFT_PASTE) 51 | # define SWIFT_PASTE_HELPER(x, y) x##y 52 | # define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y) 53 | #endif 54 | #if !defined(SWIFT_METATYPE) 55 | # define SWIFT_METATYPE(X) Class 56 | #endif 57 | #if !defined(SWIFT_CLASS_PROPERTY) 58 | # if __has_feature(objc_class_property) 59 | # define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__ 60 | # else 61 | # define SWIFT_CLASS_PROPERTY(...) 62 | # endif 63 | #endif 64 | 65 | #if __has_attribute(objc_runtime_name) 66 | # define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X))) 67 | #else 68 | # define SWIFT_RUNTIME_NAME(X) 69 | #endif 70 | #if __has_attribute(swift_name) 71 | # define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X))) 72 | #else 73 | # define SWIFT_COMPILE_NAME(X) 74 | #endif 75 | #if __has_attribute(objc_method_family) 76 | # define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X))) 77 | #else 78 | # define SWIFT_METHOD_FAMILY(X) 79 | #endif 80 | #if __has_attribute(noescape) 81 | # define SWIFT_NOESCAPE __attribute__((noescape)) 82 | #else 83 | # define SWIFT_NOESCAPE 84 | #endif 85 | #if __has_attribute(warn_unused_result) 86 | # define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) 87 | #else 88 | # define SWIFT_WARN_UNUSED_RESULT 89 | #endif 90 | #if __has_attribute(noreturn) 91 | # define SWIFT_NORETURN __attribute__((noreturn)) 92 | #else 93 | # define SWIFT_NORETURN 94 | #endif 95 | #if !defined(SWIFT_CLASS_EXTRA) 96 | # define SWIFT_CLASS_EXTRA 97 | #endif 98 | #if !defined(SWIFT_PROTOCOL_EXTRA) 99 | # define SWIFT_PROTOCOL_EXTRA 100 | #endif 101 | #if !defined(SWIFT_ENUM_EXTRA) 102 | # define SWIFT_ENUM_EXTRA 103 | #endif 104 | #if !defined(SWIFT_CLASS) 105 | # if __has_attribute(objc_subclassing_restricted) 106 | # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA 107 | # define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA 108 | # else 109 | # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA 110 | # define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA 111 | # endif 112 | #endif 113 | 114 | #if !defined(SWIFT_PROTOCOL) 115 | # define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA 116 | # define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA 117 | #endif 118 | 119 | #if !defined(SWIFT_EXTENSION) 120 | # define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__) 121 | #endif 122 | 123 | #if !defined(OBJC_DESIGNATED_INITIALIZER) 124 | # if __has_attribute(objc_designated_initializer) 125 | # define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) 126 | # else 127 | # define OBJC_DESIGNATED_INITIALIZER 128 | # endif 129 | #endif 130 | #if !defined(SWIFT_ENUM_ATTR) 131 | # if defined(__has_attribute) && __has_attribute(enum_extensibility) 132 | # define SWIFT_ENUM_ATTR __attribute__((enum_extensibility(open))) 133 | # else 134 | # define SWIFT_ENUM_ATTR 135 | # endif 136 | #endif 137 | #if !defined(SWIFT_ENUM) 138 | # define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_ATTR SWIFT_ENUM_EXTRA _name : _type 139 | # if __has_feature(generalized_swift_name) 140 | # define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR SWIFT_ENUM_EXTRA _name : _type 141 | # else 142 | # define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) SWIFT_ENUM(_type, _name) 143 | # endif 144 | #endif 145 | #if !defined(SWIFT_UNAVAILABLE) 146 | # define SWIFT_UNAVAILABLE __attribute__((unavailable)) 147 | #endif 148 | #if !defined(SWIFT_UNAVAILABLE_MSG) 149 | # define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg))) 150 | #endif 151 | #if !defined(SWIFT_AVAILABILITY) 152 | # define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__))) 153 | #endif 154 | #if !defined(SWIFT_DEPRECATED) 155 | # define SWIFT_DEPRECATED __attribute__((deprecated)) 156 | #endif 157 | #if !defined(SWIFT_DEPRECATED_MSG) 158 | # define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__))) 159 | #endif 160 | #if __has_feature(attribute_diagnose_if_objc) 161 | # define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning"))) 162 | #else 163 | # define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg) 164 | #endif 165 | #if __has_feature(modules) 166 | @import ObjectiveC; 167 | @import Foundation; 168 | #endif 169 | 170 | #pragma clang diagnostic ignored "-Wproperty-attribute-mismatch" 171 | #pragma clang diagnostic ignored "-Wduplicate-method-arg" 172 | #if __has_warning("-Wpragma-clang-attribute") 173 | # pragma clang diagnostic ignored "-Wpragma-clang-attribute" 174 | #endif 175 | #pragma clang diagnostic ignored "-Wunknown-pragmas" 176 | #pragma clang diagnostic ignored "-Wnullability" 177 | 178 | #if __has_attribute(external_source_symbol) 179 | # pragma push_macro("any") 180 | # undef any 181 | # pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="AcceptSDK",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol)) 182 | # pragma pop_macro("any") 183 | #endif 184 | 185 | 186 | SWIFT_CLASS("_TtC9AcceptSDK28AcceptSDKCardFieldsValidator") 187 | @interface AcceptSDKCardFieldsValidator : NSObject 188 | - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; 189 | - (NSInteger)cardExpirationYearMin SWIFT_WARN_UNUSED_RESULT; 190 | - (BOOL)validateSecurityCodeWithString:(NSString * _Nonnull)inSecurityCode SWIFT_WARN_UNUSED_RESULT; 191 | - (BOOL)validateCardWithLuhnAlgorithm:(NSString * _Nonnull)inCardNumber SWIFT_WARN_UNUSED_RESULT; 192 | - (BOOL)validateExpirationDate:(NSString * _Nonnull)inMonth inYear:(NSString * _Nonnull)inYear SWIFT_WARN_UNUSED_RESULT; 193 | @end 194 | 195 | typedef SWIFT_ENUM(NSInteger, AcceptSDKEnvironment) { 196 | AcceptSDKEnvironmentENV_LIVE = 0, 197 | AcceptSDKEnvironmentENV_TEST = 1, 198 | }; 199 | 200 | @class Messages; 201 | 202 | SWIFT_CLASS("_TtC9AcceptSDK22AcceptSDKErrorResponse") 203 | @interface AcceptSDKErrorResponse : NSObject 204 | - (Messages * _Nonnull)getMessages SWIFT_WARN_UNUSED_RESULT; 205 | - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; 206 | @end 207 | 208 | @class AcceptSDKRequest; 209 | @class AcceptSDKTokenResponse; 210 | 211 | SWIFT_CLASS("_TtC9AcceptSDK16AcceptSDKHandler") 212 | @interface AcceptSDKHandler : NSObject 213 | - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; 214 | - (nullable instancetype)initWithEnvironment:(enum AcceptSDKEnvironment)environment OBJC_DESIGNATED_INITIALIZER; 215 | - (void)getTokenWithRequest:(AcceptSDKRequest * _Nonnull)inRequest successHandler:(void (^ _Nonnull)(AcceptSDKTokenResponse * _Nonnull))successHandler failureHandler:(void (^ _Nonnull)(AcceptSDKErrorResponse * _Nonnull))failureHandler; 216 | @end 217 | 218 | @class MerchantAuthenticaton; 219 | @class SecurePaymentContainerRequest; 220 | 221 | SWIFT_CLASS("_TtC9AcceptSDK16AcceptSDKRequest") 222 | @interface AcceptSDKRequest : NSObject 223 | @property (nonatomic, strong) MerchantAuthenticaton * _Nonnull merchantAuthentication; 224 | @property (nonatomic, strong) SecurePaymentContainerRequest * _Nonnull securePaymentContainerRequest; 225 | - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; 226 | @end 227 | 228 | 229 | SWIFT_CLASS("_TtC9AcceptSDK17AcceptSDKSettings") 230 | @interface AcceptSDKSettings : NSObject 231 | - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; 232 | @end 233 | 234 | @class OpaqueData; 235 | 236 | SWIFT_CLASS("_TtC9AcceptSDK22AcceptSDKTokenResponse") 237 | @interface AcceptSDKTokenResponse : NSObject 238 | - (OpaqueData * _Nonnull)getOpaqueData SWIFT_WARN_UNUSED_RESULT; 239 | - (Messages * _Nonnull)getMessages SWIFT_WARN_UNUSED_RESULT; 240 | - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; 241 | @end 242 | 243 | 244 | SWIFT_CLASS("_TtC9AcceptSDK11FingerPrint") 245 | @interface FingerPrint : NSObject 246 | @property (nonatomic, copy) NSString * _Nonnull fingerPrintHashValue; 247 | @property (nonatomic, copy) NSString * _Nonnull sequence; 248 | @property (nonatomic, copy) NSString * _Nonnull timestamp; 249 | @property (nonatomic, copy) NSString * _Nullable currencyCode; 250 | @property (nonatomic, copy) NSString * _Nonnull amount; 251 | - (nullable instancetype)initInHashValue:(NSString * _Nonnull)inHashValue inSequence:(NSString * _Nonnull)inSequence inTimestamp:(NSString * _Nonnull)inTimestamp inCurrencyCode:(NSString * _Nullable)inCurrencyCode inAmount:(NSString * _Nullable)inAmount OBJC_DESIGNATED_INITIALIZER; 252 | - (nonnull instancetype)init SWIFT_UNAVAILABLE; 253 | + (nonnull instancetype)new SWIFT_DEPRECATED_MSG("-init is unavailable"); 254 | @end 255 | 256 | 257 | SWIFT_CLASS("_TtC9AcceptSDK21MerchantAuthenticaton") 258 | @interface MerchantAuthenticaton : NSObject 259 | @property (nonatomic, copy) NSString * _Nonnull name; 260 | @property (nonatomic, strong) FingerPrint * _Nullable fingerPrint; 261 | @property (nonatomic, copy) NSString * _Nullable clientKey; 262 | @property (nonatomic, copy) NSString * _Nullable mobileDeviceId; 263 | - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; 264 | @end 265 | 266 | 267 | SWIFT_CLASS("_TtC9AcceptSDK7Message") 268 | @interface Message : NSObject 269 | - (NSString * _Nonnull)getCode SWIFT_WARN_UNUSED_RESULT; 270 | - (NSString * _Nonnull)getText SWIFT_WARN_UNUSED_RESULT; 271 | - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; 272 | @end 273 | 274 | 275 | SWIFT_CLASS("_TtC9AcceptSDK8Messages") 276 | @interface Messages : NSObject 277 | - (NSString * _Nonnull)getResultCode SWIFT_WARN_UNUSED_RESULT; 278 | - (NSArray * _Nonnull)getMessages SWIFT_WARN_UNUSED_RESULT; 279 | - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; 280 | @end 281 | 282 | 283 | 284 | 285 | SWIFT_CLASS("_TtC9AcceptSDK10OpaqueData") 286 | @interface OpaqueData : NSObject 287 | - (NSString * _Nonnull)getDataDescriptor SWIFT_WARN_UNUSED_RESULT; 288 | - (NSString * _Nonnull)getDataValue SWIFT_WARN_UNUSED_RESULT; 289 | - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; 290 | @end 291 | 292 | @class WebCheckOutDataType; 293 | 294 | SWIFT_CLASS("_TtC9AcceptSDK29SecurePaymentContainerRequest") 295 | @interface SecurePaymentContainerRequest : NSObject 296 | @property (nonatomic, strong) WebCheckOutDataType * _Nonnull webCheckOutDataType; 297 | - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; 298 | @end 299 | 300 | 301 | SWIFT_CLASS("_TtC9AcceptSDK5Token") 302 | @interface Token : NSObject 303 | @property (nonatomic, copy) NSString * _Nonnull cardNumber; 304 | @property (nonatomic, copy) NSString * _Nonnull expirationMonth; 305 | @property (nonatomic, copy) NSString * _Nonnull expirationYear; 306 | @property (nonatomic, copy) NSString * _Nullable cardCode; 307 | @property (nonatomic, copy) NSString * _Nullable zip; 308 | @property (nonatomic, copy) NSString * _Nullable fullName; 309 | - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; 310 | @end 311 | 312 | 313 | SWIFT_CLASS("_TtC9AcceptSDK19WebCheckOutDataType") 314 | @interface WebCheckOutDataType : NSObject 315 | @property (nonatomic, strong) Token * _Nonnull token; 316 | - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; 317 | @end 318 | 319 | #if __has_attribute(external_source_symbol) 320 | # pragma clang attribute pop 321 | #endif 322 | #pragma clang diagnostic pop 323 | -------------------------------------------------------------------------------- /AcceptSDK-Framework/AcceptSDK.framework/Headers/AcceptSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // AcceptSDK.h 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/15/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for AcceptSDK. 12 | FOUNDATION_EXPORT double AcceptSDKVersionNumber; 13 | 14 | //! Project version string for AcceptSDK. 15 | FOUNDATION_EXPORT const unsigned char AcceptSDKVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /AcceptSDK-Framework/AcceptSDK.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AuthorizeNet/accept-sdk-ios/05a2451b9906c84de2a8adf135c84d783be3bd91/AcceptSDK-Framework/AcceptSDK.framework/Info.plist -------------------------------------------------------------------------------- /AcceptSDK-Framework/AcceptSDK.framework/Modules/AcceptSDK.swiftmodule/arm.swiftdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AuthorizeNet/accept-sdk-ios/05a2451b9906c84de2a8adf135c84d783be3bd91/AcceptSDK-Framework/AcceptSDK.framework/Modules/AcceptSDK.swiftmodule/arm.swiftdoc -------------------------------------------------------------------------------- /AcceptSDK-Framework/AcceptSDK.framework/Modules/AcceptSDK.swiftmodule/arm.swiftmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AuthorizeNet/accept-sdk-ios/05a2451b9906c84de2a8adf135c84d783be3bd91/AcceptSDK-Framework/AcceptSDK.framework/Modules/AcceptSDK.swiftmodule/arm.swiftmodule -------------------------------------------------------------------------------- /AcceptSDK-Framework/AcceptSDK.framework/Modules/AcceptSDK.swiftmodule/arm64.swiftdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AuthorizeNet/accept-sdk-ios/05a2451b9906c84de2a8adf135c84d783be3bd91/AcceptSDK-Framework/AcceptSDK.framework/Modules/AcceptSDK.swiftmodule/arm64.swiftdoc -------------------------------------------------------------------------------- /AcceptSDK-Framework/AcceptSDK.framework/Modules/AcceptSDK.swiftmodule/arm64.swiftmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AuthorizeNet/accept-sdk-ios/05a2451b9906c84de2a8adf135c84d783be3bd91/AcceptSDK-Framework/AcceptSDK.framework/Modules/AcceptSDK.swiftmodule/arm64.swiftmodule -------------------------------------------------------------------------------- /AcceptSDK-Framework/AcceptSDK.framework/Modules/AcceptSDK.swiftmodule/i386.swiftdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AuthorizeNet/accept-sdk-ios/05a2451b9906c84de2a8adf135c84d783be3bd91/AcceptSDK-Framework/AcceptSDK.framework/Modules/AcceptSDK.swiftmodule/i386.swiftdoc -------------------------------------------------------------------------------- /AcceptSDK-Framework/AcceptSDK.framework/Modules/AcceptSDK.swiftmodule/i386.swiftmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AuthorizeNet/accept-sdk-ios/05a2451b9906c84de2a8adf135c84d783be3bd91/AcceptSDK-Framework/AcceptSDK.framework/Modules/AcceptSDK.swiftmodule/i386.swiftmodule -------------------------------------------------------------------------------- /AcceptSDK-Framework/AcceptSDK.framework/Modules/AcceptSDK.swiftmodule/x86_64.swiftdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AuthorizeNet/accept-sdk-ios/05a2451b9906c84de2a8adf135c84d783be3bd91/AcceptSDK-Framework/AcceptSDK.framework/Modules/AcceptSDK.swiftmodule/x86_64.swiftdoc -------------------------------------------------------------------------------- /AcceptSDK-Framework/AcceptSDK.framework/Modules/AcceptSDK.swiftmodule/x86_64.swiftmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AuthorizeNet/accept-sdk-ios/05a2451b9906c84de2a8adf135c84d783be3bd91/AcceptSDK-Framework/AcceptSDK.framework/Modules/AcceptSDK.swiftmodule/x86_64.swiftmodule -------------------------------------------------------------------------------- /AcceptSDK-Framework/AcceptSDK.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module AcceptSDK { 2 | umbrella header "AcceptSDK.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | 8 | module AcceptSDK.Swift { 9 | header "AcceptSDK-Swift.h" 10 | requires objc 11 | } 12 | -------------------------------------------------------------------------------- /AcceptSDK.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AcceptSDK.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /AcceptSDK.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /AcceptSDK/AcceptSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // AcceptSDK.h 3 | // AcceptSDK 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/15/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for AcceptSDK. 12 | FOUNDATION_EXPORT double AcceptSDKVersionNumber; 13 | 14 | //! Project version string for AcceptSDK. 15 | FOUNDATION_EXPORT const unsigned char AcceptSDKVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /AcceptSDK/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.5.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /AcceptSDKTests/FingerPrintTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FingerPrintTests.swift 3 | // AcceptSDK 4 | // 5 | // Created by MMA on 7/20/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class FingerPrintTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testEmptyTimestampReturnsFalse() { 24 | let request = getValidFingerprintRequest() 25 | request.timestamp = "" 26 | 27 | XCTAssertFalse(request.isValidTimestamp(), "Timestamp value should not be empty") 28 | } 29 | 30 | func testAlphaNumericTimestampReturnsFalse() { 31 | let request = getValidFingerprintRequest() 32 | request.timestamp = "23473hv232" 33 | 34 | XCTAssertFalse(request.isValidTimestamp(), "Timestamp value should contains only numbers") 35 | } 36 | 37 | func testNegativeTimestampReturnsFalse() { 38 | let request = getValidFingerprintRequest() 39 | request.timestamp = "-2987665" 40 | 41 | XCTAssertFalse(request.isValidTimestamp(), "Timestamp value should not be negative numbers") 42 | } 43 | 44 | func testFloatingNumberTimestampReturnsFalse() { 45 | let request = getValidFingerprintRequest() 46 | request.timestamp = "945.87665" 47 | 48 | XCTAssertFalse(request.isValidTimestamp(), "Timestamp value should not contains decimal numbers") 49 | } 50 | 51 | func testValidTimestampReturnsTrue() { 52 | let request = getValidFingerprintRequest() 53 | request.timestamp = "94587665" 54 | 55 | XCTAssertTrue(request.isValidTimestamp(), "Timestamp value is not valid") 56 | } 57 | 58 | func testAmountValidationReturnsFalseWhenNotNumber() { 59 | let request = getValidFingerprintRequest() 60 | request.amount = "ghwq" 61 | 62 | XCTAssertFalse(request.isValidAmount(), "Amount should be number") 63 | } 64 | 65 | func testNegativeAmountValidationReturnsFalse() { 66 | let request = getValidFingerprintRequest() 67 | request.amount = "-12" 68 | 69 | XCTAssertFalse(request.isValidAmount(), "Amount should not be negative") 70 | } 71 | 72 | func testAmountValidationSuccess() { 73 | let request = getValidFingerprintRequest() 74 | request.amount = "12.99" 75 | 76 | XCTAssertTrue(request.isValidAmount(), "Amount is not a valid number") 77 | } 78 | 79 | func testEmptyHashvalueErrorCodeE_WC_09() { 80 | let request = self.getValidFingerprintRequest() 81 | request.fingerPrintHashValue = "" 82 | 83 | let exp = expectation(description: "Empty hashvalue error mapping failed") 84 | 85 | request.validate({ (isSuccess) -> () in 86 | }, failureHandler: { (withResponse) -> () in 87 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 88 | let errorText = withResponse.getMessages().getMessages()[0].getText() 89 | 90 | XCTAssertEqual(errorCode, "E_WC_09", "Empty hashvalue Error code mapping is wrong") 91 | XCTAssertEqual(errorText, "Fingerprint hash should not be blank.", "Empty hashvalueError text mapping is wrong") 92 | 93 | exp.fulfill() 94 | }) 95 | 96 | waitForExpectations(timeout: 1) { error in 97 | if let error = error { 98 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 99 | } 100 | } 101 | } 102 | 103 | func testEmptySequenceErrorCodeE_WC_12() { 104 | let request = self.getValidFingerprintRequest() 105 | request.sequence = "" 106 | 107 | let exp = expectation(description: "Empty sequence error mapping failed") 108 | 109 | request.validate({ (isSuccess) -> () in 110 | }, failureHandler: { (withResponse) -> () in 111 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 112 | let errorText = withResponse.getMessages().getMessages()[0].getText() 113 | 114 | XCTAssertEqual(errorCode, "E_WC_12", "Empty sequence Error code mapping is wrong") 115 | XCTAssertEqual(errorText, "Sequence attribute should not be blank.", "Empty sequence text mapping is wrong") 116 | 117 | exp.fulfill() 118 | }) 119 | 120 | waitForExpectations(timeout: 1) { error in 121 | if let error = error { 122 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 123 | } 124 | } 125 | } 126 | 127 | func testEmptyAmountErrorCodeE_WC_13() { 128 | let request = self.getValidFingerprintRequest() 129 | request.amount = "" 130 | 131 | let exp = expectation(description: "Empty Amount error mapping failed") 132 | 133 | request.validate({ (isSuccess) -> () in 134 | }, failureHandler: { (withResponse) -> () in 135 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 136 | let errorText = withResponse.getMessages().getMessages()[0].getText() 137 | 138 | XCTAssertEqual(errorCode, "E_WC_13", "Empty Amount Error code mapping is wrong") 139 | XCTAssertEqual(errorText, "Invalid Fingerprint.", "Empty Amount text mapping is wrong") 140 | 141 | exp.fulfill() 142 | }) 143 | 144 | waitForExpectations(timeout: 1) { error in 145 | if let error = error { 146 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 147 | } 148 | } 149 | } 150 | 151 | func testNegativeAmountErrorCodeE_WC_13() { 152 | let request = self.getValidFingerprintRequest() 153 | request.amount = "-12" 154 | 155 | let exp = expectation(description: "Negative Amount error mapping failed") 156 | 157 | request.validate({ (isSuccess) -> () in 158 | }, failureHandler: { (withResponse) -> () in 159 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 160 | let errorText = withResponse.getMessages().getMessages()[0].getText() 161 | 162 | XCTAssertEqual(errorCode, "E_WC_13", "Negative Amount Error code mapping is wrong") 163 | XCTAssertEqual(errorText, "Invalid Fingerprint.", "Negative Amount text mapping is wrong") 164 | 165 | exp.fulfill() 166 | }) 167 | 168 | waitForExpectations(timeout: 1) { error in 169 | if let error = error { 170 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 171 | } 172 | } 173 | } 174 | 175 | func testNegativeTimestampErrorCodeE_WC_13() { 176 | let request = self.getValidFingerprintRequest() 177 | request.timestamp = "-12324424a" 178 | 179 | let exp = expectation(description: "Invalid Timestamp error mapping failed") 180 | 181 | request.validate({ (isSuccess) -> () in 182 | }, failureHandler: { (withResponse) -> () in 183 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 184 | let errorText = withResponse.getMessages().getMessages()[0].getText() 185 | 186 | XCTAssertEqual(errorCode, "E_WC_11", "Invalid Timestamp Error code mapping is wrong") 187 | XCTAssertEqual(errorText, "Please provide valid timestamp in utc.", "Invalid Timestamp text mapping is wrong") 188 | 189 | exp.fulfill() 190 | }) 191 | 192 | waitForExpectations(timeout: 1) { error in 193 | if let error = error { 194 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 195 | } 196 | } 197 | } 198 | 199 | func testFingerPrintValidationSuccess() { 200 | let request = getValidFingerprintRequest() 201 | 202 | let exp = expectation(description: "FingerPrint validation failed") 203 | 204 | request.validate({ (isSuccess) -> () in 205 | XCTAssertTrue(isSuccess) 206 | 207 | exp.fulfill() 208 | }, failureHandler: { (withResponse) -> () in 209 | }) 210 | 211 | waitForExpectations(timeout: 1) { error in 212 | if let error = error { 213 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 214 | } 215 | } 216 | } 217 | 218 | func getValidFingerprintRequest() -> FingerPrint { 219 | let fingerprintRequest = FingerPrint(inHashValue: "abcd123",inSequence: "abc",inTimestamp: "123456789",inCurrencyCode: "USD",inAmount: "12.54") 220 | 221 | return fingerprintRequest! 222 | } 223 | } 224 | -------------------------------------------------------------------------------- /AcceptSDKTests/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 | 0.5.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /AcceptSDKTests/MerchantAuthenticationTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MerchantAuthenticationTests.swift 3 | // AcceptSDK 4 | // 5 | // Created by MMA on 7/20/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class MerchantAuthenticationTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | } 16 | 17 | override func tearDown() { 18 | super.tearDown() 19 | } 20 | 21 | func testValidateNameReturnsFalseWhenEmptyString() { 22 | let request = getValidMerchantAuthentication() 23 | request.name = "" 24 | 25 | XCTAssertFalse(request.isValidName(request.name), "Name cann't be empty") 26 | } 27 | 28 | func testValidateNameReturnsFalseWhenLengthGreaterThan25() { 29 | let request = getValidMerchantAuthentication() 30 | request.name = "some name with characters count greater than twenty five" 31 | 32 | XCTAssertFalse(request.isValidName(request.name), "Name cann't contain more than 25 characters") 33 | } 34 | 35 | func testValidateNameReturnsTrueWhenValid() { 36 | let request = getValidMerchantAuthentication() 37 | request.name = "valid name" 38 | 39 | XCTAssertTrue(request.isValidName(request.name), "Not a valid name") 40 | } 41 | 42 | func testValidateNameReturnsTrueWhenValidAlphaNumeric() { 43 | let request = getValidMerchantAuthentication() 44 | request.name = "ajw12ujhg12" 45 | 46 | XCTAssertTrue(request.isValidName(request.name), "Not a valid name") 47 | } 48 | 49 | func testValidateMobileDeviceIdReturnsFalseWhenEmptyString() { 50 | let request = getValidMerchantAuthentication() 51 | request.mobileDeviceId = "" 52 | 53 | XCTAssertFalse(request.isValidMobileDeviceId(request.mobileDeviceId!), "Mobile device id cann't be empty") 54 | } 55 | 56 | func testValidateMobileDeviceIdReturnsFalseWhenLengthGreaterThan60() { 57 | let request = getValidMerchantAuthentication() 58 | request.mobileDeviceId = "hhghdg767sagd-8789sgdhjsadtsagcqwq-jshdasd73-476df-98rhtr-hdgsjks0-936hdsj-8763gdh-dhjshdyt-7463gdhjst" 59 | 60 | XCTAssertFalse(request.isValidMobileDeviceId(request.mobileDeviceId!), "Mobile device id cann't contain more than 60 characters") 61 | } 62 | 63 | func testValidateMobileDeviceIdReturnsTrueWhenValid() { 64 | let request = getValidMerchantAuthentication() 65 | request.mobileDeviceId = "h67hgf-hfjjf7-98hdkks-9nnbb" 66 | 67 | XCTAssertTrue(request.isValidMobileDeviceId(request.mobileDeviceId!), "Not a valid mobile device id") 68 | } 69 | 70 | func testMerchantAuthenticationValidationErrorCodeE_WC_18() { 71 | let request = MerchantAuthenticaton() 72 | request.name = "ValidName" 73 | request.mobileDeviceId = "fhhyh-dhdu7un-08790jb" 74 | 75 | let exp = expectation(description: "MerchantAuthentication validation failed") 76 | 77 | request.validate({ (isSuccess) -> () in 78 | }, failureHandler: { (withResponse) -> () in 79 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 80 | let errorText = withResponse.getMessages().getMessages()[0].getText() 81 | 82 | XCTAssertEqual(errorCode, "E_WC_18", "Client key empty Error code mapping is wrong") 83 | XCTAssertEqual(errorText, "Client key is required.", "Cleint key empty mapping is wrong") 84 | 85 | exp.fulfill() 86 | }) 87 | 88 | waitForExpectations(timeout: 1) { error in 89 | if let error = error { 90 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 91 | } 92 | } 93 | } 94 | 95 | func testEmptyNameValidationErrorCodeE_WC_10() { 96 | let request = getValidMerchantAuthentication() 97 | request.name = "" 98 | 99 | let exp = expectation(description: "MerchantAuthentication validation failed") 100 | 101 | request.validate({ (isSuccess) -> () in 102 | }, failureHandler: { (withResponse) -> () in 103 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 104 | let errorText = withResponse.getMessages().getMessages()[0].getText() 105 | 106 | XCTAssertEqual(errorCode, "E_WC_10", "Apiloginid empty Error code mapping is wrong") 107 | XCTAssertEqual(errorText, "Please provide valid apiloginid.", "Apiloginid empty mapping is wrong") 108 | 109 | exp.fulfill() 110 | }) 111 | 112 | waitForExpectations(timeout: 1) { error in 113 | if let error = error { 114 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 115 | } 116 | } 117 | } 118 | 119 | func testEmptyMobileDeviceIdValidationErrorCodeE_WC_04() { 120 | let request = getValidMerchantAuthentication() 121 | request.mobileDeviceId = "" 122 | 123 | let exp = expectation(description: "MerchantAuthentication validation failed") 124 | 125 | request.validate({ (isSuccess) -> () in 126 | }, failureHandler: { (withResponse) -> () in 127 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 128 | let errorText = withResponse.getMessages().getMessages()[0].getText() 129 | 130 | XCTAssertEqual(errorCode, "E_WC_04", "Mobile device id empty Error code mapping is wrong") 131 | XCTAssertEqual(errorText, "Please provide mandatory fileds", "Mobile device id empty mapping is wrong") 132 | 133 | exp.fulfill() 134 | }) 135 | 136 | waitForExpectations(timeout: 1) { error in 137 | if let error = error { 138 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 139 | } 140 | } 141 | } 142 | 143 | func testMerchantAuthenticationValidationSuccess() { 144 | let request = getValidMerchantAuthentication() 145 | 146 | let exp = expectation(description: "MerchantAuthentication validation failed") 147 | 148 | request.validate({ (isSuccess) -> () in 149 | XCTAssertTrue(isSuccess) 150 | 151 | exp.fulfill() 152 | }, failureHandler: { (withResponse) -> () in 153 | }) 154 | 155 | waitForExpectations(timeout: 1) { error in 156 | if let error = error { 157 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 158 | } 159 | } 160 | } 161 | 162 | func getValidMerchantAuthentication() -> MerchantAuthenticaton { 163 | let request = MerchantAuthenticaton() 164 | request.name = "ValidName" 165 | request.clientKey = "27gshfgjew87efb" 166 | request.mobileDeviceId = "fhhyh-dhdu7un-08790jb" 167 | request.fingerPrint = self.getValidFingerprintRequest() 168 | 169 | return request 170 | } 171 | 172 | func getValidFingerprintRequest() -> FingerPrint { 173 | let fingerprintRequest = FingerPrint(inHashValue: "abcd123",inSequence: "abc",inTimestamp: "123456789",inCurrencyCode: "USD",inAmount: "12.54") 174 | 175 | return fingerprintRequest! 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /AcceptSDKTests/TokenDataTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TokenDataTests.swift 3 | // AcceptSDKTests 4 | // 5 | // Created by Ramamurthy, Rakesh Ramamurthy on 7/15/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import XCTest 11 | 12 | class TokenDataTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | 17 | } 18 | 19 | override func tearDown() { 20 | } 21 | 22 | func testCreditCardValidationFailsWhenEmpty() { 23 | let request = Token() 24 | request.cardNumber = "" 25 | 26 | let isValid = request.isValidCardNumber() 27 | XCTAssertFalse(isValid, "Should return false when card number is empty") 28 | } 29 | 30 | func testCreditCardValidationFailsWhenContainsAlphaNumeric() { 31 | let request = Token() 32 | request.cardNumber = "a67675" 33 | 34 | let isValid = request.isValidCardNumber() 35 | XCTAssertFalse(isValid, "Card number should not be alpa numeric") 36 | } 37 | 38 | func testCreditCardValidationFailsWhenContainsNegativeNunber() { 39 | let request = Token() 40 | request.cardNumber = "-9989" 41 | 42 | let isValid = request.isValidCardNumber() 43 | XCTAssertFalse(isValid, "Card number should not be a negative") 44 | } 45 | 46 | func testCreditCardValidationFailsWhenContainsDecimal() { 47 | let request = Token() 48 | request.cardNumber = "1908.8" 49 | 50 | let isValid = request.isValidCardNumber() 51 | XCTAssertFalse(isValid, "Card number should not contain decimal places") 52 | } 53 | 54 | func testCreditCardValidationFailsWhenLessThan4Characters() { 55 | let request = Token() 56 | request.cardNumber = "234" 57 | 58 | let isValid = request.isValidCardNumber() 59 | XCTAssertFalse(isValid) 60 | } 61 | 62 | func testCreditCardValidationFailsWhenGreaterThan4AndLessThan16Characters() { 63 | let request = Token() 64 | request.cardNumber = "234787" 65 | 66 | let isValid = request.isValidCardNumber() 67 | XCTAssertFalse(isValid) 68 | } 69 | 70 | func testCreditCardValidationFailsWhenLuhnAlgorithmFails() { 71 | let request = Token() 72 | request.cardNumber = "1234567891234567" 73 | 74 | let isValid = request.isValidCardNumber() 75 | XCTAssertFalse(isValid, "testCreditCardValidationFailsWhenLuhnAlgorithmFails fails") 76 | } 77 | 78 | func testCreditCardValidationFailsWhenContainsSpaces() { 79 | let request = Token() 80 | request.cardNumber = "1123 135 345 123" 81 | 82 | let isValid = request.isValidCardNumber() 83 | XCTAssertFalse(isValid, "testCreditCardValidationFailsWhenLuhnAlgorithmFails fails") 84 | } 85 | 86 | func testCreditCardValidationSuccess() { 87 | let request = Token() 88 | request.cardNumber = "378282246310005" 89 | 90 | let isValid = request.isValidCardNumber() 91 | XCTAssertTrue(isValid, "testCreditCardValidationSuccess fails") 92 | } 93 | 94 | func testValidateExpirationMonthFailsWhenNumberOfCharactersIsMoreThan2() { 95 | let request = Token() 96 | request.expirationMonth = "122" 97 | 98 | XCTAssertFalse(request.isValidExpirationMonth(), "testExpirationMonthFailsWhenNumberOfCharactersIsMoreThan2 fails") 99 | } 100 | 101 | func testValidateExpirationMonthReturnsTruesWhenNumberOfCharactersIs1() { 102 | let request = Token() 103 | request.expirationMonth = "1" 104 | 105 | XCTAssertTrue(request.isValidExpirationMonth(), "testValidateExpirationMonthReturnsTruesWhenNumberOfCharactersIs1 fails") 106 | } 107 | 108 | func testValidateExpirationMonthReturnsFalseWhenMonthLessThan1() { 109 | let request = Token() 110 | request.expirationMonth = "0" 111 | 112 | XCTAssertFalse(request.isValidExpirationMonth(), "testValidateExpirationMonthReturnsFalseWhenMonthLessThan1 fails") 113 | } 114 | 115 | func testValidateExpirationMonthReturnFalseWhenMonthGreaterThan12() { 116 | let request = Token() 117 | request.expirationMonth = "15" 118 | 119 | XCTAssertFalse(request.isValidExpirationMonth(), "testValidateExpirationMonthReturnFalseWhenMonthGreaterThan12 fails") 120 | } 121 | 122 | func testValidateExpirationMonthReturnsTrueWhenNumberOfCharactersIs2() { 123 | let request = Token() 124 | request.expirationMonth = "11" 125 | 126 | XCTAssertTrue(request.isValidExpirationMonth(), "testValidateExpirationMonthReturnsTrueWhenNumberOfCharactersIs2 fails") 127 | } 128 | 129 | func testValidateExpirationYearReturnsFalseWhenNumberOfCharactersIsLessThan2() { 130 | let request = Token() 131 | request.expirationYear = "5" 132 | 133 | XCTAssertFalse(request.isValidExpirationYear(), "testValidateExpirationYearReturnsFalseWhenNumberOfCharactersIsLessThan2 fails") 134 | } 135 | 136 | func testValidateExpirationYearReturnsFalseWhenNumberOfCharactersIsGreaterThan4() { 137 | let request = Token() 138 | request.expirationYear = "53453" 139 | 140 | XCTAssertFalse(request.isValidExpirationYear(), "testValidateExpirationYearReturnsFalseWhenNumberOfCharactersIsGreaterThan4 fails") 141 | } 142 | 143 | func testValidateExpirationYearReturnsFalseWhenNotNumber() { 144 | let request = Token() 145 | request.expirationYear = "abcd" 146 | 147 | XCTAssertFalse(request.isValidExpirationYear(), "testValidateExpirationYearReturnsFalseWhenNotNumber fails") 148 | } 149 | 150 | func testValidateExpirationMonthReturnsTrueWhenValidYearWith4Characters() { 151 | let request = Token() 152 | request.expirationYear = "2028" 153 | 154 | XCTAssertTrue(request.isValidExpirationYear(), "testValidateExpirationMonthReturnsTrueWhenValidYearWith2Characters fails") 155 | } 156 | 157 | func testValidateExpirationMonthReturnsTrueWhenValidYearWith2Characters() { 158 | let request = Token() 159 | request.expirationYear = "28" 160 | 161 | XCTAssertTrue(request.isValidExpirationYear(), "testValidateExpirationMonthReturnsTrueWhenValidYearWith2Characters fails") 162 | } 163 | 164 | func testValidateExpirationDateReturnsFalseWhenYearExpired() { 165 | let request = Token() 166 | request.expirationYear = "1990" 167 | request.expirationMonth = "11" 168 | 169 | XCTAssertFalse(request.isValidExpirationDate(), "testValidateExpirationDateReturnsFalseWhenYearExpired fails") 170 | } 171 | 172 | func testValidateExpirationDateReturnsTrueWhenForFutureExpirationDate() { 173 | let request = Token() 174 | request.expirationYear = "2020" 175 | request.expirationMonth = "11" 176 | 177 | XCTAssertTrue(request.isValidExpirationDate(), "testValidateExpirationDateReturnsTrueWhenForFutureExpirationDate fails") 178 | } 179 | 180 | func testValidateZipReturnsFalseWhenEmptyString() { 181 | let request = Token() 182 | request.zip = "" 183 | 184 | XCTAssertFalse(request.isValidZip(request.zip!), "testValidateZipReturnsFalseWhenEmptyString fails") 185 | } 186 | 187 | func testValidateZipReturnsFalseWhenOnlySpacesString() { 188 | let request = Token() 189 | request.zip = " " 190 | 191 | XCTAssertFalse(request.isValidZip(request.zip!), "Zip code has only spaces") 192 | } 193 | 194 | func testValidateZipReturnsFalseWhenStartWithSpace() { 195 | let request = Token() 196 | request.zip = " dhjqwhdjqwd" 197 | 198 | XCTAssertFalse(request.isValidZip(request.zip!), "Zip code cann't start with spaces") 199 | } 200 | 201 | func testValidateZipReturnsFalseWhenEndsWithSpace() { 202 | let request = Token() 203 | request.zip = "4563 " 204 | 205 | XCTAssertFalse(request.isValidZip(request.zip!), "Zip code cann't end with spaces") 206 | } 207 | 208 | func testValidateZipReturnsFalseWhenNumberOfCharactersGreaterThan20() { 209 | let request = Token() 210 | request.zip = "z7676777786767678678678678" 211 | 212 | XCTAssertFalse(request.isValidZip(request.zip!), "testValidateZipReturnsFalseWhenNumberOfCharactersGreaterThan20 fails") 213 | } 214 | 215 | func testValidateZipReturnsTrueWhenZipIsValid() { 216 | let request = Token() 217 | request.zip = "560085" 218 | 219 | XCTAssertTrue(request.isValidZip(request.zip!), "testValidateZipReturnsTrueWhenZipIsValid fails") 220 | } 221 | 222 | func testValidateFullNameReturnsFalseWhenEmptyString() { 223 | let request = Token() 224 | request.fullName = "" 225 | 226 | XCTAssertFalse(request.isValidFullName(request.fullName!), "testValidateFullNameReturnsFalseWhenEmptyString fails") 227 | } 228 | 229 | func testValidateFullNameReturnsFalseWhenOnlySpacesString() { 230 | let request = Token() 231 | request.fullName = " " 232 | 233 | XCTAssertFalse(request.isValidFullName(request.fullName!), "Full name contains only spaces") 234 | } 235 | 236 | func testValidateFullNameReturnsFalseWhenNumberOfCharactersGreaterThan64() { 237 | let request = Token() 238 | request.fullName = "some really really long name whose length is more than sixty four characters which required to validate" 239 | 240 | XCTAssertFalse(request.isValidFullName(request.fullName!), "testValidateFullNameReturnsFalseWhenNumberOfCharactersGreaterThan64 fails") 241 | } 242 | 243 | func testValidateFullNameReturnsTrueWhenValidName() { 244 | let request = Token() 245 | request.fullName = "john doe" 246 | 247 | XCTAssertTrue(request.isValidFullName(request.fullName!), "testValidateFullNameReturnsTrueWhenValidName fails") 248 | } 249 | 250 | func testValidateCardCodeReturnsFalseWhenEmptyString() { 251 | let request = Token() 252 | request.cardCode = "" 253 | 254 | XCTAssertFalse(request.isValidCardCode(request.cardCode!), "testValidateCardCodeReturnsFalseWhenEmptyString fails") 255 | } 256 | 257 | func testValidateCardCodeReturnsFalseWhenMinimumCharactersLessThan3() { 258 | let request = Token() 259 | request.cardCode = "12" 260 | 261 | XCTAssertFalse(request.isValidCardCode(request.cardCode!), "testValidateCardCodeReturnsFalseWhenMinimumCharactersLessThan3 fails") 262 | } 263 | 264 | func testValidateCardCodeReturnsFalseWhenMinimumCharactersGreaterThan4() { 265 | let request = Token() 266 | request.cardCode = "12345" 267 | 268 | XCTAssertFalse(request.isValidCardCode(request.cardCode!), "testValidateCardCodeReturnsFalseWhenMinimumCharactersGreaterThan4 fails") 269 | } 270 | 271 | func testValidateCardCodeReturnsTrueWhenMinimumCharactersEqualTo3() { 272 | let request = Token() 273 | request.cardCode = "123" 274 | 275 | XCTAssertTrue(request.isValidCardCode(request.cardCode!), "testValidateCardCodeReturnsTrueWhenMinimumCharactersEqualTo3 fails") 276 | } 277 | 278 | func testValidateCardCodeReturnsTrueWhenMinimumCharactersEqualTo4() { 279 | let request = Token() 280 | request.cardCode = "1234" 281 | 282 | XCTAssertTrue(request.isValidCardCode(request.cardCode!), "testValidateCardCodeReturnsTrueWhenMinimumCharactersEqualTo4 fails") 283 | } 284 | 285 | func testTokenValidationErrorCodeE_WC_05() { 286 | let request = self.getValidTokenRequest() 287 | request.cardNumber = "671" 288 | 289 | let exp = expectation(description: "Card Number error mapping failed") 290 | 291 | request.validate({ (isSuccess) -> () in 292 | }, failureHandler: { (withResponse) -> () in 293 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 294 | let errorText = withResponse.getMessages().getMessages()[0].getText() 295 | 296 | XCTAssertEqual(errorCode, "E_WC_05", "Card number Error code mapping is wrong") 297 | XCTAssertEqual(errorText, "Please provide valid credit card number.", "Card number Error text mapping is wrong") 298 | 299 | exp.fulfill() 300 | }) 301 | 302 | waitForExpectations(timeout: 1) { error in 303 | if let error = error { 304 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 305 | } 306 | } 307 | } 308 | 309 | func testTokenValidationErrorCodeE_WC_06() { 310 | let request = self.getValidTokenRequest() 311 | request.expirationMonth = "21" 312 | 313 | let exp = expectation(description: "Expiration month error mapping failed") 314 | 315 | request.validate({ (isSuccess) -> () in 316 | }, failureHandler: { (withResponse) -> () in 317 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 318 | let errorText = withResponse.getMessages().getMessages()[0].getText() 319 | 320 | XCTAssertEqual(errorCode, "E_WC_06", "Expiration month Error code mapping is wrong") 321 | XCTAssertEqual(errorText, "Please provide valid expiration month.", "Expiration month Error text mapping is wrong") 322 | 323 | exp.fulfill() 324 | }) 325 | 326 | waitForExpectations(timeout: 1) { error in 327 | if let error = error { 328 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 329 | } 330 | } 331 | } 332 | 333 | func testTokenValidationErrorCodeE_WC_07() { 334 | let request = self.getValidTokenRequest() 335 | request.expirationYear = "29088" 336 | 337 | let exp = expectation(description: "Expiration year error mapping failed") 338 | 339 | request.validate({ (isSuccess) -> () in 340 | }, failureHandler: { (withResponse) -> () in 341 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 342 | let errorText = withResponse.getMessages().getMessages()[0].getText() 343 | 344 | XCTAssertEqual(errorCode, "E_WC_07", "Expiration year Error code mapping is wrong") 345 | XCTAssertEqual(errorText, "Please provide valid expiration year.", "Expiration year Error text mapping is wrong") 346 | 347 | exp.fulfill() 348 | }) 349 | 350 | waitForExpectations(timeout: 1) { error in 351 | if let error = error { 352 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 353 | } 354 | } 355 | } 356 | 357 | func testTokenValidationErrorCodeE_WC_08() { 358 | let request = self.getValidTokenRequest() 359 | request.expirationYear = "1999" 360 | request.expirationMonth = "11" 361 | 362 | let exp = expectation(description: "Expiration date error mapping failed") 363 | 364 | request.validate({ (isSuccess) -> () in 365 | }, failureHandler: { (withResponse) -> () in 366 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 367 | let errorText = withResponse.getMessages().getMessages()[0].getText() 368 | 369 | XCTAssertEqual(errorCode, "E_WC_08", "Expiration date Error code mapping is wrong") 370 | XCTAssertEqual(errorText, "Expiration date must be in the future.", "Expiration date Error text mapping is wrong") 371 | 372 | exp.fulfill() 373 | }) 374 | 375 | waitForExpectations(timeout: 1) { error in 376 | if let error = error { 377 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 378 | } 379 | } 380 | } 381 | 382 | func testCardCodeMinLengthValidationErrorCodeE_WC_15() { 383 | let request = self.getValidTokenRequest() 384 | request.cardCode = "1" 385 | let exp = expectation(description: "Card code min length error mapping failed") 386 | 387 | request.validate({ (isSuccess) -> () in 388 | }, failureHandler: { (withResponse) -> () in 389 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 390 | let errorText = withResponse.getMessages().getMessages()[0].getText() 391 | 392 | XCTAssertEqual(errorCode, "E_WC_15", "CardCode Error code mapping is wrong") 393 | XCTAssertEqual(errorText, "Please provide valid CVV.", "CardCode Error text mapping is wrong") 394 | 395 | exp.fulfill() 396 | }) 397 | 398 | waitForExpectations(timeout: 1) { error in 399 | if let error = error { 400 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 401 | } 402 | } 403 | } 404 | func testCardCodeMaxLengthValidationErrorCodeE_WC_15() { 405 | let request = self.getValidTokenRequest() 406 | request.cardCode = "12345" 407 | let exp = expectation(description: "Card code max length error mapping failed") 408 | 409 | request.validate({ (isSuccess) -> () in 410 | }, failureHandler: { (withResponse) -> () in 411 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 412 | let errorText = withResponse.getMessages().getMessages()[0].getText() 413 | 414 | XCTAssertEqual(errorCode, "E_WC_15", "CardCode Error code mapping is wrong") 415 | XCTAssertEqual(errorText, "Please provide valid CVV.", "CardCode Error text mapping is wrong") 416 | 417 | exp.fulfill() 418 | }) 419 | 420 | waitForExpectations(timeout: 1) { error in 421 | if let error = error { 422 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 423 | } 424 | } 425 | } 426 | func testCardCodeNullValidationErrorCodeE_WC_15() { 427 | let request = self.getValidTokenRequest() 428 | request.cardCode = "" 429 | let exp = expectation(description: "Empty card code error mapping failed") 430 | 431 | request.validate({ (isSuccess) -> () in 432 | }, failureHandler: { (withResponse) -> () in 433 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 434 | let errorText = withResponse.getMessages().getMessages()[0].getText() 435 | 436 | XCTAssertEqual(errorCode, "E_WC_15", "CardCode Error code mapping is wrong") 437 | XCTAssertEqual(errorText, "Please provide valid CVV.", "CardCode Error text mapping is wrong") 438 | 439 | exp.fulfill() 440 | }) 441 | 442 | waitForExpectations(timeout: 1) { error in 443 | if let error = error { 444 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 445 | } 446 | } 447 | } 448 | 449 | func testZipcodeNullValidationErrorCodeE_WC_16() { 450 | let request = self.getValidTokenRequest() 451 | request.zip = "" 452 | let exp = expectation(description: "Empty zip code error mapping failed") 453 | 454 | request.validate({ (isSuccess) -> () in 455 | }, failureHandler: { (withResponse) -> () in 456 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 457 | let errorText = withResponse.getMessages().getMessages()[0].getText() 458 | 459 | XCTAssertEqual(errorCode, "E_WC_16", "Zipcode Error code mapping is wrong") 460 | XCTAssertEqual(errorText, "Please provide valid Zip code.", "Zipcode Error text mapping is wrong") 461 | 462 | exp.fulfill() 463 | }) 464 | 465 | waitForExpectations(timeout: 1) { error in 466 | if let error = error { 467 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 468 | } 469 | } 470 | } 471 | 472 | func testZipcodeMaxLengthValidationErrorCodeE_WC_16() { 473 | let request = self.getValidTokenRequest() 474 | request.zip = "123456789012345678901" 475 | let exp = expectation(description: "Max length of zip code error mapping failed") 476 | 477 | request.validate({ (isSuccess) -> () in 478 | }, failureHandler: { (withResponse) -> () in 479 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 480 | let errorText = withResponse.getMessages().getMessages()[0].getText() 481 | 482 | XCTAssertEqual(errorCode, "E_WC_16", "Zipcode Error code mapping is wrong") 483 | XCTAssertEqual(errorText, "Please provide valid Zip code.", "Zipcode Error text mapping is wrong") 484 | 485 | exp.fulfill() 486 | }) 487 | 488 | waitForExpectations(timeout: 1) { error in 489 | if let error = error { 490 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 491 | } 492 | } 493 | } 494 | 495 | func testFullnameLengthValidationErrorCodeE_WC_17() { 496 | let request = self.getValidTokenRequest() 497 | request.fullName = "some really really long name whose length is more than sixty four characters which required to validate" 498 | let exp = expectation(description: "Max length of fullname error mapping failed") 499 | 500 | request.validate({ (isSuccess) -> () in 501 | }, failureHandler: { (withResponse) -> () in 502 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 503 | let errorText = withResponse.getMessages().getMessages()[0].getText() 504 | 505 | XCTAssertEqual(errorCode, "E_WC_17", "Fullname Error code mapping is wrong") 506 | XCTAssertEqual(errorText, "Please provide valid card holder name.", "Fullname Error text mapping is wrong") 507 | 508 | exp.fulfill() 509 | }) 510 | 511 | waitForExpectations(timeout: 1) { error in 512 | if let error = error { 513 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 514 | } 515 | } 516 | } 517 | 518 | func testFullnameEmptyStringValidationErrorCodeE_WC_17() { 519 | let request = self.getValidTokenRequest() 520 | request.fullName = "" 521 | let exp = expectation(description: "Empty fullname error mapping failed") 522 | 523 | request.validate({ (isSuccess) -> () in 524 | }, failureHandler: { (withResponse) -> () in 525 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 526 | let errorText = withResponse.getMessages().getMessages()[0].getText() 527 | 528 | XCTAssertEqual(errorCode, "E_WC_17", "Fullname Error code mapping is wrong") 529 | XCTAssertEqual(errorText, "Please provide valid card holder name.", "Fullname Error text mapping is wrong") 530 | 531 | exp.fulfill() 532 | }) 533 | 534 | waitForExpectations(timeout: 1) { error in 535 | if let error = error { 536 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 537 | } 538 | } 539 | } 540 | 541 | func testTokenValidationSuccess() { 542 | let request = getValidTokenRequest() 543 | 544 | let exp = expectation(description: "Token validation failed") 545 | 546 | request.validate({ (isSuccess) -> () in 547 | XCTAssertTrue(isSuccess) 548 | 549 | exp.fulfill() 550 | }, failureHandler: { (withResponse) -> () in 551 | }) 552 | 553 | waitForExpectations(timeout: 1) { error in 554 | if let error = error { 555 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 556 | } 557 | } 558 | } 559 | 560 | func getValidTokenRequest() -> Token { 561 | let tokenRequest = Token() 562 | 563 | tokenRequest.cardNumber = "378282246310005" 564 | tokenRequest.cardCode = "123" 565 | tokenRequest.expirationMonth = "11" 566 | tokenRequest.expirationYear = "2023" 567 | 568 | return tokenRequest 569 | } 570 | } 571 | -------------------------------------------------------------------------------- /AcceptSDKTests/WebCheckOutDataTypeTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WebCheckOutDataTypeTests.swift 3 | // AcceptSDK 4 | // 5 | // Created by MMA on 7/20/16. 6 | // Copyright © 2016 Ramamurthy, Rakesh Ramamurthy. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class WebCheckOutDataTypeTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | } 16 | 17 | override func tearDown() { 18 | super.tearDown() 19 | } 20 | 21 | func testTypeInitializesToTokenString() { 22 | let request = WebCheckOutDataType() 23 | 24 | XCTAssertEqual(request.type, WebCheckOutTypeEnum.kToken.rawValue, "Type is not initialized to TOKEN") 25 | } 26 | 27 | func testValidateTypeReturnsFalseWhenEmptyString() { 28 | let request = WebCheckOutDataType() 29 | request.type = "" 30 | 31 | XCTAssertFalse(request.isValidType(), "Type cann't be empty and should initialize to TOKEN") 32 | } 33 | 34 | func testValidateTypeReturnsTrueWhenValidString() { 35 | let request = WebCheckOutDataType() 36 | 37 | XCTAssertTrue(request.isValidType(), "Type cann't be empty and should initialize to TOKEN") 38 | } 39 | 40 | func testValidateIdReturnsFalseWhenEmptyString() { 41 | let request = WebCheckOutDataType() 42 | request.id = "" 43 | 44 | XCTAssertFalse(request.isValidId(), "Id cann't be empty") 45 | } 46 | 47 | func testTypeInitializesToUUIDString() { 48 | let request = WebCheckOutDataType() 49 | 50 | XCTAssertEqual(request.id, UIDevice.current.identifierForVendor!.uuidString, "Id is not initialized to TOKEN") 51 | } 52 | 53 | func testValidateIdReturnsFalseWhenCharactersGreaterThan64() { 54 | let request = WebCheckOutDataType() 55 | request.id = "some really really long name whose length is more than sixty four characters which required to validate" 56 | 57 | XCTAssertFalse(request.isValidId(), "Id cann't be more than 64 characters") 58 | } 59 | 60 | func testValidateIdReturnsTrueWhenValidString() { 61 | let request = WebCheckOutDataType() 62 | request.id = UIDevice.current.identifierForVendor!.uuidString 63 | 64 | XCTAssertTrue(request.isValidId(), "Id cann't be empty") 65 | } 66 | 67 | func testWebCheckOutDataTypeValidation() { 68 | let request = WebCheckOutDataType() 69 | request.token.cardNumber = "378282246310005" 70 | request.token.cardCode = "123" 71 | request.token.expirationMonth = "11" 72 | request.token.expirationYear = "2023" 73 | 74 | let exp = expectation(description: "WebCheckOutDataType validation failed") 75 | 76 | request.validate({ (isSuccess) -> () in 77 | XCTAssertTrue(isSuccess) 78 | 79 | exp.fulfill() 80 | }, failureHandler: {_ in 81 | 82 | }) 83 | 84 | waitForExpectations(timeout: 1) { error in 85 | if let error = error { 86 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 87 | } 88 | } 89 | } 90 | 91 | func testWebCheckOutDataTypeValidationErrorCodeE_WC_04() { 92 | let request = WebCheckOutDataType() 93 | request.type = "" 94 | request.token = self.getValidTokenRequest() 95 | 96 | let exp = expectation(description: "WebCheckOutDataType validation failed") 97 | 98 | request.validate({ (isSuccess) -> () in 99 | }, failureHandler: { (withResponse) -> () in 100 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 101 | let errorText = withResponse.getMessages().getMessages()[0].getText() 102 | 103 | XCTAssertEqual(errorCode, "E_WC_04", "Type Error code mapping is wrong") 104 | XCTAssertEqual(errorText, "Invalid type", "Type Error text mapping is wrong") 105 | 106 | exp.fulfill() 107 | }) 108 | 109 | waitForExpectations(timeout: 1) { error in 110 | if let error = error { 111 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 112 | } 113 | } 114 | } 115 | 116 | func testWebCheckOutDataIdValidationErrorCodeE_WC_04() { 117 | let request = WebCheckOutDataType() 118 | request.id = "" 119 | request.token = self.getValidTokenRequest() 120 | 121 | let exp = expectation(description: "WebCheckOutDataType validation failed") 122 | 123 | request.validate({ (isSuccess) -> () in 124 | }, failureHandler: { (withResponse) -> () in 125 | let errorCode = withResponse.getMessages().getMessages()[0].getCode() 126 | let errorText = withResponse.getMessages().getMessages()[0].getText() 127 | 128 | XCTAssertEqual(errorCode, "E_WC_04", "Type Error code mapping is wrong") 129 | XCTAssertEqual(errorText, "Invalid id", "Type Error text mapping is wrong") 130 | 131 | exp.fulfill() 132 | }) 133 | 134 | waitForExpectations(timeout: 1) { error in 135 | if let error = error { 136 | XCTFail("waitForExpectationsWithTimeout errored: \(error)") 137 | } 138 | } 139 | } 140 | 141 | func getValidTokenRequest() -> Token { 142 | let tokenRequest = Token() 143 | 144 | tokenRequest.cardNumber = "378282246310005" 145 | tokenRequest.cardCode = "123" 146 | tokenRequest.expirationMonth = "11" 147 | tokenRequest.expirationYear = "2023" 148 | 149 | return tokenRequest 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /AuthorizeNetAccept.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint AuthorizeNetAccept.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | 11 | s.name = 'AuthorizeNetAccept' 12 | s.authors = 'Authorize.Net' 13 | s.version = '0.4.0' 14 | s.summary = 'Authorize.Net Accept SDK for iOS' 15 | s.homepage = 'https://developer.authorize.net' 16 | 17 | s.license = 'https://github.com/AuthorizeNet/accept-sdk-ios/blob/master/LICENSE.md' 18 | s.platform = :ios, "8.4" 19 | 20 | s.source = {:git => 'https://github.com/AuthorizeNet/accept-sdk-ios.git', :tag => s.version.to_s} 21 | s.requires_arc = true 22 | 23 | s.module_name = 'AuthorizeNetAccept' 24 | s.source_files = "AcceptSDK/**/*.{swift}" 25 | 26 | end 27 | 28 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | 3 | platform :ios, "8.4" 4 | use_frameworks! 5 | 6 | target 'AcceptSDK' do 7 | end 8 | 9 | target 'AcceptSDKTests' do 10 | end 11 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODFILE CHECKSUM: d540ecd1d9ff8387717cebd129048009ea6f91d4 2 | 3 | COCOAPODS: 1.4.0 4 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODFILE CHECKSUM: d540ecd1d9ff8387717cebd129048009ea6f91d4 2 | 3 | COCOAPODS: 1.4.0 4 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 56D235276495EB5B46C273F02E4201BF /* Pods-AcceptSDK-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = AFA9864A0A3D33A96118C7945235DFEB /* Pods-AcceptSDK-dummy.m */; }; 11 | 6202031B9AAFD5887E551CCFDB07E2AA /* Pods-AcceptSDK-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 6994C2F7EC7A0C8F79D59610440C0E46 /* Pods-AcceptSDK-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; 12 | 71B8133C3D46256CF916F84370BA0FD3 /* Pods-AcceptSDKTests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 9ED9E952CBCDFF329B403A9777FC814C /* Pods-AcceptSDKTests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; 13 | 9133C7679FA5872FCEE7FE4C3B352245 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */; }; 14 | 97C6E559D4E2DDA9505378218144705F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */; }; 15 | 9E8D3AD75B9331A2CB283EE8AD0A0A37 /* Pods-AcceptSDKTests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = FC88CC1E192DA089E3862D38DDF86B8B /* Pods-AcceptSDKTests-dummy.m */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 08B4CA888216BB38402A2DCCF3D7118F /* Pods-AcceptSDK-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-AcceptSDK-resources.sh"; sourceTree = ""; }; 20 | 0A899E924199D1EEB440DE6D5ECD6F6B /* Pods-AcceptSDK-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-AcceptSDK-acknowledgements.markdown"; sourceTree = ""; }; 21 | 15C5C85A068F85F642C350CD41250676 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 22 | 2BF7C2BFBF2052980FD159AE3A3B87AD /* Pods-AcceptSDK.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-AcceptSDK.debug.xcconfig"; sourceTree = ""; }; 23 | 36730EB909204790810DE2C26409A4BD /* Pods-AcceptSDK-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-AcceptSDK-acknowledgements.plist"; sourceTree = ""; }; 24 | 573CED3992FDACA161FA31008615EE76 /* Pods_AcceptSDKTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_AcceptSDKTests.framework; path = "Pods-AcceptSDKTests.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; 25 | 5850043E4D3E6257E1E1D2AEB0D962FE /* Pods-AcceptSDKTests-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-AcceptSDKTests-resources.sh"; sourceTree = ""; }; 26 | 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 27 | 6994C2F7EC7A0C8F79D59610440C0E46 /* Pods-AcceptSDK-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-AcceptSDK-umbrella.h"; sourceTree = ""; }; 28 | 725A9836D885D5184F8FF4876273E8CA /* Pods-AcceptSDKTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-AcceptSDKTests.release.xcconfig"; sourceTree = ""; }; 29 | 764570BA5D97DCB5B3931CB5E416F389 /* Pods-AcceptSDKTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-AcceptSDKTests.debug.xcconfig"; sourceTree = ""; }; 30 | 796D48BE24CD36A165870495A8C19941 /* Pods-AcceptSDK.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-AcceptSDK.release.xcconfig"; sourceTree = ""; }; 31 | 7E6E26388EE048B8EE73EDCB197825FF /* Pods-AcceptSDK.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-AcceptSDK.modulemap"; sourceTree = ""; }; 32 | 874A865D0CB86213DE26722BE3E30E4A /* Pods-AcceptSDKTests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-AcceptSDKTests-acknowledgements.plist"; sourceTree = ""; }; 33 | 898263BECC7ABC614F57B052BA852415 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 35 | 9ED9E952CBCDFF329B403A9777FC814C /* Pods-AcceptSDKTests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-AcceptSDKTests-umbrella.h"; sourceTree = ""; }; 36 | A27EEDDD5EBF68F00D03B2B8629E168A /* Pods-AcceptSDKTests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-AcceptSDKTests.modulemap"; sourceTree = ""; }; 37 | AFA9864A0A3D33A96118C7945235DFEB /* Pods-AcceptSDK-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-AcceptSDK-dummy.m"; sourceTree = ""; }; 38 | AFD803046BFFE3AFAE5E1E895754F89B /* Pods-AcceptSDKTests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-AcceptSDKTests-frameworks.sh"; sourceTree = ""; }; 39 | E50BA07591871632870E75A3465464AB /* Pods_AcceptSDK.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_AcceptSDK.framework; path = "Pods-AcceptSDK.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | F5D28470281E15AD1A838A9506929A60 /* Pods-AcceptSDKTests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-AcceptSDKTests-acknowledgements.markdown"; sourceTree = ""; }; 41 | FC88CC1E192DA089E3862D38DDF86B8B /* Pods-AcceptSDKTests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-AcceptSDKTests-dummy.m"; sourceTree = ""; }; 42 | /* End PBXFileReference section */ 43 | 44 | /* Begin PBXFrameworksBuildPhase section */ 45 | 4B977A5F8339AFE1592B6ABA542C9DCD /* Frameworks */ = { 46 | isa = PBXFrameworksBuildPhase; 47 | buildActionMask = 2147483647; 48 | files = ( 49 | 9133C7679FA5872FCEE7FE4C3B352245 /* Foundation.framework in Frameworks */, 50 | ); 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | E1A145956C0CD42164311CA7DE85F7EE /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | 97C6E559D4E2DDA9505378218144705F /* Foundation.framework in Frameworks */, 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | /* End PBXFrameworksBuildPhase section */ 62 | 63 | /* Begin PBXGroup section */ 64 | 17F0ADE14AFF0156002A7F9CDAFD627C /* Pods-AcceptSDKTests */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | 898263BECC7ABC614F57B052BA852415 /* Info.plist */, 68 | A27EEDDD5EBF68F00D03B2B8629E168A /* Pods-AcceptSDKTests.modulemap */, 69 | F5D28470281E15AD1A838A9506929A60 /* Pods-AcceptSDKTests-acknowledgements.markdown */, 70 | 874A865D0CB86213DE26722BE3E30E4A /* Pods-AcceptSDKTests-acknowledgements.plist */, 71 | FC88CC1E192DA089E3862D38DDF86B8B /* Pods-AcceptSDKTests-dummy.m */, 72 | AFD803046BFFE3AFAE5E1E895754F89B /* Pods-AcceptSDKTests-frameworks.sh */, 73 | 5850043E4D3E6257E1E1D2AEB0D962FE /* Pods-AcceptSDKTests-resources.sh */, 74 | 9ED9E952CBCDFF329B403A9777FC814C /* Pods-AcceptSDKTests-umbrella.h */, 75 | 764570BA5D97DCB5B3931CB5E416F389 /* Pods-AcceptSDKTests.debug.xcconfig */, 76 | 725A9836D885D5184F8FF4876273E8CA /* Pods-AcceptSDKTests.release.xcconfig */, 77 | ); 78 | name = "Pods-AcceptSDKTests"; 79 | path = "Target Support Files/Pods-AcceptSDKTests"; 80 | sourceTree = ""; 81 | }; 82 | 2EC07C130A880FB103FC1EC7BB73A3AF /* Pods-AcceptSDK */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 15C5C85A068F85F642C350CD41250676 /* Info.plist */, 86 | 7E6E26388EE048B8EE73EDCB197825FF /* Pods-AcceptSDK.modulemap */, 87 | 0A899E924199D1EEB440DE6D5ECD6F6B /* Pods-AcceptSDK-acknowledgements.markdown */, 88 | 36730EB909204790810DE2C26409A4BD /* Pods-AcceptSDK-acknowledgements.plist */, 89 | AFA9864A0A3D33A96118C7945235DFEB /* Pods-AcceptSDK-dummy.m */, 90 | 08B4CA888216BB38402A2DCCF3D7118F /* Pods-AcceptSDK-resources.sh */, 91 | 6994C2F7EC7A0C8F79D59610440C0E46 /* Pods-AcceptSDK-umbrella.h */, 92 | 2BF7C2BFBF2052980FD159AE3A3B87AD /* Pods-AcceptSDK.debug.xcconfig */, 93 | 796D48BE24CD36A165870495A8C19941 /* Pods-AcceptSDK.release.xcconfig */, 94 | ); 95 | name = "Pods-AcceptSDK"; 96 | path = "Target Support Files/Pods-AcceptSDK"; 97 | sourceTree = ""; 98 | }; 99 | 3631FBD9EA7771D4CC66F156B919E361 /* Targets Support Files */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 2EC07C130A880FB103FC1EC7BB73A3AF /* Pods-AcceptSDK */, 103 | 17F0ADE14AFF0156002A7F9CDAFD627C /* Pods-AcceptSDKTests */, 104 | ); 105 | name = "Targets Support Files"; 106 | sourceTree = ""; 107 | }; 108 | 7DB346D0F39D3F0E887471402A8071AB = { 109 | isa = PBXGroup; 110 | children = ( 111 | 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */, 112 | BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */, 113 | FB09CB0354FF5AB96EB895E1D2CB9664 /* Products */, 114 | 3631FBD9EA7771D4CC66F156B919E361 /* Targets Support Files */, 115 | ); 116 | sourceTree = ""; 117 | }; 118 | BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | D35AF013A5F0BAD4F32504907A52519E /* iOS */, 122 | ); 123 | name = Frameworks; 124 | sourceTree = ""; 125 | }; 126 | D35AF013A5F0BAD4F32504907A52519E /* iOS */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */, 130 | ); 131 | name = iOS; 132 | sourceTree = ""; 133 | }; 134 | FB09CB0354FF5AB96EB895E1D2CB9664 /* Products */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | E50BA07591871632870E75A3465464AB /* Pods_AcceptSDK.framework */, 138 | 573CED3992FDACA161FA31008615EE76 /* Pods_AcceptSDKTests.framework */, 139 | ); 140 | name = Products; 141 | sourceTree = ""; 142 | }; 143 | /* End PBXGroup section */ 144 | 145 | /* Begin PBXHeadersBuildPhase section */ 146 | 050DFF10BEACE1DA3DB7726A5BC96895 /* Headers */ = { 147 | isa = PBXHeadersBuildPhase; 148 | buildActionMask = 2147483647; 149 | files = ( 150 | 6202031B9AAFD5887E551CCFDB07E2AA /* Pods-AcceptSDK-umbrella.h in Headers */, 151 | ); 152 | runOnlyForDeploymentPostprocessing = 0; 153 | }; 154 | 1FC96788402D2AA94CF69AADA27C3C2F /* Headers */ = { 155 | isa = PBXHeadersBuildPhase; 156 | buildActionMask = 2147483647; 157 | files = ( 158 | 71B8133C3D46256CF916F84370BA0FD3 /* Pods-AcceptSDKTests-umbrella.h in Headers */, 159 | ); 160 | runOnlyForDeploymentPostprocessing = 0; 161 | }; 162 | /* End PBXHeadersBuildPhase section */ 163 | 164 | /* Begin PBXNativeTarget section */ 165 | 42191ABD42A8DD02D98C0311EA0DF40C /* Pods-AcceptSDK */ = { 166 | isa = PBXNativeTarget; 167 | buildConfigurationList = F5567B5CFD95517FAFC97276BA644AD9 /* Build configuration list for PBXNativeTarget "Pods-AcceptSDK" */; 168 | buildPhases = ( 169 | E488F5915B7BE69342E396AACC1E7EB5 /* Sources */, 170 | 4B977A5F8339AFE1592B6ABA542C9DCD /* Frameworks */, 171 | 050DFF10BEACE1DA3DB7726A5BC96895 /* Headers */, 172 | ); 173 | buildRules = ( 174 | ); 175 | dependencies = ( 176 | ); 177 | name = "Pods-AcceptSDK"; 178 | productName = "Pods-AcceptSDK"; 179 | productReference = E50BA07591871632870E75A3465464AB /* Pods_AcceptSDK.framework */; 180 | productType = "com.apple.product-type.framework"; 181 | }; 182 | C8924C2E6E5FDCEAB750C5A035F48C7A /* Pods-AcceptSDKTests */ = { 183 | isa = PBXNativeTarget; 184 | buildConfigurationList = DFFB3886CA8883D6F10B837831885301 /* Build configuration list for PBXNativeTarget "Pods-AcceptSDKTests" */; 185 | buildPhases = ( 186 | 2438F17866980A75982F1267DC5C8D67 /* Sources */, 187 | E1A145956C0CD42164311CA7DE85F7EE /* Frameworks */, 188 | 1FC96788402D2AA94CF69AADA27C3C2F /* Headers */, 189 | ); 190 | buildRules = ( 191 | ); 192 | dependencies = ( 193 | ); 194 | name = "Pods-AcceptSDKTests"; 195 | productName = "Pods-AcceptSDKTests"; 196 | productReference = 573CED3992FDACA161FA31008615EE76 /* Pods_AcceptSDKTests.framework */; 197 | productType = "com.apple.product-type.framework"; 198 | }; 199 | /* End PBXNativeTarget section */ 200 | 201 | /* Begin PBXProject section */ 202 | D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { 203 | isa = PBXProject; 204 | attributes = { 205 | LastSwiftUpdateCheck = 0930; 206 | LastUpgradeCheck = 0930; 207 | }; 208 | buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; 209 | compatibilityVersion = "Xcode 3.2"; 210 | developmentRegion = English; 211 | hasScannedForEncodings = 0; 212 | knownRegions = ( 213 | en, 214 | ); 215 | mainGroup = 7DB346D0F39D3F0E887471402A8071AB; 216 | productRefGroup = FB09CB0354FF5AB96EB895E1D2CB9664 /* Products */; 217 | projectDirPath = ""; 218 | projectRoot = ""; 219 | targets = ( 220 | 42191ABD42A8DD02D98C0311EA0DF40C /* Pods-AcceptSDK */, 221 | C8924C2E6E5FDCEAB750C5A035F48C7A /* Pods-AcceptSDKTests */, 222 | ); 223 | }; 224 | /* End PBXProject section */ 225 | 226 | /* Begin PBXSourcesBuildPhase section */ 227 | 2438F17866980A75982F1267DC5C8D67 /* Sources */ = { 228 | isa = PBXSourcesBuildPhase; 229 | buildActionMask = 2147483647; 230 | files = ( 231 | 9E8D3AD75B9331A2CB283EE8AD0A0A37 /* Pods-AcceptSDKTests-dummy.m in Sources */, 232 | ); 233 | runOnlyForDeploymentPostprocessing = 0; 234 | }; 235 | E488F5915B7BE69342E396AACC1E7EB5 /* Sources */ = { 236 | isa = PBXSourcesBuildPhase; 237 | buildActionMask = 2147483647; 238 | files = ( 239 | 56D235276495EB5B46C273F02E4201BF /* Pods-AcceptSDK-dummy.m in Sources */, 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | }; 243 | /* End PBXSourcesBuildPhase section */ 244 | 245 | /* Begin XCBuildConfiguration section */ 246 | 4221BC3DDE9B0844CF12000F6A2BC0C3 /* Debug */ = { 247 | isa = XCBuildConfiguration; 248 | baseConfigurationReference = 2BF7C2BFBF2052980FD159AE3A3B87AD /* Pods-AcceptSDK.debug.xcconfig */; 249 | buildSettings = { 250 | CODE_SIGN_IDENTITY = ""; 251 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 252 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 253 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 254 | CURRENT_PROJECT_VERSION = 1; 255 | DEFINES_MODULE = YES; 256 | DYLIB_COMPATIBILITY_VERSION = 1; 257 | DYLIB_CURRENT_VERSION = 1; 258 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 259 | INFOPLIST_FILE = "Target Support Files/Pods-AcceptSDK/Info.plist"; 260 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 261 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 262 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 263 | MACH_O_TYPE = staticlib; 264 | MODULEMAP_FILE = "Target Support Files/Pods-AcceptSDK/Pods-AcceptSDK.modulemap"; 265 | OTHER_LDFLAGS = ""; 266 | OTHER_LIBTOOLFLAGS = ""; 267 | PODS_ROOT = "$(SRCROOT)"; 268 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; 269 | PRODUCT_NAME = Pods_AcceptSDK; 270 | SDKROOT = iphoneos; 271 | SKIP_INSTALL = YES; 272 | TARGETED_DEVICE_FAMILY = "1,2"; 273 | VERSIONING_SYSTEM = "apple-generic"; 274 | VERSION_INFO_PREFIX = ""; 275 | }; 276 | name = Debug; 277 | }; 278 | 50A35A7FE15A632364B1DB2EC7800A5C /* Release */ = { 279 | isa = XCBuildConfiguration; 280 | baseConfigurationReference = 796D48BE24CD36A165870495A8C19941 /* Pods-AcceptSDK.release.xcconfig */; 281 | buildSettings = { 282 | CODE_SIGN_IDENTITY = ""; 283 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 284 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 285 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 286 | CURRENT_PROJECT_VERSION = 1; 287 | DEFINES_MODULE = YES; 288 | DYLIB_COMPATIBILITY_VERSION = 1; 289 | DYLIB_CURRENT_VERSION = 1; 290 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 291 | INFOPLIST_FILE = "Target Support Files/Pods-AcceptSDK/Info.plist"; 292 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 293 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 294 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 295 | MACH_O_TYPE = staticlib; 296 | MODULEMAP_FILE = "Target Support Files/Pods-AcceptSDK/Pods-AcceptSDK.modulemap"; 297 | OTHER_LDFLAGS = ""; 298 | OTHER_LIBTOOLFLAGS = ""; 299 | PODS_ROOT = "$(SRCROOT)"; 300 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; 301 | PRODUCT_NAME = Pods_AcceptSDK; 302 | SDKROOT = iphoneos; 303 | SKIP_INSTALL = YES; 304 | TARGETED_DEVICE_FAMILY = "1,2"; 305 | VALIDATE_PRODUCT = YES; 306 | VERSIONING_SYSTEM = "apple-generic"; 307 | VERSION_INFO_PREFIX = ""; 308 | }; 309 | name = Release; 310 | }; 311 | 9A5BD4939DD85F5F91AC0EBCE8B60B15 /* Release */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | ALWAYS_SEARCH_USER_PATHS = NO; 315 | CLANG_ANALYZER_NONNULL = YES; 316 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 317 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 318 | CLANG_CXX_LIBRARY = "libc++"; 319 | CLANG_ENABLE_MODULES = YES; 320 | CLANG_ENABLE_OBJC_ARC = YES; 321 | CLANG_ENABLE_OBJC_WEAK = YES; 322 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 323 | CLANG_WARN_BOOL_CONVERSION = YES; 324 | CLANG_WARN_COMMA = YES; 325 | CLANG_WARN_CONSTANT_CONVERSION = YES; 326 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 327 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 328 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 329 | CLANG_WARN_EMPTY_BODY = YES; 330 | CLANG_WARN_ENUM_CONVERSION = YES; 331 | CLANG_WARN_INFINITE_RECURSION = YES; 332 | CLANG_WARN_INT_CONVERSION = YES; 333 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 334 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 335 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 336 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 337 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 338 | CLANG_WARN_STRICT_PROTOTYPES = YES; 339 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 340 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 341 | CLANG_WARN_UNREACHABLE_CODE = YES; 342 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 343 | CODE_SIGNING_REQUIRED = NO; 344 | COPY_PHASE_STRIP = NO; 345 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 346 | ENABLE_NS_ASSERTIONS = NO; 347 | ENABLE_STRICT_OBJC_MSGSEND = YES; 348 | GCC_C_LANGUAGE_STANDARD = gnu11; 349 | GCC_NO_COMMON_BLOCKS = YES; 350 | GCC_PREPROCESSOR_DEFINITIONS = ( 351 | "POD_CONFIGURATION_RELEASE=1", 352 | "$(inherited)", 353 | ); 354 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 355 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 356 | GCC_WARN_UNDECLARED_SELECTOR = YES; 357 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 358 | GCC_WARN_UNUSED_FUNCTION = YES; 359 | GCC_WARN_UNUSED_VARIABLE = YES; 360 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 361 | MTL_ENABLE_DEBUG_INFO = NO; 362 | PRODUCT_NAME = "$(TARGET_NAME)"; 363 | PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; 364 | STRIP_INSTALLED_PRODUCT = NO; 365 | SYMROOT = "${SRCROOT}/../build"; 366 | }; 367 | name = Release; 368 | }; 369 | B72FD420C7B5C95C6BA608082975F9D5 /* Release */ = { 370 | isa = XCBuildConfiguration; 371 | baseConfigurationReference = 725A9836D885D5184F8FF4876273E8CA /* Pods-AcceptSDKTests.release.xcconfig */; 372 | buildSettings = { 373 | CODE_SIGN_IDENTITY = ""; 374 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 375 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 376 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 377 | CURRENT_PROJECT_VERSION = 1; 378 | DEFINES_MODULE = YES; 379 | DYLIB_COMPATIBILITY_VERSION = 1; 380 | DYLIB_CURRENT_VERSION = 1; 381 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 382 | INFOPLIST_FILE = "Target Support Files/Pods-AcceptSDKTests/Info.plist"; 383 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 384 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 385 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 386 | MACH_O_TYPE = staticlib; 387 | MODULEMAP_FILE = "Target Support Files/Pods-AcceptSDKTests/Pods-AcceptSDKTests.modulemap"; 388 | OTHER_LDFLAGS = ""; 389 | OTHER_LIBTOOLFLAGS = ""; 390 | PODS_ROOT = "$(SRCROOT)"; 391 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; 392 | PRODUCT_NAME = Pods_AcceptSDKTests; 393 | SDKROOT = iphoneos; 394 | SKIP_INSTALL = YES; 395 | TARGETED_DEVICE_FAMILY = "1,2"; 396 | VALIDATE_PRODUCT = YES; 397 | VERSIONING_SYSTEM = "apple-generic"; 398 | VERSION_INFO_PREFIX = ""; 399 | }; 400 | name = Release; 401 | }; 402 | BBDB5851EF5A971296C7D1AEC3DCA2A9 /* Debug */ = { 403 | isa = XCBuildConfiguration; 404 | baseConfigurationReference = 764570BA5D97DCB5B3931CB5E416F389 /* Pods-AcceptSDKTests.debug.xcconfig */; 405 | buildSettings = { 406 | CODE_SIGN_IDENTITY = ""; 407 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 408 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 409 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 410 | CURRENT_PROJECT_VERSION = 1; 411 | DEFINES_MODULE = YES; 412 | DYLIB_COMPATIBILITY_VERSION = 1; 413 | DYLIB_CURRENT_VERSION = 1; 414 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 415 | INFOPLIST_FILE = "Target Support Files/Pods-AcceptSDKTests/Info.plist"; 416 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 417 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 418 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 419 | MACH_O_TYPE = staticlib; 420 | MODULEMAP_FILE = "Target Support Files/Pods-AcceptSDKTests/Pods-AcceptSDKTests.modulemap"; 421 | OTHER_LDFLAGS = ""; 422 | OTHER_LIBTOOLFLAGS = ""; 423 | PODS_ROOT = "$(SRCROOT)"; 424 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; 425 | PRODUCT_NAME = Pods_AcceptSDKTests; 426 | SDKROOT = iphoneos; 427 | SKIP_INSTALL = YES; 428 | TARGETED_DEVICE_FAMILY = "1,2"; 429 | VERSIONING_SYSTEM = "apple-generic"; 430 | VERSION_INFO_PREFIX = ""; 431 | }; 432 | name = Debug; 433 | }; 434 | DEBBCB8E1712128CF4CC93D672203A44 /* Debug */ = { 435 | isa = XCBuildConfiguration; 436 | buildSettings = { 437 | ALWAYS_SEARCH_USER_PATHS = NO; 438 | CLANG_ANALYZER_NONNULL = YES; 439 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 440 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 441 | CLANG_CXX_LIBRARY = "libc++"; 442 | CLANG_ENABLE_MODULES = YES; 443 | CLANG_ENABLE_OBJC_ARC = YES; 444 | CLANG_ENABLE_OBJC_WEAK = YES; 445 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 446 | CLANG_WARN_BOOL_CONVERSION = YES; 447 | CLANG_WARN_COMMA = YES; 448 | CLANG_WARN_CONSTANT_CONVERSION = YES; 449 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 450 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 451 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 452 | CLANG_WARN_EMPTY_BODY = YES; 453 | CLANG_WARN_ENUM_CONVERSION = YES; 454 | CLANG_WARN_INFINITE_RECURSION = YES; 455 | CLANG_WARN_INT_CONVERSION = YES; 456 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 457 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 458 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 459 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 460 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 461 | CLANG_WARN_STRICT_PROTOTYPES = YES; 462 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 463 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 464 | CLANG_WARN_UNREACHABLE_CODE = YES; 465 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 466 | CODE_SIGNING_REQUIRED = NO; 467 | COPY_PHASE_STRIP = NO; 468 | DEBUG_INFORMATION_FORMAT = dwarf; 469 | ENABLE_STRICT_OBJC_MSGSEND = YES; 470 | ENABLE_TESTABILITY = YES; 471 | GCC_C_LANGUAGE_STANDARD = gnu11; 472 | GCC_DYNAMIC_NO_PIC = NO; 473 | GCC_NO_COMMON_BLOCKS = YES; 474 | GCC_OPTIMIZATION_LEVEL = 0; 475 | GCC_PREPROCESSOR_DEFINITIONS = ( 476 | "POD_CONFIGURATION_DEBUG=1", 477 | "DEBUG=1", 478 | "$(inherited)", 479 | ); 480 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 481 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 482 | GCC_WARN_UNDECLARED_SELECTOR = YES; 483 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 484 | GCC_WARN_UNUSED_FUNCTION = YES; 485 | GCC_WARN_UNUSED_VARIABLE = YES; 486 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 487 | MTL_ENABLE_DEBUG_INFO = YES; 488 | ONLY_ACTIVE_ARCH = YES; 489 | PRODUCT_NAME = "$(TARGET_NAME)"; 490 | PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; 491 | STRIP_INSTALLED_PRODUCT = NO; 492 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 493 | SYMROOT = "${SRCROOT}/../build"; 494 | }; 495 | name = Debug; 496 | }; 497 | /* End XCBuildConfiguration section */ 498 | 499 | /* Begin XCConfigurationList section */ 500 | 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { 501 | isa = XCConfigurationList; 502 | buildConfigurations = ( 503 | DEBBCB8E1712128CF4CC93D672203A44 /* Debug */, 504 | 9A5BD4939DD85F5F91AC0EBCE8B60B15 /* Release */, 505 | ); 506 | defaultConfigurationIsVisible = 0; 507 | defaultConfigurationName = Release; 508 | }; 509 | DFFB3886CA8883D6F10B837831885301 /* Build configuration list for PBXNativeTarget "Pods-AcceptSDKTests" */ = { 510 | isa = XCConfigurationList; 511 | buildConfigurations = ( 512 | BBDB5851EF5A971296C7D1AEC3DCA2A9 /* Debug */, 513 | B72FD420C7B5C95C6BA608082975F9D5 /* Release */, 514 | ); 515 | defaultConfigurationIsVisible = 0; 516 | defaultConfigurationName = Release; 517 | }; 518 | F5567B5CFD95517FAFC97276BA644AD9 /* Build configuration list for PBXNativeTarget "Pods-AcceptSDK" */ = { 519 | isa = XCConfigurationList; 520 | buildConfigurations = ( 521 | 4221BC3DDE9B0844CF12000F6A2BC0C3 /* Debug */, 522 | 50A35A7FE15A632364B1DB2EC7800A5C /* Release */, 523 | ); 524 | defaultConfigurationIsVisible = 0; 525 | defaultConfigurationName = Release; 526 | }; 527 | /* End XCConfigurationList section */ 528 | }; 529 | rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; 530 | } 531 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDK/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-AcceptSDK/Pods-AcceptSDK-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | Generated by CocoaPods - https://cocoapods.org 4 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDK/Pods-AcceptSDK-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 | Generated by CocoaPods - https://cocoapods.org 18 | Title 19 | 20 | Type 21 | PSGroupSpecifier 22 | 23 | 24 | StringsTable 25 | Acknowledgements 26 | Title 27 | Acknowledgements 28 | 29 | 30 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDK/Pods-AcceptSDK-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_AcceptSDK : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_AcceptSDK 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDK/Pods-AcceptSDK-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 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 12 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 13 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 14 | 15 | case "${TARGETED_DEVICE_FAMILY}" in 16 | 1,2) 17 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 18 | ;; 19 | 1) 20 | TARGET_DEVICE_ARGS="--target-device iphone" 21 | ;; 22 | 2) 23 | TARGET_DEVICE_ARGS="--target-device ipad" 24 | ;; 25 | 3) 26 | TARGET_DEVICE_ARGS="--target-device tv" 27 | ;; 28 | 4) 29 | TARGET_DEVICE_ARGS="--target-device watch" 30 | ;; 31 | *) 32 | TARGET_DEVICE_ARGS="--target-device mac" 33 | ;; 34 | esac 35 | 36 | install_resource() 37 | { 38 | if [[ "$1" = /* ]] ; then 39 | RESOURCE_PATH="$1" 40 | else 41 | RESOURCE_PATH="${PODS_ROOT}/$1" 42 | fi 43 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 44 | cat << EOM 45 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 46 | EOM 47 | exit 1 48 | fi 49 | case $RESOURCE_PATH in 50 | *.storyboard) 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\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 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\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 53 | ;; 54 | *.xib) 55 | 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}" || true 56 | 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} 57 | ;; 58 | *.framework) 59 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 60 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 61 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 62 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 63 | ;; 64 | *.xcdatamodel) 65 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 66 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 67 | ;; 68 | *.xcdatamodeld) 69 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 70 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 71 | ;; 72 | *.xcmappingmodel) 73 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 74 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 75 | ;; 76 | *.xcassets) 77 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 78 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 79 | ;; 80 | *) 81 | echo "$RESOURCE_PATH" || true 82 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 83 | ;; 84 | esac 85 | } 86 | 87 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 88 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 89 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 90 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 91 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 92 | fi 93 | rm -f "$RESOURCES_TO_COPY" 94 | 95 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 96 | then 97 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 98 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 99 | while read line; do 100 | if [[ $line != "${PODS_ROOT}*" ]]; then 101 | XCASSET_FILES+=("$line") 102 | fi 103 | done <<<"$OTHER_XCASSETS" 104 | 105 | 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}" 106 | fi 107 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDK/Pods-AcceptSDK-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_AcceptSDKVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_AcceptSDKVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDK/Pods-AcceptSDK.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' '@executable_path/../../Frameworks' 3 | PODS_BUILD_DIR = ${BUILD_DIR} 4 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 5 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 6 | PODS_ROOT = ${SRCROOT}/Pods 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDK/Pods-AcceptSDK.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_AcceptSDK { 2 | umbrella header "Pods-AcceptSDK-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDK/Pods-AcceptSDK.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' '@executable_path/../../Frameworks' 3 | PODS_BUILD_DIR = ${BUILD_DIR} 4 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 5 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 6 | PODS_ROOT = ${SRCROOT}/Pods 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKTests/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-AcceptSDKTests/Pods-AcceptSDKTests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | Generated by CocoaPods - https://cocoapods.org 4 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKTests/Pods-AcceptSDKTests-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 | Generated by CocoaPods - https://cocoapods.org 18 | Title 19 | 20 | Type 21 | PSGroupSpecifier 22 | 23 | 24 | StringsTable 25 | Acknowledgements 26 | Title 27 | Acknowledgements 28 | 29 | 30 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKTests/Pods-AcceptSDKTests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_AcceptSDKTests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_AcceptSDKTests 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKTests/Pods-AcceptSDKTests-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | # Used as a return value for each invocation of `strip_invalid_archs` function. 10 | STRIP_BINARY_RETVAL=0 11 | 12 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 13 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 14 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 15 | 16 | # Copies and strips a vendored framework 17 | install_framework() 18 | { 19 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 20 | local source="${BUILT_PRODUCTS_DIR}/$1" 21 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 22 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 23 | elif [ -r "$1" ]; then 24 | local source="$1" 25 | fi 26 | 27 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 28 | 29 | if [ -L "${source}" ]; then 30 | echo "Symlinked..." 31 | source="$(readlink "${source}")" 32 | fi 33 | 34 | # Use filter instead of exclude so missing patterns don't throw errors. 35 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 36 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 37 | 38 | local basename 39 | basename="$(basename -s .framework "$1")" 40 | binary="${destination}/${basename}.framework/${basename}" 41 | if ! [ -r "$binary" ]; then 42 | binary="${destination}/${basename}" 43 | fi 44 | 45 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 46 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 47 | strip_invalid_archs "$binary" 48 | fi 49 | 50 | # Resign the code if required by the build settings to avoid unstable apps 51 | code_sign_if_enabled "${destination}/$(basename "$1")" 52 | 53 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 54 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 55 | local swift_runtime_libs 56 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 57 | for lib in $swift_runtime_libs; do 58 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 59 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 60 | code_sign_if_enabled "${destination}/${lib}" 61 | done 62 | fi 63 | } 64 | 65 | # Copies and strips a vendored dSYM 66 | install_dsym() { 67 | local source="$1" 68 | if [ -r "$source" ]; then 69 | # Copy the dSYM into a the targets temp dir. 70 | 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}\"" 71 | 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}" 72 | 73 | local basename 74 | basename="$(basename -s .framework.dSYM "$source")" 75 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 76 | 77 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 78 | if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then 79 | strip_invalid_archs "$binary" 80 | fi 81 | 82 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 83 | # Move the stripped file into its final destination. 84 | 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}\"" 85 | 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}" 86 | else 87 | # 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. 88 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 89 | fi 90 | fi 91 | } 92 | 93 | # Signs a framework with the provided identity 94 | code_sign_if_enabled() { 95 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 96 | # Use the current code_sign_identitiy 97 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 98 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" 99 | 100 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 101 | code_sign_cmd="$code_sign_cmd &" 102 | fi 103 | echo "$code_sign_cmd" 104 | eval "$code_sign_cmd" 105 | fi 106 | } 107 | 108 | # Strip invalid architectures 109 | strip_invalid_archs() { 110 | binary="$1" 111 | # Get architectures for current target binary 112 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 113 | # Intersect them with the architectures we are building for 114 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 115 | # If there are no archs supported by this binary then warn the user 116 | if [[ -z "$intersected_archs" ]]; then 117 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 118 | STRIP_BINARY_RETVAL=0 119 | return 120 | fi 121 | stripped="" 122 | for arch in $binary_archs; do 123 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 124 | # Strip non-valid architectures in-place 125 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 126 | stripped="$stripped $arch" 127 | fi 128 | done 129 | if [[ "$stripped" ]]; then 130 | echo "Stripped $binary of architectures:$stripped" 131 | fi 132 | STRIP_BINARY_RETVAL=1 133 | } 134 | 135 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 136 | wait 137 | fi 138 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKTests/Pods-AcceptSDKTests-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 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 12 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 13 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 14 | 15 | case "${TARGETED_DEVICE_FAMILY}" in 16 | 1,2) 17 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 18 | ;; 19 | 1) 20 | TARGET_DEVICE_ARGS="--target-device iphone" 21 | ;; 22 | 2) 23 | TARGET_DEVICE_ARGS="--target-device ipad" 24 | ;; 25 | 3) 26 | TARGET_DEVICE_ARGS="--target-device tv" 27 | ;; 28 | 4) 29 | TARGET_DEVICE_ARGS="--target-device watch" 30 | ;; 31 | *) 32 | TARGET_DEVICE_ARGS="--target-device mac" 33 | ;; 34 | esac 35 | 36 | install_resource() 37 | { 38 | if [[ "$1" = /* ]] ; then 39 | RESOURCE_PATH="$1" 40 | else 41 | RESOURCE_PATH="${PODS_ROOT}/$1" 42 | fi 43 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 44 | cat << EOM 45 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 46 | EOM 47 | exit 1 48 | fi 49 | case $RESOURCE_PATH in 50 | *.storyboard) 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\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 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\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 53 | ;; 54 | *.xib) 55 | 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}" || true 56 | 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} 57 | ;; 58 | *.framework) 59 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 60 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 61 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 62 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 63 | ;; 64 | *.xcdatamodel) 65 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 66 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 67 | ;; 68 | *.xcdatamodeld) 69 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 70 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 71 | ;; 72 | *.xcmappingmodel) 73 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 74 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 75 | ;; 76 | *.xcassets) 77 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 78 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 79 | ;; 80 | *) 81 | echo "$RESOURCE_PATH" || true 82 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 83 | ;; 84 | esac 85 | } 86 | 87 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 88 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 89 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 90 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 91 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 92 | fi 93 | rm -f "$RESOURCES_TO_COPY" 94 | 95 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 96 | then 97 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 98 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 99 | while read line; do 100 | if [[ $line != "${PODS_ROOT}*" ]]; then 101 | XCASSET_FILES+=("$line") 102 | fi 103 | done <<<"$OTHER_XCASSETS" 104 | 105 | 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}" 106 | fi 107 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKTests/Pods-AcceptSDKTests-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_AcceptSDKTestsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_AcceptSDKTestsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKTests/Pods-AcceptSDKTests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 3 | PODS_BUILD_DIR = ${BUILD_DIR} 4 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 5 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 6 | PODS_ROOT = ${SRCROOT}/Pods 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKTests/Pods-AcceptSDKTests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_AcceptSDKTests { 2 | umbrella header "Pods-AcceptSDKTests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-AcceptSDKTests/Pods-AcceptSDKTests.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 3 | PODS_BUILD_DIR = ${BUILD_DIR} 4 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 5 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 6 | PODS_ROOT = ${SRCROOT}/Pods 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /createUniversalArchive.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | abort() { 6 | echo "[fatal] $1" 7 | exit 1 8 | } 9 | 10 | test -n "${PROJECT_NAME}" || abort "This script should not be run from the command line, but is used by Xcode" 11 | 12 | ###################### 13 | # Options 14 | ###################### 15 | 16 | REVEAL_ARCHIVE_IN_FINDER=true 17 | 18 | FRAMEWORK_NAME="${PROJECT_NAME}" 19 | 20 | SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${FRAMEWORK_NAME}.framework" 21 | 22 | DEVICE_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphoneos/${FRAMEWORK_NAME}.framework" 23 | 24 | UNIVERSAL_LIBRARY_DIR="${BUILD_DIR}/${CONFIGURATION}-iphoneuniversal" 25 | 26 | FRAMEWORK="${UNIVERSAL_LIBRARY_DIR}/${FRAMEWORK_NAME}.framework" 27 | 28 | 29 | ###################### 30 | # Build Frameworks 31 | ###################### 32 | 33 | xcodebuild -workspace "${FRAMEWORK_NAME}.xcworkspace" -scheme "${FRAMEWORK_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" || exit 1 34 | xcodebuild -workspace "${FRAMEWORK_NAME}.xcworkspace" -scheme "${FRAMEWORK_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" || exit 1 35 | 36 | 37 | ###################### 38 | # Create directory for universal 39 | ###################### 40 | 41 | rm -rf "${UNIVERSAL_LIBRARY_DIR}" 42 | 43 | mkdir "${UNIVERSAL_LIBRARY_DIR}" 44 | 45 | mkdir "${FRAMEWORK}" 46 | 47 | 48 | ###################### 49 | # Copy files Framework 50 | ###################### 51 | 52 | cp -r "${DEVICE_LIBRARY_PATH}/." "${FRAMEWORK}" 53 | 54 | 55 | ###################### 56 | # Make an universal binary 57 | ###################### 58 | 59 | set -o pipefail 60 | lipo "${SIMULATOR_LIBRARY_PATH}/${FRAMEWORK_NAME}" "${DEVICE_LIBRARY_PATH}/${FRAMEWORK_NAME}" -create -output "${FRAMEWORK}/${FRAMEWORK_NAME}" | echo || exit 1 61 | 62 | ## For Swift framework, Swiftmodule needs to be copied in the universal framework 63 | #if [ -d "${SIMULATOR_LIBRARY_PATH}/Modules/${FRAMEWORK_NAME}.swiftmodule/" ]; then 64 | #cp -f ${SIMULATOR_LIBRARY_PATH}/Modules/${FRAMEWORK_NAME}.swiftmodule/* "${FRAMEWORK}/Modules/${FRAMEWORK_NAME}.swiftmodule/" | echo 65 | #fi 66 | # 67 | #if [ -d "${DEVICE_LIBRARY_PATH}/Modules/${FRAMEWORK_NAME}.swiftmodule/" ]; then 68 | #cp -f ${DEVICE_LIBRARY_PATH}/Modules/${FRAMEWORK_NAME}.swiftmodule/* "${FRAMEWORK}/Modules/${FRAMEWORK_NAME}.swiftmodule/" | echo 69 | #fi 70 | 71 | if [ -n "${WORKSPACE}" ]; then 72 | cp -r "${FRAMEWORK}" "${WORKSPACE}" 73 | elif [ ${REVEAL_ARCHIVE_IN_FINDER} = true ]; then 74 | open "${UNIVERSAL_LIBRARY_DIR}/" 75 | fi 76 | --------------------------------------------------------------------------------