diff --git a/Controller/Checkout/Finish.php b/Controller/Checkout/Finish.php
index 54a4c7fb..7e5b5f76 100644
--- a/Controller/Checkout/Finish.php
+++ b/Controller/Checkout/Finish.php
@@ -111,6 +111,7 @@ public function execute()
$bPending = in_array($orderStatusId, Config::ORDERSTATUS_PENDING);
$bDenied = $orderStatusId === Config::ORDERSTATUS_DENIED;
$bCanceled = $orderStatusId === Config::ORDERSTATUS_CANCELED;
+ $bVerify = $orderStatusId === Config::ORDERSTATUS_VERIFY;
$isPinTransaction = false;
try {
@@ -143,7 +144,7 @@ public function execute()
$bSuccess = ($transaction->isPaid() || $transaction->isAuthorized());
}
- if ($bSuccess) {
+ if ($bSuccess || $bVerify) {
$successUrl = $this->config->getSuccessPage($payment->getMethod());
if (empty($successUrl)) {
$successUrl = ($payment->getMethod() == 'paynl_payment_paylink' || $this->config->sendEcommerceAnalytics()) ? Config::FINISH_PAY : Config::FINISH_STANDARD;
@@ -152,9 +153,19 @@ public function execute()
if ($isPinTransaction && $pinStatus->getTransactionState() !== 'approved') {
$this->messageManager->addNoticeMessage(__('Order has been made and the payment is pending.'));
}
+ if ($bVerify) {
+ $order->addStatusHistoryComment(__('PAY. - This payment has been flagged as possibly fraudulent. Please verify this transaction in the Pay. portal.'));
+ $this->orderRepository->save($order);
+ }
$this->deactivateCart($order, $payOrderId);
} elseif ($bPending) {
- $resultRedirect->setPath(Config::PENDING_PAY);
+ $successUrl = Config::FINISH_STANDARD;
+ if ($this->config->getPendingPage()) {
+ $successUrl = Config::PENDING_PAY;
+ } elseif ($this->config->sendEcommerceAnalytics()) {
+ $successUrl = Config::FINISH_PAY;
+ }
+ $resultRedirect->setPath($successUrl, ['_query' => ['utm_nooverride' => '1']]);
$this->deactivateCart($order, $payOrderId);
} else {
$cancelMessage = $bDenied ? __('Payment denied') : __('Payment canceled');
diff --git a/Model/Config.php b/Model/Config.php
index 4a77f31b..d1df6254 100755
--- a/Model/Config.php
+++ b/Model/Config.php
@@ -19,6 +19,7 @@ class Config
public const ORDERSTATUS_PENDING = array(20, 25, 40, 50, 90);
public const ORDERSTATUS_DENIED = -63;
public const ORDERSTATUS_CANCELED = -90;
+ public const ORDERSTATUS_VERIFY = 85;
/** @var Store */
private $store;
@@ -328,6 +329,14 @@ public function sendEcommerceAnalytics()
return $this->store->getConfig('payment/paynl/google_analytics_ecommerce') == 1;
}
+ /**
+ * @return boolean
+ */
+ public function getPendingPage()
+ {
+ return $this->store->getConfig('payment/paynl/pay_pending_page') == 1;
+ }
+
/**
* @param string $methodCode
* @return string
diff --git a/Model/PayPayment.php b/Model/PayPayment.php
index ce24c890..80488942 100644
--- a/Model/PayPayment.php
+++ b/Model/PayPayment.php
@@ -45,6 +45,12 @@ class PayPayment
*/
private $builderInterface;
+ /**
+ *
+ * @var Magento\Sales\Model\Order\PaymentFactory
+ */
+ private $paymentFactory;
+
private $paynlConfig;
/**
@@ -57,6 +63,7 @@ class PayPayment
* @param OrderRepository $orderRepository
* @param \Paynl\Payment\Model\Config $paynlConfig
* @param \Magento\Sales\Model\Order\Payment\Transaction\BuilderInterface $builderInterface
+ * @param \Magento\Sales\Model\Order\PaymentFactory $paymentFactory
*/
public function __construct(
\Paynl\Payment\Model\Config $config,
@@ -65,7 +72,8 @@ public function __construct(
\Magento\Framework\Event\ManagerInterface $eventManager,
OrderRepository $orderRepository,
\Paynl\Payment\Model\Config $paynlConfig,
- \Magento\Sales\Model\Order\Payment\Transaction\BuilderInterface $builderInterface
+ \Magento\Sales\Model\Order\Payment\Transaction\BuilderInterface $builderInterface,
+ \Magento\Sales\Model\Order\PaymentFactory $paymentFactory
) {
$this->eventManager = $eventManager;
$this->config = $config;
@@ -74,6 +82,7 @@ public function __construct(
$this->orderRepository = $orderRepository;
$this->paynlConfig = $paynlConfig;
$this->builderInterface = $builderInterface;
+ $this->paymentFactory = $paymentFactory;
}
/**
@@ -254,9 +263,6 @@ private function processB2BPayment(Transaction $transaction, Order $order, Inter
public function processPartiallyPaidOrder(Order $order, string $payOrderId)
{
$returnResult = false;
- $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
- $orderPaymentFactory = $objectManager->get(\Magento\Sales\Model\Order\PaymentFactory::class);
-
try {
$details = \Paynl\Transaction::details($payOrderId);
@@ -278,7 +284,7 @@ public function processPartiallyPaidOrder(Order $order, string $payOrderId)
/** @var Interceptor $orderPayment */
if (!$firstPayment) {
- $orderPayment = $orderPaymentFactory->create();
+ $orderPayment = $this->paymentFactory->create();
} else {
$orderPayment = $order->getPayment();
}
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index 58eb7ad9..54e313d7 100644
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -21,7 +21,7 @@
Paynl\Payment\Block\Adminhtml\Render\Credentials
-
+
here. Not registered at PAY? Sign up here!]]>
@@ -190,6 +190,12 @@
Paynl\Payment\Model\Config\Source\GoogleAnalyticspayment/paynl/google_analytics_ecommerce
+
+
+
+ Paynl\Payment\Model\Config\Source\OffOn
+ payment/paynl/pay_pending_page
+
diff --git a/etc/config.xml b/etc/config.xml
index 6d849048..3a7d67c6 100755
--- a/etc/config.xml
+++ b/etc/config.xml
@@ -11,6 +11,7 @@
11Order
+ 10
diff --git a/i18n/en_US.csv b/i18n/en_US.csv
index 5cfe2528..62fd4447 100644
--- a/i18n/en_US.csv
+++ b/i18n/en_US.csv
@@ -134,3 +134,5 @@
"Check version","Check version"
"You are up to date with the latest version","You are up to date with the latest version"
"There is a new version available (","There is a new version available ("
+"PAY. - This payment has been flagged as possibly fraudulent. Please verify this transaction in the Pay. portal.","PAY. - This payment has been flagged as possibly fraudulent. Please verify this transaction in the Pay. portal."
+"Select whether you want to use the PAY. thank you page when transaction is pending.","Select whether you want to use the PAY. thank you page when transaction is pending."
diff --git a/i18n/nl_NL.csv b/i18n/nl_NL.csv
index c309d696..02f9922d 100644
--- a/i18n/nl_NL.csv
+++ b/i18n/nl_NL.csv
@@ -182,3 +182,5 @@
"Check version","Check versie"
"You are up to date with the latest version","U bent up to date met de laatste versie"
"There is a new version available (","Er is een nieuwe versie beschikbaar ("
+"PAY. - This payment has been flagged as possibly fraudulent. Please verify this transaction in the Pay. portal.","PAY. - Deze betaling is gemarkeerd als mogelijk frauduleus. Controleer deze transactie in het Pay. portaal."
+"Select whether you want to use the PAY. thank you page when transaction is pending.","Selecteer of u gebruik wilt maken van de PAY. bedankpagina wanneer de transactie in behandeling is."