Skip to content

Commit

Permalink
Merge pull request #6 from appinlet/release/1.1.2
Browse files Browse the repository at this point in the history
Release/1.1.2
  • Loading branch information
appinlet authored Jan 5, 2022
2 parents 1ac0e5f + fa6c700 commit cdba10f
Show file tree
Hide file tree
Showing 45 changed files with 1,487 additions and 958 deletions.
12 changes: 9 additions & 3 deletions Dpo/Dpo/Block/Form.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
/*
* Copyright (c) 2020 PayGate (Pty) Ltd
/**
* Copyright (c) 2022 DPO Group
*
* Author: App Inlet (Pty) Ltd
*
* Released under the GNU General Public License
*/
namespace Dpo\Dpo\Block\Dpo;
namespace Dpo\Dpo\Block;

use Dpo\Dpo\Helper\Data;
use Dpo\Dpo\Model\Config;
Expand Down Expand Up @@ -52,6 +52,11 @@ class Form extends \Magento\Payment\Block\Form
*/
protected $currentCustomer;

/**
* @var LoggerInterface
*/
protected $_logger;

/**
* @param Context $context
* @param ConfigFactory $dpoConfigFactory
Expand All @@ -68,6 +73,7 @@ public function __construct(
CurrentCustomer $currentCustomer,
array $data = []
) {
$this->_logger = $context->getLogger();
$pre = __METHOD__ . " : ";
$this->_logger->debug( $pre . 'bof' );
$this->_dpoData = $dpoData;
Expand Down
2 changes: 1 addition & 1 deletion Dpo/Dpo/Block/Payment/Info.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (c) 2020 PayGate (Pty) Ltd
* Copyright (c) 2022 DPO Group
*
* Author: App Inlet (Pty) Ltd
*
Expand Down
13 changes: 12 additions & 1 deletion Dpo/Dpo/Block/Payment/Request.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (c) 2020 PayGate (Pty) Ltd
* Copyright (c) 2022 DPO Group
*
* Author: App Inlet (Pty) Ltd
*
Expand Down Expand Up @@ -70,4 +70,15 @@ public function __construct(
$this->reader = $reader;
$this->_paymentMethod = $paymentMethod;
}

public function _prepareLayout()
{
$this->setMessage( 'Redirecting to DPO Group' )
->setId( 'dpo_checkout' )
->setName( 'dpo_checkout' )
->setFormData( $this->_paymentMethod->getStandardCheckoutFormFields() )
->setSubmitForm( '<script type="text/javascript">document.getElementById( "dpo_checkout" ).submit();</script>' );

return parent::_prepareLayout();
}
}
85 changes: 48 additions & 37 deletions Dpo/Dpo/Controller/AbstractDpo.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (c) 2020 PayGate (Pty) Ltd
* Copyright (c) 2022 DPO Group
*
* Author: App Inlet (Pty) Ltd
*
Expand All @@ -11,7 +11,24 @@
use Dpo\Dpo\Model\Dpo;
use Magento\Checkout\Controller\Express\RedirectLoginInterface;
use Magento\Framework\App\Action\Action as AppAction;

use Magento\Framework\App\Action\Context;
use Magento\Framework\View\Result\PageFactory;
use Magento\Customer\Model\Session as CustomerSession;
use Magento\Checkout\Model\Session as CheckoutSession;
use Magento\Sales\Model\OrderFactory;
use Magento\Framework\Session\Generic;
use Magento\Framework\Url\Helper\Data;
use Magento\Customer\Model\Url;
use Psr\Log\LoggerInterface;
use Magento\Framework\DB\TransactionFactory ;
use Magento\Sales\Model\Service\InvoiceService;
use Magento\Sales\Model\Order\Email\Sender\InvoiceSender;
use Magento\Framework\UrlInterface;
use Magento\Sales\Api\OrderRepositoryInterface;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Sales\Model\Order\Email\Sender\OrderSender;
use Magento\Framework\Stdlib\DateTime\DateTime;
use Magento\Framework\Data\Form\FormKey;
/**
* Checkout Controller
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
Expand All @@ -23,12 +40,10 @@ abstract class AbstractDpo extends AppAction implements RedirectLoginInterface
*
* @var array
*/
protected $_checkoutTypes = [];

/**
* @var \Dpo\Dpo\Model\Config
*/
protected $_config;

/**
* @var \Magento\Quote\Model\Quote
Expand All @@ -40,7 +55,6 @@ abstract class AbstractDpo extends AppAction implements RedirectLoginInterface
*
* @var string
*/
protected $_configType = 'Dpo\Dpo\Model\Config';

/** Config method type @var string */
protected $_configMethod = \Dpo\Dpo\Model\Config::METHOD_CODE;
Expand All @@ -50,7 +64,6 @@ abstract class AbstractDpo extends AppAction implements RedirectLoginInterface
*
* @var string
*/
protected $_checkoutType;

/**
* @var \Magento\Customer\Model\Session
Expand Down Expand Up @@ -107,6 +120,7 @@ abstract class AbstractDpo extends AppAction implements RedirectLoginInterface
*/
protected $_paymentMethod;
protected $orderRepository;

/**
* @param \Magento\Framework\App\Action\Context $context
* @param \Magento\Framework\View\Result\PageFactory $pageFactory
Expand All @@ -116,34 +130,43 @@ abstract class AbstractDpo extends AppAction implements RedirectLoginInterface
* @param \Magento\Framework\Session\Generic $DpoSession
* @param \Magento\Framework\Url\Helper\Data $urlHelper
* @param \Magento\Customer\Model\Url $customerUrl
* @param LoggerInterface $logger
* @param \Magento\Framework\DB\TransactionFactory $transactionFactory
* @param InvoiceService $invoiceService
* @param InvoiceSender $invoiceSender
* @param \Dpo\Dpo\Model\Dpo $paymentMethod
* @param UrlInterface $urlBuilder
* @param OrderRepositoryInterface $orderRepository
* @param StoreManagerInterface $storeManager
* @param OrderSender $OrderSender
* @param DateTime $date
* @param FormKey $formKey
*/
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $pageFactory,
\Magento\Customer\Model\Session $customerSession,
\Magento\Checkout\Model\Session $checkoutSession,
\Magento\Sales\Model\OrderFactory $orderFactory,
\Magento\Framework\Session\Generic $DpoSession,
\Magento\Framework\Url\Helper\Data $urlHelper,
\Magento\Customer\Model\Url $customerUrl,
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\DB\TransactionFactory $transactionFactory,
\Magento\Sales\Model\Service\InvoiceService $invoiceService,
\Magento\Sales\Model\Order\Email\Sender\InvoiceSender $invoiceSender,
\Dpo\Dpo\Model\Dpo $paymentMethod,
\Magento\Framework\UrlInterface $urlBuilder,
\Magento\Sales\Api\OrderRepositoryInterface $orderRepository,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Sales\Model\Order\Email\Sender\OrderSender $OrderSender,
\Magento\Framework\Stdlib\DateTime\DateTime $date
Context $context,
PageFactory $pageFactory,
CustomerSession $customerSession,
CheckoutSession $checkoutSession,
OrderFactory $orderFactory,
Generic $DpoSession,
Data $urlHelper,
Url $customerUrl,
LoggerInterface $logger,
TransactionFactory $transactionFactory,
InvoiceService $invoiceService,
InvoiceSender $invoiceSender,
Dpo $paymentMethod,
UrlInterface $urlBuilder,
OrderRepositoryInterface $orderRepository,
StoreManagerInterface $storeManager,
OrderSender $OrderSender,
DateTime $date,
FormKey $formKey
) {
// CsrfAwareAction Magento2.3 compatibility
if ( interface_exists( "\Magento\Framework\App\CsrfAwareActionInterface" ) ) {
$request = $this->getRequest();
if ( $request instanceof HttpRequest && $request->isPost() && empty( $request->getParam( 'form_key' ) ) ) {
$formKey = $this->_objectManager->get( \Magento\Framework\Data\Form\FormKey::class );
$request->setParam( 'form_key', $formKey->getFormKey() );
}
}
Expand Down Expand Up @@ -173,9 +196,6 @@ public function __construct(

parent::__construct( $context );

$parameters = ['params' => [$this->_configMethod]];
$this->_config = $this->_objectManager->create( $this->_configType, $parameters );

$this->_logger->debug( $pre . 'eof' );
}

Expand Down Expand Up @@ -266,15 +286,6 @@ protected function _getQuote()
return $this->_quote;
}

/**
* Returns before_auth_url redirect parameter for customer session
* @return null
*/
public function getCustomerBeforeAuthUrl()
{
return;
}

/**
* Returns a list of action flags [flag_key] => boolean
* @return array
Expand Down
Loading

0 comments on commit cdba10f

Please sign in to comment.