Skip to content
Snippets Groups Projects
Commit 3e28fd05 authored by Arnaud Pauget's avatar Arnaud Pauget
Browse files

fix package building before sending to Maarch RM

parent 7a190a16
Branches fix/seda2_transferSource
No related tags found
1 merge request!1Changement du type d'exception levé pour éviter le blocage du workflow dans...
......@@ -55,10 +55,10 @@ class MaarchREST extends SAEConnecteur {
$curlWrapper = $this->curlWrapperFactory->getInstance();
$bodyPackage = $this->createPackageSource($seda_message_path, $attachments_path);
$curlWrapper->setJsonPostData($bodyPackage);
return $this->getWS('/transfer/source', "application/json", $curlWrapper);
return $this->getWS('/medona/archiveTransfer/source', "application/json", $curlWrapper);
}
public function createPackageSource($seda_message_path, $attachments_path) {
......@@ -82,12 +82,14 @@ class MaarchREST extends SAEConnecteur {
}
$sourcePackage = [];
$package = new stdClass();
$package->connector = "seda2zip";
$package->params = [];
$package->params['manifest'] = "bordereau.xml";
$package->package = base64_encode(file_get_contents($zipFilePath));
$sourcePackage[] = $package;
$package = base64_encode(file_get_contents($zipFilePath));
$sourcePackage['package'] = new stdClass();
$sourcePackage['package']->data = $package;
$sourcePackage['package']->encoding = "base64";
$sourcePackage['params'] = [];
$sourcePackage['params']['manifest'] = "bordereau.xml";
$sourcePackage['connector'] = "seda2zip";
unset($zipFilePath);
......@@ -162,16 +164,12 @@ class MaarchREST extends SAEConnecteur {
// array_push($bodyPackage['attachments'], $attachment);
// }
// }
// var_dump($bodyPackage); exit;
// Chemin de base où les fichiers et dossiers sont stockés
$baseDirectory = $tmpFolder . "/tmpFiles";
$this->addFilesFromDirectory($baseDirectory, $bodyPackage);
// var_dump($bodyPackage); exit;
rmdir($tmpFolder."/tmpFiles");
return $bodyPackage;
......@@ -206,7 +204,7 @@ class MaarchREST extends SAEConnecteur {
* @throws Exception
*/
public function getAcuseReception($id_transfert) {
return $this->getAck($id_transfert, $this->originatingAgency);
return $this->getAck($id_transfert, "test");
}
/**
......@@ -360,6 +358,7 @@ class MaarchREST extends SAEConnecteur {
$curlWrapper->dontVerifySSLCACert();
$result = $curlWrapper->get($this->url.$url);
if (! $result){
throw new Exception($curlWrapper->getLastError());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment