Class WC_Braintree_Payment_Gateway
Abstract class that is meant to be extended by Braintree payment methods.
- WC_Payment_Gateway
- WC_Braintree_Payment_Gateway uses WC_Braintree_Settings_Trait
Direct known subclasses
WC_Braintree_ApplePay_Payment_Gateway
,
WC_Braintree_CC_Payment_Gateway
,
WC_Braintree_GooglePay_Payment_Gateway
,
WC_Braintree_Local_Payment_Gateway
,
WC_Braintree_PayPal_Payment_Gateway
,
WC_Braintree_Venmo_Payment_Gateway
Indirect known subclasses
WC_Braintree_Alipay_Payment_Gateway
,
WC_Braintree_Bancontact_Payment_Gateway
,
WC_Braintree_EPS_Payment_Gateway
,
WC_Braintree_Giropay_Payment_Gateway
,
WC_Braintree_IDEAL_Payment_Gateway
,
WC_Braintree_MyBank_Payment_Gateway
,
WC_Braintree_P24_Payment_Gateway
,
WC_Braintree_Sepa_Payment_Gateway
,
WC_Braintree_Sofort_Payment_Gateway
,
WC_Braintree_WeChat_Payment_Gateway
Package: Braintree\Abstracts
Version: 3.0.0
Located at abstract/abstract-class-wc-braintree-payment-gateway.php
Methods summary
public static
|
|
public
|
|
public
|
|
public
|
|
public
boolean|mixed|
|
#
is_available( )
Wrapper for the WC_Payment_Gateway::is_available function. A filter is added so merchants can add custom logic for determining when the gateway should be available. |
public
|
|
public
|
|
public
|
#
delete_payment_method( integer $token_id, WC_Payment_Token $token )
Delete a payment method in the Braintree gateway. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
string
|
|
public
|
|
public
|
#
payment_complete_actions( WC_Order $order, Braintree\Transaction $transaction, array $args )
Handles order status once payment has been captured or authorized. |
public
|
#
get_payment_method_token( )
If the payment_method_token has been set then return it. If not look for the token in the $_POST. |
public
|
#
get_payment_method_nonce( )
If the payment_method_nonce has been set, then return it. If not look for the nonce in the $_POST. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
should_save_payment_method( )
Return true if the payment method used on the checkout page should be saved. Payment methods should only be saved if the customer's wants to save the method or a new method is being used and there are subscriptions associated with the order. |
public
|
|
public
|
|
public
|
|
public
|
#
save_order_meta( Braintree\Transaction $transaction, WC_Order $order )
Save transaction data as meta data of the order. |
abstract public
|
#
get_payment_method_from_transaction( Braintree\Transaction $transaction )
Return the payment method details from the tranaction. |
public
|
|
public
|
|
public
|
|
public
|
|
public
boolean|WP_Error
|
|
public
boolean|WP_Error
|
|
public
array|string[]
|
|
public
WP_Error|Braintree\Transaction
|
|
public static
|
|
public static
|
|
public
|
|
public static
|
|
public
|
|
public
|
#
wcs_braintree_before_process_order( WC_Order $order )
If the plugin's subscription functionality is being used and there is a subscription in the cart and a new payment method is being used save the payment method. |
public
|
#
create_braintree_subscription(
Creates a subscription in the Braintree Gateway using data from the WC_Braintree_Subscription |
public
|
|
public
|
#
token_exists( string $token, integer $user_id = 0 )
Return true if the token exists in the woocommerce_payment_tokens table. |
public
|
|
public
|
|
private
|
|
private
|
|
public
|
|
public static
|
#
process_shop_subscription_meta( integer $post_id, WP_Post $post )
Save WCS meta data when it's changed in the admin section. By default WCS saves the payment method title as the gateway title. This method saves the payment method title in a human readable format suitable for the frontend. |
public
|
|
public
|
|
public
|
#
change_subscription_payment_method(
Update the payment method associated with the Braintree Subscription. |
public
array
|
|
public
|
#
is_cart_checkout_enabled( )
Return true if the payment gateway has been enabled for cart checkout. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
remove_session_checkout_vars( )
Method that is called during successful checkout. It's purpose is to remove any gateway specific variables that are stored in the WC session. |
public
|
#
banner_checkout_enabled( )
Return true if the gateway has enabled checkout from the top of the checkout page. |
public
|
|
public
|
|
public
boolean
|
|
public static
|
#
deprecated_subscription_check( integer $subscription_id )
Check if the request for recurring payment is for a Braintree Subscription. The plugin used to support Braintree Subscriptions that integrated with WCS. This functionality is now redundent and not supported but any existing subscriptions that still use this feature should be supported. |
public
|
|
private
|
|
protected
|
#
get_locale( )
Returns the locale of the shop. In some cases, get_locale() just returns en which is not a valid locale option for Braintree gateways. The country code suffix is required. Example: en_US |
protected
|
#
add_order_line_items( array & $args, WC_Order $order, array & $items = array() )
Adds the WC_Order line items to the transaction args. For PayPal transactions, the totals must equal the amount property. Totals are calculated by PayPal as follows: taxAmount + shippingAmount + (item['unitAmount'] * item['quantity']). If those values do not equal the amount property, then validation will fail. |
public
array
|
#
add_to_cart_response( array $data )
Decorate the add to cart response with data relevant to the gateway. |
public
|
#
update_shipping_address_response( array $data )
Decoraate the response when the shipping address is updated for the cart. |
public
|
#
update_shipping_method_response( array $data )
Decoraate the response when the shipping method is updated for the cart. |
public
boolean
|
|
public
|
|
public
boolean
|
#
cart_contains_trial_period_subscription( )
Returns true if the Cart contains a WCS subscription product that has a trial period. |
public
|
|
public
|
|
public
the
|
|
protected
WP_Error|string
|
#
create_customer( WC_Customer|null $customer = null )
Create a Braintree vault ID for the WC customer. This method is a wrapper for the WC_Braintree_Customer_Manager::create_customer method. |
public
|
#
pre_order_before_process_order( WC_Order $order )
Check if the order contains a pre-order product. If so, may need to save the payment method. |
protected
|
|
public
|
#
process_pre_order_payment( WC_Order $order )
Process the payment for the pre order. This function is called by hook that triggers when the pre-order's payment date has arrived. |
protected
|
|
protected
|
#
get_order_meta_data( string $key, WC_Order $order, string $context = 'view' )
Returns the metadata value for the order. This function is used to find common metadata between this plugin and other Braintree plugins which use different naming conventions. |
public
|
#
maybe_enqueue_checkout_scripts( )
Enqueue scripts if the payment fields are not displayed. Payment fields might not be displayed if the order total is zero due to a coupon. Scripts are still needed because customer might make a selection that makes the order total > 0 |
public
|
|
public
|
|
private
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
private
|
#
format_order_line_item( array & $item, string $key, integer $len, boolean $unset = false )
Given a line item, trim or unset the specified property if it exceeds the max length. |
public
array
|
|
public
array
|
#
get_formatted_shipping_method( WC_Shipping_Rate $method, integer $index, boolean $selected, float $amount, integer $decimals )
Return a shipping method formatted for the gateway. |
public
|
#
get_shipping_method_id( WC_Shipping_Rate|string $method, integer $index )
Returns an ID that represents a shipping method. |
public
array
|
|
public
|
|
public
|
#
get_display_items( string $page = 'checkout', WC_Order $order = null )
Returns an array of items for display in the Gateway' wallet. |
public
|
|
public
array
|
|
public
|
#
get_display_items_for_order( WC_Order $order, integer $decimals = 2 )
Return an array of order items formatted for the gateway wallet display. |
public
|
#
get_display_item_for_order( string $total, string $label, string $type, WC_Order $order, array $args )
|
public
|
|
public
array
|
|
public
|
#
get_display_items_for_recurring_cart( array $items, WC_Cart $cart, integer $decimals, boolean $incl_tax )
|
protected
|
|
public
mixed
|
|
public
array
|
|
public
|
|
public
|
|
public
|
|
protected
|
#
do_post_payment_processing( WC_Order $order, string|null $type = null )
Perform processes that are dependent on a successful payment. |
public
|
Methods used from WC_Braintree_Settings_Trait
admin_settings_tabs()
,
generate_button_html()
,
generate_description_html()
,
generate_multi_select_countries_html()
,
generate_multiselect_html()
,
generate_paragraph_html()
,
generate_slider_html()
,
get_admin_localized_params()
,
get_braintree_documentation_url()
,
get_custom_attribute_html()
,
get_localized_params()
,
get_prefix()
,
get_tab_title()
,
is_active()
,
output_settings_nav()
,
process_admin_options()
,
validate_multi_select_countries_field()
Properties summary
public
|
$nonce_key
|
|
public
|
$token_key
|
|
public
|
$device_data_key
|
|
public
|
$save_method_key
|
|
public
|
$payment_type_key
|
|
public
string
|
$config_key
|
#
''
|
protected
string
|
$token_type
The token type used to create WC_Payment_Token objects. |
|
protected
string
|
$deprecated_id
|
#
''
|
protected
array
|
$client_token
|
#
''
|
protected
string
|
$payment_method_token
Token that represents a vaulted payment method in Braintree. Example: cby23j |
#
null
|
protected
string
|
$payment_method_nonce
Nonce that represents a once time use payment method. |
#
null
|
protected
boolean
|
$update_payment_method_request
|
#
false
|
protected
string
|
$tab_title
|
#
''
|
public
string
|
$template
Template that points to where the gateway's html is rendered. |
#
''
|
public
boolean
|
$processing_payment
Indicator for when payment is being processed. |
|
protected
array
|
$order_totals
|
#
array(
'item' => array(
'subtotal' => 0,
'tax_total' => 0
),
'discount' => array(
'subtotal' => 0,
'tax_total' => 0
),
'fee' => array(
'subtotal' => 0,
'tax_total' => 0
),
'shipping' => array(
'subtotal' => 0,
'tax_total' => 0
),
'tax' => array(
'subtotal' => 0,
'tax_total' => 0
)
)
|
protected
int[]
|
$line_item_validations
|
#
array(
'commodityCode' => 12,
'description' => 127,
'discountAmount' => 2,
'name' => 35,
'productCode' => 12,
'taxAmount' => 2,
'totalAmount' => 2,
'unitAmount' => 4,
'unitOfMeasure' => 12,
'unitTaxAmount' => 2
)
|
protected
boolean
|
$has_digital_wallet
|
#
false
|
public
|
$product_gateway_option
|
|
public
Braintree\Gateway
|
$gateway
|