-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from paynl/feature/PLUG-628
PLUG-628: Codesniffer issues
- Loading branch information
Showing
216 changed files
with
646 additions
and
1,378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
|
@@ -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]> | ||
*/ | ||
|
@@ -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; | ||
|
@@ -203,7 +199,6 @@ public function execute() | |
return $this->cancelOrder($order); | ||
} | ||
} | ||
|
||
} | ||
|
||
private function cancelOrder(Order $order) | ||
|
@@ -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); | ||
|
@@ -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)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
|
@@ -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]> | ||
*/ | ||
|
@@ -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; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
|
@@ -12,7 +9,7 @@ | |
use Paynl\Payment\Controller\PayAction; | ||
|
||
/** | ||
* Description of Redirect | ||
* Redirects the user. | ||
* | ||
* @author Andy Pieters <[email protected]> | ||
*/ | ||
|
@@ -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 | ||
|
@@ -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); | ||
} | ||
|
@@ -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) { | ||
|
@@ -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) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.