Skip to content

Commit 58103a2

Browse files
committed
Add CStore xendit
1 parent 27265a0 commit 58103a2

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/Providers/Xendit/XenditClient.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
namespace Ziswapp\Payment\Providers\Xendit;
66

7-
use BadMethodCallException;
87
use Ziswapp\Payment\Enum\CStore;
98
use Ziswapp\Payment\Enum\EWallet;
109
use Ziswapp\Payment\Input\CStoreInput;
1110
use Ziswapp\Payment\Input\EWalletInput;
1211
use Ziswapp\Payment\Enum\VirtualAccount;
12+
use Ziswapp\Payment\Output\CStoreOutput;
1313
use Ziswapp\Payment\Output\EWalletOutput;
1414
use Ziswapp\Payment\Input\CheckStatusInput;
1515
use Symfony\Component\HttpClient\HttpClient;
@@ -52,7 +52,8 @@ public function __construct(
5252
?PaymentInputFactoryInterface $inputFactory,
5353
?OutputFactoryInterface $outputFactory,
5454
?HttpClientInterface $httpClient = null
55-
) {
55+
)
56+
{
5657
$this->setConfigurations($configurations);
5758

5859
$this->httpClient = $httpClient ?: HttpClient::createForBaseUri('https://api.xendit.co', [
@@ -110,9 +111,22 @@ public function createEWallet(EWalletInput $input): EWalletOutput
110111
return $this->outputFactory->fromEWalletArray($data);
111112
}
112113

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
114122
{
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);
116130
}
117131

118132
/**

0 commit comments

Comments
 (0)