Skip to content

Commit

Permalink
Merge pull request #39 from Webador/total-order-value
Browse files Browse the repository at this point in the history
total-order-value
  • Loading branch information
villermen authored Aug 13, 2024
2 parents 5b68de8 + a6bdbda commit d0a80ed
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ public function createParcel(
?ShippingMethod $shippingMethod = null,
?string $errors = null,
?string $shippingMethodCheckoutName = null,
?string $totalOrderValue = null,
?string $totalOrderValueCurrency = null,
): Parcel {
$parcelData = $this->createParcelData(
shippingAddress: $shippingAddress,
Expand All @@ -177,6 +179,8 @@ public function createParcel(
items: $items,
postNumber: $postNumber,
shippingMethodCheckoutName: $shippingMethodCheckoutName,
totalOrderValue: $totalOrderValue,
totalOrderValueCurrency: $totalOrderValueCurrency,
);

try {
Expand Down Expand Up @@ -567,6 +571,8 @@ protected function createParcelData(
?string $postNumber = null,
bool $applyShippingRules = false,
?string $shippingMethodCheckoutName = null,
?string $totalOrderValue = null,
?string $totalOrderValueCurrency = null,
): array {
$parcelData = [];

Expand Down Expand Up @@ -664,6 +670,11 @@ protected function createParcelData(
$parcelData['shipping_method_checkout_name'] = $shippingMethodCheckoutName;
}

if ($totalOrderValue && $totalOrderValueCurrency) {
$parcelData['total_order_value'] = $totalOrderValue;
$parcelData['total_order_value_currency'] = $totalOrderValueCurrency;
}

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

0 comments on commit d0a80ed

Please sign in to comment.