WC_Gateway_Paypal_Request::get_transaction_args()protectedWC 1.0

Get transaction args for paypal request, except for line item args.

Метод класса: WC_Gateway_Paypal_Request{}

Хуков нет.

Возвращает

Массив.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_transaction_args( $order );
$order(WC_Order) (обязательный)
Order object.

Код WC_Gateway_Paypal_Request::get_transaction_args() WC 8.7.0

protected function get_transaction_args( $order ) {
	return array_merge(
		array(
			'cmd'           => '_cart',
			'business'      => $this->gateway->get_option( 'email' ),
			'no_note'       => 1,
			'currency_code' => get_woocommerce_currency(),
			'charset'       => 'utf-8',
			'rm'            => is_ssl() ? 2 : 1,
			'upload'        => 1,
			'return'        => esc_url_raw( add_query_arg( 'utm_nooverride', '1', $this->gateway->get_return_url( $order ) ) ),
			'cancel_return' => esc_url_raw( $order->get_cancel_order_url_raw() ),
			'image_url'     => esc_url_raw( $this->gateway->get_option( 'image_url' ) ),
			'paymentaction' => $this->gateway->get_option( 'paymentaction' ),
			'invoice'       => $this->limit_length( $this->gateway->get_option( 'invoice_prefix' ) . $order->get_order_number(), 127 ),
			'custom'        => wp_json_encode(
				array(
					'order_id'  => $order->get_id(),
					'order_key' => $order->get_order_key(),
				)
			),
			'notify_url'    => $this->limit_length( $this->notify_url, 255 ),
			'first_name'    => $this->limit_length( $order->get_billing_first_name(), 32 ),
			'last_name'     => $this->limit_length( $order->get_billing_last_name(), 64 ),
			'address1'      => $this->limit_length( $order->get_billing_address_1(), 100 ),
			'address2'      => $this->limit_length( $order->get_billing_address_2(), 100 ),
			'city'          => $this->limit_length( $order->get_billing_city(), 40 ),
			'state'         => $this->get_paypal_state( $order->get_billing_country(), $order->get_billing_state() ),
			'zip'           => $this->limit_length( wc_format_postcode( $order->get_billing_postcode(), $order->get_billing_country() ), 32 ),
			'country'       => $this->limit_length( $order->get_billing_country(), 2 ),
			'email'         => $this->limit_length( $order->get_billing_email() ),
		),
		$this->get_phone_number_args( $order ),
		$this->get_shipping_args( $order )
	);
}