Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .github/img-en/01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/img-en/02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/img-en/03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/img-en/04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/img-en/05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/img-en/06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/img-en/07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions Api/UpdateStatusesInterface.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?php

namespace Asaas\Magento2\Api;
//use Asaas\Magento2\Api\Data\PointInterface;

/**
* @api
*/
interface UpdateStatusesInterface
{
/**
* Post Company.
* Update Order Status.
*
* @api
* @param mixed $event
Expand Down
36 changes: 36 additions & 0 deletions Block/Adminhtml/Order/View/Tab/PixPaymentInfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace Asaas\Magento2\Block\Adminhtml\Order\View\Tab;

class PixPaymentInfo extends \Magento\Framework\View\Element\Template
{
protected $request;
protected $orderRepository;

protected $_template = 'Asaas_Magento2::order/view/tab/pix_payment_info.phtml';

public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Framework\App\Request\Http $http,
\Magento\Sales\Api\OrderRepositoryInterface $orderRepositoryInterface,
array $data = []
) {
parent::__construct($context, $data);
$this->request = $http;
$this->orderRepository = $orderRepositoryInterface;
}
public function getOrder()
{
$orderId = $this->request->getParam('order_id');
$order = $this->orderRepository->get($orderId);
return $order;
}


public function getPaymentMethodByOrder()
{
$order = $this->getOrder();
$payment = $order->getPayment();
return $payment->getMethod();
}
}
29 changes: 28 additions & 1 deletion Block/Payment/Info.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
<?php

namespace Asaas\Magento2\Block\Payment;

class Info extends \Magento\Framework\View\Element\Template
{
protected $_checkoutSession;
protected $_orderFactory;
protected $_scopeConfig;
protected $request;
protected $orderRepository;

protected $_template = 'Asaas_Magento2::info/info.phtml';

public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Checkout\Model\Session $checkoutSession,
\Magento\Sales\Model\OrderFactory $orderFactory,
\Magento\Framework\App\Request\Http $http,
\Magento\Sales\Api\OrderRepositoryInterface $orderRepositoryInterface,
array $data = []
) {
parent::__construct($context, $data);
$this->_checkoutSession = $checkoutSession;
$this->_orderFactory = $orderFactory;
$this->request = $http;
$this->orderRepository = $orderRepositoryInterface;
}


Expand All @@ -33,7 +40,12 @@ public function getOrder()
if ($this->_checkoutSession->getLastRealOrderId()) {
return $this->_checkoutSession->getLastRealOrder();
}
if ($order = $this->getInfo()->getOrder()) {
// if ($order = $this->getInfo()->getOrder()) {
// return $order;
// }
else {
$orderId = $this->request->getParam('order_id');
$order = $this->orderRepository->get($orderId);
return $order;
}
return false;
Expand All @@ -45,6 +57,13 @@ public function getPaymentMethod()
return $payment->getMethod();
}

public function getPaymentMethodByOrder()
{
$order = $this->getOrder();
$payment = $order->getPayment();
return $payment->getMethod();
}

public function getPaymentInfo()
{
$order = $this->getOrder();
Expand All @@ -66,6 +85,14 @@ public function getPaymentInfo()

);
break;
case 'pix':
return array(
'tipo' => 'Pix',
'url' => 'qrcode',
'texto' => 'Escaneie o QrCode ou copie o código para realizar o pagamento'

);
break;

}
}
Expand Down
8 changes: 8 additions & 0 deletions Block/Success.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ public function __construct(
public function getBoleto() {
return $this->checkoutSession->getBoleto();
}

public function getPixQrCode() {
return $this->checkoutSession->getPixQrCode();
}

public function getPixPayload() {
return $this->checkoutSession->getPixPayload();
}

public function getOrder() {
return $this->_order = $this->_orderFactory->create()->loadByIncrementId(
Expand Down
4 changes: 4 additions & 0 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,8 @@ public function getInstallments() {
public function getMinParcela(){
return $this->getConfig('payment/asaasmagento2/options_cc/min_parcela');
}

public function getPixInstructions(){
return $this->getConfig('payment/asaasmagento2/options_pix/instrucoes');
}
}
2 changes: 1 addition & 1 deletion Model/Config/Source/Ambiente.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ class Ambiente
* @var string[]
*/ public function toOptionArray()
{
return [['value' => 'production', 'label' => __('Produção')], ['value' => 'dev', 'label' => __('Desenvolvimento')],];
return [['value' => 'production', 'label' => __('Production')], ['value' => 'dev', 'label' => __('Development')],];
}
}
4 changes: 2 additions & 2 deletions Model/Config/Source/Discount.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class Discount {
* @var string[]
*/ public function toOptionArray() {
return [
['value' => 'FIXED', 'label' => __('Valor Fixo')],
['value' => 'PERCENTAGE', 'label' => __('Percentual')],
['value' => 'FIXED', 'label' => __('Fixed Value')],
['value' => 'PERCENTAGE', 'label' => __('Percentage')],
];
}
}
8 changes: 4 additions & 4 deletions Model/Payment/Boleto.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ public function __construct(
\Magento\Payment\Helper\Data $paymentData,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Payment\Model\Method\Logger $logger,
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = [],
\Asaas\Magento2\Helper\Data $helper,
\Magento\Checkout\Model\Session $checkout,
\Magento\Store\Model\StoreManagerInterface $store,
\Magento\Framework\Message\ManagerInterface $message,
\Magento\Framework\Encryption\EncryptorInterface $encryptor,
\Magento\Customer\Model\Customer $customerRepositoryInterface
\Magento\Customer\Model\Customer $customerRepositoryInterface,
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
parent::__construct(
$context,
Expand Down
8 changes: 4 additions & 4 deletions Model/Payment/Cc.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ public function __construct(
\Magento\Payment\Helper\Data $paymentData,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Payment\Model\Method\Logger $logger,
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = [],
\Asaas\Magento2\Helper\Data $helper,
\Magento\Checkout\Model\Session $checkout,
\Magento\Framework\Message\ManagerInterface $messageManager,
\Magento\Framework\Encryption\EncryptorInterface $encryptor,
\Magento\Customer\Model\Customer $customerRepositoryInterface
\Magento\Customer\Model\Customer $customerRepositoryInterface,
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
parent::__construct(
$context,
Expand Down
Loading