Skip to content

Refactoring, unify Omise key(s)-defining into one place.#108

Merged
guzzilar merged 3 commits intomasterfrom
define-omise-keys-as-global
Mar 29, 2019
Merged

Refactoring, unify Omise key(s)-defining into one place.#108
guzzilar merged 3 commits intomasterfrom
define-omise-keys-as-global

Conversation

@guzzilar
Copy link
Copy Markdown
Contributor

@guzzilar guzzilar commented Mar 28, 2019

1. Objective

Currently in Omise-WooCommerce code base, the public key and the secret key have been spread all over the places. By that, it has a high risk and a potential of any bug from code maintenance in the future (as there are many places that need to be taken care of).

This pull request is to unifying Omise-Keys declaration into one place to reduce any potential bug & code mess.

2. Description of change

  • Defining Omise secret key and public key at the plugin initial step.
  • Removing all related code.

3. Quality assurance

🔧 Environments:

  • WordPress: v5.1.1.
  • WooCommerce: v3.5.7.
  • PHP version: v7.3.3.

✏️ Details:

All of cases that we should test would be really huge as this pull request is removing all key-assigning out from all of Omise class. However, the main test could be listed as below:

  1. Make sure that Alipay payment method works properly by creating a new charge with Alipay payment method.

  2. Make sure that Internet Banking payment method works properly by creating a new charge with Internet Banking payment method.

  3. Make sure that Credit Card payment method works properly by creating a new charge with Credit Card payment method on both auth only and auto capture.

  4. Make sure that an order can be funded properly

  5. Make sure that user can save a card properly.

  6. Make sure that user can delete a card properly.

4. Impact of the change

No

5. Priority of change

Normal

6. Additional Notes

This change will help on #101 as well (as there is no keys tied up in those methods anymore after this change).

@guzzilar guzzilar requested review from jacstn and jonrandy March 28, 2019 04:36
@guzzilar guzzilar force-pushed the define-omise-keys-as-global branch from e689704 to 640be07 Compare March 28, 2019 04:51
@guzzilar guzzilar force-pushed the define-omise-keys-as-global branch from 640be07 to 5853102 Compare March 28, 2019 05:13
@@ -7,11 +7,37 @@
}

class Omise_Setting {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should really be called "Settings" - otherwise the name suggests a class that deals with one setting only

array(
'key' => $this->public_key,
'key' => Omise()->setting->public_key(),
'ajax_url' => admin_url( 'admin-ajax.php' ),
Copy link
Copy Markdown

@jonrandy jonrandy Mar 28, 2019

Choose a reason for hiding this comment

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

Not sure, but should this be setting()? (should be calling the function?)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Again, this should definitely be named settings

Copy link
Copy Markdown
Contributor

@jacstn jacstn left a comment

Choose a reason for hiding this comment

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

except for small thing mentioned from @jonrandy ... for me, it good to go.

@guzzilar
Copy link
Copy Markdown
Contributor Author

@jonrandy @jacstn updated, can you help check f1cc6db

However, renaming Omise_Setting class to Omise_Settings would touch more on an irrelevant part of code than its actual purpose. Agreed to change, but I think it's better to submit another pr for that only (I'll have a clean-up pr later on before the release v3.4).

@guzzilar guzzilar force-pushed the define-omise-keys-as-global branch from f1cc6db to f304275 Compare March 28, 2019 07:26
@guzzilar
Copy link
Copy Markdown
Contributor Author

Screen Shot 2562-03-28 at 14 27 33

@guzzilar guzzilar force-pushed the define-omise-keys-as-global branch from f304275 to 31f1402 Compare March 28, 2019 07:43
@guzzilar
Copy link
Copy Markdown
Contributor Author

Note: Updated Quality Assurance section. All tested.

@guzzilar guzzilar merged commit 793a771 into master Mar 29, 2019
@guzzilar guzzilar deleted the define-omise-keys-as-global branch March 29, 2019 04:35
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