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
233 changes: 119 additions & 114 deletions source/includes/_addresses.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@ country | `string` | The country of Address
geo | `array` | The geo position of Address
raw | `object` | All information like address, country, zip code, etc... from service
alias | `string` | The alias of Address
organization_name | `string` | The name of the organization at the given address if applicable
service | `string` | The service used for Address _default google_

### service
### Services

Possibilities |
------------- |
google |
pca |
We currently support localization with Google.

## Retrieves an Address
## Retrieving an Address

> Definition

Expand All @@ -35,126 +33,133 @@ GET https://api.kvass.ai/addresses/lookup
> Example request:

``` http
GET /addresses/lookup HTTP/1.1
GET /addresses/lookup?service=google&type=streetname&query=Karl%20Johans%20gate%2022 HTTP/1.1
Content-Type: application/json
Authorization: Bearer <jwt>
X-Kvass-Api-Key: <kvass-api-key>
Host: api.kvass.ai

{
"service_address_id":"ChIJR0HKYoduQUYRkho1K1zkZpA",
"alias":"",
"country":"Norway",
"zip_code":"0160",
"street_name":"Tordenskiolds gate 3",
"geo":[
59.9131976,
10.7361056
],
"raw":{
"address_components":[
{
"types":[
"street_number"
],
"short_name":"3",
"long_name":"3"
},
{
"types":[
"route"
],
"short_name":"Tordenskiolds gate",
"long_name":"Tordenskiolds gate"
},
{
"types":[
"political",
"sublocality",
"sublocality_level_1"
],
"short_name":"Sentrum",
"long_name":"Sentrum"
},
{
"types":[
"postal_town"
],
"short_name":"Oslo",
"long_name":"Oslo"
},
{
"types":[
"administrative_area_level_2",
"political"
],
"short_name":"Oslo kommune",
"long_name":"Oslo kommune"
},
{
"types":[
"administrative_area_level_1",
"political"
],
"short_name":"Oslo",
"long_name":"Oslo"
},
{
"types":[
"country",
"political"
],
"short_name":"NO",
"long_name":"Norway"
},
{
"types":[
"postal_code"
],
"short_name":"0160",
"long_name":"0160"
}
],
"formatted_address":"Tordenskiolds gate 3, 0160 Oslo, Norway",
"types":[
"premise"
],
"geometry":{
"location_type":"ROOFTOP",
"location":{
"lat":59.9131976,
"lng":10.7361056
},
"viewport":{
"northeast":{
"lat":59.9145465802915,
"lng":10.7374546302915
"alias": "",
"country": "Norway",
"service": "google",
"street_name": "Karl Johans gate 22",
"city": "Oslo",
"geo": [
59.9130629,
10.7402665
],
"service_address_id": "ChIJ7ZkfWX1uQUYRLjlo7CGVLFo",
"raw": {
"geometry": {
"viewport": {
"northeast": {
"lat": 59.9143406802915,
"lng": 10.7415464302915
},
"southwest": {
"lat": 59.91164271970849,
"lng": 10.7388484697085
}
},
"southwest":{
"lat":59.91184861970849,
"lng":10.7347566697085
}
},
"bounds":{
"northeast":{
"lat":59.91333940000001,
"lng":10.736447
"location": {
"lat": 59.9130629,
"lng": 10.7402665
},
"bounds": {
"northeast": {
"lat": 59.9134037,
"lng": 10.7410763
},
"southwest": {
"lat": 59.91257969999999,
"lng": 10.7393186
}
},
"location_type": "ROOFTOP"
},
"place_id": "ChIJ7ZkfWX1uQUYRLjlo7CGVLFo",
"formatted_address": "Stortingsbygningen, Karl Johans gate 22, 0026 Oslo, Norway",
"types": [
"premise"
],
"address_components": [
{
"long_name": "Stortingsbygningen",
"short_name": "Stortingsbygningen",
"types": [
"premise"
]
},
{
"long_name": "22",
"short_name": "22",
"types": [
"street_number"
]
},
{
"long_name": "Karl Johans gate",
"short_name": "Karl Johans gate",
"types": [
"route"
]
},
{
"long_name": "Sentrum",
"short_name": "Sentrum",
"types": [
"political",
"sublocality",
"sublocality_level_1"
]
},
{
"long_name": "Oslo",
"short_name": "Oslo",
"types": [
"postal_town"
]
},
{
"long_name": "Oslo kommune",
"short_name": "Oslo kommune",
"types": [
"administrative_area_level_2",
"political"
]
},
{
"long_name": "Oslo",
"short_name": "Oslo",
"types": [
"administrative_area_level_1",
"political"
]
},
{
"long_name": "Norway",
"short_name": "NO",
"types": [
"country",
"political"
]
},
"southwest":{
"lat":59.91305579999999,
"lng":10.7357643
{
"long_name": "0026",
"short_name": "0026",
"types": [
"postal_code"
]
}
}
},
"place_id":"ChIJR0HKYoduQUYRkho1K1zkZpA"
},
"service":"google",
"city":"Oslo"
]
},
"zip_code": "0026"
}
```

Arguments | Type | Description
--------- | ---- | ------
service | `string` | Chose the service you want use
type | `string` | Define the type of your search, if it's street name, zip code, etc
**service** | `string` | Chose the service you want to use
**query** | `string` | Query is what you want to search for e.g.: "Tordenskioldsgate 3, Oslo"
type | `string` | Define your search parameter, if it's street name, zip code, etc
14 changes: 7 additions & 7 deletions source/includes/_coupons.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Coupons

Coupons are a great way to offer discounts or vouchers to your Customers. They can be used together with multiple business models: Orders, Invoices and Subscriptions.
Coupons are a great way to offer discounts or credit vouchers to your customers. They can be used together with multiple business models: Orders, Invoices and Subscriptions.


## Coupon Object

Attributes | Types | Description
---------- | ----- | -----------
**name** | `string` | Name of the coupon
**code** | `string` | The code to be used by a costumer. By default, the code is automatically generated (a string of 6 characters long, e.g: Nz42kL), but you can also create our own.
**code** | `string` | The code to be used by a customer. By default, the code is automatically generated (a string of 6 characters long, e.g: Nz42kL), but you can also create our own.
percent_off | `number` | The discount percentage, should be between `0.` and `1.`, for example: 0.2 means 20% of the total amount.
amount_off | `number` | Discount amount, for example: 100.50, means that the next payment will be decreased by 100.50.
currency | `string` | ISO 4217 code of currency, for example: "EUR"
starting_date | `object` | Define when can the coupon start being used. By default, it'll start at the time of creation, but it could be defined for the future. If defined in the future, it means the coupon could not be used before the `starting_date`, `timestamp` format. _Default `now`_
ending_date | `object` | The date when the coupon will stop being available. `timestamp` format.
starting_date | `object` | Define when the coupon can start being used. By default, it'll start at the time of creation, but it could be defined for the future. If defined in the future, it means the coupon cannot be used before the `starting_date`. `timestamp` format. _Default `now`_
ending_date | `object` | The expiry date of the coupon. `timestamp` format.
max_redemptions | `integer` | The number of times a coupon can be used. When the `used_count` is equal to the `max_redemption` then the coupon becomes unusable.
used_count | `integer` | Automatically incremented by each use.


As you can see, there are two type of discount: percent_off and amount_off.
As you can see, there are two types of discounts: percent_off and amount_off.
It's important to remember: a coupon can only have one of them at the same time.
But if you want to change the type of discount you can do it easily with a `PUT coupons/<coupon_id>` (There is an example [here](#switch-the-discount-type))
<br/>
Expand Down Expand Up @@ -210,7 +210,7 @@ date_filter | `string` | Date field used for filter results. _default is `create

## Coupons Search

Retrieves a list of Coupons associate with the company.
Retrieves a list of Coupons associated with the company.

> Definition

Expand All @@ -221,7 +221,7 @@ GET https://api.kvass.ai/coupons/search
> Example request:

```http
GET /coupons/search/query=SUMMER HTTP/1.1
GET /coupons/search?query=SUMMER HTTP/1.1
Content-Type: application/json
Authorization: Bearer <jwt>
X-Kvass-Api-Key: <kvass-api-key>
Expand Down
Loading