omise / omise-woocommerce

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

[WIP] Code Refactoring, simplifying Callback function. #160

Closed guzzilar closed 4 years ago

guzzilar commented 4 years ago

1. Objective

Credit Card payment method's callback function has been implemented long time ago since before Omise provided other offsite payment methods.

However, as the payment feature grows, this function remains untouched, duplicated, and complicated.

This pull request is to simplify the function, combining between Offsite callback and Credit Card callback. Yet, also decouple the duplicated code to make the code simpler to integrate with API Localization feature.

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

2. Description of change

After listing out 2 callback methods from Credit Card and Offsite payment methods. There are some part of the code that is sharing the same behaviour, and some that could be merged. Untitled Diagram (8)

Here is a new structure after merged. Untitled Diagram (9)

3. Quality assurance

🔧 Environments:

✏️ Details:

drafting

4. Impact of the change

Some response messages have been changed, that would impact to the plugin translation.

5. Priority of change

Normal

6. Additional Notes

Nothing for now