-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Travis CI User
committed
Sep 13, 2019
1 parent
dccf472
commit 59a0c53
Showing
5 changed files
with
104 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,12 +12,9 @@ fun createCustomer() { | |
carColor = "Silver", | ||
licensePlate = "OUTATIME" | ||
) | ||
val customerConsent = CustomerConsent( | ||
termsOfService = true, | ||
ageVerification = true | ||
) | ||
|
||
FlyBuy.customer.create(customerInfo, customerConsent) { customer, sdkError -> | ||
FlyBuy.customer.create(customerInfo, termOfService = true, | ||
ageVerification = true) { customer, sdkError -> | ||
// Handle customer or deal with error | ||
} | ||
} | ||
|
@@ -29,22 +26,15 @@ Create a customer account with email and password using information from the use | |
|
||
```kotlin | ||
fun createCustomerWithLogin() { | ||
val loginInfo = LoginInfo ( | ||
email = "[email protected]", | ||
password = "password" | ||
) | ||
val customerInfo = CustomerInfo ( | ||
name = "Marty McFly", | ||
carType = "DeLorean", | ||
carColor = "Silver", | ||
licensePlate = "OUTATIME" | ||
) | ||
val customerConsent = CustomerConsent( | ||
termsOfService = true, | ||
ageVerification = true | ||
) | ||
|
||
FlyBuy.customer.createWithLogin(customerInfo, loginInfo, customerConsent) { customer , sdkError -> | ||
FlyBuy.customer.createWithLogin(customerInfo, email = "[email protected]", password = "passwordk", | ||
termsOfService = true, ageVerification = true) { customer , sdkError -> | ||
// Handle customer or deal with error | ||
} | ||
} | ||
|
@@ -56,37 +46,27 @@ Link an email and password with the current anonymous logged in user. | |
|
||
```kotlin | ||
fun signUp() { | ||
val loginInfo = LoginInfo ( | ||
email = "[email protected]", | ||
password = "password" | ||
) | ||
|
||
FlyBuy.customer.signUp(loginInfo) { customer, sdkError -> | ||
FlyBuy.customer.signUp("[email protected]", "password") { customer, sdkError -> | ||
// Handle customer or deal with error | ||
} | ||
} | ||
``` | ||
|
||
## Sign In | ||
## Login | ||
|
||
Sign in the user in using existing credentials | ||
Login the user in using existing credentials | ||
|
||
```kotlin | ||
fun login() { | ||
val loginInfo = LoginInfo( | ||
email = "[email protected]", | ||
password = "password" | ||
) | ||
|
||
FlyBuy.customer.login(loginInfo) { customer, sdkError -> | ||
FlyBuy.customer.login("[email protected]", "password") { customer, sdkError -> | ||
// Handle customer or deal with error | ||
} | ||
} | ||
``` | ||
|
||
## Sign In with Token | ||
## Login with Token | ||
|
||
Sign in the user with a previously obtained customer API token | ||
Login the user with a previously obtained customer API token | ||
|
||
```kotlin | ||
fun loginWithToken() { | ||
|
@@ -96,13 +76,13 @@ fun loginWithToken() { | |
} | ||
``` | ||
|
||
## Sign out the current Customer | ||
## Log out the current Customer | ||
|
||
Signs out the current customer. | ||
Logs out the current customer. | ||
|
||
```kotlin | ||
fun signOut() { | ||
FlyBuy.customer.signOut { sdkError -> | ||
FlyBuy.customer.logout { sdkError -> | ||
// Handle error | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Sites | ||
|
||
Examples are in Kotlin. | ||
|
||
- [Fetch Sites](#fetch-sites) | ||
- [Fetch All Sites](#fetch-all-sites) | ||
|
||
## <span id="fetch-sites">Fetch Sites</span> | ||
|
||
Fetch sites for the app. The `query` parameter will return results that | ||
match the `partnerIdentifier` or `name` of the site. | ||
|
||
Note that this method uses pagination to retrieve sites. The | ||
`Pagination` object contains the current page and total pages. Use the | ||
`page` parameter of fetch along with the `Pagination` object in the | ||
callback to send subsequent requests to retrieve more sites. | ||
|
||
```kotlin | ||
FlyBuy.sites.fetch("1234", 1) { sites, pagination, sdkError -> | ||
// Handle orders or deal with error | ||
} | ||
``` | ||
|
||
Get the cached list of sites. | ||
|
||
``` | ||
FlyBuy.sites.all | ||
``` | ||
|
||
If you are using Android Jetpack, you can observe sites using `LiveData`. | ||
|
||
```kotlin | ||
val sites = FlyBuy.sites.allLiveData | ||
``` | ||
|
||
## <span id="fetch-all-sites">Fetch All Sites</span> | ||
|
||
Fetch all sites for the app. | ||
|
||
**IMPORTANT**: This method could result in long running operation with | ||
multiple API calls behind the scenes. It is recommended to only use this | ||
method with a `query` parameter to reduce the number of sites in the | ||
response. | ||
|
||
```kotlin | ||
FlyBuy.sites.fetchAll("1234") { sites, sdkError -> | ||
// Handle orders or deal with error | ||
} | ||
``` |