Skip to content

Commit 5742a35

Browse files
feat: Add ViURShopClient.discount_remove (#8)
Api call for viur-framework/viur-shop#24
1 parent 952695e commit 5742a35

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/ViURShopClient.js

+21-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,12 @@ export class ViURShopClient {
407407

408408

409409
// --- Discount -----------------------------------------------------------
410-
410+
/**
411+
* Add a Discount to the current Cart.
412+
* @param {string} code Human readable Discount Code
413+
* @param {string} discount_key Database Key from a Discount.
414+
* @returns {Response<Response>}
415+
*/
411416
discount_add({
412417
code,
413418
discount_key,
@@ -422,6 +427,21 @@ export class ViURShopClient {
422427
.then(req => req.json());
423428
}
424429

430+
/**
431+
* Removes a Discount by the Database Key
432+
* @param {string} discount_key Database Key from a Discount.
433+
* @returns {Promise<Response>}
434+
*/
435+
discount_remove({
436+
discount_key,
437+
} = {}) {
438+
return request(`${this.shop_api_url}/discount_remove`, {
439+
method: 'POST',
440+
params: {discount_key},
441+
})
442+
.then(req => req.json());
443+
}
444+
425445

426446
// --- Shipping -----------------------------------------------------------
427447

0 commit comments

Comments
 (0)