WC_Gateway_Paypal_IPN_Handler::payment_status_completed() protected WC 1.0
Handle a completed payment.
{} Это метод класса: WC_Gateway_Paypal_IPN_Handler{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->payment_status_completed( $order, $posted );
- $order(WC_Order) (обязательный)
- Order object.
- $posted(массив) (обязательный)
- Posted data.
Код WC_Gateway_Paypal_IPN_Handler::payment_status_completed() WC Gateway Paypal IPN Handler::payment status completed WC 5.0.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'] ) );
}
}
}