private static function set_posted_properties() { if (isset($_POST['email'])) { self::$email = sanitize_email($_POST['email']); } if (isset($_POST['password'])) { self::$passwd = sanitize_text_field($_POST['password']); } if (isset($_POST['server'])) { self::$endpoint = (bool) $_POST['server'] ? 'https://api.beta.shipwire.com/exec/' : 'https://api.shipwire.com/exec/'; } }
/** * 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')); }