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 51c99e26 authored by basm's avatar basm

Fix PayPal capture mode

parent ccbd5337
......@@ -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;
}
......@@ -1248,18 +1249,19 @@ class Cron
);
return true;
}
// if PayPal capture modues is different from the default use this one
if (strcmp($this->_paymentMethod, 'paypal') === 0 && $captureModePayPal != "") {
if (strcmp($captureModePayPal, 'auto') === 0) {
$this->_adyenLogger->addAdyenNotificationCronjob(
'This payment method is paypal and configured to work as auto capture'
);
return true;
} elseif (strcmp($captureModePayPal, 'manual') === 0) {
if (strcmp($this->_paymentMethod, 'paypal') === 0) {
if ($captureModePayPal) {
$this->_adyenLogger->addAdyenNotificationCronjob(
'This payment method is paypal and configured to work as manual capture'
);
return false;
} else {
$this->_adyenLogger->addAdyenNotificationCronjob(
'This payment method is paypal and configured to work as auto capture'
);
return true;
}
}
if (strcmp($captureMode, 'manual') === 0) {
......@@ -1609,4 +1611,6 @@ class Cron
$path = 'payment/' . $paymentMethodCode . '/' . $field;
return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
}
}
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