omise / omise-woocommerce

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

[FRON-1464]: Added customer name to the metadata. #268

Closed aashishgurung closed 1 year ago

aashishgurung commented 2 years ago

1. Objective

Add customer name to the metadata

Jira Ticket: https://omise.atlassian.net/browse/FRON-1464

2. Description of change

Customer name is fetched from the $order object. A new function getOrderMetadata which is created in the class-omise-payment.php that abstracts the code to generate the metadata to be sent to the OMISE server. It takes $order_id and $order as the parameters.

Even though we could obtain the order ID from the $order obejct, we passed the $order_id to the getOrderMetada method to avoid checking for backward compatibility.

/** override order_id as a reference for webhook handlers **/
/** backward compatible with WooCommerce v2.x series **/
'order_id' => version_compare( WC()->version, '3.0.0', '>=' ) ? $order->get_id() : $order->id

3. Quality assurance

Add item to the cart and checkout using following payment methods

Tested with following payment methods

Screen Shot 2565-05-09 at 16 56 08

On the dashboard, go to any one charge and you should see the customer name in the metadata.

Screen Shot 2565-05-09 at 16 45 44

🔧 Environments:

FhanOmise commented 2 years ago

Need to update this on includes/gateway/class-omise-payment-ocbc-pao.php from https://github.com/omise/omise-woocommerce/pull/265 as well. 🤔

tanawin-opn commented 2 years ago

I've tested with my website but even I'm filled all the billing address

image

the metadata here still empty value

image
aashishgurung commented 2 years ago

I've tested with my website but even I'm filled all the billing address

the metadata here still empty value

Thanks for reporting it. It should have worked. I will ping you via slack to know more about it.

kan98 commented 2 years ago

https://github.com/omise/omise-woocommerce/pull/270 if you release after me, can you incorporate your change on GrabPay (new payment method) too?

aashishgurung commented 2 years ago

270 if you release after me, can you incorporate your change on GrabPay (new payment method) too?

Sure

tanawin-opn commented 2 years ago

retest again with billing address fixed, now it works

image
sonarcloud[bot] commented 2 years ago

SonarCloud Quality Gate failed.    Quality Gate failed

Bug C 3 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell D 10 Code Smells

No Coverage information No Coverage information
5.9% 5.9% Duplication