Skip to content

Be able to create a refund when placing an order with Alipay or Installment payment method.#158

Merged
guzzilar merged 1 commit intomasterfrom
support-refund-feature
Apr 9, 2020
Merged

Be able to create a refund when placing an order with Alipay or Installment payment method.#158
guzzilar merged 1 commit intomasterfrom
support-refund-feature

Conversation

@guzzilar
Copy link
Copy Markdown
Contributor

@guzzilar guzzilar commented Mar 19, 2020

1. Objective

According to Omise documents, those Alipay (online) and Installment payment methods are supporting refund via Omise API. However the plugin is still behind and doesn't provide this feature.

This pull request is to add a refund-feature support to those 2 payment methods.

References:

Related information:
Related issue(s): T18953, T19969 (internal ticket)

2. Description of change

Adding refund feature to Alipay (online) and Installment payment methods.

3. Quality assurance

🔧 Environments:

  • WooCommerce: v3.9.3
  • WordPress: v5.3.2
  • PHP version: 7.3.3

✏️ Details:

1. To test refunding a charge using Alipay payment method, you will need to place an order and go through the normal WooCommerce checkout step.

1.1. At WooCommerce Order page, click "refund" button
alipay-refund-01

1.2. Enter a refund amount and click "Refund [amount] via Omise Alipay".
alipay-refund-02

1.3. Successfully refund will be shown on the "Order Notes" section, as well as displaying its refund transaction under the "items" section at WooCommerce Order page.
alipay-refund-03

Screen Shot 2563-04-08 at 19 14 03

1.4. You may as well, test for a failure case by modifying the code (as WooCommerce provides frontend-validation, the easiest way is to modify Omise code to create a refund with a false amount).
At file: includes/gateway/class-omise-payment.php Line: 252, replace $amount with any invalid number, then create another refund via WooCommerce Order page.
Screen Shot 2563-04-08 at 18 24 54

There will be a alert-dialog showing "Refund failed: ..."* with a message (from Omise API)
alipay-refund-04

2. To test refunding a charge using Installment payment method, you will need to place an order and go through the normal WooCommerce checkout step the same Alipay.
2.1. At WooCommerce Order page, click "refund" button
installment-refund-01

2.2. Enter a refund amount and click "Refund [amount] via Omise Installment".
installment-refund-02

2.3. Successfully refund will be shown on the "Order Notes" section, as well as displaying its refund transaction under the "items" section at WooCommerce Order page.
Also for a full-refund, the order status will be updated to Refunded.
installment-refund-03

Screen Shot 2563-04-08 at 19 14 11

2.4. However, Installment payment method does not support for partial-refund.
If you try to create a refund with a partial amount, it will result showing alert-dialog saying: "Refund failed: charge partial refunds is not permitted for this type of charge."
installment-refund-04

4. Impact of the change

none

5. Priority of change

Normal

6. Additional Notes

none

@guzzilar guzzilar merged commit a770fd7 into master Apr 9, 2020
@guzzilar guzzilar deleted the support-refund-feature branch April 9, 2020 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants