OrderService.php 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Service\Climate;
  4. /**
  5. * @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
  6. * @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
  7. */
  8. class OrderService extends \Stripe\Service\AbstractService
  9. {
  10. /**
  11. * Lists all Climate order objects. The orders are returned sorted by creation
  12. * date, with the most recently created orders appearing first.
  13. *
  14. * @param null|array $params
  15. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  16. *
  17. * @throws \Stripe\Exception\ApiErrorException if the request fails
  18. *
  19. * @return \Stripe\Collection<\Stripe\Climate\Order>
  20. */
  21. public function all($params = null, $opts = null)
  22. {
  23. return $this->requestCollection('get', '/v1/climate/orders', $params, $opts);
  24. }
  25. /**
  26. * Cancels a Climate order. You can cancel an order within 24 hours of creation.
  27. * Stripe refunds the reservation <code>amount_subtotal</code>, but not the
  28. * <code>amount_fees</code> for user-triggered cancellations. Frontier might cancel
  29. * reservations if suppliers fail to deliver. If Frontier cancels the reservation,
  30. * Stripe provides 90 days advance notice and refunds the
  31. * <code>amount_total</code>.
  32. *
  33. * @param string $id
  34. * @param null|array $params
  35. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  36. *
  37. * @throws \Stripe\Exception\ApiErrorException if the request fails
  38. *
  39. * @return \Stripe\Climate\Order
  40. */
  41. public function cancel($id, $params = null, $opts = null)
  42. {
  43. return $this->request('post', $this->buildPath('/v1/climate/orders/%s/cancel', $id), $params, $opts);
  44. }
  45. /**
  46. * Creates a Climate order object for a given Climate product. The order will be
  47. * processed immediately after creation and payment will be deducted your Stripe
  48. * balance.
  49. *
  50. * @param null|array $params
  51. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  52. *
  53. * @throws \Stripe\Exception\ApiErrorException if the request fails
  54. *
  55. * @return \Stripe\Climate\Order
  56. */
  57. public function create($params = null, $opts = null)
  58. {
  59. return $this->request('post', '/v1/climate/orders', $params, $opts);
  60. }
  61. /**
  62. * Retrieves the details of a Climate order object with the given ID.
  63. *
  64. * @param string $id
  65. * @param null|array $params
  66. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  67. *
  68. * @throws \Stripe\Exception\ApiErrorException if the request fails
  69. *
  70. * @return \Stripe\Climate\Order
  71. */
  72. public function retrieve($id, $params = null, $opts = null)
  73. {
  74. return $this->request('get', $this->buildPath('/v1/climate/orders/%s', $id), $params, $opts);
  75. }
  76. /**
  77. * Updates the specified order by setting the values of the parameters passed.
  78. *
  79. * @param string $id
  80. * @param null|array $params
  81. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  82. *
  83. * @throws \Stripe\Exception\ApiErrorException if the request fails
  84. *
  85. * @return \Stripe\Climate\Order
  86. */
  87. public function update($id, $params = null, $opts = null)
  88. {
  89. return $this->request('post', $this->buildPath('/v1/climate/orders/%s', $id), $params, $opts);
  90. }
  91. }