Skip to content

Commit

Permalink
Version 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis CI User committed Sep 13, 2019
1 parent dccf472 commit 59a0c53
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 42 deletions.
46 changes: 13 additions & 33 deletions doc/customer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand All @@ -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
}
}
Expand All @@ -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() {
Expand All @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion doc/notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ FlyBuy.customer.login(login.value ?: LoginInfo()) { customer, sdkError ->
}


FlyBuy.customer.signOut { sdkError ->
FlyBuy.customer.logout { sdkError ->
handleSdkError(sdkError)
FirebaseInstanceId.getInstance().deleteInstanceId()
}
Expand Down
19 changes: 11 additions & 8 deletions doc/orders.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,21 @@ FlyBuy.orders.claim(redemptionCode, customerInfo) { order, sdkError ->

## <span id="create-order">Create Order</span>

To create an order for the current customer, the app should call the `create` method. Note that a customer will be created if there isn't a customer currently logged in.
To create an order for the current customer, the app should call the `create` method.

```kotlin
val createOrderInfo = CreateOrderInfo (
siteID = 1,
partnerIdentifier = "1234",
val customerInfo = CustomerInfo (
name = "Marty McFly",
carType = "DeLorean",
carColor = "Silver",
licensePlate = "OUTATIME"
licensePlate = "OUTATIME",
phone = "555-555-5555"
)
FlyBuy.orders.create(createOrderInfo) { order, sdkError ->
FlyBuy.orders.create(
siteID = 1,
partnerIdentifier = "1234"
customerInfo,
) { order, sdkError ->
// If sdkError == null, order has been created
}
```
Expand All @@ -95,7 +98,7 @@ FlyBuy.orders.create(createOrderInfo) { order, sdkError ->
Orders are always updated with an order event. The order object cannot be updated directly.

```kotlin
FlyBuy.orders.event(order, CustomerState.WAITING) { order, sdkError ->
FlyBuy.orders.event(orderId, CustomerState.WAITING) { order, sdkError ->
// If sdkError == null, order has been updated
}
```
Expand All @@ -104,7 +107,7 @@ FlyBuy.orders.event(order, CustomerState.WAITING) { order, sdkError ->

| Attribute | Description |
|-----------------|---------------------------|
| `order` | Order data |
| `orderId` | Order ID |
| `customerState` | Customer state ENUM value |

#### Customer State ENUM Values
Expand Down
30 changes: 30 additions & 0 deletions doc/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,35 @@ FlyBuy.onLocationPermissionChanged()

This ensures that the FlyBuy SDK is aware of the permission change so the user location is updated appropriately.

#### Android 10 (API 29 and higher)

As of Android 10 (API 29), location permissions have changed to allow
users to select "when in use" as an option. If your app targets and API
before API 29, then some additional work is needed for your app to
compile properly. Once you target API 29 or higher, this code needs to
be removed.

In your `AndroidManifest.xml`, add the following service:

```xml
<service
android:name="com.radiusnetworks.flybuy.sdk.service.LocationService"
android:enabled="true"
android:exported="false"
tools:node="replace">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</service>
```

Note: If this code is not removed when targeting API 29 or higher, your
app will throw the following exception:

```
java.lang.RuntimeException: Unable to start service com.radiusnetworks.flybuy.sdk.service.LocationService ...
java.lang.IllegalArgumentException: foregroundServiceType 0x00000008 is not a subset of foregroundServiceType attribute 0x00000000 in service element of manifest file
```

## Typical Usage Pattern

Expand Down Expand Up @@ -271,4 +300,5 @@ Details on specific SDK functionality that can be used with your app.
- [Handling Notifications](notifications.md)
- [Managing Customers](customer.md)
- [Managing Orders](orders.md)
- [Getting Sites](sites.md)

49 changes: 49 additions & 0 deletions doc/sites.md
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
}
```

0 comments on commit 59a0c53

Please sign in to comment.