Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ihor Sereda committed May 9, 2018
1 parent 002ec09 commit cf05cc1
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Once registered, you can manage the currencies you want to integrate in the Memb

1. Download the latest version of the integration: https://github.com/Paybear/paybear-magento2/releases/download/v0.2-alpha/paybear-magento2.zip
2. Extract the package and connect to your server using SFTP Clients. Then upload the app folder to Magento 2 root folder.
3. To complete the installation process you need to run following commands:
3. To complete the installation process you need to run following commands: <br>
php bin/magento setup:upgrade <br>
php bin/magento cache:clean
4. Log in to your Magento Administration page as administrator
Expand Down
13 changes: 10 additions & 3 deletions app/code/Paybear/Payment/Block/Form/Paybear.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Paybear\Payment\Block\Form;

use Magento\Checkout\Model\Session;
use Magento\Sales\Model\Order;


class Paybear extends \Magento\Framework\View\Element\Template
Expand All @@ -23,15 +24,19 @@ class Paybear extends \Magento\Framework\View\Element\Template

protected $_logger;

protected $registry;
protected $_order;

public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Sales\Api\OrderRepositoryInterface $orderRepository,
Session $checkoutSession,
\Paybear\Payment\Model\Payment $paybearPayment,
\Paybear\Payment\Helper\Data $helper,
\Magento\Framework\UrlInterface $url,

Order $order,
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\Registry $registry,
array $data = []
)
{
Expand All @@ -43,16 +48,18 @@ public function __construct(
$this->url = $url;

$this->_logger = $logger;
$this->_order = $order;
$this->registry = $registry;

parent::__construct($context, $data);
}

public function getOrder()
{
$id = $this->_checkoutSession->getLastOrderId();

$id = $this->registry->registry('last_real_order_id');
if ($id) {
$order = $this->_orderRepository->get($id);
$order = $this->_order->loadByIncrementId($id);
if ($order->getEntityId())
return $order;
}
Expand Down
2 changes: 2 additions & 0 deletions app/code/Paybear/Payment/Controller/Payment/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public function execute()
$order_id = (int)$params['order'];

$response = $this->paybearPayment->checkCallback($data, $order_id);
$this->helper->log('Order Id:' . $order_id);
$this->helper->log($response);

$this->getResponse()->setBody($response);
}
Expand Down
13 changes: 9 additions & 4 deletions app/code/Paybear/Payment/Controller/Payment/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,30 @@
class Payment extends Action
{
protected $orderFactory;
protected $coingatePayment;
protected $checkoutSession;
protected $registry;

public function __construct(
Context $context,
OrderFactory $orderFactory,
Session $checkoutSession,
Paybear $paybearPayment
Paybear $paybearPayment,
\Magento\Framework\Registry $registry
)
{
parent::__construct($context);

$this->orderFactory = $orderFactory;
$this->paybearPayment = $paybearPayment;
$this->checkoutSession = $checkoutSession;
$this->registry = $registry;

parent::__construct($context);
}

public function execute()
{
$last_real_order_id = $this->checkoutSession->getLastRealOrderId();
$this->registry->register('last_real_order_id', $last_real_order_id);

return $this->resultFactory->create('page');
}
}
4 changes: 2 additions & 2 deletions app/code/Paybear/Payment/Controller/Payment/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ public function __construct(

)
{
parent::__construct($context);

$this->order = $order;
$this->paybearPayment = $paybearPayment;

Expand All @@ -50,6 +48,8 @@ public function __construct(
$this->helper = $helper;

$this->orderStatus = $orderStatus;

parent::__construct($context);
}

public function execute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,10 @@
<item name="renders" xsi:type="array">
<item name="children" xsi:type="array">
<item name="paybear" xsi:type="array">
<item name="component"
xsi:type="string">Paybear_Payment/js/view/payment/paybear
</item>
<item name="component" xsi:type="string">Paybear_Payment/js/view/payment/paybear</item>
<item name="methods" xsi:type="array">
<item name="paybear" xsi:type="array">
<item name="isBillingAddressRequired"
xsi:type="boolean">true
</item>
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
</item>
</item>
Expand Down

0 comments on commit cf05cc1

Please sign in to comment.