Skip to content

Commit

Permalink
Merge pull request #91 from paynl/feature/PLUG-1677
Browse files Browse the repository at this point in the history
PLUG-1677 - Exchange formatting fixes
  • Loading branch information
woutse authored Jan 11, 2023
2 parents 0be245f + e32880d commit 4b51f5e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 16 deletions.
27 changes: 21 additions & 6 deletions Controller/Checkout/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,21 @@ class Exchange extends PayAction implements CsrfAwareActionInterface
*/
private $paynlHelper;

/**
*
* @param RequestInterface $request
* @return null
*/
public function createCsrfValidationException(RequestInterface $request): ?InvalidRequestException
{
return null;
}

/**
*
* @param RequestInterface $request
* @return boolean
*/
public function validateForCsrf(RequestInterface $request): bool
{
return true;
Expand All @@ -61,10 +71,10 @@ public function validateForCsrf(RequestInterface $request): bool
*
* @param \Magento\Framework\App\Action\Context $context
* @param \Paynl\Payment\Model\Config $config
* @param \Magento\Sales\Model\OrderFactory $orderFactory
* @param \Magento\Sales\Model\Order\Email\Sender\OrderSender $orderSender
* @param \Magento\Sales\Model\Order\Email\Sender\InvoiceSender $invoiceSender
* @param \Magento\Framework\Controller\Result\Raw $result
* @param OrderRepository $orderRepository
* @param PayPayment $payPayment
* @param PayHelper $paynlHelper
*/
public function __construct(
\Magento\Framework\App\Action\Context $context,
Expand All @@ -83,6 +93,10 @@ public function __construct(
parent::__construct($context);
}

/**
*
* @return \Magento\Framework\Controller\Result\Raw
*/
public function execute()
{
$params = $this->getRequest()->getParams();
Expand Down Expand Up @@ -220,10 +234,11 @@ public function execute()
}

/**
* @param $payOrderId
* @param $action
* @param string $payOrderId
* @param string $action
* @return void
*/
private function removeProcessing($payOrderId, $action)
private function removeProcessing(string $payOrderId, string $action)
{
if ($action == 'new_ppt') {
$this->paynlHelper->removeProcessing($payOrderId);
Expand Down
26 changes: 16 additions & 10 deletions Model/PayPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Magento\Sales\Model\Order\Payment\Interceptor;
use Magento\Sales\Model\OrderRepository;
use Paynl\Result\Transaction\Transaction;
use \Paynl\Payment\Helper\PayHelper;
use Paynl\Payment\Helper\PayHelper;

class PayPayment
{
Expand Down Expand Up @@ -48,14 +48,15 @@ class PayPayment
private $paynlConfig;

/**
* Exchange constructor.
* Constructor.
*
* @param \Magento\Framework\App\Action\Context $context
* @param \Paynl\Payment\Model\Config $config
* @param \Magento\Sales\Model\OrderFactory $orderFactory
* @param \Magento\Sales\Model\Order\Email\Sender\OrderSender $orderSender
* @param \Magento\Sales\Model\Order\Email\Sender\InvoiceSender $invoiceSender
* @param \Magento\Framework\Controller\Result\Raw $result
* @param \Magento\Framework\Event\ManagerInterface $eventManager
* @param OrderRepository $orderRepository
* @param \Paynl\Payment\Model\Config $paynlConfig
* @param \Magento\Sales\Model\Order\Payment\Transaction\BuilderInterface $builderInterface
*/
public function __construct(
\Paynl\Payment\Model\Config $config,
Expand All @@ -75,6 +76,10 @@ public function __construct(
$this->builderInterface = $builderInterface;
}

/**
* @param Order $order
* @return boolean
*/
public function cancelOrder(Order $order)
{
$returnResult = false;
Expand All @@ -95,6 +100,7 @@ public function cancelOrder(Order $order)

/**
* @param Order $order
* @return void
*/
public function uncancelOrder(Order $order)
{
Expand Down Expand Up @@ -140,7 +146,7 @@ public function uncancelOrder(Order $order)
/**
* @param Transaction $transaction
* @param Order $order
* @return bool
* @return boolean
* @throws \Magento\Framework\Exception\AlreadyExistsException
* @throws \Magento\Framework\Exception\InputException
* @throws \Magento\Framework\Exception\NoSuchEntityException
Expand Down Expand Up @@ -189,7 +195,6 @@ public function processPaidOrder(Transaction $transaction, Order $order)
if ($this->config->ignoreB2BInvoice($paymentMethod) && !empty($order->getBillingAddress()->getCompany())) {
$returnResult = $this->processB2BPayment($transaction, $order, $payment);
} else {

if ($transaction->isAuthorized()) {
$payment->registerAuthorizationNotification($order->getBaseGrandTotal());
} else {
Expand Down Expand Up @@ -218,6 +223,7 @@ public function processPaidOrder(Transaction $transaction, Order $order)
* @param Transaction $transaction
* @param Order $order
* @param Interceptor $payment
* @return boolean
*/
private function processB2BPayment(Transaction $transaction, Order $order, Interceptor $payment)
{
Expand All @@ -242,10 +248,10 @@ private function processB2BPayment(Transaction $transaction, Order $order, Inter

/**
* @param Order $order
* @param $payOrderId
* @return \Magento\Framework\Controller\Result\Raw
* @param string $payOrderId
* @return boolean
*/
public function processPartiallyPaidOrder(Order $order, $payOrderId)
public function processPartiallyPaidOrder(Order $order, string $payOrderId)
{
$returnResult = false;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
Expand Down

0 comments on commit 4b51f5e

Please sign in to comment.