Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Actually send the colli meta to the rates endpoint #227

Merged
merged 8 commits into from
Dec 9, 2024
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
Loading