Skip to content

Commit

Permalink
Merge pull request #44 from WoutervanderLoopNL/fix-upload
Browse files Browse the repository at this point in the history
Fix Upload form. Refs: #43 #44
  • Loading branch information
casperbakker committed Jan 3, 2024
2 parents 45243ed + 780dc74 commit 2305bf1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
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

0 comments on commit 2305bf1

Please sign in to comment.