From b7568a421c323e52fc448e26037d073f74f5fbee Mon Sep 17 00:00:00 2001 From: Pedro Barros Date: Wed, 21 Oct 2020 16:26:57 -0300 Subject: [PATCH 01/13] primeiro documento de testes --- tests/Resources/Shipment/CalculatorTest.php | 45 +++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/Resources/Shipment/CalculatorTest.php diff --git a/tests/Resources/Shipment/CalculatorTest.php b/tests/Resources/Shipment/CalculatorTest.php new file mode 100644 index 0000000..f90433e --- /dev/null +++ b/tests/Resources/Shipment/CalculatorTest.php @@ -0,0 +1,45 @@ +createMock(Calculator::class); + $response->method('getPayload'); + + $clientStub = $this->createMock(ClientInterface::class); + + $clientStub->method('send')->willReturn($response); + + $resourceStub = $this->createMock(Resource::class); + $resourceStub->method('getHttp')->willReturn($clientStub); + + } + + /** + * @test + */ + public function is_invalid_calculate() + { + $clientStub = $this->createMock(ClientInterface::class); + $clientStub->method('send')->willReturn(function () { throw new \Exception; }); + + $resourceStub = $this->createMock(Resource::class); + $resourceStub->method('getHttp')->willReturn($clientStub); + } +} From 25a9bdf8eb4cf143b690d456b1a57b1f1f04f3e4 Mon Sep 17 00:00:00 2001 From: Pedro Barros Date: Thu, 22 Oct 2020 17:06:17 -0300 Subject: [PATCH 02/13] =?UTF-8?q?corre=C3=A7=C3=B5es=20no=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- tests/Resources/Shipment/CalculatorTest.php | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e9f09bf..1185bdf 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ $calculator->postalCode('01010010', '20271130'); #### Adicionando os produtos para cotação -Nesta parte, você define os produtos que servião para sua cotaçãom as informações que devem ser passadas como parâmetro são as seguintes: +Nesta parte, você irá definir os produtos que servirão para a sua cotação as informações que devem ser passadas como parâmetro são as seguintes: * Altura * Largura @@ -115,7 +115,7 @@ $calculator->addProducts( #### Adicionando os pacotes para cotação -Nesta parte, você define os pacotes que servirão para sua cotação, as informações que devem ser passadas como parâmetro são as seguintes: +Nesta parte, você irá definir os pacotes que servirão para sua cotação, as informações que devem ser passadas como parâmetro são as seguintes: * Altura * Largura diff --git a/tests/Resources/Shipment/CalculatorTest.php b/tests/Resources/Shipment/CalculatorTest.php index f90433e..0437546 100644 --- a/tests/Resources/Shipment/CalculatorTest.php +++ b/tests/Resources/Shipment/CalculatorTest.php @@ -9,7 +9,7 @@ class CalculatorTest extends TestCase { - public function setUp() + protected function setUp() { parent::setUp(); } @@ -23,7 +23,6 @@ public function is_valid_calculate() $response->method('getPayload'); $clientStub = $this->createMock(ClientInterface::class); - $clientStub->method('send')->willReturn($response); $resourceStub = $this->createMock(Resource::class); From e97f9ade2b965e7abe6ced4e4c478d5571c5c966 Mon Sep 17 00:00:00 2001 From: Pedro Barros Date: Tue, 27 Oct 2020 20:30:52 -0300 Subject: [PATCH 03/13] segundo documente de teste --- tests/Resources/Shipment/CalculatorTest.php | 1 - tests/Resources/Shipment/ProductTest.php | 48 +++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 tests/Resources/Shipment/ProductTest.php diff --git a/tests/Resources/Shipment/CalculatorTest.php b/tests/Resources/Shipment/CalculatorTest.php index 0437546..86dbd72 100644 --- a/tests/Resources/Shipment/CalculatorTest.php +++ b/tests/Resources/Shipment/CalculatorTest.php @@ -27,7 +27,6 @@ public function is_valid_calculate() $resourceStub = $this->createMock(Resource::class); $resourceStub->method('getHttp')->willReturn($clientStub); - } /** diff --git a/tests/Resources/Shipment/ProductTest.php b/tests/Resources/Shipment/ProductTest.php new file mode 100644 index 0000000..372f39b --- /dev/null +++ b/tests/Resources/Shipment/ProductTest.php @@ -0,0 +1,48 @@ +product = new Product(uniqid(), 40, 30, 50, 10.00, 100.0, 1); + } + + /** + * @test + */ + public function is_valid_quantity_of_product() + { + $quantity = $this->product->getQuantity(); + + $this->product->setQuantity($quantity); + + self::assertEquals(1, $quantity); + } + + /** + * @test + */ + public function is_invalid_quantity_of_product() + { + $this->expectException(InvalidArgumentException::class); + + $invalidProduct = new Product(uniqid(), 40, 30, 50, 10.00, 100.0, -2); + + $invalidQuantity = $invalidProduct->getQuantity(); + + $invalidProduct->setQuantity($invalidQuantity); + } + + +} From cf60a706ddf8fccc783be7afc2ae048cf2f806d1 Mon Sep 17 00:00:00 2001 From: Pedro Barros Date: Wed, 28 Oct 2020 17:27:09 -0300 Subject: [PATCH 04/13] =?UTF-8?q?terceiro=20documento=20de=20teste=20e=20c?= =?UTF-8?q?orre=C3=A7=C3=A3o=20no=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++++ tests/Enums/EndpointTest.php | 49 ++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 tests/Enums/EndpointTest.php diff --git a/README.md b/README.md index 1185bdf..a80b2b6 100644 --- a/README.md +++ b/README.md @@ -188,9 +188,17 @@ $quotations = $calculator->calculate(); ### Testes +Dentro do projeto você encontrará alguns documentos de teste baseados em testes unitários + + +Você pode usar na aplicação tanto o comando: ``` bash composer test ``` +Quanto o comando: +```bash +vendor/bin/phpunit tests +``` ### Changelog diff --git a/tests/Enums/EndpointTest.php b/tests/Enums/EndpointTest.php new file mode 100644 index 0000000..192cc2d --- /dev/null +++ b/tests/Enums/EndpointTest.php @@ -0,0 +1,49 @@ + 'Bar'], 'Hello'), + new RequestException('Communicating with server failed', new Request('POST', 'https://sandbox.melhorenvio.com.br')) + ]); + + $handlerStack = HandlerStack::create($mockHandler); + + $httpClient = new Client([ + 'handler' => $handlerStack + ]); + + $this->client = $httpClient; + } + + /** + * @test + */ + public function is_valid_endpoint_production() + { + $response = $this->client->post('https://sandbox.melhorenvio.com.br', array( + 'request.options' => array( + 'exceptions' => false + ) + )); + + $this->assertEquals(200, $response->getStatusCode()); + } +} From ef14b477d4fe459df36f9bab12b3fb4f1a5e99a9 Mon Sep 17 00:00:00 2001 From: Pedro Barros Date: Mon, 16 Nov 2020 15:32:17 -0300 Subject: [PATCH 05/13] resolvendo problemas nos testes do calculate --- tests/Enums/EndpointTest.php | 8 +++- tests/Resources/Shipment/CalculatorTest.php | 51 ++++++++++++++++++--- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/tests/Enums/EndpointTest.php b/tests/Enums/EndpointTest.php index 192cc2d..aada614 100644 --- a/tests/Enums/EndpointTest.php +++ b/tests/Enums/EndpointTest.php @@ -10,6 +10,10 @@ use GuzzleHttp\Psr7\Response; use PHPUnit\Framework\TestCase; + +/** + * This test is a example for consult + */ class EndpointTest extends TestCase { /** @@ -20,7 +24,7 @@ class EndpointTest extends TestCase protected function setUp() { $mockHandler = new MockHandler([ - new Response(200, ['Foo' => 'Bar'], 'Hello'), + new Response(200, ['Foo' => 'Bar'], 'ResponseContext'), new RequestException('Communicating with server failed', new Request('POST', 'https://sandbox.melhorenvio.com.br')) ]); @@ -36,7 +40,7 @@ protected function setUp() /** * @test */ - public function is_valid_endpoint_production() + public function is_valid_endpoint_sandbox() { $response = $this->client->post('https://sandbox.melhorenvio.com.br', array( 'request.options' => array( diff --git a/tests/Resources/Shipment/CalculatorTest.php b/tests/Resources/Shipment/CalculatorTest.php index 86dbd72..3480221 100644 --- a/tests/Resources/Shipment/CalculatorTest.php +++ b/tests/Resources/Shipment/CalculatorTest.php @@ -2,16 +2,40 @@ namespace MelhorEnvio\Tests\Resources\Shipment; -use GuzzleHttp\ClientInterface; +use GuzzleHttp\Client; +use GuzzleHttp\Exception\InvalidArgumentException; +use GuzzleHttp\Handler\MockHandler; +use GuzzleHttp\HandlerStack; +use GuzzleHttp\Psr7\Response; +use MelhorEnvio\Exceptions\InvalidCalculatorPayloadException; use MelhorEnvio\Resources\Resource; use MelhorEnvio\Resources\Shipment\Calculator; +use MelhorEnvio\Resources\Shipment\Product; use PHPUnit\Framework\TestCase; class CalculatorTest extends TestCase { + /** + * @var Client + */ + protected $client; + protected function setUp() { parent::setUp(); + + $mock = new MockHandler([ + new Response(200, ['payload'], '[{"id":1,"name":"PAC","price":"27.48","custom_price":"27.48","discount":"0.00","currency":"R$","delivery_time":10,"delivery_range":{"min":9,"max":10},"custom_delivery_time":10,"custom_delivery_range":{"min":9,"max":10},"packages":[{"price":"27.48","discount":"0.00","format":"box","dimensions":{"height":6,"width":11,"length":18},"weight":"0.40","insurance_value":"0.00"}],"additional_services":{"receipt":false,"own_hand":true,"collect":false},"company":{"id":1,"name":"Correios","picture":"https:\/\/logistic.melhorenvio.work\/images\/shipping-companies\/correios.png"}}]'), + new Response(200, ['payload'], '[{"id":1,"name":"PAC","price":"27.48","custom_price":"27.48","discount":"0.00","currency":"R$","delivery_time":10,"delivery_range":{"min":9,"max":10},"custom_delivery_time":10,"custom_delivery_range":{"min":9,"max":10},"packages":[{"price":"27.48","discount":"0.00","format":"box","dimensions":{"height":6,"width":11,"length":18},"weight":"0.40","insurance_value":"0.00"}],"additional_services":{"receipt":false,"own_hand":true,"collect":false},"company":{"id":1,"name":"Correios","picture":"https:\/\/logistic.melhorenvio.work\/images\/shipping-companies\/correios.png"}}]'), + ]); + + $handlerStack = HandlerStack::create($mock); + + $httpClient = new Client([ + 'handler' => $handlerStack + ]); + + $this->client = $httpClient; } /** @@ -19,14 +43,21 @@ protected function setUp() */ public function is_valid_calculate() { - $response = $this->createMock(Calculator::class); - $response->method('getPayload'); - $clientStub = $this->createMock(ClientInterface::class); - $clientStub->method('send')->willReturn($response); + $response = $this->client->request('POST', 'me/shipment/calculate'); $resourceStub = $this->createMock(Resource::class); - $resourceStub->method('getHttp')->willReturn($clientStub); + $resourceStub->method('getHttp')->willReturn($this->client); + + $calculator = new Calculator($resourceStub); + + $calculator->postalCode('96010760', '08226021'); + + $calculator->addProduct(new Product(uniqid(), 40, 30, 50, 10.00, 100.0, 1)); + + $quotation = $calculator->calculate(); + + $this->assertEquals(json_encode($quotation), $response->getBody()); } /** @@ -34,10 +65,16 @@ public function is_valid_calculate() */ public function is_invalid_calculate() { - $clientStub = $this->createMock(ClientInterface::class); + $clientStub = $this->createMock(Client::class); $clientStub->method('send')->willReturn(function () { throw new \Exception; }); $resourceStub = $this->createMock(Resource::class); $resourceStub->method('getHttp')->willReturn($clientStub); + + $calculator = new Calculator($resourceStub); + + $this->expectException(InvalidCalculatorPayloadException::class); + + $calculator->calculate(); } } From 73cecc6045a7565de920bf1e6ebe869eccfd9ef4 Mon Sep 17 00:00:00 2001 From: Pedro Barros Date: Thu, 3 Dec 2020 13:34:33 -0300 Subject: [PATCH 06/13] =?UTF-8?q?mudan=C3=A7as=20nos=20nomes=20das=20fun?= =?UTF-8?q?=C3=A7=C3=B5es=20para=20padr=C3=A3o=20camelCase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/Enums/EndpointTest.php | 2 +- tests/EnvironmentTest.php | 4 ++-- tests/Resources/Shipment/CalculatorTest.php | 4 ++-- tests/Resources/Shipment/ProductTest.php | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/Enums/EndpointTest.php b/tests/Enums/EndpointTest.php index aada614..1aed683 100644 --- a/tests/Enums/EndpointTest.php +++ b/tests/Enums/EndpointTest.php @@ -40,7 +40,7 @@ protected function setUp() /** * @test */ - public function is_valid_endpoint_sandbox() + public function isValidEndpointSandbox() { $response = $this->client->post('https://sandbox.melhorenvio.com.br', array( 'request.options' => array( diff --git a/tests/EnvironmentTest.php b/tests/EnvironmentTest.php index 637c28e..bbad795 100644 --- a/tests/EnvironmentTest.php +++ b/tests/EnvironmentTest.php @@ -15,7 +15,7 @@ class EnvironmentTest extends TestCase const TOKEN = 'token-testing'; /** @test */ - public function is_invalid_environment() + public function isInvalidEnvironment() { $this->expectException(InvalidEnvironmentException::class); @@ -23,7 +23,7 @@ public function is_invalid_environment() } /** @test */ - public function is_valid_environment() + public function isValidEnvironment() { foreach (Environment::ENVIRONMENTS as $environment) { $shipment = new Shipment(self::TOKEN, $environment); diff --git a/tests/Resources/Shipment/CalculatorTest.php b/tests/Resources/Shipment/CalculatorTest.php index 3480221..b4e3560 100644 --- a/tests/Resources/Shipment/CalculatorTest.php +++ b/tests/Resources/Shipment/CalculatorTest.php @@ -41,7 +41,7 @@ protected function setUp() /** * @test */ - public function is_valid_calculate() + public function isValidCalculate() { $response = $this->client->request('POST', 'me/shipment/calculate'); @@ -63,7 +63,7 @@ public function is_valid_calculate() /** * @test */ - public function is_invalid_calculate() + public function isInvalidCalculate() { $clientStub = $this->createMock(Client::class); $clientStub->method('send')->willReturn(function () { throw new \Exception; }); diff --git a/tests/Resources/Shipment/ProductTest.php b/tests/Resources/Shipment/ProductTest.php index 372f39b..05b815e 100644 --- a/tests/Resources/Shipment/ProductTest.php +++ b/tests/Resources/Shipment/ProductTest.php @@ -21,7 +21,7 @@ protected function setUp() /** * @test */ - public function is_valid_quantity_of_product() + public function isValidQuantityOfProducts() { $quantity = $this->product->getQuantity(); @@ -33,7 +33,7 @@ public function is_valid_quantity_of_product() /** * @test */ - public function is_invalid_quantity_of_product() + public function isInvalidQuantityOfProducts() { $this->expectException(InvalidArgumentException::class); From 594e73b05e9be88d88b867666bd72d0e854bcc1e Mon Sep 17 00:00:00 2001 From: Pedro Barros Date: Thu, 17 Dec 2020 10:46:21 -0300 Subject: [PATCH 07/13] =?UTF-8?q?adi=C3=A7=C3=A3o=20de=20servi=C3=A7os=20d?= =?UTF-8?q?ispon=C3=ADveis=20no=20Readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++++-- src/Enums/Service.php | 6 ------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a80b2b6..f93dbcd 100644 --- a/README.md +++ b/README.md @@ -145,15 +145,19 @@ Se você desejar customizar, nesta parte serão escolhidos os serviços das tran * Correios * Jadlog * Via Brasil -* Azul Cargo +* Azul Cargo +* Latam Cargo ```php $calculator->addServices( Service::CORREIOS_PAC, Service::CORREIOS_SEDEX, + Service::CORREIOS_MINI, Service::JADLOG_PACKAGE, Service::JADLOG_COM, - Service::AZULCARGO_AMANHA + Service::AZULCARGO_AMANHA, + Service::AZULCARGO_ECOMMERCE, + Service::LATAMCARGO_JUNTOS ); ``` diff --git a/src/Enums/Service.php b/src/Enums/Service.php index 406f175..751237f 100644 --- a/src/Enums/Service.php +++ b/src/Enums/Service.php @@ -20,12 +20,6 @@ class Service const JADLOG_PACKAGE = 3; const JADLOG_COM = 4; - /** - * Services - JAMEF - * @var int - */ - const JAMEF_RODOVIARIO = 7; - /** * Services - VIABRASIL * @var int From 773b76530badaa734d611659e598f54c307175ab Mon Sep 17 00:00:00 2001 From: Pedro Barros Date: Thu, 17 Dec 2020 11:25:39 -0300 Subject: [PATCH 08/13] =?UTF-8?q?adi=C3=A7=C3=A3o=20no=20Readme=20do=20exe?= =?UTF-8?q?mplo=20de=20uso=20de=20todas=20os=20servi=C3=A7os.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f93dbcd..c2987e4 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,8 @@ $calculator->addServices( Service::JADLOG_COM, Service::AZULCARGO_AMANHA, Service::AZULCARGO_ECOMMERCE, - Service::LATAMCARGO_JUNTOS + Service::LATAMCARGO_JUNTOS, + Service::VIABRASIL_RODOVIARIO ); ``` From 6878a5fa4cdaef487c8361626c00a93ef8656764 Mon Sep 17 00:00:00 2001 From: Pedro Barros Date: Mon, 21 Dec 2020 17:15:45 -0300 Subject: [PATCH 09/13] =?UTF-8?q?corre=C3=A7=C3=A3o=20no=20composer=20json?= =?UTF-8?q?=20para=20publica=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 8219f93..6d9eb7e 100644 --- a/composer.json +++ b/composer.json @@ -5,14 +5,13 @@ "melhorenvio", "shipment-sdk-php" ], - "homepage": "https://github.com/melhorenvio/shipment-sdk", + "homepage": "https://github.com/melhorenvio/shipment-sdk-php", "license": "MIT", "type": "library", "authors": [ { - "name": "Rodrigo Silveira", - "email": "rodrigo.silveira@melhorenvio.com", - "role": "Developer" + "name": "Melhor Envio", + "email": "tecnologia@melhorenvio.com" } ], "require": { From 8f7c9c84922c72618e616620dddba40647579562 Mon Sep 17 00:00:00 2001 From: Pedro Barros Date: Mon, 21 Dec 2020 17:22:47 -0300 Subject: [PATCH 10/13] =?UTF-8?q?corre=C3=A7=C3=A3o=20no=20composer.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6d9eb7e..2092da0 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "shipment-sdk-php" ], "homepage": "https://github.com/melhorenvio/shipment-sdk-php", - "license": "MIT", + "license": "Melhor Envio", "type": "library", "authors": [ { From aed38a77e734c9623bf814c47b84943d46ed68e8 Mon Sep 17 00:00:00 2001 From: Pedro Barros Date: Tue, 22 Dec 2020 09:11:30 -0300 Subject: [PATCH 11/13] ajuste no readme --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c2987e4..33350db 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Shipment SDK - Serviço de cotações do Melhor Envio -[![Latest Version on Packagist](https://img.shields.io/packagist/v/melhorenvio/shipment-sdk.svg?style=flat-square)](https://packagist.org/packages/melhorenvio/shipment-sdk) -[![Build Status](https://img.shields.io/travis/melhorenvio/shipment-sdk/master.svg?style=flat-square)](https://travis-ci.org/melhorenvio/shipment-sdk) -[![Quality Score](https://img.shields.io/scrutinizer/g/melhorenvio/shipment-sdk.svg?style=flat-square)](https://scrutinizer-ci.com/g/melhorenvio/shipment-sdk) -[![Total Downloads](https://img.shields.io/packagist/dt/melhorenvio/shipment-sdk.svg?style=flat-square)](https://packagist.org/packages/melhorenvio/shipment-sdk) +[![Latest Version on Packagist](https://img.shields.io/packagist/v/melhorenvio/shipment-sdk-php.svg?style=flat-square)](https://packagist.org/packages/melhorenvio/shipment-sdk-php) +[![Build Status](https://img.shields.io/travis/melhorenvio/shipment-sdk-php/master.svg?style=flat-square)](https://travis-ci.org/melhorenvio/shipment-sdk-php) +[![Quality Score](https://img.shields.io/scrutinizer/g/melhorenvio/shipment-sdk-php.svg?style=flat-square)](https://scrutinizer-ci.com/g/melhorenvio/shipment-sdk-php) +[![Total Downloads](https://img.shields.io/packagist/dt/melhorenvio/shipment-sdk-php.svg?style=flat-square)](https://packagist.org/packages/melhorenvio/shipment-sdk-php) Agora ficou mais fácil ter o serviço de cotações do Melhor Envio no seu projeto de e-commerce. From 8127a01a1088d23fbaeafc1fa302bcaf5186cbe9 Mon Sep 17 00:00:00 2001 From: Pedro Barros Date: Tue, 22 Dec 2020 09:32:02 -0300 Subject: [PATCH 12/13] ajuste composer.json --- composer.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 2092da0..939551f 100644 --- a/composer.json +++ b/composer.json @@ -6,12 +6,13 @@ "shipment-sdk-php" ], "homepage": "https://github.com/melhorenvio/shipment-sdk-php", - "license": "Melhor Envio", + "license": "MIT", "type": "library", "authors": [ { "name": "Melhor Envio", - "email": "tecnologia@melhorenvio.com" + "email": "tecnologia@melhorenvio.com", + "role": "Developer" } ], "require": { From 7a57e0804eb1e02f804007b2d0c1a41eccd77391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=A7al=20Pizzi?= Date: Wed, 7 Jul 2021 15:30:50 -0300 Subject: [PATCH 13/13] fix:modifing the payload format for the calculate request --- src/Resources/Shipment/Calculator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resources/Shipment/Calculator.php b/src/Resources/Shipment/Calculator.php index 27c3444..79fff3b 100644 --- a/src/Resources/Shipment/Calculator.php +++ b/src/Resources/Shipment/Calculator.php @@ -276,7 +276,7 @@ public function calculate() try { $response = $this->resource->getHttp()->post('me/shipment/calculate', [ - 'form_params' => $this->payload, + 'json' => $this->payload, ]); return json_decode((string) $response->getBody(), true);