Skip to content

Commit 3ef8db3

Browse files
author
Rik Morskate
committed
Added method to retrieve shipping price
1 parent fb39901 commit 3ef8db3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/Sendcloud.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,25 @@ public function shippingMethods(array $optionalParameters = []): array
5656
return $this->request('get', self::SHIPPING_METHODS_ENDPOINT, $optionalParameters);
5757
}
5858

59+
public function shippingPrice(
60+
int $shipingMethodId,
61+
string $fromCountry,
62+
int $weight,
63+
string $weightUnit,
64+
array $optionalParameters = []
65+
): array {
66+
$parameters = [
67+
'shipping_method_id' => $shipingMethodId,
68+
'from_country' => $fromCountry,
69+
'weight' => $weight,
70+
'weight_unit' => $weightUnit,
71+
];
72+
73+
$parameters = array_merge($parameters, $optionalParameters);
74+
75+
return $this->request('get', 'shipping-price', $parameters);
76+
}
77+
5978
public function download(string $url): string
6079
{
6180
$response = Http::withBasicAuth(config('sendcloud.key'), config('sendcloud.secret'))

0 commit comments

Comments
 (0)