mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for tests
This commit is contained in:
parent
50a9a917b3
commit
2214b546ed
@ -57,6 +57,12 @@ class Peppol extends AbstractService
|
|||||||
use NumberFormatter;
|
use NumberFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Assumptions:
|
||||||
|
*
|
||||||
|
* Line Item Taxes Only
|
||||||
|
* Exclusive Taxes
|
||||||
|
*
|
||||||
|
*
|
||||||
* used as a proxy for
|
* used as a proxy for
|
||||||
* the schemeID of partyidentification
|
* the schemeID of partyidentification
|
||||||
* property - for Storecove only:
|
* property - for Storecove only:
|
||||||
@ -154,7 +160,9 @@ class Peppol extends AbstractService
|
|||||||
private \InvoiceNinja\EInvoice\Models\Peppol\Invoice $p_invoice;
|
private \InvoiceNinja\EInvoice\Models\Peppol\Invoice $p_invoice;
|
||||||
|
|
||||||
private ?\InvoiceNinja\EInvoice\Models\Peppol\Invoice $_client_settings;
|
private ?\InvoiceNinja\EInvoice\Models\Peppol\Invoice $_client_settings;
|
||||||
|
|
||||||
private ?\InvoiceNinja\EInvoice\Models\Peppol\Invoice $_company_settings;
|
private ?\InvoiceNinja\EInvoice\Models\Peppol\Invoice $_company_settings;
|
||||||
|
|
||||||
private EInvoice $e;
|
private EInvoice $e;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -761,13 +769,13 @@ class Peppol extends AbstractService
|
|||||||
public function getSetting(string $property_path): mixed
|
public function getSetting(string $property_path): mixed
|
||||||
{
|
{
|
||||||
|
|
||||||
if($prop_value = PropertyResolver::resolve($this->invoice->e_invoice, $property_path))
|
if($prop_value = PropertyResolver::resolve($this->p_invoice, $property_path)) {
|
||||||
return $prop_value;
|
return $prop_value;
|
||||||
elseif($prop_value = PropertyResolver::resolve($this->_client_settings, $property_path))
|
}elseif($prop_value = PropertyResolver::resolve($this->_client_settings, $property_path)) {
|
||||||
return $prop_value;
|
return $prop_value;
|
||||||
elseif($prop_value = PropertyResolver::resolve($this->_company_settings, $property_path))
|
}elseif($prop_value = PropertyResolver::resolve($this->_company_settings, $property_path)) {
|
||||||
return $prop_value;
|
return $prop_value;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -786,7 +794,7 @@ class Peppol extends AbstractService
|
|||||||
|
|
||||||
if(isset($this->p_invoice->PaymentMeans))
|
if(isset($this->p_invoice->PaymentMeans))
|
||||||
return $this;
|
return $this;
|
||||||
elseif(!isset($this->p_invoice->PaymentMeans) && $paymentMeans = $this->getSetting('Invoice.PaymentMeans')){
|
elseif($paymentMeans = $this->getSetting('Invoice.PaymentMeans')){
|
||||||
$this->p_invoice->PaymentMeans = is_array($paymentMeans) ? $paymentMeans : [$paymentMeans];
|
$this->p_invoice->PaymentMeans = is_array($paymentMeans) ? $paymentMeans : [$paymentMeans];
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -797,23 +805,47 @@ class Peppol extends AbstractService
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DE
|
||||||
|
*
|
||||||
|
* @Completed
|
||||||
|
* @Tested
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
private function DE(): self
|
private function DE(): self
|
||||||
{
|
{
|
||||||
// accountingsupplierparty.party.contact MUST be set - Name / Telephone / Electronic Mail
|
|
||||||
// this is forced by default.
|
|
||||||
|
|
||||||
$this->setPaymentMeans(true);
|
$this->setPaymentMeans(true);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CH
|
||||||
|
*
|
||||||
|
* @Completed
|
||||||
|
*
|
||||||
|
* Completed - QR-Bill to be implemented at a later date.
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
private function CH(): self
|
private function CH(): self
|
||||||
{
|
{
|
||||||
//if QR-Bill support required - then special flow required.... optional.
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AT
|
||||||
|
*
|
||||||
|
* @Pending
|
||||||
|
*
|
||||||
|
* Need to ensure when sending to government entities that we route appropriately
|
||||||
|
* Also need to ensure customerAssignedAccountIdValue is set so that the sender can be resolved.
|
||||||
|
*
|
||||||
|
* Need a way to define if the client is a government entity.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
private function AT(): self
|
private function AT(): self
|
||||||
{
|
{
|
||||||
//special fields for sending to AT:GOV
|
//special fields for sending to AT:GOV
|
||||||
@ -827,6 +859,13 @@ class Peppol extends AbstractService
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ES
|
||||||
|
*
|
||||||
|
* @Pending - testing.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
private function ES(): self
|
private function ES(): self
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -67,10 +67,8 @@ class PeppolTest extends TestCase
|
|||||||
$settings->country_id = '276';
|
$settings->country_id = '276';
|
||||||
$settings->currency_id = '3';
|
$settings->currency_id = '3';
|
||||||
|
|
||||||
|
|
||||||
$einvoice = new \InvoiceNinja\EInvoice\Models\Peppol\Invoice();
|
$einvoice = new \InvoiceNinja\EInvoice\Models\Peppol\Invoice();
|
||||||
|
|
||||||
|
|
||||||
$fib = new FinancialInstitutionBranch();
|
$fib = new FinancialInstitutionBranch();
|
||||||
$fib->ID = "DEUTDEMMXXX"; //BIC
|
$fib->ID = "DEUTDEMMXXX"; //BIC
|
||||||
$fib->Name = 'Deutsche Bank';
|
$fib->Name = 'Deutsche Bank';
|
||||||
@ -88,10 +86,13 @@ class PeppolTest extends TestCase
|
|||||||
$pm->PayeeFinancialAccount = $pfa;
|
$pm->PayeeFinancialAccount = $pfa;
|
||||||
$einvoice->PaymentMeans[] = $pm;
|
$einvoice->PaymentMeans[] = $pm;
|
||||||
|
|
||||||
|
$stub = new \stdClass;
|
||||||
|
$stub->Invoice = $einvoice;
|
||||||
|
|
||||||
$company = Company::factory()->create([
|
$company = Company::factory()->create([
|
||||||
'account_id' => $this->account->id,
|
'account_id' => $this->account->id,
|
||||||
'settings' => $settings,
|
'settings' => $settings,
|
||||||
'e_invoice' => $einvoice,
|
'e_invoice' => $stub,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$cu = CompanyUserFactory::create($this->user->id, $company->id, $this->account->id);
|
$cu = CompanyUserFactory::create($this->user->id, $company->id, $this->account->id);
|
||||||
@ -149,11 +150,12 @@ class PeppolTest extends TestCase
|
|||||||
|
|
||||||
$this->assertEquals(119, $invoice->amount);
|
$this->assertEquals(119, $invoice->amount);
|
||||||
|
|
||||||
|
|
||||||
$peppol = new Peppol($invoice);
|
$peppol = new Peppol($invoice);
|
||||||
$peppol->setInvoiceDefaults();
|
$peppol->setInvoiceDefaults();
|
||||||
$peppol->run();
|
$peppol->run();
|
||||||
|
|
||||||
|
nlog($peppol->toXml());
|
||||||
|
|
||||||
$de_invoice = $peppol->getInvoice();
|
$de_invoice = $peppol->getInvoice();
|
||||||
|
|
||||||
$this->assertNotNull($de_invoice);
|
$this->assertNotNull($de_invoice);
|
||||||
@ -207,10 +209,14 @@ class PeppolTest extends TestCase
|
|||||||
$pm->PayeeFinancialAccount = $pfa;
|
$pm->PayeeFinancialAccount = $pfa;
|
||||||
$einvoice->PaymentMeans[] = $pm;
|
$einvoice->PaymentMeans[] = $pm;
|
||||||
|
|
||||||
|
|
||||||
|
$stub = new \stdClass();
|
||||||
|
$stub->Invoice = $einvoice;
|
||||||
|
|
||||||
$company = Company::factory()->create([
|
$company = Company::factory()->create([
|
||||||
'account_id' => $this->account->id,
|
'account_id' => $this->account->id,
|
||||||
'settings' => $settings,
|
'settings' => $settings,
|
||||||
'e_invoice' => $einvoice,
|
'e_invoice' => $stub,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$cu = CompanyUserFactory::create($this->user->id, $company->id, $this->account->id);
|
$cu = CompanyUserFactory::create($this->user->id, $company->id, $this->account->id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user