-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
m.vela
committed
Jul 15, 2019
1 parent
1f9576a
commit 558e23f
Showing
357 changed files
with
23,438 additions
and
2,539 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
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,80 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright Copyright (c) 2018-2019 Payvision B.V. (https://www.payvision.com/) | ||
* @license see LICENCE.TXT | ||
* | ||
* Warning! This file is auto-generated! Any changes made to this file will be deleted in the future! | ||
*/ | ||
|
||
namespace Payvision\SDK\Application\Checkouts\Service; | ||
|
||
use Payvision\SDK\Domain\Checkouts\ValueObject\Checkout\Request as CheckoutRequest; | ||
use Payvision\SDK\Domain\Checkouts\ValueObject\Checkout\Response as CheckoutResponse; | ||
use Payvision\SDK\Domain\Checkouts\ValueObject\Status\Response as StatusResponse; | ||
use Payvision\SDK\Application\Request\Builder; | ||
use Payvision\SDK\Application\ApiRequest; | ||
|
||
class RequestBuilder | ||
{ | ||
public static function newCheckout( | ||
CheckoutRequest $input | ||
|
||
): ApiRequest | ||
{ | ||
$jsonBody = Builder::toArray($input); | ||
return new ApiRequest( | ||
'checkouts', | ||
'POST', | ||
self::getParameters($jsonBody), | ||
$jsonBody['header'] ?? [], | ||
$jsonBody['body'] ?? [], | ||
[], | ||
[ | ||
200 => CheckoutResponse::class, | ||
400 => CheckoutResponse::class, | ||
500 => CheckoutResponse::class, | ||
501 => CheckoutResponse::class, | ||
] | ||
); | ||
} | ||
|
||
public static function getCheckoutStatus( | ||
|
||
string $id, | ||
string $businessId | ||
): ApiRequest | ||
{ | ||
return new ApiRequest( | ||
\str_replace('{id}', $id, 'checkouts/{id}'), | ||
'GET', | ||
[], | ||
[], | ||
[], | ||
[ | ||
'businessId' => $businessId | ||
], | ||
[ | ||
200 => StatusResponse::class, | ||
400 => StatusResponse::class, | ||
500 => StatusResponse::class, | ||
501 => StatusResponse::class, | ||
] | ||
); | ||
} | ||
|
||
private static function getParameters(array $input): array | ||
{ | ||
$parameters = []; | ||
|
||
foreach ($input as $key => $value) { | ||
if ($key !== 'header' && $key !== 'body') { | ||
$parameters[$key] = $value; | ||
} | ||
} | ||
|
||
return $parameters; | ||
} | ||
} |
Oops, something went wrong.