Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions Docs/Authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ Initialise the library using `AppDelegate`. You can set the `ClientId`, `SecretI
<key>ReloadlySDKSecretId</key>
<string>PUT_YOUR_RELOADLY_CLIENT_SECRET_HERE</string>
<key>ReloadlySDKEnvironment</key>
<string>sandbox</string>
<string>airtimeSandbox</string>
```


```swift
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand Down Expand Up @@ -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
Expand All @@ -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.


Expand All @@ -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)

```
156 changes: 156 additions & 0 deletions Docs/GiftcardsSDK.md
Original file line number Diff line number Diff line change
@@ -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)
}
}
```
4 changes: 4 additions & 0 deletions Docs/Sample_code.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions Example/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading