From 8e5c515b44bd7760e8e47e1b6f29c918ce05b435 Mon Sep 17 00:00:00 2001 From: akali22 Date: Sat, 14 Dec 2024 18:18:03 +0100 Subject: [PATCH 1/5] Update Client.php add more options to getShipping methods --- src/Client.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Client.php b/src/Client.php index 1e160cf..f687473 100644 --- a/src/Client.php +++ b/src/Client.php @@ -75,6 +75,9 @@ public function getUser(): User * @param SenderAddress|int|null $senderAddress The sender address to ship from. Methods available to all of your * account's sender addresses will be retrieved when null. * @param bool $returnMethodsOnly When true, methods for making a return are returned instead. + * @param int from_postal_code + * @param int to_postal_code + * @param int to_country iso2 code * @return ShippingMethod[] * @throws SendcloudClientException * @see https://sendcloud.dev/docs/shipping/shipping-methods/ @@ -82,7 +85,11 @@ public function getUser(): User public function getShippingMethods( ?int $servicePointId = null, SenderAddress|int|null $senderAddress = null, - bool $returnMethodsOnly = false + bool $returnMethodsOnly = false, + ?int $from_postal_code =null, + ?int $to_postal_code =null, + ?string $to_country =null, + ): array { try { $queryData = []; @@ -109,6 +116,18 @@ public function getShippingMethods( $queryData['is_return'] = 'true'; } + if ($from_postal_code) { + $queryData['from_postal_code'] = $from_postal_code; + } + + if ($to_postal_code) { + $queryData['to_postal_code'] = $to_postal_code; + } + + if ($to_country) { + $queryData['to_country'] = $to_country; + } + $response = $this->guzzleClient->get('shipping_methods', [ RequestOptions::QUERY => $queryData, ]); From 75e3359cd666ddbed0100e45893f5c384f276315 Mon Sep 17 00:00:00 2001 From: akali22 Date: Sat, 14 Dec 2024 18:53:40 +0100 Subject: [PATCH 2/5] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 397212c..fe0b12b 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "jouwweb/sendcloud", + "name": "akali22/sendcloud", "description": "Provides a client to interact with the Sendcloud API in an object-oriented way.", "keywords": [ "sendcloud", From 14c973451c6d48debb2b63d709b179c9662def93 Mon Sep 17 00:00:00 2001 From: akali22 Date: Sat, 14 Dec 2024 19:01:05 +0100 Subject: [PATCH 3/5] Update composer.json --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index fe0b12b..9a107e4 100644 --- a/composer.json +++ b/composer.json @@ -9,13 +9,13 @@ "parcel", "webhook" ], - "homepage": "https://github.com/Webador/sendcloud", + "homepage": "https://github.com/akali22/sendcloud", "type": "library", "license": "MIT", "authors": [ { - "name": "Webador", - "email": "tech@webador.com" + "name": "akali22", + "email": "" } ], "scripts": { From 8a2b4b9fa272e7cfc84ecc4fbaedeeeef50f2758 Mon Sep 17 00:00:00 2001 From: akali22 Date: Sat, 14 Dec 2024 19:18:11 +0100 Subject: [PATCH 4/5] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9a107e4..b70132e 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "authors": [ { "name": "akali22", - "email": "" + "email": "akali22@gmail.com" } ], "scripts": { From c86791792a00cbe4da0ac2ac4b6eaddc733a6734 Mon Sep 17 00:00:00 2001 From: akali22 Date: Sat, 14 Dec 2024 19:19:33 +0100 Subject: [PATCH 5/5] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3cf5bbe..dc99e80 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Sendcloud +e# Sendcloud This is a PHP library that provides a simple way to communicate with the Sendcloud API. It was created because there were no simple alternatives that follow good object-oriented code practices. @@ -109,4 +109,4 @@ try { ``` ## Installation -`composer require jouwweb/sendcloud` +`composer require akali22/sendcloud`