Total Complexity | 4 |
Total Lines | 68 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
8 | class Promotions extends Client |
||
9 | { |
||
10 | /** |
||
11 | * Create a basket promotion |
||
12 | * Creates a new basket promotion object. |
||
13 | * |
||
14 | * @param PromotionRequest $promotion |
||
15 | * |
||
16 | * @return $this |
||
17 | */ |
||
18 | public function create(PromotionRequest $promotion): self |
||
19 | { |
||
20 | // Set HTTP params |
||
21 | $this->type = 'post'; |
||
22 | $this->endpoint = '/baskets/' . $this->basket_id . '/promotions'; |
||
23 | $this->params = $promotion; |
||
24 | |||
25 | return $this; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Retrieve a basket promotion |
||
30 | * Retrieves the details of a basket promotion. Provide the unique id for the basket promotion. |
||
31 | * |
||
32 | * @param int $promotion_id The basket promotion id |
||
33 | * |
||
34 | * @return $this |
||
35 | */ |
||
36 | public function __invoke(int $promotion_id): self |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Delete a basket promotion |
||
49 | * Permanently deletes a basket promotion. It cannot be undone. |
||
50 | * |
||
51 | * @return $this |
||
52 | */ |
||
53 | public function delete(): self |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * List all basket promotions |
||
64 | * Returns a list of your basket promotions. |
||
65 | * The basket promotions are returned sorted by creation date, with the most recent basket purchase appearing first. |
||
66 | * |
||
67 | * @return $this |
||
68 | */ |
||
69 | public function all(): self |
||
78 |