mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
3cbf28eb72
@ -411,7 +411,7 @@ class InvoiceItemSumInclusive
|
|||||||
|
|
||||||
$this->rule = new $class();
|
$this->rule = new $class();
|
||||||
|
|
||||||
if($this->rule->regionWithNoTaxCoverage($this->client->country->iso_3166_2)) {
|
if($this->rule->regionWithNoTaxCoverage($this->client->country->iso_3166_2 ?? false)) {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,10 +449,41 @@ class Activity extends StaticModel
|
|||||||
$replacements['created_at'] = $this->created_at ?? '';
|
$replacements['created_at'] = $this->created_at ?? '';
|
||||||
$replacements['ip'] = $this->ip ?? '';
|
$replacements['ip'] = $this->ip ?? '';
|
||||||
|
|
||||||
|
if($this->activity_type_id == 141)
|
||||||
|
$replacements = $this->harvestNoteEntities($replacements);
|
||||||
|
|
||||||
return $replacements;
|
return $replacements;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function harvestNoteEntities(array $replacements): array
|
||||||
|
{
|
||||||
|
$entities = [
|
||||||
|
':invoice',
|
||||||
|
':quote',
|
||||||
|
':credit',
|
||||||
|
':payment',
|
||||||
|
':task',
|
||||||
|
':expense',
|
||||||
|
':purchase_order',
|
||||||
|
':recurring_invoice',
|
||||||
|
':recurring_expense',
|
||||||
|
':client',
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach($entities as $entity)
|
||||||
|
{
|
||||||
|
$entity_key = substr($entity, 1);
|
||||||
|
|
||||||
|
if($this?->{$entity_key})
|
||||||
|
$replacements = array_merge($replacements, $this->matchVar($entity));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $replacements;
|
||||||
|
}
|
||||||
|
|
||||||
private function matchVar(string $variable)
|
private function matchVar(string $variable)
|
||||||
{
|
{
|
||||||
$system = ctrans('texts.system');
|
$system = ctrans('texts.system');
|
||||||
|
@ -313,4 +313,13 @@ class PaymentIntentWebhook implements ShouldQueue
|
|||||||
$client->company,
|
$client->company,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function failed($exception = null)
|
||||||
|
{
|
||||||
|
if ($exception) {
|
||||||
|
nlog($exception->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
config(['queue.failed.driver' => null]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,11 +9,11 @@
|
|||||||
* @license https://www.elastic.co/licensing/elastic-license
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace App\Services\EDocument\Gateway;
|
namespace App\Services\EDocument\Gateway\Storecove;
|
||||||
|
|
||||||
|
use App\Models\Company;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
|
|
||||||
enum HttpVerb: string
|
enum HttpVerb: string
|
||||||
{
|
{
|
||||||
case POST = 'post';
|
case POST = 'post';
|
||||||
@ -25,12 +25,14 @@ enum HttpVerb: string
|
|||||||
|
|
||||||
class Storecove {
|
class Storecove {
|
||||||
|
|
||||||
|
private string $base_url = 'https://api.storecove.com/api/v2/';
|
||||||
|
|
||||||
private array $peppol_discovery = [
|
private array $peppol_discovery = [
|
||||||
"documentTypes" => ["invoice"],
|
"documentTypes" => ["invoice"],
|
||||||
"network" => "peppol",
|
"network" => "peppol",
|
||||||
"metaScheme" => "iso6523-actorid-upis",
|
"metaScheme" => "iso6523-actorid-upis",
|
||||||
"scheme" => "de:lwid",
|
"scheme" => "de:lwid",
|
||||||
"identifier" => "10101010-STO-10"
|
"identifier" => "DE:VAT"
|
||||||
];
|
];
|
||||||
|
|
||||||
private array $dbn_discovery = [
|
private array $dbn_discovery = [
|
||||||
@ -62,7 +64,7 @@ class Storecove {
|
|||||||
default => $network_data = array_merge($this->peppol_discovery, ['scheme' => $scheme, 'identifier' => $identifier]),
|
default => $network_data = array_merge($this->peppol_discovery, ['scheme' => $scheme, 'identifier' => $identifier]),
|
||||||
};
|
};
|
||||||
|
|
||||||
$uri = "https://api.storecove.com/api/v2/discovery/receives";
|
$uri = "api/v2/discovery/receives";
|
||||||
|
|
||||||
$r = $this->httpClient($uri, (HttpVerb::POST)->value, $network_data, $this->getHeaders());
|
$r = $this->httpClient($uri, (HttpVerb::POST)->value, $network_data, $this->getHeaders());
|
||||||
|
|
||||||
@ -99,16 +101,31 @@ class Storecove {
|
|||||||
{
|
{
|
||||||
|
|
||||||
$payload = [
|
$payload = [
|
||||||
|
"legalEntityId"=> 290868,
|
||||||
|
"idempotencyGuid"=> \Illuminate\Support\Str::uuid(),
|
||||||
|
"routing"=> [
|
||||||
|
"eIdentifiers" => [
|
||||||
|
[
|
||||||
|
"scheme" => "DE:VAT",
|
||||||
|
"id"=> "DE:VAT"
|
||||||
|
],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"document"=> [
|
||||||
'documentType' => 'invoice',
|
'documentType' => 'invoice',
|
||||||
'rawDocumentData' => base64_encode($document),
|
'rawDocumentData' => ['document' => base64_encode($document)],
|
||||||
'parse' => true,
|
'parse' => true,
|
||||||
'parseStrategy', 'ubl'
|
'parseStrategy', 'ubl'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
$uri = "https://api.storecove.com/api/v2/document_submissions";
|
$uri = "document_submissions";
|
||||||
|
|
||||||
$r = $this->httpClient($uri, (HttpVerb::POST)->value, $payload, $this->getHeaders());
|
$r = $this->httpClient($uri, (HttpVerb::POST)->value, $payload, $this->getHeaders());
|
||||||
|
|
||||||
|
nlog($r->body());
|
||||||
|
nlog($r->json());
|
||||||
|
|
||||||
if($r->successful())
|
if($r->successful())
|
||||||
return $r->json()['guid'];
|
return $r->json()['guid'];
|
||||||
|
|
||||||
@ -119,11 +136,129 @@ class Storecove {
|
|||||||
//document submission sending evidence
|
//document submission sending evidence
|
||||||
public function getSendingEvidence(string $guid)
|
public function getSendingEvidence(string $guid)
|
||||||
{
|
{
|
||||||
$uri = "https://api.storecove.com/api/v2/document_submissions/{$guid}";
|
$uri = "document_submissions/{$guid}";
|
||||||
$r = $this->httpClient($uri, (HttpVerb::GET)->value, [], $this->getHeaders());
|
$r = $this->httpClient($uri, (HttpVerb::GET)->value, [], $this->getHeaders());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// {
|
||||||
|
// "party_name": "<string>",
|
||||||
|
// "line1": "<string>",
|
||||||
|
// "city": "<string>",
|
||||||
|
// "zip": "<string>",
|
||||||
|
// "country": "EH",
|
||||||
|
// "line2": "<string>",
|
||||||
|
// "county": "<string>",
|
||||||
|
// "tenant_id": "<string>",
|
||||||
|
// "public": true,
|
||||||
|
// "advertisements": [
|
||||||
|
// "invoice"
|
||||||
|
// ],
|
||||||
|
// "third_party_username": "<string>",
|
||||||
|
// "third_party_password": "<string>",
|
||||||
|
// "rea": {
|
||||||
|
// "province": "AR",
|
||||||
|
// "identifier": "<string>",
|
||||||
|
// "capital": "<number>",
|
||||||
|
// "partners": "SM",
|
||||||
|
// "liquidation_status": "LN"
|
||||||
|
// },
|
||||||
|
// "acts_as_sender": true,
|
||||||
|
// "acts_as_receiver": true,
|
||||||
|
// "tax_registered": true
|
||||||
|
// }
|
||||||
|
|
||||||
|
// acts_as_receiver - optional - Default : true
|
||||||
|
// acts_as_sender - optional - Default : true
|
||||||
|
// advertisements - optional < enum (invoice, invoice_response, order, ordering, order_response, selfbilling) > array
|
||||||
|
// city - required - Length : 2 - 64
|
||||||
|
// country - required - ISO 3166-1 alpha-2
|
||||||
|
// county - optional - Maximal length : 64
|
||||||
|
// line1 - required - The first address line - Length : 2 - 192
|
||||||
|
// line2 - optional - The second address line, if applicable Maximal length : 192
|
||||||
|
// party_name - required - The name of the company. Length : 2 - 64
|
||||||
|
// public - optional - Whether or not this LegalEntity is public. Public means it will be entered into the PEPPOL directory at https://directory.peppol.eu/ Default : true
|
||||||
|
// rea - optional - The REA details for the LegalEntity. Only applies to IT (Italian) LegalEntities. - https://www.storecove.com/docs/#_openapi_rea (schema)
|
||||||
|
|
||||||
|
// capital - optional - The captial for the company. - number
|
||||||
|
// identifier - optional - The identifier. Length : 2 - 20
|
||||||
|
// liquidation_status - optional - The liquidation status of the company. enum (LN, LS)
|
||||||
|
// partners - optional - The number of partners. enum (SU, SM)
|
||||||
|
// province - optional - The provincia of the ufficio that issued the identifier.enum (AG, AL, AN, AO, AQ, AR, AP, AT, AV, BA, BT, BL, BN, BG, BI, BO, BZ, BS, BR, CA, CL, CB, CI, CE, CT, CZ, CH, CO, CS, CR, KR, CN, EN, FM, FE, FI, FG, FC, FR, GE, GO, GR, IM, IS, SP, LT, LE, LC, LI, LO, LU, MC, MN, MS, MT, VS, ME, MI, MO, MB, NA, NO, NU, OG, OT, OR, PD, PA, PR, PV, PG, PU, PE, PC, PI, PT, PN, PZ, PO, RG, RA, RC, RE, RI, RN, RO, SA, SS, SV, SI, SR, SO, TA, TE, TR, TO, TP, TN, TV, TS, UD, VA, VE, VB, VC, VR, VV, VI, VT)
|
||||||
|
|
||||||
|
// tax_registered - optional - Whether or not this LegalEntity is tax registered. This influences the validation of the data presented when sending documents. Default : true
|
||||||
|
// tenant_id - optional - The id of the tenant, to be used in case of single-tenant solutions that share webhook URLs. This property will included in webhook events. Maximal length : 64
|
||||||
|
// third_party_password - optional - The password to use to authenticate to a system through which to send the document, or to obtain tax authority approval to send it. This field is currently relevant only for India and mandatory when creating an IN LegalEntity. Length : 2 - 64
|
||||||
|
// third_party_username - optional - The username to use to authenticate to a system through which to send the document, or to obtain tax authority approval to send it. This field is currently relevant only for India and mandatory when creating an IN LegalEntity. Length : 2 - 64
|
||||||
|
// zip - required - The zipcode. Length : 2 - 32
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CreateLegalEntity
|
||||||
|
*
|
||||||
|
* @url https://www.storecove.com/docs/#_openapi_legalentitycreate
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function createLegalEntity(array $data, Company $company)
|
||||||
|
{
|
||||||
|
$uri = 'legal_entities';
|
||||||
|
|
||||||
|
$company_defaults = [
|
||||||
|
'acts_as_receiver' => true,
|
||||||
|
'acts_as_sender' => true,
|
||||||
|
'advertisements' => ['invoice'],
|
||||||
|
'city' => $company->settings->city,
|
||||||
|
'country' => $company->country()->iso_3166_2,
|
||||||
|
'county' => $company->settings->state,
|
||||||
|
'line1' => $company->settings->address1,
|
||||||
|
'line2' => $company->settings->address2,
|
||||||
|
'party_name' => $company->settings->name,
|
||||||
|
'tax_registered' => true,
|
||||||
|
'tenant_id' => $company->company_key,
|
||||||
|
'zip' => $company->settings->postal_code,
|
||||||
|
];
|
||||||
|
|
||||||
|
$payload = array_merge($company_defaults, $data);
|
||||||
|
|
||||||
|
$r = $this->httpClient($uri, (HttpVerb::POST)->value, $payload);
|
||||||
|
|
||||||
|
if($r->successful())
|
||||||
|
return $r->json();
|
||||||
|
|
||||||
|
return $r;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLegalEntity($id)
|
||||||
|
{
|
||||||
|
|
||||||
|
$uri = "legal_entities/{$id}";
|
||||||
|
|
||||||
|
$r = $this->httpClient($uri, (HttpVerb::GET)->value, []);
|
||||||
|
|
||||||
|
if($r->successful()) {
|
||||||
|
return $r->json();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $r;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateLegalEntity($id, array $data)
|
||||||
|
{
|
||||||
|
|
||||||
|
$uri = "legal_entities/{$id}";
|
||||||
|
|
||||||
|
$r = $this->httpClient($uri, (HttpVerb::PATCH)->value, $data);
|
||||||
|
|
||||||
|
if($r->successful()) {
|
||||||
|
return $r->json();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $r;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
private function getHeaders(array $headers = [])
|
private function getHeaders(array $headers = [])
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -136,10 +271,10 @@ class Storecove {
|
|||||||
|
|
||||||
private function httpClient(string $uri, string $verb, array $data, ?array $headers = [])
|
private function httpClient(string $uri, string $verb, array $data, ?array $headers = [])
|
||||||
{
|
{
|
||||||
|
nlog("{$this->base_url}{$uri}");
|
||||||
$r = Http::withToken(config('ninja.storecove_api_key'))
|
$r = Http::withToken(config('ninja.storecove_api_key'))
|
||||||
->withHeaders($this->getHeaders($headers))
|
->withHeaders($this->getHeaders($headers))
|
||||||
->{$verb}($uri, $data);
|
->{$verb}("{$this->base_url}{$uri}", $data);
|
||||||
|
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ use App\Models\Invoice;
|
|||||||
use App\Services\AbstractService;
|
use App\Services\AbstractService;
|
||||||
use App\Helpers\Invoice\InvoiceSum;
|
use App\Helpers\Invoice\InvoiceSum;
|
||||||
use App\Helpers\Invoice\InvoiceSumInclusive;
|
use App\Helpers\Invoice\InvoiceSumInclusive;
|
||||||
|
use InvoiceNinja\EInvoice\EInvoice;
|
||||||
use InvoiceNinja\EInvoice\Models\Peppol\ItemType\Item;
|
use InvoiceNinja\EInvoice\Models\Peppol\ItemType\Item;
|
||||||
use InvoiceNinja\EInvoice\Models\Peppol\PartyType\Party;
|
use InvoiceNinja\EInvoice\Models\Peppol\PartyType\Party;
|
||||||
use InvoiceNinja\EInvoice\Models\Peppol\PriceType\Price;
|
use InvoiceNinja\EInvoice\Models\Peppol\PriceType\Price;
|
||||||
@ -78,6 +79,12 @@ class Peppol extends AbstractService
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function toXml(): string
|
||||||
|
{
|
||||||
|
$e = new EInvoice();
|
||||||
|
return $e->encode($this->p_invoice, 'xml');
|
||||||
|
}
|
||||||
|
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$this->p_invoice->ID = $this->invoice->number;
|
$this->p_invoice->ID = $this->invoice->number;
|
||||||
|
@ -62,7 +62,7 @@ class AutoBillInvoice extends AbstractService
|
|||||||
$this->invoice = $this->invoice->service()->markSent()->save();
|
$this->invoice = $this->invoice->service()->markSent()->save();
|
||||||
|
|
||||||
/* Mark the invoice as paid if there is no balance */
|
/* Mark the invoice as paid if there is no balance */
|
||||||
if ((int) $this->invoice->balance == 0) {
|
if (floatval($this->invoice->balance) == 0) {
|
||||||
return $this->invoice->service()->markPaid()->save();
|
return $this->invoice->service()->markPaid()->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Models\Timezone;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$t = \App\Models\Timezone::find(115);
|
||||||
|
|
||||||
|
if(!$t){
|
||||||
|
|
||||||
|
$t = new Timezone();
|
||||||
|
$t->id = 115;
|
||||||
|
$t->name = 'Asia/Dubai';
|
||||||
|
$t->location = '(GMT+04:00) Dubai';
|
||||||
|
$t->utc_offset = 14400;
|
||||||
|
$t->save();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
};
|
@ -151,6 +151,7 @@ class ConstantsSeeder extends Seeder
|
|||||||
$timezones[] = ['name'=>'Asia/Magadan', 'location' => '(GMT+12:00) Magadan', 'utc_offset' => 43200];
|
$timezones[] = ['name'=>'Asia/Magadan', 'location' => '(GMT+12:00) Magadan', 'utc_offset' => 43200];
|
||||||
$timezones[] = ['name'=>'Pacific/Auckland', 'location' => '(GMT+12:00) Auckland', 'utc_offset' => 43200];
|
$timezones[] = ['name'=>'Pacific/Auckland', 'location' => '(GMT+12:00) Auckland', 'utc_offset' => 43200];
|
||||||
$timezones[] = ['name'=>'Pacific/Fiji', 'location' => '(GMT+12:00) Fiji', 'utc_offset' => 43200];
|
$timezones[] = ['name'=>'Pacific/Fiji', 'location' => '(GMT+12:00) Fiji', 'utc_offset' => 43200];
|
||||||
|
$timezones[] = ['name' => 'Asia/Dubai', 'location' => '(GMT+04:00) Dubai', 'utc_offset' => 14400];
|
||||||
|
|
||||||
$x = 1;
|
$x = 1;
|
||||||
foreach ($timezones as $timezone) {
|
foreach ($timezones as $timezone) {
|
||||||
|
220
tests/Integration/Einvoice/Storecove/StorecoveTest.php
Normal file
220
tests/Integration/Einvoice/Storecove/StorecoveTest.php
Normal file
@ -0,0 +1,220 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\Integration\Einvoice\Storecove;
|
||||||
|
|
||||||
|
use Tests\TestCase;
|
||||||
|
use Tests\MockAccountData;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
|
||||||
|
|
||||||
|
class StorecoveTest extends TestCase
|
||||||
|
{
|
||||||
|
use MockAccountData;
|
||||||
|
use DatabaseTransactions;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->makeTestData();
|
||||||
|
|
||||||
|
if (config('ninja.testvars.travis') !== false || !config('ninja.storecove_api_key'))
|
||||||
|
$this->markTestSkipped("do not run in CI");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCreateLegalEntity()
|
||||||
|
{
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'acts_as_receiver' => true,
|
||||||
|
'acts_as_sender' => true,
|
||||||
|
'advertisements' => ['invoice'],
|
||||||
|
'city' => $this->company->settings->city,
|
||||||
|
'country' => 'DE',
|
||||||
|
'county' => $this->company->settings->state,
|
||||||
|
'line1' => $this->company->settings->address1,
|
||||||
|
'line2' => $this->company->settings->address2,
|
||||||
|
'party_name' => $this->company->present()->name(),
|
||||||
|
'tax_registered' => true,
|
||||||
|
'tenant_id' => $this->company->company_key,
|
||||||
|
'zip' => $this->company->settings->postal_code,
|
||||||
|
'peppol_identifiers' => [
|
||||||
|
'scheme' => 'DE:VAT',
|
||||||
|
'id' => 'DE:VAT'
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$sc = new \App\Services\EDocument\Gateway\Storecove\Storecove();
|
||||||
|
$r = $sc->createLegalEntity($data, $this->company);
|
||||||
|
|
||||||
|
$this->assertIsArray($r);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// public function testUpdateLegalEntity()
|
||||||
|
// {
|
||||||
|
// $data = [
|
||||||
|
// 'peppol_identifiers' => [
|
||||||
|
// 'scheme' => 'DE:VAT',
|
||||||
|
// 'id' => 'DE:VAT'
|
||||||
|
// ],
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// $sc = new \App\Services\EDocument\Gateway\Storecove\Storecove();
|
||||||
|
// $r = $sc->updateLegalEntity(290868, $data);
|
||||||
|
|
||||||
|
// $this->assertIsArray($r);
|
||||||
|
// nlog($r);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
public function testGetLegalEntity()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$sc = new \App\Services\EDocument\Gateway\Storecove\Storecove();
|
||||||
|
$r = $sc->getLegalEntity(290868);
|
||||||
|
|
||||||
|
$this->assertIsArray($r);
|
||||||
|
|
||||||
|
nlog($r);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSendDocument()
|
||||||
|
{
|
||||||
|
|
||||||
|
$x = '<?xml version="1.0"?>
|
||||||
|
<cbc:ID>0061</cbc:ID>
|
||||||
|
<cbc:IssueDate>2024-07-15</cbc:IssueDate>
|
||||||
|
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
|
||||||
|
<cac:AccountingSupplierParty>
|
||||||
|
<cac:Party>
|
||||||
|
<cac:PartyName>
|
||||||
|
<cbc:Name>Eladio Ullrich I</cbc:Name>
|
||||||
|
</cac:PartyName>
|
||||||
|
<cac:PostalAddress>
|
||||||
|
<cbc:StreetName>Jasper Brook</cbc:StreetName>
|
||||||
|
<cbc:CityName>Kodychester</cbc:CityName>
|
||||||
|
<cbc:PostalZone>73445-5131</cbc:PostalZone>
|
||||||
|
<cbc:CountrySubentity>South Dakota</cbc:CountrySubentity>
|
||||||
|
<cac:Country>
|
||||||
|
<cbc:IdentificationCode>AT</cbc:IdentificationCode>
|
||||||
|
</cac:Country>
|
||||||
|
</cac:PostalAddress>
|
||||||
|
<cac:PhysicalLocation>
|
||||||
|
<cbc:StreetName>Jasper Brook</cbc:StreetName>
|
||||||
|
<cbc:CityName>Kodychester</cbc:CityName>
|
||||||
|
<cbc:PostalZone>73445-5131</cbc:PostalZone>
|
||||||
|
<cbc:CountrySubentity>South Dakota</cbc:CountrySubentity>
|
||||||
|
<cac:Country>
|
||||||
|
<cbc:IdentificationCode>AT</cbc:IdentificationCode>
|
||||||
|
</cac:Country>
|
||||||
|
</cac:PhysicalLocation>
|
||||||
|
<cac:Contact>
|
||||||
|
<cbc:ElectronicMail>small@example.com</cbc:ElectronicMail>
|
||||||
|
</cac:Contact>
|
||||||
|
</cac:Party>
|
||||||
|
</cac:AccountingSupplierParty>
|
||||||
|
<cac:AccountingCustomerParty>
|
||||||
|
<cac:Party>
|
||||||
|
<cac:PartyName>
|
||||||
|
<cbc:Name>Beispiel GmbH</cbc:Name>
|
||||||
|
</cac:PartyName>
|
||||||
|
<cac:PostalAddress>
|
||||||
|
<cbc:StreetName>45 Hauptstraße</cbc:StreetName>
|
||||||
|
<cbc:CityName>Berlin</cbc:CityName>
|
||||||
|
<cbc:PostalZone>10115</cbc:PostalZone>
|
||||||
|
<cbc:CountrySubentity>Berlin</cbc:CountrySubentity>
|
||||||
|
<cac:Country>
|
||||||
|
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||||
|
</cac:Country>
|
||||||
|
</cac:PostalAddress>
|
||||||
|
<cac:PhysicalLocation>
|
||||||
|
<cbc:StreetName>45 Hauptstraße</cbc:StreetName>
|
||||||
|
<cbc:CityName>Berlin</cbc:CityName>
|
||||||
|
<cbc:PostalZone>10115</cbc:PostalZone>
|
||||||
|
<cbc:CountrySubentity>Berlin</cbc:CountrySubentity>
|
||||||
|
<cac:Country>
|
||||||
|
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||||
|
</cac:Country>
|
||||||
|
</cac:PhysicalLocation>
|
||||||
|
<cac:Contact>
|
||||||
|
<cbc:ElectronicMail>TTKGjKW9Rv00LEr@example.com</cbc:ElectronicMail>
|
||||||
|
</cac:Contact>
|
||||||
|
</cac:Party>
|
||||||
|
</cac:AccountingCustomerParty>
|
||||||
|
<cac:TaxTotal/>
|
||||||
|
<cac:LegalMonetaryTotal>
|
||||||
|
<cbc:LineExtensionAmount currencyID="EUR">215</cbc:LineExtensionAmount>
|
||||||
|
<cbc:TaxExclusiveAmount currencyID="EUR">215</cbc:TaxExclusiveAmount>
|
||||||
|
<cbc:TaxInclusiveAmount currencyID="EUR">215.00</cbc:TaxInclusiveAmount>
|
||||||
|
<cbc:PayableAmount currencyID="EUR">215.00</cbc:PayableAmount>
|
||||||
|
</cac:LegalMonetaryTotal>
|
||||||
|
<cac:InvoiceLine>
|
||||||
|
<cbc:ID>1</cbc:ID>
|
||||||
|
<cbc:InvoicedQuantity>1</cbc:InvoicedQuantity>
|
||||||
|
<cbc:LineExtensionAmount currencyID="EUR">10</cbc:LineExtensionAmount>
|
||||||
|
<cac:TaxTotal>
|
||||||
|
<cbc:TaxAmount currencyID="EUR">0.5</cbc:TaxAmount>
|
||||||
|
<cac:TaxSubtotal>
|
||||||
|
<cbc:TaxableAmount currencyID="EUR">10</cbc:TaxableAmount>
|
||||||
|
<cbc:TaxAmount currencyID="EUR">0.5</cbc:TaxAmount>
|
||||||
|
<cac:TaxCategory>
|
||||||
|
<cbc:ID>C62</cbc:ID>
|
||||||
|
<cbc:Percent>20</cbc:Percent>
|
||||||
|
<cac:TaxScheme>
|
||||||
|
<cbc:ID>USt</cbc:ID>
|
||||||
|
</cac:TaxScheme>
|
||||||
|
</cac:TaxCategory>
|
||||||
|
</cac:TaxSubtotal>
|
||||||
|
</cac:TaxTotal>
|
||||||
|
<cac:Item>
|
||||||
|
<cbc:Description>The Pro Plan NO MORE</cbc:Description>
|
||||||
|
<cbc:Name>ee</cbc:Name>
|
||||||
|
</cac:Item>
|
||||||
|
<cac:Price>
|
||||||
|
<cbc:PriceAmount currencyID="EUR">10</cbc:PriceAmount>
|
||||||
|
</cac:Price>
|
||||||
|
</cac:InvoiceLine>
|
||||||
|
<cac:InvoiceLine>
|
||||||
|
<cbc:ID>2</cbc:ID>
|
||||||
|
<cbc:InvoicedQuantity>1</cbc:InvoicedQuantity>
|
||||||
|
<cbc:LineExtensionAmount currencyID="EUR">14</cbc:LineExtensionAmount>
|
||||||
|
<cac:Item>
|
||||||
|
<cbc:Description>The Enterprise Plan</cbc:Description>
|
||||||
|
<cbc:Name>eee</cbc:Name>
|
||||||
|
</cac:Item>
|
||||||
|
<cac:Price>
|
||||||
|
<cbc:PriceAmount currencyID="EUR">14</cbc:PriceAmount>
|
||||||
|
</cac:Price>
|
||||||
|
</cac:InvoiceLine>
|
||||||
|
<cac:InvoiceLine>
|
||||||
|
<cbc:ID>3</cbc:ID>
|
||||||
|
<cbc:InvoicedQuantity>1</cbc:InvoicedQuantity>
|
||||||
|
<cbc:LineExtensionAmount currencyID="EUR">191</cbc:LineExtensionAmount>
|
||||||
|
<cac:Item>
|
||||||
|
<cbc:Description>Soluta provident.</cbc:Description>
|
||||||
|
<cbc:Name>k</cbc:Name>
|
||||||
|
</cac:Item>
|
||||||
|
<cac:Price>
|
||||||
|
<cbc:PriceAmount currencyID="EUR">191</cbc:PriceAmount>
|
||||||
|
</cac:Price>
|
||||||
|
</cac:InvoiceLine>';
|
||||||
|
|
||||||
|
|
||||||
|
$sc = new \App\Services\EDocument\Gateway\Storecove\Storecove();
|
||||||
|
$sc->sendDocument($x);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user