Desconto

Tiago Assis
Tiago Assis
  • Atualizado

# Criar Desconto

POST https://api.dooca.store/discounts

 

Body
{
"name": "Desconto genérico",
"codes": [
"code1",
"code2"
],
"is_free_freight": false,
"single_use": false,
"type": "coupon",
"value_type": "percentage",
"value": "15",
"prerequisite_customer_id": 1,
"prerequisite_customer_group_id": 1,
"prerequisite_quantity": 2,
"prerequisite_category_ids": [7],
"prerequisite_product_ids": [15],
"entitled_quantity": 1,
"entitled_category_ids": [2],
"entitled_product_ids": [5],
"zipcodes": [
{
"zipcode_from": "50812910",
"zipcode_to": "72221353"
}, {
"zipcode_from": "41372765",
"zipcode_to": "98503983"
}, {
"zipcode_from": "26207720",
"zipcode_to": "70520789"
}, {
"zipcode_from": "25446935",
"zipcode_to": "98288721"
}
]
}

 

Status: 201

 

# Editar Desconto

PUT https://api.dooca.store/discounts/:id

Parâmetro: O ID do desconto.

A edição do registro pode ser parcial ou total.

 

{
"name": "EDIT",
"code": "GENERIC15",
"is_free_freight": false,
"single_use": true,
"type": "coupon",
"value_type": "percentage",
"value": "15",
"categories": [
{
"category_id": 7,
"type": "entitled"
}
],
"products": []
}

 

Status: 200

 

# Deletar Desconto

DELETE https://api.dooca.store/discounts/:id

Parâmetro: O ID do desconto.

 

# Consultar Desconto

GET https://api.dooca.store/discounts/:id

Parâmetro: O ID do desconto.

 

HTTP STATUS: 200 OK
{
"id": 404,
"name": "Desconto genérico",
"codes": [
{
"id": 309,
"discount_id": 404,
"code": "code1",
"created_at": "2020-01-10 13:45:18"
},
{
"id": 310,
"discount_id": 404,
"code": "code2",
"created_at": "2020-01-10 13:45:18"
}
],
"date_from": null,
"date_to": null,
"single_usage": true,
"usage_limit": null,
"min_purchase": null,
"min_quantity": null,
"type": "coupon",
"value_type": "percentage",
"value": "15.00",
"coupon_allow_free_freight": true,
"is_free_freight": false,
"active": true,
"created_at": "2020-01-10 13:45:18",
"updated_at": "2020-01-10 13:45:18",
"prerequisite_customer_id": null,
"prerequisite_customer_group_id": null,
"prerequisite_quantity": 1,
"prerequisite_category_ids": [],
"prerequisite_product_ids": [],
"entitled_quantity": null,
"entitled_category_ids": [],
"entitled_product_ids": [],
"zipcodes": []
}

 

# Listar Desconto

GET https://api.dooca.store/discounts

 

HTTP STATUS: 200 OK
{
"id": 404,
"name": "Desconto genérico",
"codes": [
{
"id": 309,
"discount_id": 404,
"code": "code1",
"created_at": "2020-01-10 13:45:18"
},
{
"id": 310,
"discount_id": 404,
"code": "code2",
"created_at": "2020-01-10 13:45:18"
}
],
"date_from": null,
"date_to": null,
"single_usage": true,
"usage_limit": null,
"min_purchase": null,
"min_quantity": null,
"type": "coupon",
"value_type": "percentage",
"value": "15.00",
"coupon_allow_free_freight": true,
"is_free_freight": false,
"active": true,
"created_at": "2020-01-10 13:45:18",
"updated_at": "2020-01-10 13:45:18",
"prerequisite_customer_id": null,
"prerequisite_customer_group_id": null,
"prerequisite_quantity": 1,
"prerequisite_category_ids": [],
"prerequisite_product_ids": [],
"entitled_quantity": null,
"entitled_category_ids": [],
"entitled_product_ids": [],
"zipcodes": []
}

 

# Consultar Desconto pelo Tipo

GET https://api.dooca.store/discounts/:type

Parâmetro: O Tipo de desconto.

 

HTTP STATUS: 200 OK

{
"id": 404,
"name": "Desconto genérico",
"codes": [
{
"id": 309,
"discount_id": 404,
"code": "code1",
"created_at": "2020-01-10 13:45:18"
},
{
"id": 310,
"discount_id": 404,
"code": "code2",
"created_at": "2020-01-10 13:45:18"
}
],
"date_from": null,
"date_to": null,
"single_usage": true,
"usage_limit": null,
"min_purchase": null,
"min_quantity": null,
"type": "coupon",
"value_type": "percentage",
"value": "15.00",
"coupon_allow_free_freight": true,
"is_free_freight": false,
"active": true,
"created_at": "2020-01-10 13:45:18",
"updated_at": "2020-01-10 13:45:18",
"prerequisite_customer_id": null,
"prerequisite_customer_group_id": null,
"prerequisite_quantity": 1,
"prerequisite_category_ids": [],
"prerequisite_product_ids": [],
"entitled_quantity": null,
"entitled_category_ids": [],
"entitled_product_ids": [],
"zipcodes": []
}

 

# Adicionar Código ao Desconto

POST https://api.dooca.store/discounts/:id/codes

Parâmetro: O ID do desconto.

 

{
"code": "Codigo123"
}

 

# Editar Código do Desconto

PUT https://api.dooca.store/discounts/:id/codes/:code_id

Parâmetro: O ID do desconto e ID do código.

 

{
"code": "Codigo123"
}

 

Status: 200

 

# Deletar Código do Desconto

DELETE https://api.dooca.store/discounts/:id/codes/:code_id

Parâmetro: O ID do desconto e ID do código.

 

Response: 204

Esse artigo foi útil?

Usuários que acharam isso útil: 0 de 0

Tem mais dúvidas? Envie uma solicitação

Comentários

0 comentário

Por favor, entre para comentar.