-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update SDK from api-definitions (#695)
Co-authored-by: rebilly-machine-user <[email protected]> Co-authored-by: Arif Kurkchi <[email protected]>
- Loading branch information
1 parent
028c113
commit 0c3fadb
Showing
21 changed files
with
1,228 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@rebilly/client-php": patch | ||
--- | ||
|
||
Fix api errors in risk-score-simualtion-jobs Rebilly/rebilly#5709 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@rebilly/client-php": patch | ||
--- | ||
|
||
Add "release" version attribute to Status API response Rebilly/rebilly#1883 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@rebilly/client-php": patch | ||
--- | ||
|
||
Risk score simulation configuration Rebilly/rebilly#5613 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@rebilly/client-php": patch | ||
--- | ||
|
||
Add autopay to trial only conversion quote Rebilly/rebilly#5685 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@rebilly/client-php": patch | ||
--- | ||
|
||
Add PayU gateway account Rebilly/rebilly#5250 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
<?php | ||
/** | ||
* This source file is proprietary and part of Rebilly. | ||
* | ||
* (c) Rebilly SRL | ||
* Rebilly Ltd. | ||
* Rebilly Inc. | ||
* | ||
* @see https://www.rebilly.com | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rebilly\Sdk\Api; | ||
|
||
use GuzzleHttp\ClientInterface; | ||
use GuzzleHttp\Psr7\Request; | ||
use GuzzleHttp\Utils; | ||
use Rebilly\Sdk\Collection; | ||
use Rebilly\Sdk\Model\RiskScoreSimulationJob; | ||
use Rebilly\Sdk\Model\RiskScoreSimulationTransaction; | ||
use Rebilly\Sdk\Paginator; | ||
|
||
class RiskScoreSimulationJobsApi | ||
{ | ||
public function __construct(protected ?ClientInterface $client) | ||
{ | ||
} | ||
|
||
public function create( | ||
RiskScoreSimulationJob $riskScoreSimulationJob, | ||
): RiskScoreSimulationJob { | ||
$uri = '/risk-score-simulation-jobs'; | ||
|
||
$request = new Request('POST', $uri, headers: [ | ||
'Accept' => 'application/json', | ||
], body: Utils::jsonEncode($riskScoreSimulationJob)); | ||
$response = $this->client->send($request); | ||
$data = Utils::jsonDecode((string) $response->getBody(), true); | ||
|
||
return RiskScoreSimulationJob::from($data); | ||
} | ||
|
||
public function get( | ||
string $id, | ||
): RiskScoreSimulationJob { | ||
$pathParams = [ | ||
'{id}' => $id, | ||
]; | ||
|
||
$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/risk-score-simulation-jobs/{id}'); | ||
|
||
$request = new Request('GET', $uri, headers: [ | ||
'Accept' => 'application/json', | ||
]); | ||
$response = $this->client->send($request); | ||
$data = Utils::jsonDecode((string) $response->getBody(), true); | ||
|
||
return RiskScoreSimulationJob::from($data); | ||
} | ||
|
||
/** | ||
* @return Collection<RiskScoreSimulationJob> | ||
*/ | ||
public function getAll( | ||
?string $filter = null, | ||
?array $sort = null, | ||
?int $limit = null, | ||
?int $offset = null, | ||
): Collection { | ||
$queryParams = [ | ||
'filter' => $filter, | ||
'sort' => $sort ? implode(',', $sort) : null, | ||
'limit' => $limit, | ||
'offset' => $offset, | ||
]; | ||
$uri = '/risk-score-simulation-jobs?' . http_build_query($queryParams); | ||
|
||
$request = new Request('GET', $uri, headers: [ | ||
'Accept' => 'application/json', | ||
]); | ||
$response = $this->client->send($request); | ||
$data = Utils::jsonDecode((string) $response->getBody(), true); | ||
|
||
return new Collection( | ||
array_map(fn (array $item): RiskScoreSimulationJob => RiskScoreSimulationJob::from($item), $data), | ||
(int) $response->getHeaderLine(Collection::HEADER_LIMIT), | ||
(int) $response->getHeaderLine(Collection::HEADER_OFFSET), | ||
(int) $response->getHeaderLine(Collection::HEADER_TOTAL), | ||
); | ||
} | ||
|
||
/** | ||
* @return Paginator<RiskScoreSimulationJob> | ||
*/ | ||
public function getAllPaginator( | ||
?string $filter = null, | ||
?array $sort = null, | ||
?int $limit = null, | ||
?int $offset = null, | ||
): Paginator { | ||
$closure = fn (?int $limit, ?int $offset): Collection => $this->getAll( | ||
filter: $filter, | ||
sort: $sort, | ||
limit: $limit, | ||
offset: $offset, | ||
); | ||
|
||
return new Paginator( | ||
$limit !== null || $offset !== null ? $closure(limit: $limit, offset: $offset) : null, | ||
$closure, | ||
); | ||
} | ||
|
||
/** | ||
* @return Collection<RiskScoreSimulationTransaction> | ||
*/ | ||
public function getTransactions( | ||
string $id, | ||
?int $limit = null, | ||
?int $offset = null, | ||
): Collection { | ||
$pathParams = [ | ||
'{id}' => $id, | ||
]; | ||
|
||
$queryParams = [ | ||
'limit' => $limit, | ||
'offset' => $offset, | ||
]; | ||
$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/risk-score-simulation-jobs/{id}/transactions?') . http_build_query($queryParams); | ||
|
||
$request = new Request('GET', $uri, headers: [ | ||
'Accept' => 'application/json', | ||
]); | ||
$response = $this->client->send($request); | ||
$data = Utils::jsonDecode((string) $response->getBody(), true); | ||
|
||
return new Collection( | ||
array_map(fn (array $item): RiskScoreSimulationTransaction => RiskScoreSimulationTransaction::from($item), $data), | ||
(int) $response->getHeaderLine(Collection::HEADER_LIMIT), | ||
(int) $response->getHeaderLine(Collection::HEADER_OFFSET), | ||
(int) $response->getHeaderLine(Collection::HEADER_TOTAL), | ||
); | ||
} | ||
|
||
/** | ||
* @return Paginator<RiskScoreSimulationTransaction> | ||
*/ | ||
public function getTransactionsPaginator( | ||
string $id, | ||
?int $limit = null, | ||
?int $offset = null, | ||
): Paginator { | ||
$closure = fn (?int $limit, ?int $offset): Collection => $this->getTransactions( | ||
id: $id, | ||
limit: $limit, | ||
offset: $offset, | ||
); | ||
|
||
return new Paginator( | ||
$limit !== null || $offset !== null ? $closure(limit: $limit, offset: $offset) : null, | ||
$closure, | ||
); | ||
} | ||
|
||
public function stop( | ||
string $id, | ||
): RiskScoreSimulationJob { | ||
$pathParams = [ | ||
'{id}' => $id, | ||
]; | ||
|
||
$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/risk-score-simulation-jobs/{id}/stop'); | ||
|
||
$request = new Request('POST', $uri, headers: [ | ||
'Accept' => 'application/json', | ||
]); | ||
$response = $this->client->send($request); | ||
$data = Utils::jsonDecode((string) $response->getBody(), true); | ||
|
||
return RiskScoreSimulationJob::from($data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php | ||
/** | ||
* This source file is proprietary and part of Rebilly. | ||
* | ||
* (c) Rebilly SRL | ||
* Rebilly Ltd. | ||
* Rebilly Inc. | ||
* | ||
* @see https://www.rebilly.com | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rebilly\Sdk\Model; | ||
|
||
class PayU extends GatewayAccount | ||
{ | ||
private array $fields = []; | ||
|
||
public function __construct(array $data = []) | ||
{ | ||
parent::__construct([ | ||
'gatewayName' => 'PayU', | ||
] + $data); | ||
|
||
if (array_key_exists('credentials', $data)) { | ||
$this->setCredentials($data['credentials']); | ||
} | ||
if (array_key_exists('threeDSecureServer', $data)) { | ||
$this->setThreeDSecureServer($data['threeDSecureServer']); | ||
} | ||
} | ||
|
||
public static function from(array $data = []): self | ||
{ | ||
return new self($data); | ||
} | ||
|
||
public function getCredentials(): PayUCredentials | ||
{ | ||
return $this->fields['credentials']; | ||
} | ||
|
||
public function setCredentials(PayUCredentials|array $credentials): static | ||
{ | ||
if (!($credentials instanceof PayUCredentials)) { | ||
$credentials = PayUCredentials::from($credentials); | ||
} | ||
|
||
$this->fields['credentials'] = $credentials; | ||
|
||
return $this; | ||
} | ||
|
||
public function getThreeDSecureServer(): ?ThreeDSecureIO3dsServer | ||
{ | ||
return $this->fields['threeDSecureServer'] ?? null; | ||
} | ||
|
||
public function setThreeDSecureServer(null|ThreeDSecureIO3dsServer|array $threeDSecureServer): static | ||
{ | ||
if ($threeDSecureServer !== null && !($threeDSecureServer instanceof ThreeDSecureIO3dsServer)) { | ||
$threeDSecureServer = ThreeDSecureIO3dsServer::from($threeDSecureServer); | ||
} | ||
|
||
$this->fields['threeDSecureServer'] = $threeDSecureServer; | ||
|
||
return $this; | ||
} | ||
|
||
public function jsonSerialize(): array | ||
{ | ||
$data = []; | ||
if (array_key_exists('credentials', $this->fields)) { | ||
$data['credentials'] = $this->fields['credentials']->jsonSerialize(); | ||
} | ||
if (array_key_exists('threeDSecureServer', $this->fields)) { | ||
$data['threeDSecureServer'] = $this->fields['threeDSecureServer']?->jsonSerialize(); | ||
} | ||
|
||
return parent::jsonSerialize() + $data; | ||
} | ||
} |
Oops, something went wrong.