mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Merge branch 'PCP-4521-extract-3-ds-setting-from-acdc-payment-method' of github.com:woocommerce/woocommerce-paypal-payments into PCP-4487-fastlane-uk
This commit is contained in:
commit
fa047772c3
3 changed files with 31 additions and 21 deletions
|
@ -71,6 +71,7 @@ class CompatModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
|||
|
||||
$this->migrate_pay_later_settings( $c );
|
||||
$this->migrate_smart_button_settings( $c );
|
||||
$this->migrate_three_d_secure_setting();
|
||||
|
||||
$this->fix_page_builders();
|
||||
$this->exclude_cache_plugins_js_minification( $c );
|
||||
|
@ -274,6 +275,35 @@ class CompatModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Migrates the old Three D Secure setting located in PaymentSettings to the new location in SettingsModel.
|
||||
*
|
||||
* The migration will be done on plugin update if it hasn't already done.
|
||||
*/
|
||||
protected function migrate_three_d_secure_setting(): void {
|
||||
add_action(
|
||||
'woocommerce_paypal_payments_gateway_migrate_on_update',
|
||||
function () {
|
||||
$payment_settings = get_option( 'woocommerce-ppcp-data-payment' ) ?: array();
|
||||
$data_settings = get_option( 'woocommerce-ppcp-data-settings' ) ?: array();
|
||||
|
||||
// Skip if payment settings don't have the setting but data settings do.
|
||||
if ( ! isset( $payment_settings['three_d_secure'] ) && isset( $data_settings['three_d_secure'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Move the setting.
|
||||
$data_settings['three_d_secure'] = $payment_settings['three_d_secure'];
|
||||
unset( $payment_settings['three_d_secure'] );
|
||||
|
||||
// Save both.
|
||||
update_option( 'woocommerce-ppcp-data-settings', $data_settings );
|
||||
update_option( 'woocommerce-ppcp-data-payment', $payment_settings );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the button rendering place for page builders
|
||||
* that do not work well with our default places.
|
||||
|
|
|
@ -38,7 +38,6 @@ class PaymentSettings extends AbstractDataModel {
|
|||
protected function get_defaults() : array {
|
||||
return array(
|
||||
'paypal_show_logo' => false,
|
||||
'three_d_secure' => 'no-3d-secure',
|
||||
'fastlane_cardholder_name' => false,
|
||||
'fastlane_display_watermark' => false,
|
||||
'venmo_enabled' => false,
|
||||
|
@ -158,15 +157,6 @@ class PaymentSettings extends AbstractDataModel {
|
|||
return (bool) $this->data['paypal_show_logo'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get 3DSecure.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_three_d_secure() : string {
|
||||
return $this->data['three_d_secure'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Fastlane cardholder name.
|
||||
*
|
||||
|
@ -213,16 +203,6 @@ class PaymentSettings extends AbstractDataModel {
|
|||
$this->data['paypal_show_logo'] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set 3DSecure.
|
||||
*
|
||||
* @param string $value The value.
|
||||
* @return void
|
||||
*/
|
||||
public function set_three_d_secure( string $value ) : void {
|
||||
$this->data['three_d_secure'] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Fastlane cardholder name.
|
||||
*
|
||||
|
|
|
@ -91,7 +91,7 @@ class SettingsModel extends AbstractDataModel {
|
|||
'subtotal_adjustment' => 'correction', // Options: [correction|no_details].
|
||||
'landing_page' => 'any', // Options: [any|login|guest_checkout].
|
||||
'button_language' => '', // empty or a language locale code.
|
||||
'three_d_secure' => 'only-required-3d-secure', // Options: [no-3d-secure|only-required-3d-secure|always-3d-secure].
|
||||
'three_d_secure' => 'no-3d-secure', // Options: [no-3d-secure|only-required-3d-secure|always-3d-secure].
|
||||
|
||||
// Boolean flags.
|
||||
'authorize_only' => false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue