Skip to content

Commit

Permalink
Merge pull request #3 from lucassilva15/main
Browse files Browse the repository at this point in the history
v1.0.3
  • Loading branch information
jvoliveiraGN authored Jul 7, 2021
2 parents 7758a3b + d14185a commit 4f303ae
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public function getUrl()

public function getOrderStatus()
{
return $this->getConfig('payment/gerencianet_configuracoes/order_status');
$status = $this->getConfig('payment/gerencianet_configuracoes/order_status');
return $status ?? 'pending';
}
}
10 changes: 8 additions & 2 deletions Observer/OrderObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Gerencianet\Magento2\Helper\Data;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Event\Observer;
use Magento\Sales\Model\Order;

class OrderObserver implements ObserverInterface {

Expand All @@ -16,8 +17,13 @@ public function __construct(Data $helperData) {
}

public function execute(Observer $observer) {
/** @var Order */
$order = $observer->getEvent()->getOrder();
$order->setState("new")->setStatus($this->_helperData->getOrderStatus());
$order->save();
$payment = $order->getPayment();
$methodCode = $payment->getMethod();
if (strpos($methodCode, 'gerencianet') !== false) {
$order->setState("new")->setStatus($this->_helperData->getOrderStatus());
$order->save();
}
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gerencianet/module-magento2",
"description": "Gerencianet Payment Gateway",
"version": "1.0.2",
"version": "1.0.3",
"type": "magento2-module",
"license": "OSL-3.0",
"authors": [{
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Gerencianet_Magento2" setup_version='1.0.2'>
<module name="Gerencianet_Magento2" setup_version='1.0.3'>
<sequence>
<module name="Magento_Checkout" />
</sequence>
Expand Down

0 comments on commit 4f303ae

Please sign in to comment.