pagarme / magento2

Magento2 Module for Pagar.me 2.0
MIT License
4 stars 2 forks source link

Pagarme does not update order status on the platform! #162

Closed ElNogara closed 1 year ago

ElNogara commented 1 year ago

Status

BUG REPORT

Steps

  1. Finalize a purchase using the pagarme pix
  2. Order is created correctly on the platform.
  3. But it does not have the status changed to payment confirmed by pagarme.

Expected behaviour

The expected behavior is that when the order has payment confirmed in the pagame panel, it will also be updated to the platform.

Actual behaviour

Currently the order is being created correctly, but its information is not updated as it follows its flow through pagarme

Environment

We are using the Magento/2.4 (Community).

Logs / Stack trace

**Below are the logs we have about an order that didn't update the status correctly!**

[2023-03-07 10:22:14] Order.INFO: Order #xxxxxxxxxxxx : Changing status quote to processing.
Version: m: 1.1.6 c: 1.1.4 p: Magento Community 2.4.2-p1
From: /var/www/dev/magento2/vendor/pagarme/pagarme-magento2-module/Gateway/Transaction/Base/Command/InitializeCommand.php:50 -> Pagarme\Pagarme\Gateway\Transaction\Base\Command\InitializeCommand::doCoreDetour
[]
[2023-03-07 10:22:14] Order.INFO: Order #xxxxxxxxxxxx : Creating order.
Version: m: 1.1.6 c: 1.1.4 p: Magento Community 2.4.2-p1
From: /var/www/dev/magento2/vendor/pagarme/pagarme-magento2-module/Gateway/Transaction/Base/Command/InitializeCommand.php:146 -> Pagarme\Core\Kernel\Services\OrderService::createOrderAtPagarme
{
    "grandTotal": 597.06
}
[2023-03-07 10:22:14] Order.INFO: Order #xxxxxxxxxxxx : State Change
Version: m: 1.1.6 c: 1.1.4 p: Magento Community 2.4.2-p1
From: /var/www/dev/magento2/vendor/pagarme/ecommerce-module-core/src/Kernel/Services/OrderService.php:255 -> Pagarme\Core\Kernel\Abstractions\AbstractPlatformOrderDecorator::setState
{
    "from": "",
    "to": "new"
}
[2023-03-07 10:22:14] Order.INFO: Order #xxxxxxxxxxxx : Status Change
Version: m: 1.1.6 c: 1.1.4 p: Magento Community 2.4.2-p1
From: /var/www/dev/magento2/vendor/pagarme/ecommerce-module-core/src/Kernel/Services/OrderService.php:256 -> Pagarme\Core\Kernel\Abstractions\AbstractPlatformOrderDecorator::setStatus
{
    "from": null,
    "to": "pending"
}
[2023-03-07 10:22:14] Order.INFO: Order #xxxxxxxxxxxx : Snapshot config from **pk_key**
Version: m: 1.1.6 c: 1.1.4 p: Magento Community 2.4.2-p1
From: /var/www/dev/magento2/vendor/pagarme/ecommerce-module-core/src/Kernel/Services/APIService.php:137 -> Pagarme\Core\Kernel\Services\OrderLogService::orderInfo
{
    "enabled": true,
    "antifraudEnabled": false,
    "antifraudMinAmount": "0",
    "boletoEnabled": true,
.
.
.

[2023-03-07 10:22:14] Order.INFO: Order #xxxxxxxxxxxx : Create order Response
Version: m: 1.1.6 c: 1.1.4 p: Magento Community 2.4.2-p1
From: /var/www/dev/magento2/vendor/pagarme/ecommerce-module-core/src/Kernel/Services/OrderCreationService.php:81 -> Pagarme\Core\Kernel\Services\OrderLogService::orderInfo
{
    "id": "or_key",
    "code": "xxxxxxxxxxxx",
.
.
.

[2023-03-07 10:22:15] Order.INFO: Order #xxxxxxxxxxxx : Handling order status: Pending
Version: m: 1.1.6 c: 1.1.4 p: Magento Community 2.4.2-p1
From: /var/www/dev/magento2/vendor/pagarme/ecommerce-module-core/src/Kernel/Services/OrderService.php:297 -> Pagarme\Core\Payment\Services\ResponseHandlers\OrderHandler::handle
[]
[2023-03-07 10:22:15] Order.INFO: Order #xxxxxxxxxxxx : Creating Authorization Transaction...
Version: m: 1.1.6 c: 1.1.4 p: Magento Community 2.4.2-p1
From: /var/www/dev/magento2/vendor/pagarme/ecommerce-module-core/src/Payment/Services/ResponseHandlers/OrderHandler.php:85 -> Pagarme\Core\Payment\Services\ResponseHandlers\OrderHandler::createAuthorizationTransaction
[]
[2023-03-07 10:22:15] Order.INFO: Order #xxxxxxxxxxxx : Authorization Transaction created.
Version: m: 1.1.6 c: 1.1.4 p: Magento Community 2.4.2-p1
From: /var/www/dev/magento2/vendor/pagarme/ecommerce-module-core/src/Payment/Services/ResponseHandlers/OrderHandler.php:85 -> Pagarme\Core\Payment\Services\ResponseHandlers\OrderHandler::createAuthorizationTransaction
[]
[2023-03-07 10:22:15] Order.INFO: Order #xxxxxxxxxxxx : Status Change
Version: m: 1.1.6 c: 1.1.4 p: Magento Community 2.4.2-p1
From: /var/www/dev/magento2/vendor/pagarme/ecommerce-module-core/src/Kernel/Services/OrderService.php:87 -> Pagarme\Core\Kernel\Abstractions\AbstractPlatformOrderDecorator::setStatus
{
    "from": "pending",
    "to": "pending"
}
RafaMelazzo commented 1 year ago

Hello @ElNogara!

I noticed your store is using the module in version 1.1.4. This version has the issue you are reporting, but it has been corrected in a newer version. To fix this you just need to update, running the following commands:

composer require pagarme/pagarme-magento2-module:2.1.0 ./bin/magento setup:upgrade ./bin/magento setup:di:compile