Skip to content
Open
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
15 changes: 14 additions & 1 deletion src/Contexts/PaymentsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ class PaymentsContext extends BluemContext
public const PAYMENT_METHOD_CREDITCARD = 'CreditCard';
public const PAYMENT_METHOD_SOFORT = 'Sofort';
public const PAYMENT_METHOD_CARTE_BANCAIRE = 'CarteBancaire';
public const PAYMENT_METHOD_BANCONTACT = 'Bancontact';

public const PAYMENT_METHODS = [
self::PAYMENT_METHOD_IDEAL,
self::PAYMENT_METHOD_PAYPAL,
self::PAYMENT_METHOD_CREDITCARD,
self::PAYMENT_METHOD_SOFORT,
self::PAYMENT_METHOD_CARTE_BANCAIRE
self::PAYMENT_METHOD_CARTE_BANCAIRE,
self::PAYMENT_METHOD_BANCONTACT,
];

public string $debtorWalletElementName = self::PAYMENT_METHOD_IDEAL;
Expand All @@ -40,6 +42,7 @@ class PaymentsContext extends BluemContext
*/
public function __construct()
{
// @todo: make BICs method-specific
parent::__construct(
[
new BIC("ABNANL2A", "ABN AMRO"),
Expand Down Expand Up @@ -130,6 +133,11 @@ private function validateDetails(): array
// // add upcoming validation here
// }
//
// if($this->isBancontact()) {
// // validate DebtorAccountName to be TokenLength70SimpleType with minOccurs="0"
// // validate DebtorAccount to be TokenLength70SimpleType with minOccurs="0"
// }

// return [];
}

Expand Down Expand Up @@ -162,4 +170,9 @@ public function isCarteBancaire(): bool
{
return $this->debtorWalletElementName === self::PAYMENT_METHOD_CARTE_BANCAIRE;
}

public function isBancontact(): bool
{
return $this->debtorWalletElementName === self::PAYMENT_METHOD_BANCONTACT;
}
}
13 changes: 12 additions & 1 deletion src/Requests/PaymentBluemRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ public function setPaymentMethodToCarteBancaire(): self
return $this;
}

public function setPaymentMethodToBancontact(): self
{
$this->setPaymentMethod($this->context::PAYMENT_METHOD_BANCONTACT);
return $this;
}

/**
* @param mixed $dueDateTime
* @return string
Expand Down Expand Up @@ -342,9 +348,14 @@ private function XmlWrapDebtorWalletForPaymentMethod(): string
} elseif ($this->context->isSofort()) {
// if specific sofort body becomes required in the future; please add it here
} elseif ($this->context->isCarteBancaire()) {
// $res .= "CARTE_BANCAIRE";
// if specific carte bancaire body becomes required in the future; please add it here
} elseif ($this->context->isBancontact()) {
// $res .= "BANCONTACT";
// if specific bancontact body becomes required in the future; please add it here
}


$res .= "</{$this->context->debtorWalletElementName}>" . PHP_EOL;
return $res . ("</DebtorWallet>" . PHP_EOL);
}
Expand All @@ -357,7 +368,7 @@ private function XmlWrapDebtorWalletForPaymentMethod(): string
* @return void
* @throws Exception
*/
public function selectDebtorWallet($BIC)
public function selectDebtorWallet($BIC): void
{

if (! in_array($BIC, $this->context->getBICCodes())) {
Expand Down