Skip to content

Commit 4f222f1

Browse files
authored
Remove unused code related to old Stripe settings (#2432)
* Remove unused code related to old Stripe settings * Add changelog entries * Remove empty line
1 parent 5c4ac69 commit 4f222f1

File tree

6 files changed

+2
-112
lines changed

6 files changed

+2
-112
lines changed

assets/js/stripe-admin.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
= 6.8.0 - 2022-xx-xx =
44
* Fix - Minor adjustments for Custom Order Tables compatibility.
55
* Fix - Upgrade from Payment Element beta.
6+
* Tweak - Remove remaining traces of old Stripe settings.
67

78
= 6.7.0 - 2022-09-06 =
89
* Fix - Check payment method before updating payment method title.

includes/class-wc-gateway-stripe.php

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,50 +1037,6 @@ public function settings_api_sanitized_fields( $settings ) {
10371037
return $settings;
10381038
}
10391039

1040-
/**
1041-
* This is overloading the title type so the oauth url is only fetched if we are on the settings page.
1042-
*
1043-
* @param string $key Field key.
1044-
* @param array $data Field data.
1045-
* @return string
1046-
*/
1047-
public function generate_stripe_account_keys_html( $key, $data ) {
1048-
if ( woocommerce_gateway_stripe()->connect->is_connected() ) {
1049-
$reset_link = add_query_arg(
1050-
[
1051-
'_wpnonce' => wp_create_nonce( 'reset_stripe_api_credentials' ),
1052-
'reset_stripe_api_credentials' => true,
1053-
],
1054-
admin_url( 'admin.php?page=wc-settings&tab=checkout&section=stripe' )
1055-
);
1056-
1057-
$api_credentials_text = sprintf(
1058-
/* translators: %1, %2, %3, and %4 are all HTML markup tags */
1059-
__( '%1$sClear all Stripe account keys.%2$s %3$sThis will disable any connection to Stripe.%4$s', 'woocommerce-gateway-stripe' ),
1060-
'<a id="wc_stripe_connect_button" href="' . $reset_link . '" class="button button-secondary">',
1061-
'</a>',
1062-
'<span style="color:red;">',
1063-
'</span>'
1064-
);
1065-
} else {
1066-
$oauth_url = woocommerce_gateway_stripe()->connect->get_oauth_url();
1067-
1068-
if ( ! is_wp_error( $oauth_url ) ) {
1069-
$api_credentials_text = sprintf(
1070-
/* translators: %1, %2 and %3 are all HTML markup tags */
1071-
__( '%1$sSet up or link an existing Stripe account.%2$s By clicking this button you agree to the %3$sTerms of Service%2$s. Or, manually enter Stripe account keys below.', 'woocommerce-gateway-stripe' ),
1072-
'<a id="wc_stripe_connect_button" href="' . $oauth_url . '" class="button button-primary">',
1073-
'</a>',
1074-
'<a href="https://wordpress.com/tos">'
1075-
);
1076-
} else {
1077-
$api_credentials_text = __( 'Manually enter Stripe keys below.', 'woocommerce-gateway-stripe' );
1078-
}
1079-
}
1080-
$data['description'] = $api_credentials_text;
1081-
return $this->generate_title_html( $key, $data );
1082-
}
1083-
10841040
/**
10851041
* Checks whether the gateway is enabled.
10861042
*

includes/connect/class-wc-stripe-connect.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -89,28 +89,7 @@ public function maybe_handle_redirect() {
8989
$response = $this->connect_oauth( wc_clean( wp_unslash( $_GET['wcs_stripe_state'] ) ), wc_clean( wp_unslash( $_GET['wcs_stripe_code'] ) ) );
9090
wp_safe_redirect( esc_url_raw( remove_query_arg( [ 'wcs_stripe_state', 'wcs_stripe_code' ] ) ) );
9191
exit;
92-
93-
// redirect from credentials reset
94-
} elseif ( isset( $_GET['reset_stripe_api_credentials'], $_GET['_wpnonce'] ) ) {
95-
96-
if ( ! wp_verify_nonce( wc_clean( wp_unslash( $_GET['_wpnonce'] ) ), 'reset_stripe_api_credentials' ) ) {
97-
die( __( 'You are not authorized to clear Stripe account keys.', 'woocommerce-gateway-stripe' ) );
98-
}
99-
100-
$this->clear_stripe_keys();
101-
wp_safe_redirect(
102-
esc_url_raw(
103-
remove_query_arg(
104-
[
105-
'_wpnonce',
106-
'reset_stripe_api_credentials',
107-
]
108-
)
109-
)
110-
);
111-
exit;
11292
}
113-
11493
}
11594

11695
/**

includes/payment-methods/class-wc-stripe-upe-payment-gateway.php

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,52 +1213,6 @@ public function generate_upe_checkout_experience_accepted_payments_html( $key, $
12131213
return $this->generate_title_html( $key, $data );
12141214
}
12151215

1216-
/**
1217-
* This is overloading the title type so the oauth url is only fetched if we are on the settings page.
1218-
*
1219-
* TODO: This is duplicate code from WC_Gateway_Stripe.
1220-
*
1221-
* @param string $key Field key.
1222-
* @param array $data Field data.
1223-
* @return string
1224-
*/
1225-
public function generate_stripe_account_keys_html( $key, $data ) {
1226-
if ( woocommerce_gateway_stripe()->connect->is_connected() ) {
1227-
$reset_link = add_query_arg(
1228-
[
1229-
'_wpnonce' => wp_create_nonce( 'reset_stripe_api_credentials' ),
1230-
'reset_stripe_api_credentials' => true,
1231-
],
1232-
admin_url( 'admin.php?page=wc-settings&tab=checkout&section=stripe' )
1233-
);
1234-
1235-
$api_credentials_text = sprintf(
1236-
/* translators: %1, %2, %3, and %4 are all HTML markup tags */
1237-
__( '%1$sClear all Stripe account keys.%2$s %3$sThis will disable any connection to Stripe.%4$s', 'woocommerce-gateway-stripe' ),
1238-
'<a id="wc_stripe_connect_button" href="' . $reset_link . '" class="button button-secondary">',
1239-
'</a>',
1240-
'<span style="color:red;">',
1241-
'</span>'
1242-
);
1243-
} else {
1244-
$oauth_url = woocommerce_gateway_stripe()->connect->get_oauth_url();
1245-
1246-
if ( ! is_wp_error( $oauth_url ) ) {
1247-
$api_credentials_text = sprintf(
1248-
/* translators: %1, %2 and %3 are all HTML markup tags */
1249-
__( '%1$sSetup or link an existing Stripe account.%2$s By clicking this button you agree to the %3$sTerms of Service%2$s. Or, manually enter Stripe account keys below.', 'woocommerce-gateway-stripe' ),
1250-
'<a id="wc_stripe_connect_button" href="' . $oauth_url . '" class="button button-primary">',
1251-
'</a>',
1252-
'<a href="https://wordpress.com/tos">'
1253-
);
1254-
} else {
1255-
$api_credentials_text = __( 'Manually enter Stripe keys below.', 'woocommerce-gateway-stripe' );
1256-
}
1257-
}
1258-
$data['description'] = $api_credentials_text;
1259-
return $this->generate_title_html( $key, $data );
1260-
}
1261-
12621216
/**
12631217
* Extacts the Stripe intent's payment_method_type and payment_method_details values.
12641218
*

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,6 @@ If you get stuck, you can ask for help in the Plugin Forum.
131131
= 6.8.0 - 2022-xx-xx =
132132
* Fix - Minor adjustments for Custom Order Tables compatibility.
133133
* Fix - Upgrade from Payment Element beta.
134+
* Tweak - Remove remaining traces of old Stripe settings.
134135

135136
[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).

0 commit comments

Comments
 (0)