PHP Class WC_Gateway_Paypal_Request

Exibir arquivo Open project: woocommerce/woocommerce Class Usage Examples

Protected Properties

Property Type Description
$gateway WC_Gateway_Paypal Pointer to gateway making the request.
$line_items array Stores line items to send to PayPal.
$notify_url string Endpoint for requests from PayPal.

Public Methods

Method Description
__construct ( WC_Gateway_Paypal $gateway ) Constructor.
get_request_url ( WC_Order $order, boolean $sandbox = false ) : string Get the PayPal request URL for an order.

Protected Methods

Method Description
add_line_item ( string $item_name, integer $quantity = 1, float $amount, string $item_number = '' ) : boolean Add PayPal Line Item.
currency_has_decimals ( string $currency ) : boolean Check if currency has decimals.
delete_line_items ( ) Remove all line items.
get_line_item_args ( WC_Order $order ) : array Get line item args for paypal request.
get_line_items ( ) Return all line items.
get_order_item_name ( WC_Order $order, array $item ) : string Get order item names as a string.
get_order_item_names ( WC_Order $order ) : string Get order item names as a string.
get_paypal_args ( WC_Order $order ) : array Get PayPal Args for passing to PP.
get_paypal_state ( string $cc, string $state ) : string Get the state to send to paypal.
get_phone_number_args ( WC_Order $order ) : array Get phone number args for paypal request.
get_shipping_args ( WC_Order $order ) : array Get shipping args for paypal request.
number_format ( float | integer $price, WC_Order $order ) : string Format prices.
prepare_line_items ( WC_Order $order ) : boolean Get line items to send to paypal.
round ( double $price, WC_Order $order ) : double Round prices.

Method Details

__construct() public method

Constructor.
public __construct ( WC_Gateway_Paypal $gateway )
$gateway WC_Gateway_Paypal

add_line_item() protected method

Add PayPal Line Item.
protected add_line_item ( string $item_name, integer $quantity = 1, float $amount, string $item_number = '' ) : boolean
$item_name string
$quantity integer
$amount float
$item_number string
return boolean successfully added or not

currency_has_decimals() protected method

Check if currency has decimals.
protected currency_has_decimals ( string $currency ) : boolean
$currency string
return boolean

delete_line_items() protected method

Remove all line items.
protected delete_line_items ( )

get_line_item_args() protected method

Get line item args for paypal request.
protected get_line_item_args ( WC_Order $order ) : array
$order WC_Order
return array

get_line_items() protected method

Return all line items.
protected get_line_items ( )

get_order_item_name() protected method

Get order item names as a string.
protected get_order_item_name ( WC_Order $order, array $item ) : string
$order WC_Order
$item array
return string

get_order_item_names() protected method

Get order item names as a string.
protected get_order_item_names ( WC_Order $order ) : string
$order WC_Order
return string

get_paypal_args() protected method

Get PayPal Args for passing to PP.
protected get_paypal_args ( WC_Order $order ) : array
$order WC_Order
return array

get_paypal_state() protected method

Get the state to send to paypal.
protected get_paypal_state ( string $cc, string $state ) : string
$cc string
$state string
return string

get_phone_number_args() protected method

Get phone number args for paypal request.
protected get_phone_number_args ( WC_Order $order ) : array
$order WC_Order
return array

get_request_url() public method

Get the PayPal request URL for an order.
public get_request_url ( WC_Order $order, boolean $sandbox = false ) : string
$order WC_Order
$sandbox boolean
return string

get_shipping_args() protected method

Get shipping args for paypal request.
protected get_shipping_args ( WC_Order $order ) : array
$order WC_Order
return array

number_format() protected method

Format prices.
protected number_format ( float | integer $price, WC_Order $order ) : string
$price float | integer
$order WC_Order
return string

prepare_line_items() protected method

Get line items to send to paypal.
protected prepare_line_items ( WC_Order $order ) : boolean
$order WC_Order
return boolean

round() protected method

Round prices.
protected round ( double $price, WC_Order $order ) : double
$price double
$order WC_Order
return double

Property Details

$gateway protected_oe property

Pointer to gateway making the request.
protected WC_Gateway_Paypal $gateway
return WC_Gateway_Paypal

$line_items protected_oe property

Stores line items to send to PayPal.
protected array $line_items
return array

$notify_url protected_oe property

Endpoint for requests from PayPal.
protected string $notify_url
return string