Skip to content

Commit e65eef3

Browse files
author
Rik Morskate
committed
Added shipping prices endpoint
1 parent b82662c commit e65eef3

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/Contracts/SendcloudContract.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public function parcelStatuses(): array;
2424

2525
public function shippingMethods(array $optionalParameters = []): array;
2626

27+
public function getShippingProducts(string $fromCountry, string $toCountry, int $weight, string $weightUnit, array $optionalParameters = []): array;
28+
2729
public function shippingPrice(int $shippingMethodId, string $fromCountry, int $weight, string $weightUnit, array $optionalParameters = []): array;
2830

2931
public function download(string $url): string;

src/Sendcloud.php

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

68+
public function getShippingProducts(
69+
string $fromCountry,
70+
string $toCountry,
71+
int $weight,
72+
string $weightUnit,
73+
array $optionalParameters = []
74+
): array {
75+
$parameters = [
76+
'from_country' => $fromCountry,
77+
'to_country' => $toCountry,
78+
'weight' => $weight,
79+
'weight_unit' => $weightUnit,
80+
];
81+
82+
$parameters = array_merge($parameters, $optionalParameters);
83+
84+
return $this->request('get', 'shipping-products', $parameters);
85+
}
86+
6887
public function shippingPrice(
6988
int $shippingMethodId,
7089
string $fromCountry,

0 commit comments

Comments
 (0)