Move update order status after PayPal order creation

This commit is contained in:
emilicastells 2022-11-14 16:04:58 +01:00
parent 7ffbb5e159
commit 39f41e1a14
No known key found for this signature in database
GPG key ID: 1520C07081754570

View file

@ -249,13 +249,13 @@ class PayUponInvoiceGateway extends WC_Payment_Gateway {
$wc_order->save();
}
$wc_order->update_status( 'on-hold', __( 'Awaiting Pay upon Invoice payment.', 'woocommerce-paypal-payments' ) );
$purchase_unit = $this->purchase_unit_factory->from_wc_order( $wc_order );
$payment_source = $this->payment_source_factory->from_wc_order( $wc_order, $birth_date );
try {
$order = $this->order_endpoint->create( array( $purchase_unit ), $payment_source, $wc_order );
$this->add_paypal_meta( $wc_order, $order, $this->environment );
$wc_order->update_status( 'on-hold', __( 'Awaiting Pay upon Invoice payment.', 'woocommerce-paypal-payments' ) );
as_schedule_single_action(
time() + ( 5 * MINUTE_IN_SECONDS ),