Skip to content

Commit

Permalink
Merge pull request #8 from paynl/feature/PLUG-628
Browse files Browse the repository at this point in the history
PLUG-628: Codesniffer issues
  • Loading branch information
woutse authored Nov 18, 2021
2 parents 0b6c256 + 2cacf9d commit 23b1b41
Show file tree
Hide file tree
Showing 216 changed files with 646 additions and 1,378 deletions.
4 changes: 0 additions & 4 deletions Block/Adminhtml/Render/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
use Magento\Framework\Data\Form\Element\AbstractElement;
use Paynl\Payment\Model\Config;

/**
* Class Version
*
*/
class Version extends Field
{
protected $paynlConfig;
Expand Down
3 changes: 0 additions & 3 deletions Block/Adminhtml/System/Config/Fieldset/Expanded.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<?php
/**
* Copyright © 2020 PAY. All rights reserved.
*/
namespace Paynl\Payment\Block\Adminhtml\System\Config\Fieldset;

use Magento\Framework\Data\Form\Element\AbstractElement;
Expand Down
4 changes: 2 additions & 2 deletions Block/Css.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public function __construct()
{
$om = \Magento\Framework\App\ObjectManager::getInstance();

$page = $om->get('Magento\Framework\View\Page\Config');
$store = $om->get('Magento\Store\Model\Store');
$page = $om->get(\Magento\Framework\View\Page\Config::class);
$store = $om->get(\Magento\Store\Model\Store::class);
if ($store->getConfig('payment/paynl/pay_style_checkout') == 1) {
$page->addPageAsset('Paynl_Payment::css/paycheckout.css');
}
Expand Down
17 changes: 7 additions & 10 deletions Controller/Checkout/Exchange.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<?php
/**
* Copyright © 2020 PAY. All rights reserved.
*/

namespace Paynl\Payment\Controller\Checkout;

Expand All @@ -16,7 +13,7 @@
use Paynl\Result\Transaction\Transaction;

/**
* Description of Index
* Communicates with PAY. in order to update payment statuses in magento
*
* @author Andy Pieters <[email protected]>
*/
Expand Down Expand Up @@ -101,8 +98,7 @@ public function __construct(
OrderRepository $orderRepository,
\Paynl\Payment\Model\Config $paynlConfig,
\Magento\Sales\Model\Order\Payment\Transaction\BuilderInterface $builderInterface
)
{
) {
$this->result = $result;
$this->config = $config;
$this->orderFactory = $orderFactory;
Expand Down Expand Up @@ -203,7 +199,6 @@ public function execute()
return $this->cancelOrder($order);
}
}

}

private function cancelOrder(Order $order)
Expand Down Expand Up @@ -332,7 +327,7 @@ private function processPaidOrder(Transaction $transaction, Order $order)
# Skip creation of invoice for B2B if enabled
if ($this->config->ignoreB2BInvoice($paymentMethod)) {
$orderCompany = $order->getBillingAddress()->getCompany();
if(!empty($orderCompany)) {
if (!empty($orderCompany)) {
# Create transaction
$formatedPrice = $order->getBaseCurrency()->formatTxt($order->getGrandTotal());
$transactionMessage = __('PAY. - Captured amount of %1.', $formatedPrice);
Expand Down Expand Up @@ -420,8 +415,10 @@ private function processPartiallyPaidOrder(Order $order, $payOrderId)
->setTransactionId($subProfile)
->setFailSafe(true)
->build('capture')
->setAdditionalInformation(\Magento\Sales\Model\Order\Payment\Transaction::RAW_DETAILS,
array("Paymentmethod" => $method, "Amount" => $amount, "Currency" => $currency));
->setAdditionalInformation(
\Magento\Sales\Model\Order\Payment\Transaction::RAW_DETAILS,
["Paymentmethod" => $method, "Amount" => $amount, "Currency" => $currency]
);
$transactionBuilder->save();

$order->addStatusHistoryComment(__('PAY.: Partial payment received: '.$subProfile.' - Amount ' . $currency . ' ' . $amount . ' Method: ' . $method));
Expand Down
7 changes: 2 additions & 5 deletions Controller/Checkout/Finish.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<?php
/**
* Copyright © 2020 PAY. All rights reserved.
*/

namespace Paynl\Payment\Controller\Checkout;

Expand All @@ -16,7 +13,7 @@
use Psr\Log\LoggerInterface;

/**
* Description of Redirect
* Finishes up the payment and redirects the user to the thank you page.
*
* @author PAY. <[email protected]>
*/
Expand Down Expand Up @@ -91,7 +88,7 @@ public function execute()
$resultRedirect = $this->resultRedirectFactory->create();
$params = $this->getRequest()->getParams();
$payOrderId = empty($params['orderId']) ? (empty($params['orderid']) ? null : $params['orderid']) : $params['orderId'];
$orderStatusId = empty($params['orderStatusId']) ? null : intval($params['orderStatusId']);
$orderStatusId = empty($params['orderStatusId']) ? null : (int)$params['orderStatusId'];
$magOrderId = empty($params['entityid']) ? null : $params['entityid'];
$bSuccess = $orderStatusId === Config::ORDERSTATUS_PAID;
$bDenied = $orderStatusId === Config::ORDERSTATUS_DENIED;
Expand Down
31 changes: 13 additions & 18 deletions Controller/Checkout/Paylink.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
<?php
/**
* Copyright © 2020 PAY. All rights reserved.
*/

namespace Paynl\Payment\Controller\Checkout;

class Paylink extends \Magento\Framework\App\Action\Action
{
protected $_pageFactory;
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $pageFactory)
{

protected $_pageFactory;
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $pageFactory
) {
$this->_pageFactory = $pageFactory;
return parent::__construct($context);
}

$this->_pageFactory = $pageFactory;
return parent::__construct($context);
}

public function execute()
{
return $this->_pageFactory->create();
}
}
public function execute()
{
return $this->_pageFactory->create();
}
}
63 changes: 29 additions & 34 deletions Controller/Checkout/Redirect.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<?php
/**
* Copyright © 2020 PAY. All rights reserved.
*/

namespace Paynl\Payment\Controller\Checkout;

Expand All @@ -12,7 +9,7 @@
use Paynl\Payment\Controller\PayAction;

/**
* Description of Redirect
* Redirects the user.
*
* @author Andy Pieters <[email protected]>
*/
Expand All @@ -21,33 +18,32 @@ class Redirect extends PayAction
/**
* @var \Paynl\Payment\Model\Config
*/
private $config;
private $config;

/**
* @var \Magento\Checkout\Model\Session
*/
private $checkoutSession;
private $checkoutSession;

/**
* @var \Psr\Log\LoggerInterface
*/
private $_logger;
private $_logger;

/**
* @var PaymentHelper
*/
private $paymentHelper;

/**
* @var QuoteRepository
*/
private $quoteRepository;
private $paymentHelper;

/**
* @var QuoteRepository
*/
private $quoteRepository;

/**
* @var OrderRepository
*/
private $orderRepository;
/**
* @var OrderRepository
*/
private $orderRepository;

/**
* @param \Magento\Framework\App\Action\Context $context
Expand All @@ -60,16 +56,15 @@ public function __construct(
\Magento\Checkout\Model\Session $checkoutSession,
\Psr\Log\LoggerInterface $logger,
PaymentHelper $paymentHelper,
QuoteRepository $quoteRepository,
OrderRepository $orderRepository
)
{
QuoteRepository $quoteRepository,
OrderRepository $orderRepository
) {
$this->config = $config; // PAY. config helper
$this->checkoutSession = $checkoutSession;
$this->_logger = $logger;
$this->paymentHelper = $paymentHelper;
$this->quoteRepository = $quoteRepository;
$this->orderRepository = $orderRepository;
$this->quoteRepository = $quoteRepository;
$this->orderRepository = $orderRepository;

parent::__construct($context);
}
Expand All @@ -79,22 +74,22 @@ public function execute()
try {
$order = $this->checkoutSession->getLastRealOrder();

if(empty($order)){
if (empty($order)) {
throw new Error('No order found in session, please try again');
}

# Restore the quote
$quote = $this->quoteRepository->get($order->getQuoteId());
$quote->setIsActive(true)->setReservedOrderId(null);
$this->checkoutSession->replaceQuote($quote);
$this->quoteRepository->save($quote);
$quote = $this->quoteRepository->get($order->getQuoteId());
$quote->setIsActive(true)->setReservedOrderId(null);
$this->checkoutSession->replaceQuote($quote);
$this->quoteRepository->save($quote);

$payment = $order->getPayment();
$payment = $order->getPayment();

if (empty($payment)) {
$this->_redirect('checkout/cart');
return;
}
if (empty($payment)) {
$this->_redirect('checkout/cart');
return;
}

$methodInstance = $this->paymentHelper->getMethodInstance($payment->getMethod());
if ($methodInstance instanceof \Paynl\Payment\Model\Paymentmethod\Paymentmethod) {
Expand All @@ -103,7 +98,7 @@ public function execute()
$this->getResponse()->setNoCacheHeaders();
$this->getResponse()->setRedirect($redirectUrl);
} else {
throw new Error('PAY.: Method is not a paynl payment method');
throw new Error('PAY.: Method is not a paynl payment method');
}

} catch (\Exception $e) {
Expand Down
7 changes: 0 additions & 7 deletions Controller/PayAction.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
<?php
/**
* Copyright © 2020 Pay.nl All rights reserved.
*/

namespace Paynl\Payment\Controller;

/**
* Class PayAction
* @package Paynl\Payment\Controller
*/
abstract class PayAction extends \Magento\Framework\App\Action\Action
{
/**
Expand Down
Loading

0 comments on commit 23b1b41

Please sign in to comment.