diff --git a/VERSION.txt b/VERSION.txt index 44e4813bf4..576f92a4fe 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.10.9 \ No newline at end of file +5.10.10 \ No newline at end of file diff --git a/app/Services/EDocument/Gateway/Storecove/Storecove.php b/app/Services/EDocument/Gateway/Storecove/Storecove.php index fa84fbd615..5527b4482f 100644 --- a/app/Services/EDocument/Gateway/Storecove/Storecove.php +++ b/app/Services/EDocument/Gateway/Storecove/Storecove.php @@ -113,9 +113,9 @@ class Storecove { ], "document"=> [ 'documentType' => 'invoice', - 'rawDocumentData' => ['document' => base64_encode($document)], - 'parse' => true, - 'parseStrategy', 'ubl' + 'rawDocumentData' => ['document' => base64_encode($document), 'parse' => true, 'parseStrategy', 'ubl'], + // + // ' ], ]; @@ -258,6 +258,29 @@ class Storecove { } + + + public function addIdentifier(int $legal_entity_id, string $identifier, string $scheme) + { + $uri = "legal_entities/{$legal_entity_id}/peppol_identifiers"; + + $data = [ + "identifier" => $identifier, + "scheme" => $scheme, + "superscheme" => "iso6523-actorid-upis", + ]; + + $r = $this->httpClient($uri, (HttpVerb::POST)->value, $data); + + if($r->successful()) { + return $r->json(); + } + + return $r; + + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private function getHeaders(array $headers = []) { @@ -271,7 +294,7 @@ class Storecove { private function httpClient(string $uri, string $verb, array $data, ?array $headers = []) { -nlog("{$this->base_url}{$uri}"); + $r = Http::withToken(config('ninja.storecove_api_key')) ->withHeaders($this->getHeaders($headers)) ->{$verb}("{$this->base_url}{$uri}", $data); diff --git a/config/ninja.php b/config/ninja.php index 7680a6d74e..615673bec9 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -17,8 +17,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => env('APP_VERSION', '5.10.9'), - 'app_tag' => env('APP_TAG', '5.10.9'), + 'app_version' => env('APP_VERSION', '5.10.10'), + 'app_tag' => env('APP_TAG', '5.10.10'), 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', false), diff --git a/tests/Integration/Einvoice/Storecove/StorecoveTest.php b/tests/Integration/Einvoice/Storecove/StorecoveTest.php index d78c1ed5a4..df05079470 100644 --- a/tests/Integration/Einvoice/Storecove/StorecoveTest.php +++ b/tests/Integration/Einvoice/Storecove/StorecoveTest.php @@ -60,6 +60,18 @@ class StorecoveTest extends TestCase } + public function tesXAddPeppolIdentifier() + { + + $sc = new \App\Services\EDocument\Gateway\Storecove\Storecove(); + $r = $sc->addIdentifier(290868, "DE923356489", "DE:VAT"); + + // nlog($r->body()); + // $this->assertIsArray($r); + nlog($r); + + } + // public function testUpdateLegalEntity() // { // $data = [ @@ -86,8 +98,6 @@ class StorecoveTest extends TestCase $this->assertIsArray($r); - nlog($r); - } public function testSendDocument()