Merge branch 'trunk' into pcp-475-free-trial

This commit is contained in:
Alex P 2022-04-12 15:32:31 +03:00
commit 1b5052a858
5 changed files with 48 additions and 9 deletions

View file

@ -226,7 +226,7 @@ class OrderEndpoint {
'application_context' => $this->application_context_repository
->current_context( $shipping_preference )->to_array(),
);
if ( $payer ) {
if ( $payer && ! empty( $payer->email_address() ) && ! empty( $payer->name() ) ) {
$data['payer'] = $payer->to_array();
}
if ( $payment_token ) {
@ -235,6 +235,11 @@ class OrderEndpoint {
if ( $payment_method ) {
$data['payment_method'] = $payment_method->to_array();
}
/**
* The filter can be used to modify the order creation request body data.
*/
$data = apply_filters( 'ppcp_create_order_request_body_data', $data );
$url = trailingslashit( $this->host ) . 'v2/checkout/orders';
$args = array(
'method' => 'POST',