mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 12:25:15 +08:00
Merge branch 'trunk' into pcp-370-onboarding
This commit is contained in:
commit
bc83f48692
2 changed files with 3 additions and 2 deletions
|
@ -13,6 +13,7 @@ namespace WooCommerce\PayPalCommerce\ApiClient\Repository;
|
||||||
* Class CustomerRepository
|
* Class CustomerRepository
|
||||||
*/
|
*/
|
||||||
class CustomerRepository {
|
class CustomerRepository {
|
||||||
|
const CLIENT_ID_MAX_LENGTH = 22;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The prefix.
|
* The prefix.
|
||||||
|
@ -43,7 +44,7 @@ class CustomerRepository {
|
||||||
return $guest_customer_id;
|
return $guest_customer_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$unique_id = $this->prefix . uniqid();
|
$unique_id = substr( $this->prefix . strrev( uniqid() ), 0, self::CLIENT_ID_MAX_LENGTH );
|
||||||
WC()->session->set( 'ppcp_guest_customer_id', $unique_id );
|
WC()->session->set( 'ppcp_guest_customer_id', $unique_id );
|
||||||
|
|
||||||
return $unique_id;
|
return $unique_id;
|
||||||
|
|
|
@ -647,7 +647,7 @@ class SmartButton implements SmartButtonInterface {
|
||||||
$localize = array(
|
$localize = array(
|
||||||
'script_attributes' => $this->attributes(),
|
'script_attributes' => $this->attributes(),
|
||||||
'data_client_id' => array(
|
'data_client_id' => array(
|
||||||
'set_attribute' => $this->can_save_vault_token(),
|
'set_attribute' => ( is_checkout() && $this->dcc_is_enabled() ) || $this->can_save_vault_token(),
|
||||||
'endpoint' => home_url( \WC_AJAX::get_endpoint( DataClientIdEndpoint::ENDPOINT ) ),
|
'endpoint' => home_url( \WC_AJAX::get_endpoint( DataClientIdEndpoint::ENDPOINT ) ),
|
||||||
'nonce' => wp_create_nonce( DataClientIdEndpoint::nonce() ),
|
'nonce' => wp_create_nonce( DataClientIdEndpoint::nonce() ),
|
||||||
'user' => get_current_user_id(),
|
'user' => get_current_user_id(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue