Skip to content

Commit

Permalink
post request fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Marnier Vivien committed May 27, 2022
1 parent 0c7f367 commit 4fb1655
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/Service/ModeloClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function createContract(string $modelName, bool $isDocType = false, strin
throw new ModelNotFound($type.' was not found with specific '.$modelName.' name.');
}

return $this->createContractByModelId($modelId, $outputPdf, $xml);
return $this->createContractByModelId($modelId, null, $outputPdf, $xml);
}

/**
Expand Down Expand Up @@ -264,14 +264,17 @@ public function createContractByModelId(string $modelId, string $contractId = nu


$response = $this->client->request('POST', $uri, [
'query' => array_merge($this->getGenericParams(), [
'headers' => [
'Content-Type: application/xml',
'Accept: application/xml',
],
'query' => [
self::AUTHKEY_PARAM_KEY => $this->getAuthKey(),
$keyName => $modelId,
self::OUTPUT_PARAM_KEY => $outputValue,
self::CONTRACT_ID_KEY => $contractId,
]),
'body' => [
'xml' => $xml,
],
'body' => $xml,
]);

if (Response::HTTP_OK !== $response->getStatusCode()) {
Expand Down Expand Up @@ -302,13 +305,16 @@ public function updateContractById(string $contractId, string $xml = null, bool
$outputValue = $outputPdf ? 'pdf' : null;

$response = $this->client->request('PUT', self::CONTRACT_URI, [
'query' => array_merge($this->getGenericParams(), [
'_id' => $contractId,
'headers' => [
'Content-Type: application/xml',
'Accept: application/xml',
],
'query' => [
self::AUTHKEY_PARAM_KEY => $this->getAuthKey(),
self::OUTPUT_PARAM_KEY => $outputValue,
]),
'body' => [
'xml' => $xml,
self::CONTRACT_ID_KEY => $contractId,
],
'body' => $xml,
]);

if (Response::HTTP_OK !== $response->getStatusCode()) {
Expand Down

0 comments on commit 4fb1655

Please sign in to comment.