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

Fix Upload form. Refs: #43 #44 #44

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -1577,17 +1577,24 @@ public function getInvoiceRequests(?string $shipmentId = null, ?int $page = 1, ?
/**
* Uploads an invoice associated with shipment id.
* @param string $shipmentId The id of the shipment associated with the invoice.
* @param string $invoice
* @return Model\ProcessStatus|null
* @throws Exception\ConnectException when an error occurred in the HTTP connection.
* @throws Exception\ResponseException when an unexpected response was received.
* @throws Exception\UnauthorizedException when the request was unauthorized.
* @throws Exception\RateLimitException when the throttling limit has been reached for the API user.
* @throws Exception\Exception when something unexpected went wrong.
*/
public function uploadInvoice(string $shipmentId): ?Model\ProcessStatus
public function uploadInvoice(string $shipmentId, string $invoice): ?Model\ProcessStatus
{
$url = "retailer/shipments/invoices/{$shipmentId}";
$options = [
'multipart' => [
[
'name' => 'invoice',
'contents' => \GuzzleHttp\Psr7\Utils::tryFopen($invoice, 'r'),
],
],
'produces' => 'application/vnd.retailer.v10+json',
'consumes' => 'application/json',
];
Expand Down
2 changes: 1 addition & 1 deletion src/OpenApi/ClientGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ protected function extractArguments(array $methodDefinition): array
}

$argsWithoutDefault[] = $argument;
} elseif (array_key_first($methodDefinition['requestBody']['content']) == 'multipart/form-data') {
} else {
foreach ($requestBody['schema']['properties'] as $propName => $property) {
$argument = [
'default' => null,
Expand Down
Loading