EvilFreelancer /
resova-api-php
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Resova\Endpoints\Baskets; |
||||
| 4 | |||||
| 5 | use Resova\Client; |
||||
| 6 | use Resova\Models\PurchaseRequest; |
||||
| 7 | |||||
| 8 | class Purchases extends Client |
||||
| 9 | { |
||||
| 10 | /** |
||||
| 11 | * Create a basket purchase |
||||
| 12 | * Creates a new basket purchase object |
||||
| 13 | * |
||||
| 14 | * @param PurchaseRequest $purchase |
||||
| 15 | * |
||||
| 16 | * @return $this |
||||
| 17 | */ |
||||
| 18 | public function create(PurchaseRequest $purchase): self |
||||
| 19 | { |
||||
| 20 | $purchase->setRequired([ |
||||
| 21 | 'gift_voucher_id', |
||||
| 22 | ]); |
||||
| 23 | |||||
| 24 | // Set HTTP params |
||||
| 25 | $this->type = 'post'; |
||||
| 26 | $this->endpoint = '/baskets/' . $this->basket_id . '/purchases'; |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
The property
basket_id does not exist on Resova\Endpoints\Baskets\Purchases. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||||
| 27 | $this->params = $purchase; |
||||
| 28 | |||||
| 29 | return $this; |
||||
| 30 | } |
||||
| 31 | |||||
| 32 | /** |
||||
| 33 | * Retrieve a basket purchase |
||||
| 34 | * Retrieves the details of a basket purchase. Provide the unique id for the basket purchase. |
||||
| 35 | * |
||||
| 36 | * @param int $purchase_id The basket purchase id |
||||
| 37 | * |
||||
| 38 | * @return $this |
||||
| 39 | */ |
||||
| 40 | public function __invoke(int $purchase_id): self |
||||
| 41 | { |
||||
| 42 | $this->purchase_id = $purchase_id; |
||||
|
0 ignored issues
–
show
|
|||||
| 43 | |||||
| 44 | // Set HTTP params |
||||
| 45 | $this->type = 'get'; |
||||
| 46 | $this->endpoint = '/baskets/' . $this->basket_id . '/purchases/' . $purchase_id; |
||||
|
0 ignored issues
–
show
The property
basket_id does not exist on Resova\Endpoints\Baskets\Purchases. Since you implemented __get, consider adding a @property annotation.
Loading history...
Are you sure
$this->basket_id of type boolean|object can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 47 | |||||
| 48 | return $this; |
||||
| 49 | } |
||||
| 50 | |||||
| 51 | /** |
||||
| 52 | * Delete a basket purchase |
||||
| 53 | * Permanently deletes a basket purchase. It cannot be undone. |
||||
| 54 | * |
||||
| 55 | * @return $this |
||||
| 56 | */ |
||||
| 57 | public function delete(): self |
||||
| 58 | { |
||||
| 59 | // Set HTTP params |
||||
| 60 | $this->type = 'delete'; |
||||
| 61 | $this->endpoint = '/baskets/' . $this->basket_id . '/purchases/' . $this->purchase_id; |
||||
|
0 ignored issues
–
show
The property
basket_id does not exist on Resova\Endpoints\Baskets\Purchases. Since you implemented __get, consider adding a @property annotation.
Loading history...
Are you sure
$this->basket_id of type boolean|object can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 62 | |||||
| 63 | return $this; |
||||
| 64 | } |
||||
| 65 | |||||
| 66 | /** |
||||
| 67 | * Update a basket purchase |
||||
| 68 | * Updates the specified basket purchase by setting the values of the parameters passed. |
||||
| 69 | * Any parameters not provided will be left unchanged. |
||||
| 70 | * This request accepts mostly the same arguments as the basket purchase creation call. |
||||
| 71 | * |
||||
| 72 | * @param PurchaseRequest $purchase |
||||
| 73 | * |
||||
| 74 | * @return $this |
||||
| 75 | */ |
||||
| 76 | public function update(PurchaseRequest $purchase): self |
||||
| 77 | { |
||||
| 78 | // Set HTTP params |
||||
| 79 | $this->type = 'put'; |
||||
| 80 | $this->endpoint = '/baskets/' . $this->basket_id . '/purchases/' . $this->purchase_id; |
||||
|
0 ignored issues
–
show
Are you sure
$this->basket_id of type boolean|object can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
The property
basket_id does not exist on Resova\Endpoints\Baskets\Purchases. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||||
| 81 | $this->params = $purchase; |
||||
| 82 | |||||
| 83 | return $this; |
||||
| 84 | } |
||||
| 85 | |||||
| 86 | /** |
||||
| 87 | * List all basket purchases |
||||
| 88 | * Returns a list of your basket purchases. |
||||
| 89 | * The basket purchases are returned sorted by creation date, with the most recent basket purchase appearing first. |
||||
| 90 | * |
||||
| 91 | * @return $this |
||||
| 92 | */ |
||||
| 93 | public function all(): self |
||||
| 94 | { |
||||
| 95 | // Set HTTP params |
||||
| 96 | $this->type = 'get'; |
||||
| 97 | $this->endpoint = '/baskets/' . $this->basket_id . '/purchases'; |
||||
|
0 ignored issues
–
show
The property
basket_id does not exist on Resova\Endpoints\Baskets\Purchases. Since you implemented __get, consider adding a @property annotation.
Loading history...
Are you sure
$this->basket_id of type boolean|object can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 98 | |||||
| 99 | return $this; |
||||
| 100 | } |
||||
| 101 | } |
||||
| 102 |