Handle virtual-only auto-capture the same as normal capture

Do not duplicate code and make it call payment_complete to handle the statuses properly.
This commit is contained in:
Alex P 2022-09-28 11:45:00 +03:00
parent eb156c435f
commit 153fc09a09
2 changed files with 4 additions and 12 deletions

View file

@ -210,12 +210,8 @@ class OrderProcessor {
$this->handle_new_order_status( $order, $wc_order );
if ( $this->capture_authorized_downloads( $order ) && AuthorizedPaymentsProcessor::SUCCESSFUL === $this->authorized_payments_processor->process( $wc_order ) ) {
$wc_order->add_order_note(
__( 'Payment successfully captured.', 'woocommerce-paypal-payments' )
);
$wc_order->update_meta_data( AuthorizedPaymentsProcessor::CAPTURED_META_KEY, 'true' );
$wc_order->update_status( 'completed' );
if ( $this->capture_authorized_downloads( $order ) ) {
$this->authorized_payments_processor->capture_authorized_payment( $wc_order );
}
$this->last_error = '';
return true;