public function testDocsExample() { $api = ClientTest::getInstance(); $res = $api->getSalesTax()->where(array(\TaxJar\Api\Common\Fields::AMOUNT => "10.00", \TaxJar\Api\Common\Fields::SHIPPING => "2.00", \TaxJar\Api\Common\Fields::FROM_CITY => "Ramsey", \TaxJar\Api\Common\Fields::FROM_STATE => "NJ", \TaxJar\Api\Common\Fields::FROM_ZIP => "07446", \TaxJar\Api\Common\Fields::FROM_COUNTRY => "US", \TaxJar\Api\Common\Fields::TO_CITY => "Freehold", \TaxJar\Api\Common\Fields::TO_STATE => "NJ", \TaxJar\Api\Common\Fields::TO_ZIP => "07728", \TaxJar\Api\Common\Fields::TO_COUNTRY => "US"))->execute(); $this->assertNotEmpty($res); $this->assertInstanceOf("TaxJar\\Api\\Response", $res); $this->assertEquals(\TaxJar\Api\Response::HTTP_OK, $res->status); $this->assertNotEmpty($res->data); $this->assertArrayHasKey('amount_to_collect', $res->data); $this->assertArrayHasKey('rate', $res->data); $this->assertArrayHasKey('has_nexus', $res->data); $this->assertArrayHasKey('freight_taxable', $res->data); $this->assertArrayHasKey('tax_source', $res->data); }
public function testZipCityCountryCanada() { $api = ClientTest::getInstance(); $res = $api->getTaxRate("N8W1Y3", "ON", "CA")->execute(); $this->assertNotEmpty($res); $this->assertInstanceOf("TaxJar\\Api\\Response", $res); $this->assertEquals(\TaxJar\Api\Response::HTTP_OK, $res->status); $this->assertNotEmpty($res->data); $this->assertArrayHasKey('location', $res->data); $this->assertNotEmpty($res->data); $this->assertArrayHasKey('combined_rate', $res->data['location']); $this->assertEquals('Windsor', $res->data['location']['city']); $this->assertGreaterThan(0, $res->data['location']['combined_rate']); }