omise / omise-prestashop

Omise PrestaShop Plugin
https://docs.opn.ooo/prestashop-plugin
MIT License
4 stars 7 forks source link

Handle an Omise event, charge.complete #45

Closed nimid closed 6 years ago

nimid commented 6 years ago

1. Objective

Correctly update a status of PrestaShop order when checkout with Omise internet banking payment.

Note: To complete the checkout with Omise internet banking payment, the payer need to be redirected off the PrestaShop website to the bank website. After the payer completed their payment on bank website, bank will,

  1. Redirect the payer back to PrestaShop website.
  2. Send the notification of payment result to Omise.

Sometimes the notification is delayed or slower than the redirection. This situation causes the Omise can not sure the result of payment.

This problem can be solved by using Omise webhooks. Whenever bank sent the notification of payment result to Omise, Omise will send the notification to the PrestaShop website.

Related information:

2. Description of change

3. Quality assurance

Environments:

Details:

It has 2 test cases.

  1. The event is charge.complete, status of charge is successful. Expect the status PrestaShop order has been updated to be Payment accepted (success).

  2. The event is charge.complete, status of charge is failed. Expect the status PrestaShop order has been updated to be Canceled.

Steps before test.

  1. Configure the Omise Webhooks. By copy the URL from Webhooks endpoint that appeared in PrestaShop back office, Omise setting page, and paste it in Omise dashboard, Webhooks Endpoint.

  2. Go to PrestaShop front office and process checkout, at the payment step, select any bank from Omise internet banking payment.

The screenshot below shows the configuration for Omise Webhooks endpoint.

prestashop-1 7 2 4-configure-omise-webhooks-on-omise-dashboard

Test case 1:

The screenshot below shows Omise dashboard, webhooks detail. In the red boxes, there are show the event is charge.complete and charge status is successful.

omise-dashboard-webhooks-detail-charge complete-and-charge-status-is-successful

The screenshot below shows PrestaShop back office, order detail. In the red box, it shows order status is payment accepted.

prestashop-1 7 2 4-order-detail-order-status-is-payment-accepted

The screenshot below shows PrestaShop back office, logs page. In the red box, it shows log message that the module, Omise PrestaShop, has caught Omise webhooks event and updated PrestaShop order status to be payment accepted.

prestashop-1 7 2 4-logs-charge complete-event-update-order-status-to-be-payment-accepted

Test case 2:

The screenshot below shows Omise dashboard, webhooks detail. In the red boxes, they show the event is charge.complete and charge status is failed.

omise-dashboard-webhooks-detail-charge complete-and-charge-status-is-failed

The screenshot below shows PrestaShop back office, order detail. In the red box, it shows order status is canceled.

prestashop-1 7 2 4-order-detail-order-status-is-canceled

The screenshot below shows PrestaShop back office, logs page. In the red box, it shows log message that the module, Omise PrestaShop, has caught Omise webhooks event and updated PrestaShop order status to be canceled.

prestashop-1 7 2 4-logs-charge complete-event-update-order-status-to-be-canceled

4. Impact of the change

-

5. Priority of change

Normal

6. Additional notes

presashop-debug-mode-html-comments-appeard-on-response-body-omise-dashboard-webhooks-detail