2016-06-14 22:36:25 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shipping Zones API Tests
|
|
|
|
* @package WooCommerce\Tests\API
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-14 22:36:25 +00:00
|
|
|
*/
|
2016-07-26 21:30:02 +00:00
|
|
|
class WC_Tests_API_Shipping_Zones extends WC_REST_Unit_Test_Case {
|
2016-06-14 22:36:25 +00:00
|
|
|
|
|
|
|
protected $server;
|
|
|
|
|
|
|
|
protected $endpoint;
|
|
|
|
|
|
|
|
protected $user;
|
|
|
|
|
|
|
|
protected $zones;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Setup our test server, endpoints, and user info.
|
|
|
|
*/
|
|
|
|
public function setUp() {
|
|
|
|
parent::setUp();
|
|
|
|
$this->endpoint = new WC_REST_Shipping_Zones_Controller();
|
2018-05-04 14:42:45 +00:00
|
|
|
$this->user = $this->factory->user->create(
|
|
|
|
array(
|
|
|
|
'role' => 'administrator',
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->zones = array();
|
2016-06-14 22:36:25 +00:00
|
|
|
}
|
|
|
|
|
2016-06-14 22:43:17 +00:00
|
|
|
/**
|
|
|
|
* Helper method to create a Shipping Zone.
|
|
|
|
*
|
|
|
|
* @param string $name Zone name.
|
|
|
|
* @param int $order Optional. Zone sort order.
|
|
|
|
* @return WC_Shipping_Zone
|
|
|
|
*/
|
2016-06-15 21:24:56 +00:00
|
|
|
protected function create_shipping_zone( $name, $order = 0, $locations = array() ) {
|
2016-06-14 22:43:17 +00:00
|
|
|
$zone = new WC_Shipping_Zone( null );
|
|
|
|
$zone->set_zone_name( $name );
|
|
|
|
$zone->set_zone_order( $order );
|
2016-06-15 21:24:56 +00:00
|
|
|
$zone->set_locations( $locations );
|
2016-06-14 22:43:17 +00:00
|
|
|
$zone->save();
|
|
|
|
|
|
|
|
$this->zones[] = $zone;
|
|
|
|
|
|
|
|
return $zone;
|
|
|
|
}
|
|
|
|
|
2016-06-14 22:36:25 +00:00
|
|
|
/**
|
|
|
|
* Test route registration.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-14 22:36:25 +00:00
|
|
|
*/
|
|
|
|
public function test_register_routes() {
|
|
|
|
$routes = $this->server->get_routes();
|
2017-02-09 20:21:52 +00:00
|
|
|
$this->assertArrayHasKey( '/wc/v2/shipping/zones', $routes );
|
|
|
|
$this->assertArrayHasKey( '/wc/v2/shipping/zones/(?P<id>[\d-]+)', $routes );
|
2017-04-28 14:49:51 +00:00
|
|
|
$this->assertArrayHasKey( '/wc/v2/shipping/zones/(?P<id>[\d]+)/locations', $routes );
|
|
|
|
$this->assertArrayHasKey( '/wc/v2/shipping/zones/(?P<zone_id>[\d]+)/methods', $routes );
|
2017-05-02 23:37:03 +00:00
|
|
|
$this->assertArrayHasKey( '/wc/v2/shipping/zones/(?P<zone_id>[\d]+)/methods/(?P<instance_id>[\d]+)', $routes );
|
2016-06-14 22:36:25 +00:00
|
|
|
}
|
2016-06-14 22:44:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test getting all Shipping Zones.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-14 22:44:10 +00:00
|
|
|
*/
|
|
|
|
public function test_get_zones() {
|
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
|
2016-06-17 23:03:59 +00:00
|
|
|
// "Rest of the World" zone exists by default
|
2017-02-09 20:21:52 +00:00
|
|
|
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/shipping/zones' ) );
|
2018-05-04 14:42:45 +00:00
|
|
|
$data = $response->get_data();
|
2016-06-14 22:44:10 +00:00
|
|
|
|
|
|
|
$this->assertEquals( 200, $response->get_status() );
|
2016-06-17 23:03:59 +00:00
|
|
|
$this->assertEquals( count( $data ), 1 );
|
2018-05-04 14:42:45 +00:00
|
|
|
$this->assertContains(
|
|
|
|
array(
|
|
|
|
'id' => 0,
|
|
|
|
'name' => 'Locations not covered by your other zones',
|
|
|
|
'order' => 0,
|
|
|
|
'_links' => array(
|
|
|
|
'self' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/0' ),
|
|
|
|
),
|
2016-06-17 23:03:59 +00:00
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
'collection' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones' ),
|
|
|
|
),
|
2016-06-17 23:03:59 +00:00
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
'describedby' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/0/locations' ),
|
|
|
|
),
|
2016-06-17 23:03:59 +00:00
|
|
|
),
|
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
), $data
|
|
|
|
);
|
2016-06-14 22:44:10 +00:00
|
|
|
|
|
|
|
// Create a zone and make sure it's in the response
|
|
|
|
$this->create_shipping_zone( 'Zone 1' );
|
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/shipping/zones' ) );
|
2018-05-04 14:42:45 +00:00
|
|
|
$data = $response->get_data();
|
2016-06-14 22:44:10 +00:00
|
|
|
|
|
|
|
$this->assertEquals( 200, $response->get_status() );
|
2016-06-17 23:03:59 +00:00
|
|
|
$this->assertEquals( count( $data ), 2 );
|
2018-05-04 14:42:45 +00:00
|
|
|
$this->assertContains(
|
|
|
|
array(
|
|
|
|
'id' => 1,
|
|
|
|
'name' => 'Zone 1',
|
|
|
|
'order' => 0,
|
|
|
|
'_links' => array(
|
|
|
|
'self' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/1' ),
|
|
|
|
),
|
2016-06-14 22:44:10 +00:00
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
'collection' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones' ),
|
|
|
|
),
|
2016-06-14 22:44:10 +00:00
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
'describedby' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/1/locations' ),
|
|
|
|
),
|
2016-06-15 18:51:48 +00:00
|
|
|
),
|
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
), $data
|
|
|
|
);
|
2016-06-14 22:44:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test /shipping/zones without valid permissions/creds.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-14 22:44:10 +00:00
|
|
|
*/
|
|
|
|
public function test_get_shipping_zones_without_permission() {
|
|
|
|
wp_set_current_user( 0 );
|
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/shipping/zones' ) );
|
2016-06-14 22:44:10 +00:00
|
|
|
$this->assertEquals( 401, $response->get_status() );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test /shipping/zones while Shipping is disabled in WooCommerce.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-14 22:44:10 +00:00
|
|
|
*/
|
|
|
|
public function test_get_shipping_zones_disabled_shipping() {
|
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
|
|
|
|
add_filter( 'wc_shipping_enabled', '__return_false' );
|
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/shipping/zones' ) );
|
2016-06-14 22:44:10 +00:00
|
|
|
$this->assertEquals( 404, $response->get_status() );
|
|
|
|
|
|
|
|
remove_filter( 'wc_shipping_enabled', '__return_false' );
|
|
|
|
}
|
2016-06-14 22:57:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test Shipping Zone schema.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-14 22:57:35 +00:00
|
|
|
*/
|
|
|
|
public function test_get_shipping_zone_schema() {
|
2018-05-04 14:42:45 +00:00
|
|
|
$request = new WP_REST_Request( 'OPTIONS', '/wc/v2/shipping/zones' );
|
|
|
|
$response = $this->server->dispatch( $request );
|
|
|
|
$data = $response->get_data();
|
2016-06-14 22:57:35 +00:00
|
|
|
$properties = $data['schema']['properties'];
|
|
|
|
$this->assertEquals( 3, count( $properties ) );
|
|
|
|
$this->assertArrayHasKey( 'id', $properties );
|
|
|
|
$this->assertTrue( $properties['id']['readonly'] );
|
|
|
|
$this->assertArrayHasKey( 'name', $properties );
|
|
|
|
$this->assertArrayHasKey( 'order', $properties );
|
|
|
|
}
|
2016-06-14 23:06:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test Shipping Zone create endpoint.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-14 23:06:47 +00:00
|
|
|
*/
|
|
|
|
public function test_create_shipping_zone() {
|
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$request = new WP_REST_Request( 'POST', '/wc/v2/shipping/zones' );
|
2018-05-04 14:42:45 +00:00
|
|
|
$request->set_body_params(
|
|
|
|
array(
|
|
|
|
'name' => 'Test Zone',
|
|
|
|
'order' => 1,
|
|
|
|
)
|
|
|
|
);
|
2016-06-14 23:06:47 +00:00
|
|
|
$response = $this->server->dispatch( $request );
|
2018-05-04 14:42:45 +00:00
|
|
|
$data = $response->get_data();
|
2016-06-14 23:06:47 +00:00
|
|
|
|
2016-08-02 17:26:26 +00:00
|
|
|
$this->assertEquals( 201, $response->get_status() );
|
2018-05-04 14:42:45 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
array(
|
|
|
|
'id' => $data['id'],
|
|
|
|
'name' => 'Test Zone',
|
|
|
|
'order' => 1,
|
|
|
|
'_links' => array(
|
|
|
|
'self' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/' . $data['id'] ),
|
|
|
|
),
|
2016-06-14 23:06:47 +00:00
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
'collection' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones' ),
|
|
|
|
),
|
2016-06-14 23:06:47 +00:00
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
'describedby' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/' . $data['id'] . '/locations' ),
|
|
|
|
),
|
2016-06-15 18:51:48 +00:00
|
|
|
),
|
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
), $data
|
|
|
|
);
|
2016-06-14 23:06:47 +00:00
|
|
|
}
|
2016-06-14 23:15:16 +00:00
|
|
|
|
2016-08-02 17:26:26 +00:00
|
|
|
/**
|
|
|
|
* Test Shipping Zone create endpoint.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-08-02 17:26:26 +00:00
|
|
|
*/
|
|
|
|
public function test_create_shipping_zone_without_permission() {
|
|
|
|
wp_set_current_user( 0 );
|
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$request = new WP_REST_Request( 'POST', '/wc/v2/shipping/zones' );
|
2018-05-04 14:42:45 +00:00
|
|
|
$request->set_body_params(
|
|
|
|
array(
|
|
|
|
'name' => 'Test Zone',
|
|
|
|
'order' => 1,
|
|
|
|
)
|
|
|
|
);
|
2016-08-02 17:26:26 +00:00
|
|
|
$response = $this->server->dispatch( $request );
|
|
|
|
$this->assertEquals( 401, $response->get_status() );
|
|
|
|
}
|
|
|
|
|
2016-06-14 23:15:16 +00:00
|
|
|
/**
|
|
|
|
* Test Shipping Zone update endpoint.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-14 23:15:16 +00:00
|
|
|
*/
|
|
|
|
public function test_update_shipping_zone() {
|
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
|
|
|
|
$zone = $this->create_shipping_zone( 'Test Zone' );
|
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$request = new WP_REST_Request( 'PUT', '/wc/v2/shipping/zones/' . $zone->get_id() );
|
2018-05-04 14:42:45 +00:00
|
|
|
$request->set_body_params(
|
|
|
|
array(
|
|
|
|
'name' => 'Zone Test',
|
|
|
|
'order' => 2,
|
|
|
|
)
|
|
|
|
);
|
2016-06-14 23:15:16 +00:00
|
|
|
$response = $this->server->dispatch( $request );
|
2018-05-04 14:42:45 +00:00
|
|
|
$data = $response->get_data();
|
2016-06-14 23:15:16 +00:00
|
|
|
|
|
|
|
$this->assertEquals( 200, $response->get_status() );
|
2018-05-04 14:42:45 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
array(
|
|
|
|
'id' => $zone->get_id(),
|
|
|
|
'name' => 'Zone Test',
|
|
|
|
'order' => 2,
|
|
|
|
'_links' => array(
|
|
|
|
'self' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/' . $zone->get_id() ),
|
|
|
|
),
|
2016-06-14 23:15:16 +00:00
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
'collection' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones' ),
|
|
|
|
),
|
2016-06-14 23:15:16 +00:00
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
'describedby' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/' . $zone->get_id() . '/locations' ),
|
|
|
|
),
|
2016-06-15 18:51:48 +00:00
|
|
|
),
|
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
), $data
|
|
|
|
);
|
2016-06-14 23:15:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test Shipping Zone update endpoint with a bad zone ID.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-14 23:15:16 +00:00
|
|
|
*/
|
|
|
|
public function test_update_shipping_zone_invalid_id() {
|
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$request = new WP_REST_Request( 'PUT', '/wc/v2/shipping/zones/555555' );
|
2018-05-04 14:42:45 +00:00
|
|
|
$request->set_body_params(
|
|
|
|
array(
|
|
|
|
'name' => 'Zone Test',
|
|
|
|
'order' => 2,
|
|
|
|
)
|
|
|
|
);
|
2016-06-14 23:15:16 +00:00
|
|
|
$response = $this->server->dispatch( $request );
|
|
|
|
|
|
|
|
$this->assertEquals( 404, $response->get_status() );
|
|
|
|
}
|
2016-06-14 23:25:12 +00:00
|
|
|
|
2016-08-29 17:19:28 +00:00
|
|
|
/**
|
|
|
|
* Test Shipping Zone delete endpoint.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-08-29 17:19:28 +00:00
|
|
|
*/
|
|
|
|
public function test_delete_shipping_zone() {
|
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
$zone = $this->create_shipping_zone( 'Zone 1' );
|
|
|
|
|
2018-05-04 14:42:45 +00:00
|
|
|
$request = new WP_REST_Request( 'DELETE', '/wc/v2/shipping/zones/' . $zone->get_id() );
|
2016-08-29 17:19:28 +00:00
|
|
|
$request->set_param( 'force', true );
|
|
|
|
$response = $this->server->dispatch( $request );
|
|
|
|
$data = $response->get_data();
|
|
|
|
|
|
|
|
$this->assertEquals( 200, $response->get_status() );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test Shipping Zone delete endpoint without permissions.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-08-29 17:19:28 +00:00
|
|
|
*/
|
|
|
|
public function test_delete_shipping_zone_without_permission() {
|
|
|
|
wp_set_current_user( 0 );
|
|
|
|
$zone = $this->create_shipping_zone( 'Zone 1' );
|
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$request = new WP_REST_Request( 'DELETE', '/wc/v2/shipping/zones/' . $zone->get_id() );
|
2016-08-29 17:19:28 +00:00
|
|
|
$request->set_param( 'force', true );
|
|
|
|
$response = $this->server->dispatch( $request );
|
|
|
|
$this->assertEquals( 401, $response->get_status() );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test Shipping Zone delete endpoint with a bad zone ID.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-08-29 17:19:28 +00:00
|
|
|
*/
|
|
|
|
public function test_delete_shipping_zone_invalid_id() {
|
|
|
|
wp_set_current_user( $this->user );
|
2017-02-09 20:21:52 +00:00
|
|
|
$request = new WP_REST_Request( 'DELETE', '/wc/v2/shipping/zones/555555' );
|
2016-08-29 17:19:28 +00:00
|
|
|
$response = $this->server->dispatch( $request );
|
|
|
|
$this->assertEquals( 404, $response->get_status() );
|
|
|
|
}
|
|
|
|
|
2016-06-14 23:25:12 +00:00
|
|
|
/**
|
|
|
|
* Test getting a single Shipping Zone.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-14 23:25:12 +00:00
|
|
|
*/
|
|
|
|
public function test_get_single_shipping_zone() {
|
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
|
|
|
|
$zone = $this->create_shipping_zone( 'Test Zone' );
|
2017-02-09 20:21:52 +00:00
|
|
|
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/shipping/zones/' . $zone->get_id() ) );
|
2016-06-14 23:25:12 +00:00
|
|
|
$data = $response->get_data();
|
|
|
|
|
|
|
|
$this->assertEquals( 200, $response->get_status() );
|
2018-05-04 14:42:45 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
array(
|
|
|
|
'id' => $zone->get_id(),
|
|
|
|
'name' => 'Test Zone',
|
|
|
|
'order' => 0,
|
|
|
|
'_links' => array(
|
|
|
|
'self' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/' . $zone->get_id() ),
|
|
|
|
),
|
2016-06-14 23:25:12 +00:00
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
'collection' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones' ),
|
|
|
|
),
|
2016-06-14 23:25:12 +00:00
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
'describedby' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/' . $zone->get_id() . '/locations' ),
|
|
|
|
),
|
2016-06-15 18:51:48 +00:00
|
|
|
),
|
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
), $data
|
|
|
|
);
|
2016-06-14 23:25:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test getting a single Shipping Zone with a bad zone ID.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-14 23:25:12 +00:00
|
|
|
*/
|
|
|
|
public function test_get_single_shipping_zone_invalid_id() {
|
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/shipping/zones/1' ) );
|
2016-06-14 23:25:12 +00:00
|
|
|
|
|
|
|
$this->assertEquals( 404, $response->get_status() );
|
|
|
|
}
|
2016-06-15 21:24:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test getting Shipping Zone Locations.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-15 21:24:56 +00:00
|
|
|
*/
|
|
|
|
public function test_get_locations() {
|
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
|
|
|
|
// Create a zone
|
2018-05-04 14:42:45 +00:00
|
|
|
$zone = $this->create_shipping_zone(
|
|
|
|
'Zone 1', 0, array(
|
|
|
|
array(
|
|
|
|
'code' => 'US',
|
|
|
|
'type' => 'country',
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
2016-06-15 21:24:56 +00:00
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/shipping/zones/' . $zone->get_id() . '/locations' ) );
|
2018-05-04 14:42:45 +00:00
|
|
|
$data = $response->get_data();
|
2016-06-15 21:24:56 +00:00
|
|
|
|
|
|
|
$this->assertEquals( 200, $response->get_status() );
|
|
|
|
$this->assertEquals( count( $data ), 1 );
|
2018-05-04 14:42:45 +00:00
|
|
|
$this->assertEquals(
|
2016-06-15 21:24:56 +00:00
|
|
|
array(
|
2018-05-04 14:42:45 +00:00
|
|
|
array(
|
|
|
|
'code' => 'US',
|
|
|
|
'type' => 'country',
|
|
|
|
'_links' => array(
|
|
|
|
'collection' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/' . $zone->get_id() . '/locations' ),
|
|
|
|
),
|
2016-06-15 21:24:56 +00:00
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
'describes' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/' . $zone->get_id() ),
|
|
|
|
),
|
2016-06-15 21:24:56 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
), $data
|
|
|
|
);
|
2016-06-15 21:24:56 +00:00
|
|
|
}
|
2016-06-15 21:47:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test getting Shipping Zone Locations with a bad zone ID.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-15 21:47:57 +00:00
|
|
|
*/
|
|
|
|
public function test_get_locations_invalid_id() {
|
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/shipping/zones/1/locations' ) );
|
2016-06-15 21:47:57 +00:00
|
|
|
|
|
|
|
$this->assertEquals( 404, $response->get_status() );
|
|
|
|
}
|
2016-06-15 22:23:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test Shipping Zone Locations update endpoint.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-15 22:23:10 +00:00
|
|
|
*/
|
|
|
|
public function test_update_locations() {
|
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
|
|
|
|
$zone = $this->create_shipping_zone( 'Test Zone' );
|
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$request = new WP_REST_Request( 'PUT', '/wc/v2/shipping/zones/' . $zone->get_id() . '/locations' );
|
2016-06-15 22:23:10 +00:00
|
|
|
$request->add_header( 'Content-Type', 'application/json' );
|
2018-05-04 14:42:45 +00:00
|
|
|
$request->set_body(
|
|
|
|
json_encode(
|
|
|
|
array(
|
|
|
|
array(
|
|
|
|
'code' => 'UK',
|
|
|
|
'type' => 'country',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'code' => 'US', // test that locations missing "type" treated as country.
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'code' => 'SW1A0AA',
|
|
|
|
'type' => 'postcode',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'type' => 'continent', // test that locations missing "code" aren't saved
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2016-06-15 22:23:10 +00:00
|
|
|
$response = $this->server->dispatch( $request );
|
2018-05-04 14:42:45 +00:00
|
|
|
$data = $response->get_data();
|
2016-06-15 22:23:10 +00:00
|
|
|
|
2017-03-24 00:41:56 +00:00
|
|
|
$this->assertEquals( 3, count( $data ) );
|
2018-05-04 14:42:45 +00:00
|
|
|
$this->assertEquals(
|
2016-06-15 22:23:10 +00:00
|
|
|
array(
|
2018-05-04 14:42:45 +00:00
|
|
|
array(
|
|
|
|
'code' => 'UK',
|
|
|
|
'type' => 'country',
|
|
|
|
'_links' => array(
|
|
|
|
'collection' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/' . $zone->get_id() . '/locations' ),
|
|
|
|
),
|
2016-06-15 22:23:10 +00:00
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
'describes' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/' . $zone->get_id() ),
|
|
|
|
),
|
2016-06-15 22:23:10 +00:00
|
|
|
),
|
|
|
|
),
|
2017-03-24 11:35:54 +00:00
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
array(
|
|
|
|
'code' => 'US',
|
|
|
|
'type' => 'country',
|
|
|
|
'_links' => array(
|
|
|
|
'collection' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/' . $zone->get_id() . '/locations' ),
|
|
|
|
),
|
2017-03-24 11:35:54 +00:00
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
'describes' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/' . $zone->get_id() ),
|
|
|
|
),
|
2017-03-24 11:35:54 +00:00
|
|
|
),
|
|
|
|
),
|
2016-06-15 22:23:10 +00:00
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
array(
|
|
|
|
'code' => 'SW1A0AA',
|
|
|
|
'type' => 'postcode',
|
|
|
|
'_links' => array(
|
|
|
|
'collection' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/' . $zone->get_id() . '/locations' ),
|
|
|
|
),
|
2016-06-15 22:23:10 +00:00
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
'describes' => array(
|
|
|
|
array(
|
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/' . $zone->get_id() ),
|
|
|
|
),
|
2016-06-15 22:23:10 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
), $data
|
|
|
|
);
|
2016-06-15 22:23:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test updating Shipping Zone Locations with a bad zone ID.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-15 22:23:10 +00:00
|
|
|
*/
|
|
|
|
public function test_update_locations_invalid_id() {
|
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$response = $this->server->dispatch( new WP_REST_Request( 'PUT', '/wc/v2/shipping/zones/1/locations' ) );
|
2016-06-15 22:23:10 +00:00
|
|
|
|
|
|
|
$this->assertEquals( 404, $response->get_status() );
|
|
|
|
}
|
2016-06-17 23:03:59 +00:00
|
|
|
|
|
|
|
/**
|
2016-06-17 23:41:02 +00:00
|
|
|
* Test getting all Shipping Zone Methods and getting a single Shipping Zone Method.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-17 23:03:59 +00:00
|
|
|
*/
|
|
|
|
public function test_get_methods() {
|
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
|
|
|
|
// Create a shipping method and make sure it's in the response
|
|
|
|
$zone = $this->create_shipping_zone( 'Zone 1' );
|
|
|
|
$instance_id = $zone->add_shipping_method( 'flat_rate' );
|
|
|
|
$methods = $zone->get_shipping_methods();
|
|
|
|
$method = $methods[ $instance_id ];
|
|
|
|
|
2016-08-26 03:34:26 +00:00
|
|
|
$settings = array();
|
|
|
|
$method->init_instance_settings();
|
|
|
|
foreach ( $method->get_instance_form_fields() as $id => $field ) {
|
|
|
|
$data = array(
|
|
|
|
'id' => $id,
|
|
|
|
'label' => $field['title'],
|
|
|
|
'description' => ( empty( $field['description'] ) ? '' : $field['description'] ),
|
|
|
|
'type' => $field['type'],
|
|
|
|
'value' => $method->instance_settings[ $id ],
|
|
|
|
'default' => ( empty( $field['default'] ) ? '' : $field['default'] ),
|
|
|
|
'tip' => ( empty( $field['description'] ) ? '' : $field['description'] ),
|
|
|
|
'placeholder' => ( empty( $field['placeholder'] ) ? '' : $field['placeholder'] ),
|
|
|
|
);
|
|
|
|
if ( ! empty( $field['options'] ) ) {
|
|
|
|
$data['options'] = $field['options'];
|
|
|
|
}
|
|
|
|
$settings[ $id ] = $data;
|
|
|
|
}
|
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods' ) );
|
2016-06-17 23:41:02 +00:00
|
|
|
$data = $response->get_data();
|
|
|
|
$expected = array(
|
2017-05-02 23:37:03 +00:00
|
|
|
'id' => $instance_id,
|
2016-06-17 23:03:59 +00:00
|
|
|
'instance_id' => $instance_id,
|
|
|
|
'title' => $method->instance_settings['title'],
|
|
|
|
'order' => $method->method_order,
|
|
|
|
'enabled' => ( 'yes' === $method->enabled ),
|
|
|
|
'method_id' => $method->id,
|
|
|
|
'method_title' => $method->method_title,
|
|
|
|
'method_description' => $method->method_description,
|
2016-08-26 03:34:26 +00:00
|
|
|
'settings' => $settings,
|
2016-06-17 23:03:59 +00:00
|
|
|
'_links' => array(
|
|
|
|
'self' => array(
|
|
|
|
array(
|
2017-02-09 20:21:52 +00:00
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods/' . $instance_id ),
|
2016-06-17 23:03:59 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
'collection' => array(
|
|
|
|
array(
|
2017-02-09 20:21:52 +00:00
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods' ),
|
2016-06-17 23:03:59 +00:00
|
|
|
),
|
|
|
|
),
|
2018-05-04 14:42:45 +00:00
|
|
|
'describes' => array(
|
2016-06-17 23:03:59 +00:00
|
|
|
array(
|
2017-02-09 20:21:52 +00:00
|
|
|
'href' => rest_url( '/wc/v2/shipping/zones/' . $zone->get_id() ),
|
2016-06-17 23:03:59 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2016-06-17 23:41:02 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
$this->assertEquals( 200, $response->get_status() );
|
|
|
|
$this->assertEquals( count( $data ), 1 );
|
|
|
|
$this->assertContains( $expected, $data );
|
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods/' . $instance_id ) );
|
2016-06-17 23:41:02 +00:00
|
|
|
$data = $response->get_data();
|
|
|
|
|
|
|
|
$this->assertEquals( 200, $response->get_status() );
|
|
|
|
$this->assertEquals( $expected, $data );
|
2016-06-17 23:03:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test getting all Shipping Zone Methods with a bad zone ID.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-17 23:03:59 +00:00
|
|
|
*/
|
2016-06-17 23:41:02 +00:00
|
|
|
public function test_get_methods_invalid_zone_id() {
|
2016-06-17 23:03:59 +00:00
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/shipping/zones/1/methods' ) );
|
2016-06-17 23:03:59 +00:00
|
|
|
|
|
|
|
$this->assertEquals( 404, $response->get_status() );
|
2016-06-17 23:41:02 +00:00
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/shipping/zones/1/methods/1' ) );
|
2016-06-17 23:41:02 +00:00
|
|
|
|
|
|
|
$this->assertEquals( 404, $response->get_status() );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test getting a single Shipping Zone Method with a bad ID.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-06-17 23:41:02 +00:00
|
|
|
*/
|
|
|
|
public function test_get_methods_invalid_method_id() {
|
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
|
|
|
|
$zone = $this->create_shipping_zone( 'Zone 1' );
|
2017-02-09 20:21:52 +00:00
|
|
|
$response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods/1' ) );
|
2016-06-17 23:41:02 +00:00
|
|
|
|
|
|
|
$this->assertEquals( 404, $response->get_status() );
|
2016-06-17 23:03:59 +00:00
|
|
|
}
|
2016-08-26 03:34:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test updating a Shipping Zone Method.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-08-26 03:34:26 +00:00
|
|
|
*/
|
|
|
|
public function test_update_methods() {
|
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
|
|
|
|
$zone = $this->create_shipping_zone( 'Zone 1' );
|
|
|
|
$instance_id = $zone->add_shipping_method( 'flat_rate' );
|
|
|
|
$methods = $zone->get_shipping_methods();
|
|
|
|
$method = $methods[ $instance_id ];
|
|
|
|
|
|
|
|
// Test defaults
|
2018-05-04 14:42:45 +00:00
|
|
|
$request = new WP_REST_Request( 'GET', '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods/' . $instance_id );
|
2016-08-26 03:34:26 +00:00
|
|
|
$response = $this->server->dispatch( $request );
|
2018-05-04 14:42:45 +00:00
|
|
|
$data = $response->get_data();
|
2016-08-26 03:34:26 +00:00
|
|
|
|
|
|
|
$this->assertArrayHasKey( 'title', $data['settings'] );
|
2016-10-12 10:16:30 +00:00
|
|
|
$this->assertEquals( 'Flat rate', $data['settings']['title']['value'] );
|
2016-08-26 03:34:26 +00:00
|
|
|
$this->assertArrayHasKey( 'tax_status', $data['settings'] );
|
|
|
|
$this->assertEquals( 'taxable', $data['settings']['tax_status']['value'] );
|
|
|
|
$this->assertArrayHasKey( 'cost', $data['settings'] );
|
|
|
|
$this->assertEquals( '0', $data['settings']['cost']['value'] );
|
|
|
|
|
|
|
|
// Update a single value
|
2017-02-09 20:21:52 +00:00
|
|
|
$request = new WP_REST_Request( 'POST', '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods/' . $instance_id );
|
2018-05-04 14:42:45 +00:00
|
|
|
$request->set_body_params(
|
|
|
|
array(
|
|
|
|
'settings' => array(
|
|
|
|
'cost' => 5,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
2016-08-26 03:34:26 +00:00
|
|
|
$response = $this->server->dispatch( $request );
|
2018-05-04 14:42:45 +00:00
|
|
|
$data = $response->get_data();
|
2016-08-26 03:34:26 +00:00
|
|
|
|
|
|
|
$this->assertArrayHasKey( 'title', $data['settings'] );
|
2016-10-12 10:16:30 +00:00
|
|
|
$this->assertEquals( 'Flat rate', $data['settings']['title']['value'] );
|
2016-08-26 03:34:26 +00:00
|
|
|
$this->assertArrayHasKey( 'tax_status', $data['settings'] );
|
|
|
|
$this->assertEquals( 'taxable', $data['settings']['tax_status']['value'] );
|
|
|
|
$this->assertArrayHasKey( 'cost', $data['settings'] );
|
|
|
|
$this->assertEquals( '5', $data['settings']['cost']['value'] );
|
|
|
|
|
|
|
|
// Test multiple settings
|
2017-02-09 20:21:52 +00:00
|
|
|
$request = new WP_REST_Request( 'POST', '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods/' . $instance_id );
|
2018-05-04 14:42:45 +00:00
|
|
|
$request->set_body_params(
|
|
|
|
array(
|
|
|
|
'settings' => array(
|
|
|
|
'cost' => 10,
|
|
|
|
'tax_status' => 'none',
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
2016-08-26 03:34:26 +00:00
|
|
|
$response = $this->server->dispatch( $request );
|
2018-05-04 14:42:45 +00:00
|
|
|
$data = $response->get_data();
|
2016-08-26 03:34:26 +00:00
|
|
|
|
|
|
|
$this->assertArrayHasKey( 'title', $data['settings'] );
|
2016-10-12 10:16:30 +00:00
|
|
|
$this->assertEquals( 'Flat rate', $data['settings']['title']['value'] );
|
2016-08-26 03:34:26 +00:00
|
|
|
$this->assertArrayHasKey( 'tax_status', $data['settings'] );
|
|
|
|
$this->assertEquals( 'none', $data['settings']['tax_status']['value'] );
|
|
|
|
$this->assertArrayHasKey( 'cost', $data['settings'] );
|
|
|
|
$this->assertEquals( '10', $data['settings']['cost']['value'] );
|
|
|
|
|
2016-09-08 22:14:40 +00:00
|
|
|
// Test bogus
|
2017-02-09 20:21:52 +00:00
|
|
|
$request = new WP_REST_Request( 'POST', '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods/' . $instance_id );
|
2018-05-04 14:42:45 +00:00
|
|
|
$request->set_body_params(
|
|
|
|
array(
|
|
|
|
'settings' => array(
|
|
|
|
'cost' => 10,
|
|
|
|
'tax_status' => 'this_is_not_a_valid_option',
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
2016-09-08 22:14:40 +00:00
|
|
|
$response = $this->server->dispatch( $request );
|
|
|
|
$this->assertEquals( 400, $response->get_status() );
|
|
|
|
|
2016-08-26 03:34:26 +00:00
|
|
|
// Test other parameters
|
|
|
|
$this->assertTrue( $data['enabled'] );
|
|
|
|
$this->assertEquals( 1, $data['order'] );
|
|
|
|
|
2017-02-09 20:21:52 +00:00
|
|
|
$request = new WP_REST_Request( 'POST', '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods/' . $instance_id );
|
2018-05-04 14:42:45 +00:00
|
|
|
$request->set_body_params(
|
|
|
|
array(
|
|
|
|
'enabled' => false,
|
|
|
|
'order' => 2,
|
|
|
|
)
|
|
|
|
);
|
2016-08-26 03:34:26 +00:00
|
|
|
$response = $this->server->dispatch( $request );
|
2018-05-04 14:42:45 +00:00
|
|
|
$data = $response->get_data();
|
2016-08-26 03:34:26 +00:00
|
|
|
|
|
|
|
$this->assertFalse( $data['enabled'] );
|
|
|
|
$this->assertEquals( 2, $data['order'] );
|
|
|
|
$this->assertArrayHasKey( 'cost', $data['settings'] );
|
|
|
|
$this->assertEquals( '10', $data['settings']['cost']['value'] );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test creating a Shipping Zone Method.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-08-26 03:34:26 +00:00
|
|
|
*/
|
|
|
|
public function test_create_method() {
|
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
$zone = $this->create_shipping_zone( 'Zone 1' );
|
2017-02-09 20:21:52 +00:00
|
|
|
$request = new WP_REST_Request( 'POST', '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods' );
|
2018-05-04 14:42:45 +00:00
|
|
|
$request->set_body_params(
|
|
|
|
array(
|
|
|
|
'method_id' => 'flat_rate',
|
|
|
|
'enabled' => false,
|
|
|
|
'order' => 2,
|
|
|
|
)
|
|
|
|
);
|
2016-08-26 03:34:26 +00:00
|
|
|
$response = $this->server->dispatch( $request );
|
|
|
|
$data = $response->get_data();
|
|
|
|
|
|
|
|
$this->assertFalse( $data['enabled'] );
|
|
|
|
$this->assertEquals( 2, $data['order'] );
|
|
|
|
$this->assertArrayHasKey( 'cost', $data['settings'] );
|
|
|
|
$this->assertEquals( '0', $data['settings']['cost']['value'] );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test deleting a Shipping Zone Method.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @since 3.0.0
|
2016-08-26 03:34:26 +00:00
|
|
|
*/
|
|
|
|
public function test_delete_method() {
|
|
|
|
wp_set_current_user( $this->user );
|
|
|
|
$zone = $this->create_shipping_zone( 'Zone 1' );
|
|
|
|
$instance_id = $zone->add_shipping_method( 'flat_rate' );
|
|
|
|
$methods = $zone->get_shipping_methods();
|
|
|
|
$method = $methods[ $instance_id ];
|
2017-02-09 20:21:52 +00:00
|
|
|
$request = new WP_REST_Request( 'DELETE', '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods/' . $instance_id );
|
2016-08-26 03:34:26 +00:00
|
|
|
$request->set_param( 'force', true );
|
2018-05-04 14:42:45 +00:00
|
|
|
$response = $this->server->dispatch( $request );
|
2016-08-26 03:34:26 +00:00
|
|
|
$this->assertEquals( 200, $response->get_status() );
|
|
|
|
}
|
2016-07-26 18:42:57 +00:00
|
|
|
}
|