We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday in our country

Commit 4a4f0e48 authored by Rik ter Beek's avatar Rik ter Beek

fix for klarna_account

parent 80266bd7
......@@ -464,7 +464,7 @@ class Data extends AbstractHelper
{
return $this->getConfigData($field, 'adyen_apple_pay', $storeId);
}
/**
* @param null $storeId
* @return mixed
......@@ -849,13 +849,13 @@ class Data extends AbstractHelper
{
if (strlen($paymentMethod) >= 9 && substr($paymentMethod, 0, 9) == 'afterpay_') {
return true;
} else {
if ($paymentMethod == 'klarna' || $paymentMethod == 'ratepay') {
return true;
} else {
return false;
}
} elseif (strlen($paymentMethod) >= 6 && substr($paymentMethod, 0, 6) == 'klarna') {
return true;
} elseif (strlen($paymentMethod) >= 7 && substr($paymentMethod, 0, 7) == 'ratepay') {
return true;
}
return false;
}
public function getRatePayId()
......
......@@ -210,7 +210,8 @@ class Cron
\Adyen\Payment\Model\Order\PaymentFactory $adyenOrderPaymentFactory,
\Adyen\Payment\Model\Resource\Order\Payment\CollectionFactory $adyenOrderPaymentCollectionFactory,
AreaList $areaList
) {
)
{
$this->_scopeConfig = $scopeConfig;
$this->_adyenLogger = $adyenLogger;
$this->_notificationFactory = $notificationFactory;
......@@ -235,7 +236,7 @@ class Cron
{
try {
$this->execute();
} catch(\Exception $e) {
} catch (\Exception $e) {
$this->_adyenLogger->addAdyenNotificationCronjob($e->getMessage() . "\n" . $e->getTraceAsString());
throw $e;
}
......@@ -536,11 +537,7 @@ class Cron
}
// if payment method is klarna, ratepay or openinvoice/afterpay show the reservartion number
if (($this->_paymentMethod == "klarna" || $this->_paymentMethod == "afterpay_default" ||
$this->_paymentMethod == "openinvoice" || $this->_paymentMethod == "ratepay"
) && ($this->_klarnaReservationNumber != null &&
$this->_klarnaReservationNumber != "")
) {
if ($this->_adyenHelper->isPaymentMethodOpenInvoiceMethod($this->_paymentMethod) && !empty($this->_klarnaReservationNumber)) {
$klarnaReservationNumberText = "<br /> reservationNumber: " . $this->_klarnaReservationNumber;
} else {
$klarnaReservationNumberText = "";
......@@ -1298,6 +1295,11 @@ class Cron
$manualCaptureAllowed = null;
$paymentMethod = $this->_paymentMethod;
// For all openinvoice methods manual capture is the default
if ($this->_adyenHelper->isPaymentMethodOpenInvoiceMethod($paymentMethod)) {
return true;
}
switch ($paymentMethod) {
case 'cup':
case 'cartebancaire':
......@@ -1314,17 +1316,10 @@ class Cron
case 'jcb':
case 'laser':
case 'paypal':
case 'klarna':
case 'afterpay_default':
case 'ratepay':
case 'sepadirectdebit':
$manualCaptureAllowed = true;
break;
default:
// To be sure check if it payment method starts with afterpay_ then manualCapture is allowed
if (strlen($this->_paymentMethod) >= 9 && substr($this->_paymentMethod, 0, 9) == "afterpay_") {
$manualCaptureAllowed = true;
}
$manualCaptureAllowed = false;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment