/** * The constructor * * @param string $ip */ public function __construct($ip) { // Set request method and endpoint $this->set_request_methods(array('geoip')); $this->set_request_endpoint($ip); parent::__construct(); }
/** * The constructor */ public function __construct() { // Set request method and endpoint $this->set_request_methods(array('dictionaries')); $this->set_request_endpoint('countries'); // Only return tax supported countries $this->set_request_body(array('tax_supported' => 'true')); parent::__construct(); }
/** * The constructor * * @param String $transaction_key */ public function __construct($transaction_key) { // Set request method and endpoint $this->set_request_methods(array('transactions', $transaction_key)); $this->set_request_endpoint('confirm'); // Set the HTTP method $this->set_http_method('POST'); parent::__construct(); }
/** * The constructor * * @param $vat_number * @param $country_code */ public function __construct($vat_number, $country_code = '') { // Set request method and endpoint $this->set_request_methods(array('tax', 'vat_numbers', $vat_number)); $this->set_request_endpoint('validate'); // Optionally set the country code if ('' != $country_code) { $this->set_request_body(array('country_code' => $country_code)); } parent::__construct(); }
/** * The constructor * * @param String $transaction_key * @param String $line_key * @param float $amount */ public function __construct($transaction_key, $line_key, $amount) { // Set request method and endpoint $this->set_request_methods(array('transactions', $transaction_key)); $this->set_request_endpoint('refunds'); // Set the HTTP method $this->set_http_method('POST'); // Set the body $this->set_request_body(array('line_key' => $line_key, 'amount' => floatval($amount))); parent::__construct(); }
/** * The constructor * * @param String $transaction_key * @param int $amount * @param String $gateway */ public function __construct($transaction_key, $amount, $gateway = null) { // Set request method and endpoint $this->set_request_methods(array('transactions', $transaction_key)); $this->set_request_endpoint('payments'); // Set the HTTP method $this->set_http_method('POST'); // Set the transaction $this->set_request_body(array('amount' => floatval($amount), 'payment_information' => 'Gateway: ' . $gateway)); parent::__construct(); }
/** * The constructor * * @param string $country * @param array $items * @param array $transaction_extra */ public function __construct($country, $items, $transaction_extra = array()) { // Set request method and endpoint $this->set_request_methods(array('tax')); $this->set_request_endpoint('calculate'); // Set the HTTP method $this->set_http_method('POST'); // Transaction manager $transaction_manager = new WC_TA_Transaction_Manager(); // Set the transaction $this->set_request_body(array('transaction' => $transaction_manager->build_transaction($country, $items, null, null, null, $transaction_extra))); parent::__construct(); }
/** * The constructor * * @param string $country * @param array $items * @param String $buyer_name * @param String $buyer_email * @param int $custom_transaction_id * @param array $transaction_extra */ public function __construct($country, $items, $buyer_name, $buyer_email, $custom_transaction_id, $transaction_extra = array()) { // Set request method and endpoint //$this->set_request_methods( array( 'transactions' ) ); $this->set_request_endpoint('transactions'); // Set the HTTP method $this->set_http_method('POST'); // Transaction manager $transaction_manager = new WC_TA_Transaction_Manager(); // Set the transaction $this->set_request_body(array('transaction' => $transaction_manager->build_transaction($country, $items, $buyer_name, $buyer_email, $custom_transaction_id, $transaction_extra))); parent::__construct(); }