Skip to content

Commit

Permalink
Merge pull request #227 from MyParcelCOM/bugfix/send-colli-meta
Browse files Browse the repository at this point in the history
πŸ› Actually send the colli meta to the rates endpoint
  • Loading branch information
M4tini authored Dec 9, 2024
2 parents 4361a0e + 312cdfa commit 0f12215
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/MyParcelComApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,17 @@ public function resolveDynamicServiceRates(
];
}

$response = $this->doRequest('/get-dynamic-service-rates', 'post', ['data' => $data], [
$body = array_filter([
'data' => $data,
'meta' => array_filter([
'colli' => array_map(
fn (ShipmentInterface $collo) => $collo->jsonSerialize()['attributes'] ?? null,
$shipmentData?->getColli() ?? [],
),
]),
]);

$response = $this->doRequest('/get-dynamic-service-rates', 'post', $body, [
AuthenticatorInterface::HEADER_ACCEPT => AuthenticatorInterface::MIME_TYPE_JSON,
]);
$json = json_decode((string) $response->getBody(), true);
Expand Down

0 comments on commit 0f12215

Please sign in to comment.