omise-woocommerce icon indicating copy to clipboard operation
omise-woocommerce copied to clipboard

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

Open aashishgurung opened this issue 2 years ago • 7 comments

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

  • Alipay
  • Alipay Plus
  • Bill payment Tesco
  • Credit Card
  • FPX
  • Installment
  • Internet banking
  • Konbini
  • Mobile banking
  • Rabbit linepay
  • True Money

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:

  • WooCommerce: v6.4.1
  • WordPress: v5.9.3
  • PHP version: 7.4.28
  • Omise plugin version: Omise-WooCommerce 4.19.2

aashishgurung avatar May 09 '22 10:05 aashishgurung

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

FhanOmise avatar May 09 '22 10:05 FhanOmise

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

image

the metadata here still empty value

image

tanawin-opn avatar May 10 '22 03:05 tanawin-opn

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.

aashishgurung avatar May 10 '22 06:05 aashishgurung

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

kan98 avatar May 10 '22 09:05 kan98

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

Sure

aashishgurung avatar May 10 '22 10:05 aashishgurung

retest again with billing address fixed, now it works

image

tanawin-opn avatar May 11 '22 05:05 tanawin-opn

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

sonarqubecloud[bot] avatar Aug 03 '22 05:08 sonarqubecloud[bot]