Skip to content

Commit

Permalink
Merge pull request #6 from dachcom-digital/payment_methods
Browse files Browse the repository at this point in the history
add allowedPaymentMethodConfigurations option config
  • Loading branch information
solverat authored May 27, 2024
2 parents 9b982d7 + 1ef2ed2 commit 7bb11eb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
1 change: 1 addition & 0 deletions Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 19 additions & 7 deletions Transaction/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit 7bb11eb

Please sign in to comment.