|
4 | 4 |
|
5 | 5 | namespace Ziswapp\Payment\Providers\Xendit;
|
6 | 6 |
|
7 |
| -use BadMethodCallException; |
8 | 7 | use Ziswapp\Payment\Enum\CStore;
|
9 | 8 | use Ziswapp\Payment\Enum\EWallet;
|
10 | 9 | use Ziswapp\Payment\Input\CStoreInput;
|
11 | 10 | use Ziswapp\Payment\Input\EWalletInput;
|
12 | 11 | use Ziswapp\Payment\Enum\VirtualAccount;
|
| 12 | +use Ziswapp\Payment\Output\CStoreOutput; |
13 | 13 | use Ziswapp\Payment\Output\EWalletOutput;
|
14 | 14 | use Ziswapp\Payment\Input\CheckStatusInput;
|
15 | 15 | use Symfony\Component\HttpClient\HttpClient;
|
@@ -52,7 +52,8 @@ public function __construct(
|
52 | 52 | ?PaymentInputFactoryInterface $inputFactory,
|
53 | 53 | ?OutputFactoryInterface $outputFactory,
|
54 | 54 | ?HttpClientInterface $httpClient = null
|
55 |
| - ) { |
| 55 | + ) |
| 56 | + { |
56 | 57 | $this->setConfigurations($configurations);
|
57 | 58 |
|
58 | 59 | $this->httpClient = $httpClient ?: HttpClient::createForBaseUri('https://api.xendit.co', [
|
@@ -110,9 +111,22 @@ public function createEWallet(EWalletInput $input): EWalletOutput
|
110 | 111 | return $this->outputFactory->fromEWalletArray($data);
|
111 | 112 | }
|
112 | 113 |
|
113 |
| - public function createConvenienceStore(CStoreInput $input): void |
| 114 | + /** |
| 115 | + * @throws ClientExceptionInterface |
| 116 | + * @throws DecodingExceptionInterface |
| 117 | + * @throws RedirectionExceptionInterface |
| 118 | + * @throws ServerExceptionInterface |
| 119 | + * @throws TransportExceptionInterface |
| 120 | + */ |
| 121 | + public function createConvenienceStore(CStoreInput $input): CStoreOutput |
114 | 122 | {
|
115 |
| - throw new BadMethodCallException('Not implemented yet'); |
| 123 | + $input = $this->inputFactory->fromCStoreInput($input); |
| 124 | + |
| 125 | + $response = $this->executeRequest('POST', '/fixed_payment_code', [], $input->requestBody()); |
| 126 | + |
| 127 | + $data = $response->toArray(); |
| 128 | + |
| 129 | + return $this->outputFactory->fromCStoreArray($data); |
116 | 130 | }
|
117 | 131 |
|
118 | 132 | /**
|
|
0 commit comments