Skip to content

Commit

Permalink
Merge pull request #4 from digitickets/v2-allow-empty-payment-methods
Browse files Browse the repository at this point in the history
Allow empty payment methods param, allowing Payyo to handle what's av…
  • Loading branch information
hkwak authored Nov 23, 2023
2 parents 3c81d51 + bef45f2 commit ab955a8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Message/AuthorizeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function setPaymentMethods($value)
*/
public function getPaymentMethods()
{
return $this->getParameter('paymentMethods') ?: ['credit_card'];
return $this->getParameter('paymentMethods');
}

protected function getRpcMethod(): string
Expand All @@ -70,7 +70,6 @@ public function getData()
'description' => $this->getDescription(),
'currency' => $this->getCurrency(),
'amount' => $this->getAmountInteger(),
'payment_methods' => (array) $this->getPaymentMethods(),
'return_urls' => [
'success' => $this->getReturnUrl(),
'error' => $this->getCancelUrl(),
Expand All @@ -79,6 +78,10 @@ public function getData()
'language' => $this->getLanguage(),
];

if (is_array($this->getPaymentMethods()) && count($this->getPaymentMethods()) > 0) {
$data['payment_methods'] = $this->getPaymentMethods();
}

if ($this->getNotifyUrl()) {
$data['webhooks'] = [
[
Expand Down

0 comments on commit ab955a8

Please sign in to comment.