-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introducing Bill Payment, Tesco Lotus (only available in Thailand) #122
Conversation
c8402ca
to
82ab13f
Compare
323a139
to
9324e69
Compare
…ent at the WooCommerce payment setting page.
9324e69
to
2367254
Compare
2367254
to
0b84db6
Compare
Done at PR #125 |
<small class="omise-billpayment-tesco-reference-number">| <?php echo $tax_id; ?> 00 <?php echo $ref_1; ?> <?php echo $ref_2; ?> <?php echo $amount; ?></small> | ||
</div> | ||
<?php | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, as this code is worked as normal as for the basic need to display barcode at the Thank-You page, this method has also been modified at #125 to support for displaying barcode at WC Order Confirmation email.
https://github.com/omise/omise-woocommerce/pull/125/files#diff-b100586f82e3090b17f2369adb8d9235R111
Done at #126 |
tested, everything works as expected. |
'title' => array( | ||
'title' => __( 'Title', 'omise' ), | ||
'type' => 'text', | ||
'description' => __( 'This controls the title which the user sees during checkout.', 'omise' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This controls the title the user sees during checkout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonrandy 👍 you've mentioned that for Installment once, I forgot 😂
Thanks!
'description' => array( | ||
'title' => __( 'Description', 'omise' ), | ||
'type' => 'textarea', | ||
'description' => __( 'This controls the description which the user sees during checkout.', 'omise' ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This controls the description the user sees during checkout.
|
||
return OmiseCharge::create( array( | ||
'amount' => Omise_Money::to_subunit( $order->get_total(), $order->get_order_currency() ), | ||
'currency' => $order->get_order_currency(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a bit wasteful to call get_order_currency
twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonrandy thanks for pointing out. I was going to say I don't see much different and I will leave it as it is, but after dig a bit into WC's get_order_currency()
method and with some researches, the code with variable is sparking more joy to me.
Updating.
'currency' => $order->get_order_currency(), | ||
'description' => apply_filters( 'omise_charge_params_description', 'WooCommerce Order id ' . $order_id, $order ), | ||
'source' => array( 'type' => 'bill_payment_tesco_lotus' ), | ||
'return_uri' => add_query_arg( 'order_id', $order_id, site_url() . "?wc-api=omise_billpayment_tesco_callback" ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it correct to add one query argument using a function and another directly in a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonrandy Good catch! Definitely not correct. It has been fixed in another payment classes and this one is a legacy that comes before the fixed PR. 👍
$ref_2 = $charge['source']['references']['reference_number_2']; | ||
?> | ||
|
||
<div class="omise omise-billpayment-tesco-details"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a recommended way to output HTML in WooCommerce?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonrandy yup (we've discussed this topic already in some PR in the past) – It is a common way in WordPress.
} | ||
|
||
if ( 'pending' == $charge['status'] ) { | ||
return [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which array creation style should we be using? Is there a standard in WooCommerce?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonrandy good catch again, array()
it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
1. Objective
As the statement Omise put at the releasing article:
Our focus is to help you boost sales by offering payment solutions that put customers choice and experience ahead. We’re super excited to let you know that starting today, Omise merchants in Thailand will be able to offer cash payments at Tesco Lotus as an option for customers to pay.
Increasingly we see consumers shifting over to online payments, however a large percentage still prefer to pay by cash over-the-counter. Tesco Lotus is currently the most preferred outlet by consumers, with more than 1800 locations across the country including 24-hour Lotus Express stores.
The objective of this pull request is to bring this feature to our lovely WooCommerce.
https://www.omise.co/now-supporting-over-the-counter-payments-at-tesco-lotus
2. Description of change
Adding all the needs in order to integrate Omise Bill Payment to WooCommerce.
3. Quality assurance
🔧 Environments:
✏️ Details:
After installed this patch, you will be able to use Omise Bill Payment Tesco.
The below quality assurance steps is to make sure that all functions are properly work as expected.
At Omise Payment Setting page (logged in to WordPress admin page first), there will be a new payment method, "Bill Payment: Tesco".

Once the payment is enabled, new payment method will be displayed at the checkout page.

Bill Payment uses the "offline" flow, meaning that there is no redirect to any 3rd party page but create a new charge with
authorize: pending
, andpaid: pending
status then redirect buyer to the order-received page.pending payment
status.IMPORTANT
charge.complete
event and update a pending-payment order accordingly. If no, then merchants have to update an order status manually.Successful case, order status get updated to

processing
.Failure case, order status get updated to

failed
.4. Impact of the change
Nothing
5. Priority of change
Normal
6. Additional Notes
There are 2 more PRs coming regarding to Omise Bill Payment, which are:
Also, according to the Quality assurance section, case [5].
There is one solution that I would like to provide in the future pull request (after the above 2 coming pull requests). Update order status when buyers open an order history page.
The flow is simple, when buyers open an order history page then, plugin will first, check if there is any pending-payment status remains. Then request to Omise Charge API to check for a new status and update those orders accordingly before display it on a screen.