diff --git a/Example/Podfile b/Example/Podfile index d00d046..518c7dd 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -1,10 +1,16 @@ source 'https://github.com/CocoaPods/Specs.git' use_frameworks! +workspace 'eWAYPaymentsSDK.xcworkspace' +xcodeproj 'eWAYPaymentsSDK.xcodeproj' +xcodeproj 'eWAYPaymentsSDK+ApplePay.xcodeproj' + target 'eWAYPaymentsSDK_Example', :exclusive => true do pod "eWAYPaymentsSDK", :path => "../" + xcodeproj 'eWAYPaymentsSDK.xcodeproj' end + target 'eWAYPaymentsSDK_Tests', :exclusive => true do pod "eWAYPaymentsSDK", :path => "../" @@ -12,4 +18,10 @@ target 'eWAYPaymentsSDK_Tests', :exclusive => true do pod 'Expecta' pod 'FBSnapshotTestCase' pod 'Expecta+Snapshots' + xcodeproj 'eWAYPaymentsSDK.xcodeproj' end + +target 'eWAYPaymentsSDK_ApplePay_Example', :exclusive => true do + pod "eWAYPaymentsSDK", :path => "../" + xcodeproj 'eWAYPaymentsSDK+ApplePay.xcodeproj' +end \ No newline at end of file diff --git a/Example/eWAYPaymentsSDK+ApplePay.xcodeproj/project.pbxproj b/Example/eWAYPaymentsSDK+ApplePay.xcodeproj/project.pbxproj new file mode 100644 index 0000000..c16362c --- /dev/null +++ b/Example/eWAYPaymentsSDK+ApplePay.xcodeproj/project.pbxproj @@ -0,0 +1,415 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + E24310C11B6B13DE00B6020B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E24310C01B6B13DE00B6020B /* main.m */; }; + E24310C41B6B13DE00B6020B /* ApplePayDemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E24310C31B6B13DE00B6020B /* ApplePayDemoAppDelegate.m */; }; + E24310CA1B6B13DE00B6020B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E24310C81B6B13DE00B6020B /* Main.storyboard */; }; + E24310CC1B6B13DE00B6020B /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E24310CB1B6B13DE00B6020B /* Images.xcassets */; }; + E24310CF1B6B13DE00B6020B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = E24310CD1B6B13DE00B6020B /* LaunchScreen.xib */; }; + E281F1F41C067B0100AEAF92 /* Pods_eWAYPaymentsSDK_ApplePay_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E281F1F31C067B0100AEAF92 /* Pods_eWAYPaymentsSDK_ApplePay_Example.framework */; }; + E2E1EA0D1BF9996D00939998 /* APSimpleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E2E1EA0C1BF9996D00939998 /* APSimpleViewController.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + D7190F7FC23BC9C63331D93F /* Pods-eWAYPaymentsSDK_ApplePay_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-eWAYPaymentsSDK_ApplePay_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-eWAYPaymentsSDK_ApplePay_Example/Pods-eWAYPaymentsSDK_ApplePay_Example.release.xcconfig"; sourceTree = ""; }; + E24310BB1B6B13DE00B6020B /* eWAYPaymentsSDK_ApplePay_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = eWAYPaymentsSDK_ApplePay_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + E24310BF1B6B13DE00B6020B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E24310C01B6B13DE00B6020B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + E24310C21B6B13DE00B6020B /* ApplePayDemoAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApplePayDemoAppDelegate.h; sourceTree = ""; }; + E24310C31B6B13DE00B6020B /* ApplePayDemoAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ApplePayDemoAppDelegate.m; sourceTree = ""; }; + E24310C91B6B13DE00B6020B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + E24310CB1B6B13DE00B6020B /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + E24310CE1B6B13DE00B6020B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; + E24310E41B6B1A8200B6020B /* eWAYPaymentsSDK+ApplePay.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = "eWAYPaymentsSDK+ApplePay.entitlements"; path = "eWAYPaymentsSDK+ApplePay/eWAYPaymentsSDK+ApplePay.entitlements"; sourceTree = ""; }; + E281F1F31C067B0100AEAF92 /* Pods_eWAYPaymentsSDK_ApplePay_Example.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Pods_eWAYPaymentsSDK_ApplePay_Example.framework; path = "Pods/../build/Debug-iphoneos/Pods_eWAYPaymentsSDK_ApplePay_Example.framework"; sourceTree = ""; }; + E2E1EA0B1BF9996D00939998 /* APSimpleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APSimpleViewController.h; sourceTree = ""; }; + E2E1EA0C1BF9996D00939998 /* APSimpleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APSimpleViewController.m; sourceTree = ""; }; + F674FA9D1DB682FC98637D96 /* Pods-eWAYPaymentsSDK_ApplePay_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-eWAYPaymentsSDK_ApplePay_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-eWAYPaymentsSDK_ApplePay_Example/Pods-eWAYPaymentsSDK_ApplePay_Example.debug.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + E24310B81B6B13DE00B6020B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + E281F1F41C067B0100AEAF92 /* Pods_eWAYPaymentsSDK_ApplePay_Example.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 3AE2D3F8813E459200741B55 /* Frameworks */ = { + isa = PBXGroup; + children = ( + E281F1F31C067B0100AEAF92 /* Pods_eWAYPaymentsSDK_ApplePay_Example.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 4B3B4C9BE1AF5355B3065070 /* Pods */ = { + isa = PBXGroup; + children = ( + F674FA9D1DB682FC98637D96 /* Pods-eWAYPaymentsSDK_ApplePay_Example.debug.xcconfig */, + D7190F7FC23BC9C63331D93F /* Pods-eWAYPaymentsSDK_ApplePay_Example.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + E24310B21B6B13DE00B6020B = { + isa = PBXGroup; + children = ( + E24310E41B6B1A8200B6020B /* eWAYPaymentsSDK+ApplePay.entitlements */, + E24310BD1B6B13DE00B6020B /* Example for eWAYPaymentsSDK+ApplePay */, + E24310BC1B6B13DE00B6020B /* Products */, + 4B3B4C9BE1AF5355B3065070 /* Pods */, + 3AE2D3F8813E459200741B55 /* Frameworks */, + ); + sourceTree = ""; + }; + E24310BC1B6B13DE00B6020B /* Products */ = { + isa = PBXGroup; + children = ( + E24310BB1B6B13DE00B6020B /* eWAYPaymentsSDK_ApplePay_Example.app */, + ); + name = Products; + sourceTree = ""; + }; + E24310BD1B6B13DE00B6020B /* Example for eWAYPaymentsSDK+ApplePay */ = { + isa = PBXGroup; + children = ( + E24310C21B6B13DE00B6020B /* ApplePayDemoAppDelegate.h */, + E24310C31B6B13DE00B6020B /* ApplePayDemoAppDelegate.m */, + E2E1EA0B1BF9996D00939998 /* APSimpleViewController.h */, + E2E1EA0C1BF9996D00939998 /* APSimpleViewController.m */, + E24310C81B6B13DE00B6020B /* Main.storyboard */, + E24310CB1B6B13DE00B6020B /* Images.xcassets */, + E24310CD1B6B13DE00B6020B /* LaunchScreen.xib */, + E24310BE1B6B13DE00B6020B /* Supporting Files */, + ); + name = "Example for eWAYPaymentsSDK+ApplePay"; + path = "eWAYPaymentsSDK+ApplePay"; + sourceTree = ""; + }; + E24310BE1B6B13DE00B6020B /* Supporting Files */ = { + isa = PBXGroup; + children = ( + E24310BF1B6B13DE00B6020B /* Info.plist */, + E24310C01B6B13DE00B6020B /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + E24310BA1B6B13DE00B6020B /* eWAYPaymentsSDK_ApplePay_Example */ = { + isa = PBXNativeTarget; + buildConfigurationList = E24310DE1B6B13DE00B6020B /* Build configuration list for PBXNativeTarget "eWAYPaymentsSDK_ApplePay_Example" */; + buildPhases = ( + 180F7F927CDDAAA4CAC4ACBB /* Check Pods Manifest.lock */, + E24310B71B6B13DE00B6020B /* Sources */, + E24310B81B6B13DE00B6020B /* Frameworks */, + E24310B91B6B13DE00B6020B /* Resources */, + 01E190E006A7C20A4457ACE7 /* Embed Pods Frameworks */, + 3336746D1A8C679798139D1A /* Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = eWAYPaymentsSDK_ApplePay_Example; + productName = "eWAYPaymentsSDK+ApplePay"; + productReference = E24310BB1B6B13DE00B6020B /* eWAYPaymentsSDK_ApplePay_Example.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + E24310B31B6B13DE00B6020B /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0640; + ORGANIZATIONNAME = eWAY; + TargetAttributes = { + E24310BA1B6B13DE00B6020B = { + CreatedOnToolsVersion = 6.3.2; + SystemCapabilities = { + com.apple.OMC = { + enabled = 1; + }; + }; + }; + }; + }; + buildConfigurationList = E24310B61B6B13DE00B6020B /* Build configuration list for PBXProject "eWAYPaymentsSDK+ApplePay" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = E24310B21B6B13DE00B6020B; + productRefGroup = E24310BC1B6B13DE00B6020B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + E24310BA1B6B13DE00B6020B /* eWAYPaymentsSDK_ApplePay_Example */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + E24310B91B6B13DE00B6020B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E24310CA1B6B13DE00B6020B /* Main.storyboard in Resources */, + E24310CF1B6B13DE00B6020B /* LaunchScreen.xib in Resources */, + E24310CC1B6B13DE00B6020B /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 01E190E006A7C20A4457ACE7 /* Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-eWAYPaymentsSDK_ApplePay_Example/Pods-eWAYPaymentsSDK_ApplePay_Example-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 180F7F927CDDAAA4CAC4ACBB /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + 3336746D1A8C679798139D1A /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-eWAYPaymentsSDK_ApplePay_Example/Pods-eWAYPaymentsSDK_ApplePay_Example-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + E24310B71B6B13DE00B6020B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E24310C41B6B13DE00B6020B /* ApplePayDemoAppDelegate.m in Sources */, + E24310C11B6B13DE00B6020B /* main.m in Sources */, + E2E1EA0D1BF9996D00939998 /* APSimpleViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + E24310C81B6B13DE00B6020B /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + E24310C91B6B13DE00B6020B /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + E24310CD1B6B13DE00B6020B /* LaunchScreen.xib */ = { + isa = PBXVariantGroup; + children = ( + E24310CE1B6B13DE00B6020B /* Base */, + ); + name = LaunchScreen.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + E24310DC1B6B13DE00B6020B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + E24310DD1B6B13DE00B6020B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + E24310DF1B6B13DE00B6020B /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F674FA9D1DB682FC98637D96 /* Pods-eWAYPaymentsSDK_ApplePay_Example.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = "eWAYPaymentsSDK+ApplePay/eWAYPaymentsSDK+ApplePay.entitlements"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/build/Debug-iphoneos", + ); + INFOPLIST_FILE = "eWAYPaymentsSDK+ApplePay/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.eWAYPaymentsSDK-ApplePay-Example"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Debug; + }; + E24310E01B6B13DE00B6020B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D7190F7FC23BC9C63331D93F /* Pods-eWAYPaymentsSDK_ApplePay_Example.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = "eWAYPaymentsSDK+ApplePay/eWAYPaymentsSDK+ApplePay.entitlements"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/build/Debug-iphoneos", + ); + INFOPLIST_FILE = "eWAYPaymentsSDK+ApplePay/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.eWAYPaymentsSDK-ApplePay-Example"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + E24310B61B6B13DE00B6020B /* Build configuration list for PBXProject "eWAYPaymentsSDK+ApplePay" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E24310DC1B6B13DE00B6020B /* Debug */, + E24310DD1B6B13DE00B6020B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E24310DE1B6B13DE00B6020B /* Build configuration list for PBXNativeTarget "eWAYPaymentsSDK_ApplePay_Example" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E24310DF1B6B13DE00B6020B /* Debug */, + E24310E01B6B13DE00B6020B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = E24310B31B6B13DE00B6020B /* Project object */; +} diff --git a/Example/eWAYPaymentsSDK+ApplePay/APSimpleViewController.h b/Example/eWAYPaymentsSDK+ApplePay/APSimpleViewController.h new file mode 100644 index 0000000..34355aa --- /dev/null +++ b/Example/eWAYPaymentsSDK+ApplePay/APSimpleViewController.h @@ -0,0 +1,14 @@ +// +// APSimpleViewController.h +// eWAYPaymentsSDK+ApplePay +// +// Created by lok on 16/11/2015. +// Copyright © 2015 eWAY. All rights reserved. +// + +#import + +@interface APSimpleViewController : UIViewController + +- (IBAction)Pay:(id)sender; +@end diff --git a/Example/eWAYPaymentsSDK+ApplePay/APSimpleViewController.m b/Example/eWAYPaymentsSDK+ApplePay/APSimpleViewController.m new file mode 100644 index 0000000..7e0932d --- /dev/null +++ b/Example/eWAYPaymentsSDK+ApplePay/APSimpleViewController.m @@ -0,0 +1,180 @@ +// +// APSimpleViewController.m +// eWAYPaymentsSDK+ApplePay +// +// Created by lok on 16/11/2015. +// Copyright © 2015 eWAY. All rights reserved. +// + +#import "APSimpleViewController.h" +#import "RapidAPI+ApplePay.h" + +@interface APSimpleViewController () +{ + NSString *merchantIdentifier; + NSString *countryCode; + NSArray *supportedNetworks; + PKMerchantCapability merchantCapabilities; + NSArray *paymentSummaryItems; + NSString *currencyCode; + PKAddressField requiredBillingAddressFields; + PKAddressField requiredShippingAddressFields; + NSArray *shippingMethods; + NSString *transactionID; + IBOutlet UITextField *tfTransactionID; + NSString *token; + IBOutlet UITextField *tfToken; + IBOutlet UILabel *lbResult; + TransactionType transactionType; + Method method; +} + +@end + +@implementation APSimpleViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + // Set this to your Apple Pay Merchant ID from Developer account + merchantIdentifier = @"You Merchant ID from Developer account"; + + countryCode = @"AU"; + + //Indicate which payment networks you support by populating the supportedNetworks property with an array of string constants. + supportedNetworks = @[PKPaymentNetworkAmex, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa]; + + //Indicate which payment processing protocols you support by setting a value for the merchantCapabilities property + merchantCapabilities = PKMerchantCapability3DS; + + //Create an instance of PKShippingMethod for each available shipping method + PKShippingMethod *standard = + [PKShippingMethod summaryItemWithLabel:@"Standard Shipping" amount:[NSDecimalNumber decimalNumberWithString:@"0.05"]]; + standard.detail = @"5 Business Days"; + standard.identifier = @"standard"; + PKShippingMethod *express = + [PKShippingMethod summaryItemWithLabel:@"Express Shipping" amount:[NSDecimalNumber decimalNumberWithString:@"0.10"]]; + express.detail = @"Next Day"; + express.identifier = @"next-day"; + + shippingMethods = @[standard, express]; + + //Payment summary items, represented by the PKPaymentSummaryItem class, describe the different parts of the payment request to the user. + PKPaymentSummaryItem *firstItem = [PKPaymentSummaryItem summaryItemWithLabel:@"iPad" amount:[NSDecimalNumber decimalNumberWithString:@"3.00"]]; + PKPaymentSummaryItem *secondItem = [PKPaymentSummaryItem summaryItemWithLabel:@"iWatch" amount:[NSDecimalNumber decimalNumberWithString:@"1.00"]]; + PKPaymentSummaryItem *shippingItem = [PKPaymentSummaryItem summaryItemWithLabel:standard.identifier amount:standard.amount]; + + //The last payment summary item in the list is the grand total. Calculate the grand total amount by adding the amounts of all the other summary items. + NSDecimalNumber *total = [firstItem.amount decimalNumberByAdding:[secondItem.amount decimalNumberByAdding:shippingItem.amount]]; + PKPaymentSummaryItem *totalItem = [PKPaymentSummaryItem summaryItemWithLabel:@"Your Company Name" amount:total]; + + paymentSummaryItems = @[firstItem, secondItem, shippingItem,totalItem]; + + currencyCode = @"AUD"; + + //Populate the requiredBillingAddressFields and requiredShippingAddressFields properties of the payment authorization view controller to indicate what billing and shipping information is needed + requiredBillingAddressFields = PKAddressFieldPostalAddress | PKAddressFieldName; + requiredShippingAddressFields = PKAddressFieldPostalAddress; + +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + + + + +/* + #pragma mark - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. + } + */ + +- (IBAction)Pay:(id)sender { + + transactionType = Purchase; + method = ProcessPayment; + + //Create PKPaymentRequest + [RapidAPI CreateApplePayRequest:merchantIdentifier countryCode:countryCode supportedNetworks:supportedNetworks merchantCapabilities:merchantCapabilities paymentSummaryItems:paymentSummaryItems currencyCode:currencyCode requiredBillingAddressFields:requiredBillingAddressFields billingAddress:nil requiredShippingAddressFields:requiredShippingAddressFields shippingAddress:nil shippingMethods:shippingMethods onCompletion:^(PKPaymentRequest *paymentRequest, NSError *error) { + if (error) { + NSLog(@"Error creating payment request: %@", [error localizedDescription]); + + UIAlertView *errorAlert = [[UIAlertView alloc] + initWithTitle: @"Error" + message: [error localizedDescription] + delegate:nil + cancelButtonTitle:@"OK" + otherButtonTitles:nil]; + [errorAlert show]; + return; + } + + //Bring up the PKPaymentAuthorizationViewController, pass the payment request to the view controller’s initializer + //Set a delegate for the view controller, and then present it. + [RapidAPI ShowApplePayAuthorizationView:paymentRequest withDelegateController:self]; + + }]; + +} + +#pragma mark PaymentAuthorizationViewController Delegate Methods +- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller + didSelectShippingAddress:(ABRecordRef)address + completion:(void (^)(PKPaymentAuthorizationStatus status, NSArray *shippingMethods, NSArray *summaryItems))completion { + + completion(PKPaymentAuthorizationStatusSuccess,nil,nil); + +} + + +- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller + didSelectShippingMethod:(PKShippingMethod *)shippingMethod + completion:(void (^)(PKPaymentAuthorizationStatus, NSArray *summaryItems))completion { + completion(PKPaymentAuthorizationStatusSuccess, [self summaryItemsForShippingMethod:shippingMethod]); +} + +- (NSArray *)summaryItemsForShippingMethod:(PKShippingMethod *)shippingMethod { + NSMutableArray *summaryItemsArray = [NSMutableArray new]; + + [summaryItemsArray addObject:(PKPaymentSummaryItem *)paymentSummaryItems[0]]; + [summaryItemsArray addObject:(PKPaymentSummaryItem *)paymentSummaryItems[1]]; + + PKPaymentSummaryItem *shippingItem = [PKPaymentSummaryItem summaryItemWithLabel:shippingMethod.identifier amount:shippingMethod.amount]; + NSDecimalNumber *total = [((PKPaymentSummaryItem *)paymentSummaryItems[0]).amount decimalNumberByAdding:[((PKPaymentSummaryItem *)paymentSummaryItems[1]).amount decimalNumberByAdding:shippingMethod.amount]]; + PKPaymentSummaryItem *totalItem = [PKPaymentSummaryItem summaryItemWithLabel:@"Your Company Name" amount:total]; + + [summaryItemsArray addObject:shippingItem]; + [summaryItemsArray addObject:totalItem]; + + return summaryItemsArray; +} + +- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller + didAuthorizePayment:(PKPayment *)payment + completion:(void (^)(PKPaymentAuthorizationStatus))completion { + + + [RapidAPI submitApplePay:payment transactionType:transactionType method:method completed:^(SubmitPaymentResponse *submitPaymentResponse) { + NSString *msg = [NSString stringWithFormat:@"%@",@{@"Errors":submitPaymentResponse.Errors,@"SubmissionID":submitPaymentResponse.SubmissionID, @"Status":[NSString stringWithFormat:@"%lu",(unsigned long)submitPaymentResponse.Status]}]; + NSLog(@"Apple Pay Result %@", msg); + if (submitPaymentResponse.Status != Error && [submitPaymentResponse.SubmissionID length] > 0) + completion(PKPaymentAuthorizationStatusSuccess); + else + completion(PKPaymentAuthorizationStatusFailure); + + }]; +} + +- (void)paymentAuthorizationViewControllerDidFinish:(PKPaymentAuthorizationViewController *)controller { + [self dismissViewControllerAnimated:YES completion:nil]; +} + + +@end diff --git a/Example/eWAYPaymentsSDK+ApplePay/ApplePayDemoAppDelegate.h b/Example/eWAYPaymentsSDK+ApplePay/ApplePayDemoAppDelegate.h new file mode 100644 index 0000000..3e1dbf2 --- /dev/null +++ b/Example/eWAYPaymentsSDK+ApplePay/ApplePayDemoAppDelegate.h @@ -0,0 +1,17 @@ +// +// AppDelegate.h +// eWAYPaymentsSDK+ApplePay +// +// Created by lok on 31/07/2015. +// Copyright (c) 2015 eWAY. All rights reserved. +// + +#import + +@interface ApplePayDemoAppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + + +@end + diff --git a/Example/eWAYPaymentsSDK+ApplePay/ApplePayDemoAppDelegate.m b/Example/eWAYPaymentsSDK+ApplePay/ApplePayDemoAppDelegate.m new file mode 100644 index 0000000..d2c4ee0 --- /dev/null +++ b/Example/eWAYPaymentsSDK+ApplePay/ApplePayDemoAppDelegate.m @@ -0,0 +1,50 @@ +// +// AppDelegate.m +// eWAYPaymentsSDK+ApplePay +// +// Created by lok on 31/07/2015. +// Copyright (c) 2015 eWAY. All rights reserved. +// + +#import "ApplePayDemoAppDelegate.h" +#import "RapidApi.h" + +@interface ApplePayDemoAppDelegate () + +@end + +@implementation ApplePayDemoAppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + + + //To Live, be careful, the card will be charged when using this setting. + [[RapidAPI sharedManager] setRapidEndpoint:@"https://api.ewaypayments.com/ApRapid/"]; + [[RapidAPI sharedManager] setPublicAPIKey:@"Your Public API Key from MYeWAY"]; + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + +@end diff --git a/Example/eWAYPaymentsSDK+ApplePay/Base.lproj/LaunchScreen.xib b/Example/eWAYPaymentsSDK+ApplePay/Base.lproj/LaunchScreen.xib new file mode 100644 index 0000000..958332d --- /dev/null +++ b/Example/eWAYPaymentsSDK+ApplePay/Base.lproj/LaunchScreen.xib @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/eWAYPaymentsSDK+ApplePay/Base.lproj/Main.storyboard b/Example/eWAYPaymentsSDK+ApplePay/Base.lproj/Main.storyboard new file mode 100644 index 0000000..490d3d9 --- /dev/null +++ b/Example/eWAYPaymentsSDK+ApplePay/Base.lproj/Main.storyboard @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/AppIcon.appiconset/Contents.json b/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..8089069 --- /dev/null +++ b/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,54 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "57x57", + "scale" : "1x" + }, + { + "idiom" : "iphone", + "size" : "57x57", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "eWAYLogoX120.png", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/AppIcon.appiconset/eWAYLogoX120.png b/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/AppIcon.appiconset/eWAYLogoX120.png new file mode 100644 index 0000000..da0dfa6 Binary files /dev/null and b/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/AppIcon.appiconset/eWAYLogoX120.png differ diff --git a/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/ApplePayBtn.imageset/ApplePayBTN_33pt__black_logo_@2x.png b/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/ApplePayBtn.imageset/ApplePayBTN_33pt__black_logo_@2x.png new file mode 100644 index 0000000..dc3d7fe Binary files /dev/null and b/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/ApplePayBtn.imageset/ApplePayBTN_33pt__black_logo_@2x.png differ diff --git a/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/ApplePayBtn.imageset/ApplePayBTN_33pt__black_logo_@3x.png b/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/ApplePayBtn.imageset/ApplePayBTN_33pt__black_logo_@3x.png new file mode 100644 index 0000000..a92a845 Binary files /dev/null and b/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/ApplePayBtn.imageset/ApplePayBTN_33pt__black_logo_@3x.png differ diff --git a/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/ApplePayBtn.imageset/Contents.json b/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/ApplePayBtn.imageset/Contents.json new file mode 100644 index 0000000..b695a1a --- /dev/null +++ b/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/ApplePayBtn.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ApplePayBTN_33pt__black_logo_@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ApplePayBTN_33pt__black_logo_@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/Contents.json b/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/eWAYLogo.imageset/Contents.json b/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/eWAYLogo.imageset/Contents.json new file mode 100644 index 0000000..0d916b5 --- /dev/null +++ b/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/eWAYLogo.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "eway-logo-1499-630.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/eWAYLogo.imageset/eway-logo-1499-630.png b/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/eWAYLogo.imageset/eway-logo-1499-630.png new file mode 100644 index 0000000..17a491f Binary files /dev/null and b/Example/eWAYPaymentsSDK+ApplePay/Images.xcassets/eWAYLogo.imageset/eway-logo-1499-630.png differ diff --git a/Example/eWAYPaymentsSDK+ApplePay/Info.plist b/Example/eWAYPaymentsSDK+ApplePay/Info.plist new file mode 100644 index 0000000..0ced89f --- /dev/null +++ b/Example/eWAYPaymentsSDK+ApplePay/Info.plist @@ -0,0 +1,58 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.1.0 + CFBundleSignature + ???? + CFBundleVersion + 3 + LSRequiresIPhoneOS + + NSAppTransportSecurity + + NSExceptionDomains + + api.ewaypayments.com + + NSExceptionMinimumTLSVersion + TLSv1.2 + NSExceptionRequiresForwardSecrecy + + + + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Example/eWAYPaymentsSDK+ApplePay/eWAYPaymentsSDK+ApplePay.entitlements b/Example/eWAYPaymentsSDK+ApplePay/eWAYPaymentsSDK+ApplePay.entitlements new file mode 100644 index 0000000..c6c92d9 --- /dev/null +++ b/Example/eWAYPaymentsSDK+ApplePay/eWAYPaymentsSDK+ApplePay.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.developer.in-app-payments + + + diff --git a/Example/eWAYPaymentsSDK+ApplePay/main.m b/Example/eWAYPaymentsSDK+ApplePay/main.m new file mode 100644 index 0000000..18816aa --- /dev/null +++ b/Example/eWAYPaymentsSDK+ApplePay/main.m @@ -0,0 +1,16 @@ +// +// main.m +// eWAYPaymentsSDK+ApplePay +// +// Created by lok on 31/07/2015. +// Copyright (c) 2015 eWAY. All rights reserved. +// + +#import +#import "ApplePayDemoAppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([ApplePayDemoAppDelegate class])); + } +} diff --git a/Example/eWAYPaymentsSDK.xcodeproj/project.pbxproj b/Example/eWAYPaymentsSDK.xcodeproj/project.pbxproj index fc9f903..6ce2ce6 100644 --- a/Example/eWAYPaymentsSDK.xcodeproj/project.pbxproj +++ b/Example/eWAYPaymentsSDK.xcodeproj/project.pbxproj @@ -7,7 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 1E17EB7E7E8801C0CCBB50B2 /* Pods_eWAYPaymentsSDK_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9179280F29E290DD4D9E8AC0 /* Pods_eWAYPaymentsSDK_Tests.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 1E17EB7E7E8801C0CCBB50B2 /* Pods_eWAYPaymentsSDK_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9179280F29E290DD4D9E8AC0 /* Pods_eWAYPaymentsSDK_Tests.framework */; }; 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; 6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; @@ -20,7 +20,7 @@ 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; }; 6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; }; - 6B718D11E71B39B1CE91BE8E /* Pods_eWAYPaymentsSDK_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D1405F4987667EAE258F06 /* Pods_eWAYPaymentsSDK_Example.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 6B718D11E71B39B1CE91BE8E /* Pods_eWAYPaymentsSDK_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D1405F4987667EAE258F06 /* Pods_eWAYPaymentsSDK_Example.framework */; }; E29FC4A21B1D79CF005C37C9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E29FC4A01B1D79CF005C37C9 /* Main.storyboard */; }; E29FC4CD1B1D7A99005C37C9 /* EncryptViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E29FC4A61B1D7A99005C37C9 /* EncryptViewController.m */; }; E29FC4CE1B1D7A99005C37C9 /* InputNVpairViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E29FC4A81B1D7A99005C37C9 /* InputNVpairViewController.m */; }; @@ -671,6 +671,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "eWAYPaymentsSDK/eWAYPaymentsSDK-Prefix.pch"; INFOPLIST_FILE = "eWAYPaymentsSDK/eWAYPaymentsSDK-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MODULE_NAME = ExampleApp; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; @@ -686,6 +687,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "eWAYPaymentsSDK/eWAYPaymentsSDK-Prefix.pch"; INFOPLIST_FILE = "eWAYPaymentsSDK/eWAYPaymentsSDK-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MODULE_NAME = ExampleApp; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; diff --git a/Example/eWAYPaymentsSDK/eWAYPaymentsSDK-Info.plist b/Example/eWAYPaymentsSDK/eWAYPaymentsSDK-Info.plist index 13a2cd2..d4b51c3 100644 --- a/Example/eWAYPaymentsSDK/eWAYPaymentsSDK-Info.plist +++ b/Example/eWAYPaymentsSDK/eWAYPaymentsSDK-Info.plist @@ -17,13 +17,26 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0 + 1.1.0 CFBundleSignature ???? CFBundleVersion - 1.0 + 1 LSRequiresIPhoneOS + NSAppTransportSecurity + + NSExceptionDomains + + api.ewaypayments.com + + NSExceptionMinimumTLSVersion + TLSv1.2 + NSExceptionRequiresForwardSecrecy + + + + UIMainStoryboardFile Main UIMainStoryboardFile~ipad diff --git a/Example/eWAYPaymentsSDK/eWAYPaymentsSDKAppDelegate.m b/Example/eWAYPaymentsSDK/eWAYPaymentsSDKAppDelegate.m index 86824af..52fcc20 100644 --- a/Example/eWAYPaymentsSDK/eWAYPaymentsSDKAppDelegate.m +++ b/Example/eWAYPaymentsSDK/eWAYPaymentsSDKAppDelegate.m @@ -14,7 +14,7 @@ @implementation eWAYPaymentsSDKAppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. - [[RapidAPI sharedManager] setRapidEndpoint:@"http://api.sandbox.ewaypayments.com/"]; + [[RapidAPI sharedManager] setRapidEndpoint:@"https://api.sandbox.ewaypayments.com/"]; [[RapidAPI sharedManager] setPublicAPIKey:@"epk-6C961B95-D93A-443C-BCB9-64B6DBDC1C1B"]; return YES; diff --git a/Pod/Classes/Enumerated.h b/Pod/Classes/Enumerated.h index af217f4..d280ade 100755 --- a/Pod/Classes/Enumerated.h +++ b/Pod/Classes/Enumerated.h @@ -19,6 +19,13 @@ typedef enum : NSUInteger { MOTO, // Mail order or Telephone Transaction. Used when the card is not at hand. Can also be used when charging a Token customer. } TransactionType; +typedef enum : NSUInteger { + ProcessPayment, //This method allows merchants to process a standard payment. + CreateTokenCustomer, //This method allows merchants to create token customers without processing a payment. + TokenPayment, //This method allows merchants to process payments using Token customers they have stored with eWAY. Merchants can either load an existing token customer by passing in their TokenCustomerID in the initial request, or create a new Token customer by leaving the TokenCustomerID field blank (Transparent Redirect and Responsive Shared Page only). + Authorise,//This method allows merchants to reserve funds on a customer’s credit card without charging it. +} Method; + typedef enum : NSUInteger { Unknown, //Method is unknown. LowCost, //A low cost method is used diff --git a/Pod/Classes/RapidAPI+ApplePay.h b/Pod/Classes/RapidAPI+ApplePay.h new file mode 100644 index 0000000..f462da4 --- /dev/null +++ b/Pod/Classes/RapidAPI+ApplePay.h @@ -0,0 +1,33 @@ +// +// RapidAPI+ApplePay.h +// Pods +// +// Created by lok on 30/07/2015. +// +// + +#import +#import "RapidAPI.h" +#import + +@interface RapidAPI (ApplePay) + ++ (void)CreateApplePayRequest:(NSString *)merchantIdentifier + countryCode:(NSString *)countryCode + supportedNetworks:(NSArray *)supportedNetworks + merchantCapabilities:(PKMerchantCapability)merchantCapabilities + paymentSummaryItems:(NSArray *)paymentSummaryItems + currencyCode:(NSString *)currencyCode + requiredBillingAddressFields:(PKAddressField)requiredBillingAddressFields + billingAddress:(ABRecordRef *)billingAddress +requiredShippingAddressFields:(PKAddressField)requiredShippingAddressFields + shippingAddress:(ABRecordRef *)shippingAddress + shippingMethods:(NSArray *)shippingMethods + onCompletion:(void (^) (PKPaymentRequest *paymentRequest, NSError *error))onCompletion; + ++ (void)ShowApplePayAuthorizationView:(PKPaymentRequest *)paymentRequest +withDelegateController:(UIViewController *)withDelegateController; + ++ (void)submitApplePay:(PKPayment *)payment transactionType:(TransactionType)transactionType method:(Method)method completed:(void (^)(SubmitPaymentResponse *submitPaymentResponse))completed; + +@end diff --git a/Pod/Classes/RapidAPI+ApplePay.m b/Pod/Classes/RapidAPI+ApplePay.m new file mode 100644 index 0000000..f8df2ff --- /dev/null +++ b/Pod/Classes/RapidAPI+ApplePay.m @@ -0,0 +1,242 @@ +// +// RapidAPI+ApplePay.m +// Pods +// +// Created by lok on 30/07/2015. +// +// + +#import "RapidAPI+ApplePay.h" +#import + +@implementation RapidAPI (ApplePay) + ++ (void)CreateApplePayRequest:(NSString *)merchantIdentifier + countryCode:(NSString *)countryCode + supportedNetworks:(NSArray *)supportedNetworks + merchantCapabilities:(PKMerchantCapability)merchantCapabilities + paymentSummaryItems:(NSArray *)paymentSummaryItems + currencyCode:(NSString *)currencyCode + requiredBillingAddressFields:(PKAddressField)requiredBillingAddressFields + billingAddress:(ABRecordRef *)billingAddress +requiredShippingAddressFields:(PKAddressField)requiredShippingAddressFields + shippingAddress:(ABRecordRef *)shippingAddress + shippingMethods:(NSArray *)shippingMethods + onCompletion:(void (^) (PKPaymentRequest *paymentRequest, NSError *error))onCompletion +{ + PKPaymentRequest *paymentRequest = [PKPaymentRequest new]; + + //TODO: Add validation Errors + + [paymentRequest setMerchantIdentifier:merchantIdentifier]; + + + [paymentRequest setCountryCode:countryCode]; + + + [paymentRequest setSupportedNetworks:supportedNetworks]; + + + [paymentRequest setMerchantCapabilities:merchantCapabilities]; + [paymentRequest setPaymentSummaryItems:paymentSummaryItems]; + [paymentRequest setCurrencyCode:currencyCode]; + [paymentRequest setRequiredBillingAddressFields:requiredBillingAddressFields]; + [paymentRequest setBillingAddress:billingAddress]; + [paymentRequest setRequiredShippingAddressFields:requiredShippingAddressFields]; + [paymentRequest setShippingAddress:shippingAddress]; + [paymentRequest setShippingMethods:shippingMethods]; + + // Check allow payment networks + // YES if the user can authorize payments on this device using one of the payment networks supported + // by the merchant. + // NO if the user cannot authorize payments on these networks or if the user is restricted from + // authorizing payments. + if (![PKPaymentAuthorizationViewController canMakePaymentsUsingNetworks:supportedNetworks]) { + NSError *error = [NSError errorWithDomain:@"RapidApplePay" code:05 userInfo:@{NSLocalizedDescriptionKey: @"payment networks not allowed"}]; + onCompletion(paymentRequest, error); + } + else + onCompletion(paymentRequest, nil); + +} + ++ (void)ShowApplePayAuthorizationView:(PKPaymentRequest *)paymentRequest withDelegateController:(UIViewController *)withDelegateController +{ + PKPaymentAuthorizationViewController *auth = [[PKPaymentAuthorizationViewController alloc] initWithPaymentRequest:paymentRequest]; + auth.delegate = (id)withDelegateController; + [withDelegateController presentViewController:auth animated:YES completion:nil]; +} + +#pragma mark - Submit Payment ++ (void)submitApplePay:(PKPayment *)payment transactionType:(TransactionType)transactionType method:(Method)method completed:(void (^)(SubmitPaymentResponse *submitPaymentResponse))completed +{ + [[RapidAPI sharedManager] submitApplePay:payment transactionType:transactionType method:method completed:completed]; +} + +- (void)submitApplePay:(PKPayment *)payment transactionType:(TransactionType)transactionType method:(Method)method completed:(void (^)(SubmitPaymentResponse *submitPaymentResponse))completed +{ + //Internal system error + id object = [self validateWithRessponseType:SubmitPaymentResponseType]; + if (object ) { + completed(object); + return; + } + + //create json object + NSMutableDictionary *paramObject = [NSMutableDictionary new]; + @try { + Transaction *tran = [[Transaction alloc] init]; + + tran.TransactionType = transactionType; + tran.Method = method; + + if (payment.shippingAddress) { + + + Customer *customerObj = [[Customer alloc] init]; + customerObj.FirstName = (__bridge_transfer NSString*)ABRecordCopyValue(payment.shippingAddress, kABPersonFirstNameProperty); + customerObj.LastName = (__bridge_transfer NSString*)ABRecordCopyValue(payment.shippingAddress, kABPersonLastNameProperty); + + //customerObj.CompanyName = @""; + //customerObj.Phone = @"09 889 0986"; + //customerObj.Mobile = @"09 889 0986"; + + Address *address = [[Address alloc] init]; + + ABMultiValueRef addressValues = ABRecordCopyValue(payment.shippingAddress, kABPersonAddressProperty); + if (addressValues != NULL) { + if (ABMultiValueGetCount(addressValues) > 0) { + CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(addressValues, 0); + NSString *street = CFDictionaryGetValue(dict, kABPersonAddressStreetKey); + if (street) { + address.Street1 = street; + } + NSString *city = CFDictionaryGetValue(dict, kABPersonAddressCityKey); + if (city) { + address.City = city; + } + NSString *state = CFDictionaryGetValue(dict, kABPersonAddressStateKey); + if (state) { + address.State = state; + } + NSString *postalCode = CFDictionaryGetValue(dict, kABPersonAddressZIPKey); + if (postalCode) { + address.PostalCode = postalCode; + } + NSString *country = CFDictionaryGetValue(dict, kABPersonAddressCountryKey); + if (country) { + //Need a method to convert country to country code + address.Country = @"AU"; + } + CFRelease(dict); + } + CFRelease(addressValues); + } + customerObj.Address = address; + + ShippingDetails *shipping = [[ShippingDetails alloc] init]; + shipping.FirstName = (__bridge_transfer NSString*)ABRecordCopyValue(payment.shippingAddress, kABPersonFirstNameProperty); + shipping.LastName = (__bridge_transfer NSString*)ABRecordCopyValue(payment.shippingAddress, kABPersonLastNameProperty); + shipping.ShippingAddress = address; + + tran.Customer = customerObj; + tran.ShippingDetails = shipping; + } + + + NSDictionary *paymentData = [NSJSONSerialization JSONObjectWithData:payment.token.paymentData options:NSJSONReadingAllowFragments error:nil]; + + + NSMutableDictionary *applePayObject = [NSMutableDictionary new]; + + [applePayObject setObject:[paymentData objectForKey:@"data"] forKey:@"data"]; + + [applePayObject setObject:[paymentData objectForKey:@"header"] forKey:@"header"]; + + [applePayObject setObject:[paymentData objectForKey:@"signature"] forKey:@"signature"]; + + [applePayObject setObject:[paymentData objectForKey:@"version"] forKey:@"version"]; + + + if (payment.token.paymentInstrumentName) + [applePayObject setObject:payment.token.paymentInstrumentName forKey:@"PaymentInstrumentName"]; + + if (payment.token.paymentNetwork) + [applePayObject setObject:payment.token.paymentNetwork forKey:@"PaymentNetwork"]; + + if (payment.token.transactionIdentifier) + [applePayObject setObject:payment.token.transactionIdentifier forKey:@"TransactionIdentifier"]; + + + paramObject = [[NSMutableDictionary alloc] initWithDictionary:[tran dictionary]]; + + [paramObject setObject:applePayObject forKey:@"ApplePay"]; + } + @catch (NSException *exception) { + //exception: maybe internal SDK, params Bad vv + SubmitPaymentResponse *submitPaymentResponse = [[SubmitPaymentResponse alloc] init]; + submitPaymentResponse.Status = Error; + submitPaymentResponse.Errors = @"S9995"; + completed(submitPaymentResponse); + return; + } + + + //change json object to json string + NSError *writeError = nil; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:paramObject options:NSJSONWritingPrettyPrinted error:&writeError]; + NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + // NSLog(@"JSON Output: %@", jsonString); + + //request api encrypt + NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; + + NSString *authStr = [NSString stringWithFormat:@"%@:%@", self.PublicAPIKey, @""]; + NSData *authData = [authStr dataUsingEncoding:NSUTF8StringEncoding]; + NSString *authValue = [NSString stringWithFormat:@"Basic %@", [authData base64EncodedStringWithOptions:0]]; + //NSString* userAgent = @"Mozilla/6.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/8.0 Mobile/10A5376e Safari/8536.25;eWAY SDK iOS 1.1"; + + + NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@Payment",self.RapidEndpoint]]]; + [request setValue:authValue forHTTPHeaderField:@"Authorization"]; + [request setHTTPMethod:@"POST"]; + //[request setValue:userAgent forHTTPHeaderField:@"User-Agent"]; + [request setValue:@"application/json;charset=UTF-8" forHTTPHeaderField:@"Content-Type"]; + [request setHTTPBody:[jsonString dataUsingEncoding:NSUTF8StringEncoding]]; + + NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfig]; + + [[session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + + SubmitPaymentResponse *submitPaymentResponse; + if ([response isKindOfClass:[NSHTTPURLResponse class]]) { + + NSInteger statusCode = [(NSHTTPURLResponse *)response statusCode]; + + if (statusCode == 443) { + submitPaymentResponse = [self errorObjectWithErrorCode:@"S9991" ressponseType:SubmitPaymentResponseType]; + completed(submitPaymentResponse); + return; + } + } + + if (error) { + submitPaymentResponse = [self errorObjectWithErrorCode:@"S9994" ressponseType:SubmitPaymentResponseType]; + } + else + { + //need to proce data to object when before return object via block + NSError *errorEncode = nil; + NSString *rawStr = [NSString stringWithUTF8String:[data bytes]]; + NSLog(@"RawResponse from Payment endpoint %@",rawStr); + NSLog(@"data: %@", [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]); + NSDictionary *responseObject = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&errorEncode]; + submitPaymentResponse = [[SubmitPaymentResponse alloc] initWithDictionary:responseObject]; + } + completed(submitPaymentResponse); + + }] resume]; +} + + +@end diff --git a/Pod/Classes/RapidAPI.h b/Pod/Classes/RapidAPI.h index 83d721f..044e35a 100755 --- a/Pod/Classes/RapidAPI.h +++ b/Pod/Classes/RapidAPI.h @@ -30,4 +30,7 @@ typedef enum : NSUInteger { + (void)submitPayment:(Transaction *)Transaction completed:(void (^)(SubmitPaymentResponse *submitPaymentResponse))completed; + (void)userMessage:(NSString *)ErrorCodes Language:(NSString *)Language completed:(void (^)(UserMessageResponse *userMessageResponse))completed; +- (id)validateWithRessponseType:(ResponseType)type; +- (id)errorObjectWithErrorCode:(NSString *)errorCode ressponseType:(ResponseType)type; + @end diff --git a/Pod/Classes/Transaction.h b/Pod/Classes/Transaction.h index 6cfac0c..6c41509 100755 --- a/Pod/Classes/Transaction.h +++ b/Pod/Classes/Transaction.h @@ -16,6 +16,7 @@ @interface Transaction : NSObject @property (nonatomic,assign) TransactionType TransactionType; //What type of transaction this is (Purchase, MOTO,etc) +@property (nonatomic,assign) Method Method; //which determines the action being taken with the request. (ProcessPayment, Authorise, TokenPayment etc) @property (nonatomic,strong) Customer *Customer; //Customer details (name address token etc) @property (nonatomic,strong) ShippingDetails *ShippingDetails; //(optional) Shipping Address, name etc for the product ordered with this transaction @property (nonatomic,strong) Payment *Payment; //Payment details (amount, currency and invoice information) diff --git a/Pod/Classes/Transaction.m b/Pod/Classes/Transaction.m index 73fd505..9ec10ae 100755 --- a/Pod/Classes/Transaction.m +++ b/Pod/Classes/Transaction.m @@ -42,6 +42,18 @@ - (NSString *)getTransactionType return res; } +- (NSString *)getMethod +{ + NSString *res = @""; + NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@"ProcessPayment",[NSNumber numberWithInteger:ProcessPayment], + @"CreateTokenCustomer",[NSNumber numberWithInteger:CreateTokenCustomer], + @"TokenPayment",[NSNumber numberWithInteger:TokenPayment], + @"Authorise",[NSNumber numberWithInteger:Authorise], + nil]; + res = [dict objectForKey:[NSNumber numberWithInteger:self.Method]]; + return res; +} + - (NSDictionary *)dictionary { NSMutableDictionary *dict = [NSMutableDictionary new]; @@ -64,7 +76,8 @@ - (NSDictionary *)dictionary if (self.Options) [dict setObject:self.Options forKey:@"Options"]; - [dict setObject:[self.Payment dictionary] forKey:@"Payment"]; + if (self.Payment) + [dict setObject:[self.Payment dictionary] forKey:@"Payment"]; NSString *deviceID = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; [dict setObject:deviceID forKey:@"DeviceID"]; @@ -73,6 +86,8 @@ - (NSDictionary *)dictionary [dict setObject:self.PartnerID forKey:@"PartnerID"]; [dict setObject:[self getTransactionType] forKey:@"TransactionType"]; + [dict setObject:[self getMethod] forKey:@"Method"]; + return dict; }