Checkout_Handler implements Registerable, Service
Handles the VAT integration on the EDD Checkout.
Tags
Interfaces, Classes and Traits
- Registerable
- Service
Table of Contents
- $cart_vat : Cart_VAT
- The current VAT state of the cart.
- $template_path : string
- The full path to the plugin templates.
- __construct() : mixed
- Constructor
- ajax_edd_recalculate_taxes() : mixed
- Recalculate taxes via AJAX
- ajax_reconcile_payment_note() : void
- Reconcile local storage data with the payment note.
- ajax_vat_check() : mixed
- AJAX action for VAT number check.
- cart_item_price_includes_tax() : mixed
- Subtract VAT from cart item total if price includes tax.
- cart_tax() : string
- Gets the cart tax label.
- checkout_error_checks() : mixed
- Handle VAT checks on checkout if necessary.
- clear_vat_on_login() : void
- Clear VAT on login if not empty.
- debug_receipt() : void
- Print an hidden element that holds the ID number of the order.
- display_vat_field() : mixed
- Display VAT field on checkout (default location: below the billing address).
- insert_payment() : mixed
- Add VAT details to EDD payment.
- register() : mixed
- {@inheritdoc}
- register_vat_field_action() : mixed
- Registers the action which output the VAT field.
- tax_rate() : mixed
- Filter in the EU VAT rates into EDD tax rates.
- get_vat_check_result() : string
- Gets the VAT check result html.
- handle_vat_input() : mixed
- Handle VAT input on the checkout.
- should_display_vat_field() : bool
- Determines whether the VAT field should be displayed.
- vat_error_code_to_string() : string
- Gets an error message given an VAT_Check_Result code.
Properties
$cart_vat
The current VAT state of the cart.
private
Cart_VAT
$cart_vat
$template_path
The full path to the plugin templates.
private
string
$template_path
Methods
__construct()
Constructor
public
__construct(Cart_VAT $cart_vat, string $template_path) : mixed
Parameters
- $cart_vat : Cart_VAT
- $template_path : string
Return values
mixed —ajax_edd_recalculate_taxes()
Recalculate taxes via AJAX
public
ajax_edd_recalculate_taxes() : mixed
Return values
mixed —ajax_reconcile_payment_note()
Reconcile local storage data with the payment note.
public
ajax_reconcile_payment_note() : void
Return values
void —ajax_vat_check()
AJAX action for VAT number check.
public
ajax_vat_check() : mixed
Return values
mixed —cart_item_price_includes_tax()
Subtract VAT from cart item total if price includes tax.
public
cart_item_price_includes_tax(mixed $total, mixed $download_id, mixed $options) : mixed
Parameters
- $total : mixed
- $download_id : mixed
- $options : mixed
Return values
mixed —cart_tax()
Gets the cart tax label.
public
cart_tax(string $cart_tax) : string
Parameters
- $cart_tax : string
Return values
string —$cart_tax
checkout_error_checks()
Handle VAT checks on checkout if necessary.
public
checkout_error_checks(bool|array<string|int, mixed> $valid_data, array<string|int, mixed> $post_data) : mixed
Parameters
- $valid_data : bool|array<string|int, mixed>
- $post_data : array<string|int, mixed>
Return values
mixed —clear_vat_on_login()
Clear VAT on login if not empty.
public
clear_vat_on_login(string $user_login, object $user) : void
Parameters
- $user_login : string
- $user : object
Return values
void —debug_receipt()
Print an hidden element that holds the ID number of the order.
public
debug_receipt(object $order, array<string|int, mixed> $receipt_args) : void
This is needed for debug purposes.
Parameters
- $order : object
- $receipt_args : array<string|int, mixed>
Return values
void —display_vat_field()
Display VAT field on checkout (default location: below the billing address).
public
display_vat_field() : mixed
Return values
mixed —insert_payment()
Add VAT details to EDD payment.
public
insert_payment(int $payment_id, array<string|int, mixed> $payment_data) : mixed
Parameters
- $payment_id : int
- $payment_data : array<string|int, mixed>
Return values
mixed —register()
{@inheritdoc}
public
register() : mixed
Return values
mixed —register_vat_field_action()
Registers the action which output the VAT field.
public
register_vat_field_action() : mixed
Return values
mixed —tax_rate()
Filter in the EU VAT rates into EDD tax rates.
public
tax_rate(mixed $rate, string $country, string $state) : mixed
Parameters
- $rate : mixed
- $country : string
- $state : string
Return values
mixed —$rate
get_vat_check_result()
Gets the VAT check result html.
private
get_vat_check_result() : string
Return values
string —handle_vat_input()
Handle VAT input on the checkout.
private
handle_vat_input() : mixed
Return values
mixed —should_display_vat_field()
Determines whether the VAT field should be displayed.
private
should_display_vat_field() : bool
Return values
bool —vat_error_code_to_string()
Gets an error message given an VAT_Check_Result code.
private
static vat_error_code_to_string(int $code) : string
Parameters
- $code : int