autoship_init_integration_test (function)
( src/api-health.php) Initiates the WooCommerce to Autoship to QPilot integration status check. Upon completion of the tests, the corresponding status timestamps are then populated.
Function
/** * Initiates the Autoship <> QPilot integration tests. * Hits the QPilot test endpoint where QPilot then checks * POST, GET, and PUT calls to WC and Autoship Endpoints. * If successful the corresponding status timestamps are populated. * */ function autoship_init_integration_test(){ // Clear the Status timestamps in prep for testing. autoship_clear_integration_point_statuses(); // Create the QPilot client // Grab the client and only continue if connection exists. if ( empty( $client = autoship_get_default_client() ) || empty( $client->get_token_auth() ) || empty( $client->get_site_id() )) return false; try { /** * Initiate QPilot's integration tests. * When initiated QPilot uses the api autoshipcloud/v1/statuscheck/put * and autoshipcloud/v1/statuscheck/post as well as the WC REST API * to Check if the connection is fully valid. * */ $result = $client->check_integration_status(); // Run the Status checks to ensure all green lights $health = autoship_integration_statuses_check( $result ); } catch ( Exception $e ) { // Run the Status checks to see where the failure occurred. $health = autoship_integration_statuses_check( NULL, true, $e->getCode(), $e->getMessage() ); } do_action( 'autoship_init_integration_test_complete', $health ); return $health; }