From 4f67d2674cebf862198827dd4195de903472984d Mon Sep 17 00:00:00 2001 From: Tarik <4taras4@gmail.com> Date: Tue, 23 Nov 2021 19:18:50 +0200 Subject: [PATCH 1/3] Added Giftcards SDK --- Docs/Authentication.md | 11 +- Docs/GiftcardsSDK.md | 156 +++++++++++++++ Docs/Sample_code.md | 4 + Example/Pods/Pods.xcodeproj/project.pbxproj | 51 ++++- .../project.pbxproj | 9 +- Example/ReloadlyAuthentication/Info.plist | 6 +- Example/Tests/AutenticationTest.swift | 4 +- Example/Tests/ReloadlyAirtimeTest.swift | 16 +- Example/Tests/ReloadlyGiftcardTest.swift | 100 ++++++++++ ReloadlySDK.podspec | 7 +- .../ReloadlyAirtime/Models/CountryModel.swift | 14 +- .../Models/DiscountsModel.swift | 6 +- .../ReloadlyAirtime/ReloadlyAirtime.swift | 8 +- .../Network/NetworkManager.swift | 2 +- .../ReloadlyAuthentication.swift | 6 +- .../AuthenticationBackendEnvironment.swift | 20 +- .../Utilities/AuthenticationService.swift | 2 +- .../Models/OrderGiftcardModel.swift | 34 ++++ .../Models/ProductsModel.swift | 98 ++++++++++ .../Models/RedeemCodeModel.swift | 18 ++ .../ReloadlyGiftcard/ReloadlyGiftcard.swift | 179 ++++++++++++++++++ 21 files changed, 697 insertions(+), 54 deletions(-) create mode 100644 Docs/GiftcardsSDK.md create mode 100644 Example/Tests/ReloadlyGiftcardTest.swift create mode 100644 ReloadlySDK/Classes/ReloadlyGiftcard/Models/OrderGiftcardModel.swift create mode 100644 ReloadlySDK/Classes/ReloadlyGiftcard/Models/ProductsModel.swift create mode 100644 ReloadlySDK/Classes/ReloadlyGiftcard/Models/RedeemCodeModel.swift create mode 100644 ReloadlySDK/Classes/ReloadlyGiftcard/ReloadlyGiftcard.swift diff --git a/Docs/Authentication.md b/Docs/Authentication.md index 29c3155..23ecc40 100644 --- a/Docs/Authentication.md +++ b/Docs/Authentication.md @@ -19,10 +19,9 @@ Initialise the library using `AppDelegate`. You can set the `ClientId`, `SecretI ReloadlySDKSecretId PUT_YOUR_RELOADLY_CLIENT_SECRET_HERE ReloadlySDKEnvironment -sandbox +airtimeSandbox ``` - ```swift @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { @@ -63,7 +62,7 @@ To enable API default logging at `info` level, please change log level during SD You can switch the backendEnvironment that the SDK integracts with; by default the prouction environment backend is used. ```swift - ReloadlyAuthentication.shared.configure(service: AuthenticationService(backendEnvironment: .sandbox), logLevel: .info) + ReloadlyAuthentication.shared.configure(service: AuthenticationService(backendEnvironment: .airtimeSandbox), logLevel: .info) ``` ## Customizing The API Client Instance @@ -82,11 +81,11 @@ Connect and read timeouts can be configured globally: let proxyConfiguratorWithCredentials = ProxyConfigurator(hostUrl: "url", port: 8043, username: "username", password: "password") ReloadlyAuthentication.shared.configure(with: "id", clientSecret: "secret", - service: AuthenticationService(backendEnvironment: .sandbox), + service: AuthenticationService(backendEnvironment: .airtimeSandbox), logLevel: .info, proxyConfiguration: proxyConfiguratorWithCredentials) ``` -Also username and password can be nil to use proxy without credentials. +Also username and password can be nil to use proxy without credentials. Note that, while providing the `clientId` and `clientSecret` is supported as shown below, it is generallly discouraged. Make use of the plist instead to specify the clientId and clientSecret. @@ -99,7 +98,7 @@ You can disable this behavior if you prefer: ```swift ReloadlyAuthentication.shared.configure(with: "id", clientSecret: "secret", - service: AuthenticationService(backendEnvironment: .sandbox), + service: AuthenticationService(backendEnvironment: .airtimeSandbox), logLevel: .info, useTelemetry: false) ``` diff --git a/Docs/GiftcardsSDK.md b/Docs/GiftcardsSDK.md new file mode 100644 index 0000000..ee9579b --- /dev/null +++ b/Docs/GiftcardsSDK.md @@ -0,0 +1,156 @@ +# Giftcards SDK + +Gift cards are an awesome way to send and receive value in a digital economy that is fast becoming the future. Reloadly's GiftCard SDK connects you to over 200 gift cards that can be used both locally and internationally across 140+ countries. +This enables you to purchase gift cards for both commercial and personal reasons. Some of the data you will need are your access token and the brand details of the gift card. +This documentation contains a reference to each endpoint in the GiftCard API. You can check it out to learn more about how they work. + + +## Get all products + +```java +ReloadlyGiftcard.shared.getAllProducts() { result in + switch result { + case .success(let result): + print(result) + case .failure(let error): + print(error) + } + } +``` + + +## Get product by ID + +You can access the details of a particular gift card by making a request with that gift card's product ID + +```swift + +ReloadlyGiftcard.shared.getProduct(by: Int) { result in + switch result { + case .success(let result): + print(result) + case .failure(let error): + print(error) + } + } +``` + + +## Get products by ISO Code + +You can retrieve details of every gift card product that is available in a country + +```swift + +ReloadlyGiftcard.shared.getProductByISO(countryCode: String) { result in + switch result { + case .success(let result): + print(result) + case .failure(let error): + print(error) + } + } +``` + +## Get all redeem instructions + +Redeem instructions are useful for retrieving the value of a gift card. The redeem instructions provides details on how to redeem every gift card product made available by Reloadly. + +```swift + +ReloadlyGiftcard.shared.redeemInstruction() { result in + switch result { + case .success(let result): + print(result) + case .failure(let error): + print(error) + } + } +``` + +## Get redeem instructions by brand ID + +Retrieve the redeem instructions for a particular gift card brand + +```swift + +ReloadlyGiftcard.shared.redeemInstruction(by id: Int) { result in + switch result { + case .success(let result): + print(result) + case .failure(let error): + print(error) + } + } +``` + +## Get all discounts + +Fetch data of every gift card that has an available discount at the point of purchase + +```swift + +ReloadlyGiftcard.shared.allTransactions() { result in + switch result { + case .success(let result): + print(result) + case .failure(let error): + print(error) + } + } +``` + +## Get discount by product ID + +Get the details of an active discount on a particular gift card product + +```swift + +ReloadlyGiftcard.shared.transaction(by id: Int) { result in + switch result { + case .success(let result): + print(result) + case .failure(let error): + print(error) + } + } +``` + +## Order a gift card + +You can make a request to purchase any of the gift card products made available via Reloadly + +```swift + +ReloadlyGiftcard.shared.orderGiftcard(with productId: Int, + countryCode: String, + quantity: Int, + unitPrice: Double, + customIdentifier: String, + senderName: String, + recipientEmail: String) { result in + switch result { + case .success(let result): + print(result) + case .failure(let error): + print(error) + } + } +``` + +## Get a redeem code + +Retrieve details of an already purchased gift card's redeem code. +Note that in some cases, a purchased gift card's details may not be readily available due to the transaction still being processed. In this case, you can track the transaction details using the Get Transaction by ID endpoint. + +```swift + +ReloadlyGiftcard.shared.redeemCode(by transactionId: Int) { result in + switch result { + case .success(let result): + print(result) + case .failure(let error): + print(error) + } + } +``` diff --git a/Docs/Sample_code.md b/Docs/Sample_code.md index ed5a570..2629337 100644 --- a/Docs/Sample_code.md +++ b/Docs/Sample_code.md @@ -13,3 +13,7 @@ * [Promotion Operations](https://github.com/Reloadly/reloadly-sdk-ios/blob/main/Docs/Promotion.md) * [Report Operations](https://github.com/Reloadly/reloadly-sdk-ios/blob/main/Docs/Report.md) * [Topup Operations](https://github.com/Reloadly/reloadly-sdk-ios/blob/main/Docs/Topup.md) + +## GiftCard SDK + +* [GiftcardsSDK](https://github.com/Reloadly/reloadly-sdk-ios/blob/main/Docs/GiftcardsSDK.md) diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index f0abc53..5e65ff2 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -38,6 +38,10 @@ A4A680ABC25F8C9F730EA4BAEB52AEEC /* ReloadlySDK-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = EC41314C2A07D306BFC79E3E21C06C11 /* ReloadlySDK-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; D24AB5E778196E2BD8B6D9E376596715 /* Pods-ReloadlyAuthentication_Tests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 6827B24491E1DAA988C17129B8123E55 /* Pods-ReloadlyAuthentication_Tests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; EA87991AE9CC00F0A64D467E852AFDC1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */; }; + F3B7BE29274AD7990084A3BC /* ReloadlyGiftcard.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3B7BE28274AD7990084A3BC /* ReloadlyGiftcard.swift */; }; + F3BDE029274BF552006983AB /* ProductsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3BDE028274BF552006983AB /* ProductsModel.swift */; }; + F3BDE02D274BFE0E006983AB /* OrderGiftcardModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3BDE02C274BFE0E006983AB /* OrderGiftcardModel.swift */; }; + F3BDE02F274BFF2D006983AB /* RedeemCodeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3BDE02E274BFF2D006983AB /* RedeemCodeModel.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -110,6 +114,10 @@ EA173E0F1655BBE1D5D6DEE4B8F8828C /* Pods-ReloadlyAuthentication_Example-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-ReloadlyAuthentication_Example-frameworks.sh"; sourceTree = ""; }; EBE6EFD91CA2F531C1552AFA036FE598 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; EC41314C2A07D306BFC79E3E21C06C11 /* ReloadlySDK-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "ReloadlySDK-umbrella.h"; sourceTree = ""; }; + F3B7BE28274AD7990084A3BC /* ReloadlyGiftcard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReloadlyGiftcard.swift; sourceTree = ""; }; + F3BDE028274BF552006983AB /* ProductsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductsModel.swift; sourceTree = ""; }; + F3BDE02C274BFE0E006983AB /* OrderGiftcardModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderGiftcardModel.swift; sourceTree = ""; }; + F3BDE02E274BFF2D006983AB /* RedeemCodeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RedeemCodeModel.swift; sourceTree = ""; }; F77FF3918786364D682C453189BEC190 /* Pods_ReloadlyAuthentication_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ReloadlyAuthentication_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; FECCC601891B10E1F805EE8C1A0DDCDC /* Pods-ReloadlyAuthentication_Example-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-ReloadlyAuthentication_Example-dummy.m"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -294,6 +302,7 @@ children = ( 1A7743BA26033FC700D34144 /* ReloadlyAirtime */, 1A7743C826033FC700D34144 /* ReloadlyAuthentication */, + F3B7BE27274AD7590084A3BC /* ReloadlyGiftcard */, 962E6B909208D6C753A0977BBC81F2D5 /* Pod */, A1456B760C0CF163545F9AC1449EE3A8 /* Support Files */, ); @@ -344,6 +353,26 @@ name = "Development Pods"; sourceTree = ""; }; + F3B7BE27274AD7590084A3BC /* ReloadlyGiftcard */ = { + isa = PBXGroup; + children = ( + F3B7BE28274AD7990084A3BC /* ReloadlyGiftcard.swift */, + F3BDE030274BFFB2006983AB /* Models */, + ); + name = ReloadlyGiftcard; + path = ReloadlySDK/Classes/ReloadlyGiftcard; + sourceTree = ""; + }; + F3BDE030274BFFB2006983AB /* Models */ = { + isa = PBXGroup; + children = ( + F3BDE028274BF552006983AB /* ProductsModel.swift */, + F3BDE02C274BFE0E006983AB /* OrderGiftcardModel.swift */, + F3BDE02E274BFF2D006983AB /* RedeemCodeModel.swift */, + ); + path = Models; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -437,7 +466,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1100; - LastUpgradeCheck = 1100; + LastUpgradeCheck = 1310; }; buildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */; compatibilityVersion = "Xcode 3.2"; @@ -505,13 +534,16 @@ buildActionMask = 2147483647; files = ( 1A7743EF26033FC800D34144 /* ErrorModel.swift in Sources */, + F3B7BE29274AD7990084A3BC /* ReloadlyGiftcard.swift in Sources */, 1A7743E226033FC700D34144 /* TopupsModel.swift in Sources */, 1A7743DC26033FC700D34144 /* BalanceModel.swift in Sources */, 1A7743DF26033FC700D34144 /* OperatorModel.swift in Sources */, 1A7743F526033FC800D34144 /* AuthenticationBackendEnvironment.swift in Sources */, + F3BDE029274BF552006983AB /* ProductsModel.swift in Sources */, 30802B8A10C02A81289543FC17C784FB /* ReloadlySDK-dummy.m in Sources */, 1A7743E126033FC700D34144 /* DiscountsModel.swift in Sources */, 1A7743DE26033FC700D34144 /* PhoneModel.swift in Sources */, + F3BDE02F274BFF2D006983AB /* RedeemCodeModel.swift in Sources */, 1A7743E326033FC700D34144 /* ReloadlyAirtime+Promotions.swift in Sources */, 1A7743DD26033FC700D34144 /* CountryModel.swift in Sources */, 1A7743E026033FC700D34144 /* PromotionModel.swift in Sources */, @@ -525,6 +557,7 @@ 1A7743E526033FC700D34144 /* ReloadlyAirtime+Operators.swift in Sources */, 1A7743F126033FC800D34144 /* ReloadlyAuthentication.swift in Sources */, 1A7743EA26033FC800D34144 /* Formatter.swift in Sources */, + F3BDE02D274BFE0E006983AB /* OrderGiftcardModel.swift in Sources */, 1A7743E426033FC700D34144 /* ReloadlyAirtime.swift in Sources */, 1A7743F026033FC800D34144 /* OAuth2Token.swift in Sources */, ); @@ -564,7 +597,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "Target Support Files/Pods-ReloadlyAuthentication_Tests/Pods-ReloadlyAuthentication_Tests-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACH_O_TYPE = staticlib; MODULEMAP_FILE = "Target Support Files/Pods-ReloadlyAuthentication_Tests/Pods-ReloadlyAuthentication_Tests.modulemap"; @@ -598,7 +631,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "Target Support Files/Pods-ReloadlyAuthentication_Example/Pods-ReloadlyAuthentication_Example-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACH_O_TYPE = staticlib; MODULEMAP_FILE = "Target Support Files/Pods-ReloadlyAuthentication_Example/Pods-ReloadlyAuthentication_Example.modulemap"; @@ -666,7 +699,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -693,7 +726,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "Target Support Files/Pods-ReloadlyAuthentication_Tests/Pods-ReloadlyAuthentication_Tests-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACH_O_TYPE = staticlib; MODULEMAP_FILE = "Target Support Files/Pods-ReloadlyAuthentication_Tests/Pods-ReloadlyAuthentication_Tests.modulemap"; @@ -726,7 +759,7 @@ GCC_PREFIX_HEADER = "Target Support Files/ReloadlySDK/ReloadlySDK-prefix.pch"; INFOPLIST_FILE = "Target Support Files/ReloadlySDK/ReloadlySDK-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MODULEMAP_FILE = "Target Support Files/ReloadlySDK/ReloadlySDK.modulemap"; PRODUCT_MODULE_NAME = ReloadlySDK; @@ -758,7 +791,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "Target Support Files/Pods-ReloadlyAuthentication_Example/Pods-ReloadlyAuthentication_Example-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACH_O_TYPE = staticlib; MODULEMAP_FILE = "Target Support Files/Pods-ReloadlyAuthentication_Example/Pods-ReloadlyAuthentication_Example.modulemap"; @@ -828,7 +861,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -857,7 +890,7 @@ GCC_PREFIX_HEADER = "Target Support Files/ReloadlySDK/ReloadlySDK-prefix.pch"; INFOPLIST_FILE = "Target Support Files/ReloadlySDK/ReloadlySDK-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MODULEMAP_FILE = "Target Support Files/ReloadlySDK/ReloadlySDK.modulemap"; PRODUCT_MODULE_NAME = ReloadlySDK; diff --git a/Example/ReloadlyAuthentication.xcodeproj/project.pbxproj b/Example/ReloadlyAuthentication.xcodeproj/project.pbxproj index 8d90c3a..b891d32 100644 --- a/Example/ReloadlyAuthentication.xcodeproj/project.pbxproj +++ b/Example/ReloadlyAuthentication.xcodeproj/project.pbxproj @@ -17,6 +17,7 @@ 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; 607FACEC1AFB9204008FA782 /* AutenticationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* AutenticationTest.swift */; }; A1BAE5131423FAF995F164B3 /* Pods_ReloadlyAuthentication_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CFDB84F883D67EF72541412B /* Pods_ReloadlyAuthentication_Example.framework */; }; + F3BDE034274C0152006983AB /* ReloadlyGiftcardTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3BDE033274C0152006983AB /* ReloadlyGiftcardTest.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -51,6 +52,7 @@ 67341B0D82C5099B1167DA22 /* Pods-ReloadlyAuthentication_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReloadlyAuthentication_Tests.release.xcconfig"; path = "Target Support Files/Pods-ReloadlyAuthentication_Tests/Pods-ReloadlyAuthentication_Tests.release.xcconfig"; sourceTree = ""; }; A4FA8A87922145E14255079E /* Pods-ReloadlyAuthentication_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReloadlyAuthentication_Tests.debug.xcconfig"; path = "Target Support Files/Pods-ReloadlyAuthentication_Tests/Pods-ReloadlyAuthentication_Tests.debug.xcconfig"; sourceTree = ""; }; CFDB84F883D67EF72541412B /* Pods_ReloadlyAuthentication_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ReloadlyAuthentication_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + F3BDE033274C0152006983AB /* ReloadlyGiftcardTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReloadlyGiftcardTest.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -133,6 +135,7 @@ 607FACEB1AFB9204008FA782 /* AutenticationTest.swift */, 1A4B7B9D2604EAFA004A00AA /* DemoAppTest.swift */, 1A7744062603521800D34144 /* ReloadlyAirtimeTest.swift */, + F3BDE033274C0152006983AB /* ReloadlyGiftcardTest.swift */, 607FACE91AFB9204008FA782 /* Supporting Files */, ); path = Tests; @@ -222,7 +225,7 @@ }; 607FACE41AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; - LastSwiftMigration = 1240; + LastSwiftMigration = 1310; TestTargetID = 607FACCF1AFB9204008FA782; }; }; @@ -346,6 +349,7 @@ buildActionMask = 2147483647; files = ( 607FACEC1AFB9204008FA782 /* AutenticationTest.swift in Sources */, + F3BDE034274C0152006983AB /* ReloadlyGiftcardTest.swift in Sources */, 1A77440F2603530700D34144 /* ReloadlyAirtimeTest.swift in Sources */, 1A4B7B9E2604EAFA004A00AA /* DemoAppTest.swift in Sources */, ); @@ -523,6 +527,7 @@ baseConfigurationReference = A4FA8A87922145E14255079E /* Pods-ReloadlyAuthentication_Tests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ENABLE_MODULES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(PLATFORM_DIR)/Developer/Library/Frameworks", "$(inherited)", @@ -535,6 +540,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReloadlyAuthentication_Example.app/ReloadlyAuthentication_Example"; @@ -546,6 +552,7 @@ baseConfigurationReference = 67341B0D82C5099B1167DA22 /* Pods-ReloadlyAuthentication_Tests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ENABLE_MODULES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(PLATFORM_DIR)/Developer/Library/Frameworks", "$(inherited)", diff --git a/Example/ReloadlyAuthentication/Info.plist b/Example/ReloadlyAuthentication/Info.plist index e5e86d5..5002f3c 100644 --- a/Example/ReloadlyAuthentication/Info.plist +++ b/Example/ReloadlyAuthentication/Info.plist @@ -5,11 +5,11 @@ CFBundleDevelopmentRegion en ReloadlySDKClientId - + CnRq3ACS1AsOYb2hnW8iEAOZq09pEPOT ReloadlySDKSecretId - + 0Q8t7n7chP-KESrM0Mauy6U3UmxGR9-ATE0k8CuLoSVk7cDF1Yz2pI7mAh5TcEg ReloadlySDKEnvironment - sandbox + giftcardSandbox CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/Example/Tests/AutenticationTest.swift b/Example/Tests/AutenticationTest.swift index 8ba9757..21ca470 100644 --- a/Example/Tests/AutenticationTest.swift +++ b/Example/Tests/AutenticationTest.swift @@ -6,7 +6,7 @@ class AutenticationTests: XCTestCase { super.setUp() ReloadlyAuthentication.shared.configure(with: "NxhvFxDrXtX34VL1DLHsbQGLOPgE8qL9", clientSecret: "c7gcNR4dOIAlmalojV35okbq--tqqVhPPr2bvcsXlmKadewvaXdRSxENwfpyFywh", - service: AuthenticationService(backendEnvironment: .sandbox)) + service: AuthenticationService(backendEnvironment: .airtimeSandbox)) } override func tearDown() { @@ -34,7 +34,7 @@ class AutenticationTests: XCTestCase { let proxy = ProxyConfigurator(hostUrl: "localhost", port: 80, username: "username", password: "password") ReloadlyAuthentication.shared.configure(with: "id", clientSecret: "id", - service: AuthenticationService(backendEnvironment: .sandbox), logLevel: .debug, proxyConfiguration: proxy) + service: AuthenticationService(backendEnvironment: .airtimeSandbox), logLevel: .debug, proxyConfiguration: proxy) ReloadlyAuthentication.shared.requestAccessToken() { result in switch result { case .success(let token): diff --git a/Example/Tests/ReloadlyAirtimeTest.swift b/Example/Tests/ReloadlyAirtimeTest.swift index 16d4738..b9f5afd 100644 --- a/Example/Tests/ReloadlyAirtimeTest.swift +++ b/Example/Tests/ReloadlyAirtimeTest.swift @@ -15,7 +15,7 @@ class ReloadlyAirtimeTest: XCTestCase { super.setUp() ReloadlyAuthentication.shared.configure(with: "NxhvFxDrXtX34VL1DLHsbQGLOPgE8qL9", clientSecret: "c7gcNR4dOIAlmalojV35okbq--tqqVhPPr2bvcsXlmKadewvaXdRSxENwfpyFywh", - service: AuthenticationService(backendEnvironment: .sandbox)) + service: AuthenticationService(backendEnvironment: .airtimeSandbox)) ReloadlyAuthentication.shared.requestAccessToken() { result in XCTAssertNotNil(result) } @@ -126,7 +126,7 @@ class ReloadlyAirtimeTest: XCTestCase { let proxy = ProxyConfigurator(hostUrl: "localhost", port: 80, username: "username", password: "password") ReloadlyAuthentication.shared.configure(with: "NxhvFxDrXtX34VL1DLHsbQGLOPgE8qL9", clientSecret: "c7gcNR4dOIAlmalojV35okbq--tqqVhPPr2bvcsXlmKadewvaXdRSxENwfpyFywh", - service: AuthenticationService(backendEnvironment: .sandbox), proxyConfiguration: proxy) + service: AuthenticationService(backendEnvironment: .airtimeSandbox), proxyConfiguration: proxy) ReloadlyAirtime.shared.getAccountBalance() { result in XCTAssertNotNil(result) } @@ -136,7 +136,7 @@ class ReloadlyAirtimeTest: XCTestCase { func testNotExpiredToken() { ReloadlyAuthentication.shared.configure(with: "NxhvFxDrXtX34VL1DLHsbQGLOPgE8qL9", clientSecret: "c7gcNR4dOIAlmalojV35okbq--tqqVhPPr2bvcsXlmKadewvaXdRSxENwfpyFywh", - service: AuthenticationService(backendEnvironment: .sandbox)) + service: AuthenticationService(backendEnvironment: .airtimeSandbox)) ReloadlyAuthentication.shared.requestAccessToken(completionHandler: { result in XCTAssertNotNil(result) }) @@ -145,7 +145,7 @@ class ReloadlyAirtimeTest: XCTestCase { func testEmptyToken() { ReloadlyAuthentication.shared.configure(with: "", clientSecret: "", - service: AuthenticationService(backendEnvironment: .sandbox)) + service: AuthenticationService(backendEnvironment: .airtimeSandbox)) ReloadlyAuthentication.shared.requestAccessToken(completionHandler: { result in XCTAssertNotNil(result) }) @@ -176,8 +176,8 @@ class ReloadlyAirtimeTest: XCTestCase { func testEnvironment() { - let service = AuthenticationService(backendEnvironment: .production) - service.backendEnvironment = .sandbox + let service = AuthenticationService(backendEnvironment: .airtimeProduction) + service.backendEnvironment = .airtimeSandbox XCTAssertNotNil(service) } @@ -209,7 +209,7 @@ class ReloadlyAirtimeTest: XCTestCase { func testDiscountsModel() { - let discount = Discounts(content: [Content(percentage: 2.2, internationalPercentage: 23.21, localPercentage: 13.1, updatedAt: nil, contentOperator: nil)], pageable: Pageable(sort: Sort(unsorted: false, sorted: false, empty: false), pageNumber: 1, pageSize: 2, offset: 2, unpaged: false, paged: false), totalElements: 1, totalPages: 3, last: false, sort: Sort(unsorted: false, sorted: false, empty: false), first: false, numberOfElements: 3, size: 3, number: 3, empty: false) + let discount = Discounts(content: [Discount(percentage: 2.2, internationalPercentage: 23.21, localPercentage: 13.1, updatedAt: nil, contentOperator: nil)], pageable: Pageable(sort: Sort(unsorted: false, sorted: false, empty: false), pageNumber: 1, pageSize: 2, offset: 2, unpaged: false, paged: false), totalElements: 1, totalPages: 3, last: false, sort: Sort(unsorted: false, sorted: false, empty: false), first: false, numberOfElements: 3, size: 3, number: 3, empty: false) XCTAssertEqual(2.2, discount.content.first?.percentage) } @@ -230,7 +230,7 @@ class ReloadlyAirtimeTest: XCTestCase { func testRequestAuth() { ReloadlyAuthentication.shared.configure(with: "NxhvFxDrXtX34VL1DLHsbQGLOPgE8qL9", clientSecret: "c7gcNR4dOIAlmalojV35okbq--tqqVhPPr2bvcsXlmKadewvaXdRSxENwfpyFywh", - service: AuthenticationService(backendEnvironment: .sandbox)) + service: AuthenticationService(backendEnvironment: .airtimeSandbox)) ReloadlyAuthentication.shared.requestAccessToken() { result in XCTAssertNotNil(result) } diff --git a/Example/Tests/ReloadlyGiftcardTest.swift b/Example/Tests/ReloadlyGiftcardTest.swift new file mode 100644 index 0000000..76b603a --- /dev/null +++ b/Example/Tests/ReloadlyGiftcardTest.swift @@ -0,0 +1,100 @@ +// +// ReloadlyGiftcardTest.swift +// ReloadlyAuthentication_Tests +// +// Created by Tarik on 22.11.2021. +// Copyright © 2021 CocoaPods. All rights reserved. +// + +import XCTest +@testable import ReloadlySDK + + +class ReloadlyGiftcardTest: XCTestCase { + + override func setUp() { + super.setUp() + ReloadlyAuthentication.shared.configure(with: "CnRq3ACS1AsOYb2hnW8iEAOZq09pEPOT", + clientSecret: "0Q8t7n7chP-KESrM0Mauy6U3UmxGR9-ATE0k8CuLoSVk7cDF1Yz2pI7mAh5TcEg", + service: AuthenticationService(backendEnvironment: .giftcardSandbox)) + ReloadlyAuthentication.shared.requestAccessToken() { result in + XCTAssertNotNil(result) + } + } + + func testGetAllProducts() { + ReloadlyGiftcard.shared.getAllProducts() { result in + XCTAssertNotNil(result) + } + } + + func testGetAllProductsWithParams() { + ReloadlyGiftcard.shared.getAllProducts(includeRange: true, includeFixed: true) { result in + XCTAssertNotNil(result) + } + } + + func testGetAllProductsWithId() { + ReloadlyGiftcard.shared.getProduct(by: 1) { result in + XCTAssertNotNil(result) + } + } + + func testRedeemCodeWithId() { + ReloadlyGiftcard.shared.redeemCode(by: 617) { result in + XCTAssertNotNil(result) + } + } + + func testDiscounts() { + ReloadlyGiftcard.shared.discounts() { result in + XCTAssertNotNil(result) + } + } + + func testDiscountsById() { + ReloadlyGiftcard.shared.discounts(by: 1) { result in + XCTAssertNotNil(result) + } + } + + func testAllTransactions() { + ReloadlyGiftcard.shared.allTransactions() { result in + XCTAssertNotNil(result) + } + } + + func testGetProductByISO() { + ReloadlyGiftcard.shared.getProductByISO() { result in + XCTAssertNotNil(result) + } + } + + func testRedeemInstructionById() { + ReloadlyGiftcard.shared.redeemInstruction(by: 1) { result in + XCTAssertNotNil(result) + } + } + + func testRedeemInstructions() { + ReloadlyGiftcard.shared.redeemInstruction() { result in + XCTAssertNotNil(result) + } + } + + func testOrderGiftcard() { + ReloadlyGiftcard.shared.orderGiftcard(with: 1, countryCode: "US", quantity: 1, unitPrice: 25.00, customIdentifier: "obucks10", senderName: "John Doe", recipientEmail: "anyone@email.com") { result in + XCTAssertNotNil(result) + } + } + + func testModes() { + let orderGiftcard = OrderGiftcard(transactionId: 1, amount: 1.2, discount: 12.1, currencyCode: "ds", fee: 12.12, recipientEmail: "sd", customIdentifier: "sd", status: "fsff", product: Discount(percentage: 1.1, internationalPercentage: 1.2, localPercentage: 32.2, updatedAt: "sdfs", contentOperator: Operator(id: 23, operatorId: 23, name: "sf", countryCode: "dsf", data: false, bundle: false, status: false)), transactionCreatedTime: "sdas") + XCTAssertEqual(1, orderGiftcard.transactionId) + let redeemCode = RedeemCode(cardNumber: "4343", pinCode: "1234") + XCTAssertEqual("4343", redeemCode.cardNumber) + let products = Products(content: [ProductContent](), pageable: nil, last: nil, totalPages: nil, totalElements: nil, first: nil, sort: nil, numberOfElements: nil, size: nil, number: nil, empty: nil) + XCTAssertEqual(0, products.content?.count) + } + +} diff --git a/ReloadlySDK.podspec b/ReloadlySDK.podspec index 67d7ecb..bd8ac9e 100644 --- a/ReloadlySDK.podspec +++ b/ReloadlySDK.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'ReloadlySDK' - s.version = '1.0.3' + s.version = '1.0.4' s.summary = 'The Reloadly SDK to easily work with Reloadly Services' @@ -21,7 +21,7 @@ The Reloadly SDK for iOS enables iOS developers to easily work with Reloadly Ser s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { '4taras4' => '4taras4@gmail.com' } s.source = { :git => 'https://github.com/Reloadly/reloadly-sdk-ios.git', :tag => s.version.to_s } - s.swift_version = ['4.2', '5.0'] + s.swift_version = ['4.2', '5.3'] s.ios.deployment_target = '10.0' s.source_files = 'ReloadlySDK/Classes/**/*' @@ -36,4 +36,7 @@ The Reloadly SDK for iOS enables iOS developers to easily work with Reloadly Ser co.source_files = "ReloadlySDK/Classes/ReloadlyAuthentication/**/*.swift" end + s.subspec 'Giftcard' do |co| + co.source_files = "ReloadlySDK/Classes/ReloadlyGiftcard/**/*.swift" + end end diff --git a/ReloadlySDK/Classes/ReloadlyAirtime/Models/CountryModel.swift b/ReloadlySDK/Classes/ReloadlyAirtime/Models/CountryModel.swift index 89965aa..58272ca 100644 --- a/ReloadlySDK/Classes/ReloadlyAirtime/Models/CountryModel.swift +++ b/ReloadlySDK/Classes/ReloadlyAirtime/Models/CountryModel.swift @@ -8,12 +8,12 @@ import Foundation public struct Country: Codable { - public var isoName: String - public var name: String - public var currencyCode: String - public var currencyName: String - public var currencySymbol: String - public var flag: String - public var callingCodes: [String] + public var isoName: String? + public var name: String? + public var currencyCode: String? + public var currencyName: String? + public var currencySymbol: String? + public var flag: String? + public var callingCodes: [String]? } diff --git a/ReloadlySDK/Classes/ReloadlyAirtime/Models/DiscountsModel.swift b/ReloadlySDK/Classes/ReloadlyAirtime/Models/DiscountsModel.swift index 6583202..377cfb3 100644 --- a/ReloadlySDK/Classes/ReloadlyAirtime/Models/DiscountsModel.swift +++ b/ReloadlySDK/Classes/ReloadlyAirtime/Models/DiscountsModel.swift @@ -9,7 +9,7 @@ import Foundation // MARK: - Discounts public struct Discounts: Codable { - public let content: [Content] + public let content: [Discount] public let pageable: Pageable public let totalElements: Int public let totalPages: Int @@ -21,7 +21,7 @@ public struct Discounts: Codable { public let number: Int public let empty: Bool - public init(content: [Content], pageable: Pageable, totalElements: Int, totalPages: Int, last: Bool, sort: Sort, first: Bool, numberOfElements: Int, size: Int, number: Int, empty: Bool) { + public init(content: [Discount], pageable: Pageable, totalElements: Int, totalPages: Int, last: Bool, sort: Sort, first: Bool, numberOfElements: Int, size: Int, number: Int, empty: Bool) { self.content = content self.pageable = pageable self.totalElements = totalElements @@ -66,7 +66,7 @@ public struct Transactions: Codable { } // MARK: - Content -public struct Content: Codable { +public struct Discount: Codable { public let percentage: Double? public let internationalPercentage: Double? public let localPercentage: Double? diff --git a/ReloadlySDK/Classes/ReloadlyAirtime/ReloadlyAirtime.swift b/ReloadlySDK/Classes/ReloadlyAirtime/ReloadlyAirtime.swift index d98ccd6..f631e5f 100644 --- a/ReloadlySDK/Classes/ReloadlyAirtime/ReloadlyAirtime.swift +++ b/ReloadlySDK/Classes/ReloadlyAirtime/ReloadlyAirtime.swift @@ -60,11 +60,11 @@ public class ReloadlyAirtime { } } - public func getDiscountsByOperator(id: Int, completionHandler: @escaping (Result) -> Void) { + public func getDiscountsByOperator(id: Int, completionHandler: @escaping (Result) -> Void) { NetworkManager.shared.dataTask(serviceURL: "/operators/\(id)/commissions", httpMethod: .get, parameters: nil, proxyConfigurator: ReloadlyAuthentication.shared.proxyConfiguration) { result in switch result { case .success(let data): - let discount: Result = self.processSuccess(data: data) + let discount: Result = self.processSuccess(data: data) completionHandler(discount) case .failure(let error): completionHandler(.failure(error)) @@ -112,11 +112,11 @@ public class ReloadlyAirtime { } - public func getTransactionById(id: Int, completionHandler: @escaping (Result) -> Void) { + public func getTransactionById(id: Int, completionHandler: @escaping (Result) -> Void) { NetworkManager.shared.dataTask(serviceURL: "/topups/reports/transactions/\(id)", httpMethod: .get, parameters: nil, proxyConfigurator: ReloadlyAuthentication.shared.proxyConfiguration) { result in switch result { case .success(let data): - let discount: Result = self.processSuccess(data: data) + let discount: Result = self.processSuccess(data: data) completionHandler(discount) case .failure(let error): completionHandler(.failure(error)) diff --git a/ReloadlySDK/Classes/ReloadlyAuthentication/Network/NetworkManager.swift b/ReloadlySDK/Classes/ReloadlyAuthentication/Network/NetworkManager.swift index e3c23cb..6d06415 100644 --- a/ReloadlySDK/Classes/ReloadlyAuthentication/Network/NetworkManager.swift +++ b/ReloadlySDK/Classes/ReloadlyAuthentication/Network/NetworkManager.swift @@ -30,7 +30,7 @@ class NetworkManager { private func requestAuth(serviceURL: String, httpMethod: HttpMethod, parameters: [String:String]?, proxyConfigurator: ProxyConfigurator? = nil, completion: @escaping (Result) -> Void) -> Void { - var request = URLRequest(url: URL(string: "https://auth.reloadly.com\(serviceURL)")!) + var request = URLRequest(url: URL(string: "\(ReloadlyAuthentication.shared.service.backendEnvironment.authURL)\(serviceURL)")!) request.addValue("application/json", forHTTPHeaderField: "Content-Type") request.httpMethod = httpMethod.rawValue diff --git a/ReloadlySDK/Classes/ReloadlyAuthentication/ReloadlyAuthentication.swift b/ReloadlySDK/Classes/ReloadlyAuthentication/ReloadlyAuthentication.swift index 50b2c85..74e9431 100644 --- a/ReloadlySDK/Classes/ReloadlyAuthentication/ReloadlyAuthentication.swift +++ b/ReloadlySDK/Classes/ReloadlyAuthentication/ReloadlyAuthentication.swift @@ -18,8 +18,8 @@ public class ReloadlyAuthentication { public static let shared = ReloadlyAuthentication() let storageKey = "OAuth2Token" - /// Service's backend environment. Default value is `.production`. Make sure to use `.production` in you release (App Store) - public private(set) var service: AuthenticationServiceProtocol = AuthenticationService(backendEnvironment: .sandbox) + /// Service's backend environment. Default value is `.airtimeSandbox`. Make sure to use `.airtimeProduction` in you release (App Store) + public private(set) var service: AuthenticationServiceProtocol = AuthenticationService(backendEnvironment: .airtimeSandbox) let storage = Keychain() private var clientId: String? private var clientSecret: String? @@ -57,7 +57,7 @@ public class ReloadlyAuthentication { */ public func configure(with clientId: String? = nil, clientSecret: String? = nil, service: AuthenticationServiceProtocol? = nil, logLevel: Level = .info, proxyConfiguration: ProxyConfigurator? = nil, useTelemetry: Bool = true) { let dictionary = Bundle.main.infoDictionary - self.service = service ?? AuthenticationService(backendEnvironment: (dictionary?["ReloadlySDKEnvironment"] as? String) ?? "sandbox") + self.service = service ?? AuthenticationService(backendEnvironment: (dictionary?["ReloadlySDKEnvironment"] as? String) ?? "airtimeSandbox") self.clientId = clientId ?? (dictionary?["ReloadlySDKClientId"] as? String) ?? "" self.clientSecret = clientSecret ?? (dictionary?["ReloadlySDKSecretId"] as? String) ?? "" self.logger.minLevel = logLevel diff --git a/ReloadlySDK/Classes/ReloadlyAuthentication/Utilities/AuthenticationBackendEnvironment.swift b/ReloadlySDK/Classes/ReloadlyAuthentication/Utilities/AuthenticationBackendEnvironment.swift index cb7cb17..d02b647 100644 --- a/ReloadlySDK/Classes/ReloadlyAuthentication/Utilities/AuthenticationBackendEnvironment.swift +++ b/ReloadlySDK/Classes/ReloadlyAuthentication/Utilities/AuthenticationBackendEnvironment.swift @@ -9,14 +9,26 @@ import Foundation import Foundation public enum AuthenticationBackendEnvironment: String { - case production - case sandbox + case airtimeProduction + case airtimeSandbox + case giftcardProduction + case giftcardSandbox var baseURL: String { let environment = ReloadlyAuthentication.shared.service.backendEnvironment switch environment { - case .production: return "https://topups.reloadly.com" - case .sandbox: return "https://topups-sandbox.reloadly.com" + case .airtimeProduction: return "https://topups.reloadly.com" + case .airtimeSandbox: return "https://topups-sandbox.reloadly.com" + case .giftcardProduction: return "https://giftcards.reloadly.com" + case .giftcardSandbox: return "https://giftcards-sandbox.reloadly.com" + } + } + + var authURL: String { + let environment = ReloadlyAuthentication.shared.service.backendEnvironment + switch environment { + case .airtimeSandbox, .airtimeProduction: return "https://auth.reloadly.com" + case .giftcardSandbox, .giftcardProduction: return "https://auth.reloadly.com" } } } diff --git a/ReloadlySDK/Classes/ReloadlyAuthentication/Utilities/AuthenticationService.swift b/ReloadlySDK/Classes/ReloadlyAuthentication/Utilities/AuthenticationService.swift index 411e02d..bb5f3c1 100644 --- a/ReloadlySDK/Classes/ReloadlyAuthentication/Utilities/AuthenticationService.swift +++ b/ReloadlySDK/Classes/ReloadlyAuthentication/Utilities/AuthenticationService.swift @@ -26,7 +26,7 @@ public final class AuthenticationService: AuthenticationServiceProtocol { } public init(backendEnvironment: String) { - self.backendEnvironment = AuthenticationBackendEnvironment(rawValue: backendEnvironment) ?? .sandbox + self.backendEnvironment = AuthenticationBackendEnvironment(rawValue: backendEnvironment) ?? .airtimeSandbox } private func notifyAboutUpdate() { diff --git a/ReloadlySDK/Classes/ReloadlyGiftcard/Models/OrderGiftcardModel.swift b/ReloadlySDK/Classes/ReloadlyGiftcard/Models/OrderGiftcardModel.swift new file mode 100644 index 0000000..279eefc --- /dev/null +++ b/ReloadlySDK/Classes/ReloadlyGiftcard/Models/OrderGiftcardModel.swift @@ -0,0 +1,34 @@ +// +// OrderGiftcard.swift +// ReloadlySDK +// +// Created by Tarik on 22.11.2021. +// + +import Foundation + +public struct OrderGiftcard: Codable { + public let transactionId: Int? + public let amount: Double? + public let discount: Double? + public let currencyCode: String? + public let fee: Double? + public let recipientEmail: String? + public let customIdentifier: String? + public let status: String? + public let product: Discount? + public let transactionCreatedTime: String? + + public init(transactionId: Int?, amount: Double?, discount: Double?, currencyCode: String?, fee: Double?, recipientEmail: String?, customIdentifier: String?, status: String?, product: Discount?, transactionCreatedTime: String?) { + self.transactionId = transactionId + self.amount = amount + self.discount = discount + self.currencyCode = currencyCode + self.fee = fee + self.recipientEmail = recipientEmail + self.customIdentifier = customIdentifier + self.status = status + self.product = product + self.transactionCreatedTime = transactionCreatedTime + } +} diff --git a/ReloadlySDK/Classes/ReloadlyGiftcard/Models/ProductsModel.swift b/ReloadlySDK/Classes/ReloadlyGiftcard/Models/ProductsModel.swift new file mode 100644 index 0000000..a365796 --- /dev/null +++ b/ReloadlySDK/Classes/ReloadlyGiftcard/Models/ProductsModel.swift @@ -0,0 +1,98 @@ +import Foundation + +// MARK: - Products +public struct Products: Codable { + public let content: [ProductContent]? + public let pageable: Pageable? + public let last: Bool? + public let totalPages: Int? + public let totalElements: Int? + public let first: Bool? + public let sort: Sort? + public let numberOfElements: Int? + public let size: Int? + public let number: Int? + public let empty: Bool? + + public init(content: [ProductContent]?, pageable: Pageable?, last: Bool?, totalPages: Int?, totalElements: Int?, first: Bool?, sort: Sort?, numberOfElements: Int?, size: Int?, number: Int?, empty: Bool?) { + self.content = content + self.pageable = pageable + self.last = last + self.totalPages = totalPages + self.totalElements = totalElements + self.first = first + self.sort = sort + self.numberOfElements = numberOfElements + self.size = size + self.number = number + self.empty = empty + } +} + +// MARK: - Content +public struct ProductContent: Codable { + public let productId: Int? + public let productName: String? + public let global: Bool? + public let senderFee: Double? + public let discountPercentage: Double? + public let denominationType: String? + public let recipientCurrencyCode: String? + public let minRecipientDenomination: String? + public let maxRecipientDenomination: String? + public let senderCurrencyCode: String? + public let minSenderDenomination: String? + public let maxSenderDenomination: String? + public let fixedRecipientDenominations: [Double]? + public let fixedSenderDenominations: [Double]? + public let fixedRecipientToSenderDenominationsMap: [String: Double]? + public let logoUrls: [String]? + public let brand: Brand? + public let country: Country? + public let redeemInstruction: RedeemInstruction? + + public init(productId: Int?, productName: String? = nil, global: Bool? = nil, senderFee: Double? = nil, discountPercentage: Double? = nil, denominationType: String? = nil, recipientCurrencyCode: String? = nil, minRecipientDenomination: String? = nil, maxRecipientDenomination: String? = nil, senderCurrencyCode: String? = nil, minSenderDenomination: String? = nil, maxSenderDenomination: String? = nil, fixedRecipientDenominations: [Double]? = nil, fixedSenderDenominations: [Double]? = nil, fixedRecipientToSenderDenominationsMap: [String: Double]? = nil, logoUrls: [String]? = nil, brand: Brand? = nil, country: Country? = nil, redeemInstruction: RedeemInstruction? = nil) { + self.productId = productId + self.productName = productName + self.global = global + self.senderFee = senderFee + self.discountPercentage = discountPercentage + self.denominationType = denominationType + self.recipientCurrencyCode = recipientCurrencyCode + self.minRecipientDenomination = minRecipientDenomination + self.maxRecipientDenomination = maxRecipientDenomination + self.senderCurrencyCode = senderCurrencyCode + self.minSenderDenomination = minSenderDenomination + self.maxSenderDenomination = maxSenderDenomination + self.fixedRecipientDenominations = fixedRecipientDenominations + self.fixedSenderDenominations = fixedSenderDenominations + self.fixedRecipientToSenderDenominationsMap = fixedRecipientToSenderDenominationsMap + self.logoUrls = logoUrls + self.brand = brand + self.country = country + self.redeemInstruction = redeemInstruction + } +} + +// MARK: - Brand +public struct Brand: Codable { + public let brandId: Int? + public let brandName: String? + + public init(brandId: Int?, brandName: String?) { + self.brandId = brandId + self.brandName = brandName + } +} + + +// MARK: - RedeemInstruction +public struct RedeemInstruction: Codable { + public let concise: String? + public let verbose: String? + + public init(concise: String?, verbose: String?) { + self.concise = concise + self.verbose = verbose + } +} diff --git a/ReloadlySDK/Classes/ReloadlyGiftcard/Models/RedeemCodeModel.swift b/ReloadlySDK/Classes/ReloadlyGiftcard/Models/RedeemCodeModel.swift new file mode 100644 index 0000000..84c2122 --- /dev/null +++ b/ReloadlySDK/Classes/ReloadlyGiftcard/Models/RedeemCodeModel.swift @@ -0,0 +1,18 @@ +// +// RedeemCodeModel.swift +// ReloadlySDK +// +// Created by Tarik on 22.11.2021. +// + +import Foundation + +public struct RedeemCode: Codable { + public let cardNumber: String? + public let pinCode: String? + + public init(cardNumber: String?, pinCode: String?) { + self.cardNumber = cardNumber + self.pinCode = pinCode + } +} diff --git a/ReloadlySDK/Classes/ReloadlyGiftcard/ReloadlyGiftcard.swift b/ReloadlySDK/Classes/ReloadlyGiftcard/ReloadlyGiftcard.swift new file mode 100644 index 0000000..fd89d01 --- /dev/null +++ b/ReloadlySDK/Classes/ReloadlyGiftcard/ReloadlyGiftcard.swift @@ -0,0 +1,179 @@ +// +// ReloadlyGiftcard.swift +// ReloadlySDK +// +// Created by Tarik on 21.11.2021. +// + +import Foundation + +public class ReloadlyGiftcard { + + public static let shared = ReloadlyGiftcard() + + public func getAllProducts(includeRange: Bool = false, includeFixed: Bool = false, completionHandler: @escaping (Result) -> Void) { + NetworkManager.shared.dataTask(serviceURL: "/products?includeRange=\(includeRange)&includeFixed=\(includeFixed)", httpMethod: .get, parameters: nil, proxyConfigurator: ReloadlyAuthentication.shared.proxyConfiguration) { result in + switch result { + case .success(let data): + let result: Result = self.processSuccess(data: data) + completionHandler(result) + case .failure(let error): + completionHandler(.failure(error)) + } + } + } + + public func getProduct(by id: Int, completionHandler: @escaping (Result) -> Void) { + NetworkManager.shared.dataTask(serviceURL: "/products/\(id)", httpMethod: .get, parameters: nil, proxyConfigurator: ReloadlyAuthentication.shared.proxyConfiguration) { result in + switch result { + case .success(let data): + let result: Result = self.processSuccess(data: data) + completionHandler(result) + case .failure(let error): + completionHandler(.failure(error)) + } + } + } + + public func getProductByISO(countryCode: String, completionHandler: @escaping (Result) -> Void) { + NetworkManager.shared.dataTask(serviceURL: "/countries/\(countryCode)/products", httpMethod: .get, parameters: nil, proxyConfigurator: ReloadlyAuthentication.shared.proxyConfiguration) { result in + switch result { + case .success(let data): + let result: Result = self.processSuccess(data: data) + completionHandler(result) + case .failure(let error): + completionHandler(.failure(error)) + } + } + } + + public func redeemInstruction(completionHandler: @escaping (Result<[Brand], Error>) -> Void) { + NetworkManager.shared.dataTask(serviceURL: "/redeem-instructions", httpMethod: .get, parameters: nil, proxyConfigurator: ReloadlyAuthentication.shared.proxyConfiguration) { result in + switch result { + case .success(let data): + let result: Result<[Brand], Error> = self.processSuccess(data: data) + completionHandler(result) + case .failure(let error): + completionHandler(.failure(error)) + } + } + } + + public func , completionHandler: @escaping (Result) -> Void) { + NetworkManager.shared.dataTask(serviceURL: "/redeem-instructions/\(id)", httpMethod: .get, parameters: nil, proxyConfigurator: ReloadlyAuthentication.shared.proxyConfiguration) { result in + switch result { + case .success(let data): + let result: Result = self.processSuccess(data: data) + completionHandler(result) + case .failure(let error): + completionHandler(.failure(error)) + } + } + } + + public func discounts(page: Int = 1, size: Int = 50, completionHandler: @escaping (Result) -> Void) { + NetworkManager.shared.dataTask(serviceURL: "/discounts?page=\(page)&size=\(size)", httpMethod: .get, parameters: nil, proxyConfigurator: ReloadlyAuthentication.shared.proxyConfiguration) { result in + switch result { + case .success(let data): + let result: Result = self.processSuccess(data: data) + completionHandler(result) + case .failure(let error): + completionHandler(.failure(error)) + } + } + } + + public func discounts(by productId: Int, completionHandler: @escaping (Result) -> Void) { + NetworkManager.shared.dataTask(serviceURL: "/products/\(productId)/discounts", httpMethod: .get, parameters: nil, proxyConfigurator: ReloadlyAuthentication.shared.proxyConfiguration) { result in + switch result { + case .success(let data): + let result: Result = self.processSuccess(data: data) + completionHandler(result) + case .failure(let error): + completionHandler(.failure(error)) + } + } + } + public func allTransactions(completionHandler: @escaping (Result) -> Void) { + let url = "/reports/transactions" + NetworkManager.shared.dataTask(serviceURL: url, httpMethod: .get, parameters: nil, proxyConfigurator: ReloadlyAuthentication.shared.proxyConfiguration) { result in + switch result { + case .success(let data): + let result: Result = self.processSuccess(data: data) + completionHandler(result) + case .failure(let error): + completionHandler(.failure(error)) + } + } + } + + public func transaction(by id: Int, completionHandler: @escaping (Result) -> Void) { + NetworkManager.shared.dataTask(serviceURL: "/reports/transactions/\(id)", httpMethod: .get, parameters: nil, proxyConfigurator: ReloadlyAuthentication.shared.proxyConfiguration) { result in + switch result { + case .success(let data): + let result: Result = self.processSuccess(data: data) + completionHandler(result) + case .failure(let error): + completionHandler(.failure(error)) + } + } + } + + + public func orderGiftcard(with productId: Int, + countryCode: String, + quantity: Int, + unitPrice: Double, + customIdentifier: String, + senderName: String, + recipientEmail: String, completionHandler: @escaping (Result) -> Void) { + let parameters: [String: Any] = [ + "productId": productId, + "countryCode": countryCode, + "quantity": quantity, + "unitPrice": unitPrice, + "customIdentifier": customIdentifier, + "senderName": senderName, + "recipientEmail": recipientEmail] + + NetworkManager.shared.dataTask(serviceURL: "/orders", httpMethod: .post, parameters: parameters, proxyConfigurator: ReloadlyAuthentication.shared.proxyConfiguration) { result in + switch result { + case .success(let data): + let result: Result = self.processSuccess(data: data) + completionHandler(result) + case .failure(let error): + completionHandler(.failure(error)) + } + } + } + + public func redeemCode(by transactionId: Int, completionHandler: @escaping (Result<[RedeemCode], Error>) -> Void) { + NetworkManager.shared.dataTask(serviceURL: "/orders/transactions/\(transactionId)/cards", httpMethod: .get, parameters: nil, proxyConfigurator: ReloadlyAuthentication.shared.proxyConfiguration) { result in + switch result { + case .success(let data): + let result: Result<[RedeemCode], Error> = self.processSuccess(data: data) + completionHandler(result) + case .failure(let error): + completionHandler(.failure(error)) + } + } + } +} + +extension ReloadlyGiftcard { + func processSuccess(data: Data) -> Result { + do { + let model = try JSONDecoder().decode(T.self, from: data) + ReloadlyAuthentication.shared.logger.debug("Receive model: \(model)") + return .success(model) + } catch let error { + if let serverError: ErrorModel = try? JSONDecoder().decode(ErrorModel.self, from: data) { + ReloadlyAuthentication.shared.logger.error("\(serverError)") + return.failure(ServiceError.unableToProcesRequest(message: serverError.message)) + } else { + ReloadlyAuthentication.shared.logger.error("\(error)") + return.failure(error) + } + } + } +} From f3c49f462ae34a72af4b6db75d31a65f273a0276 Mon Sep 17 00:00:00 2001 From: DEV <4taras4@gmail.com> Date: Thu, 13 Jan 2022 20:21:13 +0200 Subject: [PATCH 2/3] Split to separate modules Airtime and giftcards Split to separate modules Airtime and giftcards --- Example/Podfile | 1 + Example/Pods/Pods.xcodeproj/project.pbxproj | 26 ++++---- ...ds-ReloadlyAuthentication_Example.xcscheme | 58 ++++++++++++++++++ ...Pods-ReloadlyAuthentication_Tests.xcscheme | 58 ++++++++++++++++++ .../xcschemes/ReloadlySDK.xcscheme | 58 ++++++++++++++++++ .../xcschemes/xcschememanagement.plist | 26 ++++++++ .../UserInterfaceState.xcuserstate | Bin 0 -> 34192 bytes Example/Tests/ReloadlyGiftcardTest.swift | 2 +- .../Models/BalanceModel.swift | 0 .../Models/CountryModel.swift | 0 .../Models/DiscountsModel.swift | 31 ---------- .../Models/OperatorModel.swift | 0 .../Models/PhoneModel.swift | 0 .../Models/PromotionModel.swift | 0 .../Models/SortModel.swift | 38 ++++++++++++ .../Models/TopupsModel.swift | 0 .../ReloadlyGiftcard/ReloadlyGiftcard.swift | 2 +- 17 files changed, 252 insertions(+), 48 deletions(-) create mode 100644 Example/Pods/Pods.xcodeproj/xcuserdata/tarik.xcuserdatad/xcschemes/Pods-ReloadlyAuthentication_Example.xcscheme create mode 100644 Example/Pods/Pods.xcodeproj/xcuserdata/tarik.xcuserdatad/xcschemes/Pods-ReloadlyAuthentication_Tests.xcscheme create mode 100644 Example/Pods/Pods.xcodeproj/xcuserdata/tarik.xcuserdatad/xcschemes/ReloadlySDK.xcscheme create mode 100644 Example/Pods/Pods.xcodeproj/xcuserdata/tarik.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 Example/ReloadlyAuthentication.xcworkspace/xcuserdata/tarik.xcuserdatad/UserInterfaceState.xcuserstate rename ReloadlySDK/Classes/{ReloadlyAirtime => ReloadlyAuthentication}/Models/BalanceModel.swift (100%) rename ReloadlySDK/Classes/{ReloadlyAirtime => ReloadlyAuthentication}/Models/CountryModel.swift (100%) rename ReloadlySDK/Classes/{ReloadlyAirtime => ReloadlyAuthentication}/Models/DiscountsModel.swift (79%) rename ReloadlySDK/Classes/{ReloadlyAirtime => ReloadlyAuthentication}/Models/OperatorModel.swift (100%) rename ReloadlySDK/Classes/{ReloadlyAirtime => ReloadlyAuthentication}/Models/PhoneModel.swift (100%) rename ReloadlySDK/Classes/{ReloadlyAirtime => ReloadlyAuthentication}/Models/PromotionModel.swift (100%) create mode 100644 ReloadlySDK/Classes/ReloadlyAuthentication/Models/SortModel.swift rename ReloadlySDK/Classes/{ReloadlyAirtime => ReloadlyAuthentication}/Models/TopupsModel.swift (100%) diff --git a/Example/Podfile b/Example/Podfile index b2be985..6da5c31 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -4,6 +4,7 @@ platform :ios, '10.0' target 'ReloadlyAuthentication_Example' do pod 'ReloadlySDK/Airtime', :path => '../' + pod 'ReloadlySDK/GiftCard', :path => '../' target 'ReloadlyAuthentication_Tests' do inherit! :search_paths diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index 5e65ff2..a0fef57 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -38,6 +38,7 @@ A4A680ABC25F8C9F730EA4BAEB52AEEC /* ReloadlySDK-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = EC41314C2A07D306BFC79E3E21C06C11 /* ReloadlySDK-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; D24AB5E778196E2BD8B6D9E376596715 /* Pods-ReloadlyAuthentication_Tests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 6827B24491E1DAA988C17129B8123E55 /* Pods-ReloadlyAuthentication_Tests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; EA87991AE9CC00F0A64D467E852AFDC1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */; }; + F331A5FD2790A35B00C3B416 /* SortModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331A5FC2790A35B00C3B416 /* SortModel.swift */; }; F3B7BE29274AD7990084A3BC /* ReloadlyGiftcard.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3B7BE28274AD7990084A3BC /* ReloadlyGiftcard.swift */; }; F3BDE029274BF552006983AB /* ProductsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3BDE028274BF552006983AB /* ProductsModel.swift */; }; F3BDE02D274BFE0E006983AB /* OrderGiftcardModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3BDE02C274BFE0E006983AB /* OrderGiftcardModel.swift */; }; @@ -114,6 +115,7 @@ EA173E0F1655BBE1D5D6DEE4B8F8828C /* Pods-ReloadlyAuthentication_Example-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-ReloadlyAuthentication_Example-frameworks.sh"; sourceTree = ""; }; EBE6EFD91CA2F531C1552AFA036FE598 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; EC41314C2A07D306BFC79E3E21C06C11 /* ReloadlySDK-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "ReloadlySDK-umbrella.h"; sourceTree = ""; }; + F331A5FC2790A35B00C3B416 /* SortModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SortModel.swift; sourceTree = ""; }; F3B7BE28274AD7990084A3BC /* ReloadlyGiftcard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReloadlyGiftcard.swift; sourceTree = ""; }; F3BDE028274BF552006983AB /* ProductsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductsModel.swift; sourceTree = ""; }; F3BDE02C274BFE0E006983AB /* OrderGiftcardModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderGiftcardModel.swift; sourceTree = ""; }; @@ -153,7 +155,6 @@ 1A7743BA26033FC700D34144 /* ReloadlyAirtime */ = { isa = PBXGroup; children = ( - 1A7743BB26033FC700D34144 /* Models */, 1A7743C326033FC700D34144 /* ReloadlyAirtime+Promotions.swift */, 1A7743C426033FC700D34144 /* ReloadlyAirtime.swift */, 1A7743C526033FC700D34144 /* ReloadlyAirtime+Operators.swift */, @@ -162,20 +163,6 @@ path = ReloadlySDK/Classes/ReloadlyAirtime; sourceTree = ""; }; - 1A7743BB26033FC700D34144 /* Models */ = { - isa = PBXGroup; - children = ( - 1A7743BC26033FC700D34144 /* BalanceModel.swift */, - 1A7743BD26033FC700D34144 /* CountryModel.swift */, - 1A7743BE26033FC700D34144 /* PhoneModel.swift */, - 1A7743BF26033FC700D34144 /* OperatorModel.swift */, - 1A7743C026033FC700D34144 /* PromotionModel.swift */, - 1A7743C126033FC700D34144 /* DiscountsModel.swift */, - 1A7743C226033FC700D34144 /* TopupsModel.swift */, - ); - path = Models; - sourceTree = ""; - }; 1A7743C826033FC700D34144 /* ReloadlyAuthentication */ = { isa = PBXGroup; children = ( @@ -212,6 +199,14 @@ children = ( 1A7743D426033FC700D34144 /* ErrorModel.swift */, 1A7743D526033FC700D34144 /* OAuth2Token.swift */, + 1A7743BD26033FC700D34144 /* CountryModel.swift */, + 1A7743BC26033FC700D34144 /* BalanceModel.swift */, + 1A7743BE26033FC700D34144 /* PhoneModel.swift */, + 1A7743BF26033FC700D34144 /* OperatorModel.swift */, + 1A7743C026033FC700D34144 /* PromotionModel.swift */, + 1A7743C126033FC700D34144 /* DiscountsModel.swift */, + 1A7743C226033FC700D34144 /* TopupsModel.swift */, + F331A5FC2790A35B00C3B416 /* SortModel.swift */, ); path = Models; sourceTree = ""; @@ -544,6 +539,7 @@ 1A7743E126033FC700D34144 /* DiscountsModel.swift in Sources */, 1A7743DE26033FC700D34144 /* PhoneModel.swift in Sources */, F3BDE02F274BFF2D006983AB /* RedeemCodeModel.swift in Sources */, + F331A5FD2790A35B00C3B416 /* SortModel.swift in Sources */, 1A7743E326033FC700D34144 /* ReloadlyAirtime+Promotions.swift in Sources */, 1A7743DD26033FC700D34144 /* CountryModel.swift in Sources */, 1A7743E026033FC700D34144 /* PromotionModel.swift in Sources */, diff --git a/Example/Pods/Pods.xcodeproj/xcuserdata/tarik.xcuserdatad/xcschemes/Pods-ReloadlyAuthentication_Example.xcscheme b/Example/Pods/Pods.xcodeproj/xcuserdata/tarik.xcuserdatad/xcschemes/Pods-ReloadlyAuthentication_Example.xcscheme new file mode 100644 index 0000000..a195fa4 --- /dev/null +++ b/Example/Pods/Pods.xcodeproj/xcuserdata/tarik.xcuserdatad/xcschemes/Pods-ReloadlyAuthentication_Example.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/Pods/Pods.xcodeproj/xcuserdata/tarik.xcuserdatad/xcschemes/Pods-ReloadlyAuthentication_Tests.xcscheme b/Example/Pods/Pods.xcodeproj/xcuserdata/tarik.xcuserdatad/xcschemes/Pods-ReloadlyAuthentication_Tests.xcscheme new file mode 100644 index 0000000..0a77550 --- /dev/null +++ b/Example/Pods/Pods.xcodeproj/xcuserdata/tarik.xcuserdatad/xcschemes/Pods-ReloadlyAuthentication_Tests.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/Pods/Pods.xcodeproj/xcuserdata/tarik.xcuserdatad/xcschemes/ReloadlySDK.xcscheme b/Example/Pods/Pods.xcodeproj/xcuserdata/tarik.xcuserdatad/xcschemes/ReloadlySDK.xcscheme new file mode 100644 index 0000000..ad3cc38 --- /dev/null +++ b/Example/Pods/Pods.xcodeproj/xcuserdata/tarik.xcuserdatad/xcschemes/ReloadlySDK.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/Pods/Pods.xcodeproj/xcuserdata/tarik.xcuserdatad/xcschemes/xcschememanagement.plist b/Example/Pods/Pods.xcodeproj/xcuserdata/tarik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..ef0f153 --- /dev/null +++ b/Example/Pods/Pods.xcodeproj/xcuserdata/tarik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,26 @@ + + + + + SchemeUserState + + Pods-ReloadlyAuthentication_Example.xcscheme + + isShown + + + Pods-ReloadlyAuthentication_Tests.xcscheme + + isShown + + + ReloadlySDK.xcscheme + + isShown + + + + SuppressBuildableAutocreation + + + diff --git a/Example/ReloadlyAuthentication.xcworkspace/xcuserdata/tarik.xcuserdatad/UserInterfaceState.xcuserstate b/Example/ReloadlyAuthentication.xcworkspace/xcuserdata/tarik.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000000000000000000000000000000000000..39457e1e2c72e13d70393a8fb9867372b2d796fa GIT binary patch literal 34192 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)4Z+u{^p&{hnwGP{=FrnC88y+C7~syCA%fB zrLaZYQrc42($v!0($QjRnb|U@MQmBna%;;&E$_4ntq!fjTfJLHwW?axtzoS(t?{kn zS|_$9wPv>#wN_4voDw}Hc}l^Q;whz5%BNIK(M_qH(mrL%6w8#UQ)Wz=HD%6}c~iDd zIX2}-vxhm*9BPg+$D5PQS>}9mjk&?xWNtCHnP-{jnnm*h^Fs3?^D6UN^PT3q%-!Z5 h^H%dN^FH%a=4Z?Y&4) -> Void) { + public func redeemInstruction(by id: Int, completionHandler: @escaping (Result) -> Void) { NetworkManager.shared.dataTask(serviceURL: "/redeem-instructions/\(id)", httpMethod: .get, parameters: nil, proxyConfigurator: ReloadlyAuthentication.shared.proxyConfiguration) { result in switch result { case .success(let data): From 61cf864982a766bae149ca2367048fc32177face Mon Sep 17 00:00:00 2001 From: DEV <4taras4@gmail.com> Date: Wed, 19 Jan 2022 18:36:22 +0200 Subject: [PATCH 3/3] Updated requests Updated requests --- Example/Pods/Pods.xcodeproj/project.pbxproj | 4 +++ .../Models/RecipientPhoneDetailsModel.swift | 4 +++ .../ReloadlyGiftcard/ReloadlyGiftcard.swift | 28 +++++++++++++++---- 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 ReloadlySDK/Classes/ReloadlyGiftcard/Models/RecipientPhoneDetailsModel.swift diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index a0fef57..60fbf7b 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -39,6 +39,7 @@ D24AB5E778196E2BD8B6D9E376596715 /* Pods-ReloadlyAuthentication_Tests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 6827B24491E1DAA988C17129B8123E55 /* Pods-ReloadlyAuthentication_Tests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; EA87991AE9CC00F0A64D467E852AFDC1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */; }; F331A5FD2790A35B00C3B416 /* SortModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331A5FC2790A35B00C3B416 /* SortModel.swift */; }; + F34FC6C22798739200B2CF05 /* RecipientPhoneDetailsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F34FC6C12798739100B2CF05 /* RecipientPhoneDetailsModel.swift */; }; F3B7BE29274AD7990084A3BC /* ReloadlyGiftcard.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3B7BE28274AD7990084A3BC /* ReloadlyGiftcard.swift */; }; F3BDE029274BF552006983AB /* ProductsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3BDE028274BF552006983AB /* ProductsModel.swift */; }; F3BDE02D274BFE0E006983AB /* OrderGiftcardModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3BDE02C274BFE0E006983AB /* OrderGiftcardModel.swift */; }; @@ -116,6 +117,7 @@ EBE6EFD91CA2F531C1552AFA036FE598 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; EC41314C2A07D306BFC79E3E21C06C11 /* ReloadlySDK-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "ReloadlySDK-umbrella.h"; sourceTree = ""; }; F331A5FC2790A35B00C3B416 /* SortModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SortModel.swift; sourceTree = ""; }; + F34FC6C12798739100B2CF05 /* RecipientPhoneDetailsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecipientPhoneDetailsModel.swift; sourceTree = ""; }; F3B7BE28274AD7990084A3BC /* ReloadlyGiftcard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReloadlyGiftcard.swift; sourceTree = ""; }; F3BDE028274BF552006983AB /* ProductsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductsModel.swift; sourceTree = ""; }; F3BDE02C274BFE0E006983AB /* OrderGiftcardModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderGiftcardModel.swift; sourceTree = ""; }; @@ -364,6 +366,7 @@ F3BDE028274BF552006983AB /* ProductsModel.swift */, F3BDE02C274BFE0E006983AB /* OrderGiftcardModel.swift */, F3BDE02E274BFF2D006983AB /* RedeemCodeModel.swift */, + F34FC6C12798739100B2CF05 /* RecipientPhoneDetailsModel.swift */, ); path = Models; sourceTree = ""; @@ -542,6 +545,7 @@ F331A5FD2790A35B00C3B416 /* SortModel.swift in Sources */, 1A7743E326033FC700D34144 /* ReloadlyAirtime+Promotions.swift in Sources */, 1A7743DD26033FC700D34144 /* CountryModel.swift in Sources */, + F34FC6C22798739200B2CF05 /* RecipientPhoneDetailsModel.swift in Sources */, 1A7743E026033FC700D34144 /* PromotionModel.swift in Sources */, 1A7743EE26033FC800D34144 /* NetworkManager.swift in Sources */, 1A7743F326033FC800D34144 /* ProxyConfigurator.swift in Sources */, diff --git a/ReloadlySDK/Classes/ReloadlyGiftcard/Models/RecipientPhoneDetailsModel.swift b/ReloadlySDK/Classes/ReloadlyGiftcard/Models/RecipientPhoneDetailsModel.swift new file mode 100644 index 0000000..baa8be4 --- /dev/null +++ b/ReloadlySDK/Classes/ReloadlyGiftcard/Models/RecipientPhoneDetailsModel.swift @@ -0,0 +1,4 @@ +public struct RecipientPhoneDetailsModel: Codable { + var countryCode:String? + var phoneNumber: String? +} diff --git a/ReloadlySDK/Classes/ReloadlyGiftcard/ReloadlyGiftcard.swift b/ReloadlySDK/Classes/ReloadlyGiftcard/ReloadlyGiftcard.swift index 5acdc74..9262b6f 100644 --- a/ReloadlySDK/Classes/ReloadlyGiftcard/ReloadlyGiftcard.swift +++ b/ReloadlySDK/Classes/ReloadlyGiftcard/ReloadlyGiftcard.swift @@ -60,7 +60,7 @@ public class ReloadlyGiftcard { } public func redeemInstruction(by id: Int, completionHandler: @escaping (Result) -> Void) { - NetworkManager.shared.dataTask(serviceURL: "/redeem-instructions/\(id)", httpMethod: .get, parameters: nil, proxyConfigurator: ReloadlyAuthentication.shared.proxyConfiguration) { result in + NetworkManager.shared.dataTask(serviceURL: "/brands/\(id)/redeem-instructions", httpMethod: .get, parameters: nil, proxyConfigurator: ReloadlyAuthentication.shared.proxyConfiguration) { result in switch result { case .success(let data): let result: Result = self.processSuccess(data: data) @@ -126,15 +126,33 @@ public class ReloadlyGiftcard { unitPrice: Double, customIdentifier: String, senderName: String, - recipientEmail: String, completionHandler: @escaping (Result) -> Void) { - let parameters: [String: Any] = [ + recipientEmail: String? = nil, + recipientPhoneDetails: RecipientPhoneDetailsModel? = nil, + completionHandler: @escaping (Result) -> Void) { + var parameters: [String: Any] = [ "productId": productId, "countryCode": countryCode, "quantity": quantity, "unitPrice": unitPrice, "customIdentifier": customIdentifier, - "senderName": senderName, - "recipientEmail": recipientEmail] + "senderName": senderName] + if let recipientEmail = recipientEmail { + parameters.updateValue(recipientEmail, forKey: "recipientEmail") + } + + if let recipientPhoneDetails = recipientPhoneDetails, + let countryCode = recipientPhoneDetails.countryCode, + let phone = recipientPhoneDetails.phoneNumber { + let value = ["countryCode": countryCode, + "phoneNumber": phone + ] + parameters.updateValue(value, forKey: "recipientPhoneDetails") + } + + if recipientEmail == nil && recipientPhoneDetails == nil { + completionHandler(.failure(ServiceError.unableToProcesRequest(message: "recipientPhoneDetails or recipientEmail should be filled"))) + return + } NetworkManager.shared.dataTask(serviceURL: "/orders", httpMethod: .post, parameters: parameters, proxyConfigurator: ReloadlyAuthentication.shared.proxyConfiguration) { result in switch result {