Skip to content
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 PayNow payment method (only available in Singapore) #152

Merged
merged 4 commits into from
Mar 17, 2020

Conversation

guzzilar
Copy link
Contributor

@guzzilar guzzilar commented Feb 25, 2020

1. Objective

As Omise has been providing a support for PayNow payment method.
This pull request is to integrate the new PayNow payment to WooCommerce plugin.

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

2. Description of change

IMPORTANT: The changes only appear when using Omise Singapore account.

  1. Integrating Omise PayNow payment method with WooCommerce.
    At Omise Settings page, you will see a new payment method, "PayNow".

Screen Shot 2563-02-26 at 12 04 44 copy

Screen Shot 2563-02-24 at 09 50 20

  1. Once enabled the payment, the PayNow payment method will be appeared at WooCommerce Checkout page.

Screen Shot 2563-02-25 at 16 48 09

  1. Displaying PayNow QR code at the order-confirmation page, once placing an order with PayNow payment method.

Screen Shot 2563-02-25 at 16 48 37

  1. With Omise Webhook feature, once the charge has been paid, an order status will be updated to processing.

Screen Shot 2563-02-25 at 17 00 23

3. Quality assurance

🔧 Environments:

  • WooCommerce: -
  • WordPress: v5.3.2
  • PHP version: -

✏️ Details:

IMPORTANT: To test this feature, requires Omise Singapore account, and also the Webhook feature should be set on that particular account.

1. Making sure that the payment method's setting is available only on Omise Singapore account.

Using Omise Singapore account
Screen Shot 2563-02-26 at 12 04 44 copy

Using Omise Japan account
Screen Shot 2563-02-26 at 12 03 40

2. Making sure that once enabled the PayNow payment method, the method will be displayed at WooCommerce Checkout page properly.
Screen Shot 2563-02-25 at 16 48 09

3. Making sure that once the order has been placed, a PayNow QR code will be displayed at the Order Received page, scannable.
Screen Shot 2563-02-25 at 16 48 37 copy

The example using QR Reader application, on iPhone
Screen Shot 2563-02-26 at 12 15 45

An order has been placed with on-hold order status.
Screen Shot 2563-02-26 at 12 18 47 copy

4. Making sure that Omise charge.complete event will be caught properly once the payment has been paid.

To simulate this situation, firstly Omise Webhook feature must be promptly set with a store's webhook endpoint.
Screen Shot 2563-02-26 at 12 23 53 copy

Then to go to Omise Dashboard and mark a particular charge as successful.
Screen Shot 2563-02-26 at 12 22 49 copy

Once done, the plugin will be able to catch a charge.complete event that has been triggered by Omise, then update an order status accordingly.
Screen Shot 2563-02-26 at 12 26 34 copy

The following graphic is showing an overview of the payment flow.
paynow-flow

4. Impact of the change

None

5. Priority of change

Normal

6. Additional Notes

This pull request is providing the least basic feature of PayNow payment method.
There are still numbers of thing that can be added to make its experience better however will be discussed and implemented later.

i.e.

  1. An input from Irista suggested a counting down mechanism to automatically cancel the payment & order after a certain time if the payment hasn't been paid (10-15 minutes).

  2. Adding more text or footnote to provide an instruction of how to use PayNow.

  3. Including QR code to the WooCommerce Order Confirmation email.

and so on.

@guzzilar guzzilar changed the title [WIP] Introducing PayNow payment method (only available in Singapore) Introducing PayNow payment method (only available in Singapore) Feb 26, 2020
@@ -0,0 +1,153 @@
<?php

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at a lot of these class-omise-payment-xxxxx.php files, there is a lot of replication. Should we consider a hierarchy of classes here - to prevent further duplication and simplify existing classes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could also see some part of the code that could be lean a bit more (__construct, charge, and result methods). But as for business perspective, probably not so efficient if we to do it at this time (as refactoring will take a lot of time to discuss and review).

But noted and acknowledged that we could improve those class-omise-payment-xxxxx.php classes a bit more.
I'll look into it after #149, #152 and one more coming PR, "API localization" get merged and released.
Thanks 👍

@@ -81,6 +81,7 @@ public function init() {
register_omise_creditcard();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like we should have a list of payment methods, then iterate over a list to call these register_omise_xxxx functions. Such a list would also be beneficial for including the files etc. - when a new payment method was added, you could simply add a new name to the list

@@ -139,6 +139,7 @@
new Omise_Payment_Creditcard,
new Omise_Payment_Installment,
new Omise_Payment_Internetbanking,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here again, feels like this code could be simplified by having a general list of available payment methods somewhere. Then you could just update the list instead of updating this code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…e way to register a new payment method).
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.

3 participants