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

Revert option renaming in settings controller #7565

Merged
merged 3 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/7554-revert-woopay-settings-rename
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Reverting a small change before release.


8 changes: 4 additions & 4 deletions includes/admin/class-wc-rest-payments-settings-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ public function register_routes() {
'type' => 'array',
'items' => [
'type' => 'string',
'enum' => array_keys( $wcpay_form_fields['platform_checkout_button_locations']['options'] ),
'enum' => array_keys( $wcpay_form_fields['payment_request_button_locations']['options'] ),
],
'default' => array_keys( $wcpay_form_fields['platform_checkout_button_locations']['options'] ),
'default' => array_keys( $wcpay_form_fields['payment_request_button_locations']['options'] ),
'validate_callback' => 'rest_validate_request_arg',
],
'is_stripe_billing_enabled' => [
Expand Down Expand Up @@ -505,7 +505,7 @@ public function get_settings(): WP_REST_Response {
'show_woopay_incompatibility_notice' => get_option( 'woopay_invalid_extension_found', false ),
'woopay_custom_message' => $this->wcpay_gateway->get_option( 'platform_checkout_custom_message' ),
'woopay_store_logo' => $this->wcpay_gateway->get_option( 'platform_checkout_store_logo' ),
'woopay_enabled_locations' => $this->wcpay_gateway->get_option( 'platform_checkout_button_locations', array_keys( $wcpay_form_fields['platform_checkout_button_locations']['options'] ) ),
'woopay_enabled_locations' => $this->wcpay_gateway->get_option( 'payment_request_button_locations', array_keys( $wcpay_form_fields['payment_request_button_locations']['options'] ) ),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the first argument had the value of platform_checkout_button_locations prior to the changes. Could you give some context if we should change it to payment_request_button_locations here? Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct! Thank you for catching this. 5b5595a

'deposit_schedule_interval' => $this->wcpay_gateway->get_option( 'deposit_schedule_interval' ),
'deposit_schedule_monthly_anchor' => $this->wcpay_gateway->get_option( 'deposit_schedule_monthly_anchor' ),
'deposit_schedule_weekly_anchor' => $this->wcpay_gateway->get_option( 'deposit_schedule_weekly_anchor' ),
Expand Down Expand Up @@ -904,7 +904,7 @@ private function update_woopay_enabled_locations( WP_REST_Request $request ) {

$woopay_enabled_locations = $request->get_param( 'woopay_enabled_locations' );

$all_locations = $this->wcpay_gateway->form_fields['platform_checkout_button_locations']['options'];
$all_locations = $this->wcpay_gateway->form_fields['payment_request_button_locations']['options'];
WC_Payments::woopay_tracker()->woopay_locations_updated( $all_locations, $woopay_enabled_locations );

$this->wcpay_gateway->update_option( 'platform_checkout_button_locations', $woopay_enabled_locations );
Expand Down
Loading