/** * Sets up properties, sends Order via API on checkout success. Initial hook for AJAX link in admin * * @since 3.8.9 * @return type */ private function __construct() { self::$email = get_option('shipwireemail'); self::$passwd = get_option('shipwirepassword'); self::$server = 'Production'; self::$warehouse = '00'; self::$endpoint = 'https://api.shipwire.com/exec/'; //For testing, change to api.beta.shipwire //Hooks into transaction results for Order Fulfillment API. wpsc_confirm_checkout would be logical - but it is run for each cart item. //In fact, the only two current transaction page actions happen within the cart loop. Not great. //I believe there is a patch on Issue 490 that proposes a 'wpsc_transaction_results_shutdown' action. It doesn't pass a $log_id, but it does pass a sessionid, which is fine. add_action('wpsc_transaction_results_shutdown', array($this, 'shipwire_on_checkout'), 10, 3); //Hooks into ajax handler for Inventory Sync and Tracking API. Handler is run upon clicking "Update Tracking and Inventory" in Shipping Settings add_action('wp_ajax_sync_shipwire_products', array($this, 'sync_products')); }
/** * Sets up properties, sends Order via API on checkout success. Initial hook for AJAX link in admin * * @since 3.8.9 * @return type */ private function __construct() { self::$email = sanitize_email(get_option('shipwireemail')); self::$passwd = sanitize_text_field(get_option('shipwirepassword')); self::$server = apply_filters('wpsc_shipwire_server', 'Production'); self::$warehouse = apply_filters('wpsc_shipwire_warehouse', '00'); self::$endpoint = (bool) get_option('shipwire_test_server') ? 'https://api.beta.shipwire.com/exec/' : 'https://api.shipwire.com/exec/'; if (!self::is_active()) { return; } if (defined('DOING_AJAX') && DOING_AJAX) { self::set_posted_properties(); } add_action('wpsc_transaction_results_shutdown', array($this, 'shipwire_on_checkout'), 10, 3); //Hooks into ajax handler for Inventory Sync and Tracking API. Handler is run upon clicking "Update Tracking and Inventory" in Shipping Settings add_action('wp_ajax_sync_shipwire_products', array($this, 'sync_products')); }