omise / omise-woocommerce

Omise WooCommerce Plugin
https://docs.opn.ooo/woocommerce-plugin
MIT License
47 stars 27 forks source link

Bypassing Callback function for Offline payment methods. #184

Closed guzzilar closed 4 years ago

guzzilar commented 4 years ago

1. Objective

It seems the 'is_omise_payment_resolved' flag is not working smoothly with Offline payment flow.

For those Credit Card and Offsite payment methods, we have is_omise_payment_resolved as an indicator to tell the plugin if a specific Webhook event is needed to be queued (if the store's callback has triggered). However, as Offline has no redirection behaviour after payment, this is_omise_payment_resolved will stay as false forever.

Event handler flow at the moment: 1). if "Order.is_omise_payment_resolved" is "false"? 2). if Queue.try < 3, queue the event again. 3). Otherwise, bypass the "is_omise_payment_resolved" check to execute Charge.Complete event handler class.

The current flow is working just fine, however increases unnecessary steps to force all the Offline payment webhook to be in Queue as is_omise_payment_resolved as in the current, will never be set to true.

Related information: Related issue(s): T22534 (internal ticket)

2. Description of change

3. Quality assurance

🔧 Environments:

✏️ Details:

To test this, you may try place a new order using one of the offline payment methods that Omise-WooCommerce supports. Once the order has been placed, is_omise_payment_resolved flag will be updated to yes.

Screen Shot 2563-08-06 at 02 16 45

Which, will result in the charge.complete webhook event will get executed right after the Omise Webhook event is fired without being put in WC Queue.

Screen Shot 2563-08-06 at 02 17 55 copy

4. Impact of the change

None

5. Priority of change

Normal

6. Additional Notes

None