-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/GPY025-17-new-payments' into development
- Loading branch information
Showing
21 changed files
with
236 additions
and
112 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# IDE | ||
/nbproject/ | ||
.idea | ||
/gopay-php-api.iml | ||
|
||
# APP | ||
/vendor/ | ||
|
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,111 @@ | ||
<?php | ||
|
||
namespace GoPay; | ||
|
||
use GoPay\Definition\Language; | ||
use GoPay\Definition\TokenScope; | ||
|
||
class Config | ||
{ | ||
/** | ||
* @param string|null $clientId {@see https://doc.gopay.com/#access-token} | ||
* @param string|null $clientSecret {@see https://doc.gopay.com/#access-token} | ||
* @param string|null $goid Default GoPay account used in `createPayment` if `target` is not specified. | ||
* @param string|null $gatewayUrl {@see https://help.gopay.com/en/knowledge-base/integration-of-payment-gateway/integration-of-payment-gateway-1/how-do-i-integrate-the-payment-gateway} | ||
*/ | ||
public function __construct( | ||
public ?string $clientId = null, | ||
public ?string $clientSecret = null, | ||
public ?string $goid = null, | ||
public ?string $gatewayUrl = null, | ||
public ?string $customUserAgent = null, | ||
) { | ||
} | ||
|
||
/** | ||
* {@see https://doc.gopay.com/#access-token} | ||
* | ||
* @var string | ||
*/ | ||
public string $scope = TokenScope::ALL; | ||
|
||
/** | ||
* Language used in `createPayment` if `lang` is not specified + used for | ||
* {@see https://doc.gopay.com/#errors localization of errors}. | ||
* | ||
* @var string | ||
*/ | ||
public string $language = Language::ENGLISH; | ||
|
||
/** | ||
* Browser timeout in seconds. | ||
* | ||
* @var int | ||
*/ | ||
public int $timeout = 30; | ||
|
||
/** | ||
* @param array|Config $userConfig | ||
* @param bool $defaultArrayValues | ||
* @return array | ||
*/ | ||
public static function parseUserConfig(array|Config $userConfig, bool $defaultArrayValues = true): array | ||
{ | ||
if (is_array($userConfig)) { | ||
if ($defaultArrayValues) { | ||
return $userConfig + [ | ||
'scope' => TokenScope::ALL, | ||
'language' => Language::ENGLISH, | ||
'timeout' => 30 | ||
]; | ||
} | ||
|
||
return $userConfig; | ||
} else { | ||
return $userConfig->toArray(); | ||
} | ||
} | ||
|
||
/** | ||
* @param array $arr | ||
* @return Config | ||
*/ | ||
public static function fromArray(array $arr): Config | ||
{ | ||
$config = new Config(); | ||
|
||
$config->goid = $arr['goid'] ?? null; | ||
$config->clientId = $arr['clientId'] ?? null; | ||
$config->clientSecret = $arr['clientSecret'] ?? null; | ||
$config->gatewayUrl = $arr['gatewayUrl'] ?? null; | ||
|
||
// Properties with default values are set only if their value is provided | ||
if (isset($arr['scope'])) { | ||
$config->scope = $arr['scope']; | ||
} | ||
if (isset($arr['language'])) { | ||
$config->language = $arr['language']; | ||
} | ||
if (isset($arr['timeout'])) { | ||
$config->timeout = $arr['timeout']; | ||
} | ||
|
||
return $config; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function toArray(): array | ||
{ | ||
return [ | ||
'goid' => $this->goid, | ||
'clientId' => $this->clientId, | ||
'clientSecret' => $this->clientSecret, | ||
'gatewayUrl' => $this->gatewayUrl, | ||
'scope' => $this->scope, | ||
'language' => $this->language, | ||
'timeout' => $this->timeout, | ||
]; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
vendor/gopay/payments-sdk-php/src/Definition/Payment/BnplType.php
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,9 @@ | ||
<?php | ||
|
||
namespace GoPay\Definition\Payment; | ||
|
||
class BnplType | ||
{ | ||
const DEFERRED_PAYMENT = 'DEFERRED_PAYMENT'; | ||
const PAY_IN_THREE = 'PAY_IN_THREE'; | ||
} |
Oops, something went wrong.