mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Merge trunk
This commit is contained in:
commit
13d27a016e
131 changed files with 3265 additions and 1463 deletions
|
@ -82,9 +82,8 @@ import {
|
|||
renderFields( cardFields );
|
||||
}
|
||||
|
||||
document
|
||||
.querySelector( '#place_order' )
|
||||
?.addEventListener( 'click', ( event ) => {
|
||||
const placeOrderButton = document.querySelector( '#place_order' );
|
||||
placeOrderButton?.addEventListener( 'click', ( event ) => {
|
||||
const cardPaymentToken = document.querySelector(
|
||||
'input[name="wc-ppcp-credit-card-gateway-payment-token"]:checked'
|
||||
)?.value;
|
||||
|
@ -95,11 +94,11 @@ import {
|
|||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
placeOrderButton.disabled = true;
|
||||
event.preventDefault();
|
||||
|
||||
cardFields.submit().catch( ( error ) => {
|
||||
console.error( error );
|
||||
placeOrderButton.disabled = false;
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
|
|
@ -94,7 +94,9 @@ class CreatePaymentToken implements EndpointInterface {
|
|||
)
|
||||
);
|
||||
|
||||
$result = $this->payment_method_tokens_endpoint->create_payment_token( $payment_source );
|
||||
$customer_id = get_user_meta( get_current_user_id(), '_ppcp_target_customer_id', true );
|
||||
|
||||
$result = $this->payment_method_tokens_endpoint->create_payment_token( $payment_source, $customer_id );
|
||||
|
||||
if ( is_user_logged_in() && isset( $result->customer->id ) ) {
|
||||
$current_user_id = get_current_user_id();
|
||||
|
|
|
@ -103,7 +103,9 @@ class CreateSetupToken implements EndpointInterface {
|
|||
);
|
||||
}
|
||||
|
||||
$result = $this->payment_method_tokens_endpoint->setup_tokens( $payment_source );
|
||||
$customer_id = get_user_meta( get_current_user_id(), '_ppcp_target_customer_id', true );
|
||||
|
||||
$result = $this->payment_method_tokens_endpoint->setup_tokens( $payment_source, $customer_id );
|
||||
|
||||
wp_send_json_success( $result );
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue