mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
move generating request id to separate method
This commit is contained in:
parent
c10e3b0ba7
commit
8392f955ef
1 changed files with 11 additions and 1 deletions
|
@ -223,7 +223,7 @@ class OrderEndpoint {
|
||||||
'body' => wp_json_encode( $data ),
|
'body' => wp_json_encode( $data ),
|
||||||
);
|
);
|
||||||
|
|
||||||
$paypal_request_id = $paypal_request_id ? $paypal_request_id : uniqid( 'ppcp-', true );
|
$paypal_request_id = $paypal_request_id ?: $this->generate_request_id();
|
||||||
$args['headers']['PayPal-Request-Id'] = $paypal_request_id;
|
$args['headers']['PayPal-Request-Id'] = $paypal_request_id;
|
||||||
if ( $this->bn_code ) {
|
if ( $this->bn_code ) {
|
||||||
$args['headers']['PayPal-Partner-Attribution-Id'] = $this->bn_code;
|
$args['headers']['PayPal-Partner-Attribution-Id'] = $this->bn_code;
|
||||||
|
@ -547,4 +547,14 @@ class OrderEndpoint {
|
||||||
$new_order = $this->order( $order_to_update->id() );
|
$new_order = $this->order( $order_to_update->id() );
|
||||||
return $new_order;
|
return $new_order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a new invoice id.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function generate_request_id(): string
|
||||||
|
{
|
||||||
|
return uniqid( 'ppcp-', true );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue