Skip to content

Fix: WooCommerce order status not updated for BI-SNAP & DANA#85

Open
robby-xp wants to merge 1 commit into
veritrans:masterfrom
robby-xp:fix-order-id-for-bisnap-dana-notif-handler
Open

Fix: WooCommerce order status not updated for BI-SNAP & DANA#85
robby-xp wants to merge 1 commit into
veritrans:masterfrom
robby-xp:fix-order-id-for-bisnap-dana-notif-handler

Conversation

@robby-xp

Copy link
Copy Markdown

Problem

Payments that settle successfully in Midtrans don't update the WooCommerce order status for DANA and VA transfers to Danamon, BSI, Seabank, and Saqu. Other payment methods are unaffected.

Cause

In handleMidtransNotificationRequest(), after getStatusFromMidtransNotif() returns the verified status, the order is resolved from $midtrans_notification->order_id.

For BI-SNAP & DANA payment methods, the get-status response returns the transaction_id in the order_id field, so wc_get_order() fails and do_action( "midtrans-handle-valid-notification", ... ) never fires — leaving the WooCommerce order status unchanged.

Fix

In class/class.midtrans-gateway-notif-handler.php, right after the status call, restore the correct order_id from the notification body that still holds the correct WooCommerce order_id:

       $midtrans_notification = WC_Midtrans_API::getStatusFromMidtransNotif( $plugin_id );
+      // DANA & VA (Danamon, BSI, Seabank, Saqu) return transaction_id in `order_id`;
+      // restore the WooCommerce order_id from the raw notification body.
+      $midtrans_notification->getResponse()->order_id = $raw_notification['order_id'];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant