-
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
Refactoring offsite payment methods (introducing abstract offsite class) #143
Conversation
6a3d161
to
3c3a55c
Compare
3c3a55c
to
dc877d7
Compare
"The translation will be corrected and done in another different time, when we start working on Konbini payment." Am I missing something? There don't appear to be any translations in the PR. Some of the English needs fixing though - is that something I should do in this review? |
@jonrandy This pull request is tweaking some messages here and there.
after
and these affects to the localisation as its translation is paired and matched with the previous 'before' version. However, for English fixing, yeah, help me (in this PR) 🆘 |
…extended from its abstract parent class. Removing abstract 'charge' method out from 'Omise_Payment_Offsite'.
For the recent commit (bfed4a4) This won’t work on PHP prior 7.2 abstract class class1 {
abstract public function someFunc();
}
abstract class class2 extends class1 {
abstract public function someFunc();
} ref: By removing the abstract |
if ( ! $order ) { | ||
$message = __( | ||
'<strong>We cannot validate your payment result:</strong><br/> | ||
Note that your payment might already has been processed.<br/> |
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 that your payment may have already been processed."
|
||
if ( self::STATUS_PENDING === $charge['status'] && ! $charge['paid'] ) { | ||
$message = __( | ||
'Omise: The payment has been processing.<br/> |
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.
"Omise: The payment is being processed."
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 just wonder what is the nuance that these 2 sentences are giving. Not similar, if not the same?
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.
"The payment has been processing" implies that it was being processed, but now has stopped for some reason - which I don't think is what you wanted to say
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.
ic. Thanks 👍
if ( self::STATUS_PENDING === $charge['status'] && ! $charge['paid'] ) { | ||
$message = __( | ||
'Omise: The payment has been processing.<br/> | ||
Due to the payment provider, this may take some time to process.<br/> |
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.
"Depending on the payment provider, this may take some time to process."
$message = __( | ||
'Omise: The payment has been processing.<br/> | ||
Due to the payment provider, this may take some time to process.<br/> | ||
Please do a manual \'Sync Payment Status\' action from the <strong>Order Actions</strong> panel or check the payment status directly at Omise dashboard again later.', |
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.
"Please do a manual 'Sync Payment Status' action from the Order Actions panel, or check the payment status directly at the Omise dashboard later."
} | ||
|
||
$message = __( | ||
'Note that your payment might already has been processed.<br/> |
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 that your payment may have already been processed."
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.
English fixes needed (see notes)
1. Objective
Those implemented offsite payment methods (Alipay, Installment, Internet Banking, and TrueMoney Wallet) have almost an identical function on
result
andcallback
methods.Having to implement each of them separately increasing the risk of human-error and potential malfunctions as the code could be changed/enhanced overtime.
As you can see from the screenshot below
These 2, "TrueMoney" on the left, and "Alipay" on the right, are doing exactly the same thing.
However this code introduces an inconsistency as the code on the left (TrueMoney) has been developed and improved overtime while the code on the right (Alipay) screen remains the same as original, and becomes obsolete.
It must be a risk or unnecessarily if this
abstract offsite
class was introduced at the very beginning, as fixing one place will effect to all methods, and that may not be what we wanted.However, after repetitively implemented 4 offsite payment methods, we can now be sure that they are doing the exact same thing and it should be safe to group them now.
Bonus point.
This is to reduce the work on localization as well, as it will be easier to make sure that we don't miss any translation or having any typo here and there in each of payment classes as we can group them into one single file, Omise_Payment_Offsite class.
2. Description of change
Grouping all repetitive offsite methods into one abstract
Omise_Payment_Offsite
class.Removing all redundant code from
class-omise-payment-alipay.php
,class-omise-payment-installment.php
,class-omise-payment-internetbanking.php
,class-omise-payment-truemoney.php
.Generalizing all offsite-payment messages, making it more generic and can be used all across the offsite payment methods.

3. Quality assurance
🔧 Environments:
✏️ Details:
The test will be conducted and categorized into 5 main topics.
1. General tests

1.1.) All payment methods can be enabled properly.
2. Placing order using Alipay payment method


We will go through the normal WooCommerce checkout process and test mark a particular charge as "successful", "failed", and "pending".
Successful case
Failure case


Failure code and message can be shown properly as before.
Pending case


3. Placing order using Installment payment method


We will go through the normal WooCommerce checkout process and test mark a particular charge as "successful", "failed", and "pending".
Successful case
Failure case


Pending case


4. Placing order using Internet Banking payment method


We will go through the normal WooCommerce checkout process and test mark a particular charge as "successful", "failed", and "pending".
Successful case
Failure case


Pending case


5. Placing order using TrueMoney Wallet payment method


We will go through the normal WooCommerce checkout process and test mark a particular charge as "successful", "failed", and "pending".
Successful case
Failure case


Pending case


4. Impact of the change
Should be none.
5. Priority of change
Normal
6. Additional Notes
The translation will be corrected and done in another different time, when we start working on Konbini payment.
This pull request is focusing only for refactoring the offsite payment classes.