| 1 |
<?php |
| 2 |
|
| 3 |
// File generated from our OpenAPI spec |
| 4 |
|
| 5 |
namespace Stripe\Service; |
| 6 |
|
| 7 |
class OrderService extends \Stripe\Service\AbstractService |
| 8 |
{ |
| 9 |
/** |
| 10 |
* Returns a list of your orders. The orders are returned sorted by creation date, |
| 11 |
* with the most recently created orders appearing first. |
| 12 |
* |
| 13 |
* @param null|array $params |
| 14 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 15 |
* |
| 16 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 17 |
* |
| 18 |
* @return \Stripe\Collection<\Stripe\Order> |
| 19 |
*/ |
| 20 |
public function all($params = null, $opts = null) |
| 21 |
{ |
| 22 |
return $this->requestCollection('get', '/v1/orders', $params, $opts); |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* When retrieving an order, there is an includable <strong>line_items</strong> |
| 27 |
* property containing the first handful of those items. There is also a URL where |
| 28 |
* you can retrieve the full (paginated) list of line items. |
| 29 |
* |
| 30 |
* @param string $id |
| 31 |
* @param null|array $params |
| 32 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 33 |
* |
| 34 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 35 |
* |
| 36 |
* @return \Stripe\Collection<\Stripe\LineItem> |
| 37 |
*/ |
| 38 |
public function allLineItems($id, $params = null, $opts = null) |
| 39 |
{ |
| 40 |
return $this->requestCollection('get', $this->buildPath('/v1/orders/%s/line_items', $id), $params, $opts); |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* Cancels the order as well as the payment intent if one is attached. |
| 45 |
* |
| 46 |
* @param string $id |
| 47 |
* @param null|array $params |
| 48 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 49 |
* |
| 50 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 51 |
* |
| 52 |
* @return \Stripe\Order |
| 53 |
*/ |
| 54 |
public function cancel($id, $params = null, $opts = null) |
| 55 |
{ |
| 56 |
return $this->request('post', $this->buildPath('/v1/orders/%s/cancel', $id), $params, $opts); |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* Creates a new <code>open</code> order object. |
| 61 |
* |
| 62 |
* @param null|array $params |
| 63 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 64 |
* |
| 65 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 66 |
* |
| 67 |
* @return \Stripe\Order |
| 68 |
*/ |
| 69 |
public function create($params = null, $opts = null) |
| 70 |
{ |
| 71 |
return $this->request('post', '/v1/orders', $params, $opts); |
| 72 |
} |
| 73 |
|
| 74 |
/** |
| 75 |
* Reopens a <code>submitted</code> order. |
| 76 |
* |
| 77 |
* @param string $id |
| 78 |
* @param null|array $params |
| 79 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 80 |
* |
| 81 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 82 |
* |
| 83 |
* @return \Stripe\Order |
| 84 |
*/ |
| 85 |
public function reopen($id, $params = null, $opts = null) |
| 86 |
{ |
| 87 |
return $this->request('post', $this->buildPath('/v1/orders/%s/reopen', $id), $params, $opts); |
| 88 |
} |
| 89 |
|
| 90 |
/** |
| 91 |
* Retrieves the details of an existing order. Supply the unique order ID from |
| 92 |
* either an order creation request or the order list, and Stripe will return the |
| 93 |
* corresponding order information. |
| 94 |
* |
| 95 |
* @param string $id |
| 96 |
* @param null|array $params |
| 97 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 98 |
* |
| 99 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 100 |
* |
| 101 |
* @return \Stripe\Order |
| 102 |
*/ |
| 103 |
public function retrieve($id, $params = null, $opts = null) |
| 104 |
{ |
| 105 |
return $this->request('get', $this->buildPath('/v1/orders/%s', $id), $params, $opts); |
| 106 |
} |
| 107 |
|
| 108 |
/** |
| 109 |
* Submitting an Order transitions the status to <code>processing</code> and |
| 110 |
* creates a PaymentIntent object so the order can be paid. If the Order has an |
| 111 |
* <code>amount_total</code> of 0, no PaymentIntent object will be created. Once |
| 112 |
* the order is submitted, its contents cannot be changed, unless the <a |
| 113 |
* href="#reopen_order">reopen</a> method is called. |
| 114 |
* |
| 115 |
* @param string $id |
| 116 |
* @param null|array $params |
| 117 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 118 |
* |
| 119 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 120 |
* |
| 121 |
* @return \Stripe\Order |
| 122 |
*/ |
| 123 |
public function submit($id, $params = null, $opts = null) |
| 124 |
{ |
| 125 |
return $this->request('post', $this->buildPath('/v1/orders/%s/submit', $id), $params, $opts); |
| 126 |
} |
| 127 |
|
| 128 |
/** |
| 129 |
* Updates the specific order by setting the values of the parameters passed. Any |
| 130 |
* parameters not provided will be left unchanged. |
| 131 |
* |
| 132 |
* @param string $id |
| 133 |
* @param null|array $params |
| 134 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 135 |
* |
| 136 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 137 |
* |
| 138 |
* @return \Stripe\Order |
| 139 |
*/ |
| 140 |
public function update($id, $params = null, $opts = null) |
| 141 |
{ |
| 142 |
return $this->request('post', $this->buildPath('/v1/orders/%s', $id), $params, $opts); |
| 143 |
} |
| 144 |
} |
| 145 |
|