Working on dedicated credits for PEPPOL

This commit is contained in:
David Bomba
2026-01-18 13:15:41 +11:00
parent d659337863
commit 0349a5a2ae
3 changed files with 18 additions and 1 deletions

View File

@@ -81,6 +81,8 @@ class UpdateCreditRequest extends Request
$rules['location_id'] = ['nullable', 'sometimes','bail', Rule::exists('locations', 'id')->where('company_id', $user->company()->id)->where('client_id', $this->credit->client_id)];
$rules['e_invoice'] = ['sometimes', 'nullable', new ValidInvoiceScheme()];
return $rules;
}

View File

@@ -39,7 +39,7 @@ class UpdateEInvoiceConfiguration extends Request
public function rules()
{
return [
'entity' => 'required|bail|in:invoice,client,company',
'entity' => 'required|bail|in:credit,invoice,client,company',
'payment_means' => 'sometimes|bail|array',
'payment_means.*.code' => ['required_with:payment_means', 'bail', Rule::in(PaymentMeans::getPaymentMeansCodelist())],
'payment_means.*.bic_swift' => Rule::forEach(function (string|null $value, string $attribute) {
@@ -115,6 +115,7 @@ class UpdateEInvoiceConfiguration extends Request
return [...$rules, 'nullable'];
}),
'document_reference' => ['sometimes', 'bail', 'array'],
];
}

View File

@@ -276,6 +276,7 @@ class Peppol extends AbstractService
$this->p_invoice->Delivery = $this->getDelivery();
$this->setOrderReference()
->setDocumentReference()
->setTaxBreakdown()
->setPaymentTerms()
->addAttachments()
@@ -496,6 +497,19 @@ class Peppol extends AbstractService
return [$key => json_decode($this->toJson(), true)];
}
/**
* Set the reference for this document,
* ie: for a credit note, this reference would be the invoice it is referencing. Will always be stored on the e_invoice object.
*
* @return self
*/
private function setDocumentReference(): self
{
// InvoiceNinja\EInvoice\Models\Peppol\DocumentReferenceType
// We should only need to pull this in from the already stored object.
return $this;
}
/**
* setOrderReference