Skip to content

Commit

Permalink
🐛 now get saved card config from each payment method
Browse files Browse the repository at this point in the history
  • Loading branch information
wallaceSF committed May 13, 2020
1 parent 4a6829e commit ae69372
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions src/Payment/Aggregates/Payments/NewDebitCardPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@

class NewDebitCardPayment extends NewCreditCardPayment
{
/** @var bool */
private $saveOnSuccess;

public function __construct()
{
$this->saveOnSuccess = false;
parent::__construct();
}

static public function getBaseCode()
{
return PaymentMethod::debitCard()->getMethod();
Expand All @@ -30,4 +39,24 @@ public function setInstallments(int $installments)

$this->installments = $installments;
}

public function isSaveOnSuccess()
{
$order = $this->getOrder();
if ($order === null) {
return false;
}

if (!MPSetup::getModuleConfiguration()->getDebitConfig()->isSaveCards()) {
return false;
}

$customer = $this->getCustomer();

if ($customer === null) {
return false;
}

return $this->saveOnSuccess;
}
}
2 changes: 1 addition & 1 deletion src/Payment/Aggregates/Payments/NewVoucherPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function isSaveOnSuccess()
return false;
}

if (!MPSetup::getModuleConfiguration()->isSaveCards()) {
if (!MPSetup::getModuleConfiguration()->getVoucherConfig()->isSaveCards()) {
return false;
}

Expand Down

0 comments on commit ae69372

Please sign in to comment.