diff --git a/Api.php b/Api.php index 8f4d1fd..4728997 100644 --- a/Api.php +++ b/Api.php @@ -73,6 +73,7 @@ public function prepareTransaction(ArrayObject $details, string $returnUrl, stri 'billingAddress' => $billingAddress, 'metaData' => ['paymentToken' => $notifyTokenHash], 'allowedPaymentMethodBrands' => $transactionExtender['allowedPaymentMethodBrands'] ?? [], + 'allowedPaymentMethodConfigurations' => $transactionExtender['allowedPaymentMethodConfigurations'] ?? [], ]); return $this->getTransactionService()->create($this->getSpaceId(), $transaction); diff --git a/README.md b/README.md index 4a07f9c..e578bb6 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ You need to define a global webhook: `https://your-domain.com/payment/notify/uns ## Changelog ### 1.1.0 - add integration types +- Add `allowedPaymentMethodConfigurations` option ### 1.0.4 - keep payment state at `new` even if postfinance status is `confirmed`. Reason: PF state `confirmed` only means, that the payment itself cannot be altered anymore and instantly triggers, as soon the payment transaction has been dispatched. ### 1.0.3 diff --git a/Transaction/Transaction.php b/Transaction/Transaction.php index d6500cf..6778aef 100644 --- a/Transaction/Transaction.php +++ b/Transaction/Transaction.php @@ -12,6 +12,7 @@ class Transaction protected ?string $currency; protected ?string $language = null; protected ?array $allowedPaymentMethodBrands = null; + protected ?array $allowedPaymentMethodConfigurations = null; protected ?AddressCreate $shippingAddress = null; protected ?AddressCreate $billingAddress = null; @@ -66,6 +67,16 @@ public function setAllowedPaymentMethodBrands(?array $allowedPaymentMethodBrands $this->allowedPaymentMethodBrands = $allowedPaymentMethodBrands; } + public function getAllowedPaymentMethodConfigurations(): ?array + { + return $this->allowedPaymentMethodConfigurations; + } + + public function setAllowedPaymentMethodConfigurations(?array $allowedPaymentMethodConfigurations): void + { + $this->allowedPaymentMethodConfigurations = $allowedPaymentMethodConfigurations; + } + public function getShippingAddress(): ?AddressCreate { return $this->shippingAddress; @@ -89,13 +100,14 @@ public function setBillingAddress(?AddressCreate $billingAddress): void public function toArray(): array { $data = [ - 'id' => $this->getId(), - 'amount' => $this->getAmount(), - 'currency' => $this->getCurrency(), - 'language' => $this->getLanguage(), - 'allowedPaymentMethodBrands' => $this->getAllowedPaymentMethodBrands(), - 'shippingAddress' => $this->shippingAddress === null ? [] : (array) ObjectSerializer::sanitizeForSerialization($this->shippingAddress), - 'billingAddress' => $this->billingAddress === null ? [] : (array) ObjectSerializer::sanitizeForSerialization($this->billingAddress) + 'id' => $this->getId(), + 'amount' => $this->getAmount(), + 'currency' => $this->getCurrency(), + 'language' => $this->getLanguage(), + 'allowedPaymentMethodBrands' => $this->getAllowedPaymentMethodBrands(), + 'allowedPaymentMethodConfigurations' => $this->getAllowedPaymentMethodConfigurations(), + 'shippingAddress' => $this->shippingAddress === null ? [] : (array) ObjectSerializer::sanitizeForSerialization($this->shippingAddress), + 'billingAddress' => $this->billingAddress === null ? [] : (array) ObjectSerializer::sanitizeForSerialization($this->billingAddress) ]; return array_filter($data, static function ($row) {