Skip to content

Commit

Permalink
Merge pull request #37 from linaori/feature/shipping-method-checkout-…
Browse files Browse the repository at this point in the history
…name

Added shipping_method_checkout_name to create parcel
  • Loading branch information
villermen authored Aug 13, 2024
2 parents 2bee10e + 7796205 commit 5b68de8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ public function createParcel(
?array $items = null,
?string $postNumber = null,
?ShippingMethod $shippingMethod = null,
?string $errors = null
?string $errors = null,
?string $shippingMethodCheckoutName = null,
): Parcel {
$parcelData = $this->createParcelData(
shippingAddress: $shippingAddress,
Expand All @@ -175,6 +176,7 @@ public function createParcel(
customsShipmentType: $customsShipmentType,
items: $items,
postNumber: $postNumber,
shippingMethodCheckoutName: $shippingMethodCheckoutName,
);

try {
Expand Down Expand Up @@ -563,7 +565,8 @@ protected function createParcelData(
?int $customsShipmentType = null,
?array $items = null,
?string $postNumber = null,
bool $applyShippingRules = false
bool $applyShippingRules = false,
?string $shippingMethodCheckoutName = null,
): array {
$parcelData = [];

Expand Down Expand Up @@ -657,6 +660,10 @@ protected function createParcelData(
$parcelData['apply_shipping_rules'] = true;
}

if ($shippingMethodCheckoutName) {
$parcelData['shipping_method_checkout_name'] = $shippingMethodCheckoutName;
}

// Additional fields are only added when requesting a label
if ($requestLabel) {
$parcelData['request_label'] = true;
Expand Down

0 comments on commit 5b68de8

Please sign in to comment.