WordPress at Your Fingertips
function is not described

WC_Gateway_Paypal_IPN_Handler::payment_status_completed() protected WC 1.0

Handle a completed payment.

{} It's a method of the class: WC_Gateway_Paypal_IPN_Handler{}

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->payment_status_completed( $order, $posted );
$order(WC_Order) (required)
Order object.
$posted(array) (required)
Posted data.

Code of WC_Gateway_Paypal_IPN_Handler::payment_status_completed() WC 5.7.0

protected function payment_status_completed( $order, $posted ) {
	if ( $order->has_status( wc_get_is_paid_statuses() ) ) {
		WC_Gateway_Paypal::log( 'Aborting, Order #' . $order->get_id() . ' is already complete.' );
		exit;
	}

	$this->validate_transaction_type( $posted['txn_type'] );
	$this->validate_currency( $order, $posted['mc_currency'] );
	$this->validate_amount( $order, $posted['mc_gross'] );
	$this->validate_receiver_email( $order, $posted['receiver_email'] );
	$this->save_paypal_meta_data( $order, $posted );

	if ( 'completed' === $posted['payment_status'] ) {
		if ( $order->has_status( 'cancelled' ) ) {
			$this->payment_status_paid_cancelled_order( $order, $posted );
		}

		if ( ! empty( $posted['mc_fee'] ) ) {
			$order->add_meta_data( 'PayPal Transaction Fee', wc_clean( $posted['mc_fee'] ) );
		}

		$this->payment_complete( $order, ( ! empty( $posted['txn_id'] ) ? wc_clean( $posted['txn_id'] ) : '' ), __( 'IPN payment completed', 'woocommerce' ) );
	} else {
		if ( 'authorization' === $posted['pending_reason'] ) {
			$this->payment_on_hold( $order, __( 'Payment authorized. Change payment status to processing or complete to capture funds.', 'woocommerce' ) );
		} else {
			/* translators: %s: pending reason. */
			$this->payment_on_hold( $order, sprintf( __( 'Payment pending (%s).', 'woocommerce' ), $posted['pending_reason'] ) );
		}
	}
}