diff --git a/app/Http/ValidationRules/EInvoice/ValidClientScheme.php b/app/Http/ValidationRules/EInvoice/ValidClientScheme.php new file mode 100644 index 000000000000..ff38a0aad27c --- /dev/null +++ b/app/Http/ValidationRules/EInvoice/ValidClientScheme.php @@ -0,0 +1,61 @@ +validateRequest($value['Invoice'], ClientLevel::class); + + foreach ($errors as $key => $msg) { + + $this->validator->errors()->add( + "e_invoice.{$key}", + "{$key} - {$msg}" + ); + + } + + } + + /** + * Set the current validator. + */ + public function setValidator(Validator $validator): static + { + $this->validator = $validator; + return $this; + } + + +} diff --git a/app/Services/EDocument/Standards/Validation/Peppol/ClientLevel.php b/app/Services/EDocument/Standards/Validation/Peppol/ClientLevel.php new file mode 100644 index 000000000000..e83383388afc --- /dev/null +++ b/app/Services/EDocument/Standards/Validation/Peppol/ClientLevel.php @@ -0,0 +1,303 @@ + 'Y-m-d'])] + // #[SerializedName('cbc:IssueDate')] + // public ?DateTime $IssueDate; + + // /** @var ?\DateTime */ + // #[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d\TH:i:s.uP'])] + // #[SerializedName('cbc:IssueTime')] + // public ?DateTime $IssueTime; + + // /** @var ?\DateTime */ + // #[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])] + // #[SerializedName('cbc:DueDate')] + // public ?DateTime $DueDate; + + /** @var InvoiceTypeCode */ + #[SerializedName('cbc:InvoiceTypeCode')] + public $InvoiceTypeCode; + + /** @var string */ + #[SerializedName('cbc:Note')] + public string $Note; + + /** @var ?\DateTime */ + #[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])] + #[SerializedName('cbc:TaxPointDate')] + public ?DateTime $TaxPointDate; + + /** @var DocumentCurrencyCode */ + #[SerializedName('cbc:DocumentCurrencyCode')] + public $DocumentCurrencyCode; + + /** @var TaxCurrencyCode */ + #[SerializedName('cbc:TaxCurrencyCode')] + public $TaxCurrencyCode; + + /** @var PricingCurrencyCode */ + #[SerializedName('cbc:PricingCurrencyCode')] + public $PricingCurrencyCode; + + /** @var PaymentCurrencyCode */ + #[SerializedName('cbc:PaymentCurrencyCode')] + public $PaymentCurrencyCode; + + /** @var PaymentAlternativeCurrencyCode */ + #[SerializedName('cbc:PaymentAlternativeCurrencyCode')] + public $PaymentAlternativeCurrencyCode; + + // /** @var AccountingCostCode */ + // #[SerializedName('cbc:AccountingCostCode')] + // public $AccountingCostCode; + + /** @var string */ + #[SerializedName('cbc:AccountingCost')] + public string $AccountingCost; + + // /** @var LineCountNumeric */ + // #[SerializedName('cbc:LineCountNumeric')] + // public $LineCountNumeric; + + // /** @var string */ + // #[SerializedName('cbc:BuyerReference')] + // public string $BuyerReference; + + // /** @var InvoicePeriod[] */ + // #[SerializedName('cac:InvoicePeriod')] + // public array $InvoicePeriod; + + // /** @var OrderReference */ + // #[SerializedName('cac:OrderReference')] + // public $OrderReference; + + // /** @var BillingReference[] */ + // #[SerializedName('cac:BillingReference')] + // public array $BillingReference; + + /** @var DespatchDocumentReference[] */ + #[SerializedName('cac:DespatchDocumentReference')] + public array $DespatchDocumentReference; + + /** @var ReceiptDocumentReference[] */ + #[SerializedName('cac:ReceiptDocumentReference')] + public array $ReceiptDocumentReference; + + /** @var StatementDocumentReference[] */ + #[SerializedName('cac:StatementDocumentReference')] + public array $StatementDocumentReference; + + /** @var OriginatorDocumentReference[] */ + #[SerializedName('cac:OriginatorDocumentReference')] + public array $OriginatorDocumentReference; + + /** @var ContractDocumentReference[] */ + #[SerializedName('cac:ContractDocumentReference')] + public array $ContractDocumentReference; + + /** @var AdditionalDocumentReference[] */ + #[SerializedName('cac:AdditionalDocumentReference')] + public array $AdditionalDocumentReference; + + /** @var ProjectReference[] */ + #[SerializedName('cac:ProjectReference')] + public array $ProjectReference; + + // /** @var Signature[] */ + // #[SerializedName('cac:Signature')] + // public array $Signature; + + // /** @var AccountingSupplierParty */ + // #[NotNull] + // #[NotBlank] + // #[Valid] + // #[SerializedName('cac:AccountingSupplierParty')] + // public $AccountingSupplierParty; + + // /** @var AccountingCustomerParty */ + // #[NotNull] + // #[NotBlank] + // #[Valid] + // #[SerializedName('cac:AccountingCustomerParty')] + // public $AccountingCustomerParty; + + /** @var PayeeParty */ + #[SerializedName('cac:PayeeParty')] + public $PayeeParty; + + /** @var BuyerCustomerParty */ + #[SerializedName('cac:BuyerCustomerParty')] + public $BuyerCustomerParty; + + // /** @var SellerSupplierParty */ + // #[SerializedName('cac:SellerSupplierParty')] + // public $SellerSupplierParty; + + /** @var TaxRepresentativeParty */ + #[SerializedName('cac:TaxRepresentativeParty')] + public $TaxRepresentativeParty; + + /** @var Delivery[] */ + #[SerializedName('cac:Delivery')] + public array $Delivery; + + /** @var DeliveryTerms */ + #[SerializedName('cac:DeliveryTerms')] + public $DeliveryTerms; + + /** @var PaymentMeans[] */ + #[SerializedName('cac:PaymentMeans')] + public array $PaymentMeans; + + /** @var PaymentTerms[] */ + #[SerializedName('cac:PaymentTerms')] + public array $PaymentTerms; + + // /** @var PrepaidPayment[] */ + // #[SerializedName('cac:PrepaidPayment')] + // public array $PrepaidPayment; + + // /** @var AllowanceCharge[] */ + // #[SerializedName('cac:AllowanceCharge')] + // public array $AllowanceCharge; + + // /** @var TaxExchangeRate */ + // #[SerializedName('cac:TaxExchangeRate')] + // public $TaxExchangeRate; + + // /** @var PricingExchangeRate */ + // #[SerializedName('cac:PricingExchangeRate')] + // public $PricingExchangeRate; + + // /** @var PaymentExchangeRate */ + // #[SerializedName('cac:PaymentExchangeRate')] + // public $PaymentExchangeRate; + + // /** @var PaymentAlternativeExchangeRate */ + // #[SerializedName('cac:PaymentAlternativeExchangeRate')] + // public $PaymentAlternativeExchangeRate; + + // /** @var TaxTotal[] */ + // #[SerializedName('cac:TaxTotal')] + // public array $TaxTotal; + + // /** @var WithholdingTaxTotal[] */ + // #[SerializedName('cac:WithholdingTaxTotal')] + // public array $WithholdingTaxTotal; + + // /** @var LegalMonetaryTotal */ + // #[NotNull] + // #[NotBlank] + // #[Valid] + // #[SerializedName('cac:LegalMonetaryTotal')] + // public $LegalMonetaryTotal; + + // /** @var InvoiceLine[] */ + // #[NotNull] + // #[NotBlank] + // #[Valid] + // #[SerializedName('cac:InvoiceLine')] + // public array $InvoiceLine; +}