Get Amount Discount
Returns the discount brackets that the products have based on the quantity purchased. It obtains the quantity in units, the discount applied, the final price with discount, and the range of dates on which the promotion is active.
Endpoint:
GET /product/getAmountDiscount
Correct answer of obtaining discounts
Here is an example of the correct answer obtained:
[
{
"itemCode": "ACFU0046",
"discounts": [
{
"quantity": 600,
"discount": 10,
"specialPrice": 0.14,
"fromDate": "2019-11-26T00:00:00.000Z",
"toDate": "2021-03-09T10:10:11.873Z"
},
{
"quantity": 3000,
"discount": 20,
"specialPrice": 0.12,
"fromDate": "2019-11-26T00:00:00.000Z",
"toDate": "2021-03-09T10:10:11.873Z"
},
{
"quantity": 12000,
"discount": 30,
"specialPrice": 0.11,
"fromDate": "2019-11-26T00:00:00.000Z",
"toDate": "2021-03-09T10:10:11.873Z"
},
{
"quantity": 60000,
"discount": 25,
"specialPrice": 0.11,
"fromDate": "2019-11-26T00:00:00.000Z",
"toDate": "2021-03-09T10:10:11.873Z"
}
]
}
]
Method to get quantity discounts
Example call getAmountDiscount:
1var axios = require('axios');
2
3var config = {
4 method: 'get',
5 url: 'https://api.qnubu.com/api/product/getAmountDiscount',
6 headers: {
7 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjYXJkQ29kZSI6IkMwMDAxMCIsImdyb3VwQ29kZSI6MTI3LCJsaXN0TnVtIjoxMiwibm9EaXNjb3VudCI6Ik4iLCJkaXNjUmVsIjoiSCIsIm11ZXN0cmFPY3VsdGFzIjoxLCJpYXQiOjE2MTUxOTQ0MzQsImV4cCI6MTYxNTI4MDgzNH0.4SCvWNwD-nzP033a1Rt95uoWlmQkOfpj0hAqB01yMwI'
8 }
9};
10
11axios(config)
12.then(function (response) {
13 console.log(JSON.stringify(response.data));
14})
15.catch(function (error) {
16 console.log(error);
17});