From 90c700a81aa1a9fc5bf28526d8de5971b70c87c7 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 16 Jul 2024 08:31:56 +1000 Subject: [PATCH] v5.10.9 --- VERSION.txt | 2 +- .../Requests/Company/UpdateCompanyRequest.php | 2 +- .../EDocument/Gateway/Storecove/Storecove.php | 29 +++++++++++++------ config/ninja.php | 4 +-- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index e5cce47b3049..44e4813bf4a8 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.10.8 \ No newline at end of file +5.10.9 \ No newline at end of file diff --git a/app/Http/Requests/Company/UpdateCompanyRequest.php b/app/Http/Requests/Company/UpdateCompanyRequest.php index c48ee397ee0e..c51419393171 100644 --- a/app/Http/Requests/Company/UpdateCompanyRequest.php +++ b/app/Http/Requests/Company/UpdateCompanyRequest.php @@ -65,7 +65,7 @@ class UpdateCompanyRequest extends Request $rules['smtp_local_domain'] = 'sometimes|string|nullable'; // $rules['smtp_verify_peer'] = 'sometimes|string'; - $rules['e_invoice'] = ['sometimes','nullable', new ValidCompanyScheme()]; + // $rules['e_invoice'] = ['sometimes','nullable', new ValidCompanyScheme()]; if (isset($input['portal_mode']) && ($input['portal_mode'] == 'domain' || $input['portal_mode'] == 'iframe')) { $rules['portal_domain'] = 'bail|nullable|sometimes|url'; diff --git a/app/Services/EDocument/Gateway/Storecove/Storecove.php b/app/Services/EDocument/Gateway/Storecove/Storecove.php index f913e466d107..7c991aabc621 100644 --- a/app/Services/EDocument/Gateway/Storecove/Storecove.php +++ b/app/Services/EDocument/Gateway/Storecove/Storecove.php @@ -86,12 +86,28 @@ class Storecove { } } * + * + * + // documentType : invoice/invoice_response/order + // rawDocumentData : { + // document: base64_encode($ubl) + // parse: true + // parseStrategy: ubl + // } */ public function sendDocument($document) { + + $payload = [ + 'documentType' => 'invoice', + 'rawDocumentData' => base64_encode($document), + 'parse' => true, + 'parseStrategy', 'ubl' + ]; + $uri = "https://api.storecove.com/api/v2/document_submissions"; - $r = $this->httpClient($uri, (HttpVerb::POST)->value, $document, $this->getHeaders()); + $r = $this->httpClient($uri, (HttpVerb::POST)->value, $payload, $this->getHeaders()); if($r->successful()) return $r->json()['guid']; @@ -101,7 +117,7 @@ class Storecove { } //document submission sending evidence - public function sendingEvidence(string $guid) + public function getSendingEvidence(string $guid) { $uri = "https://api.storecove.com/api/v2/document_submissions/{$guid}"; $r = $this->httpClient($uri, (HttpVerb::GET)->value, [], $this->getHeaders()); @@ -118,7 +134,7 @@ class Storecove { } - public function httpClient(string $uri, string $verb, array $data, ?array $headers = []) + private function httpClient(string $uri, string $verb, array $data, ?array $headers = []) { $r = Http::withToken(config('ninja.storecove_api_key')) @@ -128,10 +144,5 @@ class Storecove { return $r; } -// curl \ -// -X POST \ -// -H "Accept: application/json" \ -// -H "Authorization: Bearer API_KEY_HERE" \ -// -H "Content-Type: application/json" \ -// --data @discovery.json + } \ No newline at end of file diff --git a/config/ninja.php b/config/ninja.php index 13c37af3e35c..7680a6d74eb2 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.8'), - 'app_tag' => env('APP_TAG', '5.10.8'), + 'app_version' => env('APP_VERSION', '5.10.9'), + 'app_tag' => env('APP_TAG', '5.10.9'), 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', false),