| @@ 25-56 (lines=32) @@ | ||
| 22 | * |
|
| 23 | * @see https://www.omise.co/receipt-api |
|
| 24 | */ |
|
| 25 | final class Receipt extends Api |
|
| 26 | { |
|
| 27 | /** |
|
| 28 | * @param array $parameters |
|
| 29 | * |
|
| 30 | * @return Pagination |
|
| 31 | */ |
|
| 32 | public function all(array $parameters = []) |
|
| 33 | { |
|
| 34 | return $this->doRequest('GET', '/receipts', $parameters); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * @param string $id |
|
| 39 | * |
|
| 40 | * @return Domain |
|
| 41 | */ |
|
| 42 | public function find($id) |
|
| 43 | { |
|
| 44 | self::assertNotEmpty($id); |
|
| 45 | ||
| 46 | return $this->doRequest('GET', '/receipts/' . $id); |
|
| 47 | } |
|
| 48 | ||
| 49 | /** |
|
| 50 | * @param Domain $receipt |
|
| 51 | */ |
|
| 52 | public function refresh(Domain $receipt) |
|
| 53 | { |
|
| 54 | $receipt->updateStore($this->find($receipt->id)->toArray()); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| @@ 25-56 (lines=32) @@ | ||
| 22 | * |
|
| 23 | * @see https://www.omise.co/transactions-api |
|
| 24 | */ |
|
| 25 | final class Transaction extends Api |
|
| 26 | { |
|
| 27 | /** |
|
| 28 | * @param array $parameters |
|
| 29 | * |
|
| 30 | * @return Pagination |
|
| 31 | */ |
|
| 32 | public function all(array $parameters = []) |
|
| 33 | { |
|
| 34 | return $this->doRequest('GET', '/transactions', $parameters); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * @param string $id |
|
| 39 | * |
|
| 40 | * @return Domain |
|
| 41 | */ |
|
| 42 | public function find($id) |
|
| 43 | { |
|
| 44 | self::assertNotEmpty($id); |
|
| 45 | ||
| 46 | return $this->doRequest('GET', '/transactions/' . $id); |
|
| 47 | } |
|
| 48 | ||
| 49 | /** |
|
| 50 | * @param Domain $transaction |
|
| 51 | */ |
|
| 52 | public function refresh(Domain $transaction) |
|
| 53 | { |
|
| 54 | $transaction->updateStore($this->find($transaction->id)->toArray()); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||