mirror of
https://github.com/bitinflow/accounts.git
synced 2026-11-01 05:09:07 +00:00
Refactoring
This commit is contained in:
1 parent
7ba3cdffb0
commit
a2405875ad
26 files changed
+569
-391
No files matched your search
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Bitinflow\Payments\Traits;
|
||||
|
||||
use Bitinflow\Payments\Result;
|
||||
use Bitinflow\Payments\BitinflowPayments;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
trait Orders
|
||||
{
|
||||
/**
|
||||
* Get orders from user.
|
||||
*
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getOrders(): Result
|
||||
{
|
||||
return $this->query('GET', 'orders');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
*/
|
||||
public function getOrder(string $id): Result
|
||||
{
|
||||
return $this->query('GET', sprintf('orders/%s', $id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new order.
|
||||
*
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function createOrder(array $parameters = []): Result
|
||||
{
|
||||
return $this->query('POST', 'orders', $parameters)->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checkout given subscription.
|
||||
*
|
||||
* @param string $id
|
||||
*/
|
||||
public function checkoutOrder(string $id):Result
|
||||
{
|
||||
return $this->query('PUT', sprintf('orders/%s/checkout', $id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Revoke a running subscription.
|
||||
*
|
||||
* @param string $id
|
||||
*/
|
||||
public function revokeOrder(string $id):Result
|
||||
{
|
||||
return $this->query('PUT', sprintf('orders/%s/revoke', $id));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user