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

Ensure 3ds contingency uses SCA_ALWAYS instead of 3D_SECURE (521) #464

Merged
merged 9 commits into from
Feb 7, 2022

Conversation

Dinamiko
Copy link
Contributor

@Dinamiko Dinamiko commented Feb 3, 2022

Add improvements to #463.

This PR ensures that SCA_ALWAYS is used instead of 3D_SECURE stored in the database: https://github.com/woocommerce/woocommerce-paypal-payments/pull/463/files#diff-01a2758cc519d8adb065af0350c9459edb64a45576b4a2e527e8d2059c7889cbL1922-R1922

Testing package

PCP-521-woocommerce-paypal-payments.zip

Acceptance criteria

  1. For new plugin users on PSD2 countries (see list here) default 3DS contingency should be SCA_WHEN_REQUIRED.
  2. For existing plugin users with 3D_SECURE option saved, SCA_ALWAYS option value should be automatically updated*

*Note that only the value is updated, the option label is still the same (Always trigger 3D Secure).
Also note that in order to trigger the update the plugin needs to be upgraded, the provided package contains a higher plugin version which needs to be uploaded and installed from Plugins admin screen (replace existing with the new one).

@Dinamiko Dinamiko mentioned this pull request Feb 3, 2022
@Dinamiko Dinamiko requested a review from AlexP11223 February 3, 2022 11:17
@Dinamiko Dinamiko added this to the Next version milestone Feb 3, 2022
$this->settings->set( '3d_secure_contingency', 'SCA_ALWAYS' );
$this->settings->persist();

$redirect_url = admin_url( 'admin.php?page=wc-settings&tab=checkout&section=ppcp-gateway' );
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe should redirect to the cards tab? admin.php?page=wc-settings&tab=checkout&section=ppcp-gateway&ppcp-tab=ppcp-credit-card-gateway

Or maybe redirect not needed here at all.

Also as I understand it is executed only if the merchant saves settings. Maybe better to do that simply on some kind of plugin init/upgrade, such as woocommerce_paypal_payments_gateway_migrate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup, much better on plugin upgrade, thanks!

@Dinamiko Dinamiko requested a review from AlexP11223 February 3, 2022 15:28
add_action(
'woocommerce_paypal_payments_gateway_migrate',
static function () use ( $c ) {
$settings = $c->get( 'wcgateway.settings' );
Copy link
Contributor

@AlexP11223 AlexP11223 Feb 3, 2022

Choose a reason for hiding this comment

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

I would add a type hint here to help psalm and IDE.

assert( $settings instanceof Settings );

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! :)

@Dinamiko Dinamiko changed the title Ensure 3ds contingency uses SCA_ALWAYS instead of 3D_SECURE Ensure 3ds contingency uses SCA_ALWAYS instead of 3D_SECURE (521) Feb 4, 2022
@Dinamiko Dinamiko merged commit c9966a8 into trunk Feb 7, 2022
@Dinamiko Dinamiko deleted the Chaithi-trunk branch February 7, 2022 10:12
@Dinamiko Dinamiko added the enhancement New feature or request label Feb 7, 2022
This was referenced Feb 10, 2022
Dinamiko added a commit that referenced this pull request Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants