Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Entity/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class Payment
'url_paid' => '',
'url_cancelled' => '',
'url_pending' => '',
'chargeUnregulatedCardFees' => false,
'enableApplePayGooglePay' => true,
'chargeUnregulatedCardFees' => null,
'enableApplePayGooglePay' => null,
'prepareOnly' => true,
'embedded' => false,
'allowedMethods' => [],
Expand Down Expand Up @@ -634,9 +634,9 @@ public function setUrlPendingRedirect(string $urlPending): self
return $this;
}

public function getChargeUnregulatedCardFees(): bool
public function getChargeUnregulatedCardFees(): ?bool
{
return $this->getParam('chargeUnregulatedCardFees');
return $this->params['chargeUnregulatedCardFees'] ?? null;
}

public function setChargeUnregulatedCardFees(bool $chargeUnregulatedCardFees): self
Expand All @@ -650,9 +650,9 @@ public function setChargeUnregulatedCardFees(bool $chargeUnregulatedCardFees): s
* Vrací true/false/null hodnotu zapnutého Google/Apple pay.
* @return null|bool
*/
public function getEnableApplePayGooglePay()
public function getEnableApplePayGooglePay(): ?bool
{
return $this->getParam('enableApplePayGooglePay');
return $this->params['enableApplePayGooglePay'] ?? null;
}

/**
Expand Down
15 changes: 13 additions & 2 deletions src/Entity/Request/PaymentCreateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,19 @@ public function toArray(): array
$output['url_paid'] = $this->payment->getUrlPaidRedirect() ?? '';
$output['url_cancelled'] = $this->payment->getUrlCancelledRedirect() ?? '';
$output['url_pending'] = $this->payment->getUrlPendingRedirect() ?? '';
$output['chargeUnregulatedCardFees'] = $this->payment->getChargeUnregulatedCardFees() ? 'true' : 'false';
$output['enableApplePayGooglePay'] = $this->payment->getEnableApplePayGooglePay() ? 'true' : 'false';

if($this->payment->getChargeUnregulatedCardFees() !== null) {
$output['chargeUnregulatedCardFees'] = $this->payment->getChargeUnregulatedCardFees() ? 'true' : 'false';
} else {
unset($output['chargeUnregulatedCardFees']);
}

if($this->payment->getEnableApplePayGooglePay() !== null) {
$output['enableApplePayGooglePay'] = $this->payment->getEnableApplePayGooglePay() ? 'true' : 'false';
} else {
unset($output['enableApplePayGooglePay']);
}

$output['embedded'] = $this->payment->isEmbedded() ? 'true' : 'false';

return $output;
Expand Down
6 changes: 3 additions & 3 deletions tests/Integration/Entity/Request/PaymentCreateRequestCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ protected function getPaymentScenarios(){
'url_paid' => '',
'url_cancelled' => '',
'url_pending' => '',
'chargeUnregulatedCardFees' => 'false',
'enableApplePayGooglePay' => 'true',
'initRecurringId' => '',

],
Expand All @@ -81,6 +79,8 @@ protected function getPaymentScenarios(){
->setUrlPaid('https://example.com/paid')
->setUrlPending('https://example.com/pending')
->setUrlCancelled('https://example.com/cancelled')
->setEnableApplePayGooglePay(true)
->setChargeUnregulatedCardFees(true)
,
'result' => [
'initRecurring' => 'true',
Expand Down Expand Up @@ -113,7 +113,7 @@ protected function getPaymentScenarios(){
'url_paid' => '',
'url_cancelled' => '',
'url_pending' => '',
'chargeUnregulatedCardFees' => 'false',
'chargeUnregulatedCardFees' => 'true',
'enableApplePayGooglePay' => 'true',
'country' => '',
'curr' => '',
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Entity/PaymentCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public function getParamsTest(UnitTester $I)
'url_paid' => '',
'url_cancelled' => '',
'url_pending' => '',
'chargeUnregulatedCardFees' => false,
'enableApplePayGooglePay' => true,
'chargeUnregulatedCardFees' => null,
'enableApplePayGooglePay' => null,
'initRecurringId' => '',

], $paymentParams);
Expand Down
Loading