mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 06:52:50 +08:00
Fix phpcd
This commit is contained in:
parent
b161b8cfb5
commit
e3dc563a6f
5 changed files with 20 additions and 8 deletions
|
@ -208,7 +208,15 @@ class PaymentTokenEndpoint {
|
|||
return wp_remote_retrieve_response_code( $response ) === 204;
|
||||
}
|
||||
|
||||
public function delete_token_by_id(string $token_id): bool {
|
||||
/**
|
||||
* Deletes payment token by the given id.
|
||||
*
|
||||
* @param string $token_id Token id.
|
||||
* @return bool
|
||||
*
|
||||
* @throws RuntimeException If something goes wrong while deleting the token.
|
||||
*/
|
||||
public function delete_token_by_id( string $token_id ): bool {
|
||||
$bearer = $this->bearer->bearer();
|
||||
|
||||
$url = trailingslashit( $this->host ) . 'v2/vault/payment-tokens/' . $token_id;
|
||||
|
@ -226,7 +234,7 @@ class PaymentTokenEndpoint {
|
|||
$error = new RuntimeException(
|
||||
__( 'Could not delete payment token.', 'woocommerce-paypal-payments' )
|
||||
);
|
||||
$this->logger->warning($error->getMessage());
|
||||
$this->logger->warning( $error->getMessage() );
|
||||
|
||||
throw $error;
|
||||
}
|
||||
|
|
|
@ -4,12 +4,16 @@
|
|||
*
|
||||
* @package WooCommerce\PayPalCommerce\Vaulting
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Vaulting;
|
||||
|
||||
use WC_Payment_Token;
|
||||
|
||||
/**
|
||||
* Class PaymentTokenPayPal
|
||||
*/
|
||||
class PaymentTokenPayPal extends WC_Payment_Token {
|
||||
/**
|
||||
* Token Type String.
|
||||
|
|
|
@ -140,13 +140,13 @@ class VaultingModule implements ModuleInterface {
|
|||
return;
|
||||
}
|
||||
|
||||
$wpnonce = wc_clean( wp_unslash( $_REQUEST['_wpnonce'] ?? '' ) );
|
||||
$wpnonce = wc_clean( wp_unslash( $_REQUEST['_wpnonce'] ?? '' ) );
|
||||
$token_id_string = (string) $token_id;
|
||||
$action = 'delete-payment-method-' . $token_id_string;
|
||||
$action = 'delete-payment-method-' . $token_id_string;
|
||||
if (
|
||||
$token->get_user_id() !== get_current_user_id()
|
||||
|| ! isset( $wpnonce ) || ! is_string($wpnonce)
|
||||
|| wp_verify_nonce( $wpnonce, $action) === false
|
||||
|| ! isset( $wpnonce ) || ! is_string( $wpnonce )
|
||||
|| wp_verify_nonce( $wpnonce, $action ) === false
|
||||
) {
|
||||
wc_add_notice( __( 'Invalid payment method.', 'woocommerce-paypal-payments' ), 'error' );
|
||||
wp_safe_redirect( wc_get_account_endpoint_url( 'payment-methods' ) );
|
||||
|
|
|
@ -223,7 +223,7 @@ class PayPalGateway extends \WC_Payment_Gateway {
|
|||
'subscription_payment_method_change_customer',
|
||||
'subscription_payment_method_change_admin',
|
||||
'multiple_subscriptions',
|
||||
'tokenization'
|
||||
'tokenization',
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ return array(
|
|||
$prefix = $container->get( 'api.prefix' );
|
||||
$order_endpoint = $container->get( 'api.endpoint.order' );
|
||||
$authorized_payments_processor = $container->get( 'wcgateway.processor.authorized-payments' );
|
||||
$payment_token_paypal = $container->get('vaulting.payment-token-paypal');
|
||||
$payment_token_paypal = $container->get( 'vaulting.payment-token-paypal' );
|
||||
|
||||
return array(
|
||||
new CheckoutOrderApproved( $logger, $prefix, $order_endpoint ),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue