From f22de1aa99924f6721be1ab4a593f76e935661b9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 6 Dec 2025 03:16:16 +0000 Subject: [PATCH 1/9] feat: allow both model class instances and arrays in setters --- scripts/lint | 2 +- src/Documents/Allowance.php | 20 +- .../Attachments/AttachmentAddParams.php | 4 +- .../Attachments/AttachmentDeleteParams.php | 4 +- .../Attachments/AttachmentDeleteResponse.php | 4 +- .../Attachments/AttachmentRetrieveParams.php | 4 +- .../Attachments/DocumentAttachment.php | 20 +- src/Documents/Charge.php | 20 +- src/Documents/DocumentAttachmentCreate.php | 16 +- src/Documents/DocumentCreate.php | 273 +++++++++----- src/Documents/DocumentCreate/Allowance.php | 20 +- src/Documents/DocumentCreate/Charge.php | 20 +- src/Documents/DocumentCreate/Item.php | 82 +++-- .../DocumentCreate/Item/Allowance.php | 20 +- src/Documents/DocumentCreate/Item/Charge.php | 20 +- src/Documents/DocumentCreate/TaxDetail.php | 8 +- src/Documents/DocumentCreateFromPdfParams.php | 12 +- src/Documents/DocumentCreateParams.php | 347 +++++++++++------ .../DocumentCreateParams/Allowance.php | 20 +- src/Documents/DocumentCreateParams/Charge.php | 20 +- src/Documents/DocumentCreateParams/Item.php | 82 +++-- .../DocumentCreateParams/Item/Allowance.php | 20 +- .../DocumentCreateParams/Item/Charge.php | 20 +- .../DocumentCreateParams/TaxDetail.php | 8 +- src/Documents/DocumentDeleteResponse.php | 4 +- src/Documents/DocumentNewFromPdfResponse.php | 277 +++++++++----- .../DocumentNewFromPdfResponse/Item.php | 82 +++-- .../DocumentNewFromPdfResponse/TaxDetail.php | 8 +- src/Documents/DocumentResponse.php | 285 +++++++++----- src/Documents/DocumentResponse/Allowance.php | 20 +- src/Documents/DocumentResponse/Charge.php | 20 +- src/Documents/DocumentResponse/Item.php | 82 +++-- .../DocumentResponse/PaymentDetail.php | 16 +- src/Documents/DocumentResponse/TaxDetail.php | 8 +- src/Documents/DocumentSendParams.php | 20 +- src/Documents/PaymentDetailCreate.php | 16 +- src/Documents/Ubl/UblCreateFromUblParams.php | 4 +- src/Documents/Ubl/UblGetResponse.php | 42 +-- src/Inbox/InboxListCreditNotesParams.php | 8 +- src/Inbox/InboxListInvoicesParams.php | 8 +- src/Inbox/InboxListParams.php | 24 +- src/Inbox/PaginatedDocumentResponse.php | 133 ++++++- src/Lookup/Certificate.php | 12 +- src/Lookup/LookupGetParticipantsResponse.php | 36 +- .../Participant.php | 41 ++- .../Participant/DocumentType.php | 8 +- .../Participant/Entity.php | 32 +- .../Participant/Entity/Identifier.php | 8 +- src/Lookup/LookupGetResponse.php | 116 ++++-- src/Lookup/LookupGetResponse/BusinessCard.php | 30 +- .../LookupGetResponse/BusinessCard/Entity.php | 16 +- src/Lookup/LookupGetResponse/DNSInfo.php | 20 +- .../LookupGetResponse/DNSInfo/DNSRecord.php | 4 +- .../LookupGetResponse/QueryMetadata.php | 20 +- .../LookupGetResponse/ServiceMetadata.php | 34 +- .../ServiceMetadata/Endpoint.php | 35 +- .../ServiceMetadata/Endpoint/DocumentType.php | 8 +- .../ServiceMetadata/Endpoint/Process.php | 42 ++- .../Endpoint/Process/Endpoint.php | 44 ++- .../Endpoint/Process/ProcessID.php | 8 +- src/Lookup/LookupRetrieveParams.php | 4 +- .../LookupRetrieveParticipantsParams.php | 8 +- src/Me/MeGetResponse.php | 64 ++-- src/Outbox/OutboxListDraftDocumentsParams.php | 8 +- .../OutboxListReceivedDocumentsParams.php | 24 +- src/Validate/UblDocumentValidation.php | 41 ++- src/Validate/UblDocumentValidation/Issue.php | 24 +- src/Validate/ValidateValidateJsonParams.php | 348 ++++++++++++------ .../ValidateValidateJsonParams/Allowance.php | 20 +- .../ValidateValidateJsonParams/Charge.php | 20 +- .../ValidateValidateJsonParams/Item.php | 82 +++-- .../Item/Allowance.php | 20 +- .../Item/Charge.php | 20 +- .../ValidateValidateJsonParams/TaxDetail.php | 8 +- .../ValidateValidatePeppolIDParams.php | 4 +- .../ValidateValidatePeppolIDResponse.php | 38 +- .../BusinessCard.php | 12 +- src/Validate/ValidateValidateUblParams.php | 4 +- src/Webhooks/WebhookCreateParams.php | 12 +- src/Webhooks/WebhookDeleteResponse.php | 4 +- src/Webhooks/WebhookResponse.php | 20 +- src/Webhooks/WebhookUpdateParams.php | 12 +- 82 files changed, 2195 insertions(+), 1239 deletions(-) diff --git a/scripts/lint b/scripts/lint index 13f2f013..211ce906 100755 --- a/scripts/lint +++ b/scripts/lint @@ -5,4 +5,4 @@ set -e cd -- "$(dirname -- "$0")/.." echo "==> Running PHPStan" -exec -- ./vendor/bin/phpstan analyse --memory-limit=2G +exec -- ./vendor/bin/phpstan analyse --memory-limit=12G diff --git a/src/Documents/Allowance.php b/src/Documents/Allowance.php index 55aa3ff0..72c792c5 100644 --- a/src/Documents/Allowance.php +++ b/src/Documents/Allowance.php @@ -98,13 +98,13 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $base_amount && $obj->base_amount = $base_amount; - null !== $multiplier_factor && $obj->multiplier_factor = $multiplier_factor; - null !== $reason && $obj->reason = $reason; + null !== $amount && $obj['amount'] = $amount; + null !== $base_amount && $obj['base_amount'] = $base_amount; + null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $reason && $obj['reason'] = $reason; null !== $reason_code && $obj['reason_code'] = $reason_code; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; return $obj; } @@ -115,7 +115,7 @@ public static function with( public function withAmount(?string $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -126,7 +126,7 @@ public function withAmount(?string $amount): self public function withBaseAmount(?string $baseAmount): self { $obj = clone $this; - $obj->base_amount = $baseAmount; + $obj['base_amount'] = $baseAmount; return $obj; } @@ -137,7 +137,7 @@ public function withBaseAmount(?string $baseAmount): self public function withMultiplierFactor(?string $multiplierFactor): self { $obj = clone $this; - $obj->multiplier_factor = $multiplierFactor; + $obj['multiplier_factor'] = $multiplierFactor; return $obj; } @@ -148,7 +148,7 @@ public function withMultiplierFactor(?string $multiplierFactor): self public function withReason(?string $reason): self { $obj = clone $this; - $obj->reason = $reason; + $obj['reason'] = $reason; return $obj; } @@ -185,7 +185,7 @@ public function withTaxCode(TaxCode|string $taxCode): self public function withTaxRate(?string $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } diff --git a/src/Documents/Attachments/AttachmentAddParams.php b/src/Documents/Attachments/AttachmentAddParams.php index f9b683e8..7716ed36 100644 --- a/src/Documents/Attachments/AttachmentAddParams.php +++ b/src/Documents/Attachments/AttachmentAddParams.php @@ -53,7 +53,7 @@ public static function with(string $file): self { $obj = new self; - $obj->file = $file; + $obj['file'] = $file; return $obj; } @@ -61,7 +61,7 @@ public static function with(string $file): self public function withFile(string $file): self { $obj = clone $this; - $obj->file = $file; + $obj['file'] = $file; return $obj; } diff --git a/src/Documents/Attachments/AttachmentDeleteParams.php b/src/Documents/Attachments/AttachmentDeleteParams.php index 33e7aafb..a5a3b26d 100644 --- a/src/Documents/Attachments/AttachmentDeleteParams.php +++ b/src/Documents/Attachments/AttachmentDeleteParams.php @@ -53,7 +53,7 @@ public static function with(string $document_id): self { $obj = new self; - $obj->document_id = $document_id; + $obj['document_id'] = $document_id; return $obj; } @@ -61,7 +61,7 @@ public static function with(string $document_id): self public function withDocumentID(string $documentID): self { $obj = clone $this; - $obj->document_id = $documentID; + $obj['document_id'] = $documentID; return $obj; } diff --git a/src/Documents/Attachments/AttachmentDeleteResponse.php b/src/Documents/Attachments/AttachmentDeleteResponse.php index 0e422a5f..614f35e4 100644 --- a/src/Documents/Attachments/AttachmentDeleteResponse.php +++ b/src/Documents/Attachments/AttachmentDeleteResponse.php @@ -51,7 +51,7 @@ public static function with(bool $is_deleted): self { $obj = new self; - $obj->is_deleted = $is_deleted; + $obj['is_deleted'] = $is_deleted; return $obj; } @@ -59,7 +59,7 @@ public static function with(bool $is_deleted): self public function withIsDeleted(bool $isDeleted): self { $obj = clone $this; - $obj->is_deleted = $isDeleted; + $obj['is_deleted'] = $isDeleted; return $obj; } diff --git a/src/Documents/Attachments/AttachmentRetrieveParams.php b/src/Documents/Attachments/AttachmentRetrieveParams.php index 42c30abe..c3628bce 100644 --- a/src/Documents/Attachments/AttachmentRetrieveParams.php +++ b/src/Documents/Attachments/AttachmentRetrieveParams.php @@ -53,7 +53,7 @@ public static function with(string $document_id): self { $obj = new self; - $obj->document_id = $document_id; + $obj['document_id'] = $document_id; return $obj; } @@ -61,7 +61,7 @@ public static function with(string $document_id): self public function withDocumentID(string $documentID): self { $obj = clone $this; - $obj->document_id = $documentID; + $obj['document_id'] = $documentID; return $obj; } diff --git a/src/Documents/Attachments/DocumentAttachment.php b/src/Documents/Attachments/DocumentAttachment.php index 88fbabe0..a8c47e19 100644 --- a/src/Documents/Attachments/DocumentAttachment.php +++ b/src/Documents/Attachments/DocumentAttachment.php @@ -74,12 +74,12 @@ public static function with( ): self { $obj = new self; - $obj->id = $id; - $obj->file_name = $file_name; + $obj['id'] = $id; + $obj['file_name'] = $file_name; - null !== $file_size && $obj->file_size = $file_size; - null !== $file_type && $obj->file_type = $file_type; - null !== $file_url && $obj->file_url = $file_url; + null !== $file_size && $obj['file_size'] = $file_size; + null !== $file_type && $obj['file_type'] = $file_type; + null !== $file_url && $obj['file_url'] = $file_url; return $obj; } @@ -87,7 +87,7 @@ public static function with( public function withID(string $id): self { $obj = clone $this; - $obj->id = $id; + $obj['id'] = $id; return $obj; } @@ -95,7 +95,7 @@ public function withID(string $id): self public function withFileName(string $fileName): self { $obj = clone $this; - $obj->file_name = $fileName; + $obj['file_name'] = $fileName; return $obj; } @@ -103,7 +103,7 @@ public function withFileName(string $fileName): self public function withFileSize(int $fileSize): self { $obj = clone $this; - $obj->file_size = $fileSize; + $obj['file_size'] = $fileSize; return $obj; } @@ -111,7 +111,7 @@ public function withFileSize(int $fileSize): self public function withFileType(string $fileType): self { $obj = clone $this; - $obj->file_type = $fileType; + $obj['file_type'] = $fileType; return $obj; } @@ -119,7 +119,7 @@ public function withFileType(string $fileType): self public function withFileURL(?string $fileURL): self { $obj = clone $this; - $obj->file_url = $fileURL; + $obj['file_url'] = $fileURL; return $obj; } diff --git a/src/Documents/Charge.php b/src/Documents/Charge.php index 3b17e8d5..715f0d7a 100644 --- a/src/Documents/Charge.php +++ b/src/Documents/Charge.php @@ -102,13 +102,13 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $base_amount && $obj->base_amount = $base_amount; - null !== $multiplier_factor && $obj->multiplier_factor = $multiplier_factor; - null !== $reason && $obj->reason = $reason; + null !== $amount && $obj['amount'] = $amount; + null !== $base_amount && $obj['base_amount'] = $base_amount; + null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $reason && $obj['reason'] = $reason; null !== $reason_code && $obj['reason_code'] = $reason_code; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; return $obj; } @@ -119,7 +119,7 @@ public static function with( public function withAmount(?string $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -130,7 +130,7 @@ public function withAmount(?string $amount): self public function withBaseAmount(?string $baseAmount): self { $obj = clone $this; - $obj->base_amount = $baseAmount; + $obj['base_amount'] = $baseAmount; return $obj; } @@ -141,7 +141,7 @@ public function withBaseAmount(?string $baseAmount): self public function withMultiplierFactor(?string $multiplierFactor): self { $obj = clone $this; - $obj->multiplier_factor = $multiplierFactor; + $obj['multiplier_factor'] = $multiplierFactor; return $obj; } @@ -152,7 +152,7 @@ public function withMultiplierFactor(?string $multiplierFactor): self public function withReason(?string $reason): self { $obj = clone $this; - $obj->reason = $reason; + $obj['reason'] = $reason; return $obj; } @@ -193,7 +193,7 @@ public function withTaxCode(TaxCode|string|null $taxCode): self public function withTaxRate(?string $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentAttachmentCreate.php b/src/Documents/DocumentAttachmentCreate.php index a25aa604..5c0b5c4c 100644 --- a/src/Documents/DocumentAttachmentCreate.php +++ b/src/Documents/DocumentAttachmentCreate.php @@ -68,11 +68,11 @@ public static function with( ): self { $obj = new self; - $obj->file_name = $file_name; + $obj['file_name'] = $file_name; - null !== $file_data && $obj->file_data = $file_data; - null !== $file_size && $obj->file_size = $file_size; - null !== $file_type && $obj->file_type = $file_type; + null !== $file_data && $obj['file_data'] = $file_data; + null !== $file_size && $obj['file_size'] = $file_size; + null !== $file_type && $obj['file_type'] = $file_type; return $obj; } @@ -80,7 +80,7 @@ public static function with( public function withFileName(string $fileName): self { $obj = clone $this; - $obj->file_name = $fileName; + $obj['file_name'] = $fileName; return $obj; } @@ -91,7 +91,7 @@ public function withFileName(string $fileName): self public function withFileData(?string $fileData): self { $obj = clone $this; - $obj->file_data = $fileData; + $obj['file_data'] = $fileData; return $obj; } @@ -99,7 +99,7 @@ public function withFileData(?string $fileData): self public function withFileSize(int $fileSize): self { $obj = clone $this; - $obj->file_size = $fileSize; + $obj['file_size'] = $fileSize; return $obj; } @@ -107,7 +107,7 @@ public function withFileSize(int $fileSize): self public function withFileType(string $fileType): self { $obj = clone $this; - $obj->file_type = $fileType; + $obj['file_type'] = $fileType; return $obj; } diff --git a/src/Documents/DocumentCreate.php b/src/Documents/DocumentCreate.php index 37531e02..6e315c05 100644 --- a/src/Documents/DocumentCreate.php +++ b/src/Documents/DocumentCreate.php @@ -8,6 +8,7 @@ use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\DocumentCreate\Allowance; +use EInvoiceAPI\Documents\DocumentCreate\Allowance\ReasonCode; use EInvoiceAPI\Documents\DocumentCreate\Charge; use EInvoiceAPI\Documents\DocumentCreate\Item; use EInvoiceAPI\Documents\DocumentCreate\TaxCode; @@ -385,17 +386,57 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list|null $allowances - * @param list|null $attachments - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $allowances + * @param list|null $attachments + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $charges * @param CurrencyCode|value-of $currency * @param DocumentDirection|value-of $direction * @param DocumentType|value-of $document_type - * @param list $items - * @param list|null $payment_details + * @param list|null, + * amount?: float|string|null, + * charges?: list|null, + * date?: null|null, + * description?: string|null, + * product_code?: string|null, + * quantity?: float|string|null, + * tax?: float|string|null, + * tax_rate?: float|string|null, + * unit?: value-of|null, + * unit_price?: float|string|null, + * }> $items + * @param list|null $payment_details * @param DocumentState|value-of $state * @param TaxCode|value-of $tax_code - * @param list|null $tax_details + * @param list|null $tax_details * @param Vatex|value-of|null $vatex */ public static function with( @@ -450,65 +491,73 @@ public static function with( ): self { $obj = new self; - null !== $allowances && $obj->allowances = $allowances; - null !== $amount_due && $obj->amount_due = $amount_due; - null !== $attachments && $obj->attachments = $attachments; - null !== $billing_address && $obj->billing_address = $billing_address; - null !== $billing_address_recipient && $obj->billing_address_recipient = $billing_address_recipient; - null !== $charges && $obj->charges = $charges; + null !== $allowances && $obj['allowances'] = $allowances; + null !== $amount_due && $obj['amount_due'] = $amount_due; + null !== $attachments && $obj['attachments'] = $attachments; + null !== $billing_address && $obj['billing_address'] = $billing_address; + null !== $billing_address_recipient && $obj['billing_address_recipient'] = $billing_address_recipient; + null !== $charges && $obj['charges'] = $charges; null !== $currency && $obj['currency'] = $currency; - null !== $customer_address && $obj->customer_address = $customer_address; - null !== $customer_address_recipient && $obj->customer_address_recipient = $customer_address_recipient; - null !== $customer_company_id && $obj->customer_company_id = $customer_company_id; - null !== $customer_email && $obj->customer_email = $customer_email; - null !== $customer_id && $obj->customer_id = $customer_id; - null !== $customer_name && $obj->customer_name = $customer_name; - null !== $customer_tax_id && $obj->customer_tax_id = $customer_tax_id; + null !== $customer_address && $obj['customer_address'] = $customer_address; + null !== $customer_address_recipient && $obj['customer_address_recipient'] = $customer_address_recipient; + null !== $customer_company_id && $obj['customer_company_id'] = $customer_company_id; + null !== $customer_email && $obj['customer_email'] = $customer_email; + null !== $customer_id && $obj['customer_id'] = $customer_id; + null !== $customer_name && $obj['customer_name'] = $customer_name; + null !== $customer_tax_id && $obj['customer_tax_id'] = $customer_tax_id; null !== $direction && $obj['direction'] = $direction; null !== $document_type && $obj['document_type'] = $document_type; - null !== $due_date && $obj->due_date = $due_date; - null !== $invoice_date && $obj->invoice_date = $invoice_date; - null !== $invoice_id && $obj->invoice_id = $invoice_id; - null !== $invoice_total && $obj->invoice_total = $invoice_total; - null !== $items && $obj->items = $items; - null !== $note && $obj->note = $note; - null !== $payment_details && $obj->payment_details = $payment_details; - null !== $payment_term && $obj->payment_term = $payment_term; - null !== $previous_unpaid_balance && $obj->previous_unpaid_balance = $previous_unpaid_balance; - null !== $purchase_order && $obj->purchase_order = $purchase_order; - null !== $remittance_address && $obj->remittance_address = $remittance_address; - null !== $remittance_address_recipient && $obj->remittance_address_recipient = $remittance_address_recipient; - null !== $service_address && $obj->service_address = $service_address; - null !== $service_address_recipient && $obj->service_address_recipient = $service_address_recipient; - null !== $service_end_date && $obj->service_end_date = $service_end_date; - null !== $service_start_date && $obj->service_start_date = $service_start_date; - null !== $shipping_address && $obj->shipping_address = $shipping_address; - null !== $shipping_address_recipient && $obj->shipping_address_recipient = $shipping_address_recipient; + null !== $due_date && $obj['due_date'] = $due_date; + null !== $invoice_date && $obj['invoice_date'] = $invoice_date; + null !== $invoice_id && $obj['invoice_id'] = $invoice_id; + null !== $invoice_total && $obj['invoice_total'] = $invoice_total; + null !== $items && $obj['items'] = $items; + null !== $note && $obj['note'] = $note; + null !== $payment_details && $obj['payment_details'] = $payment_details; + null !== $payment_term && $obj['payment_term'] = $payment_term; + null !== $previous_unpaid_balance && $obj['previous_unpaid_balance'] = $previous_unpaid_balance; + null !== $purchase_order && $obj['purchase_order'] = $purchase_order; + null !== $remittance_address && $obj['remittance_address'] = $remittance_address; + null !== $remittance_address_recipient && $obj['remittance_address_recipient'] = $remittance_address_recipient; + null !== $service_address && $obj['service_address'] = $service_address; + null !== $service_address_recipient && $obj['service_address_recipient'] = $service_address_recipient; + null !== $service_end_date && $obj['service_end_date'] = $service_end_date; + null !== $service_start_date && $obj['service_start_date'] = $service_start_date; + null !== $shipping_address && $obj['shipping_address'] = $shipping_address; + null !== $shipping_address_recipient && $obj['shipping_address_recipient'] = $shipping_address_recipient; null !== $state && $obj['state'] = $state; - null !== $subtotal && $obj->subtotal = $subtotal; + null !== $subtotal && $obj['subtotal'] = $subtotal; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_details && $obj->tax_details = $tax_details; - null !== $total_discount && $obj->total_discount = $total_discount; - null !== $total_tax && $obj->total_tax = $total_tax; + null !== $tax_details && $obj['tax_details'] = $tax_details; + null !== $total_discount && $obj['total_discount'] = $total_discount; + null !== $total_tax && $obj['total_tax'] = $total_tax; null !== $vatex && $obj['vatex'] = $vatex; - null !== $vatex_note && $obj->vatex_note = $vatex_note; - null !== $vendor_address && $obj->vendor_address = $vendor_address; - null !== $vendor_address_recipient && $obj->vendor_address_recipient = $vendor_address_recipient; - null !== $vendor_company_id && $obj->vendor_company_id = $vendor_company_id; - null !== $vendor_email && $obj->vendor_email = $vendor_email; - null !== $vendor_name && $obj->vendor_name = $vendor_name; - null !== $vendor_tax_id && $obj->vendor_tax_id = $vendor_tax_id; + null !== $vatex_note && $obj['vatex_note'] = $vatex_note; + null !== $vendor_address && $obj['vendor_address'] = $vendor_address; + null !== $vendor_address_recipient && $obj['vendor_address_recipient'] = $vendor_address_recipient; + null !== $vendor_company_id && $obj['vendor_company_id'] = $vendor_company_id; + null !== $vendor_email && $obj['vendor_email'] = $vendor_email; + null !== $vendor_name && $obj['vendor_name'] = $vendor_name; + null !== $vendor_tax_id && $obj['vendor_tax_id'] = $vendor_tax_id; return $obj; } /** - * @param list|null $allowances + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $allowances */ public function withAllowances(?array $allowances): self { $obj = clone $this; - $obj->allowances = $allowances; + $obj['allowances'] = $allowances; return $obj; } @@ -519,18 +568,23 @@ public function withAllowances(?array $allowances): self public function withAmountDue(float|string|null $amountDue): self { $obj = clone $this; - $obj->amount_due = $amountDue; + $obj['amount_due'] = $amountDue; return $obj; } /** - * @param list|null $attachments + * @param list|null $attachments */ public function withAttachments(?array $attachments): self { $obj = clone $this; - $obj->attachments = $attachments; + $obj['attachments'] = $attachments; return $obj; } @@ -541,7 +595,7 @@ public function withAttachments(?array $attachments): self public function withBillingAddress(?string $billingAddress): self { $obj = clone $this; - $obj->billing_address = $billingAddress; + $obj['billing_address'] = $billingAddress; return $obj; } @@ -553,18 +607,26 @@ public function withBillingAddressRecipient( ?string $billingAddressRecipient ): self { $obj = clone $this; - $obj->billing_address_recipient = $billingAddressRecipient; + $obj['billing_address_recipient'] = $billingAddressRecipient; return $obj; } /** - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $charges */ public function withCharges(?array $charges): self { $obj = clone $this; - $obj->charges = $charges; + $obj['charges'] = $charges; return $obj; } @@ -588,7 +650,7 @@ public function withCurrency(CurrencyCode|string $currency): self public function withCustomerAddress(?string $customerAddress): self { $obj = clone $this; - $obj->customer_address = $customerAddress; + $obj['customer_address'] = $customerAddress; return $obj; } @@ -600,7 +662,7 @@ public function withCustomerAddressRecipient( ?string $customerAddressRecipient ): self { $obj = clone $this; - $obj->customer_address_recipient = $customerAddressRecipient; + $obj['customer_address_recipient'] = $customerAddressRecipient; return $obj; } @@ -611,7 +673,7 @@ public function withCustomerAddressRecipient( public function withCustomerCompanyID(?string $customerCompanyID): self { $obj = clone $this; - $obj->customer_company_id = $customerCompanyID; + $obj['customer_company_id'] = $customerCompanyID; return $obj; } @@ -622,7 +684,7 @@ public function withCustomerCompanyID(?string $customerCompanyID): self public function withCustomerEmail(?string $customerEmail): self { $obj = clone $this; - $obj->customer_email = $customerEmail; + $obj['customer_email'] = $customerEmail; return $obj; } @@ -633,7 +695,7 @@ public function withCustomerEmail(?string $customerEmail): self public function withCustomerID(?string $customerID): self { $obj = clone $this; - $obj->customer_id = $customerID; + $obj['customer_id'] = $customerID; return $obj; } @@ -644,7 +706,7 @@ public function withCustomerID(?string $customerID): self public function withCustomerName(?string $customerName): self { $obj = clone $this; - $obj->customer_name = $customerName; + $obj['customer_name'] = $customerName; return $obj; } @@ -655,7 +717,7 @@ public function withCustomerName(?string $customerName): self public function withCustomerTaxID(?string $customerTaxID): self { $obj = clone $this; - $obj->customer_tax_id = $customerTaxID; + $obj['customer_tax_id'] = $customerTaxID; return $obj; } @@ -692,7 +754,7 @@ public function withDocumentType(DocumentType|string $documentType): self public function withDueDate(?\DateTimeInterface $dueDate): self { $obj = clone $this; - $obj->due_date = $dueDate; + $obj['due_date'] = $dueDate; return $obj; } @@ -703,7 +765,7 @@ public function withDueDate(?\DateTimeInterface $dueDate): self public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self { $obj = clone $this; - $obj->invoice_date = $invoiceDate; + $obj['invoice_date'] = $invoiceDate; return $obj; } @@ -714,7 +776,7 @@ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self public function withInvoiceID(?string $invoiceID): self { $obj = clone $this; - $obj->invoice_id = $invoiceID; + $obj['invoice_id'] = $invoiceID; return $obj; } @@ -725,7 +787,7 @@ public function withInvoiceID(?string $invoiceID): self public function withInvoiceTotal(float|string|null $invoiceTotal): self { $obj = clone $this; - $obj->invoice_total = $invoiceTotal; + $obj['invoice_total'] = $invoiceTotal; return $obj; } @@ -733,12 +795,24 @@ public function withInvoiceTotal(float|string|null $invoiceTotal): self /** * At least one line item is required. * - * @param list $items + * @param list|null, + * amount?: float|string|null, + * charges?: list|null, + * date?: null|null, + * description?: string|null, + * product_code?: string|null, + * quantity?: float|string|null, + * tax?: float|string|null, + * tax_rate?: float|string|null, + * unit?: value-of|null, + * unit_price?: float|string|null, + * }> $items */ public function withItems(array $items): self { $obj = clone $this; - $obj->items = $items; + $obj['items'] = $items; return $obj; } @@ -749,18 +823,23 @@ public function withItems(array $items): self public function withNote(?string $note): self { $obj = clone $this; - $obj->note = $note; + $obj['note'] = $note; return $obj; } /** - * @param list|null $paymentDetails + * @param list|null $paymentDetails */ public function withPaymentDetails(?array $paymentDetails): self { $obj = clone $this; - $obj->payment_details = $paymentDetails; + $obj['payment_details'] = $paymentDetails; return $obj; } @@ -771,7 +850,7 @@ public function withPaymentDetails(?array $paymentDetails): self public function withPaymentTerm(?string $paymentTerm): self { $obj = clone $this; - $obj->payment_term = $paymentTerm; + $obj['payment_term'] = $paymentTerm; return $obj; } @@ -783,7 +862,7 @@ public function withPreviousUnpaidBalance( float|string|null $previousUnpaidBalance ): self { $obj = clone $this; - $obj->previous_unpaid_balance = $previousUnpaidBalance; + $obj['previous_unpaid_balance'] = $previousUnpaidBalance; return $obj; } @@ -794,7 +873,7 @@ public function withPreviousUnpaidBalance( public function withPurchaseOrder(?string $purchaseOrder): self { $obj = clone $this; - $obj->purchase_order = $purchaseOrder; + $obj['purchase_order'] = $purchaseOrder; return $obj; } @@ -805,7 +884,7 @@ public function withPurchaseOrder(?string $purchaseOrder): self public function withRemittanceAddress(?string $remittanceAddress): self { $obj = clone $this; - $obj->remittance_address = $remittanceAddress; + $obj['remittance_address'] = $remittanceAddress; return $obj; } @@ -817,7 +896,7 @@ public function withRemittanceAddressRecipient( ?string $remittanceAddressRecipient ): self { $obj = clone $this; - $obj->remittance_address_recipient = $remittanceAddressRecipient; + $obj['remittance_address_recipient'] = $remittanceAddressRecipient; return $obj; } @@ -828,7 +907,7 @@ public function withRemittanceAddressRecipient( public function withServiceAddress(?string $serviceAddress): self { $obj = clone $this; - $obj->service_address = $serviceAddress; + $obj['service_address'] = $serviceAddress; return $obj; } @@ -840,7 +919,7 @@ public function withServiceAddressRecipient( ?string $serviceAddressRecipient ): self { $obj = clone $this; - $obj->service_address_recipient = $serviceAddressRecipient; + $obj['service_address_recipient'] = $serviceAddressRecipient; return $obj; } @@ -852,7 +931,7 @@ public function withServiceEndDate( ?\DateTimeInterface $serviceEndDate ): self { $obj = clone $this; - $obj->service_end_date = $serviceEndDate; + $obj['service_end_date'] = $serviceEndDate; return $obj; } @@ -864,7 +943,7 @@ public function withServiceStartDate( ?\DateTimeInterface $serviceStartDate ): self { $obj = clone $this; - $obj->service_start_date = $serviceStartDate; + $obj['service_start_date'] = $serviceStartDate; return $obj; } @@ -875,7 +954,7 @@ public function withServiceStartDate( public function withShippingAddress(?string $shippingAddress): self { $obj = clone $this; - $obj->shipping_address = $shippingAddress; + $obj['shipping_address'] = $shippingAddress; return $obj; } @@ -887,7 +966,7 @@ public function withShippingAddressRecipient( ?string $shippingAddressRecipient ): self { $obj = clone $this; - $obj->shipping_address_recipient = $shippingAddressRecipient; + $obj['shipping_address_recipient'] = $shippingAddressRecipient; return $obj; } @@ -911,7 +990,7 @@ public function withState(DocumentState|string $state): self public function withSubtotal(float|string|null $subtotal): self { $obj = clone $this; - $obj->subtotal = $subtotal; + $obj['subtotal'] = $subtotal; return $obj; } @@ -930,12 +1009,14 @@ public function withTaxCode(TaxCode|string $taxCode): self } /** - * @param list|null $taxDetails + * @param list|null $taxDetails */ public function withTaxDetails(?array $taxDetails): self { $obj = clone $this; - $obj->tax_details = $taxDetails; + $obj['tax_details'] = $taxDetails; return $obj; } @@ -946,7 +1027,7 @@ public function withTaxDetails(?array $taxDetails): self public function withTotalDiscount(float|string|null $totalDiscount): self { $obj = clone $this; - $obj->total_discount = $totalDiscount; + $obj['total_discount'] = $totalDiscount; return $obj; } @@ -957,7 +1038,7 @@ public function withTotalDiscount(float|string|null $totalDiscount): self public function withTotalTax(float|string|null $totalTax): self { $obj = clone $this; - $obj->total_tax = $totalTax; + $obj['total_tax'] = $totalTax; return $obj; } @@ -984,7 +1065,7 @@ public function withVatex(Vatex|string|null $vatex): self public function withVatexNote(?string $vatexNote): self { $obj = clone $this; - $obj->vatex_note = $vatexNote; + $obj['vatex_note'] = $vatexNote; return $obj; } @@ -995,7 +1076,7 @@ public function withVatexNote(?string $vatexNote): self public function withVendorAddress(?string $vendorAddress): self { $obj = clone $this; - $obj->vendor_address = $vendorAddress; + $obj['vendor_address'] = $vendorAddress; return $obj; } @@ -1007,7 +1088,7 @@ public function withVendorAddressRecipient( ?string $vendorAddressRecipient ): self { $obj = clone $this; - $obj->vendor_address_recipient = $vendorAddressRecipient; + $obj['vendor_address_recipient'] = $vendorAddressRecipient; return $obj; } @@ -1018,7 +1099,7 @@ public function withVendorAddressRecipient( public function withVendorCompanyID(?string $vendorCompanyID): self { $obj = clone $this; - $obj->vendor_company_id = $vendorCompanyID; + $obj['vendor_company_id'] = $vendorCompanyID; return $obj; } @@ -1029,7 +1110,7 @@ public function withVendorCompanyID(?string $vendorCompanyID): self public function withVendorEmail(?string $vendorEmail): self { $obj = clone $this; - $obj->vendor_email = $vendorEmail; + $obj['vendor_email'] = $vendorEmail; return $obj; } @@ -1040,7 +1121,7 @@ public function withVendorEmail(?string $vendorEmail): self public function withVendorName(?string $vendorName): self { $obj = clone $this; - $obj->vendor_name = $vendorName; + $obj['vendor_name'] = $vendorName; return $obj; } @@ -1051,7 +1132,7 @@ public function withVendorName(?string $vendorName): self public function withVendorTaxID(?string $vendorTaxID): self { $obj = clone $this; - $obj->vendor_tax_id = $vendorTaxID; + $obj['vendor_tax_id'] = $vendorTaxID; return $obj; } diff --git a/src/Documents/DocumentCreate/Allowance.php b/src/Documents/DocumentCreate/Allowance.php index eca26acb..729e820c 100644 --- a/src/Documents/DocumentCreate/Allowance.php +++ b/src/Documents/DocumentCreate/Allowance.php @@ -101,13 +101,13 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $base_amount && $obj->base_amount = $base_amount; - null !== $multiplier_factor && $obj->multiplier_factor = $multiplier_factor; - null !== $reason && $obj->reason = $reason; + null !== $amount && $obj['amount'] = $amount; + null !== $base_amount && $obj['base_amount'] = $base_amount; + null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $reason && $obj['reason'] = $reason; null !== $reason_code && $obj['reason_code'] = $reason_code; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; return $obj; } @@ -118,7 +118,7 @@ public static function with( public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -129,7 +129,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj->base_amount = $baseAmount; + $obj['base_amount'] = $baseAmount; return $obj; } @@ -141,7 +141,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj->multiplier_factor = $multiplierFactor; + $obj['multiplier_factor'] = $multiplierFactor; return $obj; } @@ -152,7 +152,7 @@ public function withMultiplierFactor( public function withReason(?string $reason): self { $obj = clone $this; - $obj->reason = $reason; + $obj['reason'] = $reason; return $obj; } @@ -190,7 +190,7 @@ public function withTaxCode( public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentCreate/Charge.php b/src/Documents/DocumentCreate/Charge.php index 15efa6af..9f6f2597 100644 --- a/src/Documents/DocumentCreate/Charge.php +++ b/src/Documents/DocumentCreate/Charge.php @@ -106,13 +106,13 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $base_amount && $obj->base_amount = $base_amount; - null !== $multiplier_factor && $obj->multiplier_factor = $multiplier_factor; - null !== $reason && $obj->reason = $reason; + null !== $amount && $obj['amount'] = $amount; + null !== $base_amount && $obj['base_amount'] = $base_amount; + null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $reason && $obj['reason'] = $reason; null !== $reason_code && $obj['reason_code'] = $reason_code; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; return $obj; } @@ -123,7 +123,7 @@ public static function with( public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -134,7 +134,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj->base_amount = $baseAmount; + $obj['base_amount'] = $baseAmount; return $obj; } @@ -146,7 +146,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj->multiplier_factor = $multiplierFactor; + $obj['multiplier_factor'] = $multiplierFactor; return $obj; } @@ -157,7 +157,7 @@ public function withMultiplierFactor( public function withReason(?string $reason): self { $obj = clone $this; - $obj->reason = $reason; + $obj['reason'] = $reason; return $obj; } @@ -199,7 +199,7 @@ public function withTaxCode( public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentCreate/Item.php b/src/Documents/DocumentCreate/Item.php index 3524cc41..c4cd4e07 100644 --- a/src/Documents/DocumentCreate/Item.php +++ b/src/Documents/DocumentCreate/Item.php @@ -8,6 +8,8 @@ use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\DocumentCreate\Item\Allowance; +use EInvoiceAPI\Documents\DocumentCreate\Item\Allowance\ReasonCode; +use EInvoiceAPI\Documents\DocumentCreate\Item\Allowance\TaxCode; use EInvoiceAPI\Documents\DocumentCreate\Item\Charge; use EInvoiceAPI\Documents\UnitOfMeasureCode; @@ -119,8 +121,24 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list|null $allowances - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $allowances + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $charges * @param UnitOfMeasureCode|value-of|null $unit */ public static function with( @@ -138,18 +156,18 @@ public static function with( ): self { $obj = new self; - $obj->date = $date; + $obj['date'] = $date; - null !== $allowances && $obj->allowances = $allowances; - null !== $amount && $obj->amount = $amount; - null !== $charges && $obj->charges = $charges; - null !== $description && $obj->description = $description; - null !== $product_code && $obj->product_code = $product_code; - null !== $quantity && $obj->quantity = $quantity; - null !== $tax && $obj->tax = $tax; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $allowances && $obj['allowances'] = $allowances; + null !== $amount && $obj['amount'] = $amount; + null !== $charges && $obj['charges'] = $charges; + null !== $description && $obj['description'] = $description; + null !== $product_code && $obj['product_code'] = $product_code; + null !== $quantity && $obj['quantity'] = $quantity; + null !== $tax && $obj['tax'] = $tax; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; null !== $unit && $obj['unit'] = $unit; - null !== $unit_price && $obj->unit_price = $unit_price; + null !== $unit_price && $obj['unit_price'] = $unit_price; return $obj; } @@ -157,12 +175,20 @@ public static function with( /** * The allowances of the line item. * - * @param list|null $allowances + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $allowances */ public function withAllowances(?array $allowances): self { $obj = clone $this; - $obj->allowances = $allowances; + $obj['allowances'] = $allowances; return $obj; } @@ -173,7 +199,7 @@ public function withAllowances(?array $allowances): self public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -181,12 +207,20 @@ public function withAmount(float|string|null $amount): self /** * The charges of the line item. * - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $charges */ public function withCharges(?array $charges): self { $obj = clone $this; - $obj->charges = $charges; + $obj['charges'] = $charges; return $obj; } @@ -197,7 +231,7 @@ public function withCharges(?array $charges): self public function withDate(null $date): self { $obj = clone $this; - $obj->date = $date; + $obj['date'] = $date; return $obj; } @@ -208,7 +242,7 @@ public function withDate(null $date): self public function withDescription(?string $description): self { $obj = clone $this; - $obj->description = $description; + $obj['description'] = $description; return $obj; } @@ -219,7 +253,7 @@ public function withDescription(?string $description): self public function withProductCode(?string $productCode): self { $obj = clone $this; - $obj->product_code = $productCode; + $obj['product_code'] = $productCode; return $obj; } @@ -230,7 +264,7 @@ public function withProductCode(?string $productCode): self public function withQuantity(float|string|null $quantity): self { $obj = clone $this; - $obj->quantity = $quantity; + $obj['quantity'] = $quantity; return $obj; } @@ -241,7 +275,7 @@ public function withQuantity(float|string|null $quantity): self public function withTax(float|string|null $tax): self { $obj = clone $this; - $obj->tax = $tax; + $obj['tax'] = $tax; return $obj; } @@ -252,7 +286,7 @@ public function withTax(float|string|null $tax): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } @@ -276,7 +310,7 @@ public function withUnit(UnitOfMeasureCode|string|null $unit): self public function withUnitPrice(float|string|null $unitPrice): self { $obj = clone $this; - $obj->unit_price = $unitPrice; + $obj['unit_price'] = $unitPrice; return $obj; } diff --git a/src/Documents/DocumentCreate/Item/Allowance.php b/src/Documents/DocumentCreate/Item/Allowance.php index 5ce570cd..042b2fb0 100644 --- a/src/Documents/DocumentCreate/Item/Allowance.php +++ b/src/Documents/DocumentCreate/Item/Allowance.php @@ -98,13 +98,13 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $base_amount && $obj->base_amount = $base_amount; - null !== $multiplier_factor && $obj->multiplier_factor = $multiplier_factor; - null !== $reason && $obj->reason = $reason; + null !== $amount && $obj['amount'] = $amount; + null !== $base_amount && $obj['base_amount'] = $base_amount; + null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $reason && $obj['reason'] = $reason; null !== $reason_code && $obj['reason_code'] = $reason_code; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; return $obj; } @@ -115,7 +115,7 @@ public static function with( public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -126,7 +126,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj->base_amount = $baseAmount; + $obj['base_amount'] = $baseAmount; return $obj; } @@ -138,7 +138,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj->multiplier_factor = $multiplierFactor; + $obj['multiplier_factor'] = $multiplierFactor; return $obj; } @@ -149,7 +149,7 @@ public function withMultiplierFactor( public function withReason(?string $reason): self { $obj = clone $this; - $obj->reason = $reason; + $obj['reason'] = $reason; return $obj; } @@ -186,7 +186,7 @@ public function withTaxCode(TaxCode|string $taxCode): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentCreate/Item/Charge.php b/src/Documents/DocumentCreate/Item/Charge.php index 78aa4a8f..0f020506 100644 --- a/src/Documents/DocumentCreate/Item/Charge.php +++ b/src/Documents/DocumentCreate/Item/Charge.php @@ -102,13 +102,13 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $base_amount && $obj->base_amount = $base_amount; - null !== $multiplier_factor && $obj->multiplier_factor = $multiplier_factor; - null !== $reason && $obj->reason = $reason; + null !== $amount && $obj['amount'] = $amount; + null !== $base_amount && $obj['base_amount'] = $base_amount; + null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $reason && $obj['reason'] = $reason; null !== $reason_code && $obj['reason_code'] = $reason_code; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; return $obj; } @@ -119,7 +119,7 @@ public static function with( public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -130,7 +130,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj->base_amount = $baseAmount; + $obj['base_amount'] = $baseAmount; return $obj; } @@ -142,7 +142,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj->multiplier_factor = $multiplierFactor; + $obj['multiplier_factor'] = $multiplierFactor; return $obj; } @@ -153,7 +153,7 @@ public function withMultiplierFactor( public function withReason(?string $reason): self { $obj = clone $this; - $obj->reason = $reason; + $obj['reason'] = $reason; return $obj; } @@ -194,7 +194,7 @@ public function withTaxCode(TaxCode|string|null $taxCode): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentCreate/TaxDetail.php b/src/Documents/DocumentCreate/TaxDetail.php index c19099d6..7ee5e1b8 100644 --- a/src/Documents/DocumentCreate/TaxDetail.php +++ b/src/Documents/DocumentCreate/TaxDetail.php @@ -46,8 +46,8 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $rate && $obj->rate = $rate; + null !== $amount && $obj['amount'] = $amount; + null !== $rate && $obj['rate'] = $rate; return $obj; } @@ -58,7 +58,7 @@ public static function with( public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -69,7 +69,7 @@ public function withAmount(float|string|null $amount): self public function withRate(?string $rate): self { $obj = clone $this; - $obj->rate = $rate; + $obj['rate'] = $rate; return $obj; } diff --git a/src/Documents/DocumentCreateFromPdfParams.php b/src/Documents/DocumentCreateFromPdfParams.php index b2b642cc..f7229f9b 100644 --- a/src/Documents/DocumentCreateFromPdfParams.php +++ b/src/Documents/DocumentCreateFromPdfParams.php @@ -64,10 +64,10 @@ public static function with( ): self { $obj = new self; - $obj->file = $file; + $obj['file'] = $file; - null !== $customer_tax_id && $obj->customer_tax_id = $customer_tax_id; - null !== $vendor_tax_id && $obj->vendor_tax_id = $vendor_tax_id; + null !== $customer_tax_id && $obj['customer_tax_id'] = $customer_tax_id; + null !== $vendor_tax_id && $obj['vendor_tax_id'] = $vendor_tax_id; return $obj; } @@ -75,7 +75,7 @@ public static function with( public function withFile(string $file): self { $obj = clone $this; - $obj->file = $file; + $obj['file'] = $file; return $obj; } @@ -83,7 +83,7 @@ public function withFile(string $file): self public function withCustomerTaxID(?string $customerTaxID): self { $obj = clone $this; - $obj->customer_tax_id = $customerTaxID; + $obj['customer_tax_id'] = $customerTaxID; return $obj; } @@ -91,7 +91,7 @@ public function withCustomerTaxID(?string $customerTaxID): self public function withVendorTaxID(?string $vendorTaxID): self { $obj = clone $this; - $obj->vendor_tax_id = $vendorTaxID; + $obj['vendor_tax_id'] = $vendorTaxID; return $obj; } diff --git a/src/Documents/DocumentCreateParams.php b/src/Documents/DocumentCreateParams.php index 53fd7e91..f630192a 100644 --- a/src/Documents/DocumentCreateParams.php +++ b/src/Documents/DocumentCreateParams.php @@ -9,9 +9,10 @@ use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\DocumentCreateParams\Allowance; +use EInvoiceAPI\Documents\DocumentCreateParams\Allowance\ReasonCode; +use EInvoiceAPI\Documents\DocumentCreateParams\Allowance\TaxCode; use EInvoiceAPI\Documents\DocumentCreateParams\Charge; use EInvoiceAPI\Documents\DocumentCreateParams\Item; -use EInvoiceAPI\Documents\DocumentCreateParams\TaxCode; use EInvoiceAPI\Documents\DocumentCreateParams\TaxDetail; use EInvoiceAPI\Documents\DocumentCreateParams\Vatex; use EInvoiceAPI\Inbox\DocumentState; @@ -22,12 +23,33 @@ * @see EInvoiceAPI\Services\DocumentsService::create() * * @phpstan-type DocumentCreateParamsShape = array{ - * allowances?: list<\EInvoiceAPI\Documents\DocumentCreateParams\Allowance>|null, + * allowances?: list<\EInvoiceAPI\Documents\DocumentCreateParams\Allowance|array{ + * amount?: float|string|null, + * base_amount?: float|string|null, + * multiplier_factor?: float|string|null, + * reason?: string|null, + * reason_code?: value-of|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null, * amount_due?: float|string|null, - * attachments?: list|null, + * attachments?: list|null, * billing_address?: string|null, * billing_address_recipient?: string|null, - * charges?: list<\EInvoiceAPI\Documents\DocumentCreateParams\Charge>|null, + * charges?: list<\EInvoiceAPI\Documents\DocumentCreateParams\Charge|array{ + * amount?: float|string|null, + * base_amount?: float|string|null, + * multiplier_factor?: float|string|null, + * reason?: string|null, + * reason_code?: value-of<\EInvoiceAPI\Documents\DocumentCreateParams\Charge\ReasonCode>|null, + * tax_code?: value-of<\EInvoiceAPI\Documents\DocumentCreateParams\Charge\TaxCode>|null, + * tax_rate?: float|string|null, + * }>|null, * currency?: CurrencyCode|value-of, * customer_address?: string|null, * customer_address_recipient?: string|null, @@ -42,9 +64,26 @@ * invoice_date?: \DateTimeInterface|null, * invoice_id?: string|null, * invoice_total?: float|string|null, - * items?: list, + * items?: list|null, + * amount?: float|string|null, + * charges?: list<\EInvoiceAPI\Documents\DocumentCreateParams\Item\Charge>|null, + * date?: null|null, + * description?: string|null, + * product_code?: string|null, + * quantity?: float|string|null, + * tax?: float|string|null, + * tax_rate?: float|string|null, + * unit?: value-of|null, + * unit_price?: float|string|null, + * }>, * note?: string|null, - * payment_details?: list|null, + * payment_details?: list|null, * payment_term?: string|null, * previous_unpaid_balance?: float|string|null, * purchase_order?: string|null, @@ -58,8 +97,10 @@ * shipping_address_recipient?: string|null, * state?: DocumentState|value-of, * subtotal?: float|string|null, - * tax_code?: TaxCode|value-of, - * tax_details?: list|null, + * tax_code?: \EInvoiceAPI\Documents\DocumentCreateParams\TaxCode|value-of<\EInvoiceAPI\Documents\DocumentCreateParams\TaxCode>, + * tax_details?: list|null, * total_discount?: float|string|null, * total_tax?: float|string|null, * vatex?: null|Vatex|value-of, @@ -309,9 +350,12 @@ final class DocumentCreateParams implements BaseModel /** * Tax category code of the invoice (e.g., S for standard rate, Z for zero rate, E for exempt). * - * @var value-of|null $tax_code + * @var value-of|null $tax_code */ - #[Api(enum: TaxCode::class, optional: true)] + #[Api( + enum: DocumentCreateParams\TaxCode::class, + optional: true, + )] public ?string $tax_code; /** @var list|null $tax_details */ @@ -393,17 +437,57 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list|null $allowances - * @param list|null $attachments - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $allowances + * @param list|null $attachments + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $charges * @param CurrencyCode|value-of $currency * @param DocumentDirection|value-of $direction * @param DocumentType|value-of $document_type - * @param list $items - * @param list|null $payment_details + * @param list|null, + * amount?: float|string|null, + * charges?: list|null, + * date?: null|null, + * description?: string|null, + * product_code?: string|null, + * quantity?: float|string|null, + * tax?: float|string|null, + * tax_rate?: float|string|null, + * unit?: value-of|null, + * unit_price?: float|string|null, + * }> $items + * @param list|null $payment_details * @param DocumentState|value-of $state - * @param TaxCode|value-of $tax_code - * @param list|null $tax_details + * @param DocumentCreateParams\TaxCode|value-of $tax_code + * @param list|null $tax_details * @param Vatex|value-of|null $vatex */ public static function with( @@ -443,7 +527,7 @@ public static function with( ?string $shipping_address_recipient = null, DocumentState|string|null $state = null, float|string|null $subtotal = null, - TaxCode|string|null $tax_code = null, + DocumentCreateParams\TaxCode|string|null $tax_code = null, ?array $tax_details = null, float|string|null $total_discount = null, float|string|null $total_tax = null, @@ -458,65 +542,73 @@ public static function with( ): self { $obj = new self; - null !== $allowances && $obj->allowances = $allowances; - null !== $amount_due && $obj->amount_due = $amount_due; - null !== $attachments && $obj->attachments = $attachments; - null !== $billing_address && $obj->billing_address = $billing_address; - null !== $billing_address_recipient && $obj->billing_address_recipient = $billing_address_recipient; - null !== $charges && $obj->charges = $charges; + null !== $allowances && $obj['allowances'] = $allowances; + null !== $amount_due && $obj['amount_due'] = $amount_due; + null !== $attachments && $obj['attachments'] = $attachments; + null !== $billing_address && $obj['billing_address'] = $billing_address; + null !== $billing_address_recipient && $obj['billing_address_recipient'] = $billing_address_recipient; + null !== $charges && $obj['charges'] = $charges; null !== $currency && $obj['currency'] = $currency; - null !== $customer_address && $obj->customer_address = $customer_address; - null !== $customer_address_recipient && $obj->customer_address_recipient = $customer_address_recipient; - null !== $customer_company_id && $obj->customer_company_id = $customer_company_id; - null !== $customer_email && $obj->customer_email = $customer_email; - null !== $customer_id && $obj->customer_id = $customer_id; - null !== $customer_name && $obj->customer_name = $customer_name; - null !== $customer_tax_id && $obj->customer_tax_id = $customer_tax_id; + null !== $customer_address && $obj['customer_address'] = $customer_address; + null !== $customer_address_recipient && $obj['customer_address_recipient'] = $customer_address_recipient; + null !== $customer_company_id && $obj['customer_company_id'] = $customer_company_id; + null !== $customer_email && $obj['customer_email'] = $customer_email; + null !== $customer_id && $obj['customer_id'] = $customer_id; + null !== $customer_name && $obj['customer_name'] = $customer_name; + null !== $customer_tax_id && $obj['customer_tax_id'] = $customer_tax_id; null !== $direction && $obj['direction'] = $direction; null !== $document_type && $obj['document_type'] = $document_type; - null !== $due_date && $obj->due_date = $due_date; - null !== $invoice_date && $obj->invoice_date = $invoice_date; - null !== $invoice_id && $obj->invoice_id = $invoice_id; - null !== $invoice_total && $obj->invoice_total = $invoice_total; - null !== $items && $obj->items = $items; - null !== $note && $obj->note = $note; - null !== $payment_details && $obj->payment_details = $payment_details; - null !== $payment_term && $obj->payment_term = $payment_term; - null !== $previous_unpaid_balance && $obj->previous_unpaid_balance = $previous_unpaid_balance; - null !== $purchase_order && $obj->purchase_order = $purchase_order; - null !== $remittance_address && $obj->remittance_address = $remittance_address; - null !== $remittance_address_recipient && $obj->remittance_address_recipient = $remittance_address_recipient; - null !== $service_address && $obj->service_address = $service_address; - null !== $service_address_recipient && $obj->service_address_recipient = $service_address_recipient; - null !== $service_end_date && $obj->service_end_date = $service_end_date; - null !== $service_start_date && $obj->service_start_date = $service_start_date; - null !== $shipping_address && $obj->shipping_address = $shipping_address; - null !== $shipping_address_recipient && $obj->shipping_address_recipient = $shipping_address_recipient; + null !== $due_date && $obj['due_date'] = $due_date; + null !== $invoice_date && $obj['invoice_date'] = $invoice_date; + null !== $invoice_id && $obj['invoice_id'] = $invoice_id; + null !== $invoice_total && $obj['invoice_total'] = $invoice_total; + null !== $items && $obj['items'] = $items; + null !== $note && $obj['note'] = $note; + null !== $payment_details && $obj['payment_details'] = $payment_details; + null !== $payment_term && $obj['payment_term'] = $payment_term; + null !== $previous_unpaid_balance && $obj['previous_unpaid_balance'] = $previous_unpaid_balance; + null !== $purchase_order && $obj['purchase_order'] = $purchase_order; + null !== $remittance_address && $obj['remittance_address'] = $remittance_address; + null !== $remittance_address_recipient && $obj['remittance_address_recipient'] = $remittance_address_recipient; + null !== $service_address && $obj['service_address'] = $service_address; + null !== $service_address_recipient && $obj['service_address_recipient'] = $service_address_recipient; + null !== $service_end_date && $obj['service_end_date'] = $service_end_date; + null !== $service_start_date && $obj['service_start_date'] = $service_start_date; + null !== $shipping_address && $obj['shipping_address'] = $shipping_address; + null !== $shipping_address_recipient && $obj['shipping_address_recipient'] = $shipping_address_recipient; null !== $state && $obj['state'] = $state; - null !== $subtotal && $obj->subtotal = $subtotal; + null !== $subtotal && $obj['subtotal'] = $subtotal; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_details && $obj->tax_details = $tax_details; - null !== $total_discount && $obj->total_discount = $total_discount; - null !== $total_tax && $obj->total_tax = $total_tax; + null !== $tax_details && $obj['tax_details'] = $tax_details; + null !== $total_discount && $obj['total_discount'] = $total_discount; + null !== $total_tax && $obj['total_tax'] = $total_tax; null !== $vatex && $obj['vatex'] = $vatex; - null !== $vatex_note && $obj->vatex_note = $vatex_note; - null !== $vendor_address && $obj->vendor_address = $vendor_address; - null !== $vendor_address_recipient && $obj->vendor_address_recipient = $vendor_address_recipient; - null !== $vendor_company_id && $obj->vendor_company_id = $vendor_company_id; - null !== $vendor_email && $obj->vendor_email = $vendor_email; - null !== $vendor_name && $obj->vendor_name = $vendor_name; - null !== $vendor_tax_id && $obj->vendor_tax_id = $vendor_tax_id; + null !== $vatex_note && $obj['vatex_note'] = $vatex_note; + null !== $vendor_address && $obj['vendor_address'] = $vendor_address; + null !== $vendor_address_recipient && $obj['vendor_address_recipient'] = $vendor_address_recipient; + null !== $vendor_company_id && $obj['vendor_company_id'] = $vendor_company_id; + null !== $vendor_email && $obj['vendor_email'] = $vendor_email; + null !== $vendor_name && $obj['vendor_name'] = $vendor_name; + null !== $vendor_tax_id && $obj['vendor_tax_id'] = $vendor_tax_id; return $obj; } /** - * @param list|null $allowances + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $allowances */ public function withAllowances(?array $allowances): self { $obj = clone $this; - $obj->allowances = $allowances; + $obj['allowances'] = $allowances; return $obj; } @@ -527,18 +619,23 @@ public function withAllowances(?array $allowances): self public function withAmountDue(float|string|null $amountDue): self { $obj = clone $this; - $obj->amount_due = $amountDue; + $obj['amount_due'] = $amountDue; return $obj; } /** - * @param list|null $attachments + * @param list|null $attachments */ public function withAttachments(?array $attachments): self { $obj = clone $this; - $obj->attachments = $attachments; + $obj['attachments'] = $attachments; return $obj; } @@ -549,7 +646,7 @@ public function withAttachments(?array $attachments): self public function withBillingAddress(?string $billingAddress): self { $obj = clone $this; - $obj->billing_address = $billingAddress; + $obj['billing_address'] = $billingAddress; return $obj; } @@ -561,18 +658,26 @@ public function withBillingAddressRecipient( ?string $billingAddressRecipient ): self { $obj = clone $this; - $obj->billing_address_recipient = $billingAddressRecipient; + $obj['billing_address_recipient'] = $billingAddressRecipient; return $obj; } /** - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $charges */ public function withCharges(?array $charges): self { $obj = clone $this; - $obj->charges = $charges; + $obj['charges'] = $charges; return $obj; } @@ -596,7 +701,7 @@ public function withCurrency(CurrencyCode|string $currency): self public function withCustomerAddress(?string $customerAddress): self { $obj = clone $this; - $obj->customer_address = $customerAddress; + $obj['customer_address'] = $customerAddress; return $obj; } @@ -608,7 +713,7 @@ public function withCustomerAddressRecipient( ?string $customerAddressRecipient ): self { $obj = clone $this; - $obj->customer_address_recipient = $customerAddressRecipient; + $obj['customer_address_recipient'] = $customerAddressRecipient; return $obj; } @@ -619,7 +724,7 @@ public function withCustomerAddressRecipient( public function withCustomerCompanyID(?string $customerCompanyID): self { $obj = clone $this; - $obj->customer_company_id = $customerCompanyID; + $obj['customer_company_id'] = $customerCompanyID; return $obj; } @@ -630,7 +735,7 @@ public function withCustomerCompanyID(?string $customerCompanyID): self public function withCustomerEmail(?string $customerEmail): self { $obj = clone $this; - $obj->customer_email = $customerEmail; + $obj['customer_email'] = $customerEmail; return $obj; } @@ -641,7 +746,7 @@ public function withCustomerEmail(?string $customerEmail): self public function withCustomerID(?string $customerID): self { $obj = clone $this; - $obj->customer_id = $customerID; + $obj['customer_id'] = $customerID; return $obj; } @@ -652,7 +757,7 @@ public function withCustomerID(?string $customerID): self public function withCustomerName(?string $customerName): self { $obj = clone $this; - $obj->customer_name = $customerName; + $obj['customer_name'] = $customerName; return $obj; } @@ -663,7 +768,7 @@ public function withCustomerName(?string $customerName): self public function withCustomerTaxID(?string $customerTaxID): self { $obj = clone $this; - $obj->customer_tax_id = $customerTaxID; + $obj['customer_tax_id'] = $customerTaxID; return $obj; } @@ -700,7 +805,7 @@ public function withDocumentType(DocumentType|string $documentType): self public function withDueDate(?\DateTimeInterface $dueDate): self { $obj = clone $this; - $obj->due_date = $dueDate; + $obj['due_date'] = $dueDate; return $obj; } @@ -711,7 +816,7 @@ public function withDueDate(?\DateTimeInterface $dueDate): self public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self { $obj = clone $this; - $obj->invoice_date = $invoiceDate; + $obj['invoice_date'] = $invoiceDate; return $obj; } @@ -722,7 +827,7 @@ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self public function withInvoiceID(?string $invoiceID): self { $obj = clone $this; - $obj->invoice_id = $invoiceID; + $obj['invoice_id'] = $invoiceID; return $obj; } @@ -733,7 +838,7 @@ public function withInvoiceID(?string $invoiceID): self public function withInvoiceTotal(float|string|null $invoiceTotal): self { $obj = clone $this; - $obj->invoice_total = $invoiceTotal; + $obj['invoice_total'] = $invoiceTotal; return $obj; } @@ -741,12 +846,24 @@ public function withInvoiceTotal(float|string|null $invoiceTotal): self /** * At least one line item is required. * - * @param list $items + * @param list|null, + * amount?: float|string|null, + * charges?: list|null, + * date?: null|null, + * description?: string|null, + * product_code?: string|null, + * quantity?: float|string|null, + * tax?: float|string|null, + * tax_rate?: float|string|null, + * unit?: value-of|null, + * unit_price?: float|string|null, + * }> $items */ public function withItems(array $items): self { $obj = clone $this; - $obj->items = $items; + $obj['items'] = $items; return $obj; } @@ -757,18 +874,23 @@ public function withItems(array $items): self public function withNote(?string $note): self { $obj = clone $this; - $obj->note = $note; + $obj['note'] = $note; return $obj; } /** - * @param list|null $paymentDetails + * @param list|null $paymentDetails */ public function withPaymentDetails(?array $paymentDetails): self { $obj = clone $this; - $obj->payment_details = $paymentDetails; + $obj['payment_details'] = $paymentDetails; return $obj; } @@ -779,7 +901,7 @@ public function withPaymentDetails(?array $paymentDetails): self public function withPaymentTerm(?string $paymentTerm): self { $obj = clone $this; - $obj->payment_term = $paymentTerm; + $obj['payment_term'] = $paymentTerm; return $obj; } @@ -791,7 +913,7 @@ public function withPreviousUnpaidBalance( float|string|null $previousUnpaidBalance ): self { $obj = clone $this; - $obj->previous_unpaid_balance = $previousUnpaidBalance; + $obj['previous_unpaid_balance'] = $previousUnpaidBalance; return $obj; } @@ -802,7 +924,7 @@ public function withPreviousUnpaidBalance( public function withPurchaseOrder(?string $purchaseOrder): self { $obj = clone $this; - $obj->purchase_order = $purchaseOrder; + $obj['purchase_order'] = $purchaseOrder; return $obj; } @@ -813,7 +935,7 @@ public function withPurchaseOrder(?string $purchaseOrder): self public function withRemittanceAddress(?string $remittanceAddress): self { $obj = clone $this; - $obj->remittance_address = $remittanceAddress; + $obj['remittance_address'] = $remittanceAddress; return $obj; } @@ -825,7 +947,7 @@ public function withRemittanceAddressRecipient( ?string $remittanceAddressRecipient ): self { $obj = clone $this; - $obj->remittance_address_recipient = $remittanceAddressRecipient; + $obj['remittance_address_recipient'] = $remittanceAddressRecipient; return $obj; } @@ -836,7 +958,7 @@ public function withRemittanceAddressRecipient( public function withServiceAddress(?string $serviceAddress): self { $obj = clone $this; - $obj->service_address = $serviceAddress; + $obj['service_address'] = $serviceAddress; return $obj; } @@ -848,7 +970,7 @@ public function withServiceAddressRecipient( ?string $serviceAddressRecipient ): self { $obj = clone $this; - $obj->service_address_recipient = $serviceAddressRecipient; + $obj['service_address_recipient'] = $serviceAddressRecipient; return $obj; } @@ -860,7 +982,7 @@ public function withServiceEndDate( ?\DateTimeInterface $serviceEndDate ): self { $obj = clone $this; - $obj->service_end_date = $serviceEndDate; + $obj['service_end_date'] = $serviceEndDate; return $obj; } @@ -872,7 +994,7 @@ public function withServiceStartDate( ?\DateTimeInterface $serviceStartDate ): self { $obj = clone $this; - $obj->service_start_date = $serviceStartDate; + $obj['service_start_date'] = $serviceStartDate; return $obj; } @@ -883,7 +1005,7 @@ public function withServiceStartDate( public function withShippingAddress(?string $shippingAddress): self { $obj = clone $this; - $obj->shipping_address = $shippingAddress; + $obj['shipping_address'] = $shippingAddress; return $obj; } @@ -895,7 +1017,7 @@ public function withShippingAddressRecipient( ?string $shippingAddressRecipient ): self { $obj = clone $this; - $obj->shipping_address_recipient = $shippingAddressRecipient; + $obj['shipping_address_recipient'] = $shippingAddressRecipient; return $obj; } @@ -919,7 +1041,7 @@ public function withState(DocumentState|string $state): self public function withSubtotal(float|string|null $subtotal): self { $obj = clone $this; - $obj->subtotal = $subtotal; + $obj['subtotal'] = $subtotal; return $obj; } @@ -927,10 +1049,11 @@ public function withSubtotal(float|string|null $subtotal): self /** * Tax category code of the invoice (e.g., S for standard rate, Z for zero rate, E for exempt). * - * @param TaxCode|value-of $taxCode + * @param DocumentCreateParams\TaxCode|value-of $taxCode */ - public function withTaxCode(TaxCode|string $taxCode): self - { + public function withTaxCode( + DocumentCreateParams\TaxCode|string $taxCode + ): self { $obj = clone $this; $obj['tax_code'] = $taxCode; @@ -938,12 +1061,14 @@ public function withTaxCode(TaxCode|string $taxCode): self } /** - * @param list|null $taxDetails + * @param list|null $taxDetails */ public function withTaxDetails(?array $taxDetails): self { $obj = clone $this; - $obj->tax_details = $taxDetails; + $obj['tax_details'] = $taxDetails; return $obj; } @@ -954,7 +1079,7 @@ public function withTaxDetails(?array $taxDetails): self public function withTotalDiscount(float|string|null $totalDiscount): self { $obj = clone $this; - $obj->total_discount = $totalDiscount; + $obj['total_discount'] = $totalDiscount; return $obj; } @@ -965,7 +1090,7 @@ public function withTotalDiscount(float|string|null $totalDiscount): self public function withTotalTax(float|string|null $totalTax): self { $obj = clone $this; - $obj->total_tax = $totalTax; + $obj['total_tax'] = $totalTax; return $obj; } @@ -992,7 +1117,7 @@ public function withVatex(Vatex|string|null $vatex): self public function withVatexNote(?string $vatexNote): self { $obj = clone $this; - $obj->vatex_note = $vatexNote; + $obj['vatex_note'] = $vatexNote; return $obj; } @@ -1003,7 +1128,7 @@ public function withVatexNote(?string $vatexNote): self public function withVendorAddress(?string $vendorAddress): self { $obj = clone $this; - $obj->vendor_address = $vendorAddress; + $obj['vendor_address'] = $vendorAddress; return $obj; } @@ -1015,7 +1140,7 @@ public function withVendorAddressRecipient( ?string $vendorAddressRecipient ): self { $obj = clone $this; - $obj->vendor_address_recipient = $vendorAddressRecipient; + $obj['vendor_address_recipient'] = $vendorAddressRecipient; return $obj; } @@ -1026,7 +1151,7 @@ public function withVendorAddressRecipient( public function withVendorCompanyID(?string $vendorCompanyID): self { $obj = clone $this; - $obj->vendor_company_id = $vendorCompanyID; + $obj['vendor_company_id'] = $vendorCompanyID; return $obj; } @@ -1037,7 +1162,7 @@ public function withVendorCompanyID(?string $vendorCompanyID): self public function withVendorEmail(?string $vendorEmail): self { $obj = clone $this; - $obj->vendor_email = $vendorEmail; + $obj['vendor_email'] = $vendorEmail; return $obj; } @@ -1048,7 +1173,7 @@ public function withVendorEmail(?string $vendorEmail): self public function withVendorName(?string $vendorName): self { $obj = clone $this; - $obj->vendor_name = $vendorName; + $obj['vendor_name'] = $vendorName; return $obj; } @@ -1059,7 +1184,7 @@ public function withVendorName(?string $vendorName): self public function withVendorTaxID(?string $vendorTaxID): self { $obj = clone $this; - $obj->vendor_tax_id = $vendorTaxID; + $obj['vendor_tax_id'] = $vendorTaxID; return $obj; } diff --git a/src/Documents/DocumentCreateParams/Allowance.php b/src/Documents/DocumentCreateParams/Allowance.php index 0ad57a94..6550acac 100644 --- a/src/Documents/DocumentCreateParams/Allowance.php +++ b/src/Documents/DocumentCreateParams/Allowance.php @@ -101,13 +101,13 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $base_amount && $obj->base_amount = $base_amount; - null !== $multiplier_factor && $obj->multiplier_factor = $multiplier_factor; - null !== $reason && $obj->reason = $reason; + null !== $amount && $obj['amount'] = $amount; + null !== $base_amount && $obj['base_amount'] = $base_amount; + null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $reason && $obj['reason'] = $reason; null !== $reason_code && $obj['reason_code'] = $reason_code; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; return $obj; } @@ -118,7 +118,7 @@ public static function with( public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -129,7 +129,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj->base_amount = $baseAmount; + $obj['base_amount'] = $baseAmount; return $obj; } @@ -141,7 +141,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj->multiplier_factor = $multiplierFactor; + $obj['multiplier_factor'] = $multiplierFactor; return $obj; } @@ -152,7 +152,7 @@ public function withMultiplierFactor( public function withReason(?string $reason): self { $obj = clone $this; - $obj->reason = $reason; + $obj['reason'] = $reason; return $obj; } @@ -190,7 +190,7 @@ public function withTaxCode( public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentCreateParams/Charge.php b/src/Documents/DocumentCreateParams/Charge.php index a187cead..fe9bc054 100644 --- a/src/Documents/DocumentCreateParams/Charge.php +++ b/src/Documents/DocumentCreateParams/Charge.php @@ -106,13 +106,13 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $base_amount && $obj->base_amount = $base_amount; - null !== $multiplier_factor && $obj->multiplier_factor = $multiplier_factor; - null !== $reason && $obj->reason = $reason; + null !== $amount && $obj['amount'] = $amount; + null !== $base_amount && $obj['base_amount'] = $base_amount; + null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $reason && $obj['reason'] = $reason; null !== $reason_code && $obj['reason_code'] = $reason_code; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; return $obj; } @@ -123,7 +123,7 @@ public static function with( public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -134,7 +134,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj->base_amount = $baseAmount; + $obj['base_amount'] = $baseAmount; return $obj; } @@ -146,7 +146,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj->multiplier_factor = $multiplierFactor; + $obj['multiplier_factor'] = $multiplierFactor; return $obj; } @@ -157,7 +157,7 @@ public function withMultiplierFactor( public function withReason(?string $reason): self { $obj = clone $this; - $obj->reason = $reason; + $obj['reason'] = $reason; return $obj; } @@ -199,7 +199,7 @@ public function withTaxCode( public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentCreateParams/Item.php b/src/Documents/DocumentCreateParams/Item.php index d1169244..a2c86c4f 100644 --- a/src/Documents/DocumentCreateParams/Item.php +++ b/src/Documents/DocumentCreateParams/Item.php @@ -8,6 +8,8 @@ use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\DocumentCreateParams\Item\Allowance; +use EInvoiceAPI\Documents\DocumentCreateParams\Item\Allowance\ReasonCode; +use EInvoiceAPI\Documents\DocumentCreateParams\Item\Allowance\TaxCode; use EInvoiceAPI\Documents\DocumentCreateParams\Item\Charge; use EInvoiceAPI\Documents\UnitOfMeasureCode; @@ -119,8 +121,24 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list|null $allowances - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $allowances + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $charges * @param UnitOfMeasureCode|value-of|null $unit */ public static function with( @@ -138,18 +156,18 @@ public static function with( ): self { $obj = new self; - $obj->date = $date; + $obj['date'] = $date; - null !== $allowances && $obj->allowances = $allowances; - null !== $amount && $obj->amount = $amount; - null !== $charges && $obj->charges = $charges; - null !== $description && $obj->description = $description; - null !== $product_code && $obj->product_code = $product_code; - null !== $quantity && $obj->quantity = $quantity; - null !== $tax && $obj->tax = $tax; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $allowances && $obj['allowances'] = $allowances; + null !== $amount && $obj['amount'] = $amount; + null !== $charges && $obj['charges'] = $charges; + null !== $description && $obj['description'] = $description; + null !== $product_code && $obj['product_code'] = $product_code; + null !== $quantity && $obj['quantity'] = $quantity; + null !== $tax && $obj['tax'] = $tax; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; null !== $unit && $obj['unit'] = $unit; - null !== $unit_price && $obj->unit_price = $unit_price; + null !== $unit_price && $obj['unit_price'] = $unit_price; return $obj; } @@ -157,12 +175,20 @@ public static function with( /** * The allowances of the line item. * - * @param list|null $allowances + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $allowances */ public function withAllowances(?array $allowances): self { $obj = clone $this; - $obj->allowances = $allowances; + $obj['allowances'] = $allowances; return $obj; } @@ -173,7 +199,7 @@ public function withAllowances(?array $allowances): self public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -181,12 +207,20 @@ public function withAmount(float|string|null $amount): self /** * The charges of the line item. * - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $charges */ public function withCharges(?array $charges): self { $obj = clone $this; - $obj->charges = $charges; + $obj['charges'] = $charges; return $obj; } @@ -197,7 +231,7 @@ public function withCharges(?array $charges): self public function withDate(null $date): self { $obj = clone $this; - $obj->date = $date; + $obj['date'] = $date; return $obj; } @@ -208,7 +242,7 @@ public function withDate(null $date): self public function withDescription(?string $description): self { $obj = clone $this; - $obj->description = $description; + $obj['description'] = $description; return $obj; } @@ -219,7 +253,7 @@ public function withDescription(?string $description): self public function withProductCode(?string $productCode): self { $obj = clone $this; - $obj->product_code = $productCode; + $obj['product_code'] = $productCode; return $obj; } @@ -230,7 +264,7 @@ public function withProductCode(?string $productCode): self public function withQuantity(float|string|null $quantity): self { $obj = clone $this; - $obj->quantity = $quantity; + $obj['quantity'] = $quantity; return $obj; } @@ -241,7 +275,7 @@ public function withQuantity(float|string|null $quantity): self public function withTax(float|string|null $tax): self { $obj = clone $this; - $obj->tax = $tax; + $obj['tax'] = $tax; return $obj; } @@ -252,7 +286,7 @@ public function withTax(float|string|null $tax): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } @@ -276,7 +310,7 @@ public function withUnit(UnitOfMeasureCode|string|null $unit): self public function withUnitPrice(float|string|null $unitPrice): self { $obj = clone $this; - $obj->unit_price = $unitPrice; + $obj['unit_price'] = $unitPrice; return $obj; } diff --git a/src/Documents/DocumentCreateParams/Item/Allowance.php b/src/Documents/DocumentCreateParams/Item/Allowance.php index d1c8d8c8..1b4f1e7f 100644 --- a/src/Documents/DocumentCreateParams/Item/Allowance.php +++ b/src/Documents/DocumentCreateParams/Item/Allowance.php @@ -98,13 +98,13 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $base_amount && $obj->base_amount = $base_amount; - null !== $multiplier_factor && $obj->multiplier_factor = $multiplier_factor; - null !== $reason && $obj->reason = $reason; + null !== $amount && $obj['amount'] = $amount; + null !== $base_amount && $obj['base_amount'] = $base_amount; + null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $reason && $obj['reason'] = $reason; null !== $reason_code && $obj['reason_code'] = $reason_code; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; return $obj; } @@ -115,7 +115,7 @@ public static function with( public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -126,7 +126,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj->base_amount = $baseAmount; + $obj['base_amount'] = $baseAmount; return $obj; } @@ -138,7 +138,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj->multiplier_factor = $multiplierFactor; + $obj['multiplier_factor'] = $multiplierFactor; return $obj; } @@ -149,7 +149,7 @@ public function withMultiplierFactor( public function withReason(?string $reason): self { $obj = clone $this; - $obj->reason = $reason; + $obj['reason'] = $reason; return $obj; } @@ -186,7 +186,7 @@ public function withTaxCode(TaxCode|string $taxCode): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentCreateParams/Item/Charge.php b/src/Documents/DocumentCreateParams/Item/Charge.php index dd3c210f..3a425f23 100644 --- a/src/Documents/DocumentCreateParams/Item/Charge.php +++ b/src/Documents/DocumentCreateParams/Item/Charge.php @@ -102,13 +102,13 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $base_amount && $obj->base_amount = $base_amount; - null !== $multiplier_factor && $obj->multiplier_factor = $multiplier_factor; - null !== $reason && $obj->reason = $reason; + null !== $amount && $obj['amount'] = $amount; + null !== $base_amount && $obj['base_amount'] = $base_amount; + null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $reason && $obj['reason'] = $reason; null !== $reason_code && $obj['reason_code'] = $reason_code; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; return $obj; } @@ -119,7 +119,7 @@ public static function with( public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -130,7 +130,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj->base_amount = $baseAmount; + $obj['base_amount'] = $baseAmount; return $obj; } @@ -142,7 +142,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj->multiplier_factor = $multiplierFactor; + $obj['multiplier_factor'] = $multiplierFactor; return $obj; } @@ -153,7 +153,7 @@ public function withMultiplierFactor( public function withReason(?string $reason): self { $obj = clone $this; - $obj->reason = $reason; + $obj['reason'] = $reason; return $obj; } @@ -194,7 +194,7 @@ public function withTaxCode(TaxCode|string|null $taxCode): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentCreateParams/TaxDetail.php b/src/Documents/DocumentCreateParams/TaxDetail.php index eb3c41d4..b3befdf2 100644 --- a/src/Documents/DocumentCreateParams/TaxDetail.php +++ b/src/Documents/DocumentCreateParams/TaxDetail.php @@ -46,8 +46,8 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $rate && $obj->rate = $rate; + null !== $amount && $obj['amount'] = $amount; + null !== $rate && $obj['rate'] = $rate; return $obj; } @@ -58,7 +58,7 @@ public static function with( public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -69,7 +69,7 @@ public function withAmount(float|string|null $amount): self public function withRate(?string $rate): self { $obj = clone $this; - $obj->rate = $rate; + $obj['rate'] = $rate; return $obj; } diff --git a/src/Documents/DocumentDeleteResponse.php b/src/Documents/DocumentDeleteResponse.php index 61a64a4f..ad7cb96a 100644 --- a/src/Documents/DocumentDeleteResponse.php +++ b/src/Documents/DocumentDeleteResponse.php @@ -51,7 +51,7 @@ public static function with(bool $is_deleted): self { $obj = new self; - $obj->is_deleted = $is_deleted; + $obj['is_deleted'] = $is_deleted; return $obj; } @@ -59,7 +59,7 @@ public static function with(bool $is_deleted): self public function withIsDeleted(bool $isDeleted): self { $obj = clone $this; - $obj->is_deleted = $isDeleted; + $obj['is_deleted'] = $isDeleted; return $obj; } diff --git a/src/Documents/DocumentNewFromPdfResponse.php b/src/Documents/DocumentNewFromPdfResponse.php index 1f0668e6..1ffb1449 100644 --- a/src/Documents/DocumentNewFromPdfResponse.php +++ b/src/Documents/DocumentNewFromPdfResponse.php @@ -9,6 +9,7 @@ use EInvoiceAPI\Core\Concerns\SdkResponse; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; +use EInvoiceAPI\Documents\Allowance\ReasonCode; use EInvoiceAPI\Documents\DocumentNewFromPdfResponse\Item; use EInvoiceAPI\Documents\DocumentNewFromPdfResponse\TaxCode; use EInvoiceAPI\Documents\DocumentNewFromPdfResponse\TaxDetail; @@ -386,17 +387,57 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list|null $allowances - * @param list|null $attachments - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: string|null, + * }>|null $allowances + * @param list|null $attachments + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: string|null, + * }>|null $charges * @param CurrencyCode|value-of $currency * @param DocumentDirection|value-of $direction * @param DocumentType|value-of $document_type - * @param list $items - * @param list|null $payment_details + * @param list|null, + * amount?: string|null, + * charges?: list|null, + * date?: null|null, + * description?: string|null, + * product_code?: string|null, + * quantity?: string|null, + * tax?: string|null, + * tax_rate?: string|null, + * unit?: value-of|null, + * unit_price?: string|null, + * }> $items + * @param list|null $payment_details * @param DocumentState|value-of $state * @param TaxCode|value-of $tax_code - * @param list|null $tax_details + * @param list|null $tax_details * @param Vatex|value-of|null $vatex */ public static function with( @@ -452,66 +493,74 @@ public static function with( ): self { $obj = new self; - null !== $allowances && $obj->allowances = $allowances; - null !== $amount_due && $obj->amount_due = $amount_due; - null !== $attachments && $obj->attachments = $attachments; - null !== $billing_address && $obj->billing_address = $billing_address; - null !== $billing_address_recipient && $obj->billing_address_recipient = $billing_address_recipient; - null !== $charges && $obj->charges = $charges; + null !== $allowances && $obj['allowances'] = $allowances; + null !== $amount_due && $obj['amount_due'] = $amount_due; + null !== $attachments && $obj['attachments'] = $attachments; + null !== $billing_address && $obj['billing_address'] = $billing_address; + null !== $billing_address_recipient && $obj['billing_address_recipient'] = $billing_address_recipient; + null !== $charges && $obj['charges'] = $charges; null !== $currency && $obj['currency'] = $currency; - null !== $customer_address && $obj->customer_address = $customer_address; - null !== $customer_address_recipient && $obj->customer_address_recipient = $customer_address_recipient; - null !== $customer_company_id && $obj->customer_company_id = $customer_company_id; - null !== $customer_email && $obj->customer_email = $customer_email; - null !== $customer_id && $obj->customer_id = $customer_id; - null !== $customer_name && $obj->customer_name = $customer_name; - null !== $customer_tax_id && $obj->customer_tax_id = $customer_tax_id; + null !== $customer_address && $obj['customer_address'] = $customer_address; + null !== $customer_address_recipient && $obj['customer_address_recipient'] = $customer_address_recipient; + null !== $customer_company_id && $obj['customer_company_id'] = $customer_company_id; + null !== $customer_email && $obj['customer_email'] = $customer_email; + null !== $customer_id && $obj['customer_id'] = $customer_id; + null !== $customer_name && $obj['customer_name'] = $customer_name; + null !== $customer_tax_id && $obj['customer_tax_id'] = $customer_tax_id; null !== $direction && $obj['direction'] = $direction; null !== $document_type && $obj['document_type'] = $document_type; - null !== $due_date && $obj->due_date = $due_date; - null !== $invoice_date && $obj->invoice_date = $invoice_date; - null !== $invoice_id && $obj->invoice_id = $invoice_id; - null !== $invoice_total && $obj->invoice_total = $invoice_total; - null !== $items && $obj->items = $items; - null !== $note && $obj->note = $note; - null !== $payment_details && $obj->payment_details = $payment_details; - null !== $payment_term && $obj->payment_term = $payment_term; - null !== $purchase_order && $obj->purchase_order = $purchase_order; - null !== $remittance_address && $obj->remittance_address = $remittance_address; - null !== $remittance_address_recipient && $obj->remittance_address_recipient = $remittance_address_recipient; - null !== $service_address && $obj->service_address = $service_address; - null !== $service_address_recipient && $obj->service_address_recipient = $service_address_recipient; - null !== $service_end_date && $obj->service_end_date = $service_end_date; - null !== $service_start_date && $obj->service_start_date = $service_start_date; - null !== $shipping_address && $obj->shipping_address = $shipping_address; - null !== $shipping_address_recipient && $obj->shipping_address_recipient = $shipping_address_recipient; + null !== $due_date && $obj['due_date'] = $due_date; + null !== $invoice_date && $obj['invoice_date'] = $invoice_date; + null !== $invoice_id && $obj['invoice_id'] = $invoice_id; + null !== $invoice_total && $obj['invoice_total'] = $invoice_total; + null !== $items && $obj['items'] = $items; + null !== $note && $obj['note'] = $note; + null !== $payment_details && $obj['payment_details'] = $payment_details; + null !== $payment_term && $obj['payment_term'] = $payment_term; + null !== $purchase_order && $obj['purchase_order'] = $purchase_order; + null !== $remittance_address && $obj['remittance_address'] = $remittance_address; + null !== $remittance_address_recipient && $obj['remittance_address_recipient'] = $remittance_address_recipient; + null !== $service_address && $obj['service_address'] = $service_address; + null !== $service_address_recipient && $obj['service_address_recipient'] = $service_address_recipient; + null !== $service_end_date && $obj['service_end_date'] = $service_end_date; + null !== $service_start_date && $obj['service_start_date'] = $service_start_date; + null !== $shipping_address && $obj['shipping_address'] = $shipping_address; + null !== $shipping_address_recipient && $obj['shipping_address_recipient'] = $shipping_address_recipient; null !== $state && $obj['state'] = $state; - null !== $subtotal && $obj->subtotal = $subtotal; - null !== $success && $obj->success = $success; + null !== $subtotal && $obj['subtotal'] = $subtotal; + null !== $success && $obj['success'] = $success; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_details && $obj->tax_details = $tax_details; - null !== $total_discount && $obj->total_discount = $total_discount; - null !== $total_tax && $obj->total_tax = $total_tax; - null !== $ubl_document && $obj->ubl_document = $ubl_document; + null !== $tax_details && $obj['tax_details'] = $tax_details; + null !== $total_discount && $obj['total_discount'] = $total_discount; + null !== $total_tax && $obj['total_tax'] = $total_tax; + null !== $ubl_document && $obj['ubl_document'] = $ubl_document; null !== $vatex && $obj['vatex'] = $vatex; - null !== $vatex_note && $obj->vatex_note = $vatex_note; - null !== $vendor_address && $obj->vendor_address = $vendor_address; - null !== $vendor_address_recipient && $obj->vendor_address_recipient = $vendor_address_recipient; - null !== $vendor_company_id && $obj->vendor_company_id = $vendor_company_id; - null !== $vendor_email && $obj->vendor_email = $vendor_email; - null !== $vendor_name && $obj->vendor_name = $vendor_name; - null !== $vendor_tax_id && $obj->vendor_tax_id = $vendor_tax_id; + null !== $vatex_note && $obj['vatex_note'] = $vatex_note; + null !== $vendor_address && $obj['vendor_address'] = $vendor_address; + null !== $vendor_address_recipient && $obj['vendor_address_recipient'] = $vendor_address_recipient; + null !== $vendor_company_id && $obj['vendor_company_id'] = $vendor_company_id; + null !== $vendor_email && $obj['vendor_email'] = $vendor_email; + null !== $vendor_name && $obj['vendor_name'] = $vendor_name; + null !== $vendor_tax_id && $obj['vendor_tax_id'] = $vendor_tax_id; return $obj; } /** - * @param list|null $allowances + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: string|null, + * }>|null $allowances */ public function withAllowances(?array $allowances): self { $obj = clone $this; - $obj->allowances = $allowances; + $obj['allowances'] = $allowances; return $obj; } @@ -522,18 +571,23 @@ public function withAllowances(?array $allowances): self public function withAmountDue(?string $amountDue): self { $obj = clone $this; - $obj->amount_due = $amountDue; + $obj['amount_due'] = $amountDue; return $obj; } /** - * @param list|null $attachments + * @param list|null $attachments */ public function withAttachments(?array $attachments): self { $obj = clone $this; - $obj->attachments = $attachments; + $obj['attachments'] = $attachments; return $obj; } @@ -544,7 +598,7 @@ public function withAttachments(?array $attachments): self public function withBillingAddress(?string $billingAddress): self { $obj = clone $this; - $obj->billing_address = $billingAddress; + $obj['billing_address'] = $billingAddress; return $obj; } @@ -556,18 +610,26 @@ public function withBillingAddressRecipient( ?string $billingAddressRecipient ): self { $obj = clone $this; - $obj->billing_address_recipient = $billingAddressRecipient; + $obj['billing_address_recipient'] = $billingAddressRecipient; return $obj; } /** - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: string|null, + * }>|null $charges */ public function withCharges(?array $charges): self { $obj = clone $this; - $obj->charges = $charges; + $obj['charges'] = $charges; return $obj; } @@ -591,7 +653,7 @@ public function withCurrency(CurrencyCode|string $currency): self public function withCustomerAddress(?string $customerAddress): self { $obj = clone $this; - $obj->customer_address = $customerAddress; + $obj['customer_address'] = $customerAddress; return $obj; } @@ -603,7 +665,7 @@ public function withCustomerAddressRecipient( ?string $customerAddressRecipient ): self { $obj = clone $this; - $obj->customer_address_recipient = $customerAddressRecipient; + $obj['customer_address_recipient'] = $customerAddressRecipient; return $obj; } @@ -614,7 +676,7 @@ public function withCustomerAddressRecipient( public function withCustomerCompanyID(?string $customerCompanyID): self { $obj = clone $this; - $obj->customer_company_id = $customerCompanyID; + $obj['customer_company_id'] = $customerCompanyID; return $obj; } @@ -625,7 +687,7 @@ public function withCustomerCompanyID(?string $customerCompanyID): self public function withCustomerEmail(?string $customerEmail): self { $obj = clone $this; - $obj->customer_email = $customerEmail; + $obj['customer_email'] = $customerEmail; return $obj; } @@ -636,7 +698,7 @@ public function withCustomerEmail(?string $customerEmail): self public function withCustomerID(?string $customerID): self { $obj = clone $this; - $obj->customer_id = $customerID; + $obj['customer_id'] = $customerID; return $obj; } @@ -647,7 +709,7 @@ public function withCustomerID(?string $customerID): self public function withCustomerName(?string $customerName): self { $obj = clone $this; - $obj->customer_name = $customerName; + $obj['customer_name'] = $customerName; return $obj; } @@ -658,7 +720,7 @@ public function withCustomerName(?string $customerName): self public function withCustomerTaxID(?string $customerTaxID): self { $obj = clone $this; - $obj->customer_tax_id = $customerTaxID; + $obj['customer_tax_id'] = $customerTaxID; return $obj; } @@ -695,7 +757,7 @@ public function withDocumentType(DocumentType|string $documentType): self public function withDueDate(?\DateTimeInterface $dueDate): self { $obj = clone $this; - $obj->due_date = $dueDate; + $obj['due_date'] = $dueDate; return $obj; } @@ -706,7 +768,7 @@ public function withDueDate(?\DateTimeInterface $dueDate): self public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self { $obj = clone $this; - $obj->invoice_date = $invoiceDate; + $obj['invoice_date'] = $invoiceDate; return $obj; } @@ -717,7 +779,7 @@ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self public function withInvoiceID(?string $invoiceID): self { $obj = clone $this; - $obj->invoice_id = $invoiceID; + $obj['invoice_id'] = $invoiceID; return $obj; } @@ -728,7 +790,7 @@ public function withInvoiceID(?string $invoiceID): self public function withInvoiceTotal(?string $invoiceTotal): self { $obj = clone $this; - $obj->invoice_total = $invoiceTotal; + $obj['invoice_total'] = $invoiceTotal; return $obj; } @@ -736,12 +798,24 @@ public function withInvoiceTotal(?string $invoiceTotal): self /** * At least one line item is required. * - * @param list $items + * @param list|null, + * amount?: string|null, + * charges?: list|null, + * date?: null|null, + * description?: string|null, + * product_code?: string|null, + * quantity?: string|null, + * tax?: string|null, + * tax_rate?: string|null, + * unit?: value-of|null, + * unit_price?: string|null, + * }> $items */ public function withItems(array $items): self { $obj = clone $this; - $obj->items = $items; + $obj['items'] = $items; return $obj; } @@ -752,18 +826,23 @@ public function withItems(array $items): self public function withNote(?string $note): self { $obj = clone $this; - $obj->note = $note; + $obj['note'] = $note; return $obj; } /** - * @param list|null $paymentDetails + * @param list|null $paymentDetails */ public function withPaymentDetails(?array $paymentDetails): self { $obj = clone $this; - $obj->payment_details = $paymentDetails; + $obj['payment_details'] = $paymentDetails; return $obj; } @@ -774,7 +853,7 @@ public function withPaymentDetails(?array $paymentDetails): self public function withPaymentTerm(?string $paymentTerm): self { $obj = clone $this; - $obj->payment_term = $paymentTerm; + $obj['payment_term'] = $paymentTerm; return $obj; } @@ -785,7 +864,7 @@ public function withPaymentTerm(?string $paymentTerm): self public function withPurchaseOrder(?string $purchaseOrder): self { $obj = clone $this; - $obj->purchase_order = $purchaseOrder; + $obj['purchase_order'] = $purchaseOrder; return $obj; } @@ -796,7 +875,7 @@ public function withPurchaseOrder(?string $purchaseOrder): self public function withRemittanceAddress(?string $remittanceAddress): self { $obj = clone $this; - $obj->remittance_address = $remittanceAddress; + $obj['remittance_address'] = $remittanceAddress; return $obj; } @@ -808,7 +887,7 @@ public function withRemittanceAddressRecipient( ?string $remittanceAddressRecipient ): self { $obj = clone $this; - $obj->remittance_address_recipient = $remittanceAddressRecipient; + $obj['remittance_address_recipient'] = $remittanceAddressRecipient; return $obj; } @@ -819,7 +898,7 @@ public function withRemittanceAddressRecipient( public function withServiceAddress(?string $serviceAddress): self { $obj = clone $this; - $obj->service_address = $serviceAddress; + $obj['service_address'] = $serviceAddress; return $obj; } @@ -831,7 +910,7 @@ public function withServiceAddressRecipient( ?string $serviceAddressRecipient ): self { $obj = clone $this; - $obj->service_address_recipient = $serviceAddressRecipient; + $obj['service_address_recipient'] = $serviceAddressRecipient; return $obj; } @@ -843,7 +922,7 @@ public function withServiceEndDate( ?\DateTimeInterface $serviceEndDate ): self { $obj = clone $this; - $obj->service_end_date = $serviceEndDate; + $obj['service_end_date'] = $serviceEndDate; return $obj; } @@ -855,7 +934,7 @@ public function withServiceStartDate( ?\DateTimeInterface $serviceStartDate ): self { $obj = clone $this; - $obj->service_start_date = $serviceStartDate; + $obj['service_start_date'] = $serviceStartDate; return $obj; } @@ -866,7 +945,7 @@ public function withServiceStartDate( public function withShippingAddress(?string $shippingAddress): self { $obj = clone $this; - $obj->shipping_address = $shippingAddress; + $obj['shipping_address'] = $shippingAddress; return $obj; } @@ -878,7 +957,7 @@ public function withShippingAddressRecipient( ?string $shippingAddressRecipient ): self { $obj = clone $this; - $obj->shipping_address_recipient = $shippingAddressRecipient; + $obj['shipping_address_recipient'] = $shippingAddressRecipient; return $obj; } @@ -902,7 +981,7 @@ public function withState(DocumentState|string $state): self public function withSubtotal(?string $subtotal): self { $obj = clone $this; - $obj->subtotal = $subtotal; + $obj['subtotal'] = $subtotal; return $obj; } @@ -913,7 +992,7 @@ public function withSubtotal(?string $subtotal): self public function withSuccess(bool $success): self { $obj = clone $this; - $obj->success = $success; + $obj['success'] = $success; return $obj; } @@ -932,12 +1011,14 @@ public function withTaxCode(TaxCode|string $taxCode): self } /** - * @param list|null $taxDetails + * @param list|null $taxDetails */ public function withTaxDetails(?array $taxDetails): self { $obj = clone $this; - $obj->tax_details = $taxDetails; + $obj['tax_details'] = $taxDetails; return $obj; } @@ -948,7 +1029,7 @@ public function withTaxDetails(?array $taxDetails): self public function withTotalDiscount(?string $totalDiscount): self { $obj = clone $this; - $obj->total_discount = $totalDiscount; + $obj['total_discount'] = $totalDiscount; return $obj; } @@ -959,7 +1040,7 @@ public function withTotalDiscount(?string $totalDiscount): self public function withTotalTax(?string $totalTax): self { $obj = clone $this; - $obj->total_tax = $totalTax; + $obj['total_tax'] = $totalTax; return $obj; } @@ -970,7 +1051,7 @@ public function withTotalTax(?string $totalTax): self public function withUblDocument(?string $ublDocument): self { $obj = clone $this; - $obj->ubl_document = $ublDocument; + $obj['ubl_document'] = $ublDocument; return $obj; } @@ -997,7 +1078,7 @@ public function withVatex(Vatex|string|null $vatex): self public function withVatexNote(?string $vatexNote): self { $obj = clone $this; - $obj->vatex_note = $vatexNote; + $obj['vatex_note'] = $vatexNote; return $obj; } @@ -1008,7 +1089,7 @@ public function withVatexNote(?string $vatexNote): self public function withVendorAddress(?string $vendorAddress): self { $obj = clone $this; - $obj->vendor_address = $vendorAddress; + $obj['vendor_address'] = $vendorAddress; return $obj; } @@ -1020,7 +1101,7 @@ public function withVendorAddressRecipient( ?string $vendorAddressRecipient ): self { $obj = clone $this; - $obj->vendor_address_recipient = $vendorAddressRecipient; + $obj['vendor_address_recipient'] = $vendorAddressRecipient; return $obj; } @@ -1031,7 +1112,7 @@ public function withVendorAddressRecipient( public function withVendorCompanyID(?string $vendorCompanyID): self { $obj = clone $this; - $obj->vendor_company_id = $vendorCompanyID; + $obj['vendor_company_id'] = $vendorCompanyID; return $obj; } @@ -1042,7 +1123,7 @@ public function withVendorCompanyID(?string $vendorCompanyID): self public function withVendorEmail(?string $vendorEmail): self { $obj = clone $this; - $obj->vendor_email = $vendorEmail; + $obj['vendor_email'] = $vendorEmail; return $obj; } @@ -1053,7 +1134,7 @@ public function withVendorEmail(?string $vendorEmail): self public function withVendorName(?string $vendorName): self { $obj = clone $this; - $obj->vendor_name = $vendorName; + $obj['vendor_name'] = $vendorName; return $obj; } @@ -1064,7 +1145,7 @@ public function withVendorName(?string $vendorName): self public function withVendorTaxID(?string $vendorTaxID): self { $obj = clone $this; - $obj->vendor_tax_id = $vendorTaxID; + $obj['vendor_tax_id'] = $vendorTaxID; return $obj; } diff --git a/src/Documents/DocumentNewFromPdfResponse/Item.php b/src/Documents/DocumentNewFromPdfResponse/Item.php index 2af8b135..45037b47 100644 --- a/src/Documents/DocumentNewFromPdfResponse/Item.php +++ b/src/Documents/DocumentNewFromPdfResponse/Item.php @@ -8,6 +8,8 @@ use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\Allowance; +use EInvoiceAPI\Documents\Allowance\ReasonCode; +use EInvoiceAPI\Documents\Allowance\TaxCode; use EInvoiceAPI\Documents\Charge; use EInvoiceAPI\Documents\UnitOfMeasureCode; @@ -111,8 +113,24 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list|null $allowances - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: string|null, + * }>|null $allowances + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: string|null, + * }>|null $charges * @param UnitOfMeasureCode|value-of|null $unit */ public static function with( @@ -130,18 +148,18 @@ public static function with( ): self { $obj = new self; - $obj->date = $date; + $obj['date'] = $date; - null !== $allowances && $obj->allowances = $allowances; - null !== $amount && $obj->amount = $amount; - null !== $charges && $obj->charges = $charges; - null !== $description && $obj->description = $description; - null !== $product_code && $obj->product_code = $product_code; - null !== $quantity && $obj->quantity = $quantity; - null !== $tax && $obj->tax = $tax; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $allowances && $obj['allowances'] = $allowances; + null !== $amount && $obj['amount'] = $amount; + null !== $charges && $obj['charges'] = $charges; + null !== $description && $obj['description'] = $description; + null !== $product_code && $obj['product_code'] = $product_code; + null !== $quantity && $obj['quantity'] = $quantity; + null !== $tax && $obj['tax'] = $tax; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; null !== $unit && $obj['unit'] = $unit; - null !== $unit_price && $obj->unit_price = $unit_price; + null !== $unit_price && $obj['unit_price'] = $unit_price; return $obj; } @@ -149,12 +167,20 @@ public static function with( /** * The allowances of the line item. * - * @param list|null $allowances + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: string|null, + * }>|null $allowances */ public function withAllowances(?array $allowances): self { $obj = clone $this; - $obj->allowances = $allowances; + $obj['allowances'] = $allowances; return $obj; } @@ -165,7 +191,7 @@ public function withAllowances(?array $allowances): self public function withAmount(?string $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -173,12 +199,20 @@ public function withAmount(?string $amount): self /** * The charges of the line item. * - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: string|null, + * }>|null $charges */ public function withCharges(?array $charges): self { $obj = clone $this; - $obj->charges = $charges; + $obj['charges'] = $charges; return $obj; } @@ -189,7 +223,7 @@ public function withCharges(?array $charges): self public function withDate(null $date): self { $obj = clone $this; - $obj->date = $date; + $obj['date'] = $date; return $obj; } @@ -200,7 +234,7 @@ public function withDate(null $date): self public function withDescription(?string $description): self { $obj = clone $this; - $obj->description = $description; + $obj['description'] = $description; return $obj; } @@ -211,7 +245,7 @@ public function withDescription(?string $description): self public function withProductCode(?string $productCode): self { $obj = clone $this; - $obj->product_code = $productCode; + $obj['product_code'] = $productCode; return $obj; } @@ -222,7 +256,7 @@ public function withProductCode(?string $productCode): self public function withQuantity(?string $quantity): self { $obj = clone $this; - $obj->quantity = $quantity; + $obj['quantity'] = $quantity; return $obj; } @@ -233,7 +267,7 @@ public function withQuantity(?string $quantity): self public function withTax(?string $tax): self { $obj = clone $this; - $obj->tax = $tax; + $obj['tax'] = $tax; return $obj; } @@ -244,7 +278,7 @@ public function withTax(?string $tax): self public function withTaxRate(?string $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } @@ -268,7 +302,7 @@ public function withUnit(UnitOfMeasureCode|string|null $unit): self public function withUnitPrice(?string $unitPrice): self { $obj = clone $this; - $obj->unit_price = $unitPrice; + $obj['unit_price'] = $unitPrice; return $obj; } diff --git a/src/Documents/DocumentNewFromPdfResponse/TaxDetail.php b/src/Documents/DocumentNewFromPdfResponse/TaxDetail.php index d5015b76..72449340 100644 --- a/src/Documents/DocumentNewFromPdfResponse/TaxDetail.php +++ b/src/Documents/DocumentNewFromPdfResponse/TaxDetail.php @@ -44,8 +44,8 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $rate && $obj->rate = $rate; + null !== $amount && $obj['amount'] = $amount; + null !== $rate && $obj['rate'] = $rate; return $obj; } @@ -56,7 +56,7 @@ public static function with( public function withAmount(?string $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -67,7 +67,7 @@ public function withAmount(?string $amount): self public function withRate(?string $rate): self { $obj = clone $this; - $obj->rate = $rate; + $obj['rate'] = $rate; return $obj; } diff --git a/src/Documents/DocumentResponse.php b/src/Documents/DocumentResponse.php index cb8c4d9f..55b1679f 100644 --- a/src/Documents/DocumentResponse.php +++ b/src/Documents/DocumentResponse.php @@ -10,8 +10,7 @@ use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; use EInvoiceAPI\Documents\Attachments\DocumentAttachment; -use EInvoiceAPI\Documents\DocumentResponse\Allowance; -use EInvoiceAPI\Documents\DocumentResponse\Charge; +use EInvoiceAPI\Documents\DocumentResponse\Allowance\ReasonCode; use EInvoiceAPI\Documents\DocumentResponse\Item; use EInvoiceAPI\Documents\DocumentResponse\PaymentDetail; use EInvoiceAPI\Documents\DocumentResponse\TaxCode; @@ -81,9 +80,9 @@ final class DocumentResponse implements BaseModel, ResponseConverter #[Api] public string $id; - /** @var list|null $allowances */ + /** @var list|null $allowances */ #[Api( - list: Allowance::class, + list: DocumentResponse\Allowance::class, nullable: true, optional: true, )] @@ -111,9 +110,9 @@ final class DocumentResponse implements BaseModel, ResponseConverter #[Api(nullable: true, optional: true)] public ?string $billing_address_recipient; - /** @var list|null $charges */ + /** @var list|null $charges */ #[Api( - list: Charge::class, + list: DocumentResponse\Charge::class, nullable: true, optional: true, )] @@ -398,17 +397,58 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list|null $allowances - * @param list|null $attachments - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: string|null, + * }>|null $allowances + * @param list|null $attachments + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: string|null, + * }>|null $charges * @param CurrencyCode|value-of $currency * @param DocumentDirection|value-of $direction * @param DocumentType|value-of $document_type - * @param list|null $items - * @param list|null $payment_details + * @param list|null, + * amount?: string|null, + * charges?: list|null, + * date?: null|null, + * description?: string|null, + * product_code?: string|null, + * quantity?: string|null, + * tax?: string|null, + * tax_rate?: string|null, + * unit?: value-of|null, + * unit_price?: string|null, + * }>|null $items + * @param list|null $payment_details * @param DocumentState|value-of $state * @param TaxCode|value-of $tax_code - * @param list|null $tax_details + * @param list|null $tax_details * @param Vatex|value-of|null $vatex */ public static function with( @@ -463,55 +503,55 @@ public static function with( ): self { $obj = new self; - $obj->id = $id; + $obj['id'] = $id; - null !== $allowances && $obj->allowances = $allowances; - null !== $amount_due && $obj->amount_due = $amount_due; - null !== $attachments && $obj->attachments = $attachments; - null !== $billing_address && $obj->billing_address = $billing_address; - null !== $billing_address_recipient && $obj->billing_address_recipient = $billing_address_recipient; - null !== $charges && $obj->charges = $charges; + null !== $allowances && $obj['allowances'] = $allowances; + null !== $amount_due && $obj['amount_due'] = $amount_due; + null !== $attachments && $obj['attachments'] = $attachments; + null !== $billing_address && $obj['billing_address'] = $billing_address; + null !== $billing_address_recipient && $obj['billing_address_recipient'] = $billing_address_recipient; + null !== $charges && $obj['charges'] = $charges; null !== $currency && $obj['currency'] = $currency; - null !== $customer_address && $obj->customer_address = $customer_address; - null !== $customer_address_recipient && $obj->customer_address_recipient = $customer_address_recipient; - null !== $customer_company_id && $obj->customer_company_id = $customer_company_id; - null !== $customer_email && $obj->customer_email = $customer_email; - null !== $customer_id && $obj->customer_id = $customer_id; - null !== $customer_name && $obj->customer_name = $customer_name; - null !== $customer_tax_id && $obj->customer_tax_id = $customer_tax_id; + null !== $customer_address && $obj['customer_address'] = $customer_address; + null !== $customer_address_recipient && $obj['customer_address_recipient'] = $customer_address_recipient; + null !== $customer_company_id && $obj['customer_company_id'] = $customer_company_id; + null !== $customer_email && $obj['customer_email'] = $customer_email; + null !== $customer_id && $obj['customer_id'] = $customer_id; + null !== $customer_name && $obj['customer_name'] = $customer_name; + null !== $customer_tax_id && $obj['customer_tax_id'] = $customer_tax_id; null !== $direction && $obj['direction'] = $direction; null !== $document_type && $obj['document_type'] = $document_type; - null !== $due_date && $obj->due_date = $due_date; - null !== $invoice_date && $obj->invoice_date = $invoice_date; - null !== $invoice_id && $obj->invoice_id = $invoice_id; - null !== $invoice_total && $obj->invoice_total = $invoice_total; - null !== $items && $obj->items = $items; - null !== $note && $obj->note = $note; - null !== $payment_details && $obj->payment_details = $payment_details; - null !== $payment_term && $obj->payment_term = $payment_term; - null !== $purchase_order && $obj->purchase_order = $purchase_order; - null !== $remittance_address && $obj->remittance_address = $remittance_address; - null !== $remittance_address_recipient && $obj->remittance_address_recipient = $remittance_address_recipient; - null !== $service_address && $obj->service_address = $service_address; - null !== $service_address_recipient && $obj->service_address_recipient = $service_address_recipient; - null !== $service_end_date && $obj->service_end_date = $service_end_date; - null !== $service_start_date && $obj->service_start_date = $service_start_date; - null !== $shipping_address && $obj->shipping_address = $shipping_address; - null !== $shipping_address_recipient && $obj->shipping_address_recipient = $shipping_address_recipient; + null !== $due_date && $obj['due_date'] = $due_date; + null !== $invoice_date && $obj['invoice_date'] = $invoice_date; + null !== $invoice_id && $obj['invoice_id'] = $invoice_id; + null !== $invoice_total && $obj['invoice_total'] = $invoice_total; + null !== $items && $obj['items'] = $items; + null !== $note && $obj['note'] = $note; + null !== $payment_details && $obj['payment_details'] = $payment_details; + null !== $payment_term && $obj['payment_term'] = $payment_term; + null !== $purchase_order && $obj['purchase_order'] = $purchase_order; + null !== $remittance_address && $obj['remittance_address'] = $remittance_address; + null !== $remittance_address_recipient && $obj['remittance_address_recipient'] = $remittance_address_recipient; + null !== $service_address && $obj['service_address'] = $service_address; + null !== $service_address_recipient && $obj['service_address_recipient'] = $service_address_recipient; + null !== $service_end_date && $obj['service_end_date'] = $service_end_date; + null !== $service_start_date && $obj['service_start_date'] = $service_start_date; + null !== $shipping_address && $obj['shipping_address'] = $shipping_address; + null !== $shipping_address_recipient && $obj['shipping_address_recipient'] = $shipping_address_recipient; null !== $state && $obj['state'] = $state; - null !== $subtotal && $obj->subtotal = $subtotal; + null !== $subtotal && $obj['subtotal'] = $subtotal; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_details && $obj->tax_details = $tax_details; - null !== $total_discount && $obj->total_discount = $total_discount; - null !== $total_tax && $obj->total_tax = $total_tax; + null !== $tax_details && $obj['tax_details'] = $tax_details; + null !== $total_discount && $obj['total_discount'] = $total_discount; + null !== $total_tax && $obj['total_tax'] = $total_tax; null !== $vatex && $obj['vatex'] = $vatex; - null !== $vatex_note && $obj->vatex_note = $vatex_note; - null !== $vendor_address && $obj->vendor_address = $vendor_address; - null !== $vendor_address_recipient && $obj->vendor_address_recipient = $vendor_address_recipient; - null !== $vendor_company_id && $obj->vendor_company_id = $vendor_company_id; - null !== $vendor_email && $obj->vendor_email = $vendor_email; - null !== $vendor_name && $obj->vendor_name = $vendor_name; - null !== $vendor_tax_id && $obj->vendor_tax_id = $vendor_tax_id; + null !== $vatex_note && $obj['vatex_note'] = $vatex_note; + null !== $vendor_address && $obj['vendor_address'] = $vendor_address; + null !== $vendor_address_recipient && $obj['vendor_address_recipient'] = $vendor_address_recipient; + null !== $vendor_company_id && $obj['vendor_company_id'] = $vendor_company_id; + null !== $vendor_email && $obj['vendor_email'] = $vendor_email; + null !== $vendor_name && $obj['vendor_name'] = $vendor_name; + null !== $vendor_tax_id && $obj['vendor_tax_id'] = $vendor_tax_id; return $obj; } @@ -519,18 +559,26 @@ public static function with( public function withID(string $id): self { $obj = clone $this; - $obj->id = $id; + $obj['id'] = $id; return $obj; } /** - * @param list|null $allowances + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: string|null, + * }>|null $allowances */ public function withAllowances(?array $allowances): self { $obj = clone $this; - $obj->allowances = $allowances; + $obj['allowances'] = $allowances; return $obj; } @@ -541,18 +589,24 @@ public function withAllowances(?array $allowances): self public function withAmountDue(?string $amountDue): self { $obj = clone $this; - $obj->amount_due = $amountDue; + $obj['amount_due'] = $amountDue; return $obj; } /** - * @param list|null $attachments + * @param list|null $attachments */ public function withAttachments(?array $attachments): self { $obj = clone $this; - $obj->attachments = $attachments; + $obj['attachments'] = $attachments; return $obj; } @@ -563,7 +617,7 @@ public function withAttachments(?array $attachments): self public function withBillingAddress(?string $billingAddress): self { $obj = clone $this; - $obj->billing_address = $billingAddress; + $obj['billing_address'] = $billingAddress; return $obj; } @@ -575,18 +629,26 @@ public function withBillingAddressRecipient( ?string $billingAddressRecipient ): self { $obj = clone $this; - $obj->billing_address_recipient = $billingAddressRecipient; + $obj['billing_address_recipient'] = $billingAddressRecipient; return $obj; } /** - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: string|null, + * }>|null $charges */ public function withCharges(?array $charges): self { $obj = clone $this; - $obj->charges = $charges; + $obj['charges'] = $charges; return $obj; } @@ -610,7 +672,7 @@ public function withCurrency(CurrencyCode|string $currency): self public function withCustomerAddress(?string $customerAddress): self { $obj = clone $this; - $obj->customer_address = $customerAddress; + $obj['customer_address'] = $customerAddress; return $obj; } @@ -622,7 +684,7 @@ public function withCustomerAddressRecipient( ?string $customerAddressRecipient ): self { $obj = clone $this; - $obj->customer_address_recipient = $customerAddressRecipient; + $obj['customer_address_recipient'] = $customerAddressRecipient; return $obj; } @@ -633,7 +695,7 @@ public function withCustomerAddressRecipient( public function withCustomerCompanyID(?string $customerCompanyID): self { $obj = clone $this; - $obj->customer_company_id = $customerCompanyID; + $obj['customer_company_id'] = $customerCompanyID; return $obj; } @@ -644,7 +706,7 @@ public function withCustomerCompanyID(?string $customerCompanyID): self public function withCustomerEmail(?string $customerEmail): self { $obj = clone $this; - $obj->customer_email = $customerEmail; + $obj['customer_email'] = $customerEmail; return $obj; } @@ -655,7 +717,7 @@ public function withCustomerEmail(?string $customerEmail): self public function withCustomerID(?string $customerID): self { $obj = clone $this; - $obj->customer_id = $customerID; + $obj['customer_id'] = $customerID; return $obj; } @@ -666,7 +728,7 @@ public function withCustomerID(?string $customerID): self public function withCustomerName(?string $customerName): self { $obj = clone $this; - $obj->customer_name = $customerName; + $obj['customer_name'] = $customerName; return $obj; } @@ -677,7 +739,7 @@ public function withCustomerName(?string $customerName): self public function withCustomerTaxID(?string $customerTaxID): self { $obj = clone $this; - $obj->customer_tax_id = $customerTaxID; + $obj['customer_tax_id'] = $customerTaxID; return $obj; } @@ -714,7 +776,7 @@ public function withDocumentType(DocumentType|string $documentType): self public function withDueDate(?\DateTimeInterface $dueDate): self { $obj = clone $this; - $obj->due_date = $dueDate; + $obj['due_date'] = $dueDate; return $obj; } @@ -725,7 +787,7 @@ public function withDueDate(?\DateTimeInterface $dueDate): self public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self { $obj = clone $this; - $obj->invoice_date = $invoiceDate; + $obj['invoice_date'] = $invoiceDate; return $obj; } @@ -736,7 +798,7 @@ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self public function withInvoiceID(?string $invoiceID): self { $obj = clone $this; - $obj->invoice_id = $invoiceID; + $obj['invoice_id'] = $invoiceID; return $obj; } @@ -747,18 +809,30 @@ public function withInvoiceID(?string $invoiceID): self public function withInvoiceTotal(?string $invoiceTotal): self { $obj = clone $this; - $obj->invoice_total = $invoiceTotal; + $obj['invoice_total'] = $invoiceTotal; return $obj; } /** - * @param list|null $items + * @param list|null, + * amount?: string|null, + * charges?: list|null, + * date?: null|null, + * description?: string|null, + * product_code?: string|null, + * quantity?: string|null, + * tax?: string|null, + * tax_rate?: string|null, + * unit?: value-of|null, + * unit_price?: string|null, + * }>|null $items */ public function withItems(?array $items): self { $obj = clone $this; - $obj->items = $items; + $obj['items'] = $items; return $obj; } @@ -769,18 +843,23 @@ public function withItems(?array $items): self public function withNote(?string $note): self { $obj = clone $this; - $obj->note = $note; + $obj['note'] = $note; return $obj; } /** - * @param list|null $paymentDetails + * @param list|null $paymentDetails */ public function withPaymentDetails(?array $paymentDetails): self { $obj = clone $this; - $obj->payment_details = $paymentDetails; + $obj['payment_details'] = $paymentDetails; return $obj; } @@ -791,7 +870,7 @@ public function withPaymentDetails(?array $paymentDetails): self public function withPaymentTerm(?string $paymentTerm): self { $obj = clone $this; - $obj->payment_term = $paymentTerm; + $obj['payment_term'] = $paymentTerm; return $obj; } @@ -802,7 +881,7 @@ public function withPaymentTerm(?string $paymentTerm): self public function withPurchaseOrder(?string $purchaseOrder): self { $obj = clone $this; - $obj->purchase_order = $purchaseOrder; + $obj['purchase_order'] = $purchaseOrder; return $obj; } @@ -813,7 +892,7 @@ public function withPurchaseOrder(?string $purchaseOrder): self public function withRemittanceAddress(?string $remittanceAddress): self { $obj = clone $this; - $obj->remittance_address = $remittanceAddress; + $obj['remittance_address'] = $remittanceAddress; return $obj; } @@ -825,7 +904,7 @@ public function withRemittanceAddressRecipient( ?string $remittanceAddressRecipient ): self { $obj = clone $this; - $obj->remittance_address_recipient = $remittanceAddressRecipient; + $obj['remittance_address_recipient'] = $remittanceAddressRecipient; return $obj; } @@ -836,7 +915,7 @@ public function withRemittanceAddressRecipient( public function withServiceAddress(?string $serviceAddress): self { $obj = clone $this; - $obj->service_address = $serviceAddress; + $obj['service_address'] = $serviceAddress; return $obj; } @@ -848,7 +927,7 @@ public function withServiceAddressRecipient( ?string $serviceAddressRecipient ): self { $obj = clone $this; - $obj->service_address_recipient = $serviceAddressRecipient; + $obj['service_address_recipient'] = $serviceAddressRecipient; return $obj; } @@ -860,7 +939,7 @@ public function withServiceEndDate( ?\DateTimeInterface $serviceEndDate ): self { $obj = clone $this; - $obj->service_end_date = $serviceEndDate; + $obj['service_end_date'] = $serviceEndDate; return $obj; } @@ -872,7 +951,7 @@ public function withServiceStartDate( ?\DateTimeInterface $serviceStartDate ): self { $obj = clone $this; - $obj->service_start_date = $serviceStartDate; + $obj['service_start_date'] = $serviceStartDate; return $obj; } @@ -883,7 +962,7 @@ public function withServiceStartDate( public function withShippingAddress(?string $shippingAddress): self { $obj = clone $this; - $obj->shipping_address = $shippingAddress; + $obj['shipping_address'] = $shippingAddress; return $obj; } @@ -895,7 +974,7 @@ public function withShippingAddressRecipient( ?string $shippingAddressRecipient ): self { $obj = clone $this; - $obj->shipping_address_recipient = $shippingAddressRecipient; + $obj['shipping_address_recipient'] = $shippingAddressRecipient; return $obj; } @@ -919,7 +998,7 @@ public function withState(DocumentState|string $state): self public function withSubtotal(?string $subtotal): self { $obj = clone $this; - $obj->subtotal = $subtotal; + $obj['subtotal'] = $subtotal; return $obj; } @@ -938,12 +1017,14 @@ public function withTaxCode(TaxCode|string $taxCode): self } /** - * @param list|null $taxDetails + * @param list|null $taxDetails */ public function withTaxDetails(?array $taxDetails): self { $obj = clone $this; - $obj->tax_details = $taxDetails; + $obj['tax_details'] = $taxDetails; return $obj; } @@ -954,7 +1035,7 @@ public function withTaxDetails(?array $taxDetails): self public function withTotalDiscount(?string $totalDiscount): self { $obj = clone $this; - $obj->total_discount = $totalDiscount; + $obj['total_discount'] = $totalDiscount; return $obj; } @@ -965,7 +1046,7 @@ public function withTotalDiscount(?string $totalDiscount): self public function withTotalTax(?string $totalTax): self { $obj = clone $this; - $obj->total_tax = $totalTax; + $obj['total_tax'] = $totalTax; return $obj; } @@ -992,7 +1073,7 @@ public function withVatex(Vatex|string|null $vatex): self public function withVatexNote(?string $vatexNote): self { $obj = clone $this; - $obj->vatex_note = $vatexNote; + $obj['vatex_note'] = $vatexNote; return $obj; } @@ -1003,7 +1084,7 @@ public function withVatexNote(?string $vatexNote): self public function withVendorAddress(?string $vendorAddress): self { $obj = clone $this; - $obj->vendor_address = $vendorAddress; + $obj['vendor_address'] = $vendorAddress; return $obj; } @@ -1015,7 +1096,7 @@ public function withVendorAddressRecipient( ?string $vendorAddressRecipient ): self { $obj = clone $this; - $obj->vendor_address_recipient = $vendorAddressRecipient; + $obj['vendor_address_recipient'] = $vendorAddressRecipient; return $obj; } @@ -1026,7 +1107,7 @@ public function withVendorAddressRecipient( public function withVendorCompanyID(?string $vendorCompanyID): self { $obj = clone $this; - $obj->vendor_company_id = $vendorCompanyID; + $obj['vendor_company_id'] = $vendorCompanyID; return $obj; } @@ -1037,7 +1118,7 @@ public function withVendorCompanyID(?string $vendorCompanyID): self public function withVendorEmail(?string $vendorEmail): self { $obj = clone $this; - $obj->vendor_email = $vendorEmail; + $obj['vendor_email'] = $vendorEmail; return $obj; } @@ -1048,7 +1129,7 @@ public function withVendorEmail(?string $vendorEmail): self public function withVendorName(?string $vendorName): self { $obj = clone $this; - $obj->vendor_name = $vendorName; + $obj['vendor_name'] = $vendorName; return $obj; } @@ -1059,7 +1140,7 @@ public function withVendorName(?string $vendorName): self public function withVendorTaxID(?string $vendorTaxID): self { $obj = clone $this; - $obj->vendor_tax_id = $vendorTaxID; + $obj['vendor_tax_id'] = $vendorTaxID; return $obj; } diff --git a/src/Documents/DocumentResponse/Allowance.php b/src/Documents/DocumentResponse/Allowance.php index eba78d63..242988ed 100644 --- a/src/Documents/DocumentResponse/Allowance.php +++ b/src/Documents/DocumentResponse/Allowance.php @@ -99,13 +99,13 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $base_amount && $obj->base_amount = $base_amount; - null !== $multiplier_factor && $obj->multiplier_factor = $multiplier_factor; - null !== $reason && $obj->reason = $reason; + null !== $amount && $obj['amount'] = $amount; + null !== $base_amount && $obj['base_amount'] = $base_amount; + null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $reason && $obj['reason'] = $reason; null !== $reason_code && $obj['reason_code'] = $reason_code; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; return $obj; } @@ -116,7 +116,7 @@ public static function with( public function withAmount(?string $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -127,7 +127,7 @@ public function withAmount(?string $amount): self public function withBaseAmount(?string $baseAmount): self { $obj = clone $this; - $obj->base_amount = $baseAmount; + $obj['base_amount'] = $baseAmount; return $obj; } @@ -138,7 +138,7 @@ public function withBaseAmount(?string $baseAmount): self public function withMultiplierFactor(?string $multiplierFactor): self { $obj = clone $this; - $obj->multiplier_factor = $multiplierFactor; + $obj['multiplier_factor'] = $multiplierFactor; return $obj; } @@ -149,7 +149,7 @@ public function withMultiplierFactor(?string $multiplierFactor): self public function withReason(?string $reason): self { $obj = clone $this; - $obj->reason = $reason; + $obj['reason'] = $reason; return $obj; } @@ -187,7 +187,7 @@ public function withTaxCode( public function withTaxRate(?string $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentResponse/Charge.php b/src/Documents/DocumentResponse/Charge.php index b563f0bd..b43f0e74 100644 --- a/src/Documents/DocumentResponse/Charge.php +++ b/src/Documents/DocumentResponse/Charge.php @@ -104,13 +104,13 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $base_amount && $obj->base_amount = $base_amount; - null !== $multiplier_factor && $obj->multiplier_factor = $multiplier_factor; - null !== $reason && $obj->reason = $reason; + null !== $amount && $obj['amount'] = $amount; + null !== $base_amount && $obj['base_amount'] = $base_amount; + null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $reason && $obj['reason'] = $reason; null !== $reason_code && $obj['reason_code'] = $reason_code; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; return $obj; } @@ -121,7 +121,7 @@ public static function with( public function withAmount(?string $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -132,7 +132,7 @@ public function withAmount(?string $amount): self public function withBaseAmount(?string $baseAmount): self { $obj = clone $this; - $obj->base_amount = $baseAmount; + $obj['base_amount'] = $baseAmount; return $obj; } @@ -143,7 +143,7 @@ public function withBaseAmount(?string $baseAmount): self public function withMultiplierFactor(?string $multiplierFactor): self { $obj = clone $this; - $obj->multiplier_factor = $multiplierFactor; + $obj['multiplier_factor'] = $multiplierFactor; return $obj; } @@ -154,7 +154,7 @@ public function withMultiplierFactor(?string $multiplierFactor): self public function withReason(?string $reason): self { $obj = clone $this; - $obj->reason = $reason; + $obj['reason'] = $reason; return $obj; } @@ -196,7 +196,7 @@ public function withTaxCode( public function withTaxRate(?string $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentResponse/Item.php b/src/Documents/DocumentResponse/Item.php index 1293b3c3..2932650f 100644 --- a/src/Documents/DocumentResponse/Item.php +++ b/src/Documents/DocumentResponse/Item.php @@ -8,6 +8,8 @@ use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\Allowance; +use EInvoiceAPI\Documents\Allowance\ReasonCode; +use EInvoiceAPI\Documents\Allowance\TaxCode; use EInvoiceAPI\Documents\Charge; use EInvoiceAPI\Documents\UnitOfMeasureCode; @@ -119,8 +121,24 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list|null $allowances - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: string|null, + * }>|null $allowances + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: string|null, + * }>|null $charges * @param UnitOfMeasureCode|value-of|null $unit */ public static function with( @@ -138,18 +156,18 @@ public static function with( ): self { $obj = new self; - $obj->date = $date; + $obj['date'] = $date; - null !== $allowances && $obj->allowances = $allowances; - null !== $amount && $obj->amount = $amount; - null !== $charges && $obj->charges = $charges; - null !== $description && $obj->description = $description; - null !== $product_code && $obj->product_code = $product_code; - null !== $quantity && $obj->quantity = $quantity; - null !== $tax && $obj->tax = $tax; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $allowances && $obj['allowances'] = $allowances; + null !== $amount && $obj['amount'] = $amount; + null !== $charges && $obj['charges'] = $charges; + null !== $description && $obj['description'] = $description; + null !== $product_code && $obj['product_code'] = $product_code; + null !== $quantity && $obj['quantity'] = $quantity; + null !== $tax && $obj['tax'] = $tax; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; null !== $unit && $obj['unit'] = $unit; - null !== $unit_price && $obj->unit_price = $unit_price; + null !== $unit_price && $obj['unit_price'] = $unit_price; return $obj; } @@ -157,12 +175,20 @@ public static function with( /** * The allowances of the line item. * - * @param list|null $allowances + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: string|null, + * }>|null $allowances */ public function withAllowances(?array $allowances): self { $obj = clone $this; - $obj->allowances = $allowances; + $obj['allowances'] = $allowances; return $obj; } @@ -173,7 +199,7 @@ public function withAllowances(?array $allowances): self public function withAmount(?string $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -181,12 +207,20 @@ public function withAmount(?string $amount): self /** * The charges of the line item. * - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: string|null, + * }>|null $charges */ public function withCharges(?array $charges): self { $obj = clone $this; - $obj->charges = $charges; + $obj['charges'] = $charges; return $obj; } @@ -197,7 +231,7 @@ public function withCharges(?array $charges): self public function withDate(null $date): self { $obj = clone $this; - $obj->date = $date; + $obj['date'] = $date; return $obj; } @@ -208,7 +242,7 @@ public function withDate(null $date): self public function withDescription(?string $description): self { $obj = clone $this; - $obj->description = $description; + $obj['description'] = $description; return $obj; } @@ -219,7 +253,7 @@ public function withDescription(?string $description): self public function withProductCode(?string $productCode): self { $obj = clone $this; - $obj->product_code = $productCode; + $obj['product_code'] = $productCode; return $obj; } @@ -230,7 +264,7 @@ public function withProductCode(?string $productCode): self public function withQuantity(?string $quantity): self { $obj = clone $this; - $obj->quantity = $quantity; + $obj['quantity'] = $quantity; return $obj; } @@ -241,7 +275,7 @@ public function withQuantity(?string $quantity): self public function withTax(?string $tax): self { $obj = clone $this; - $obj->tax = $tax; + $obj['tax'] = $tax; return $obj; } @@ -252,7 +286,7 @@ public function withTax(?string $tax): self public function withTaxRate(?string $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } @@ -276,7 +310,7 @@ public function withUnit(UnitOfMeasureCode|string|null $unit): self public function withUnitPrice(?string $unitPrice): self { $obj = clone $this; - $obj->unit_price = $unitPrice; + $obj['unit_price'] = $unitPrice; return $obj; } diff --git a/src/Documents/DocumentResponse/PaymentDetail.php b/src/Documents/DocumentResponse/PaymentDetail.php index bcc859d5..fb4ed520 100644 --- a/src/Documents/DocumentResponse/PaymentDetail.php +++ b/src/Documents/DocumentResponse/PaymentDetail.php @@ -63,10 +63,10 @@ public static function with( ): self { $obj = new self; - null !== $bank_account_number && $obj->bank_account_number = $bank_account_number; - null !== $iban && $obj->iban = $iban; - null !== $payment_reference && $obj->payment_reference = $payment_reference; - null !== $swift && $obj->swift = $swift; + null !== $bank_account_number && $obj['bank_account_number'] = $bank_account_number; + null !== $iban && $obj['iban'] = $iban; + null !== $payment_reference && $obj['payment_reference'] = $payment_reference; + null !== $swift && $obj['swift'] = $swift; return $obj; } @@ -77,7 +77,7 @@ public static function with( public function withBankAccountNumber(?string $bankAccountNumber): self { $obj = clone $this; - $obj->bank_account_number = $bankAccountNumber; + $obj['bank_account_number'] = $bankAccountNumber; return $obj; } @@ -88,7 +88,7 @@ public function withBankAccountNumber(?string $bankAccountNumber): self public function withIban(?string $iban): self { $obj = clone $this; - $obj->iban = $iban; + $obj['iban'] = $iban; return $obj; } @@ -99,7 +99,7 @@ public function withIban(?string $iban): self public function withPaymentReference(?string $paymentReference): self { $obj = clone $this; - $obj->payment_reference = $paymentReference; + $obj['payment_reference'] = $paymentReference; return $obj; } @@ -110,7 +110,7 @@ public function withPaymentReference(?string $paymentReference): self public function withSwift(?string $swift): self { $obj = clone $this; - $obj->swift = $swift; + $obj['swift'] = $swift; return $obj; } diff --git a/src/Documents/DocumentResponse/TaxDetail.php b/src/Documents/DocumentResponse/TaxDetail.php index bf8c42fe..31a4daeb 100644 --- a/src/Documents/DocumentResponse/TaxDetail.php +++ b/src/Documents/DocumentResponse/TaxDetail.php @@ -44,8 +44,8 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $rate && $obj->rate = $rate; + null !== $amount && $obj['amount'] = $amount; + null !== $rate && $obj['rate'] = $rate; return $obj; } @@ -56,7 +56,7 @@ public static function with( public function withAmount(?string $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -67,7 +67,7 @@ public function withAmount(?string $amount): self public function withRate(?string $rate): self { $obj = clone $this; - $obj->rate = $rate; + $obj['rate'] = $rate; return $obj; } diff --git a/src/Documents/DocumentSendParams.php b/src/Documents/DocumentSendParams.php index 25594e10..1ea94f63 100644 --- a/src/Documents/DocumentSendParams.php +++ b/src/Documents/DocumentSendParams.php @@ -62,11 +62,11 @@ public static function with( ): self { $obj = new self; - null !== $email && $obj->email = $email; - null !== $receiver_peppol_id && $obj->receiver_peppol_id = $receiver_peppol_id; - null !== $receiver_peppol_scheme && $obj->receiver_peppol_scheme = $receiver_peppol_scheme; - null !== $sender_peppol_id && $obj->sender_peppol_id = $sender_peppol_id; - null !== $sender_peppol_scheme && $obj->sender_peppol_scheme = $sender_peppol_scheme; + null !== $email && $obj['email'] = $email; + null !== $receiver_peppol_id && $obj['receiver_peppol_id'] = $receiver_peppol_id; + null !== $receiver_peppol_scheme && $obj['receiver_peppol_scheme'] = $receiver_peppol_scheme; + null !== $sender_peppol_id && $obj['sender_peppol_id'] = $sender_peppol_id; + null !== $sender_peppol_scheme && $obj['sender_peppol_scheme'] = $sender_peppol_scheme; return $obj; } @@ -74,7 +74,7 @@ public static function with( public function withEmail(?string $email): self { $obj = clone $this; - $obj->email = $email; + $obj['email'] = $email; return $obj; } @@ -82,7 +82,7 @@ public function withEmail(?string $email): self public function withReceiverPeppolID(?string $receiverPeppolID): self { $obj = clone $this; - $obj->receiver_peppol_id = $receiverPeppolID; + $obj['receiver_peppol_id'] = $receiverPeppolID; return $obj; } @@ -91,7 +91,7 @@ public function withReceiverPeppolScheme( ?string $receiverPeppolScheme ): self { $obj = clone $this; - $obj->receiver_peppol_scheme = $receiverPeppolScheme; + $obj['receiver_peppol_scheme'] = $receiverPeppolScheme; return $obj; } @@ -99,7 +99,7 @@ public function withReceiverPeppolScheme( public function withSenderPeppolID(?string $senderPeppolID): self { $obj = clone $this; - $obj->sender_peppol_id = $senderPeppolID; + $obj['sender_peppol_id'] = $senderPeppolID; return $obj; } @@ -107,7 +107,7 @@ public function withSenderPeppolID(?string $senderPeppolID): self public function withSenderPeppolScheme(?string $senderPeppolScheme): self { $obj = clone $this; - $obj->sender_peppol_scheme = $senderPeppolScheme; + $obj['sender_peppol_scheme'] = $senderPeppolScheme; return $obj; } diff --git a/src/Documents/PaymentDetailCreate.php b/src/Documents/PaymentDetailCreate.php index ab910473..e68aee7b 100644 --- a/src/Documents/PaymentDetailCreate.php +++ b/src/Documents/PaymentDetailCreate.php @@ -63,10 +63,10 @@ public static function with( ): self { $obj = new self; - null !== $bank_account_number && $obj->bank_account_number = $bank_account_number; - null !== $iban && $obj->iban = $iban; - null !== $payment_reference && $obj->payment_reference = $payment_reference; - null !== $swift && $obj->swift = $swift; + null !== $bank_account_number && $obj['bank_account_number'] = $bank_account_number; + null !== $iban && $obj['iban'] = $iban; + null !== $payment_reference && $obj['payment_reference'] = $payment_reference; + null !== $swift && $obj['swift'] = $swift; return $obj; } @@ -77,7 +77,7 @@ public static function with( public function withBankAccountNumber(?string $bankAccountNumber): self { $obj = clone $this; - $obj->bank_account_number = $bankAccountNumber; + $obj['bank_account_number'] = $bankAccountNumber; return $obj; } @@ -88,7 +88,7 @@ public function withBankAccountNumber(?string $bankAccountNumber): self public function withIban(?string $iban): self { $obj = clone $this; - $obj->iban = $iban; + $obj['iban'] = $iban; return $obj; } @@ -99,7 +99,7 @@ public function withIban(?string $iban): self public function withPaymentReference(?string $paymentReference): self { $obj = clone $this; - $obj->payment_reference = $paymentReference; + $obj['payment_reference'] = $paymentReference; return $obj; } @@ -110,7 +110,7 @@ public function withPaymentReference(?string $paymentReference): self public function withSwift(?string $swift): self { $obj = clone $this; - $obj->swift = $swift; + $obj['swift'] = $swift; return $obj; } diff --git a/src/Documents/Ubl/UblCreateFromUblParams.php b/src/Documents/Ubl/UblCreateFromUblParams.php index d3eb5e08..3e9503e0 100644 --- a/src/Documents/Ubl/UblCreateFromUblParams.php +++ b/src/Documents/Ubl/UblCreateFromUblParams.php @@ -53,7 +53,7 @@ public static function with(string $file): self { $obj = new self; - $obj->file = $file; + $obj['file'] = $file; return $obj; } @@ -61,7 +61,7 @@ public static function with(string $file): self public function withFile(string $file): self { $obj = clone $this; - $obj->file = $file; + $obj['file'] = $file; return $obj; } diff --git a/src/Documents/Ubl/UblGetResponse.php b/src/Documents/Ubl/UblGetResponse.php index 5d2ef4e5..6536f5b1 100644 --- a/src/Documents/Ubl/UblGetResponse.php +++ b/src/Documents/Ubl/UblGetResponse.php @@ -99,17 +99,17 @@ public static function with( ): self { $obj = new self; - $obj->id = $id; - $obj->file_name = $file_name; - - null !== $file_hash && $obj->file_hash = $file_hash; - null !== $file_size && $obj->file_size = $file_size; - null !== $receiver_peppol_id && $obj->receiver_peppol_id = $receiver_peppol_id; - null !== $receiver_peppol_scheme && $obj->receiver_peppol_scheme = $receiver_peppol_scheme; - null !== $sender_peppol_id && $obj->sender_peppol_id = $sender_peppol_id; - null !== $sender_peppol_scheme && $obj->sender_peppol_scheme = $sender_peppol_scheme; - null !== $signed_url && $obj->signed_url = $signed_url; - null !== $validated_at && $obj->validated_at = $validated_at; + $obj['id'] = $id; + $obj['file_name'] = $file_name; + + null !== $file_hash && $obj['file_hash'] = $file_hash; + null !== $file_size && $obj['file_size'] = $file_size; + null !== $receiver_peppol_id && $obj['receiver_peppol_id'] = $receiver_peppol_id; + null !== $receiver_peppol_scheme && $obj['receiver_peppol_scheme'] = $receiver_peppol_scheme; + null !== $sender_peppol_id && $obj['sender_peppol_id'] = $sender_peppol_id; + null !== $sender_peppol_scheme && $obj['sender_peppol_scheme'] = $sender_peppol_scheme; + null !== $signed_url && $obj['signed_url'] = $signed_url; + null !== $validated_at && $obj['validated_at'] = $validated_at; return $obj; } @@ -117,7 +117,7 @@ public static function with( public function withID(string $id): self { $obj = clone $this; - $obj->id = $id; + $obj['id'] = $id; return $obj; } @@ -125,7 +125,7 @@ public function withID(string $id): self public function withFileName(string $fileName): self { $obj = clone $this; - $obj->file_name = $fileName; + $obj['file_name'] = $fileName; return $obj; } @@ -133,7 +133,7 @@ public function withFileName(string $fileName): self public function withFileHash(?string $fileHash): self { $obj = clone $this; - $obj->file_hash = $fileHash; + $obj['file_hash'] = $fileHash; return $obj; } @@ -141,7 +141,7 @@ public function withFileHash(?string $fileHash): self public function withFileSize(int $fileSize): self { $obj = clone $this; - $obj->file_size = $fileSize; + $obj['file_size'] = $fileSize; return $obj; } @@ -149,7 +149,7 @@ public function withFileSize(int $fileSize): self public function withReceiverPeppolID(?string $receiverPeppolID): self { $obj = clone $this; - $obj->receiver_peppol_id = $receiverPeppolID; + $obj['receiver_peppol_id'] = $receiverPeppolID; return $obj; } @@ -158,7 +158,7 @@ public function withReceiverPeppolScheme( ?string $receiverPeppolScheme ): self { $obj = clone $this; - $obj->receiver_peppol_scheme = $receiverPeppolScheme; + $obj['receiver_peppol_scheme'] = $receiverPeppolScheme; return $obj; } @@ -166,7 +166,7 @@ public function withReceiverPeppolScheme( public function withSenderPeppolID(?string $senderPeppolID): self { $obj = clone $this; - $obj->sender_peppol_id = $senderPeppolID; + $obj['sender_peppol_id'] = $senderPeppolID; return $obj; } @@ -174,7 +174,7 @@ public function withSenderPeppolID(?string $senderPeppolID): self public function withSenderPeppolScheme(?string $senderPeppolScheme): self { $obj = clone $this; - $obj->sender_peppol_scheme = $senderPeppolScheme; + $obj['sender_peppol_scheme'] = $senderPeppolScheme; return $obj; } @@ -182,7 +182,7 @@ public function withSenderPeppolScheme(?string $senderPeppolScheme): self public function withSignedURL(?string $signedURL): self { $obj = clone $this; - $obj->signed_url = $signedURL; + $obj['signed_url'] = $signedURL; return $obj; } @@ -190,7 +190,7 @@ public function withSignedURL(?string $signedURL): self public function withValidatedAt(?\DateTimeInterface $validatedAt): self { $obj = clone $this; - $obj->validated_at = $validatedAt; + $obj['validated_at'] = $validatedAt; return $obj; } diff --git a/src/Inbox/InboxListCreditNotesParams.php b/src/Inbox/InboxListCreditNotesParams.php index 28c50c51..732b72da 100644 --- a/src/Inbox/InboxListCreditNotesParams.php +++ b/src/Inbox/InboxListCreditNotesParams.php @@ -50,8 +50,8 @@ public static function with(?int $page = null, ?int $page_size = null): self { $obj = new self; - null !== $page && $obj->page = $page; - null !== $page_size && $obj->page_size = $page_size; + null !== $page && $obj['page'] = $page; + null !== $page_size && $obj['page_size'] = $page_size; return $obj; } @@ -62,7 +62,7 @@ public static function with(?int $page = null, ?int $page_size = null): self public function withPage(int $page): self { $obj = clone $this; - $obj->page = $page; + $obj['page'] = $page; return $obj; } @@ -73,7 +73,7 @@ public function withPage(int $page): self public function withPageSize(int $pageSize): self { $obj = clone $this; - $obj->page_size = $pageSize; + $obj['page_size'] = $pageSize; return $obj; } diff --git a/src/Inbox/InboxListInvoicesParams.php b/src/Inbox/InboxListInvoicesParams.php index 748de543..17d0ff04 100644 --- a/src/Inbox/InboxListInvoicesParams.php +++ b/src/Inbox/InboxListInvoicesParams.php @@ -48,8 +48,8 @@ public static function with(?int $page = null, ?int $page_size = null): self { $obj = new self; - null !== $page && $obj->page = $page; - null !== $page_size && $obj->page_size = $page_size; + null !== $page && $obj['page'] = $page; + null !== $page_size && $obj['page_size'] = $page_size; return $obj; } @@ -60,7 +60,7 @@ public static function with(?int $page = null, ?int $page_size = null): self public function withPage(int $page): self { $obj = clone $this; - $obj->page = $page; + $obj['page'] = $page; return $obj; } @@ -71,7 +71,7 @@ public function withPage(int $page): self public function withPageSize(int $pageSize): self { $obj = clone $this; - $obj->page_size = $pageSize; + $obj['page_size'] = $pageSize; return $obj; } diff --git a/src/Inbox/InboxListParams.php b/src/Inbox/InboxListParams.php index 4e435e50..21521b2f 100644 --- a/src/Inbox/InboxListParams.php +++ b/src/Inbox/InboxListParams.php @@ -109,12 +109,12 @@ public static function with( ): self { $obj = new self; - null !== $date_from && $obj->date_from = $date_from; - null !== $date_to && $obj->date_to = $date_to; - null !== $page && $obj->page = $page; - null !== $page_size && $obj->page_size = $page_size; - null !== $search && $obj->search = $search; - null !== $sender && $obj->sender = $sender; + null !== $date_from && $obj['date_from'] = $date_from; + null !== $date_to && $obj['date_to'] = $date_to; + null !== $page && $obj['page'] = $page; + null !== $page_size && $obj['page_size'] = $page_size; + null !== $search && $obj['search'] = $search; + null !== $sender && $obj['sender'] = $sender; null !== $state && $obj['state'] = $state; null !== $type && $obj['type'] = $type; @@ -127,7 +127,7 @@ public static function with( public function withDateFrom(?\DateTimeInterface $dateFrom): self { $obj = clone $this; - $obj->date_from = $dateFrom; + $obj['date_from'] = $dateFrom; return $obj; } @@ -138,7 +138,7 @@ public function withDateFrom(?\DateTimeInterface $dateFrom): self public function withDateTo(?\DateTimeInterface $dateTo): self { $obj = clone $this; - $obj->date_to = $dateTo; + $obj['date_to'] = $dateTo; return $obj; } @@ -149,7 +149,7 @@ public function withDateTo(?\DateTimeInterface $dateTo): self public function withPage(int $page): self { $obj = clone $this; - $obj->page = $page; + $obj['page'] = $page; return $obj; } @@ -160,7 +160,7 @@ public function withPage(int $page): self public function withPageSize(int $pageSize): self { $obj = clone $this; - $obj->page_size = $pageSize; + $obj['page_size'] = $pageSize; return $obj; } @@ -171,7 +171,7 @@ public function withPageSize(int $pageSize): self public function withSearch(?string $search): self { $obj = clone $this; - $obj->search = $search; + $obj['search'] = $search; return $obj; } @@ -182,7 +182,7 @@ public function withSearch(?string $search): self public function withSender(?string $sender): self { $obj = clone $this; - $obj->sender = $sender; + $obj['sender'] = $sender; return $obj; } diff --git a/src/Inbox/PaginatedDocumentResponse.php b/src/Inbox/PaginatedDocumentResponse.php index 9a72850e..bde78caf 100644 --- a/src/Inbox/PaginatedDocumentResponse.php +++ b/src/Inbox/PaginatedDocumentResponse.php @@ -7,7 +7,18 @@ use EInvoiceAPI\Core\Attributes\Api; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; +use EInvoiceAPI\Documents\Attachments\DocumentAttachment; +use EInvoiceAPI\Documents\CurrencyCode; +use EInvoiceAPI\Documents\DocumentDirection; use EInvoiceAPI\Documents\DocumentResponse; +use EInvoiceAPI\Documents\DocumentResponse\Allowance; +use EInvoiceAPI\Documents\DocumentResponse\Charge; +use EInvoiceAPI\Documents\DocumentResponse\Item; +use EInvoiceAPI\Documents\DocumentResponse\PaymentDetail; +use EInvoiceAPI\Documents\DocumentResponse\TaxCode; +use EInvoiceAPI\Documents\DocumentResponse\TaxDetail; +use EInvoiceAPI\Documents\DocumentResponse\Vatex; +use EInvoiceAPI\Documents\DocumentType; /** * @phpstan-type PaginatedDocumentResponseShape = array{ @@ -70,7 +81,56 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list $items + * @param list|null, + * amount_due?: string|null, + * attachments?: list|null, + * billing_address?: string|null, + * billing_address_recipient?: string|null, + * charges?: list|null, + * currency?: value-of|null, + * customer_address?: string|null, + * customer_address_recipient?: string|null, + * customer_company_id?: string|null, + * customer_email?: string|null, + * customer_id?: string|null, + * customer_name?: string|null, + * customer_tax_id?: string|null, + * direction?: value-of|null, + * document_type?: value-of|null, + * due_date?: \DateTimeInterface|null, + * invoice_date?: \DateTimeInterface|null, + * invoice_id?: string|null, + * invoice_total?: string|null, + * items?: list|null, + * note?: string|null, + * payment_details?: list|null, + * payment_term?: string|null, + * purchase_order?: string|null, + * remittance_address?: string|null, + * remittance_address_recipient?: string|null, + * service_address?: string|null, + * service_address_recipient?: string|null, + * service_end_date?: \DateTimeInterface|null, + * service_start_date?: \DateTimeInterface|null, + * shipping_address?: string|null, + * shipping_address_recipient?: string|null, + * state?: value-of|null, + * subtotal?: string|null, + * tax_code?: value-of|null, + * tax_details?: list|null, + * total_discount?: string|null, + * total_tax?: string|null, + * vatex?: value-of|null, + * vatex_note?: string|null, + * vendor_address?: string|null, + * vendor_address_recipient?: string|null, + * vendor_company_id?: string|null, + * vendor_email?: string|null, + * vendor_name?: string|null, + * vendor_tax_id?: string|null, + * }> $items */ public static function with( array $items, @@ -81,22 +141,71 @@ public static function with( ): self { $obj = new self; - $obj->items = $items; - $obj->page = $page; - $obj->page_size = $page_size; - $obj->pages = $pages; - $obj->total = $total; + $obj['items'] = $items; + $obj['page'] = $page; + $obj['page_size'] = $page_size; + $obj['pages'] = $pages; + $obj['total'] = $total; return $obj; } /** - * @param list $items + * @param list|null, + * amount_due?: string|null, + * attachments?: list|null, + * billing_address?: string|null, + * billing_address_recipient?: string|null, + * charges?: list|null, + * currency?: value-of|null, + * customer_address?: string|null, + * customer_address_recipient?: string|null, + * customer_company_id?: string|null, + * customer_email?: string|null, + * customer_id?: string|null, + * customer_name?: string|null, + * customer_tax_id?: string|null, + * direction?: value-of|null, + * document_type?: value-of|null, + * due_date?: \DateTimeInterface|null, + * invoice_date?: \DateTimeInterface|null, + * invoice_id?: string|null, + * invoice_total?: string|null, + * items?: list|null, + * note?: string|null, + * payment_details?: list|null, + * payment_term?: string|null, + * purchase_order?: string|null, + * remittance_address?: string|null, + * remittance_address_recipient?: string|null, + * service_address?: string|null, + * service_address_recipient?: string|null, + * service_end_date?: \DateTimeInterface|null, + * service_start_date?: \DateTimeInterface|null, + * shipping_address?: string|null, + * shipping_address_recipient?: string|null, + * state?: value-of|null, + * subtotal?: string|null, + * tax_code?: value-of|null, + * tax_details?: list|null, + * total_discount?: string|null, + * total_tax?: string|null, + * vatex?: value-of|null, + * vatex_note?: string|null, + * vendor_address?: string|null, + * vendor_address_recipient?: string|null, + * vendor_company_id?: string|null, + * vendor_email?: string|null, + * vendor_name?: string|null, + * vendor_tax_id?: string|null, + * }> $items */ public function withItems(array $items): self { $obj = clone $this; - $obj->items = $items; + $obj['items'] = $items; return $obj; } @@ -104,7 +213,7 @@ public function withItems(array $items): self public function withPage(int $page): self { $obj = clone $this; - $obj->page = $page; + $obj['page'] = $page; return $obj; } @@ -112,7 +221,7 @@ public function withPage(int $page): self public function withPageSize(int $pageSize): self { $obj = clone $this; - $obj->page_size = $pageSize; + $obj['page_size'] = $pageSize; return $obj; } @@ -120,7 +229,7 @@ public function withPageSize(int $pageSize): self public function withPages(int $pages): self { $obj = clone $this; - $obj->pages = $pages; + $obj['pages'] = $pages; return $obj; } @@ -128,7 +237,7 @@ public function withPages(int $pages): self public function withTotal(int $total): self { $obj = clone $this; - $obj->total = $total; + $obj['total'] = $total; return $obj; } diff --git a/src/Lookup/Certificate.php b/src/Lookup/Certificate.php index 6dbadc4d..e16ec0ae 100644 --- a/src/Lookup/Certificate.php +++ b/src/Lookup/Certificate.php @@ -73,10 +73,10 @@ public static function with( ): self { $obj = new self; - $obj->status = $status; + $obj['status'] = $status; - null !== $details && $obj->details = $details; - null !== $error && $obj->error = $error; + null !== $details && $obj['details'] = $details; + null !== $error && $obj['error'] = $error; return $obj; } @@ -87,7 +87,7 @@ public static function with( public function withStatus(string $status): self { $obj = clone $this; - $obj->status = $status; + $obj['status'] = $status; return $obj; } @@ -100,7 +100,7 @@ public function withStatus(string $status): self public function withDetails(?array $details): self { $obj = clone $this; - $obj->details = $details; + $obj['details'] = $details; return $obj; } @@ -111,7 +111,7 @@ public function withDetails(?array $details): self public function withError(?string $error): self { $obj = clone $this; - $obj->error = $error; + $obj['error'] = $error; return $obj; } diff --git a/src/Lookup/LookupGetParticipantsResponse.php b/src/Lookup/LookupGetParticipantsResponse.php index 163ef3bc..d0f677bd 100644 --- a/src/Lookup/LookupGetParticipantsResponse.php +++ b/src/Lookup/LookupGetParticipantsResponse.php @@ -10,6 +10,8 @@ use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; use EInvoiceAPI\Lookup\LookupGetParticipantsResponse\Participant; +use EInvoiceAPI\Lookup\LookupGetParticipantsResponse\Participant\DocumentType; +use EInvoiceAPI\Lookup\LookupGetParticipantsResponse\Participant\Entity; /** * Represents the result of a Peppol directory search. @@ -91,7 +93,12 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list $participants + * @param list|null, + * entities?: list|null, + * }> $participants */ public static function with( string $query_terms, @@ -102,12 +109,12 @@ public static function with( ): self { $obj = new self; - $obj->query_terms = $query_terms; - $obj->search_date = $search_date; - $obj->total_count = $total_count; - $obj->used_count = $used_count; + $obj['query_terms'] = $query_terms; + $obj['search_date'] = $search_date; + $obj['total_count'] = $total_count; + $obj['used_count'] = $used_count; - null !== $participants && $obj->participants = $participants; + null !== $participants && $obj['participants'] = $participants; return $obj; } @@ -118,7 +125,7 @@ public static function with( public function withQueryTerms(string $queryTerms): self { $obj = clone $this; - $obj->query_terms = $queryTerms; + $obj['query_terms'] = $queryTerms; return $obj; } @@ -129,7 +136,7 @@ public function withQueryTerms(string $queryTerms): self public function withSearchDate(string $searchDate): self { $obj = clone $this; - $obj->search_date = $searchDate; + $obj['search_date'] = $searchDate; return $obj; } @@ -140,7 +147,7 @@ public function withSearchDate(string $searchDate): self public function withTotalCount(int $totalCount): self { $obj = clone $this; - $obj->total_count = $totalCount; + $obj['total_count'] = $totalCount; return $obj; } @@ -151,7 +158,7 @@ public function withTotalCount(int $totalCount): self public function withUsedCount(int $usedCount): self { $obj = clone $this; - $obj->used_count = $usedCount; + $obj['used_count'] = $usedCount; return $obj; } @@ -159,12 +166,17 @@ public function withUsedCount(int $usedCount): self /** * List of participants. * - * @param list $participants + * @param list|null, + * entities?: list|null, + * }> $participants */ public function withParticipants(array $participants): self { $obj = clone $this; - $obj->participants = $participants; + $obj['participants'] = $participants; return $obj; } diff --git a/src/Lookup/LookupGetParticipantsResponse/Participant.php b/src/Lookup/LookupGetParticipantsResponse/Participant.php index e87da552..3c80a6fa 100644 --- a/src/Lookup/LookupGetParticipantsResponse/Participant.php +++ b/src/Lookup/LookupGetParticipantsResponse/Participant.php @@ -9,6 +9,7 @@ use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Lookup\LookupGetParticipantsResponse\Participant\DocumentType; use EInvoiceAPI\Lookup\LookupGetParticipantsResponse\Participant\Entity; +use EInvoiceAPI\Lookup\LookupGetParticipantsResponse\Participant\Entity\Identifier; /** * Represents a Peppol participant with their details. @@ -77,8 +78,16 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list $document_types - * @param list $entities + * @param list $document_types + * @param list|null, + * name?: string|null, + * registration_date?: string|null, + * website?: string|null, + * }> $entities */ public static function with( string $peppol_id, @@ -88,11 +97,11 @@ public static function with( ): self { $obj = new self; - $obj->peppol_id = $peppol_id; - $obj->peppol_scheme = $peppol_scheme; + $obj['peppol_id'] = $peppol_id; + $obj['peppol_scheme'] = $peppol_scheme; - null !== $document_types && $obj->document_types = $document_types; - null !== $entities && $obj->entities = $entities; + null !== $document_types && $obj['document_types'] = $document_types; + null !== $entities && $obj['entities'] = $entities; return $obj; } @@ -103,7 +112,7 @@ public static function with( public function withPeppolID(string $peppolID): self { $obj = clone $this; - $obj->peppol_id = $peppolID; + $obj['peppol_id'] = $peppolID; return $obj; } @@ -114,7 +123,7 @@ public function withPeppolID(string $peppolID): self public function withPeppolScheme(string $peppolScheme): self { $obj = clone $this; - $obj->peppol_scheme = $peppolScheme; + $obj['peppol_scheme'] = $peppolScheme; return $obj; } @@ -122,12 +131,12 @@ public function withPeppolScheme(string $peppolScheme): self /** * List of supported document types. * - * @param list $documentTypes + * @param list $documentTypes */ public function withDocumentTypes(array $documentTypes): self { $obj = clone $this; - $obj->document_types = $documentTypes; + $obj['document_types'] = $documentTypes; return $obj; } @@ -135,12 +144,20 @@ public function withDocumentTypes(array $documentTypes): self /** * List of business entities. * - * @param list $entities + * @param list|null, + * name?: string|null, + * registration_date?: string|null, + * website?: string|null, + * }> $entities */ public function withEntities(array $entities): self { $obj = clone $this; - $obj->entities = $entities; + $obj['entities'] = $entities; return $obj; } diff --git a/src/Lookup/LookupGetParticipantsResponse/Participant/DocumentType.php b/src/Lookup/LookupGetParticipantsResponse/Participant/DocumentType.php index c7b74428..4ad08bce 100644 --- a/src/Lookup/LookupGetParticipantsResponse/Participant/DocumentType.php +++ b/src/Lookup/LookupGetParticipantsResponse/Participant/DocumentType.php @@ -58,8 +58,8 @@ public static function with(string $scheme, string $value): self { $obj = new self; - $obj->scheme = $scheme; - $obj->value = $value; + $obj['scheme'] = $scheme; + $obj['value'] = $value; return $obj; } @@ -70,7 +70,7 @@ public static function with(string $scheme, string $value): self public function withScheme(string $scheme): self { $obj = clone $this; - $obj->scheme = $scheme; + $obj['scheme'] = $scheme; return $obj; } @@ -81,7 +81,7 @@ public function withScheme(string $scheme): self public function withValue(string $value): self { $obj = clone $this; - $obj->value = $value; + $obj['value'] = $value; return $obj; } diff --git a/src/Lookup/LookupGetParticipantsResponse/Participant/Entity.php b/src/Lookup/LookupGetParticipantsResponse/Participant/Entity.php index c4f98d67..5aa6d9c0 100644 --- a/src/Lookup/LookupGetParticipantsResponse/Participant/Entity.php +++ b/src/Lookup/LookupGetParticipantsResponse/Participant/Entity.php @@ -81,7 +81,7 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list $identifiers + * @param list $identifiers */ public static function with( ?string $additional_info = null, @@ -94,13 +94,13 @@ public static function with( ): self { $obj = new self; - null !== $additional_info && $obj->additional_info = $additional_info; - null !== $country_code && $obj->country_code = $country_code; - null !== $geo_info && $obj->geo_info = $geo_info; - null !== $identifiers && $obj->identifiers = $identifiers; - null !== $name && $obj->name = $name; - null !== $registration_date && $obj->registration_date = $registration_date; - null !== $website && $obj->website = $website; + null !== $additional_info && $obj['additional_info'] = $additional_info; + null !== $country_code && $obj['country_code'] = $country_code; + null !== $geo_info && $obj['geo_info'] = $geo_info; + null !== $identifiers && $obj['identifiers'] = $identifiers; + null !== $name && $obj['name'] = $name; + null !== $registration_date && $obj['registration_date'] = $registration_date; + null !== $website && $obj['website'] = $website; return $obj; } @@ -111,7 +111,7 @@ public static function with( public function withAdditionalInfo(?string $additionalInfo): self { $obj = clone $this; - $obj->additional_info = $additionalInfo; + $obj['additional_info'] = $additionalInfo; return $obj; } @@ -122,7 +122,7 @@ public function withAdditionalInfo(?string $additionalInfo): self public function withCountryCode(?string $countryCode): self { $obj = clone $this; - $obj->country_code = $countryCode; + $obj['country_code'] = $countryCode; return $obj; } @@ -133,7 +133,7 @@ public function withCountryCode(?string $countryCode): self public function withGeoInfo(?string $geoInfo): self { $obj = clone $this; - $obj->geo_info = $geoInfo; + $obj['geo_info'] = $geoInfo; return $obj; } @@ -141,12 +141,12 @@ public function withGeoInfo(?string $geoInfo): self /** * List of business identifiers. * - * @param list $identifiers + * @param list $identifiers */ public function withIdentifiers(array $identifiers): self { $obj = clone $this; - $obj->identifiers = $identifiers; + $obj['identifiers'] = $identifiers; return $obj; } @@ -157,7 +157,7 @@ public function withIdentifiers(array $identifiers): self public function withName(?string $name): self { $obj = clone $this; - $obj->name = $name; + $obj['name'] = $name; return $obj; } @@ -168,7 +168,7 @@ public function withName(?string $name): self public function withRegistrationDate(?string $registrationDate): self { $obj = clone $this; - $obj->registration_date = $registrationDate; + $obj['registration_date'] = $registrationDate; return $obj; } @@ -179,7 +179,7 @@ public function withRegistrationDate(?string $registrationDate): self public function withWebsite(?string $website): self { $obj = clone $this; - $obj->website = $website; + $obj['website'] = $website; return $obj; } diff --git a/src/Lookup/LookupGetParticipantsResponse/Participant/Entity/Identifier.php b/src/Lookup/LookupGetParticipantsResponse/Participant/Entity/Identifier.php index b4797c25..df42cf69 100644 --- a/src/Lookup/LookupGetParticipantsResponse/Participant/Entity/Identifier.php +++ b/src/Lookup/LookupGetParticipantsResponse/Participant/Entity/Identifier.php @@ -58,8 +58,8 @@ public static function with(string $scheme, string $value): self { $obj = new self; - $obj->scheme = $scheme; - $obj->value = $value; + $obj['scheme'] = $scheme; + $obj['value'] = $value; return $obj; } @@ -70,7 +70,7 @@ public static function with(string $scheme, string $value): self public function withScheme(string $scheme): self { $obj = clone $this; - $obj->scheme = $scheme; + $obj['scheme'] = $scheme; return $obj; } @@ -81,7 +81,7 @@ public function withScheme(string $scheme): self public function withValue(string $value): self { $obj = clone $this; - $obj->value = $value; + $obj['value'] = $value; return $obj; } diff --git a/src/Lookup/LookupGetResponse.php b/src/Lookup/LookupGetResponse.php index 55d7ab71..31b2cf18 100644 --- a/src/Lookup/LookupGetResponse.php +++ b/src/Lookup/LookupGetResponse.php @@ -10,9 +10,12 @@ use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; use EInvoiceAPI\Lookup\LookupGetResponse\BusinessCard; +use EInvoiceAPI\Lookup\LookupGetResponse\BusinessCard\Entity; use EInvoiceAPI\Lookup\LookupGetResponse\DNSInfo; +use EInvoiceAPI\Lookup\LookupGetResponse\DNSInfo\DNSRecord; use EInvoiceAPI\Lookup\LookupGetResponse\QueryMetadata; use EInvoiceAPI\Lookup\LookupGetResponse\ServiceMetadata; +use EInvoiceAPI\Lookup\LookupGetResponse\ServiceMetadata\Endpoint; /** * Response from a Peppol ID lookup operation. @@ -137,40 +140,74 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list $certificates + * @param BusinessCard|array{ + * entities: list, + * queryTimeMs: float, + * status: string, + * error?: string|null, + * } $businessCard + * @param list|null, error?: string|null + * }> $certificates + * @param DNSInfo|array{ + * dnsRecords: list, + * smlHostname: string, + * status: string, + * error?: string|null, + * } $dnsInfo * @param list $errors + * @param QueryMetadata|array{ + * identifierScheme: string, + * identifierValue: string, + * smlDomain: string, + * timestamp: string, + * version: string, + * } $queryMetadata + * @param ServiceMetadata|array{ + * endpoints: list, + * queryTimeMs: float, + * status: string, + * error?: string|null, + * } $serviceMetadata */ public static function with( - BusinessCard $businessCard, + BusinessCard|array $businessCard, array $certificates, - DNSInfo $dnsInfo, + DNSInfo|array $dnsInfo, array $errors, float $executionTimeMs, - QueryMetadata $queryMetadata, - ServiceMetadata $serviceMetadata, + QueryMetadata|array $queryMetadata, + ServiceMetadata|array $serviceMetadata, string $status, ): self { $obj = new self; - $obj->businessCard = $businessCard; - $obj->certificates = $certificates; - $obj->dnsInfo = $dnsInfo; - $obj->errors = $errors; - $obj->executionTimeMs = $executionTimeMs; - $obj->queryMetadata = $queryMetadata; - $obj->serviceMetadata = $serviceMetadata; - $obj->status = $status; + $obj['businessCard'] = $businessCard; + $obj['certificates'] = $certificates; + $obj['dnsInfo'] = $dnsInfo; + $obj['errors'] = $errors; + $obj['executionTimeMs'] = $executionTimeMs; + $obj['queryMetadata'] = $queryMetadata; + $obj['serviceMetadata'] = $serviceMetadata; + $obj['status'] = $status; return $obj; } /** * Business card information for the Peppol participant. + * + * @param BusinessCard|array{ + * entities: list, + * queryTimeMs: float, + * status: string, + * error?: string|null, + * } $businessCard */ - public function withBusinessCard(BusinessCard $businessCard): self + public function withBusinessCard(BusinessCard|array $businessCard): self { $obj = clone $this; - $obj->businessCard = $businessCard; + $obj['businessCard'] = $businessCard; return $obj; } @@ -178,23 +215,32 @@ public function withBusinessCard(BusinessCard $businessCard): self /** * List of certificates found for the Peppol participant. * - * @param list $certificates + * @param list|null, error?: string|null + * }> $certificates */ public function withCertificates(array $certificates): self { $obj = clone $this; - $obj->certificates = $certificates; + $obj['certificates'] = $certificates; return $obj; } /** * Information about the DNS lookup performed. + * + * @param DNSInfo|array{ + * dnsRecords: list, + * smlHostname: string, + * status: string, + * error?: string|null, + * } $dnsInfo */ - public function withDNSInfo(DNSInfo $dnsInfo): self + public function withDNSInfo(DNSInfo|array $dnsInfo): self { $obj = clone $this; - $obj->dnsInfo = $dnsInfo; + $obj['dnsInfo'] = $dnsInfo; return $obj; } @@ -207,7 +253,7 @@ public function withDNSInfo(DNSInfo $dnsInfo): self public function withErrors(array $errors): self { $obj = clone $this; - $obj->errors = $errors; + $obj['errors'] = $errors; return $obj; } @@ -218,29 +264,45 @@ public function withErrors(array $errors): self public function withExecutionTimeMs(float $executionTimeMs): self { $obj = clone $this; - $obj->executionTimeMs = $executionTimeMs; + $obj['executionTimeMs'] = $executionTimeMs; return $obj; } /** * Metadata about the query that was performed. + * + * @param QueryMetadata|array{ + * identifierScheme: string, + * identifierValue: string, + * smlDomain: string, + * timestamp: string, + * version: string, + * } $queryMetadata */ - public function withQueryMetadata(QueryMetadata $queryMetadata): self + public function withQueryMetadata(QueryMetadata|array $queryMetadata): self { $obj = clone $this; - $obj->queryMetadata = $queryMetadata; + $obj['queryMetadata'] = $queryMetadata; return $obj; } /** * Service metadata information for the Peppol participant. + * + * @param ServiceMetadata|array{ + * endpoints: list, + * queryTimeMs: float, + * status: string, + * error?: string|null, + * } $serviceMetadata */ - public function withServiceMetadata(ServiceMetadata $serviceMetadata): self - { + public function withServiceMetadata( + ServiceMetadata|array $serviceMetadata + ): self { $obj = clone $this; - $obj->serviceMetadata = $serviceMetadata; + $obj['serviceMetadata'] = $serviceMetadata; return $obj; } @@ -251,7 +313,7 @@ public function withServiceMetadata(ServiceMetadata $serviceMetadata): self public function withStatus(string $status): self { $obj = clone $this; - $obj->status = $status; + $obj['status'] = $status; return $obj; } diff --git a/src/Lookup/LookupGetResponse/BusinessCard.php b/src/Lookup/LookupGetResponse/BusinessCard.php index c2c55f86..274cbf72 100644 --- a/src/Lookup/LookupGetResponse/BusinessCard.php +++ b/src/Lookup/LookupGetResponse/BusinessCard.php @@ -74,7 +74,12 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list $entities + * @param list|null, + * countryCode?: string|null, + * name?: string|null, + * registrationDate?: string|null, + * }> $entities */ public static function with( array $entities, @@ -84,11 +89,11 @@ public static function with( ): self { $obj = new self; - $obj->entities = $entities; - $obj->queryTimeMs = $queryTimeMs; - $obj->status = $status; + $obj['entities'] = $entities; + $obj['queryTimeMs'] = $queryTimeMs; + $obj['status'] = $status; - null !== $error && $obj->error = $error; + null !== $error && $obj['error'] = $error; return $obj; } @@ -96,12 +101,17 @@ public static function with( /** * List of business entities associated with the Peppol ID. * - * @param list $entities + * @param list|null, + * countryCode?: string|null, + * name?: string|null, + * registrationDate?: string|null, + * }> $entities */ public function withEntities(array $entities): self { $obj = clone $this; - $obj->entities = $entities; + $obj['entities'] = $entities; return $obj; } @@ -112,7 +122,7 @@ public function withEntities(array $entities): self public function withQueryTimeMs(float $queryTimeMs): self { $obj = clone $this; - $obj->queryTimeMs = $queryTimeMs; + $obj['queryTimeMs'] = $queryTimeMs; return $obj; } @@ -123,7 +133,7 @@ public function withQueryTimeMs(float $queryTimeMs): self public function withStatus(string $status): self { $obj = clone $this; - $obj->status = $status; + $obj['status'] = $status; return $obj; } @@ -134,7 +144,7 @@ public function withStatus(string $status): self public function withError(?string $error): self { $obj = clone $this; - $obj->error = $error; + $obj['error'] = $error; return $obj; } diff --git a/src/Lookup/LookupGetResponse/BusinessCard/Entity.php b/src/Lookup/LookupGetResponse/BusinessCard/Entity.php index d6d72e0b..d58289fc 100644 --- a/src/Lookup/LookupGetResponse/BusinessCard/Entity.php +++ b/src/Lookup/LookupGetResponse/BusinessCard/Entity.php @@ -69,10 +69,10 @@ public static function with( ): self { $obj = new self; - null !== $additionalInformation && $obj->additionalInformation = $additionalInformation; - null !== $countryCode && $obj->countryCode = $countryCode; - null !== $name && $obj->name = $name; - null !== $registrationDate && $obj->registrationDate = $registrationDate; + null !== $additionalInformation && $obj['additionalInformation'] = $additionalInformation; + null !== $countryCode && $obj['countryCode'] = $countryCode; + null !== $name && $obj['name'] = $name; + null !== $registrationDate && $obj['registrationDate'] = $registrationDate; return $obj; } @@ -86,7 +86,7 @@ public function withAdditionalInformation( ?array $additionalInformation ): self { $obj = clone $this; - $obj->additionalInformation = $additionalInformation; + $obj['additionalInformation'] = $additionalInformation; return $obj; } @@ -97,7 +97,7 @@ public function withAdditionalInformation( public function withCountryCode(?string $countryCode): self { $obj = clone $this; - $obj->countryCode = $countryCode; + $obj['countryCode'] = $countryCode; return $obj; } @@ -108,7 +108,7 @@ public function withCountryCode(?string $countryCode): self public function withName(?string $name): self { $obj = clone $this; - $obj->name = $name; + $obj['name'] = $name; return $obj; } @@ -119,7 +119,7 @@ public function withName(?string $name): self public function withRegistrationDate(?string $registrationDate): self { $obj = clone $this; - $obj->registrationDate = $registrationDate; + $obj['registrationDate'] = $registrationDate; return $obj; } diff --git a/src/Lookup/LookupGetResponse/DNSInfo.php b/src/Lookup/LookupGetResponse/DNSInfo.php index 4b55d8a1..4707419d 100644 --- a/src/Lookup/LookupGetResponse/DNSInfo.php +++ b/src/Lookup/LookupGetResponse/DNSInfo.php @@ -74,7 +74,7 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list $dnsRecords + * @param list $dnsRecords */ public static function with( array $dnsRecords, @@ -84,11 +84,11 @@ public static function with( ): self { $obj = new self; - $obj->dnsRecords = $dnsRecords; - $obj->smlHostname = $smlHostname; - $obj->status = $status; + $obj['dnsRecords'] = $dnsRecords; + $obj['smlHostname'] = $smlHostname; + $obj['status'] = $status; - null !== $error && $obj->error = $error; + null !== $error && $obj['error'] = $error; return $obj; } @@ -96,12 +96,12 @@ public static function with( /** * List of DNS records found for the Peppol participant. * - * @param list $dnsRecords + * @param list $dnsRecords */ public function withDNSRecords(array $dnsRecords): self { $obj = clone $this; - $obj->dnsRecords = $dnsRecords; + $obj['dnsRecords'] = $dnsRecords; return $obj; } @@ -112,7 +112,7 @@ public function withDNSRecords(array $dnsRecords): self public function withSmlHostname(string $smlHostname): self { $obj = clone $this; - $obj->smlHostname = $smlHostname; + $obj['smlHostname'] = $smlHostname; return $obj; } @@ -123,7 +123,7 @@ public function withSmlHostname(string $smlHostname): self public function withStatus(string $status): self { $obj = clone $this; - $obj->status = $status; + $obj['status'] = $status; return $obj; } @@ -134,7 +134,7 @@ public function withStatus(string $status): self public function withError(?string $error): self { $obj = clone $this; - $obj->error = $error; + $obj['error'] = $error; return $obj; } diff --git a/src/Lookup/LookupGetResponse/DNSInfo/DNSRecord.php b/src/Lookup/LookupGetResponse/DNSInfo/DNSRecord.php index 7e41bd66..478c7f5e 100644 --- a/src/Lookup/LookupGetResponse/DNSInfo/DNSRecord.php +++ b/src/Lookup/LookupGetResponse/DNSInfo/DNSRecord.php @@ -52,7 +52,7 @@ public static function with(string $ip): self { $obj = new self; - $obj->ip = $ip; + $obj['ip'] = $ip; return $obj; } @@ -63,7 +63,7 @@ public static function with(string $ip): self public function withIP(string $ip): self { $obj = clone $this; - $obj->ip = $ip; + $obj['ip'] = $ip; return $obj; } diff --git a/src/Lookup/LookupGetResponse/QueryMetadata.php b/src/Lookup/LookupGetResponse/QueryMetadata.php index c035a59e..47b6f10a 100644 --- a/src/Lookup/LookupGetResponse/QueryMetadata.php +++ b/src/Lookup/LookupGetResponse/QueryMetadata.php @@ -98,11 +98,11 @@ public static function with( ): self { $obj = new self; - $obj->identifierScheme = $identifierScheme; - $obj->identifierValue = $identifierValue; - $obj->smlDomain = $smlDomain; - $obj->timestamp = $timestamp; - $obj->version = $version; + $obj['identifierScheme'] = $identifierScheme; + $obj['identifierValue'] = $identifierValue; + $obj['smlDomain'] = $smlDomain; + $obj['timestamp'] = $timestamp; + $obj['version'] = $version; return $obj; } @@ -113,7 +113,7 @@ public static function with( public function withIdentifierScheme(string $identifierScheme): self { $obj = clone $this; - $obj->identifierScheme = $identifierScheme; + $obj['identifierScheme'] = $identifierScheme; return $obj; } @@ -124,7 +124,7 @@ public function withIdentifierScheme(string $identifierScheme): self public function withIdentifierValue(string $identifierValue): self { $obj = clone $this; - $obj->identifierValue = $identifierValue; + $obj['identifierValue'] = $identifierValue; return $obj; } @@ -135,7 +135,7 @@ public function withIdentifierValue(string $identifierValue): self public function withSmlDomain(string $smlDomain): self { $obj = clone $this; - $obj->smlDomain = $smlDomain; + $obj['smlDomain'] = $smlDomain; return $obj; } @@ -146,7 +146,7 @@ public function withSmlDomain(string $smlDomain): self public function withTimestamp(string $timestamp): self { $obj = clone $this; - $obj->timestamp = $timestamp; + $obj['timestamp'] = $timestamp; return $obj; } @@ -157,7 +157,7 @@ public function withTimestamp(string $timestamp): self public function withVersion(string $version): self { $obj = clone $this; - $obj->version = $version; + $obj['version'] = $version; return $obj; } diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata.php b/src/Lookup/LookupGetResponse/ServiceMetadata.php index ff5a2a0d..19c9085d 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata.php @@ -8,6 +8,8 @@ use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Lookup\LookupGetResponse\ServiceMetadata\Endpoint; +use EInvoiceAPI\Lookup\LookupGetResponse\ServiceMetadata\Endpoint\DocumentType; +use EInvoiceAPI\Lookup\LookupGetResponse\ServiceMetadata\Endpoint\Process; /** * Service metadata information for the Peppol participant. @@ -74,7 +76,13 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list $endpoints + * @param list, + * status: string, + * url: string, + * error?: string|null, + * processes?: list|null, + * }> $endpoints */ public static function with( array $endpoints, @@ -84,11 +92,11 @@ public static function with( ): self { $obj = new self; - $obj->endpoints = $endpoints; - $obj->queryTimeMs = $queryTimeMs; - $obj->status = $status; + $obj['endpoints'] = $endpoints; + $obj['queryTimeMs'] = $queryTimeMs; + $obj['status'] = $status; - null !== $error && $obj->error = $error; + null !== $error && $obj['error'] = $error; return $obj; } @@ -96,12 +104,18 @@ public static function with( /** * List of endpoints found for the Peppol participant. * - * @param list $endpoints + * @param list, + * status: string, + * url: string, + * error?: string|null, + * processes?: list|null, + * }> $endpoints */ public function withEndpoints(array $endpoints): self { $obj = clone $this; - $obj->endpoints = $endpoints; + $obj['endpoints'] = $endpoints; return $obj; } @@ -112,7 +126,7 @@ public function withEndpoints(array $endpoints): self public function withQueryTimeMs(float $queryTimeMs): self { $obj = clone $this; - $obj->queryTimeMs = $queryTimeMs; + $obj['queryTimeMs'] = $queryTimeMs; return $obj; } @@ -123,7 +137,7 @@ public function withQueryTimeMs(float $queryTimeMs): self public function withStatus(string $status): self { $obj = clone $this; - $obj->status = $status; + $obj['status'] = $status; return $obj; } @@ -134,7 +148,7 @@ public function withStatus(string $status): self public function withError(?string $error): self { $obj = clone $this; - $obj->error = $error; + $obj['error'] = $error; return $obj; } diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint.php index 9b984a75..c979126b 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint.php @@ -9,6 +9,7 @@ use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Lookup\LookupGetResponse\ServiceMetadata\Endpoint\DocumentType; use EInvoiceAPI\Lookup\LookupGetResponse\ServiceMetadata\Endpoint\Process; +use EInvoiceAPI\Lookup\LookupGetResponse\ServiceMetadata\Endpoint\Process\ProcessID; /** * Information about a Peppol participant's endpoint. @@ -84,8 +85,11 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list $documentTypes - * @param list|null $processes + * @param list $documentTypes + * @param list, + * processId: ProcessID, + * }>|null $processes */ public static function with( array $documentTypes, @@ -96,12 +100,12 @@ public static function with( ): self { $obj = new self; - $obj->documentTypes = $documentTypes; - $obj->status = $status; - $obj->url = $url; + $obj['documentTypes'] = $documentTypes; + $obj['status'] = $status; + $obj['url'] = $url; - null !== $error && $obj->error = $error; - null !== $processes && $obj->processes = $processes; + null !== $error && $obj['error'] = $error; + null !== $processes && $obj['processes'] = $processes; return $obj; } @@ -109,12 +113,12 @@ public static function with( /** * List of document types supported by this endpoint. * - * @param list $documentTypes + * @param list $documentTypes */ public function withDocumentTypes(array $documentTypes): self { $obj = clone $this; - $obj->documentTypes = $documentTypes; + $obj['documentTypes'] = $documentTypes; return $obj; } @@ -125,7 +129,7 @@ public function withDocumentTypes(array $documentTypes): self public function withStatus(string $status): self { $obj = clone $this; - $obj->status = $status; + $obj['status'] = $status; return $obj; } @@ -136,7 +140,7 @@ public function withStatus(string $status): self public function withURL(string $url): self { $obj = clone $this; - $obj->url = $url; + $obj['url'] = $url; return $obj; } @@ -147,7 +151,7 @@ public function withURL(string $url): self public function withError(?string $error): self { $obj = clone $this; - $obj->error = $error; + $obj['error'] = $error; return $obj; } @@ -155,12 +159,15 @@ public function withError(?string $error): self /** * List of processes supported by this endpoint. * - * @param list|null $processes + * @param list, + * processId: ProcessID, + * }>|null $processes */ public function withProcesses(?array $processes): self { $obj = clone $this; - $obj->processes = $processes; + $obj['processes'] = $processes; return $obj; } diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/DocumentType.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/DocumentType.php index c23e4b4f..706d87f4 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/DocumentType.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/DocumentType.php @@ -58,8 +58,8 @@ public static function with(string $scheme, string $value): self { $obj = new self; - $obj->scheme = $scheme; - $obj->value = $value; + $obj['scheme'] = $scheme; + $obj['value'] = $value; return $obj; } @@ -70,7 +70,7 @@ public static function with(string $scheme, string $value): self public function withScheme(string $scheme): self { $obj = clone $this; - $obj->scheme = $scheme; + $obj['scheme'] = $scheme; return $obj; } @@ -81,7 +81,7 @@ public function withScheme(string $scheme): self public function withValue(string $value): self { $obj = clone $this; - $obj->value = $value; + $obj['value'] = $value; return $obj; } diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process.php index fb916a63..48331f06 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process.php @@ -7,6 +7,7 @@ use EInvoiceAPI\Core\Attributes\Api; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; +use EInvoiceAPI\Lookup\Certificate; use EInvoiceAPI\Lookup\LookupGetResponse\ServiceMetadata\Endpoint\Process\Endpoint; use EInvoiceAPI\Lookup\LookupGetResponse\ServiceMetadata\Endpoint\Process\ProcessID; @@ -60,14 +61,26 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list $endpoints + * @param list $endpoints + * @param ProcessID|array{scheme: string, value: string} $processId */ - public static function with(array $endpoints, ProcessID $processId): self - { + public static function with( + array $endpoints, + ProcessID|array $processId + ): self { $obj = new self; - $obj->endpoints = $endpoints; - $obj->processId = $processId; + $obj['endpoints'] = $endpoints; + $obj['processId'] = $processId; return $obj; } @@ -75,23 +88,34 @@ public static function with(array $endpoints, ProcessID $processId): self /** * List of endpoints supporting this process. * - * @param list $endpoints + * @param list $endpoints */ public function withEndpoints(array $endpoints): self { $obj = clone $this; - $obj->endpoints = $endpoints; + $obj['endpoints'] = $endpoints; return $obj; } /** * Identifier of the process. + * + * @param ProcessID|array{scheme: string, value: string} $processID */ - public function withProcessID(ProcessID $processID): self + public function withProcessID(ProcessID|array $processID): self { $obj = clone $this; - $obj->processId = $processID; + $obj['processId'] = $processID; return $obj; } diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/Endpoint.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/Endpoint.php index 06fce25f..05132008 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/Endpoint.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/Endpoint.php @@ -99,11 +99,15 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param Certificate|array{ + * status: string, details?: array|null, error?: string|null + * }|null $certificate */ public static function with( string $address, string $transportProfile, - ?Certificate $certificate = null, + Certificate|array|null $certificate = null, ?string $serviceActivationDate = null, ?string $serviceDescription = null, ?string $serviceExpirationDate = null, @@ -112,15 +116,15 @@ public static function with( ): self { $obj = new self; - $obj->address = $address; - $obj->transportProfile = $transportProfile; + $obj['address'] = $address; + $obj['transportProfile'] = $transportProfile; - null !== $certificate && $obj->certificate = $certificate; - null !== $serviceActivationDate && $obj->serviceActivationDate = $serviceActivationDate; - null !== $serviceDescription && $obj->serviceDescription = $serviceDescription; - null !== $serviceExpirationDate && $obj->serviceExpirationDate = $serviceExpirationDate; - null !== $technicalContactUrl && $obj->technicalContactUrl = $technicalContactUrl; - null !== $technicalInformationUrl && $obj->technicalInformationUrl = $technicalInformationUrl; + null !== $certificate && $obj['certificate'] = $certificate; + null !== $serviceActivationDate && $obj['serviceActivationDate'] = $serviceActivationDate; + null !== $serviceDescription && $obj['serviceDescription'] = $serviceDescription; + null !== $serviceExpirationDate && $obj['serviceExpirationDate'] = $serviceExpirationDate; + null !== $technicalContactUrl && $obj['technicalContactUrl'] = $technicalContactUrl; + null !== $technicalInformationUrl && $obj['technicalInformationUrl'] = $technicalInformationUrl; return $obj; } @@ -131,7 +135,7 @@ public static function with( public function withAddress(string $address): self { $obj = clone $this; - $obj->address = $address; + $obj['address'] = $address; return $obj; } @@ -142,18 +146,22 @@ public function withAddress(string $address): self public function withTransportProfile(string $transportProfile): self { $obj = clone $this; - $obj->transportProfile = $transportProfile; + $obj['transportProfile'] = $transportProfile; return $obj; } /** * Certificate information for a Peppol endpoint. + * + * @param Certificate|array{ + * status: string, details?: array|null, error?: string|null + * }|null $certificate */ - public function withCertificate(?Certificate $certificate): self + public function withCertificate(Certificate|array|null $certificate): self { $obj = clone $this; - $obj->certificate = $certificate; + $obj['certificate'] = $certificate; return $obj; } @@ -165,7 +173,7 @@ public function withServiceActivationDate( ?string $serviceActivationDate ): self { $obj = clone $this; - $obj->serviceActivationDate = $serviceActivationDate; + $obj['serviceActivationDate'] = $serviceActivationDate; return $obj; } @@ -176,7 +184,7 @@ public function withServiceActivationDate( public function withServiceDescription(?string $serviceDescription): self { $obj = clone $this; - $obj->serviceDescription = $serviceDescription; + $obj['serviceDescription'] = $serviceDescription; return $obj; } @@ -188,7 +196,7 @@ public function withServiceExpirationDate( ?string $serviceExpirationDate ): self { $obj = clone $this; - $obj->serviceExpirationDate = $serviceExpirationDate; + $obj['serviceExpirationDate'] = $serviceExpirationDate; return $obj; } @@ -199,7 +207,7 @@ public function withServiceExpirationDate( public function withTechnicalContactURL(?string $technicalContactURL): self { $obj = clone $this; - $obj->technicalContactUrl = $technicalContactURL; + $obj['technicalContactUrl'] = $technicalContactURL; return $obj; } @@ -211,7 +219,7 @@ public function withTechnicalInformationURL( ?string $technicalInformationURL ): self { $obj = clone $this; - $obj->technicalInformationUrl = $technicalInformationURL; + $obj['technicalInformationUrl'] = $technicalInformationURL; return $obj; } diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/ProcessID.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/ProcessID.php index 8b9cb773..66855b34 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/ProcessID.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/ProcessID.php @@ -58,8 +58,8 @@ public static function with(string $scheme, string $value): self { $obj = new self; - $obj->scheme = $scheme; - $obj->value = $value; + $obj['scheme'] = $scheme; + $obj['value'] = $value; return $obj; } @@ -70,7 +70,7 @@ public static function with(string $scheme, string $value): self public function withScheme(string $scheme): self { $obj = clone $this; - $obj->scheme = $scheme; + $obj['scheme'] = $scheme; return $obj; } @@ -81,7 +81,7 @@ public function withScheme(string $scheme): self public function withValue(string $value): self { $obj = clone $this; - $obj->value = $value; + $obj['value'] = $value; return $obj; } diff --git a/src/Lookup/LookupRetrieveParams.php b/src/Lookup/LookupRetrieveParams.php index bd6ee433..59218fdb 100644 --- a/src/Lookup/LookupRetrieveParams.php +++ b/src/Lookup/LookupRetrieveParams.php @@ -56,7 +56,7 @@ public static function with(string $peppol_id): self { $obj = new self; - $obj->peppol_id = $peppol_id; + $obj['peppol_id'] = $peppol_id; return $obj; } @@ -67,7 +67,7 @@ public static function with(string $peppol_id): self public function withPeppolID(string $peppolID): self { $obj = clone $this; - $obj->peppol_id = $peppolID; + $obj['peppol_id'] = $peppolID; return $obj; } diff --git a/src/Lookup/LookupRetrieveParticipantsParams.php b/src/Lookup/LookupRetrieveParticipantsParams.php index 152c8195..5f72c9d2 100644 --- a/src/Lookup/LookupRetrieveParticipantsParams.php +++ b/src/Lookup/LookupRetrieveParticipantsParams.php @@ -66,9 +66,9 @@ public static function with( ): self { $obj = new self; - $obj->query = $query; + $obj['query'] = $query; - null !== $country_code && $obj->country_code = $country_code; + null !== $country_code && $obj['country_code'] = $country_code; return $obj; } @@ -79,7 +79,7 @@ public static function with( public function withQuery(string $query): self { $obj = clone $this; - $obj->query = $query; + $obj['query'] = $query; return $obj; } @@ -90,7 +90,7 @@ public function withQuery(string $query): self public function withCountryCode(?string $countryCode): self { $obj = clone $this; - $obj->country_code = $countryCode; + $obj['country_code'] = $countryCode; return $obj; } diff --git a/src/Me/MeGetResponse.php b/src/Me/MeGetResponse.php index 332c9441..50009bb7 100644 --- a/src/Me/MeGetResponse.php +++ b/src/Me/MeGetResponse.php @@ -190,24 +190,24 @@ public static function with( ): self { $obj = new self; - $obj->credit_balance = $credit_balance; - $obj->name = $name; + $obj['credit_balance'] = $credit_balance; + $obj['name'] = $name; $obj['plan'] = $plan; - null !== $bcc_recipient_email && $obj->bcc_recipient_email = $bcc_recipient_email; - null !== $company_address && $obj->company_address = $company_address; - null !== $company_city && $obj->company_city = $company_city; - null !== $company_country && $obj->company_country = $company_country; - null !== $company_email && $obj->company_email = $company_email; - null !== $company_name && $obj->company_name = $company_name; - null !== $company_number && $obj->company_number = $company_number; - null !== $company_tax_id && $obj->company_tax_id = $company_tax_id; - null !== $company_zip && $obj->company_zip = $company_zip; - null !== $description && $obj->description = $description; - null !== $ibans && $obj->ibans = $ibans; - null !== $peppol_ids && $obj->peppol_ids = $peppol_ids; - null !== $smp_registration && $obj->smp_registration = $smp_registration; - null !== $smp_registration_date && $obj->smp_registration_date = $smp_registration_date; + null !== $bcc_recipient_email && $obj['bcc_recipient_email'] = $bcc_recipient_email; + null !== $company_address && $obj['company_address'] = $company_address; + null !== $company_city && $obj['company_city'] = $company_city; + null !== $company_country && $obj['company_country'] = $company_country; + null !== $company_email && $obj['company_email'] = $company_email; + null !== $company_name && $obj['company_name'] = $company_name; + null !== $company_number && $obj['company_number'] = $company_number; + null !== $company_tax_id && $obj['company_tax_id'] = $company_tax_id; + null !== $company_zip && $obj['company_zip'] = $company_zip; + null !== $description && $obj['description'] = $description; + null !== $ibans && $obj['ibans'] = $ibans; + null !== $peppol_ids && $obj['peppol_ids'] = $peppol_ids; + null !== $smp_registration && $obj['smp_registration'] = $smp_registration; + null !== $smp_registration_date && $obj['smp_registration_date'] = $smp_registration_date; return $obj; } @@ -218,7 +218,7 @@ public static function with( public function withCreditBalance(int $creditBalance): self { $obj = clone $this; - $obj->credit_balance = $creditBalance; + $obj['credit_balance'] = $creditBalance; return $obj; } @@ -226,7 +226,7 @@ public function withCreditBalance(int $creditBalance): self public function withName(string $name): self { $obj = clone $this; - $obj->name = $name; + $obj['name'] = $name; return $obj; } @@ -250,7 +250,7 @@ public function withPlan(Plan|string $plan): self public function withBccRecipientEmail(?string $bccRecipientEmail): self { $obj = clone $this; - $obj->bcc_recipient_email = $bccRecipientEmail; + $obj['bcc_recipient_email'] = $bccRecipientEmail; return $obj; } @@ -261,7 +261,7 @@ public function withBccRecipientEmail(?string $bccRecipientEmail): self public function withCompanyAddress(?string $companyAddress): self { $obj = clone $this; - $obj->company_address = $companyAddress; + $obj['company_address'] = $companyAddress; return $obj; } @@ -272,7 +272,7 @@ public function withCompanyAddress(?string $companyAddress): self public function withCompanyCity(?string $companyCity): self { $obj = clone $this; - $obj->company_city = $companyCity; + $obj['company_city'] = $companyCity; return $obj; } @@ -283,7 +283,7 @@ public function withCompanyCity(?string $companyCity): self public function withCompanyCountry(?string $companyCountry): self { $obj = clone $this; - $obj->company_country = $companyCountry; + $obj['company_country'] = $companyCountry; return $obj; } @@ -294,7 +294,7 @@ public function withCompanyCountry(?string $companyCountry): self public function withCompanyEmail(?string $companyEmail): self { $obj = clone $this; - $obj->company_email = $companyEmail; + $obj['company_email'] = $companyEmail; return $obj; } @@ -305,7 +305,7 @@ public function withCompanyEmail(?string $companyEmail): self public function withCompanyName(?string $companyName): self { $obj = clone $this; - $obj->company_name = $companyName; + $obj['company_name'] = $companyName; return $obj; } @@ -316,7 +316,7 @@ public function withCompanyName(?string $companyName): self public function withCompanyNumber(?string $companyNumber): self { $obj = clone $this; - $obj->company_number = $companyNumber; + $obj['company_number'] = $companyNumber; return $obj; } @@ -327,7 +327,7 @@ public function withCompanyNumber(?string $companyNumber): self public function withCompanyTaxID(?string $companyTaxID): self { $obj = clone $this; - $obj->company_tax_id = $companyTaxID; + $obj['company_tax_id'] = $companyTaxID; return $obj; } @@ -338,7 +338,7 @@ public function withCompanyTaxID(?string $companyTaxID): self public function withCompanyZip(?string $companyZip): self { $obj = clone $this; - $obj->company_zip = $companyZip; + $obj['company_zip'] = $companyZip; return $obj; } @@ -346,7 +346,7 @@ public function withCompanyZip(?string $companyZip): self public function withDescription(?string $description): self { $obj = clone $this; - $obj->description = $description; + $obj['description'] = $description; return $obj; } @@ -359,7 +359,7 @@ public function withDescription(?string $description): self public function withIbans(?array $ibans): self { $obj = clone $this; - $obj->ibans = $ibans; + $obj['ibans'] = $ibans; return $obj; } @@ -372,7 +372,7 @@ public function withIbans(?array $ibans): self public function withPeppolIDs(?array $peppolIDs): self { $obj = clone $this; - $obj->peppol_ids = $peppolIDs; + $obj['peppol_ids'] = $peppolIDs; return $obj; } @@ -383,7 +383,7 @@ public function withPeppolIDs(?array $peppolIDs): self public function withSmpRegistration(?bool $smpRegistration): self { $obj = clone $this; - $obj->smp_registration = $smpRegistration; + $obj['smp_registration'] = $smpRegistration; return $obj; } @@ -395,7 +395,7 @@ public function withSmpRegistrationDate( ?\DateTimeInterface $smpRegistrationDate ): self { $obj = clone $this; - $obj->smp_registration_date = $smpRegistrationDate; + $obj['smp_registration_date'] = $smpRegistrationDate; return $obj; } diff --git a/src/Outbox/OutboxListDraftDocumentsParams.php b/src/Outbox/OutboxListDraftDocumentsParams.php index 7bdd37dc..54b1d38a 100644 --- a/src/Outbox/OutboxListDraftDocumentsParams.php +++ b/src/Outbox/OutboxListDraftDocumentsParams.php @@ -50,8 +50,8 @@ public static function with(?int $page = null, ?int $page_size = null): self { $obj = new self; - null !== $page && $obj->page = $page; - null !== $page_size && $obj->page_size = $page_size; + null !== $page && $obj['page'] = $page; + null !== $page_size && $obj['page_size'] = $page_size; return $obj; } @@ -62,7 +62,7 @@ public static function with(?int $page = null, ?int $page_size = null): self public function withPage(int $page): self { $obj = clone $this; - $obj->page = $page; + $obj['page'] = $page; return $obj; } @@ -73,7 +73,7 @@ public function withPage(int $page): self public function withPageSize(int $pageSize): self { $obj = clone $this; - $obj->page_size = $pageSize; + $obj['page_size'] = $pageSize; return $obj; } diff --git a/src/Outbox/OutboxListReceivedDocumentsParams.php b/src/Outbox/OutboxListReceivedDocumentsParams.php index 24dbfac1..9dfdf22b 100644 --- a/src/Outbox/OutboxListReceivedDocumentsParams.php +++ b/src/Outbox/OutboxListReceivedDocumentsParams.php @@ -110,12 +110,12 @@ public static function with( ): self { $obj = new self; - null !== $date_from && $obj->date_from = $date_from; - null !== $date_to && $obj->date_to = $date_to; - null !== $page && $obj->page = $page; - null !== $page_size && $obj->page_size = $page_size; - null !== $search && $obj->search = $search; - null !== $sender && $obj->sender = $sender; + null !== $date_from && $obj['date_from'] = $date_from; + null !== $date_to && $obj['date_to'] = $date_to; + null !== $page && $obj['page'] = $page; + null !== $page_size && $obj['page_size'] = $page_size; + null !== $search && $obj['search'] = $search; + null !== $sender && $obj['sender'] = $sender; null !== $state && $obj['state'] = $state; null !== $type && $obj['type'] = $type; @@ -128,7 +128,7 @@ public static function with( public function withDateFrom(?\DateTimeInterface $dateFrom): self { $obj = clone $this; - $obj->date_from = $dateFrom; + $obj['date_from'] = $dateFrom; return $obj; } @@ -139,7 +139,7 @@ public function withDateFrom(?\DateTimeInterface $dateFrom): self public function withDateTo(?\DateTimeInterface $dateTo): self { $obj = clone $this; - $obj->date_to = $dateTo; + $obj['date_to'] = $dateTo; return $obj; } @@ -150,7 +150,7 @@ public function withDateTo(?\DateTimeInterface $dateTo): self public function withPage(int $page): self { $obj = clone $this; - $obj->page = $page; + $obj['page'] = $page; return $obj; } @@ -161,7 +161,7 @@ public function withPage(int $page): self public function withPageSize(int $pageSize): self { $obj = clone $this; - $obj->page_size = $pageSize; + $obj['page_size'] = $pageSize; return $obj; } @@ -172,7 +172,7 @@ public function withPageSize(int $pageSize): self public function withSearch(?string $search): self { $obj = clone $this; - $obj->search = $search; + $obj['search'] = $search; return $obj; } @@ -183,7 +183,7 @@ public function withSearch(?string $search): self public function withSender(?string $sender): self { $obj = clone $this; - $obj->sender = $sender; + $obj['sender'] = $sender; return $obj; } diff --git a/src/Validate/UblDocumentValidation.php b/src/Validate/UblDocumentValidation.php index 40e080c0..04d03017 100644 --- a/src/Validate/UblDocumentValidation.php +++ b/src/Validate/UblDocumentValidation.php @@ -10,6 +10,7 @@ use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; use EInvoiceAPI\Validate\UblDocumentValidation\Issue; +use EInvoiceAPI\Validate\UblDocumentValidation\Issue\Type; /** * @phpstan-type UblDocumentValidationShape = array{ @@ -71,7 +72,15 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list $issues + * @param list, + * flag?: string|null, + * location?: string|null, + * rule_id?: string|null, + * test?: string|null, + * }> $issues */ public static function with( string $id, @@ -82,12 +91,12 @@ public static function with( ): self { $obj = new self; - $obj->id = $id; - $obj->file_name = $file_name; - $obj->is_valid = $is_valid; - $obj->issues = $issues; + $obj['id'] = $id; + $obj['file_name'] = $file_name; + $obj['is_valid'] = $is_valid; + $obj['issues'] = $issues; - null !== $ubl_document && $obj->ubl_document = $ubl_document; + null !== $ubl_document && $obj['ubl_document'] = $ubl_document; return $obj; } @@ -95,7 +104,7 @@ public static function with( public function withID(string $id): self { $obj = clone $this; - $obj->id = $id; + $obj['id'] = $id; return $obj; } @@ -103,7 +112,7 @@ public function withID(string $id): self public function withFileName(?string $fileName): self { $obj = clone $this; - $obj->file_name = $fileName; + $obj['file_name'] = $fileName; return $obj; } @@ -111,18 +120,26 @@ public function withFileName(?string $fileName): self public function withIsValid(bool $isValid): self { $obj = clone $this; - $obj->is_valid = $isValid; + $obj['is_valid'] = $isValid; return $obj; } /** - * @param list $issues + * @param list, + * flag?: string|null, + * location?: string|null, + * rule_id?: string|null, + * test?: string|null, + * }> $issues */ public function withIssues(array $issues): self { $obj = clone $this; - $obj->issues = $issues; + $obj['issues'] = $issues; return $obj; } @@ -130,7 +147,7 @@ public function withIssues(array $issues): self public function withUblDocument(?string $ublDocument): self { $obj = clone $this; - $obj->ubl_document = $ublDocument; + $obj['ubl_document'] = $ublDocument; return $obj; } diff --git a/src/Validate/UblDocumentValidation/Issue.php b/src/Validate/UblDocumentValidation/Issue.php index 2c874a68..7e173426 100644 --- a/src/Validate/UblDocumentValidation/Issue.php +++ b/src/Validate/UblDocumentValidation/Issue.php @@ -84,14 +84,14 @@ public static function with( ): self { $obj = new self; - $obj->message = $message; - $obj->schematron = $schematron; + $obj['message'] = $message; + $obj['schematron'] = $schematron; $obj['type'] = $type; - null !== $flag && $obj->flag = $flag; - null !== $location && $obj->location = $location; - null !== $rule_id && $obj->rule_id = $rule_id; - null !== $test && $obj->test = $test; + null !== $flag && $obj['flag'] = $flag; + null !== $location && $obj['location'] = $location; + null !== $rule_id && $obj['rule_id'] = $rule_id; + null !== $test && $obj['test'] = $test; return $obj; } @@ -99,7 +99,7 @@ public static function with( public function withMessage(string $message): self { $obj = clone $this; - $obj->message = $message; + $obj['message'] = $message; return $obj; } @@ -107,7 +107,7 @@ public function withMessage(string $message): self public function withSchematron(string $schematron): self { $obj = clone $this; - $obj->schematron = $schematron; + $obj['schematron'] = $schematron; return $obj; } @@ -126,7 +126,7 @@ public function withType(Type|string $type): self public function withFlag(?string $flag): self { $obj = clone $this; - $obj->flag = $flag; + $obj['flag'] = $flag; return $obj; } @@ -134,7 +134,7 @@ public function withFlag(?string $flag): self public function withLocation(?string $location): self { $obj = clone $this; - $obj->location = $location; + $obj['location'] = $location; return $obj; } @@ -142,7 +142,7 @@ public function withLocation(?string $location): self public function withRuleID(?string $ruleID): self { $obj = clone $this; - $obj->rule_id = $ruleID; + $obj['rule_id'] = $ruleID; return $obj; } @@ -150,7 +150,7 @@ public function withRuleID(?string $ruleID): self public function withTest(?string $test): self { $obj = clone $this; - $obj->test = $test; + $obj['test'] = $test; return $obj; } diff --git a/src/Validate/ValidateValidateJsonParams.php b/src/Validate/ValidateValidateJsonParams.php index 5931528b..fae709a4 100644 --- a/src/Validate/ValidateValidateJsonParams.php +++ b/src/Validate/ValidateValidateJsonParams.php @@ -13,11 +13,13 @@ use EInvoiceAPI\Documents\DocumentDirection; use EInvoiceAPI\Documents\DocumentType; use EInvoiceAPI\Documents\PaymentDetailCreate; +use EInvoiceAPI\Documents\UnitOfMeasureCode; use EInvoiceAPI\Inbox\DocumentState; use EInvoiceAPI\Validate\ValidateValidateJsonParams\Allowance; +use EInvoiceAPI\Validate\ValidateValidateJsonParams\Allowance\ReasonCode; +use EInvoiceAPI\Validate\ValidateValidateJsonParams\Allowance\TaxCode; use EInvoiceAPI\Validate\ValidateValidateJsonParams\Charge; use EInvoiceAPI\Validate\ValidateValidateJsonParams\Item; -use EInvoiceAPI\Validate\ValidateValidateJsonParams\TaxCode; use EInvoiceAPI\Validate\ValidateValidateJsonParams\TaxDetail; use EInvoiceAPI\Validate\ValidateValidateJsonParams\Vatex; @@ -27,12 +29,33 @@ * @see EInvoiceAPI\Services\ValidateService::validateJson() * * @phpstan-type ValidateValidateJsonParamsShape = array{ - * allowances?: list|null, + * allowances?: list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null, * amount_due?: float|string|null, - * attachments?: list|null, + * attachments?: list|null, * billing_address?: string|null, * billing_address_recipient?: string|null, - * charges?: list|null, + * charges?: list|null, + * tax_code?: value-of<\EInvoiceAPI\Validate\ValidateValidateJsonParams\Charge\TaxCode>|null, + * tax_rate?: float|string|null, + * }>|null, * currency?: CurrencyCode|value-of, * customer_address?: string|null, * customer_address_recipient?: string|null, @@ -47,9 +70,26 @@ * invoice_date?: \DateTimeInterface|null, * invoice_id?: string|null, * invoice_total?: float|string|null, - * items?: list, + * items?: list|null, + * amount?: float|string|null, + * charges?: list<\EInvoiceAPI\Validate\ValidateValidateJsonParams\Item\Charge>|null, + * date?: null|null, + * description?: string|null, + * product_code?: string|null, + * quantity?: float|string|null, + * tax?: float|string|null, + * tax_rate?: float|string|null, + * unit?: value-of|null, + * unit_price?: float|string|null, + * }>, * note?: string|null, - * payment_details?: list|null, + * payment_details?: list|null, * payment_term?: string|null, * previous_unpaid_balance?: float|string|null, * purchase_order?: string|null, @@ -63,8 +103,10 @@ * shipping_address_recipient?: string|null, * state?: DocumentState|value-of, * subtotal?: float|string|null, - * tax_code?: TaxCode|value-of, - * tax_details?: list|null, + * tax_code?: \EInvoiceAPI\Validate\ValidateValidateJsonParams\TaxCode|value-of<\EInvoiceAPI\Validate\ValidateValidateJsonParams\TaxCode>, + * tax_details?: list|null, * total_discount?: float|string|null, * total_tax?: float|string|null, * vatex?: null|Vatex|value-of, @@ -304,9 +346,12 @@ final class ValidateValidateJsonParams implements BaseModel /** * Tax category code of the invoice (e.g., S for standard rate, Z for zero rate, E for exempt). * - * @var value-of|null $tax_code + * @var value-of|null $tax_code */ - #[Api(enum: TaxCode::class, optional: true)] + #[Api( + enum: ValidateValidateJsonParams\TaxCode::class, + optional: true, + )] public ?string $tax_code; /** @var list|null $tax_details */ @@ -388,17 +433,57 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list|null $allowances - * @param list|null $attachments - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $allowances + * @param list|null $attachments + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $charges * @param CurrencyCode|value-of $currency * @param DocumentDirection|value-of $direction * @param DocumentType|value-of $document_type - * @param list $items - * @param list|null $payment_details + * @param list|null, + * amount?: float|string|null, + * charges?: list|null, + * date?: null|null, + * description?: string|null, + * product_code?: string|null, + * quantity?: float|string|null, + * tax?: float|string|null, + * tax_rate?: float|string|null, + * unit?: value-of|null, + * unit_price?: float|string|null, + * }> $items + * @param list|null $payment_details * @param DocumentState|value-of $state - * @param TaxCode|value-of $tax_code - * @param list|null $tax_details + * @param ValidateValidateJsonParams\TaxCode|value-of $tax_code + * @param list|null $tax_details * @param Vatex|value-of|null $vatex */ public static function with( @@ -438,7 +523,7 @@ public static function with( ?string $shipping_address_recipient = null, DocumentState|string|null $state = null, float|string|null $subtotal = null, - TaxCode|string|null $tax_code = null, + ValidateValidateJsonParams\TaxCode|string|null $tax_code = null, ?array $tax_details = null, float|string|null $total_discount = null, float|string|null $total_tax = null, @@ -453,65 +538,73 @@ public static function with( ): self { $obj = new self; - null !== $allowances && $obj->allowances = $allowances; - null !== $amount_due && $obj->amount_due = $amount_due; - null !== $attachments && $obj->attachments = $attachments; - null !== $billing_address && $obj->billing_address = $billing_address; - null !== $billing_address_recipient && $obj->billing_address_recipient = $billing_address_recipient; - null !== $charges && $obj->charges = $charges; + null !== $allowances && $obj['allowances'] = $allowances; + null !== $amount_due && $obj['amount_due'] = $amount_due; + null !== $attachments && $obj['attachments'] = $attachments; + null !== $billing_address && $obj['billing_address'] = $billing_address; + null !== $billing_address_recipient && $obj['billing_address_recipient'] = $billing_address_recipient; + null !== $charges && $obj['charges'] = $charges; null !== $currency && $obj['currency'] = $currency; - null !== $customer_address && $obj->customer_address = $customer_address; - null !== $customer_address_recipient && $obj->customer_address_recipient = $customer_address_recipient; - null !== $customer_company_id && $obj->customer_company_id = $customer_company_id; - null !== $customer_email && $obj->customer_email = $customer_email; - null !== $customer_id && $obj->customer_id = $customer_id; - null !== $customer_name && $obj->customer_name = $customer_name; - null !== $customer_tax_id && $obj->customer_tax_id = $customer_tax_id; + null !== $customer_address && $obj['customer_address'] = $customer_address; + null !== $customer_address_recipient && $obj['customer_address_recipient'] = $customer_address_recipient; + null !== $customer_company_id && $obj['customer_company_id'] = $customer_company_id; + null !== $customer_email && $obj['customer_email'] = $customer_email; + null !== $customer_id && $obj['customer_id'] = $customer_id; + null !== $customer_name && $obj['customer_name'] = $customer_name; + null !== $customer_tax_id && $obj['customer_tax_id'] = $customer_tax_id; null !== $direction && $obj['direction'] = $direction; null !== $document_type && $obj['document_type'] = $document_type; - null !== $due_date && $obj->due_date = $due_date; - null !== $invoice_date && $obj->invoice_date = $invoice_date; - null !== $invoice_id && $obj->invoice_id = $invoice_id; - null !== $invoice_total && $obj->invoice_total = $invoice_total; - null !== $items && $obj->items = $items; - null !== $note && $obj->note = $note; - null !== $payment_details && $obj->payment_details = $payment_details; - null !== $payment_term && $obj->payment_term = $payment_term; - null !== $previous_unpaid_balance && $obj->previous_unpaid_balance = $previous_unpaid_balance; - null !== $purchase_order && $obj->purchase_order = $purchase_order; - null !== $remittance_address && $obj->remittance_address = $remittance_address; - null !== $remittance_address_recipient && $obj->remittance_address_recipient = $remittance_address_recipient; - null !== $service_address && $obj->service_address = $service_address; - null !== $service_address_recipient && $obj->service_address_recipient = $service_address_recipient; - null !== $service_end_date && $obj->service_end_date = $service_end_date; - null !== $service_start_date && $obj->service_start_date = $service_start_date; - null !== $shipping_address && $obj->shipping_address = $shipping_address; - null !== $shipping_address_recipient && $obj->shipping_address_recipient = $shipping_address_recipient; + null !== $due_date && $obj['due_date'] = $due_date; + null !== $invoice_date && $obj['invoice_date'] = $invoice_date; + null !== $invoice_id && $obj['invoice_id'] = $invoice_id; + null !== $invoice_total && $obj['invoice_total'] = $invoice_total; + null !== $items && $obj['items'] = $items; + null !== $note && $obj['note'] = $note; + null !== $payment_details && $obj['payment_details'] = $payment_details; + null !== $payment_term && $obj['payment_term'] = $payment_term; + null !== $previous_unpaid_balance && $obj['previous_unpaid_balance'] = $previous_unpaid_balance; + null !== $purchase_order && $obj['purchase_order'] = $purchase_order; + null !== $remittance_address && $obj['remittance_address'] = $remittance_address; + null !== $remittance_address_recipient && $obj['remittance_address_recipient'] = $remittance_address_recipient; + null !== $service_address && $obj['service_address'] = $service_address; + null !== $service_address_recipient && $obj['service_address_recipient'] = $service_address_recipient; + null !== $service_end_date && $obj['service_end_date'] = $service_end_date; + null !== $service_start_date && $obj['service_start_date'] = $service_start_date; + null !== $shipping_address && $obj['shipping_address'] = $shipping_address; + null !== $shipping_address_recipient && $obj['shipping_address_recipient'] = $shipping_address_recipient; null !== $state && $obj['state'] = $state; - null !== $subtotal && $obj->subtotal = $subtotal; + null !== $subtotal && $obj['subtotal'] = $subtotal; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_details && $obj->tax_details = $tax_details; - null !== $total_discount && $obj->total_discount = $total_discount; - null !== $total_tax && $obj->total_tax = $total_tax; + null !== $tax_details && $obj['tax_details'] = $tax_details; + null !== $total_discount && $obj['total_discount'] = $total_discount; + null !== $total_tax && $obj['total_tax'] = $total_tax; null !== $vatex && $obj['vatex'] = $vatex; - null !== $vatex_note && $obj->vatex_note = $vatex_note; - null !== $vendor_address && $obj->vendor_address = $vendor_address; - null !== $vendor_address_recipient && $obj->vendor_address_recipient = $vendor_address_recipient; - null !== $vendor_company_id && $obj->vendor_company_id = $vendor_company_id; - null !== $vendor_email && $obj->vendor_email = $vendor_email; - null !== $vendor_name && $obj->vendor_name = $vendor_name; - null !== $vendor_tax_id && $obj->vendor_tax_id = $vendor_tax_id; + null !== $vatex_note && $obj['vatex_note'] = $vatex_note; + null !== $vendor_address && $obj['vendor_address'] = $vendor_address; + null !== $vendor_address_recipient && $obj['vendor_address_recipient'] = $vendor_address_recipient; + null !== $vendor_company_id && $obj['vendor_company_id'] = $vendor_company_id; + null !== $vendor_email && $obj['vendor_email'] = $vendor_email; + null !== $vendor_name && $obj['vendor_name'] = $vendor_name; + null !== $vendor_tax_id && $obj['vendor_tax_id'] = $vendor_tax_id; return $obj; } /** - * @param list|null $allowances + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $allowances */ public function withAllowances(?array $allowances): self { $obj = clone $this; - $obj->allowances = $allowances; + $obj['allowances'] = $allowances; return $obj; } @@ -522,18 +615,23 @@ public function withAllowances(?array $allowances): self public function withAmountDue(float|string|null $amountDue): self { $obj = clone $this; - $obj->amount_due = $amountDue; + $obj['amount_due'] = $amountDue; return $obj; } /** - * @param list|null $attachments + * @param list|null $attachments */ public function withAttachments(?array $attachments): self { $obj = clone $this; - $obj->attachments = $attachments; + $obj['attachments'] = $attachments; return $obj; } @@ -544,7 +642,7 @@ public function withAttachments(?array $attachments): self public function withBillingAddress(?string $billingAddress): self { $obj = clone $this; - $obj->billing_address = $billingAddress; + $obj['billing_address'] = $billingAddress; return $obj; } @@ -556,18 +654,26 @@ public function withBillingAddressRecipient( ?string $billingAddressRecipient ): self { $obj = clone $this; - $obj->billing_address_recipient = $billingAddressRecipient; + $obj['billing_address_recipient'] = $billingAddressRecipient; return $obj; } /** - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $charges */ public function withCharges(?array $charges): self { $obj = clone $this; - $obj->charges = $charges; + $obj['charges'] = $charges; return $obj; } @@ -591,7 +697,7 @@ public function withCurrency(CurrencyCode|string $currency): self public function withCustomerAddress(?string $customerAddress): self { $obj = clone $this; - $obj->customer_address = $customerAddress; + $obj['customer_address'] = $customerAddress; return $obj; } @@ -603,7 +709,7 @@ public function withCustomerAddressRecipient( ?string $customerAddressRecipient ): self { $obj = clone $this; - $obj->customer_address_recipient = $customerAddressRecipient; + $obj['customer_address_recipient'] = $customerAddressRecipient; return $obj; } @@ -614,7 +720,7 @@ public function withCustomerAddressRecipient( public function withCustomerCompanyID(?string $customerCompanyID): self { $obj = clone $this; - $obj->customer_company_id = $customerCompanyID; + $obj['customer_company_id'] = $customerCompanyID; return $obj; } @@ -625,7 +731,7 @@ public function withCustomerCompanyID(?string $customerCompanyID): self public function withCustomerEmail(?string $customerEmail): self { $obj = clone $this; - $obj->customer_email = $customerEmail; + $obj['customer_email'] = $customerEmail; return $obj; } @@ -636,7 +742,7 @@ public function withCustomerEmail(?string $customerEmail): self public function withCustomerID(?string $customerID): self { $obj = clone $this; - $obj->customer_id = $customerID; + $obj['customer_id'] = $customerID; return $obj; } @@ -647,7 +753,7 @@ public function withCustomerID(?string $customerID): self public function withCustomerName(?string $customerName): self { $obj = clone $this; - $obj->customer_name = $customerName; + $obj['customer_name'] = $customerName; return $obj; } @@ -658,7 +764,7 @@ public function withCustomerName(?string $customerName): self public function withCustomerTaxID(?string $customerTaxID): self { $obj = clone $this; - $obj->customer_tax_id = $customerTaxID; + $obj['customer_tax_id'] = $customerTaxID; return $obj; } @@ -695,7 +801,7 @@ public function withDocumentType(DocumentType|string $documentType): self public function withDueDate(?\DateTimeInterface $dueDate): self { $obj = clone $this; - $obj->due_date = $dueDate; + $obj['due_date'] = $dueDate; return $obj; } @@ -706,7 +812,7 @@ public function withDueDate(?\DateTimeInterface $dueDate): self public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self { $obj = clone $this; - $obj->invoice_date = $invoiceDate; + $obj['invoice_date'] = $invoiceDate; return $obj; } @@ -717,7 +823,7 @@ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self public function withInvoiceID(?string $invoiceID): self { $obj = clone $this; - $obj->invoice_id = $invoiceID; + $obj['invoice_id'] = $invoiceID; return $obj; } @@ -728,7 +834,7 @@ public function withInvoiceID(?string $invoiceID): self public function withInvoiceTotal(float|string|null $invoiceTotal): self { $obj = clone $this; - $obj->invoice_total = $invoiceTotal; + $obj['invoice_total'] = $invoiceTotal; return $obj; } @@ -736,12 +842,24 @@ public function withInvoiceTotal(float|string|null $invoiceTotal): self /** * At least one line item is required. * - * @param list $items + * @param list|null, + * amount?: float|string|null, + * charges?: list|null, + * date?: null|null, + * description?: string|null, + * product_code?: string|null, + * quantity?: float|string|null, + * tax?: float|string|null, + * tax_rate?: float|string|null, + * unit?: value-of|null, + * unit_price?: float|string|null, + * }> $items */ public function withItems(array $items): self { $obj = clone $this; - $obj->items = $items; + $obj['items'] = $items; return $obj; } @@ -752,18 +870,23 @@ public function withItems(array $items): self public function withNote(?string $note): self { $obj = clone $this; - $obj->note = $note; + $obj['note'] = $note; return $obj; } /** - * @param list|null $paymentDetails + * @param list|null $paymentDetails */ public function withPaymentDetails(?array $paymentDetails): self { $obj = clone $this; - $obj->payment_details = $paymentDetails; + $obj['payment_details'] = $paymentDetails; return $obj; } @@ -774,7 +897,7 @@ public function withPaymentDetails(?array $paymentDetails): self public function withPaymentTerm(?string $paymentTerm): self { $obj = clone $this; - $obj->payment_term = $paymentTerm; + $obj['payment_term'] = $paymentTerm; return $obj; } @@ -786,7 +909,7 @@ public function withPreviousUnpaidBalance( float|string|null $previousUnpaidBalance ): self { $obj = clone $this; - $obj->previous_unpaid_balance = $previousUnpaidBalance; + $obj['previous_unpaid_balance'] = $previousUnpaidBalance; return $obj; } @@ -797,7 +920,7 @@ public function withPreviousUnpaidBalance( public function withPurchaseOrder(?string $purchaseOrder): self { $obj = clone $this; - $obj->purchase_order = $purchaseOrder; + $obj['purchase_order'] = $purchaseOrder; return $obj; } @@ -808,7 +931,7 @@ public function withPurchaseOrder(?string $purchaseOrder): self public function withRemittanceAddress(?string $remittanceAddress): self { $obj = clone $this; - $obj->remittance_address = $remittanceAddress; + $obj['remittance_address'] = $remittanceAddress; return $obj; } @@ -820,7 +943,7 @@ public function withRemittanceAddressRecipient( ?string $remittanceAddressRecipient ): self { $obj = clone $this; - $obj->remittance_address_recipient = $remittanceAddressRecipient; + $obj['remittance_address_recipient'] = $remittanceAddressRecipient; return $obj; } @@ -831,7 +954,7 @@ public function withRemittanceAddressRecipient( public function withServiceAddress(?string $serviceAddress): self { $obj = clone $this; - $obj->service_address = $serviceAddress; + $obj['service_address'] = $serviceAddress; return $obj; } @@ -843,7 +966,7 @@ public function withServiceAddressRecipient( ?string $serviceAddressRecipient ): self { $obj = clone $this; - $obj->service_address_recipient = $serviceAddressRecipient; + $obj['service_address_recipient'] = $serviceAddressRecipient; return $obj; } @@ -855,7 +978,7 @@ public function withServiceEndDate( ?\DateTimeInterface $serviceEndDate ): self { $obj = clone $this; - $obj->service_end_date = $serviceEndDate; + $obj['service_end_date'] = $serviceEndDate; return $obj; } @@ -867,7 +990,7 @@ public function withServiceStartDate( ?\DateTimeInterface $serviceStartDate ): self { $obj = clone $this; - $obj->service_start_date = $serviceStartDate; + $obj['service_start_date'] = $serviceStartDate; return $obj; } @@ -878,7 +1001,7 @@ public function withServiceStartDate( public function withShippingAddress(?string $shippingAddress): self { $obj = clone $this; - $obj->shipping_address = $shippingAddress; + $obj['shipping_address'] = $shippingAddress; return $obj; } @@ -890,7 +1013,7 @@ public function withShippingAddressRecipient( ?string $shippingAddressRecipient ): self { $obj = clone $this; - $obj->shipping_address_recipient = $shippingAddressRecipient; + $obj['shipping_address_recipient'] = $shippingAddressRecipient; return $obj; } @@ -914,7 +1037,7 @@ public function withState(DocumentState|string $state): self public function withSubtotal(float|string|null $subtotal): self { $obj = clone $this; - $obj->subtotal = $subtotal; + $obj['subtotal'] = $subtotal; return $obj; } @@ -922,10 +1045,11 @@ public function withSubtotal(float|string|null $subtotal): self /** * Tax category code of the invoice (e.g., S for standard rate, Z for zero rate, E for exempt). * - * @param TaxCode|value-of $taxCode + * @param ValidateValidateJsonParams\TaxCode|value-of $taxCode */ - public function withTaxCode(TaxCode|string $taxCode): self - { + public function withTaxCode( + ValidateValidateJsonParams\TaxCode|string $taxCode + ): self { $obj = clone $this; $obj['tax_code'] = $taxCode; @@ -933,12 +1057,14 @@ public function withTaxCode(TaxCode|string $taxCode): self } /** - * @param list|null $taxDetails + * @param list|null $taxDetails */ public function withTaxDetails(?array $taxDetails): self { $obj = clone $this; - $obj->tax_details = $taxDetails; + $obj['tax_details'] = $taxDetails; return $obj; } @@ -949,7 +1075,7 @@ public function withTaxDetails(?array $taxDetails): self public function withTotalDiscount(float|string|null $totalDiscount): self { $obj = clone $this; - $obj->total_discount = $totalDiscount; + $obj['total_discount'] = $totalDiscount; return $obj; } @@ -960,7 +1086,7 @@ public function withTotalDiscount(float|string|null $totalDiscount): self public function withTotalTax(float|string|null $totalTax): self { $obj = clone $this; - $obj->total_tax = $totalTax; + $obj['total_tax'] = $totalTax; return $obj; } @@ -987,7 +1113,7 @@ public function withVatex(Vatex|string|null $vatex): self public function withVatexNote(?string $vatexNote): self { $obj = clone $this; - $obj->vatex_note = $vatexNote; + $obj['vatex_note'] = $vatexNote; return $obj; } @@ -998,7 +1124,7 @@ public function withVatexNote(?string $vatexNote): self public function withVendorAddress(?string $vendorAddress): self { $obj = clone $this; - $obj->vendor_address = $vendorAddress; + $obj['vendor_address'] = $vendorAddress; return $obj; } @@ -1010,7 +1136,7 @@ public function withVendorAddressRecipient( ?string $vendorAddressRecipient ): self { $obj = clone $this; - $obj->vendor_address_recipient = $vendorAddressRecipient; + $obj['vendor_address_recipient'] = $vendorAddressRecipient; return $obj; } @@ -1021,7 +1147,7 @@ public function withVendorAddressRecipient( public function withVendorCompanyID(?string $vendorCompanyID): self { $obj = clone $this; - $obj->vendor_company_id = $vendorCompanyID; + $obj['vendor_company_id'] = $vendorCompanyID; return $obj; } @@ -1032,7 +1158,7 @@ public function withVendorCompanyID(?string $vendorCompanyID): self public function withVendorEmail(?string $vendorEmail): self { $obj = clone $this; - $obj->vendor_email = $vendorEmail; + $obj['vendor_email'] = $vendorEmail; return $obj; } @@ -1043,7 +1169,7 @@ public function withVendorEmail(?string $vendorEmail): self public function withVendorName(?string $vendorName): self { $obj = clone $this; - $obj->vendor_name = $vendorName; + $obj['vendor_name'] = $vendorName; return $obj; } @@ -1054,7 +1180,7 @@ public function withVendorName(?string $vendorName): self public function withVendorTaxID(?string $vendorTaxID): self { $obj = clone $this; - $obj->vendor_tax_id = $vendorTaxID; + $obj['vendor_tax_id'] = $vendorTaxID; return $obj; } diff --git a/src/Validate/ValidateValidateJsonParams/Allowance.php b/src/Validate/ValidateValidateJsonParams/Allowance.php index 6d4537c4..41e4e4c2 100644 --- a/src/Validate/ValidateValidateJsonParams/Allowance.php +++ b/src/Validate/ValidateValidateJsonParams/Allowance.php @@ -101,13 +101,13 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $base_amount && $obj->base_amount = $base_amount; - null !== $multiplier_factor && $obj->multiplier_factor = $multiplier_factor; - null !== $reason && $obj->reason = $reason; + null !== $amount && $obj['amount'] = $amount; + null !== $base_amount && $obj['base_amount'] = $base_amount; + null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $reason && $obj['reason'] = $reason; null !== $reason_code && $obj['reason_code'] = $reason_code; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; return $obj; } @@ -118,7 +118,7 @@ public static function with( public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -129,7 +129,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj->base_amount = $baseAmount; + $obj['base_amount'] = $baseAmount; return $obj; } @@ -141,7 +141,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj->multiplier_factor = $multiplierFactor; + $obj['multiplier_factor'] = $multiplierFactor; return $obj; } @@ -152,7 +152,7 @@ public function withMultiplierFactor( public function withReason(?string $reason): self { $obj = clone $this; - $obj->reason = $reason; + $obj['reason'] = $reason; return $obj; } @@ -190,7 +190,7 @@ public function withTaxCode( public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } diff --git a/src/Validate/ValidateValidateJsonParams/Charge.php b/src/Validate/ValidateValidateJsonParams/Charge.php index 268a164a..5960be04 100644 --- a/src/Validate/ValidateValidateJsonParams/Charge.php +++ b/src/Validate/ValidateValidateJsonParams/Charge.php @@ -106,13 +106,13 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $base_amount && $obj->base_amount = $base_amount; - null !== $multiplier_factor && $obj->multiplier_factor = $multiplier_factor; - null !== $reason && $obj->reason = $reason; + null !== $amount && $obj['amount'] = $amount; + null !== $base_amount && $obj['base_amount'] = $base_amount; + null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $reason && $obj['reason'] = $reason; null !== $reason_code && $obj['reason_code'] = $reason_code; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; return $obj; } @@ -123,7 +123,7 @@ public static function with( public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -134,7 +134,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj->base_amount = $baseAmount; + $obj['base_amount'] = $baseAmount; return $obj; } @@ -146,7 +146,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj->multiplier_factor = $multiplierFactor; + $obj['multiplier_factor'] = $multiplierFactor; return $obj; } @@ -157,7 +157,7 @@ public function withMultiplierFactor( public function withReason(?string $reason): self { $obj = clone $this; - $obj->reason = $reason; + $obj['reason'] = $reason; return $obj; } @@ -199,7 +199,7 @@ public function withTaxCode( public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } diff --git a/src/Validate/ValidateValidateJsonParams/Item.php b/src/Validate/ValidateValidateJsonParams/Item.php index 1d206b2a..bdf0028e 100644 --- a/src/Validate/ValidateValidateJsonParams/Item.php +++ b/src/Validate/ValidateValidateJsonParams/Item.php @@ -9,6 +9,8 @@ use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\UnitOfMeasureCode; use EInvoiceAPI\Validate\ValidateValidateJsonParams\Item\Allowance; +use EInvoiceAPI\Validate\ValidateValidateJsonParams\Item\Allowance\ReasonCode; +use EInvoiceAPI\Validate\ValidateValidateJsonParams\Item\Allowance\TaxCode; use EInvoiceAPI\Validate\ValidateValidateJsonParams\Item\Charge; /** @@ -119,8 +121,24 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list|null $allowances - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $allowances + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $charges * @param UnitOfMeasureCode|value-of|null $unit */ public static function with( @@ -138,18 +156,18 @@ public static function with( ): self { $obj = new self; - $obj->date = $date; + $obj['date'] = $date; - null !== $allowances && $obj->allowances = $allowances; - null !== $amount && $obj->amount = $amount; - null !== $charges && $obj->charges = $charges; - null !== $description && $obj->description = $description; - null !== $product_code && $obj->product_code = $product_code; - null !== $quantity && $obj->quantity = $quantity; - null !== $tax && $obj->tax = $tax; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $allowances && $obj['allowances'] = $allowances; + null !== $amount && $obj['amount'] = $amount; + null !== $charges && $obj['charges'] = $charges; + null !== $description && $obj['description'] = $description; + null !== $product_code && $obj['product_code'] = $product_code; + null !== $quantity && $obj['quantity'] = $quantity; + null !== $tax && $obj['tax'] = $tax; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; null !== $unit && $obj['unit'] = $unit; - null !== $unit_price && $obj->unit_price = $unit_price; + null !== $unit_price && $obj['unit_price'] = $unit_price; return $obj; } @@ -157,12 +175,20 @@ public static function with( /** * The allowances of the line item. * - * @param list|null $allowances + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $allowances */ public function withAllowances(?array $allowances): self { $obj = clone $this; - $obj->allowances = $allowances; + $obj['allowances'] = $allowances; return $obj; } @@ -173,7 +199,7 @@ public function withAllowances(?array $allowances): self public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -181,12 +207,20 @@ public function withAmount(float|string|null $amount): self /** * The charges of the line item. * - * @param list|null $charges + * @param list|null, + * tax_code?: value-of|null, + * tax_rate?: float|string|null, + * }>|null $charges */ public function withCharges(?array $charges): self { $obj = clone $this; - $obj->charges = $charges; + $obj['charges'] = $charges; return $obj; } @@ -197,7 +231,7 @@ public function withCharges(?array $charges): self public function withDate(null $date): self { $obj = clone $this; - $obj->date = $date; + $obj['date'] = $date; return $obj; } @@ -208,7 +242,7 @@ public function withDate(null $date): self public function withDescription(?string $description): self { $obj = clone $this; - $obj->description = $description; + $obj['description'] = $description; return $obj; } @@ -219,7 +253,7 @@ public function withDescription(?string $description): self public function withProductCode(?string $productCode): self { $obj = clone $this; - $obj->product_code = $productCode; + $obj['product_code'] = $productCode; return $obj; } @@ -230,7 +264,7 @@ public function withProductCode(?string $productCode): self public function withQuantity(float|string|null $quantity): self { $obj = clone $this; - $obj->quantity = $quantity; + $obj['quantity'] = $quantity; return $obj; } @@ -241,7 +275,7 @@ public function withQuantity(float|string|null $quantity): self public function withTax(float|string|null $tax): self { $obj = clone $this; - $obj->tax = $tax; + $obj['tax'] = $tax; return $obj; } @@ -252,7 +286,7 @@ public function withTax(float|string|null $tax): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } @@ -276,7 +310,7 @@ public function withUnit(UnitOfMeasureCode|string|null $unit): self public function withUnitPrice(float|string|null $unitPrice): self { $obj = clone $this; - $obj->unit_price = $unitPrice; + $obj['unit_price'] = $unitPrice; return $obj; } diff --git a/src/Validate/ValidateValidateJsonParams/Item/Allowance.php b/src/Validate/ValidateValidateJsonParams/Item/Allowance.php index f44c46e6..662da8a6 100644 --- a/src/Validate/ValidateValidateJsonParams/Item/Allowance.php +++ b/src/Validate/ValidateValidateJsonParams/Item/Allowance.php @@ -98,13 +98,13 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $base_amount && $obj->base_amount = $base_amount; - null !== $multiplier_factor && $obj->multiplier_factor = $multiplier_factor; - null !== $reason && $obj->reason = $reason; + null !== $amount && $obj['amount'] = $amount; + null !== $base_amount && $obj['base_amount'] = $base_amount; + null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $reason && $obj['reason'] = $reason; null !== $reason_code && $obj['reason_code'] = $reason_code; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; return $obj; } @@ -115,7 +115,7 @@ public static function with( public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -126,7 +126,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj->base_amount = $baseAmount; + $obj['base_amount'] = $baseAmount; return $obj; } @@ -138,7 +138,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj->multiplier_factor = $multiplierFactor; + $obj['multiplier_factor'] = $multiplierFactor; return $obj; } @@ -149,7 +149,7 @@ public function withMultiplierFactor( public function withReason(?string $reason): self { $obj = clone $this; - $obj->reason = $reason; + $obj['reason'] = $reason; return $obj; } @@ -186,7 +186,7 @@ public function withTaxCode(TaxCode|string $taxCode): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } diff --git a/src/Validate/ValidateValidateJsonParams/Item/Charge.php b/src/Validate/ValidateValidateJsonParams/Item/Charge.php index f888c588..c2fa66e9 100644 --- a/src/Validate/ValidateValidateJsonParams/Item/Charge.php +++ b/src/Validate/ValidateValidateJsonParams/Item/Charge.php @@ -102,13 +102,13 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $base_amount && $obj->base_amount = $base_amount; - null !== $multiplier_factor && $obj->multiplier_factor = $multiplier_factor; - null !== $reason && $obj->reason = $reason; + null !== $amount && $obj['amount'] = $amount; + null !== $base_amount && $obj['base_amount'] = $base_amount; + null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $reason && $obj['reason'] = $reason; null !== $reason_code && $obj['reason_code'] = $reason_code; null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj->tax_rate = $tax_rate; + null !== $tax_rate && $obj['tax_rate'] = $tax_rate; return $obj; } @@ -119,7 +119,7 @@ public static function with( public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -130,7 +130,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj->base_amount = $baseAmount; + $obj['base_amount'] = $baseAmount; return $obj; } @@ -142,7 +142,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj->multiplier_factor = $multiplierFactor; + $obj['multiplier_factor'] = $multiplierFactor; return $obj; } @@ -153,7 +153,7 @@ public function withMultiplierFactor( public function withReason(?string $reason): self { $obj = clone $this; - $obj->reason = $reason; + $obj['reason'] = $reason; return $obj; } @@ -194,7 +194,7 @@ public function withTaxCode(TaxCode|string|null $taxCode): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj->tax_rate = $taxRate; + $obj['tax_rate'] = $taxRate; return $obj; } diff --git a/src/Validate/ValidateValidateJsonParams/TaxDetail.php b/src/Validate/ValidateValidateJsonParams/TaxDetail.php index 8c46c116..6d25840b 100644 --- a/src/Validate/ValidateValidateJsonParams/TaxDetail.php +++ b/src/Validate/ValidateValidateJsonParams/TaxDetail.php @@ -46,8 +46,8 @@ public static function with( ): self { $obj = new self; - null !== $amount && $obj->amount = $amount; - null !== $rate && $obj->rate = $rate; + null !== $amount && $obj['amount'] = $amount; + null !== $rate && $obj['rate'] = $rate; return $obj; } @@ -58,7 +58,7 @@ public static function with( public function withAmount(float|string|null $amount): self { $obj = clone $this; - $obj->amount = $amount; + $obj['amount'] = $amount; return $obj; } @@ -69,7 +69,7 @@ public function withAmount(float|string|null $amount): self public function withRate(?string $rate): self { $obj = clone $this; - $obj->rate = $rate; + $obj['rate'] = $rate; return $obj; } diff --git a/src/Validate/ValidateValidatePeppolIDParams.php b/src/Validate/ValidateValidatePeppolIDParams.php index b9f5b0c8..3389fed5 100644 --- a/src/Validate/ValidateValidatePeppolIDParams.php +++ b/src/Validate/ValidateValidatePeppolIDParams.php @@ -56,7 +56,7 @@ public static function with(string $peppol_id): self { $obj = new self; - $obj->peppol_id = $peppol_id; + $obj['peppol_id'] = $peppol_id; return $obj; } @@ -67,7 +67,7 @@ public static function with(string $peppol_id): self public function withPeppolID(string $peppolID): self { $obj = clone $this; - $obj->peppol_id = $peppolID; + $obj['peppol_id'] = $peppolID; return $obj; } diff --git a/src/Validate/ValidateValidatePeppolIDResponse.php b/src/Validate/ValidateValidatePeppolIDResponse.php index bab86636..21483145 100644 --- a/src/Validate/ValidateValidatePeppolIDResponse.php +++ b/src/Validate/ValidateValidatePeppolIDResponse.php @@ -90,10 +90,15 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param BusinessCard|array{ + * country_code?: string|null, + * name?: string|null, + * registration_date?: \DateTimeInterface|null, + * }|null $business_card * @param list $supported_document_types */ public static function with( - ?BusinessCard $business_card, + BusinessCard|array|null $business_card, bool $business_card_valid, bool $dns_valid, bool $is_valid, @@ -101,23 +106,30 @@ public static function with( ): self { $obj = new self; - $obj->business_card = $business_card; - $obj->business_card_valid = $business_card_valid; - $obj->dns_valid = $dns_valid; - $obj->is_valid = $is_valid; + $obj['business_card'] = $business_card; + $obj['business_card_valid'] = $business_card_valid; + $obj['dns_valid'] = $dns_valid; + $obj['is_valid'] = $is_valid; - null !== $supported_document_types && $obj->supported_document_types = $supported_document_types; + null !== $supported_document_types && $obj['supported_document_types'] = $supported_document_types; return $obj; } /** * Business card information for the Peppol ID. + * + * @param BusinessCard|array{ + * country_code?: string|null, + * name?: string|null, + * registration_date?: \DateTimeInterface|null, + * }|null $businessCard */ - public function withBusinessCard(?BusinessCard $businessCard): self - { + public function withBusinessCard( + BusinessCard|array|null $businessCard + ): self { $obj = clone $this; - $obj->business_card = $businessCard; + $obj['business_card'] = $businessCard; return $obj; } @@ -128,7 +140,7 @@ public function withBusinessCard(?BusinessCard $businessCard): self public function withBusinessCardValid(bool $businessCardValid): self { $obj = clone $this; - $obj->business_card_valid = $businessCardValid; + $obj['business_card_valid'] = $businessCardValid; return $obj; } @@ -139,7 +151,7 @@ public function withBusinessCardValid(bool $businessCardValid): self public function withDNSValid(bool $dnsValid): self { $obj = clone $this; - $obj->dns_valid = $dnsValid; + $obj['dns_valid'] = $dnsValid; return $obj; } @@ -150,7 +162,7 @@ public function withDNSValid(bool $dnsValid): self public function withIsValid(bool $isValid): self { $obj = clone $this; - $obj->is_valid = $isValid; + $obj['is_valid'] = $isValid; return $obj; } @@ -162,7 +174,7 @@ public function withSupportedDocumentTypes( array $supportedDocumentTypes ): self { $obj = clone $this; - $obj->supported_document_types = $supportedDocumentTypes; + $obj['supported_document_types'] = $supportedDocumentTypes; return $obj; } diff --git a/src/Validate/ValidateValidatePeppolIDResponse/BusinessCard.php b/src/Validate/ValidateValidatePeppolIDResponse/BusinessCard.php index 891934ff..131684ac 100644 --- a/src/Validate/ValidateValidatePeppolIDResponse/BusinessCard.php +++ b/src/Validate/ValidateValidatePeppolIDResponse/BusinessCard.php @@ -48,9 +48,9 @@ public static function with( ): self { $obj = new self; - null !== $country_code && $obj->country_code = $country_code; - null !== $name && $obj->name = $name; - null !== $registration_date && $obj->registration_date = $registration_date; + null !== $country_code && $obj['country_code'] = $country_code; + null !== $name && $obj['name'] = $name; + null !== $registration_date && $obj['registration_date'] = $registration_date; return $obj; } @@ -58,7 +58,7 @@ public static function with( public function withCountryCode(?string $countryCode): self { $obj = clone $this; - $obj->country_code = $countryCode; + $obj['country_code'] = $countryCode; return $obj; } @@ -66,7 +66,7 @@ public function withCountryCode(?string $countryCode): self public function withName(?string $name): self { $obj = clone $this; - $obj->name = $name; + $obj['name'] = $name; return $obj; } @@ -75,7 +75,7 @@ public function withRegistrationDate( ?\DateTimeInterface $registrationDate ): self { $obj = clone $this; - $obj->registration_date = $registrationDate; + $obj['registration_date'] = $registrationDate; return $obj; } diff --git a/src/Validate/ValidateValidateUblParams.php b/src/Validate/ValidateValidateUblParams.php index ebde8035..27181cee 100644 --- a/src/Validate/ValidateValidateUblParams.php +++ b/src/Validate/ValidateValidateUblParams.php @@ -53,7 +53,7 @@ public static function with(string $file): self { $obj = new self; - $obj->file = $file; + $obj['file'] = $file; return $obj; } @@ -61,7 +61,7 @@ public static function with(string $file): self public function withFile(string $file): self { $obj = clone $this; - $obj->file = $file; + $obj['file'] = $file; return $obj; } diff --git a/src/Webhooks/WebhookCreateParams.php b/src/Webhooks/WebhookCreateParams.php index de0aeac1..710e0963 100644 --- a/src/Webhooks/WebhookCreateParams.php +++ b/src/Webhooks/WebhookCreateParams.php @@ -67,10 +67,10 @@ public static function with( ): self { $obj = new self; - $obj->events = $events; - $obj->url = $url; + $obj['events'] = $events; + $obj['url'] = $url; - null !== $enabled && $obj->enabled = $enabled; + null !== $enabled && $obj['enabled'] = $enabled; return $obj; } @@ -81,7 +81,7 @@ public static function with( public function withEvents(array $events): self { $obj = clone $this; - $obj->events = $events; + $obj['events'] = $events; return $obj; } @@ -89,7 +89,7 @@ public function withEvents(array $events): self public function withURL(string $url): self { $obj = clone $this; - $obj->url = $url; + $obj['url'] = $url; return $obj; } @@ -97,7 +97,7 @@ public function withURL(string $url): self public function withEnabled(bool $enabled): self { $obj = clone $this; - $obj->enabled = $enabled; + $obj['enabled'] = $enabled; return $obj; } diff --git a/src/Webhooks/WebhookDeleteResponse.php b/src/Webhooks/WebhookDeleteResponse.php index 3f7afd87..b2a4b8b5 100644 --- a/src/Webhooks/WebhookDeleteResponse.php +++ b/src/Webhooks/WebhookDeleteResponse.php @@ -53,7 +53,7 @@ public static function with(bool $is_deleted): self { $obj = new self; - $obj->is_deleted = $is_deleted; + $obj['is_deleted'] = $is_deleted; return $obj; } @@ -61,7 +61,7 @@ public static function with(bool $is_deleted): self public function withIsDeleted(bool $isDeleted): self { $obj = clone $this; - $obj->is_deleted = $isDeleted; + $obj['is_deleted'] = $isDeleted; return $obj; } diff --git a/src/Webhooks/WebhookResponse.php b/src/Webhooks/WebhookResponse.php index 403ec09c..aeddf094 100644 --- a/src/Webhooks/WebhookResponse.php +++ b/src/Webhooks/WebhookResponse.php @@ -83,12 +83,12 @@ public static function with( ): self { $obj = new self; - $obj->id = $id; - $obj->events = $events; - $obj->secret = $secret; - $obj->url = $url; + $obj['id'] = $id; + $obj['events'] = $events; + $obj['secret'] = $secret; + $obj['url'] = $url; - null !== $enabled && $obj->enabled = $enabled; + null !== $enabled && $obj['enabled'] = $enabled; return $obj; } @@ -96,7 +96,7 @@ public static function with( public function withID(string $id): self { $obj = clone $this; - $obj->id = $id; + $obj['id'] = $id; return $obj; } @@ -107,7 +107,7 @@ public function withID(string $id): self public function withEvents(array $events): self { $obj = clone $this; - $obj->events = $events; + $obj['events'] = $events; return $obj; } @@ -115,7 +115,7 @@ public function withEvents(array $events): self public function withSecret(string $secret): self { $obj = clone $this; - $obj->secret = $secret; + $obj['secret'] = $secret; return $obj; } @@ -123,7 +123,7 @@ public function withSecret(string $secret): self public function withURL(string $url): self { $obj = clone $this; - $obj->url = $url; + $obj['url'] = $url; return $obj; } @@ -131,7 +131,7 @@ public function withURL(string $url): self public function withEnabled(bool $enabled): self { $obj = clone $this; - $obj->enabled = $enabled; + $obj['enabled'] = $enabled; return $obj; } diff --git a/src/Webhooks/WebhookUpdateParams.php b/src/Webhooks/WebhookUpdateParams.php index 70becf73..73dab7e2 100644 --- a/src/Webhooks/WebhookUpdateParams.php +++ b/src/Webhooks/WebhookUpdateParams.php @@ -53,9 +53,9 @@ public static function with( ): self { $obj = new self; - null !== $enabled && $obj->enabled = $enabled; - null !== $events && $obj->events = $events; - null !== $url && $obj->url = $url; + null !== $enabled && $obj['enabled'] = $enabled; + null !== $events && $obj['events'] = $events; + null !== $url && $obj['url'] = $url; return $obj; } @@ -63,7 +63,7 @@ public static function with( public function withEnabled(?bool $enabled): self { $obj = clone $this; - $obj->enabled = $enabled; + $obj['enabled'] = $enabled; return $obj; } @@ -74,7 +74,7 @@ public function withEnabled(?bool $enabled): self public function withEvents(?array $events): self { $obj = clone $this; - $obj->events = $events; + $obj['events'] = $events; return $obj; } @@ -82,7 +82,7 @@ public function withEvents(?array $events): self public function withURL(?string $url): self { $obj = clone $this; - $obj->url = $url; + $obj['url'] = $url; return $obj; } From ebca89eaa03eff90dd4ee4435910fb2c0658703e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 03:15:00 +0000 Subject: [PATCH 2/9] feat: add `BaseResponse` class for accessing raw responses --- src/Core/BaseClient.php | 37 ++----- src/Core/Concerns/ResponseProxy.php | 101 ++++++++++++++++++ src/Core/Concerns/SdkPage.php | 16 ++- src/Core/Concerns/SdkResponse.php | 29 ----- src/Core/Contracts/BasePage.php | 19 ---- src/Core/Contracts/BaseResponse.php | 21 ++++ src/Core/Contracts/BaseStream.php | 1 + src/Core/Conversion.php | 11 -- .../Contracts/ResponseConverter.php | 18 ---- src/Core/Implementation/RawResponse.php | 100 +++++++++++++++++ .../Attachments/AttachmentDeleteResponse.php | 6 +- .../Attachments/DocumentAttachment.php | 6 +- src/Documents/DocumentDeleteResponse.php | 6 +- src/Documents/DocumentNewFromPdfResponse.php | 6 +- src/Documents/DocumentResponse.php | 6 +- src/Documents/Ubl/UblGetResponse.php | 6 +- src/DocumentsNumberPage.php | 16 ++- src/Lookup/LookupGetParticipantsResponse.php | 6 +- src/Lookup/LookupGetResponse.php | 6 +- src/Me/MeGetResponse.php | 6 +- src/Services/Documents/AttachmentsService.php | 25 +++-- src/Services/Documents/UblService.php | 13 ++- src/Services/DocumentsService.php | 37 ++++--- src/Services/InboxService.php | 19 ++-- src/Services/LookupService.php | 13 ++- src/Services/MeService.php | 7 +- src/Services/OutboxService.php | 13 ++- src/Services/ValidateService.php | 19 ++-- src/Services/WebhooksService.php | 31 ++++-- src/Validate/UblDocumentValidation.php | 6 +- .../ValidateValidatePeppolIDResponse.php | 6 +- src/Webhooks/WebhookDeleteResponse.php | 6 +- src/Webhooks/WebhookResponse.php | 6 +- 33 files changed, 380 insertions(+), 244 deletions(-) create mode 100644 src/Core/Concerns/ResponseProxy.php delete mode 100644 src/Core/Concerns/SdkResponse.php create mode 100644 src/Core/Contracts/BaseResponse.php delete mode 100644 src/Core/Conversion/Contracts/ResponseConverter.php create mode 100644 src/Core/Implementation/RawResponse.php diff --git a/src/Core/BaseClient.php b/src/Core/BaseClient.php index 646a9a5d..b802dfe9 100644 --- a/src/Core/BaseClient.php +++ b/src/Core/BaseClient.php @@ -5,11 +5,13 @@ namespace EInvoiceAPI\Core; use EInvoiceAPI\Core\Contracts\BasePage; +use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Contracts\BaseStream; use EInvoiceAPI\Core\Conversion\Contracts\Converter; use EInvoiceAPI\Core\Conversion\Contracts\ConverterSource; use EInvoiceAPI\Core\Exceptions\APIConnectionException; use EInvoiceAPI\Core\Exceptions\APIStatusException; +use EInvoiceAPI\Core\Implementation\RawResponse; use EInvoiceAPI\RequestOptions; use Psr\Http\Client\ClientExceptionInterface; use Psr\Http\Client\ClientInterface; @@ -51,9 +53,11 @@ public function __construct( * @param string|list $path * @param array $query * @param array $headers - * @param class-string> $page - * @param class-string> $stream + * @param class-string>|null $page + * @param class-string>|null $stream * @param RequestOptions|array|null $options + * + * @return BaseResponse */ public function request( string $method, @@ -65,7 +69,7 @@ public function request( ?string $page = null, ?string $stream = null, RequestOptions|array|null $options = [], - ): mixed { + ): BaseResponse { // @phpstan-ignore-next-line [$req, $opts] = $this->buildRequest(method: $method, path: $path, query: $query, headers: $headers, body: $body, opts: $options); ['method' => $method, 'path' => $uri, 'headers' => $headers] = $req; @@ -74,32 +78,11 @@ public function request( $request = $opts->requestFactory->createRequest($method, uri: $uri); $request = Util::withSetHeaders($request, headers: $headers); - // @phpstan-ignore-next-line + // @phpstan-ignore-next-line argument.type $rsp = $this->sendRequest($opts, req: $request, data: $body, redirectCount: 0, retryCount: 0); - if (!is_null($stream)) { - return new $stream( - convert: $convert, - request: $request, - response: $rsp - ); - } - - if (!is_null($page)) { - return new $page( - convert: $convert, - client: $this, - request: $req, - response: $rsp, - options: $opts, - ); - } - - if (!is_null($convert)) { - return Conversion::coerceResponse($convert, response: $rsp); - } - - return Util::decodeContent($rsp); + // @phpstan-ignore-next-line argument.type + return new RawResponse(client: $this, request: $request, response: $rsp, options: $opts, requestInfo: $req, stream: $stream, page: $page, convert: $convert ?? 'null'); } /** @return array */ diff --git a/src/Core/Concerns/ResponseProxy.php b/src/Core/Concerns/ResponseProxy.php new file mode 100644 index 00000000..2edc3b7c --- /dev/null +++ b/src/Core/Concerns/ResponseProxy.php @@ -0,0 +1,101 @@ +response->getProtocolVersion(); + } + + public function withProtocolVersion(string $version): static + { + $self = clone $this; + $self->response = $this->response->withProtocolVersion($version); + + return $self; + } + + public function getHeaders(): array + { + return $this->response->getHeaders(); + } + + public function hasHeader(string $name): bool + { + return $this->response->hasHeader($name); + } + + public function getHeader(string $name): array + { + return $this->response->getHeader($name); + } + + public function getHeaderLine(string $name): string + { + return $this->response->getHeaderLine($name); + } + + public function withHeader(string $name, $value): static + { + $self = clone $this; + $self->response = $this->response->withHeader($name, value: $value); + + return $self; + } + + public function withAddedHeader(string $name, $value): static + { + $self = clone $this; + $self->response = $this->response->withAddedHeader($name, value: $value); + + return $self; + } + + public function withoutHeader(string $name): static + { + $self = clone $this; + $self->response = $this->response->withoutHeader($name); + + return $self; + } + + public function getBody(): StreamInterface + { + return $this->response->getBody(); + } + + public function withBody(StreamInterface $body): static + { + $self = clone $this; + $self->response = $this->response->withBody($body); + + return $self; + } + + public function getStatusCode(): int + { + return $this->response->getStatusCode(); + } + + public function withStatus(int $code, string $reasonPhrase = ''): static + { + $self = clone $this; + $self->response = $this->response->withstatus($code, reasonPhrase: $reasonPhrase); + + return $self; + } + + public function getReasonPhrase(): string + { + return $this->response->getReasonPhrase(); + } +} diff --git a/src/Core/Concerns/SdkPage.php b/src/Core/Concerns/SdkPage.php index 666cb3f3..65aebcfc 100644 --- a/src/Core/Concerns/SdkPage.php +++ b/src/Core/Concerns/SdkPage.php @@ -5,6 +5,7 @@ namespace EInvoiceAPI\Core\Concerns; use EInvoiceAPI\Client; +use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Conversion\Contracts\Converter; use EInvoiceAPI\Core\Conversion\Contracts\ConverterSource; use EInvoiceAPI\Core\Exceptions\APIStatusException; @@ -14,8 +15,6 @@ * @internal * * @template Item - * - * @phpstan-import-type normalized_request from \EInvoiceAPI\Core\BaseClient */ trait SdkPage { @@ -23,13 +22,6 @@ trait SdkPage private Client $client; - /** - * normalized_request $request. - */ - private array $request; - - private RequestOptions $options; - /** * @return list */ @@ -61,7 +53,11 @@ public function getNextPage(): static [$req, $opts] = $next; // @phpstan-ignore-next-line argument.type - return $this->client->request(...$req, convert: $this->convert, page: $this::class, options: $opts); + /** @var BaseResponse */ + $response = $this->client->request(...$req, convert: $this->convert, page: $this::class, options: $opts); + + // @phpstan-ignore-next-line return.type + return $response->parse(); } /** diff --git a/src/Core/Concerns/SdkResponse.php b/src/Core/Concerns/SdkResponse.php deleted file mode 100644 index 18220918..00000000 --- a/src/Core/Concerns/SdkResponse.php +++ /dev/null @@ -1,29 +0,0 @@ -_rawResponse = $response; - $instance->__unserialize(Util::decodeContent($response)); // @phpstan-ignore-line - - return $instance; - } - - public function getRawResponse(): ?ResponseInterface - { - return $this->_rawResponse; - } -} diff --git a/src/Core/Contracts/BasePage.php b/src/Core/Contracts/BasePage.php index e81b3c65..ad858148 100644 --- a/src/Core/Contracts/BasePage.php +++ b/src/Core/Contracts/BasePage.php @@ -4,12 +4,6 @@ namespace EInvoiceAPI\Core\Contracts; -use EInvoiceAPI\Client; -use EInvoiceAPI\Core\Conversion\Contracts\Converter; -use EInvoiceAPI\Core\Conversion\Contracts\ConverterSource; -use EInvoiceAPI\RequestOptions; -use Psr\Http\Message\ResponseInterface; - /** * @internal * @@ -21,19 +15,6 @@ */ interface BasePage extends \IteratorAggregate { - /** - * @internal - * - * @param normalized_request $request - */ - public function __construct( - Converter|ConverterSource|string $convert, - Client $client, - array $request, - RequestOptions $options, - ResponseInterface $response, - ); - public function hasNextPage(): bool; /** diff --git a/src/Core/Contracts/BaseResponse.php b/src/Core/Contracts/BaseResponse.php new file mode 100644 index 00000000..a53dd993 --- /dev/null +++ b/src/Core/Contracts/BaseResponse.php @@ -0,0 +1,21 @@ + + * + * @phpstan-import-type normalized_request from \EInvoiceAPI\Core\BaseClient + */ +class RawResponse implements BaseResponse +{ + use ResponseProxy; + + private mixed $decodedBody; + + /** @var R */ + private mixed $coercedResponse; + + private bool $decoded = false; + private bool $coerced = false; + + /** + * @param normalized_request $requestInfo + */ + public function __construct( + private Client $client, + private RequestOptions $options, + private RequestInterface $request, + private ResponseInterface $response, + private array $requestInfo, + private Converter|ConverterSource|string $convert, + private ?string $page, + private ?string $stream, + ) {} + + public function getRequest(): RequestInterface + { + return $this->request; + } + + public function parse(): mixed + { + if (!$this->coerced) { + if (!is_null($this->stream)) { + // @phpstan-ignore-next-line assign.propertyType + $this->coercedResponse = new $this->stream( + convert: $this->convert, + request: $this->request, + response: $this->response, + parsedBody: $this->getDecoded(), + ); + } elseif (!is_null($this->page)) { + // @phpstan-ignore-next-line assign.propertyType + $this->coercedResponse = new $this->page( + convert: $this->convert, + client: $this->client, + requestInfo: $this->requestInfo, + options: $this->options, + response: $this->response, + parsedBody: $this->getDecoded(), + ); + } else { + // @phpstan-ignore-next-line assign.propertyType + $this->coercedResponse = Conversion::coerce( + $this->convert, + value: $this->getDecoded(), + ); + } + + $this->coerced = true; + } + + return $this->coercedResponse; + } + + private function getDecoded(): mixed + { + if (!$this->decoded) { + $this->decodedBody = Util::decodeContent($this->response); + $this->decoded = true; + } + + return $this->decodedBody; + } +} diff --git a/src/Documents/Attachments/AttachmentDeleteResponse.php b/src/Documents/Attachments/AttachmentDeleteResponse.php index 614f35e4..87a6dc88 100644 --- a/src/Documents/Attachments/AttachmentDeleteResponse.php +++ b/src/Documents/Attachments/AttachmentDeleteResponse.php @@ -6,20 +6,16 @@ use EInvoiceAPI\Core\Attributes\Api; use EInvoiceAPI\Core\Concerns\SdkModel; -use EInvoiceAPI\Core\Concerns\SdkResponse; use EInvoiceAPI\Core\Contracts\BaseModel; -use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; /** * @phpstan-type AttachmentDeleteResponseShape = array{is_deleted: bool} */ -final class AttachmentDeleteResponse implements BaseModel, ResponseConverter +final class AttachmentDeleteResponse implements BaseModel { /** @use SdkModel */ use SdkModel; - use SdkResponse; - #[Api] public bool $is_deleted; diff --git a/src/Documents/Attachments/DocumentAttachment.php b/src/Documents/Attachments/DocumentAttachment.php index a8c47e19..c9f6cd7b 100644 --- a/src/Documents/Attachments/DocumentAttachment.php +++ b/src/Documents/Attachments/DocumentAttachment.php @@ -6,9 +6,7 @@ use EInvoiceAPI\Core\Attributes\Api; use EInvoiceAPI\Core\Concerns\SdkModel; -use EInvoiceAPI\Core\Concerns\SdkResponse; use EInvoiceAPI\Core\Contracts\BaseModel; -use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; /** * @phpstan-type DocumentAttachmentShape = array{ @@ -19,13 +17,11 @@ * file_url?: string|null, * } */ -final class DocumentAttachment implements BaseModel, ResponseConverter +final class DocumentAttachment implements BaseModel { /** @use SdkModel */ use SdkModel; - use SdkResponse; - #[Api] public string $id; diff --git a/src/Documents/DocumentDeleteResponse.php b/src/Documents/DocumentDeleteResponse.php index ad7cb96a..6e99283c 100644 --- a/src/Documents/DocumentDeleteResponse.php +++ b/src/Documents/DocumentDeleteResponse.php @@ -6,20 +6,16 @@ use EInvoiceAPI\Core\Attributes\Api; use EInvoiceAPI\Core\Concerns\SdkModel; -use EInvoiceAPI\Core\Concerns\SdkResponse; use EInvoiceAPI\Core\Contracts\BaseModel; -use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; /** * @phpstan-type DocumentDeleteResponseShape = array{is_deleted: bool} */ -final class DocumentDeleteResponse implements BaseModel, ResponseConverter +final class DocumentDeleteResponse implements BaseModel { /** @use SdkModel */ use SdkModel; - use SdkResponse; - #[Api] public bool $is_deleted; diff --git a/src/Documents/DocumentNewFromPdfResponse.php b/src/Documents/DocumentNewFromPdfResponse.php index 1ffb1449..5726711a 100644 --- a/src/Documents/DocumentNewFromPdfResponse.php +++ b/src/Documents/DocumentNewFromPdfResponse.php @@ -6,9 +6,7 @@ use EInvoiceAPI\Core\Attributes\Api; use EInvoiceAPI\Core\Concerns\SdkModel; -use EInvoiceAPI\Core\Concerns\SdkResponse; use EInvoiceAPI\Core\Contracts\BaseModel; -use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; use EInvoiceAPI\Documents\Allowance\ReasonCode; use EInvoiceAPI\Documents\DocumentNewFromPdfResponse\Item; use EInvoiceAPI\Documents\DocumentNewFromPdfResponse\TaxCode; @@ -69,13 +67,11 @@ * vendor_tax_id?: string|null, * } */ -final class DocumentNewFromPdfResponse implements BaseModel, ResponseConverter +final class DocumentNewFromPdfResponse implements BaseModel { /** @use SdkModel */ use SdkModel; - use SdkResponse; - /** @var list|null $allowances */ #[Api(list: Allowance::class, nullable: true, optional: true)] public ?array $allowances; diff --git a/src/Documents/DocumentResponse.php b/src/Documents/DocumentResponse.php index 55b1679f..0e71f979 100644 --- a/src/Documents/DocumentResponse.php +++ b/src/Documents/DocumentResponse.php @@ -6,9 +6,7 @@ use EInvoiceAPI\Core\Attributes\Api; use EInvoiceAPI\Core\Concerns\SdkModel; -use EInvoiceAPI\Core\Concerns\SdkResponse; use EInvoiceAPI\Core\Contracts\BaseModel; -use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; use EInvoiceAPI\Documents\Attachments\DocumentAttachment; use EInvoiceAPI\Documents\DocumentResponse\Allowance\ReasonCode; use EInvoiceAPI\Documents\DocumentResponse\Item; @@ -70,13 +68,11 @@ * vendor_tax_id?: string|null, * } */ -final class DocumentResponse implements BaseModel, ResponseConverter +final class DocumentResponse implements BaseModel { /** @use SdkModel */ use SdkModel; - use SdkResponse; - #[Api] public string $id; diff --git a/src/Documents/Ubl/UblGetResponse.php b/src/Documents/Ubl/UblGetResponse.php index 6536f5b1..a215da9a 100644 --- a/src/Documents/Ubl/UblGetResponse.php +++ b/src/Documents/Ubl/UblGetResponse.php @@ -6,9 +6,7 @@ use EInvoiceAPI\Core\Attributes\Api; use EInvoiceAPI\Core\Concerns\SdkModel; -use EInvoiceAPI\Core\Concerns\SdkResponse; use EInvoiceAPI\Core\Contracts\BaseModel; -use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; /** * @phpstan-type UblGetResponseShape = array{ @@ -24,13 +22,11 @@ * validated_at?: \DateTimeInterface|null, * } */ -final class UblGetResponse implements BaseModel, ResponseConverter +final class UblGetResponse implements BaseModel { /** @use SdkModel */ use SdkModel; - use SdkResponse; - #[Api] public string $id; diff --git a/src/DocumentsNumberPage.php b/src/DocumentsNumberPage.php index 6a43ed25..e26a9836 100644 --- a/src/DocumentsNumberPage.php +++ b/src/DocumentsNumberPage.php @@ -11,7 +11,6 @@ use EInvoiceAPI\Core\Conversion\Contracts\Converter; use EInvoiceAPI\Core\Conversion\Contracts\ConverterSource; use EInvoiceAPI\Core\Conversion\ListOf; -use EInvoiceAPI\Core\Util; use EInvoiceAPI\DocumentsNumberPage\Item; use Psr\Http\Message\ResponseInterface; @@ -57,25 +56,24 @@ final class DocumentsNumberPage implements BaseModel, BasePage * query: array, * headers: array|null>, * body: mixed, - * } $request + * } $requestInfo */ public function __construct( private string|Converter|ConverterSource $convert, private Client $client, - private array $request, + private array $requestInfo, private RequestOptions $options, - ResponseInterface $response, + private ResponseInterface $response, + private mixed $parsedBody, ) { $this->initialize(); - $data = Util::decodeContent($response); - - if (!is_array($data)) { + if (!is_array($this->parsedBody)) { return; } // @phpstan-ignore-next-line argument.type - self::__unserialize($data); + self::__unserialize($this->parsedBody); if ($this->offsetGet('items')) { $acc = Conversion::coerce( @@ -117,7 +115,7 @@ public function nextRequest(): ?array } $nextRequest = array_merge_recursive( - $this->request, + $this->requestInfo, ['query' => $curr + 1] ); diff --git a/src/Lookup/LookupGetParticipantsResponse.php b/src/Lookup/LookupGetParticipantsResponse.php index d0f677bd..13017a84 100644 --- a/src/Lookup/LookupGetParticipantsResponse.php +++ b/src/Lookup/LookupGetParticipantsResponse.php @@ -6,9 +6,7 @@ use EInvoiceAPI\Core\Attributes\Api; use EInvoiceAPI\Core\Concerns\SdkModel; -use EInvoiceAPI\Core\Concerns\SdkResponse; use EInvoiceAPI\Core\Contracts\BaseModel; -use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; use EInvoiceAPI\Lookup\LookupGetParticipantsResponse\Participant; use EInvoiceAPI\Lookup\LookupGetParticipantsResponse\Participant\DocumentType; use EInvoiceAPI\Lookup\LookupGetParticipantsResponse\Participant\Entity; @@ -24,13 +22,11 @@ * participants?: list|null, * } */ -final class LookupGetParticipantsResponse implements BaseModel, ResponseConverter +final class LookupGetParticipantsResponse implements BaseModel { /** @use SdkModel */ use SdkModel; - use SdkResponse; - /** * Query terms used for search. */ diff --git a/src/Lookup/LookupGetResponse.php b/src/Lookup/LookupGetResponse.php index 31b2cf18..4ce7a8ee 100644 --- a/src/Lookup/LookupGetResponse.php +++ b/src/Lookup/LookupGetResponse.php @@ -6,9 +6,7 @@ use EInvoiceAPI\Core\Attributes\Api; use EInvoiceAPI\Core\Concerns\SdkModel; -use EInvoiceAPI\Core\Concerns\SdkResponse; use EInvoiceAPI\Core\Contracts\BaseModel; -use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; use EInvoiceAPI\Lookup\LookupGetResponse\BusinessCard; use EInvoiceAPI\Lookup\LookupGetResponse\BusinessCard\Entity; use EInvoiceAPI\Lookup\LookupGetResponse\DNSInfo; @@ -40,13 +38,11 @@ * status: string, * } */ -final class LookupGetResponse implements BaseModel, ResponseConverter +final class LookupGetResponse implements BaseModel { /** @use SdkModel */ use SdkModel; - use SdkResponse; - /** * Business card information for the Peppol participant. */ diff --git a/src/Me/MeGetResponse.php b/src/Me/MeGetResponse.php index 50009bb7..7a47bff8 100644 --- a/src/Me/MeGetResponse.php +++ b/src/Me/MeGetResponse.php @@ -6,9 +6,7 @@ use EInvoiceAPI\Core\Attributes\Api; use EInvoiceAPI\Core\Concerns\SdkModel; -use EInvoiceAPI\Core\Concerns\SdkResponse; use EInvoiceAPI\Core\Contracts\BaseModel; -use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; use EInvoiceAPI\Me\MeGetResponse\Plan; /** @@ -32,13 +30,11 @@ * smp_registration_date?: \DateTimeInterface|null, * } */ -final class MeGetResponse implements BaseModel, ResponseConverter +final class MeGetResponse implements BaseModel { /** @use SdkModel */ use SdkModel; - use SdkResponse; - /** * Credit balance of the tenant. */ diff --git a/src/Services/Documents/AttachmentsService.php b/src/Services/Documents/AttachmentsService.php index 46ece059..52489802 100644 --- a/src/Services/Documents/AttachmentsService.php +++ b/src/Services/Documents/AttachmentsService.php @@ -5,6 +5,7 @@ namespace EInvoiceAPI\Services\Documents; use EInvoiceAPI\Client; +use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Conversion\ListOf; use EInvoiceAPI\Core\Exceptions\APIException; use EInvoiceAPI\Documents\Attachments\AttachmentAddParams; @@ -43,13 +44,15 @@ public function retrieve( $documentID = $parsed['document_id']; unset($parsed['document_id']); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'get', path: ['api/documents/%1$s/attachments/%2$s', $documentID, $attachmentID], options: $options, convert: DocumentAttachment::class, ); + + return $response->parse(); } /** @@ -65,13 +68,15 @@ public function list( string $documentID, ?RequestOptions $requestOptions = null ): array { - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse> */ + $response = $this->client->request( method: 'get', path: ['api/documents/%1$s/attachments', $documentID], options: $requestOptions, convert: new ListOf(DocumentAttachment::class), ); + + return $response->parse(); } /** @@ -95,13 +100,15 @@ public function delete( $documentID = $parsed['document_id']; unset($parsed['document_id']); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'delete', path: ['api/documents/%1$s/attachments/%2$s', $documentID, $attachmentID], options: $options, convert: AttachmentDeleteResponse::class, ); + + return $response->parse(); } /** @@ -123,8 +130,8 @@ public function add( $requestOptions, ); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'post', path: ['api/documents/%1$s/attachments', $documentID], headers: ['Content-Type' => 'multipart/form-data'], @@ -132,5 +139,7 @@ public function add( options: $options, convert: DocumentAttachment::class, ); + + return $response->parse(); } } diff --git a/src/Services/Documents/UblService.php b/src/Services/Documents/UblService.php index 60c14877..6b6b3fa3 100644 --- a/src/Services/Documents/UblService.php +++ b/src/Services/Documents/UblService.php @@ -5,6 +5,7 @@ namespace EInvoiceAPI\Services\Documents; use EInvoiceAPI\Client; +use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; use EInvoiceAPI\Documents\DocumentResponse; use EInvoiceAPI\Documents\Ubl\UblCreateFromUblParams; @@ -37,8 +38,8 @@ public function createFromUbl( $requestOptions, ); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'post', path: 'api/documents/ubl', headers: ['Content-Type' => 'multipart/form-data'], @@ -46,6 +47,8 @@ public function createFromUbl( options: $options, convert: DocumentResponse::class, ); + + return $response->parse(); } /** @@ -59,12 +62,14 @@ public function get( string $documentID, ?RequestOptions $requestOptions = null ): UblGetResponse { - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'get', path: ['api/documents/%1$s/ubl', $documentID], options: $requestOptions, convert: UblGetResponse::class, ); + + return $response->parse(); } } diff --git a/src/Services/DocumentsService.php b/src/Services/DocumentsService.php index e80763b9..819e546e 100644 --- a/src/Services/DocumentsService.php +++ b/src/Services/DocumentsService.php @@ -5,6 +5,7 @@ namespace EInvoiceAPI\Services; use EInvoiceAPI\Client; +use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; use EInvoiceAPI\Documents\CurrencyCode; use EInvoiceAPI\Documents\DocumentAttachmentCreate; @@ -154,14 +155,16 @@ public function create( $requestOptions, ); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'post', path: 'api/documents/', body: (object) $parsed, options: $options, convert: DocumentResponse::class, ); + + return $response->parse(); } /** @@ -175,13 +178,15 @@ public function retrieve( string $documentID, ?RequestOptions $requestOptions = null ): DocumentResponse { - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'get', path: ['api/documents/%1$s', $documentID], options: $requestOptions, convert: DocumentResponse::class, ); + + return $response->parse(); } /** @@ -195,13 +200,15 @@ public function delete( string $documentID, ?RequestOptions $requestOptions = null ): DocumentDeleteResponse { - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'delete', path: ['api/documents/%1$s', $documentID], options: $requestOptions, convert: DocumentDeleteResponse::class, ); + + return $response->parse(); } /** @@ -225,8 +232,8 @@ public function createFromPdf( ); $query_params = array_flip(['customer_tax_id', 'vendor_tax_id']); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'post', path: 'api/documents/pdf', query: array_diff_key($parsed, $query_params), @@ -235,6 +242,8 @@ public function createFromPdf( options: $options, convert: DocumentNewFromPdfResponse::class, ); + + return $response->parse(); } /** @@ -262,14 +271,16 @@ public function send( $requestOptions, ); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'post', path: ['api/documents/%1$s/send', $documentID], query: $parsed, options: $options, convert: DocumentResponse::class, ); + + return $response->parse(); } /** @@ -283,12 +294,14 @@ public function validate( string $documentID, ?RequestOptions $requestOptions = null ): UblDocumentValidation { - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'post', path: ['api/documents/%1$s/validate', $documentID], options: $requestOptions, convert: UblDocumentValidation::class, ); + + return $response->parse(); } } diff --git a/src/Services/InboxService.php b/src/Services/InboxService.php index 0701d746..9b1ad398 100644 --- a/src/Services/InboxService.php +++ b/src/Services/InboxService.php @@ -5,6 +5,7 @@ namespace EInvoiceAPI\Services; use EInvoiceAPI\Client; +use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; use EInvoiceAPI\Documents\DocumentResponse; use EInvoiceAPI\Documents\DocumentType; @@ -52,8 +53,8 @@ public function list( $requestOptions, ); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse> */ + $response = $this->client->request( method: 'get', path: 'api/inbox/', query: $parsed, @@ -61,6 +62,8 @@ public function list( convert: DocumentResponse::class, page: DocumentsNumberPage::class, ); + + return $response->parse(); } /** @@ -83,8 +86,8 @@ public function listCreditNotes( $requestOptions, ); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse> */ + $response = $this->client->request( method: 'get', path: 'api/inbox/credit-notes', query: $parsed, @@ -92,6 +95,8 @@ public function listCreditNotes( convert: DocumentResponse::class, page: DocumentsNumberPage::class, ); + + return $response->parse(); } /** @@ -114,8 +119,8 @@ public function listInvoices( $requestOptions, ); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse> */ + $response = $this->client->request( method: 'get', path: 'api/inbox/invoices', query: $parsed, @@ -123,5 +128,7 @@ public function listInvoices( convert: DocumentResponse::class, page: DocumentsNumberPage::class, ); + + return $response->parse(); } } diff --git a/src/Services/LookupService.php b/src/Services/LookupService.php index 7ba65566..5f1db8cb 100644 --- a/src/Services/LookupService.php +++ b/src/Services/LookupService.php @@ -5,6 +5,7 @@ namespace EInvoiceAPI\Services; use EInvoiceAPI\Client; +use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; use EInvoiceAPI\Lookup\LookupGetParticipantsResponse; use EInvoiceAPI\Lookup\LookupGetResponse; @@ -38,14 +39,16 @@ public function retrieve( $requestOptions, ); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'get', path: 'api/lookup', query: $parsed, options: $options, convert: LookupGetResponse::class, ); + + return $response->parse(); } /** @@ -68,13 +71,15 @@ public function retrieveParticipants( $requestOptions, ); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'get', path: 'api/lookup/participants', query: $parsed, options: $options, convert: LookupGetParticipantsResponse::class, ); + + return $response->parse(); } } diff --git a/src/Services/MeService.php b/src/Services/MeService.php index 8c912d73..2bd28091 100644 --- a/src/Services/MeService.php +++ b/src/Services/MeService.php @@ -5,6 +5,7 @@ namespace EInvoiceAPI\Services; use EInvoiceAPI\Client; +use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; use EInvoiceAPI\Me\MeGetResponse; use EInvoiceAPI\RequestOptions; @@ -27,12 +28,14 @@ public function __construct(private Client $client) {} public function retrieve( ?RequestOptions $requestOptions = null ): MeGetResponse { - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'get', path: 'api/me/', options: $requestOptions, convert: MeGetResponse::class, ); + + return $response->parse(); } } diff --git a/src/Services/OutboxService.php b/src/Services/OutboxService.php index 0a52ae8e..8af9ba24 100644 --- a/src/Services/OutboxService.php +++ b/src/Services/OutboxService.php @@ -5,6 +5,7 @@ namespace EInvoiceAPI\Services; use EInvoiceAPI\Client; +use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; use EInvoiceAPI\Documents\DocumentResponse; use EInvoiceAPI\Documents\DocumentType; @@ -42,8 +43,8 @@ public function listDraftDocuments( $requestOptions, ); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse> */ + $response = $this->client->request( method: 'get', path: 'api/outbox/drafts', query: $parsed, @@ -51,6 +52,8 @@ public function listDraftDocuments( convert: DocumentResponse::class, page: DocumentsNumberPage::class, ); + + return $response->parse(); } /** @@ -82,8 +85,8 @@ public function listReceivedDocuments( $requestOptions, ); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse> */ + $response = $this->client->request( method: 'get', path: 'api/outbox/', query: $parsed, @@ -91,5 +94,7 @@ public function listReceivedDocuments( convert: DocumentResponse::class, page: DocumentsNumberPage::class, ); + + return $response->parse(); } } diff --git a/src/Services/ValidateService.php b/src/Services/ValidateService.php index 6509684f..49b925b9 100644 --- a/src/Services/ValidateService.php +++ b/src/Services/ValidateService.php @@ -5,6 +5,7 @@ namespace EInvoiceAPI\Services; use EInvoiceAPI\Client; +use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; use EInvoiceAPI\Documents\CurrencyCode; use EInvoiceAPI\Documents\DocumentAttachmentCreate; @@ -136,14 +137,16 @@ public function validateJson( $requestOptions, ); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'post', path: 'api/validate/json', body: (object) $parsed, options: $options, convert: UblDocumentValidation::class, ); + + return $response->parse(); } /** @@ -164,14 +167,16 @@ public function validatePeppolID( $requestOptions, ); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'get', path: 'api/validate/peppol-id', query: $parsed, options: $options, convert: ValidateValidatePeppolIDResponse::class, ); + + return $response->parse(); } /** @@ -192,8 +197,8 @@ public function validateUbl( $requestOptions, ); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'post', path: 'api/validate/ubl', headers: ['Content-Type' => 'multipart/form-data'], @@ -201,5 +206,7 @@ public function validateUbl( options: $options, convert: UblDocumentValidation::class, ); + + return $response->parse(); } } diff --git a/src/Services/WebhooksService.php b/src/Services/WebhooksService.php index a9852fcb..864d4922 100644 --- a/src/Services/WebhooksService.php +++ b/src/Services/WebhooksService.php @@ -5,6 +5,7 @@ namespace EInvoiceAPI\Services; use EInvoiceAPI\Client; +use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Conversion\ListOf; use EInvoiceAPI\Core\Exceptions\APIException; use EInvoiceAPI\RequestOptions; @@ -41,14 +42,16 @@ public function create( $requestOptions, ); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'post', path: 'api/webhooks/', body: (object) $parsed, options: $options, convert: WebhookResponse::class, ); + + return $response->parse(); } /** @@ -62,13 +65,15 @@ public function retrieve( string $webhookID, ?RequestOptions $requestOptions = null ): WebhookResponse { - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'get', path: ['api/webhooks/%1$s', $webhookID], options: $requestOptions, convert: WebhookResponse::class, ); + + return $response->parse(); } /** @@ -92,14 +97,16 @@ public function update( $requestOptions, ); - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'put', path: ['api/webhooks/%1$s', $webhookID], body: (object) $parsed, options: $options, convert: WebhookResponse::class, ); + + return $response->parse(); } /** @@ -113,13 +120,15 @@ public function update( */ public function list(?RequestOptions $requestOptions = null): array { - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse> */ + $response = $this->client->request( method: 'get', path: 'api/webhooks/', options: $requestOptions, convert: new ListOf(WebhookResponse::class), ); + + return $response->parse(); } /** @@ -133,12 +142,14 @@ public function delete( string $webhookID, ?RequestOptions $requestOptions = null ): WebhookDeleteResponse { - // @phpstan-ignore-next-line return.type - return $this->client->request( + /** @var BaseResponse */ + $response = $this->client->request( method: 'delete', path: ['api/webhooks/%1$s', $webhookID], options: $requestOptions, convert: WebhookDeleteResponse::class, ); + + return $response->parse(); } } diff --git a/src/Validate/UblDocumentValidation.php b/src/Validate/UblDocumentValidation.php index 04d03017..227e8155 100644 --- a/src/Validate/UblDocumentValidation.php +++ b/src/Validate/UblDocumentValidation.php @@ -6,9 +6,7 @@ use EInvoiceAPI\Core\Attributes\Api; use EInvoiceAPI\Core\Concerns\SdkModel; -use EInvoiceAPI\Core\Concerns\SdkResponse; use EInvoiceAPI\Core\Contracts\BaseModel; -use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; use EInvoiceAPI\Validate\UblDocumentValidation\Issue; use EInvoiceAPI\Validate\UblDocumentValidation\Issue\Type; @@ -21,13 +19,11 @@ * ubl_document?: string|null, * } */ -final class UblDocumentValidation implements BaseModel, ResponseConverter +final class UblDocumentValidation implements BaseModel { /** @use SdkModel */ use SdkModel; - use SdkResponse; - #[Api] public string $id; diff --git a/src/Validate/ValidateValidatePeppolIDResponse.php b/src/Validate/ValidateValidatePeppolIDResponse.php index 21483145..7297366b 100644 --- a/src/Validate/ValidateValidatePeppolIDResponse.php +++ b/src/Validate/ValidateValidatePeppolIDResponse.php @@ -6,9 +6,7 @@ use EInvoiceAPI\Core\Attributes\Api; use EInvoiceAPI\Core\Concerns\SdkModel; -use EInvoiceAPI\Core\Concerns\SdkResponse; use EInvoiceAPI\Core\Contracts\BaseModel; -use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; use EInvoiceAPI\Validate\ValidateValidatePeppolIDResponse\BusinessCard; /** @@ -25,13 +23,11 @@ * supported_document_types?: list|null, * } */ -final class ValidateValidatePeppolIDResponse implements BaseModel, ResponseConverter +final class ValidateValidatePeppolIDResponse implements BaseModel { /** @use SdkModel */ use SdkModel; - use SdkResponse; - /** * Business card information for the Peppol ID. */ diff --git a/src/Webhooks/WebhookDeleteResponse.php b/src/Webhooks/WebhookDeleteResponse.php index b2a4b8b5..db9cbfbd 100644 --- a/src/Webhooks/WebhookDeleteResponse.php +++ b/src/Webhooks/WebhookDeleteResponse.php @@ -6,22 +6,18 @@ use EInvoiceAPI\Core\Attributes\Api; use EInvoiceAPI\Core\Concerns\SdkModel; -use EInvoiceAPI\Core\Concerns\SdkResponse; use EInvoiceAPI\Core\Contracts\BaseModel; -use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; /** * Model for webhook deletion. * * @phpstan-type WebhookDeleteResponseShape = array{is_deleted: bool} */ -final class WebhookDeleteResponse implements BaseModel, ResponseConverter +final class WebhookDeleteResponse implements BaseModel { /** @use SdkModel */ use SdkModel; - use SdkResponse; - #[Api] public bool $is_deleted; diff --git a/src/Webhooks/WebhookResponse.php b/src/Webhooks/WebhookResponse.php index aeddf094..2b3087bc 100644 --- a/src/Webhooks/WebhookResponse.php +++ b/src/Webhooks/WebhookResponse.php @@ -6,9 +6,7 @@ use EInvoiceAPI\Core\Attributes\Api; use EInvoiceAPI\Core\Concerns\SdkModel; -use EInvoiceAPI\Core\Concerns\SdkResponse; use EInvoiceAPI\Core\Contracts\BaseModel; -use EInvoiceAPI\Core\Conversion\Contracts\ResponseConverter; /** * Response model for webhook API endpoints. @@ -21,13 +19,11 @@ * enabled?: bool|null, * } */ -final class WebhookResponse implements BaseModel, ResponseConverter +final class WebhookResponse implements BaseModel { /** @use SdkModel */ use SdkModel; - use SdkResponse; - #[Api] public string $id; From e2085d469c3dac597e44ffc38f3cabef6401e8d3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 03:16:03 +0000 Subject: [PATCH 3/9] chore: switch from `#[Api(optional: true|false)]` to `#[Required]|#[Optional]` for annotations --- src/Core/Attributes/Optional.php | 35 ++++++ src/Core/Attributes/{Api.php => Required.php} | 23 ++-- src/Core/Conversion/ModelOf.php | 10 +- src/Core/Conversion/PropertyInfo.php | 8 +- src/Documents/Allowance.php | 16 +-- .../Attachments/AttachmentAddParams.php | 4 +- .../Attachments/AttachmentDeleteParams.php | 4 +- .../Attachments/AttachmentDeleteResponse.php | 4 +- .../Attachments/AttachmentRetrieveParams.php | 4 +- .../Attachments/DocumentAttachment.php | 13 ++- src/Documents/Charge.php | 16 +-- src/Documents/DocumentAttachmentCreate.php | 11 +- src/Documents/DocumentCreate.php | 104 +++++++++--------- src/Documents/DocumentCreate/Allowance.php | 19 ++-- src/Documents/DocumentCreate/Charge.php | 17 ++- src/Documents/DocumentCreate/Item.php | 26 ++--- .../DocumentCreate/Item/Allowance.php | 16 +-- src/Documents/DocumentCreate/Item/Charge.php | 16 +-- src/Documents/DocumentCreate/TaxDetail.php | 6 +- src/Documents/DocumentCreateFromPdfParams.php | 9 +- src/Documents/DocumentCreateParams.php | 103 +++++++++-------- .../DocumentCreateParams/Allowance.php | 19 ++-- src/Documents/DocumentCreateParams/Charge.php | 17 ++- src/Documents/DocumentCreateParams/Item.php | 26 ++--- .../DocumentCreateParams/Item/Allowance.php | 16 +-- .../DocumentCreateParams/Item/Charge.php | 16 +-- .../DocumentCreateParams/TaxDetail.php | 6 +- src/Documents/DocumentDeleteResponse.php | 4 +- src/Documents/DocumentNewFromPdfResponse.php | 100 ++++++++--------- .../DocumentNewFromPdfResponse/Item.php | 24 ++-- .../DocumentNewFromPdfResponse/TaxDetail.php | 6 +- src/Documents/DocumentResponse.php | 103 +++++++++-------- src/Documents/DocumentResponse/Allowance.php | 19 ++-- src/Documents/DocumentResponse/Charge.php | 17 ++- src/Documents/DocumentResponse/Item.php | 32 ++---- .../DocumentResponse/PaymentDetail.php | 10 +- src/Documents/DocumentResponse/TaxDetail.php | 6 +- src/Documents/DocumentSendParams.php | 12 +- src/Documents/PaymentDetailCreate.php | 10 +- src/Documents/Ubl/UblCreateFromUblParams.php | 4 +- src/Documents/Ubl/UblGetResponse.php | 23 ++-- src/DocumentsNumberPage.php | 10 +- src/Inbox/InboxListCreditNotesParams.php | 6 +- src/Inbox/InboxListInvoicesParams.php | 6 +- src/Inbox/InboxListParams.php | 18 +-- src/Inbox/PaginatedDocumentResponse.php | 12 +- src/Lookup/Certificate.php | 9 +- src/Lookup/LookupGetParticipantsResponse.php | 13 ++- .../Participant.php | 11 +- .../Participant/DocumentType.php | 6 +- .../Participant/Entity.php | 16 +-- .../Participant/Entity/Identifier.php | 6 +- src/Lookup/LookupGetResponse.php | 18 +-- src/Lookup/LookupGetResponse/BusinessCard.php | 11 +- .../LookupGetResponse/BusinessCard/Entity.php | 10 +- src/Lookup/LookupGetResponse/DNSInfo.php | 11 +- .../LookupGetResponse/DNSInfo/DNSRecord.php | 4 +- .../LookupGetResponse/QueryMetadata.php | 12 +- .../LookupGetResponse/ServiceMetadata.php | 11 +- .../ServiceMetadata/Endpoint.php | 13 ++- .../ServiceMetadata/Endpoint/DocumentType.php | 6 +- .../ServiceMetadata/Endpoint/Process.php | 6 +- .../Endpoint/Process/Endpoint.php | 19 ++-- .../Endpoint/Process/ProcessID.php | 6 +- src/Lookup/LookupRetrieveParams.php | 4 +- .../LookupRetrieveParticipantsParams.php | 7 +- src/Me/MeGetResponse.php | 37 ++++--- src/Outbox/OutboxListDraftDocumentsParams.php | 6 +- .../OutboxListReceivedDocumentsParams.php | 18 +-- src/RequestOptions.php | 17 +-- src/Validate/UblDocumentValidation.php | 13 ++- src/Validate/UblDocumentValidation/Issue.php | 17 +-- src/Validate/ValidateValidateJsonParams.php | 101 +++++++++-------- .../ValidateValidateJsonParams/Allowance.php | 17 ++- .../ValidateValidateJsonParams/Charge.php | 17 ++- .../ValidateValidateJsonParams/Item.php | 26 ++--- .../Item/Allowance.php | 16 +-- .../Item/Charge.php | 16 +-- .../ValidateValidateJsonParams/TaxDetail.php | 6 +- .../ValidateValidatePeppolIDParams.php | 4 +- .../ValidateValidatePeppolIDResponse.php | 13 ++- .../BusinessCard.php | 8 +- src/Validate/ValidateValidateUblParams.php | 4 +- src/Webhooks/WebhookCreateParams.php | 9 +- src/Webhooks/WebhookDeleteResponse.php | 4 +- src/Webhooks/WebhookResponse.php | 13 ++- src/Webhooks/WebhookUpdateParams.php | 8 +- tests/Core/TestModel.php | 11 +- 88 files changed, 803 insertions(+), 763 deletions(-) create mode 100644 src/Core/Attributes/Optional.php rename src/Core/Attributes/{Api.php => Required.php} (77%) diff --git a/src/Core/Attributes/Optional.php b/src/Core/Attributes/Optional.php new file mode 100644 index 00000000..8c6d24e1 --- /dev/null +++ b/src/Core/Attributes/Optional.php @@ -0,0 +1,35 @@ +|Converter|string|null $type + * @param class-string<\BackedEnum>|Converter|null $enum + * @param class-string|Converter|null $union + * @param class-string|Converter|string|null $list + * @param class-string|Converter|string|null $map + */ + public function __construct( + ?string $apiName = null, + Converter|string|null $type = null, + Converter|string|null $enum = null, + Converter|string|null $union = null, + Converter|string|null $list = null, + Converter|string|null $map = null, + bool $nullable = false, + ) { + parent::__construct(apiName: $apiName, type: $type, enum: $enum, union: $union, list: $list, map: $map, nullable: $nullable); + $this->optional = true; + } +} diff --git a/src/Core/Attributes/Api.php b/src/Core/Attributes/Required.php similarity index 77% rename from src/Core/Attributes/Api.php rename to src/Core/Attributes/Required.php index 03f7c153..7863bc94 100644 --- a/src/Core/Attributes/Api.php +++ b/src/Core/Attributes/Required.php @@ -14,11 +14,17 @@ * @internal */ #[\Attribute(\Attribute::TARGET_PROPERTY)] -final class Api +class Required { /** @var class-string|Converter|string|null */ public readonly Converter|string|null $type; + public readonly ?string $apiName; + + public bool $optional; + + public readonly bool $nullable; + /** @var array */ private static array $enumConverters = []; @@ -30,14 +36,13 @@ final class Api * @param class-string|Converter|string|null $map */ public function __construct( - public readonly ?string $apiName = null, + ?string $apiName = null, Converter|string|null $type = null, Converter|string|null $enum = null, Converter|string|null $union = null, Converter|string|null $list = null, Converter|string|null $map = null, - public readonly bool $nullable = false, - public readonly bool $optional = false, + bool $nullable = false, ) { $type ??= $union; if (null !== $list) { @@ -47,17 +52,21 @@ public function __construct( $type ??= new MapOf($map); } if (null !== $enum) { - $type ??= $enum instanceof Converter ? $enum : $this->getEnumConverter($enum); + $type ??= $enum instanceof Converter ? $enum : self::enumConverter($enum); } + $this->apiName = $apiName; $this->type = $type; + $this->optional = false; + $this->nullable = $nullable; } /** @property class-string<\BackedEnum> $enum */ - private function getEnumConverter(string $enum): Converter + private static function enumConverter(string $enum): Converter { if (!isset(self::$enumConverters[$enum])) { - $converter = new EnumOf(array_column($enum::cases(), 'value')); // @phpstan-ignore-line + // @phpstan-ignore-next-line argument.type + $converter = new EnumOf(array_column($enum::cases(), column_key: 'value')); self::$enumConverters[$enum] = $converter; } diff --git a/src/Core/Conversion/ModelOf.php b/src/Core/Conversion/ModelOf.php index 04190d95..097a4340 100644 --- a/src/Core/Conversion/ModelOf.php +++ b/src/Core/Conversion/ModelOf.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Core\Conversion; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Core\Conversion; use EInvoiceAPI\Core\Conversion\Contracts\Converter; @@ -27,7 +28,9 @@ public function __construct(public readonly \ReflectionClass $class) $properties = []; foreach ($this->class->getProperties() as $property) { - if (!empty($property->getAttributes(Api::class))) { + $attributes = [...$property->getAttributes(Required::class), ...$property->getAttributes(Optional::class)]; + + if (!empty($attributes)) { $name = $property->getName(); $properties[$name] = new PropertyInfo($property); } @@ -97,7 +100,8 @@ public function coerce(mixed $value, CoerceState $state): mixed public function from(array $data): BaseModel { $instance = $this->class->newInstanceWithoutConstructor(); - $instance->__unserialize($data); // @phpstan-ignore-line + // @phpstan-ignore-next-line + $instance->__unserialize($data); return $instance; } diff --git a/src/Core/Conversion/PropertyInfo.php b/src/Core/Conversion/PropertyInfo.php index e7064c32..780c9719 100644 --- a/src/Core/Conversion/PropertyInfo.php +++ b/src/Core/Conversion/PropertyInfo.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Core\Conversion; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Conversion\Contracts\Converter; use EInvoiceAPI\Core\Conversion\Contracts\ConverterSource; @@ -28,9 +29,10 @@ public function __construct(public readonly \ReflectionProperty $property) $apiName = $property->getName(); $type = $property->getType(); $optional = false; + $attributes = [...$property->getAttributes(Required::class), ...$property->getAttributes(Optional::class)]; - foreach ($property->getAttributes(Api::class) as $attr) { - /** @var Api $attribute */ + foreach ($attributes as $attr) { + /** @var Required $attribute */ $attribute = $attr->newInstance(); $apiName = $attribute->apiName ?? $apiName; diff --git a/src/Documents/Allowance.php b/src/Documents/Allowance.php index 72c792c5..8ab40c05 100644 --- a/src/Documents/Allowance.php +++ b/src/Documents/Allowance.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\Allowance\ReasonCode; @@ -31,25 +31,25 @@ final class Allowance implements BaseModel /** * The allowance amount, without VAT. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $amount; /** * The base amount that may be used, in conjunction with the allowance percentage, to calculate the allowance amount. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $base_amount; /** * The percentage that may be used, in conjunction with the allowance base amount, to calculate the allowance amount. To state 20%, use value 20. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $multiplier_factor; /** * The reason for the allowance. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $reason; /** @@ -57,7 +57,7 @@ final class Allowance implements BaseModel * * @var value-of|null $reason_code */ - #[Api(enum: ReasonCode::class, nullable: true, optional: true)] + #[Optional(enum: ReasonCode::class, nullable: true)] public ?string $reason_code; /** @@ -65,13 +65,13 @@ final class Allowance implements BaseModel * * @var value-of|null $tax_code */ - #[Api(enum: TaxCode::class, optional: true)] + #[Optional(enum: TaxCode::class)] public ?string $tax_code; /** * The VAT rate, represented as percentage that applies to the allowance. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $tax_rate; public function __construct() diff --git a/src/Documents/Attachments/AttachmentAddParams.php b/src/Documents/Attachments/AttachmentAddParams.php index 7716ed36..33a09602 100644 --- a/src/Documents/Attachments/AttachmentAddParams.php +++ b/src/Documents/Attachments/AttachmentAddParams.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\Attachments; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -22,7 +22,7 @@ final class AttachmentAddParams implements BaseModel use SdkModel; use SdkParams; - #[Api] + #[Required] public string $file; /** diff --git a/src/Documents/Attachments/AttachmentDeleteParams.php b/src/Documents/Attachments/AttachmentDeleteParams.php index a5a3b26d..df1130c1 100644 --- a/src/Documents/Attachments/AttachmentDeleteParams.php +++ b/src/Documents/Attachments/AttachmentDeleteParams.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\Attachments; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -22,7 +22,7 @@ final class AttachmentDeleteParams implements BaseModel use SdkModel; use SdkParams; - #[Api] + #[Required] public string $document_id; /** diff --git a/src/Documents/Attachments/AttachmentDeleteResponse.php b/src/Documents/Attachments/AttachmentDeleteResponse.php index 87a6dc88..2922a50b 100644 --- a/src/Documents/Attachments/AttachmentDeleteResponse.php +++ b/src/Documents/Attachments/AttachmentDeleteResponse.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\Attachments; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -16,7 +16,7 @@ final class AttachmentDeleteResponse implements BaseModel /** @use SdkModel */ use SdkModel; - #[Api] + #[Required] public bool $is_deleted; /** diff --git a/src/Documents/Attachments/AttachmentRetrieveParams.php b/src/Documents/Attachments/AttachmentRetrieveParams.php index c3628bce..eae132b9 100644 --- a/src/Documents/Attachments/AttachmentRetrieveParams.php +++ b/src/Documents/Attachments/AttachmentRetrieveParams.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\Attachments; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -22,7 +22,7 @@ final class AttachmentRetrieveParams implements BaseModel use SdkModel; use SdkParams; - #[Api] + #[Required] public string $document_id; /** diff --git a/src/Documents/Attachments/DocumentAttachment.php b/src/Documents/Attachments/DocumentAttachment.php index c9f6cd7b..40af9918 100644 --- a/src/Documents/Attachments/DocumentAttachment.php +++ b/src/Documents/Attachments/DocumentAttachment.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Documents\Attachments; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -22,19 +23,19 @@ final class DocumentAttachment implements BaseModel /** @use SdkModel */ use SdkModel; - #[Api] + #[Required] public string $id; - #[Api] + #[Required] public string $file_name; - #[Api(optional: true)] + #[Optional] public ?int $file_size; - #[Api(optional: true)] + #[Optional] public ?string $file_type; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $file_url; /** diff --git a/src/Documents/Charge.php b/src/Documents/Charge.php index 715f0d7a..0732ce1f 100644 --- a/src/Documents/Charge.php +++ b/src/Documents/Charge.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\Charge\ReasonCode; @@ -31,25 +31,25 @@ final class Charge implements BaseModel /** * The charge amount, without VAT. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $amount; /** * The base amount that may be used, in conjunction with the charge percentage, to calculate the charge amount. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $base_amount; /** * The percentage that may be used, in conjunction with the charge base amount, to calculate the charge amount. To state 20%, use value 20. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $multiplier_factor; /** * The reason for the charge. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $reason; /** @@ -57,7 +57,7 @@ final class Charge implements BaseModel * * @var value-of|null $reason_code */ - #[Api(enum: ReasonCode::class, nullable: true, optional: true)] + #[Optional(enum: ReasonCode::class, nullable: true)] public ?string $reason_code; /** @@ -69,13 +69,13 @@ final class Charge implements BaseModel * * @var value-of|null $tax_code */ - #[Api(enum: TaxCode::class, nullable: true, optional: true)] + #[Optional(enum: TaxCode::class, nullable: true)] public ?string $tax_code; /** * The VAT rate, represented as percentage that applies to the charge. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $tax_rate; public function __construct() diff --git a/src/Documents/DocumentAttachmentCreate.php b/src/Documents/DocumentAttachmentCreate.php index 5c0b5c4c..e212adb3 100644 --- a/src/Documents/DocumentAttachmentCreate.php +++ b/src/Documents/DocumentAttachmentCreate.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Documents; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -21,19 +22,19 @@ final class DocumentAttachmentCreate implements BaseModel /** @use SdkModel */ use SdkModel; - #[Api] + #[Required] public string $file_name; /** * Base64 encoded file data. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $file_data; - #[Api(optional: true)] + #[Optional] public ?int $file_size; - #[Api(optional: true)] + #[Optional] public ?string $file_type; /** diff --git a/src/Documents/DocumentCreate.php b/src/Documents/DocumentCreate.php index 6e315c05..838d2b76 100644 --- a/src/Documents/DocumentCreate.php +++ b/src/Documents/DocumentCreate.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\DocumentCreate\Allowance; @@ -74,40 +74,38 @@ final class DocumentCreate implements BaseModel use SdkModel; /** @var list|null $allowances */ - #[Api( + #[Optional( list: Allowance::class, - nullable: true, - optional: true, + nullable: true )] public ?array $allowances; /** * The amount due for payment. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount_due; /** @var list|null $attachments */ - #[Api(list: DocumentAttachmentCreate::class, nullable: true, optional: true)] + #[Optional(list: DocumentAttachmentCreate::class, nullable: true)] public ?array $attachments; /** * The billing address (if different from customer address). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $billing_address; /** * The recipient name at the billing address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $billing_address_recipient; /** @var list|null $charges */ - #[Api( + #[Optional( list: Charge::class, - nullable: true, - optional: true, + nullable: true )] public ?array $charges; @@ -116,49 +114,49 @@ final class DocumentCreate implements BaseModel * * @var value-of|null $currency */ - #[Api(enum: CurrencyCode::class, optional: true)] + #[Optional(enum: CurrencyCode::class)] public ?string $currency; /** * The address of the customer/buyer. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_address; /** * The recipient name at the customer address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_address_recipient; /** * Customer company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_company_id; /** * The email address of the customer. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_email; /** * The unique identifier for the customer in your system. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_id; /** * The company name of the customer/buyer. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_name; /** * Customer tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_tax_id; /** @@ -166,7 +164,7 @@ final class DocumentCreate implements BaseModel * * @var value-of|null $direction */ - #[Api(enum: DocumentDirection::class, optional: true)] + #[Optional(enum: DocumentDirection::class)] public ?string $direction; /** @@ -174,31 +172,31 @@ final class DocumentCreate implements BaseModel * * @var value-of|null $document_type */ - #[Api(enum: DocumentType::class, optional: true)] + #[Optional(enum: DocumentType::class)] public ?string $document_type; /** * The date when payment is due. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $due_date; /** * The date when the invoice was issued. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $invoice_date; /** * The unique invoice identifier/number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $invoice_id; /** * The total amount of the invoice including tax (invoice_total = subtotal + total_tax + total_discount). Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $invoice_total; /** @@ -206,83 +204,83 @@ final class DocumentCreate implements BaseModel * * @var list|null $items */ - #[Api(list: Item::class, optional: true)] + #[Optional(list: Item::class)] public ?array $items; /** * Additional notes or comments for the invoice. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $note; /** @var list|null $payment_details */ - #[Api(list: PaymentDetailCreate::class, nullable: true, optional: true)] + #[Optional(list: PaymentDetailCreate::class, nullable: true)] public ?array $payment_details; /** * The payment terms (e.g., 'Net 30', 'Due on receipt', '2/10 Net 30'). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $payment_term; /** * The previous unpaid balance from prior invoices, if any. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $previous_unpaid_balance; /** * The purchase order reference number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $purchase_order; /** * The address where payment should be sent or remitted to. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $remittance_address; /** * The recipient name at the remittance address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $remittance_address_recipient; /** * The address where services were performed or goods were delivered. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $service_address; /** * The recipient name at the service address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $service_address_recipient; /** * The end date of the service period or delivery period. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $service_end_date; /** * The start date of the service period or delivery period. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $service_start_date; /** * The shipping/delivery address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $shipping_address; /** * The recipient name at the shipping address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $shipping_address_recipient; /** @@ -290,13 +288,13 @@ final class DocumentCreate implements BaseModel * * @var value-of|null $state */ - #[Api(enum: DocumentState::class, optional: true)] + #[Optional(enum: DocumentState::class)] public ?string $state; /** * The taxable base of the invoice. Should be the sum of all line items - allowances (for example commercial discounts) + charges with impact on VAT. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $subtotal; /** @@ -304,23 +302,23 @@ final class DocumentCreate implements BaseModel * * @var value-of|null $tax_code */ - #[Api(enum: TaxCode::class, optional: true)] + #[Optional(enum: TaxCode::class)] public ?string $tax_code; /** @var list|null $tax_details */ - #[Api(list: TaxDetail::class, nullable: true, optional: true)] + #[Optional(list: TaxDetail::class, nullable: true)] public ?array $tax_details; /** * The net financial discount/charge of the invoice (non-VAT charges minus non-VAT allowances). Can be positive (net charge), negative (net discount), or zero. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $total_discount; /** * The total tax amount of the invoice. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $total_tax; /** @@ -331,49 +329,49 @@ final class DocumentCreate implements BaseModel * * @var value-of|null $vatex */ - #[Api(enum: Vatex::class, nullable: true, optional: true)] + #[Optional(enum: Vatex::class, nullable: true)] public ?string $vatex; /** * Textual explanation for VAT exemption. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vatex_note; /** * The address of the vendor/seller. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_address; /** * The recipient name at the vendor address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_address_recipient; /** * Vendor company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_company_id; /** * The email address of the vendor. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_email; /** * The name of the vendor/seller/supplier. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_name; /** * Vendor tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_tax_id; public function __construct() diff --git a/src/Documents/DocumentCreate/Allowance.php b/src/Documents/DocumentCreate/Allowance.php index 729e820c..0c3e5fea 100644 --- a/src/Documents/DocumentCreate/Allowance.php +++ b/src/Documents/DocumentCreate/Allowance.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentCreate; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\DocumentCreate\Allowance\ReasonCode; @@ -31,25 +31,25 @@ final class Allowance implements BaseModel /** * The allowance amount, without VAT. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** * The base amount that may be used, in conjunction with the allowance percentage, to calculate the allowance amount. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $base_amount; /** * The percentage that may be used, in conjunction with the allowance base amount, to calculate the allowance amount. To state 20%, use value 20. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $multiplier_factor; /** * The reason for the allowance. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $reason; /** @@ -57,7 +57,7 @@ final class Allowance implements BaseModel * * @var value-of|null $reason_code */ - #[Api(enum: ReasonCode::class, nullable: true, optional: true)] + #[Optional(enum: ReasonCode::class, nullable: true)] public ?string $reason_code; /** @@ -65,16 +65,15 @@ final class Allowance implements BaseModel * * @var value-of|null $tax_code */ - #[Api( - enum: TaxCode::class, - optional: true, + #[Optional( + enum: TaxCode::class )] public ?string $tax_code; /** * The VAT rate, represented as percentage that applies to the allowance. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax_rate; public function __construct() diff --git a/src/Documents/DocumentCreate/Charge.php b/src/Documents/DocumentCreate/Charge.php index 9f6f2597..bf566aa8 100644 --- a/src/Documents/DocumentCreate/Charge.php +++ b/src/Documents/DocumentCreate/Charge.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentCreate; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\DocumentCreate\Charge\ReasonCode; @@ -31,25 +31,25 @@ final class Charge implements BaseModel /** * The charge amount, without VAT. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** * The base amount that may be used, in conjunction with the charge percentage, to calculate the charge amount. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $base_amount; /** * The percentage that may be used, in conjunction with the charge base amount, to calculate the charge amount. To state 20%, use value 20. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $multiplier_factor; /** * The reason for the charge. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $reason; /** @@ -57,7 +57,7 @@ final class Charge implements BaseModel * * @var value-of|null $reason_code */ - #[Api(enum: ReasonCode::class, nullable: true, optional: true)] + #[Optional(enum: ReasonCode::class, nullable: true)] public ?string $reason_code; /** @@ -69,17 +69,16 @@ final class Charge implements BaseModel * * @var value-of|null $tax_code */ - #[Api( + #[Optional( enum: TaxCode::class, nullable: true, - optional: true, )] public ?string $tax_code; /** * The VAT rate, represented as percentage that applies to the charge. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax_rate; public function __construct() diff --git a/src/Documents/DocumentCreate/Item.php b/src/Documents/DocumentCreate/Item.php index c4cd4e07..1483f0eb 100644 --- a/src/Documents/DocumentCreate/Item.php +++ b/src/Documents/DocumentCreate/Item.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentCreate; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\DocumentCreate\Item\Allowance; @@ -38,17 +38,16 @@ final class Item implements BaseModel * * @var list|null $allowances */ - #[Api( + #[Optional( list: Allowance::class, nullable: true, - optional: true, )] public ?array $allowances; /** * The invoice line net amount (BT-131), exclusive of VAT, inclusive of line level allowances and charges. Calculated as: ((unit_price / price_base_quantity) * quantity) - allowances + charges. Must be rounded to maximum 2 decimals. Can be negative for credit notes or corrections. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** @@ -56,45 +55,44 @@ final class Item implements BaseModel * * @var list|null $charges */ - #[Api( + #[Optional( list: Charge::class, nullable: true, - optional: true, )] public ?array $charges; /** @var null|null $date */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public null $date; /** * The description of the line item. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $description; /** * The product code of the line item. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $product_code; /** * The quantity of items (goods or services) that is the subject of the line item. Must be rounded to maximum 4 decimals. Can be negative for credit notes or corrections. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $quantity; /** * The total VAT amount for the line item. Must be rounded to maximum 2 decimals. Can be negative for credit notes or corrections. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax; /** * The VAT rate of the line item expressed as percentage with 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax_rate; /** @@ -102,13 +100,13 @@ final class Item implements BaseModel * * @var value-of|null $unit */ - #[Api(enum: UnitOfMeasureCode::class, nullable: true, optional: true)] + #[Optional(enum: UnitOfMeasureCode::class, nullable: true)] public ?string $unit; /** * The item net price (BT-146). The price of an item, exclusive of VAT, after subtracting item price discount. Must be rounded to maximum 4 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $unit_price; public function __construct() diff --git a/src/Documents/DocumentCreate/Item/Allowance.php b/src/Documents/DocumentCreate/Item/Allowance.php index 042b2fb0..0c952a30 100644 --- a/src/Documents/DocumentCreate/Item/Allowance.php +++ b/src/Documents/DocumentCreate/Item/Allowance.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentCreate\Item; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\DocumentCreate\Item\Allowance\ReasonCode; @@ -31,25 +31,25 @@ final class Allowance implements BaseModel /** * The allowance amount, without VAT. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** * The base amount that may be used, in conjunction with the allowance percentage, to calculate the allowance amount. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $base_amount; /** * The percentage that may be used, in conjunction with the allowance base amount, to calculate the allowance amount. To state 20%, use value 20. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $multiplier_factor; /** * The reason for the allowance. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $reason; /** @@ -57,7 +57,7 @@ final class Allowance implements BaseModel * * @var value-of|null $reason_code */ - #[Api(enum: ReasonCode::class, nullable: true, optional: true)] + #[Optional(enum: ReasonCode::class, nullable: true)] public ?string $reason_code; /** @@ -65,13 +65,13 @@ final class Allowance implements BaseModel * * @var value-of|null $tax_code */ - #[Api(enum: TaxCode::class, optional: true)] + #[Optional(enum: TaxCode::class)] public ?string $tax_code; /** * The VAT rate, represented as percentage that applies to the allowance. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax_rate; public function __construct() diff --git a/src/Documents/DocumentCreate/Item/Charge.php b/src/Documents/DocumentCreate/Item/Charge.php index 0f020506..68368a2b 100644 --- a/src/Documents/DocumentCreate/Item/Charge.php +++ b/src/Documents/DocumentCreate/Item/Charge.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentCreate\Item; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\DocumentCreate\Item\Charge\ReasonCode; @@ -31,25 +31,25 @@ final class Charge implements BaseModel /** * The charge amount, without VAT. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** * The base amount that may be used, in conjunction with the charge percentage, to calculate the charge amount. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $base_amount; /** * The percentage that may be used, in conjunction with the charge base amount, to calculate the charge amount. To state 20%, use value 20. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $multiplier_factor; /** * The reason for the charge. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $reason; /** @@ -57,7 +57,7 @@ final class Charge implements BaseModel * * @var value-of|null $reason_code */ - #[Api(enum: ReasonCode::class, nullable: true, optional: true)] + #[Optional(enum: ReasonCode::class, nullable: true)] public ?string $reason_code; /** @@ -69,13 +69,13 @@ final class Charge implements BaseModel * * @var value-of|null $tax_code */ - #[Api(enum: TaxCode::class, nullable: true, optional: true)] + #[Optional(enum: TaxCode::class, nullable: true)] public ?string $tax_code; /** * The VAT rate, represented as percentage that applies to the charge. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax_rate; public function __construct() diff --git a/src/Documents/DocumentCreate/TaxDetail.php b/src/Documents/DocumentCreate/TaxDetail.php index 7ee5e1b8..31fd8c3e 100644 --- a/src/Documents/DocumentCreate/TaxDetail.php +++ b/src/Documents/DocumentCreate/TaxDetail.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentCreate; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -21,13 +21,13 @@ final class TaxDetail implements BaseModel /** * The tax amount for this tax category. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** * The tax rate as a percentage (e.g., '21.00', '6.00', '0.00'). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $rate; public function __construct() diff --git a/src/Documents/DocumentCreateFromPdfParams.php b/src/Documents/DocumentCreateFromPdfParams.php index f7229f9b..8a818303 100644 --- a/src/Documents/DocumentCreateFromPdfParams.php +++ b/src/Documents/DocumentCreateFromPdfParams.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Documents; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -24,13 +25,13 @@ final class DocumentCreateFromPdfParams implements BaseModel use SdkModel; use SdkParams; - #[Api] + #[Required] public string $file; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_tax_id; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_tax_id; /** diff --git a/src/Documents/DocumentCreateParams.php b/src/Documents/DocumentCreateParams.php index f630192a..9b1f34b1 100644 --- a/src/Documents/DocumentCreateParams.php +++ b/src/Documents/DocumentCreateParams.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -122,40 +122,38 @@ final class DocumentCreateParams implements BaseModel /** * @var list|null $allowances */ - #[Api( + #[Optional( list: Allowance::class, nullable: true, - optional: true, )] public ?array $allowances; /** * The amount due for payment. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount_due; /** @var list|null $attachments */ - #[Api(list: DocumentAttachmentCreate::class, nullable: true, optional: true)] + #[Optional(list: DocumentAttachmentCreate::class, nullable: true)] public ?array $attachments; /** * The billing address (if different from customer address). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $billing_address; /** * The recipient name at the billing address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $billing_address_recipient; /** @var list|null $charges */ - #[Api( + #[Optional( list: Charge::class, nullable: true, - optional: true, )] public ?array $charges; @@ -164,49 +162,49 @@ final class DocumentCreateParams implements BaseModel * * @var value-of|null $currency */ - #[Api(enum: CurrencyCode::class, optional: true)] + #[Optional(enum: CurrencyCode::class)] public ?string $currency; /** * The address of the customer/buyer. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_address; /** * The recipient name at the customer address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_address_recipient; /** * Customer company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_company_id; /** * The email address of the customer. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_email; /** * The unique identifier for the customer in your system. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_id; /** * The company name of the customer/buyer. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_name; /** * Customer tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_tax_id; /** @@ -214,7 +212,7 @@ final class DocumentCreateParams implements BaseModel * * @var value-of|null $direction */ - #[Api(enum: DocumentDirection::class, optional: true)] + #[Optional(enum: DocumentDirection::class)] public ?string $direction; /** @@ -222,31 +220,31 @@ final class DocumentCreateParams implements BaseModel * * @var value-of|null $document_type */ - #[Api(enum: DocumentType::class, optional: true)] + #[Optional(enum: DocumentType::class)] public ?string $document_type; /** * The date when payment is due. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $due_date; /** * The date when the invoice was issued. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $invoice_date; /** * The unique invoice identifier/number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $invoice_id; /** * The total amount of the invoice including tax (invoice_total = subtotal + total_tax + total_discount). Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $invoice_total; /** @@ -254,83 +252,83 @@ final class DocumentCreateParams implements BaseModel * * @var list|null $items */ - #[Api(list: Item::class, optional: true)] + #[Optional(list: Item::class)] public ?array $items; /** * Additional notes or comments for the invoice. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $note; /** @var list|null $payment_details */ - #[Api(list: PaymentDetailCreate::class, nullable: true, optional: true)] + #[Optional(list: PaymentDetailCreate::class, nullable: true)] public ?array $payment_details; /** * The payment terms (e.g., 'Net 30', 'Due on receipt', '2/10 Net 30'). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $payment_term; /** * The previous unpaid balance from prior invoices, if any. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $previous_unpaid_balance; /** * The purchase order reference number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $purchase_order; /** * The address where payment should be sent or remitted to. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $remittance_address; /** * The recipient name at the remittance address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $remittance_address_recipient; /** * The address where services were performed or goods were delivered. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $service_address; /** * The recipient name at the service address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $service_address_recipient; /** * The end date of the service period or delivery period. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $service_end_date; /** * The start date of the service period or delivery period. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $service_start_date; /** * The shipping/delivery address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $shipping_address; /** * The recipient name at the shipping address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $shipping_address_recipient; /** @@ -338,13 +336,13 @@ final class DocumentCreateParams implements BaseModel * * @var value-of|null $state */ - #[Api(enum: DocumentState::class, optional: true)] + #[Optional(enum: DocumentState::class)] public ?string $state; /** * The taxable base of the invoice. Should be the sum of all line items - allowances (for example commercial discounts) + charges with impact on VAT. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $subtotal; /** @@ -352,26 +350,23 @@ final class DocumentCreateParams implements BaseModel * * @var value-of|null $tax_code */ - #[Api( - enum: DocumentCreateParams\TaxCode::class, - optional: true, - )] + #[Optional(enum: DocumentCreateParams\TaxCode::class)] public ?string $tax_code; /** @var list|null $tax_details */ - #[Api(list: TaxDetail::class, nullable: true, optional: true)] + #[Optional(list: TaxDetail::class, nullable: true)] public ?array $tax_details; /** * The net financial discount/charge of the invoice (non-VAT charges minus non-VAT allowances). Can be positive (net charge), negative (net discount), or zero. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $total_discount; /** * The total tax amount of the invoice. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $total_tax; /** @@ -382,49 +377,49 @@ enum: DocumentCreateParams\TaxCode::class, * * @var value-of|null $vatex */ - #[Api(enum: Vatex::class, nullable: true, optional: true)] + #[Optional(enum: Vatex::class, nullable: true)] public ?string $vatex; /** * Textual explanation for VAT exemption. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vatex_note; /** * The address of the vendor/seller. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_address; /** * The recipient name at the vendor address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_address_recipient; /** * Vendor company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_company_id; /** * The email address of the vendor. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_email; /** * The name of the vendor/seller/supplier. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_name; /** * Vendor tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_tax_id; public function __construct() diff --git a/src/Documents/DocumentCreateParams/Allowance.php b/src/Documents/DocumentCreateParams/Allowance.php index 6550acac..c5a53ed8 100644 --- a/src/Documents/DocumentCreateParams/Allowance.php +++ b/src/Documents/DocumentCreateParams/Allowance.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentCreateParams; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\DocumentCreateParams\Allowance\ReasonCode; @@ -31,25 +31,25 @@ final class Allowance implements BaseModel /** * The allowance amount, without VAT. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** * The base amount that may be used, in conjunction with the allowance percentage, to calculate the allowance amount. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $base_amount; /** * The percentage that may be used, in conjunction with the allowance base amount, to calculate the allowance amount. To state 20%, use value 20. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $multiplier_factor; /** * The reason for the allowance. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $reason; /** @@ -57,7 +57,7 @@ final class Allowance implements BaseModel * * @var value-of|null $reason_code */ - #[Api(enum: ReasonCode::class, nullable: true, optional: true)] + #[Optional(enum: ReasonCode::class, nullable: true)] public ?string $reason_code; /** @@ -65,16 +65,15 @@ final class Allowance implements BaseModel * * @var value-of|null $tax_code */ - #[Api( - enum: TaxCode::class, - optional: true, + #[Optional( + enum: TaxCode::class )] public ?string $tax_code; /** * The VAT rate, represented as percentage that applies to the allowance. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax_rate; public function __construct() diff --git a/src/Documents/DocumentCreateParams/Charge.php b/src/Documents/DocumentCreateParams/Charge.php index fe9bc054..f1739e19 100644 --- a/src/Documents/DocumentCreateParams/Charge.php +++ b/src/Documents/DocumentCreateParams/Charge.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentCreateParams; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\DocumentCreateParams\Charge\ReasonCode; @@ -31,25 +31,25 @@ final class Charge implements BaseModel /** * The charge amount, without VAT. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** * The base amount that may be used, in conjunction with the charge percentage, to calculate the charge amount. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $base_amount; /** * The percentage that may be used, in conjunction with the charge base amount, to calculate the charge amount. To state 20%, use value 20. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $multiplier_factor; /** * The reason for the charge. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $reason; /** @@ -57,7 +57,7 @@ final class Charge implements BaseModel * * @var value-of|null $reason_code */ - #[Api(enum: ReasonCode::class, nullable: true, optional: true)] + #[Optional(enum: ReasonCode::class, nullable: true)] public ?string $reason_code; /** @@ -69,17 +69,16 @@ final class Charge implements BaseModel * * @var value-of|null $tax_code */ - #[Api( + #[Optional( enum: TaxCode::class, nullable: true, - optional: true, )] public ?string $tax_code; /** * The VAT rate, represented as percentage that applies to the charge. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax_rate; public function __construct() diff --git a/src/Documents/DocumentCreateParams/Item.php b/src/Documents/DocumentCreateParams/Item.php index a2c86c4f..8be7efd0 100644 --- a/src/Documents/DocumentCreateParams/Item.php +++ b/src/Documents/DocumentCreateParams/Item.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentCreateParams; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\DocumentCreateParams\Item\Allowance; @@ -38,17 +38,16 @@ final class Item implements BaseModel * * @var list|null $allowances */ - #[Api( + #[Optional( list: Allowance::class, nullable: true, - optional: true, )] public ?array $allowances; /** * The invoice line net amount (BT-131), exclusive of VAT, inclusive of line level allowances and charges. Calculated as: ((unit_price / price_base_quantity) * quantity) - allowances + charges. Must be rounded to maximum 2 decimals. Can be negative for credit notes or corrections. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** @@ -56,45 +55,44 @@ final class Item implements BaseModel * * @var list|null $charges */ - #[Api( + #[Optional( list: Charge::class, nullable: true, - optional: true, )] public ?array $charges; /** @var null|null $date */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public null $date; /** * The description of the line item. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $description; /** * The product code of the line item. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $product_code; /** * The quantity of items (goods or services) that is the subject of the line item. Must be rounded to maximum 4 decimals. Can be negative for credit notes or corrections. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $quantity; /** * The total VAT amount for the line item. Must be rounded to maximum 2 decimals. Can be negative for credit notes or corrections. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax; /** * The VAT rate of the line item expressed as percentage with 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax_rate; /** @@ -102,13 +100,13 @@ final class Item implements BaseModel * * @var value-of|null $unit */ - #[Api(enum: UnitOfMeasureCode::class, nullable: true, optional: true)] + #[Optional(enum: UnitOfMeasureCode::class, nullable: true)] public ?string $unit; /** * The item net price (BT-146). The price of an item, exclusive of VAT, after subtracting item price discount. Must be rounded to maximum 4 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $unit_price; public function __construct() diff --git a/src/Documents/DocumentCreateParams/Item/Allowance.php b/src/Documents/DocumentCreateParams/Item/Allowance.php index 1b4f1e7f..981578e7 100644 --- a/src/Documents/DocumentCreateParams/Item/Allowance.php +++ b/src/Documents/DocumentCreateParams/Item/Allowance.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentCreateParams\Item; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\DocumentCreateParams\Item\Allowance\ReasonCode; @@ -31,25 +31,25 @@ final class Allowance implements BaseModel /** * The allowance amount, without VAT. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** * The base amount that may be used, in conjunction with the allowance percentage, to calculate the allowance amount. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $base_amount; /** * The percentage that may be used, in conjunction with the allowance base amount, to calculate the allowance amount. To state 20%, use value 20. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $multiplier_factor; /** * The reason for the allowance. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $reason; /** @@ -57,7 +57,7 @@ final class Allowance implements BaseModel * * @var value-of|null $reason_code */ - #[Api(enum: ReasonCode::class, nullable: true, optional: true)] + #[Optional(enum: ReasonCode::class, nullable: true)] public ?string $reason_code; /** @@ -65,13 +65,13 @@ final class Allowance implements BaseModel * * @var value-of|null $tax_code */ - #[Api(enum: TaxCode::class, optional: true)] + #[Optional(enum: TaxCode::class)] public ?string $tax_code; /** * The VAT rate, represented as percentage that applies to the allowance. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax_rate; public function __construct() diff --git a/src/Documents/DocumentCreateParams/Item/Charge.php b/src/Documents/DocumentCreateParams/Item/Charge.php index 3a425f23..921ea9a0 100644 --- a/src/Documents/DocumentCreateParams/Item/Charge.php +++ b/src/Documents/DocumentCreateParams/Item/Charge.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentCreateParams\Item; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\DocumentCreateParams\Item\Charge\ReasonCode; @@ -31,25 +31,25 @@ final class Charge implements BaseModel /** * The charge amount, without VAT. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** * The base amount that may be used, in conjunction with the charge percentage, to calculate the charge amount. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $base_amount; /** * The percentage that may be used, in conjunction with the charge base amount, to calculate the charge amount. To state 20%, use value 20. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $multiplier_factor; /** * The reason for the charge. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $reason; /** @@ -57,7 +57,7 @@ final class Charge implements BaseModel * * @var value-of|null $reason_code */ - #[Api(enum: ReasonCode::class, nullable: true, optional: true)] + #[Optional(enum: ReasonCode::class, nullable: true)] public ?string $reason_code; /** @@ -69,13 +69,13 @@ final class Charge implements BaseModel * * @var value-of|null $tax_code */ - #[Api(enum: TaxCode::class, nullable: true, optional: true)] + #[Optional(enum: TaxCode::class, nullable: true)] public ?string $tax_code; /** * The VAT rate, represented as percentage that applies to the charge. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax_rate; public function __construct() diff --git a/src/Documents/DocumentCreateParams/TaxDetail.php b/src/Documents/DocumentCreateParams/TaxDetail.php index b3befdf2..199528b3 100644 --- a/src/Documents/DocumentCreateParams/TaxDetail.php +++ b/src/Documents/DocumentCreateParams/TaxDetail.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentCreateParams; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -21,13 +21,13 @@ final class TaxDetail implements BaseModel /** * The tax amount for this tax category. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** * The tax rate as a percentage (e.g., '21.00', '6.00', '0.00'). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $rate; public function __construct() diff --git a/src/Documents/DocumentDeleteResponse.php b/src/Documents/DocumentDeleteResponse.php index 6e99283c..0a3a3c39 100644 --- a/src/Documents/DocumentDeleteResponse.php +++ b/src/Documents/DocumentDeleteResponse.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -16,7 +16,7 @@ final class DocumentDeleteResponse implements BaseModel /** @use SdkModel */ use SdkModel; - #[Api] + #[Required] public bool $is_deleted; /** diff --git a/src/Documents/DocumentNewFromPdfResponse.php b/src/Documents/DocumentNewFromPdfResponse.php index 5726711a..45c3d7ef 100644 --- a/src/Documents/DocumentNewFromPdfResponse.php +++ b/src/Documents/DocumentNewFromPdfResponse.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\Allowance\ReasonCode; @@ -73,33 +73,33 @@ final class DocumentNewFromPdfResponse implements BaseModel use SdkModel; /** @var list|null $allowances */ - #[Api(list: Allowance::class, nullable: true, optional: true)] + #[Optional(list: Allowance::class, nullable: true)] public ?array $allowances; /** * The amount due for payment. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $amount_due; /** @var list|null $attachments */ - #[Api(list: DocumentAttachmentCreate::class, nullable: true, optional: true)] + #[Optional(list: DocumentAttachmentCreate::class, nullable: true)] public ?array $attachments; /** * The billing address (if different from customer address). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $billing_address; /** * The recipient name at the billing address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $billing_address_recipient; /** @var list|null $charges */ - #[Api(list: Charge::class, nullable: true, optional: true)] + #[Optional(list: Charge::class, nullable: true)] public ?array $charges; /** @@ -107,49 +107,49 @@ final class DocumentNewFromPdfResponse implements BaseModel * * @var value-of|null $currency */ - #[Api(enum: CurrencyCode::class, optional: true)] + #[Optional(enum: CurrencyCode::class)] public ?string $currency; /** * The address of the customer/buyer. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_address; /** * The recipient name at the customer address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_address_recipient; /** * Customer company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_company_id; /** * The email address of the customer. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_email; /** * The unique identifier for the customer in your system. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_id; /** * The company name of the customer/buyer. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_name; /** * Customer tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_tax_id; /** @@ -157,7 +157,7 @@ final class DocumentNewFromPdfResponse implements BaseModel * * @var value-of|null $direction */ - #[Api(enum: DocumentDirection::class, optional: true)] + #[Optional(enum: DocumentDirection::class)] public ?string $direction; /** @@ -165,31 +165,31 @@ final class DocumentNewFromPdfResponse implements BaseModel * * @var value-of|null $document_type */ - #[Api(enum: DocumentType::class, optional: true)] + #[Optional(enum: DocumentType::class)] public ?string $document_type; /** * The date when payment is due. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $due_date; /** * The date when the invoice was issued. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $invoice_date; /** * The unique invoice identifier/number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $invoice_id; /** * The total amount of the invoice including tax (invoice_total = subtotal + total_tax + total_discount). Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $invoice_total; /** @@ -197,77 +197,77 @@ final class DocumentNewFromPdfResponse implements BaseModel * * @var list|null $items */ - #[Api(list: Item::class, optional: true)] + #[Optional(list: Item::class)] public ?array $items; /** * Additional notes or comments for the invoice. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $note; /** @var list|null $payment_details */ - #[Api(list: PaymentDetailCreate::class, nullable: true, optional: true)] + #[Optional(list: PaymentDetailCreate::class, nullable: true)] public ?array $payment_details; /** * The payment terms (e.g., 'Net 30', 'Due on receipt', '2/10 Net 30'). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $payment_term; /** * The purchase order reference number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $purchase_order; /** * The address where payment should be sent or remitted to. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $remittance_address; /** * The recipient name at the remittance address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $remittance_address_recipient; /** * The address where services were performed or goods were delivered. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $service_address; /** * The recipient name at the service address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $service_address_recipient; /** * The end date of the service period or delivery period. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $service_end_date; /** * The start date of the service period or delivery period. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $service_start_date; /** * The shipping/delivery address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $shipping_address; /** * The recipient name at the shipping address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $shipping_address_recipient; /** @@ -275,19 +275,19 @@ final class DocumentNewFromPdfResponse implements BaseModel * * @var value-of|null $state */ - #[Api(enum: DocumentState::class, optional: true)] + #[Optional(enum: DocumentState::class)] public ?string $state; /** * The taxable base of the invoice. Should be the sum of all line items - allowances (for example commercial discounts) + charges with impact on VAT. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $subtotal; /** * Whether the PDF was successfully converted into a compliant e-invoice. */ - #[Api(optional: true)] + #[Optional] public ?bool $success; /** @@ -295,29 +295,29 @@ final class DocumentNewFromPdfResponse implements BaseModel * * @var value-of|null $tax_code */ - #[Api(enum: TaxCode::class, optional: true)] + #[Optional(enum: TaxCode::class)] public ?string $tax_code; /** @var list|null $tax_details */ - #[Api(list: TaxDetail::class, nullable: true, optional: true)] + #[Optional(list: TaxDetail::class, nullable: true)] public ?array $tax_details; /** * The net financial discount/charge of the invoice (non-VAT charges minus non-VAT allowances). Can be positive (net charge), negative (net discount), or zero. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $total_discount; /** * The total tax amount of the invoice. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $total_tax; /** * The UBL document as an XML string. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $ubl_document; /** @@ -328,49 +328,49 @@ final class DocumentNewFromPdfResponse implements BaseModel * * @var value-of|null $vatex */ - #[Api(enum: Vatex::class, nullable: true, optional: true)] + #[Optional(enum: Vatex::class, nullable: true)] public ?string $vatex; /** * Textual explanation for VAT exemption. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vatex_note; /** * The address of the vendor/seller. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_address; /** * The recipient name at the vendor address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_address_recipient; /** * Vendor company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_company_id; /** * The email address of the vendor. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_email; /** * The name of the vendor/seller/supplier. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_name; /** * Vendor tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_tax_id; public function __construct() diff --git a/src/Documents/DocumentNewFromPdfResponse/Item.php b/src/Documents/DocumentNewFromPdfResponse/Item.php index 45037b47..45325b45 100644 --- a/src/Documents/DocumentNewFromPdfResponse/Item.php +++ b/src/Documents/DocumentNewFromPdfResponse/Item.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentNewFromPdfResponse; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\Allowance; @@ -38,13 +38,13 @@ final class Item implements BaseModel * * @var list|null $allowances */ - #[Api(list: Allowance::class, nullable: true, optional: true)] + #[Optional(list: Allowance::class, nullable: true)] public ?array $allowances; /** * The invoice line net amount (BT-131), exclusive of VAT, inclusive of line level allowances and charges. Calculated as: ((unit_price / price_base_quantity) * quantity) - allowances + charges. Must be rounded to maximum 2 decimals. Can be negative for credit notes or corrections. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $amount; /** @@ -52,41 +52,41 @@ final class Item implements BaseModel * * @var list|null $charges */ - #[Api(list: Charge::class, nullable: true, optional: true)] + #[Optional(list: Charge::class, nullable: true)] public ?array $charges; /** @var null|null $date */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public null $date; /** * The description of the line item. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $description; /** * The product code of the line item. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $product_code; /** * The quantity of items (goods or services) that is the subject of the line item. Must be rounded to maximum 4 decimals. Can be negative for credit notes or corrections. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $quantity; /** * The total VAT amount for the line item. Must be rounded to maximum 2 decimals. Can be negative for credit notes or corrections. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $tax; /** * The VAT rate of the line item expressed as percentage with 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $tax_rate; /** @@ -94,13 +94,13 @@ final class Item implements BaseModel * * @var value-of|null $unit */ - #[Api(enum: UnitOfMeasureCode::class, nullable: true, optional: true)] + #[Optional(enum: UnitOfMeasureCode::class, nullable: true)] public ?string $unit; /** * The item net price (BT-146). The price of an item, exclusive of VAT, after subtracting item price discount. Must be rounded to maximum 4 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $unit_price; public function __construct() diff --git a/src/Documents/DocumentNewFromPdfResponse/TaxDetail.php b/src/Documents/DocumentNewFromPdfResponse/TaxDetail.php index 72449340..9115f9e5 100644 --- a/src/Documents/DocumentNewFromPdfResponse/TaxDetail.php +++ b/src/Documents/DocumentNewFromPdfResponse/TaxDetail.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentNewFromPdfResponse; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -19,13 +19,13 @@ final class TaxDetail implements BaseModel /** * The tax amount for this tax category. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $amount; /** * The tax rate as a percentage (e.g., '21.00', '6.00', '0.00'). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $rate; public function __construct() diff --git a/src/Documents/DocumentResponse.php b/src/Documents/DocumentResponse.php index 0e71f979..8231c582 100644 --- a/src/Documents/DocumentResponse.php +++ b/src/Documents/DocumentResponse.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Documents; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\Attachments\DocumentAttachment; @@ -73,44 +74,42 @@ final class DocumentResponse implements BaseModel /** @use SdkModel */ use SdkModel; - #[Api] + #[Required] public string $id; /** @var list|null $allowances */ - #[Api( + #[Optional( list: DocumentResponse\Allowance::class, nullable: true, - optional: true, )] public ?array $allowances; /** * The amount due for payment. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $amount_due; /** @var list|null $attachments */ - #[Api(list: DocumentAttachment::class, nullable: true, optional: true)] + #[Optional(list: DocumentAttachment::class, nullable: true)] public ?array $attachments; /** * The billing address (if different from customer address). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $billing_address; /** * The recipient name at the billing address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $billing_address_recipient; /** @var list|null $charges */ - #[Api( + #[Optional( list: DocumentResponse\Charge::class, - nullable: true, - optional: true, + nullable: true )] public ?array $charges; @@ -119,49 +118,49 @@ final class DocumentResponse implements BaseModel * * @var value-of|null $currency */ - #[Api(enum: CurrencyCode::class, optional: true)] + #[Optional(enum: CurrencyCode::class)] public ?string $currency; /** * The address of the customer/buyer. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_address; /** * The recipient name at the customer address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_address_recipient; /** * Customer company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_company_id; /** * The email address of the customer. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_email; /** * The unique identifier for the customer in your system. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_id; /** * The company name of the customer/buyer. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_name; /** * Customer tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_tax_id; /** @@ -169,7 +168,7 @@ final class DocumentResponse implements BaseModel * * @var value-of|null $direction */ - #[Api(enum: DocumentDirection::class, optional: true)] + #[Optional(enum: DocumentDirection::class)] public ?string $direction; /** @@ -177,105 +176,105 @@ final class DocumentResponse implements BaseModel * * @var value-of|null $document_type */ - #[Api(enum: DocumentType::class, optional: true)] + #[Optional(enum: DocumentType::class)] public ?string $document_type; /** * The date when payment is due. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $due_date; /** * The date when the invoice was issued. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $invoice_date; /** * The unique invoice identifier/number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $invoice_id; /** * The total amount of the invoice including tax (invoice_total = subtotal + total_tax + total_discount). Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $invoice_total; /** @var list|null $items */ - #[Api(list: Item::class, nullable: true, optional: true)] + #[Optional(list: Item::class, nullable: true)] public ?array $items; /** * Additional notes or comments for the invoice. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $note; /** @var list|null $payment_details */ - #[Api(list: PaymentDetail::class, nullable: true, optional: true)] + #[Optional(list: PaymentDetail::class, nullable: true)] public ?array $payment_details; /** * The payment terms (e.g., 'Net 30', 'Due on receipt', '2/10 Net 30'). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $payment_term; /** * The purchase order reference number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $purchase_order; /** * The address where payment should be sent or remitted to. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $remittance_address; /** * The recipient name at the remittance address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $remittance_address_recipient; /** * The address where services were performed or goods were delivered. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $service_address; /** * The recipient name at the service address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $service_address_recipient; /** * The end date of the service period or delivery period. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $service_end_date; /** * The start date of the service period or delivery period. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $service_start_date; /** * The shipping/delivery address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $shipping_address; /** * The recipient name at the shipping address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $shipping_address_recipient; /** @@ -283,13 +282,13 @@ final class DocumentResponse implements BaseModel * * @var value-of|null $state */ - #[Api(enum: DocumentState::class, optional: true)] + #[Optional(enum: DocumentState::class)] public ?string $state; /** * The taxable base of the invoice. Should be the sum of all line items - allowances (for example commercial discounts) + charges with impact on VAT. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $subtotal; /** @@ -297,23 +296,23 @@ final class DocumentResponse implements BaseModel * * @var value-of|null $tax_code */ - #[Api(enum: TaxCode::class, optional: true)] + #[Optional(enum: TaxCode::class)] public ?string $tax_code; /** @var list|null $tax_details */ - #[Api(list: TaxDetail::class, nullable: true, optional: true)] + #[Optional(list: TaxDetail::class, nullable: true)] public ?array $tax_details; /** * The net financial discount/charge of the invoice (non-VAT charges minus non-VAT allowances). Can be positive (net charge), negative (net discount), or zero. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $total_discount; /** * The total tax amount of the invoice. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $total_tax; /** @@ -324,49 +323,49 @@ final class DocumentResponse implements BaseModel * * @var value-of|null $vatex */ - #[Api(enum: Vatex::class, nullable: true, optional: true)] + #[Optional(enum: Vatex::class, nullable: true)] public ?string $vatex; /** * Textual explanation for VAT exemption. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vatex_note; /** * The address of the vendor/seller. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_address; /** * The recipient name at the vendor address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_address_recipient; /** * Vendor company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_company_id; /** * The email address of the vendor. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_email; /** * The name of the vendor/seller/supplier. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_name; /** * Vendor tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_tax_id; /** diff --git a/src/Documents/DocumentResponse/Allowance.php b/src/Documents/DocumentResponse/Allowance.php index 242988ed..53e9eeb5 100644 --- a/src/Documents/DocumentResponse/Allowance.php +++ b/src/Documents/DocumentResponse/Allowance.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentResponse; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\DocumentResponse\Allowance\ReasonCode; @@ -29,25 +29,25 @@ final class Allowance implements BaseModel /** * The allowance amount, without VAT. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $amount; /** * The base amount that may be used, in conjunction with the allowance percentage, to calculate the allowance amount. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $base_amount; /** * The percentage that may be used, in conjunction with the allowance base amount, to calculate the allowance amount. To state 20%, use value 20. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $multiplier_factor; /** * The reason for the allowance. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $reason; /** @@ -55,7 +55,7 @@ final class Allowance implements BaseModel * * @var value-of|null $reason_code */ - #[Api(enum: ReasonCode::class, nullable: true, optional: true)] + #[Optional(enum: ReasonCode::class, nullable: true)] public ?string $reason_code; /** @@ -63,16 +63,15 @@ final class Allowance implements BaseModel * * @var value-of|null $tax_code */ - #[Api( - enum: TaxCode::class, - optional: true, + #[Optional( + enum: TaxCode::class )] public ?string $tax_code; /** * The VAT rate, represented as percentage that applies to the allowance. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $tax_rate; public function __construct() diff --git a/src/Documents/DocumentResponse/Charge.php b/src/Documents/DocumentResponse/Charge.php index b43f0e74..835ac501 100644 --- a/src/Documents/DocumentResponse/Charge.php +++ b/src/Documents/DocumentResponse/Charge.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentResponse; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\DocumentResponse\Charge\ReasonCode; @@ -29,25 +29,25 @@ final class Charge implements BaseModel /** * The charge amount, without VAT. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $amount; /** * The base amount that may be used, in conjunction with the charge percentage, to calculate the charge amount. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $base_amount; /** * The percentage that may be used, in conjunction with the charge base amount, to calculate the charge amount. To state 20%, use value 20. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $multiplier_factor; /** * The reason for the charge. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $reason; /** @@ -55,7 +55,7 @@ final class Charge implements BaseModel * * @var value-of|null $reason_code */ - #[Api(enum: ReasonCode::class, nullable: true, optional: true)] + #[Optional(enum: ReasonCode::class, nullable: true)] public ?string $reason_code; /** @@ -67,17 +67,16 @@ final class Charge implements BaseModel * * @var value-of|null $tax_code */ - #[Api( + #[Optional( enum: TaxCode::class, nullable: true, - optional: true, )] public ?string $tax_code; /** * The VAT rate, represented as percentage that applies to the charge. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $tax_rate; public function __construct() diff --git a/src/Documents/DocumentResponse/Item.php b/src/Documents/DocumentResponse/Item.php index 2932650f..6ba64130 100644 --- a/src/Documents/DocumentResponse/Item.php +++ b/src/Documents/DocumentResponse/Item.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentResponse; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\Allowance; @@ -38,17 +38,13 @@ final class Item implements BaseModel * * @var list|null $allowances */ - #[Api( - list: Allowance::class, - nullable: true, - optional: true, - )] + #[Optional(list: Allowance::class, nullable: true)] public ?array $allowances; /** * The invoice line net amount (BT-131), exclusive of VAT, inclusive of line level allowances and charges. Calculated as: ((unit_price / price_base_quantity) * quantity) - allowances + charges. Must be rounded to maximum 2 decimals. Can be negative for credit notes or corrections. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $amount; /** @@ -56,45 +52,41 @@ final class Item implements BaseModel * * @var list|null $charges */ - #[Api( - list: Charge::class, - nullable: true, - optional: true - )] + #[Optional(list: Charge::class, nullable: true)] public ?array $charges; /** @var null|null $date */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public null $date; /** * The description of the line item. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $description; /** * The product code of the line item. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $product_code; /** * The quantity of items (goods or services) that is the subject of the line item. Must be rounded to maximum 4 decimals. Can be negative for credit notes or corrections. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $quantity; /** * The total VAT amount for the line item. Must be rounded to maximum 2 decimals. Can be negative for credit notes or corrections. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $tax; /** * The VAT rate of the line item expressed as percentage with 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $tax_rate; /** @@ -102,13 +94,13 @@ final class Item implements BaseModel * * @var value-of|null $unit */ - #[Api(enum: UnitOfMeasureCode::class, nullable: true, optional: true)] + #[Optional(enum: UnitOfMeasureCode::class, nullable: true)] public ?string $unit; /** * The item net price (BT-146). The price of an item, exclusive of VAT, after subtracting item price discount. Must be rounded to maximum 4 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $unit_price; public function __construct() diff --git a/src/Documents/DocumentResponse/PaymentDetail.php b/src/Documents/DocumentResponse/PaymentDetail.php index fb4ed520..550b43d3 100644 --- a/src/Documents/DocumentResponse/PaymentDetail.php +++ b/src/Documents/DocumentResponse/PaymentDetail.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentResponse; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -24,25 +24,25 @@ final class PaymentDetail implements BaseModel /** * Bank account number (for non-IBAN accounts). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $bank_account_number; /** * International Bank Account Number for payment transfers. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $iban; /** * Structured payment reference or communication (e.g., structured communication for Belgian bank transfers). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $payment_reference; /** * SWIFT/BIC code of the bank. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $swift; public function __construct() diff --git a/src/Documents/DocumentResponse/TaxDetail.php b/src/Documents/DocumentResponse/TaxDetail.php index 31a4daeb..254805a3 100644 --- a/src/Documents/DocumentResponse/TaxDetail.php +++ b/src/Documents/DocumentResponse/TaxDetail.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\DocumentResponse; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -19,13 +19,13 @@ final class TaxDetail implements BaseModel /** * The tax amount for this tax category. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $amount; /** * The tax rate as a percentage (e.g., '21.00', '6.00', '0.00'). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $rate; public function __construct() diff --git a/src/Documents/DocumentSendParams.php b/src/Documents/DocumentSendParams.php index 1ea94f63..e6b8ba5b 100644 --- a/src/Documents/DocumentSendParams.php +++ b/src/Documents/DocumentSendParams.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -28,19 +28,19 @@ final class DocumentSendParams implements BaseModel use SdkModel; use SdkParams; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $email; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $receiver_peppol_id; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $receiver_peppol_scheme; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $sender_peppol_id; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $sender_peppol_scheme; public function __construct() diff --git a/src/Documents/PaymentDetailCreate.php b/src/Documents/PaymentDetailCreate.php index e68aee7b..9f8184c9 100644 --- a/src/Documents/PaymentDetailCreate.php +++ b/src/Documents/PaymentDetailCreate.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -24,25 +24,25 @@ final class PaymentDetailCreate implements BaseModel /** * Bank account number (for non-IBAN accounts). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $bank_account_number; /** * International Bank Account Number for payment transfers. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $iban; /** * Structured payment reference or communication (e.g., structured communication for Belgian bank transfers). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $payment_reference; /** * SWIFT/BIC code of the bank. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $swift; public function __construct() diff --git a/src/Documents/Ubl/UblCreateFromUblParams.php b/src/Documents/Ubl/UblCreateFromUblParams.php index 3e9503e0..acf690f9 100644 --- a/src/Documents/Ubl/UblCreateFromUblParams.php +++ b/src/Documents/Ubl/UblCreateFromUblParams.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Documents\Ubl; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -22,7 +22,7 @@ final class UblCreateFromUblParams implements BaseModel use SdkModel; use SdkParams; - #[Api] + #[Required] public string $file; /** diff --git a/src/Documents/Ubl/UblGetResponse.php b/src/Documents/Ubl/UblGetResponse.php index a215da9a..19b2dcd3 100644 --- a/src/Documents/Ubl/UblGetResponse.php +++ b/src/Documents/Ubl/UblGetResponse.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Documents\Ubl; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -27,34 +28,34 @@ final class UblGetResponse implements BaseModel /** @use SdkModel */ use SdkModel; - #[Api] + #[Required] public string $id; - #[Api] + #[Required] public string $file_name; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $file_hash; - #[Api(optional: true)] + #[Optional] public ?int $file_size; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $receiver_peppol_id; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $receiver_peppol_scheme; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $sender_peppol_id; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $sender_peppol_scheme; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $signed_url; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $validated_at; /** diff --git a/src/DocumentsNumberPage.php b/src/DocumentsNumberPage.php index e26a9836..a9837233 100644 --- a/src/DocumentsNumberPage.php +++ b/src/DocumentsNumberPage.php @@ -2,7 +2,7 @@ namespace EInvoiceAPI; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkPage; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -35,16 +35,16 @@ final class DocumentsNumberPage implements BaseModel, BasePage use SdkPage; /** @var list|null $items */ - #[Api(list: Item::class, optional: true)] + #[Optional(list: Item::class)] public ?array $items; - #[Api(optional: true)] + #[Optional] public ?int $page; - #[Api(optional: true)] + #[Optional] public ?int $page_size; - #[Api(optional: true)] + #[Optional] public ?int $total; /** diff --git a/src/Inbox/InboxListCreditNotesParams.php b/src/Inbox/InboxListCreditNotesParams.php index 732b72da..81f89092 100644 --- a/src/Inbox/InboxListCreditNotesParams.php +++ b/src/Inbox/InboxListCreditNotesParams.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Inbox; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -27,13 +27,13 @@ final class InboxListCreditNotesParams implements BaseModel /** * Page number. */ - #[Api(optional: true)] + #[Optional] public ?int $page; /** * Number of items per page. */ - #[Api(optional: true)] + #[Optional] public ?int $page_size; public function __construct() diff --git a/src/Inbox/InboxListInvoicesParams.php b/src/Inbox/InboxListInvoicesParams.php index 17d0ff04..c412fd7e 100644 --- a/src/Inbox/InboxListInvoicesParams.php +++ b/src/Inbox/InboxListInvoicesParams.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Inbox; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -25,13 +25,13 @@ final class InboxListInvoicesParams implements BaseModel /** * Page number. */ - #[Api(optional: true)] + #[Optional] public ?int $page; /** * Number of items per page. */ - #[Api(optional: true)] + #[Optional] public ?int $page_size; public function __construct() diff --git a/src/Inbox/InboxListParams.php b/src/Inbox/InboxListParams.php index 21521b2f..32e63b8f 100644 --- a/src/Inbox/InboxListParams.php +++ b/src/Inbox/InboxListParams.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Inbox; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -35,37 +35,37 @@ final class InboxListParams implements BaseModel /** * Filter by issue date (from). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $date_from; /** * Filter by issue date (to). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $date_to; /** * Page number. */ - #[Api(optional: true)] + #[Optional] public ?int $page; /** * Number of items per page. */ - #[Api(optional: true)] + #[Optional] public ?int $page_size; /** * Search in invoice number, seller/buyer names. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $search; /** * Filter by sender ID. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $sender; /** @@ -73,7 +73,7 @@ final class InboxListParams implements BaseModel * * @var value-of|null $state */ - #[Api(enum: DocumentState::class, nullable: true, optional: true)] + #[Optional(enum: DocumentState::class, nullable: true)] public ?string $state; /** @@ -81,7 +81,7 @@ final class InboxListParams implements BaseModel * * @var value-of|null $type */ - #[Api(enum: DocumentType::class, nullable: true, optional: true)] + #[Optional(enum: DocumentType::class, nullable: true)] public ?string $type; public function __construct() diff --git a/src/Inbox/PaginatedDocumentResponse.php b/src/Inbox/PaginatedDocumentResponse.php index bde78caf..97ff6829 100644 --- a/src/Inbox/PaginatedDocumentResponse.php +++ b/src/Inbox/PaginatedDocumentResponse.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Inbox; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\Attachments\DocumentAttachment; @@ -35,19 +35,19 @@ final class PaginatedDocumentResponse implements BaseModel use SdkModel; /** @var list $items */ - #[Api(list: DocumentResponse::class)] + #[Required(list: DocumentResponse::class)] public array $items; - #[Api] + #[Required] public int $page; - #[Api] + #[Required] public int $page_size; - #[Api] + #[Required] public int $pages; - #[Api] + #[Required] public int $total; /** diff --git a/src/Lookup/Certificate.php b/src/Lookup/Certificate.php index e16ec0ae..86a3c7fe 100644 --- a/src/Lookup/Certificate.php +++ b/src/Lookup/Certificate.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Lookup; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -23,7 +24,7 @@ final class Certificate implements BaseModel /** * Status of the certificate validation: 'success', 'error', or 'pending'. */ - #[Api] + #[Required] public string $status; /** @@ -31,13 +32,13 @@ final class Certificate implements BaseModel * * @var array|null $details */ - #[Api(map: 'mixed', nullable: true, optional: true)] + #[Optional(map: 'mixed', nullable: true)] public ?array $details; /** * Error message if certificate validation failed. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $error; /** diff --git a/src/Lookup/LookupGetParticipantsResponse.php b/src/Lookup/LookupGetParticipantsResponse.php index 13017a84..768dd762 100644 --- a/src/Lookup/LookupGetParticipantsResponse.php +++ b/src/Lookup/LookupGetParticipantsResponse.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Lookup; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Lookup\LookupGetParticipantsResponse\Participant; @@ -30,25 +31,25 @@ final class LookupGetParticipantsResponse implements BaseModel /** * Query terms used for search. */ - #[Api] + #[Required] public string $query_terms; /** * Search date of the result. */ - #[Api] + #[Required] public string $search_date; /** * Total number of results. */ - #[Api] + #[Required] public int $total_count; /** * Number of results returned by the API. */ - #[Api] + #[Required] public int $used_count; /** @@ -56,7 +57,7 @@ final class LookupGetParticipantsResponse implements BaseModel * * @var list|null $participants */ - #[Api(list: Participant::class, optional: true)] + #[Optional(list: Participant::class)] public ?array $participants; /** diff --git a/src/Lookup/LookupGetParticipantsResponse/Participant.php b/src/Lookup/LookupGetParticipantsResponse/Participant.php index 3c80a6fa..67add1c2 100644 --- a/src/Lookup/LookupGetParticipantsResponse/Participant.php +++ b/src/Lookup/LookupGetParticipantsResponse/Participant.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Lookup\LookupGetParticipantsResponse; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Lookup\LookupGetParticipantsResponse\Participant\DocumentType; @@ -29,13 +30,13 @@ final class Participant implements BaseModel /** * Peppol ID of the participant. */ - #[Api] + #[Required] public string $peppol_id; /** * Peppol scheme of the participant. */ - #[Api] + #[Required] public string $peppol_scheme; /** @@ -43,7 +44,7 @@ final class Participant implements BaseModel * * @var list|null $document_types */ - #[Api(list: DocumentType::class, optional: true)] + #[Optional(list: DocumentType::class)] public ?array $document_types; /** @@ -51,7 +52,7 @@ final class Participant implements BaseModel * * @var list|null $entities */ - #[Api(list: Entity::class, optional: true)] + #[Optional(list: Entity::class)] public ?array $entities; /** diff --git a/src/Lookup/LookupGetParticipantsResponse/Participant/DocumentType.php b/src/Lookup/LookupGetParticipantsResponse/Participant/DocumentType.php index 4ad08bce..f3e98066 100644 --- a/src/Lookup/LookupGetParticipantsResponse/Participant/DocumentType.php +++ b/src/Lookup/LookupGetParticipantsResponse/Participant/DocumentType.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Lookup\LookupGetParticipantsResponse\Participant; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -21,13 +21,13 @@ final class DocumentType implements BaseModel /** * Document type scheme. */ - #[Api] + #[Required] public string $scheme; /** * Document type value. */ - #[Api] + #[Required] public string $value; /** diff --git a/src/Lookup/LookupGetParticipantsResponse/Participant/Entity.php b/src/Lookup/LookupGetParticipantsResponse/Participant/Entity.php index 5aa6d9c0..e1dfa9f5 100644 --- a/src/Lookup/LookupGetParticipantsResponse/Participant/Entity.php +++ b/src/Lookup/LookupGetParticipantsResponse/Participant/Entity.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Lookup\LookupGetParticipantsResponse\Participant; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Lookup\LookupGetParticipantsResponse\Participant\Entity\Identifier; @@ -30,19 +30,19 @@ final class Entity implements BaseModel /** * Additional information. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $additional_info; /** * Country code. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $country_code; /** * Geographic information. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $geo_info; /** @@ -50,25 +50,25 @@ final class Entity implements BaseModel * * @var list|null $identifiers */ - #[Api(list: Identifier::class, optional: true)] + #[Optional(list: Identifier::class)] public ?array $identifiers; /** * Business entity name. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $name; /** * Registration date. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $registration_date; /** * Website URL. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $website; public function __construct() diff --git a/src/Lookup/LookupGetParticipantsResponse/Participant/Entity/Identifier.php b/src/Lookup/LookupGetParticipantsResponse/Participant/Entity/Identifier.php index df42cf69..34f10a34 100644 --- a/src/Lookup/LookupGetParticipantsResponse/Participant/Entity/Identifier.php +++ b/src/Lookup/LookupGetParticipantsResponse/Participant/Entity/Identifier.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Lookup\LookupGetParticipantsResponse\Participant\Entity; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -21,13 +21,13 @@ final class Identifier implements BaseModel /** * Identifier scheme. */ - #[Api] + #[Required] public string $scheme; /** * Identifier value. */ - #[Api] + #[Required] public string $value; /** diff --git a/src/Lookup/LookupGetResponse.php b/src/Lookup/LookupGetResponse.php index 4ce7a8ee..48de37a2 100644 --- a/src/Lookup/LookupGetResponse.php +++ b/src/Lookup/LookupGetResponse.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Lookup; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Lookup\LookupGetResponse\BusinessCard; @@ -46,7 +46,7 @@ final class LookupGetResponse implements BaseModel /** * Business card information for the Peppol participant. */ - #[Api] + #[Required] public BusinessCard $businessCard; /** @@ -54,13 +54,13 @@ final class LookupGetResponse implements BaseModel * * @var list $certificates */ - #[Api(list: Certificate::class)] + #[Required(list: Certificate::class)] public array $certificates; /** * Information about the DNS lookup performed. */ - #[Api] + #[Required] public DNSInfo $dnsInfo; /** @@ -68,31 +68,31 @@ final class LookupGetResponse implements BaseModel * * @var list $errors */ - #[Api(list: 'string')] + #[Required(list: 'string')] public array $errors; /** * Total execution time of the lookup operation in milliseconds. */ - #[Api] + #[Required] public float $executionTimeMs; /** * Metadata about the query that was performed. */ - #[Api] + #[Required] public QueryMetadata $queryMetadata; /** * Service metadata information for the Peppol participant. */ - #[Api] + #[Required] public ServiceMetadata $serviceMetadata; /** * Overall status of the lookup: 'success' or 'error'. */ - #[Api] + #[Required] public string $status; /** diff --git a/src/Lookup/LookupGetResponse/BusinessCard.php b/src/Lookup/LookupGetResponse/BusinessCard.php index 274cbf72..5c4a2a37 100644 --- a/src/Lookup/LookupGetResponse/BusinessCard.php +++ b/src/Lookup/LookupGetResponse/BusinessCard.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Lookup\LookupGetResponse; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Lookup\LookupGetResponse\BusinessCard\Entity; @@ -29,25 +30,25 @@ final class BusinessCard implements BaseModel * * @var list $entities */ - #[Api(list: Entity::class)] + #[Required(list: Entity::class)] public array $entities; /** * Time taken to query the business card in milliseconds. */ - #[Api] + #[Required] public float $queryTimeMs; /** * Status of the business card lookup: 'success', 'error', or 'pending'. */ - #[Api] + #[Required] public string $status; /** * Error message if business card lookup failed. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $error; /** diff --git a/src/Lookup/LookupGetResponse/BusinessCard/Entity.php b/src/Lookup/LookupGetResponse/BusinessCard/Entity.php index d58289fc..8375929f 100644 --- a/src/Lookup/LookupGetResponse/BusinessCard/Entity.php +++ b/src/Lookup/LookupGetResponse/BusinessCard/Entity.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Lookup\LookupGetResponse\BusinessCard; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -28,25 +28,25 @@ final class Entity implements BaseModel * * @var list|null $additionalInformation */ - #[Api(list: 'string', nullable: true, optional: true)] + #[Optional(list: 'string', nullable: true)] public ?array $additionalInformation; /** * ISO 3166-1 alpha-2 country code of the business entity. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $countryCode; /** * Name of the business entity. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $name; /** * ISO 8601 date of when the entity was registered in Peppol. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $registrationDate; public function __construct() diff --git a/src/Lookup/LookupGetResponse/DNSInfo.php b/src/Lookup/LookupGetResponse/DNSInfo.php index 4707419d..28b10e31 100644 --- a/src/Lookup/LookupGetResponse/DNSInfo.php +++ b/src/Lookup/LookupGetResponse/DNSInfo.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Lookup\LookupGetResponse; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Lookup\LookupGetResponse\DNSInfo\DNSRecord; @@ -29,25 +30,25 @@ final class DNSInfo implements BaseModel * * @var list $dnsRecords */ - #[Api(list: DNSRecord::class)] + #[Required(list: DNSRecord::class)] public array $dnsRecords; /** * Hostname of the SML used for the query. */ - #[Api] + #[Required] public string $smlHostname; /** * Status of the DNS lookup: 'success', 'error', or 'pending'. */ - #[Api] + #[Required] public string $status; /** * Error message if the DNS lookup failed. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $error; /** diff --git a/src/Lookup/LookupGetResponse/DNSInfo/DNSRecord.php b/src/Lookup/LookupGetResponse/DNSInfo/DNSRecord.php index 478c7f5e..95c1e30c 100644 --- a/src/Lookup/LookupGetResponse/DNSInfo/DNSRecord.php +++ b/src/Lookup/LookupGetResponse/DNSInfo/DNSRecord.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Lookup\LookupGetResponse\DNSInfo; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -21,7 +21,7 @@ final class DNSRecord implements BaseModel /** * IP address found in the DNS record. */ - #[Api] + #[Required] public string $ip; /** diff --git a/src/Lookup/LookupGetResponse/QueryMetadata.php b/src/Lookup/LookupGetResponse/QueryMetadata.php index 47b6f10a..53f5ae7b 100644 --- a/src/Lookup/LookupGetResponse/QueryMetadata.php +++ b/src/Lookup/LookupGetResponse/QueryMetadata.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Lookup\LookupGetResponse; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -27,31 +27,31 @@ final class QueryMetadata implements BaseModel /** * Scheme of the identifier, typically 'iso6523-actorid-upis'. */ - #[Api] + #[Required] public string $identifierScheme; /** * The actual Peppol ID value being queried. */ - #[Api] + #[Required] public string $identifierValue; /** * Domain of the SML (Service Metadata Locator) used for the lookup. */ - #[Api] + #[Required] public string $smlDomain; /** * ISO 8601 timestamp of when the query was executed. */ - #[Api] + #[Required] public string $timestamp; /** * Version of the API used for the lookup. */ - #[Api] + #[Required] public string $version; /** diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata.php b/src/Lookup/LookupGetResponse/ServiceMetadata.php index 19c9085d..da8e72f0 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Lookup\LookupGetResponse; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Lookup\LookupGetResponse\ServiceMetadata\Endpoint; @@ -31,25 +32,25 @@ final class ServiceMetadata implements BaseModel * * @var list $endpoints */ - #[Api(list: Endpoint::class)] + #[Required(list: Endpoint::class)] public array $endpoints; /** * Time taken to query the service metadata in milliseconds. */ - #[Api] + #[Required] public float $queryTimeMs; /** * Status of the service metadata lookup: 'success', 'error', or 'pending'. */ - #[Api] + #[Required] public string $status; /** * Error message if service metadata lookup failed. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $error; /** diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint.php index c979126b..c7f4727c 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Lookup\LookupGetResponse\ServiceMetadata; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Lookup\LookupGetResponse\ServiceMetadata\Endpoint\DocumentType; @@ -32,25 +33,25 @@ final class Endpoint implements BaseModel * * @var list $documentTypes */ - #[Api(list: DocumentType::class)] + #[Required(list: DocumentType::class)] public array $documentTypes; /** * Status of the endpoint lookup: 'success', 'error', or 'pending'. */ - #[Api] + #[Required] public string $status; /** * URL of the endpoint. */ - #[Api] + #[Required] public string $url; /** * Error message if endpoint lookup failed. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $error; /** @@ -58,7 +59,7 @@ final class Endpoint implements BaseModel * * @var list|null $processes */ - #[Api(list: Process::class, nullable: true, optional: true)] + #[Optional(list: Process::class, nullable: true)] public ?array $processes; /** diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/DocumentType.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/DocumentType.php index 706d87f4..632ff373 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/DocumentType.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/DocumentType.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Lookup\LookupGetResponse\ServiceMetadata\Endpoint; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -21,13 +21,13 @@ final class DocumentType implements BaseModel /** * Scheme of the document type identifier. */ - #[Api] + #[Required] public string $scheme; /** * Value of the document type identifier. */ - #[Api] + #[Required] public string $value; /** diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process.php index 48331f06..44e3e7ae 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Lookup\LookupGetResponse\ServiceMetadata\Endpoint; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Lookup\Certificate; @@ -28,13 +28,13 @@ final class Process implements BaseModel * * @var list $endpoints */ - #[Api(list: Endpoint::class)] + #[Required(list: Endpoint::class)] public array $endpoints; /** * Identifier of the process. */ - #[Api] + #[Required] public ProcessID $processId; /** diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/Endpoint.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/Endpoint.php index 05132008..23acd2c9 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/Endpoint.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/Endpoint.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Lookup\LookupGetResponse\ServiceMetadata\Endpoint\Process; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Lookup\Certificate; @@ -31,49 +32,49 @@ final class Endpoint implements BaseModel /** * URL or address of the endpoint. */ - #[Api] + #[Required] public string $address; /** * Transport profile used by this endpoint. */ - #[Api] + #[Required] public string $transportProfile; /** * Certificate information for a Peppol endpoint. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?Certificate $certificate; /** * ISO 8601 date when the service was activated. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $serviceActivationDate; /** * Human-readable description of the service. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $serviceDescription; /** * ISO 8601 date when the service will expire. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $serviceExpirationDate; /** * URL for technical contact information. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $technicalContactUrl; /** * URL for technical documentation. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $technicalInformationUrl; /** diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/ProcessID.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/ProcessID.php index 66855b34..3b34b935 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/ProcessID.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/ProcessID.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Lookup\LookupGetResponse\ServiceMetadata\Endpoint\Process; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -21,13 +21,13 @@ final class ProcessID implements BaseModel /** * Scheme of the process identifier. */ - #[Api] + #[Required] public string $scheme; /** * Value of the process identifier. */ - #[Api] + #[Required] public string $value; /** diff --git a/src/Lookup/LookupRetrieveParams.php b/src/Lookup/LookupRetrieveParams.php index 59218fdb..cf3b399d 100644 --- a/src/Lookup/LookupRetrieveParams.php +++ b/src/Lookup/LookupRetrieveParams.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Lookup; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -25,7 +25,7 @@ final class LookupRetrieveParams implements BaseModel /** * Peppol ID in the format `:`. Example: `0208:1018265814` for a Belgian company. */ - #[Api] + #[Required] public string $peppol_id; /** diff --git a/src/Lookup/LookupRetrieveParticipantsParams.php b/src/Lookup/LookupRetrieveParticipantsParams.php index 5f72c9d2..1280fd09 100644 --- a/src/Lookup/LookupRetrieveParticipantsParams.php +++ b/src/Lookup/LookupRetrieveParticipantsParams.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Lookup; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -27,13 +28,13 @@ final class LookupRetrieveParticipantsParams implements BaseModel /** * Query to lookup. */ - #[Api] + #[Required] public string $query; /** * Country code of the company to lookup. If not provided, the search will be global. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $country_code; /** diff --git a/src/Me/MeGetResponse.php b/src/Me/MeGetResponse.php index 7a47bff8..91a92cdc 100644 --- a/src/Me/MeGetResponse.php +++ b/src/Me/MeGetResponse.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Me; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Me\MeGetResponse\Plan; @@ -38,10 +39,10 @@ final class MeGetResponse implements BaseModel /** * Credit balance of the tenant. */ - #[Api] + #[Required] public int $credit_balance; - #[Api] + #[Required] public string $name; /** @@ -49,64 +50,64 @@ final class MeGetResponse implements BaseModel * * @var value-of $plan */ - #[Api(enum: Plan::class)] + #[Required(enum: Plan::class)] public string $plan; /** * BCC recipient email to deliver documents. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $bcc_recipient_email; /** * Address of the company. Must be in the form of `Street Name Street Number`. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $company_address; /** * City of the company. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $company_city; /** * Country of the company. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $company_country; /** * Email of the company. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $company_email; /** * Name of the company. Must include the company type. For example: `BV`, `NV`, `CVBA`, `VOF`. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $company_name; /** * Company number. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $company_number; /** * Company tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $company_tax_id; /** * Zip code of the company. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $company_zip; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $description; /** @@ -114,7 +115,7 @@ final class MeGetResponse implements BaseModel * * @var list|null $ibans */ - #[Api(list: 'string', nullable: true, optional: true)] + #[Optional(list: 'string', nullable: true)] public ?array $ibans; /** @@ -122,19 +123,19 @@ final class MeGetResponse implements BaseModel * * @var list|null $peppol_ids */ - #[Api(list: 'string', nullable: true, optional: true)] + #[Optional(list: 'string', nullable: true)] public ?array $peppol_ids; /** * Whether the tenant is registered on our SMP. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?bool $smp_registration; /** * Date when the tenant was registered on SMP. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $smp_registration_date; /** diff --git a/src/Outbox/OutboxListDraftDocumentsParams.php b/src/Outbox/OutboxListDraftDocumentsParams.php index 54b1d38a..ece97329 100644 --- a/src/Outbox/OutboxListDraftDocumentsParams.php +++ b/src/Outbox/OutboxListDraftDocumentsParams.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Outbox; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -27,13 +27,13 @@ final class OutboxListDraftDocumentsParams implements BaseModel /** * Page number. */ - #[Api(optional: true)] + #[Optional] public ?int $page; /** * Number of items per page. */ - #[Api(optional: true)] + #[Optional] public ?int $page_size; public function __construct() diff --git a/src/Outbox/OutboxListReceivedDocumentsParams.php b/src/Outbox/OutboxListReceivedDocumentsParams.php index 9dfdf22b..e8282e99 100644 --- a/src/Outbox/OutboxListReceivedDocumentsParams.php +++ b/src/Outbox/OutboxListReceivedDocumentsParams.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Outbox; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -36,37 +36,37 @@ final class OutboxListReceivedDocumentsParams implements BaseModel /** * Filter by issue date (from). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $date_from; /** * Filter by issue date (to). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $date_to; /** * Page number. */ - #[Api(optional: true)] + #[Optional] public ?int $page; /** * Number of items per page. */ - #[Api(optional: true)] + #[Optional] public ?int $page_size; /** * Search in invoice number, seller/buyer names. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $search; /** * Filter by sender ID. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $sender; /** @@ -74,7 +74,7 @@ final class OutboxListReceivedDocumentsParams implements BaseModel * * @var value-of|null $state */ - #[Api(enum: DocumentState::class, nullable: true, optional: true)] + #[Optional(enum: DocumentState::class, nullable: true)] public ?string $state; /** @@ -82,7 +82,7 @@ final class OutboxListReceivedDocumentsParams implements BaseModel * * @var value-of|null $type */ - #[Api(enum: DocumentType::class, nullable: true, optional: true)] + #[Optional(enum: DocumentType::class, nullable: true)] public ?string $type; public function __construct() diff --git a/src/RequestOptions.php b/src/RequestOptions.php index c3f67e34..cc2173ec 100644 --- a/src/RequestOptions.php +++ b/src/RequestOptions.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI; -use EInvoiceAPI\Core\Attributes\Api as Property; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required as Property; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Core\Implementation\Omit; @@ -49,26 +50,26 @@ final class RequestOptions implements BaseModel public float $maxRetryDelay = 8.0; /** @var array|null>|null $extraHeaders */ - #[Property(optional: true)] + #[Optional] public ?array $extraHeaders; /** @var array|null $extraQueryParams */ - #[Property(optional: true)] + #[Optional] public ?array $extraQueryParams; - #[Property(optional: true)] + #[Optional] public mixed $extraBodyParams; - #[Property(optional: true)] + #[Optional] public ?ClientInterface $transporter; - #[Property(optional: true)] + #[Optional] public ?UriFactoryInterface $uriFactory; - #[Property(optional: true)] + #[Optional] public ?StreamFactoryInterface $streamFactory; - #[Property(optional: true)] + #[Optional] public ?RequestFactoryInterface $requestFactory; public function __construct() diff --git a/src/Validate/UblDocumentValidation.php b/src/Validate/UblDocumentValidation.php index 227e8155..6c6896b7 100644 --- a/src/Validate/UblDocumentValidation.php +++ b/src/Validate/UblDocumentValidation.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Validate; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Validate\UblDocumentValidation\Issue; @@ -24,20 +25,20 @@ final class UblDocumentValidation implements BaseModel /** @use SdkModel */ use SdkModel; - #[Api] + #[Required] public string $id; - #[Api] + #[Required] public ?string $file_name; - #[Api] + #[Required] public bool $is_valid; /** @var list $issues */ - #[Api(list: Issue::class)] + #[Required(list: Issue::class)] public array $issues; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $ubl_document; /** diff --git a/src/Validate/UblDocumentValidation/Issue.php b/src/Validate/UblDocumentValidation/Issue.php index 7e173426..d00364c3 100644 --- a/src/Validate/UblDocumentValidation/Issue.php +++ b/src/Validate/UblDocumentValidation/Issue.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Validate\UblDocumentValidation; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Validate\UblDocumentValidation\Issue\Type; @@ -25,26 +26,26 @@ final class Issue implements BaseModel /** @use SdkModel */ use SdkModel; - #[Api] + #[Required] public string $message; - #[Api] + #[Required] public string $schematron; /** @var value-of $type */ - #[Api(enum: Type::class)] + #[Required(enum: Type::class)] public string $type; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $flag; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $location; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $rule_id; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $test; /** diff --git a/src/Validate/ValidateValidateJsonParams.php b/src/Validate/ValidateValidateJsonParams.php index fae709a4..36f3d990 100644 --- a/src/Validate/ValidateValidateJsonParams.php +++ b/src/Validate/ValidateValidateJsonParams.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Validate; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -126,33 +126,33 @@ final class ValidateValidateJsonParams implements BaseModel use SdkParams; /** @var list|null $allowances */ - #[Api(list: Allowance::class, nullable: true, optional: true)] + #[Optional(list: Allowance::class, nullable: true)] public ?array $allowances; /** * The amount due for payment. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount_due; /** @var list|null $attachments */ - #[Api(list: DocumentAttachmentCreate::class, nullable: true, optional: true)] + #[Optional(list: DocumentAttachmentCreate::class, nullable: true)] public ?array $attachments; /** * The billing address (if different from customer address). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $billing_address; /** * The recipient name at the billing address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $billing_address_recipient; /** @var list|null $charges */ - #[Api(list: Charge::class, nullable: true, optional: true)] + #[Optional(list: Charge::class, nullable: true)] public ?array $charges; /** @@ -160,49 +160,49 @@ final class ValidateValidateJsonParams implements BaseModel * * @var value-of|null $currency */ - #[Api(enum: CurrencyCode::class, optional: true)] + #[Optional(enum: CurrencyCode::class)] public ?string $currency; /** * The address of the customer/buyer. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_address; /** * The recipient name at the customer address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_address_recipient; /** * Customer company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_company_id; /** * The email address of the customer. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_email; /** * The unique identifier for the customer in your system. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_id; /** * The company name of the customer/buyer. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_name; /** * Customer tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $customer_tax_id; /** @@ -210,7 +210,7 @@ final class ValidateValidateJsonParams implements BaseModel * * @var value-of|null $direction */ - #[Api(enum: DocumentDirection::class, optional: true)] + #[Optional(enum: DocumentDirection::class)] public ?string $direction; /** @@ -218,31 +218,31 @@ final class ValidateValidateJsonParams implements BaseModel * * @var value-of|null $document_type */ - #[Api(enum: DocumentType::class, optional: true)] + #[Optional(enum: DocumentType::class)] public ?string $document_type; /** * The date when payment is due. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $due_date; /** * The date when the invoice was issued. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $invoice_date; /** * The unique invoice identifier/number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $invoice_id; /** * The total amount of the invoice including tax (invoice_total = subtotal + total_tax + total_discount). Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $invoice_total; /** @@ -250,83 +250,83 @@ final class ValidateValidateJsonParams implements BaseModel * * @var list|null $items */ - #[Api(list: Item::class, optional: true)] + #[Optional(list: Item::class)] public ?array $items; /** * Additional notes or comments for the invoice. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $note; /** @var list|null $payment_details */ - #[Api(list: PaymentDetailCreate::class, nullable: true, optional: true)] + #[Optional(list: PaymentDetailCreate::class, nullable: true)] public ?array $payment_details; /** * The payment terms (e.g., 'Net 30', 'Due on receipt', '2/10 Net 30'). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $payment_term; /** * The previous unpaid balance from prior invoices, if any. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $previous_unpaid_balance; /** * The purchase order reference number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $purchase_order; /** * The address where payment should be sent or remitted to. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $remittance_address; /** * The recipient name at the remittance address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $remittance_address_recipient; /** * The address where services were performed or goods were delivered. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $service_address; /** * The recipient name at the service address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $service_address_recipient; /** * The end date of the service period or delivery period. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $service_end_date; /** * The start date of the service period or delivery period. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $service_start_date; /** * The shipping/delivery address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $shipping_address; /** * The recipient name at the shipping address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $shipping_address_recipient; /** @@ -334,13 +334,13 @@ final class ValidateValidateJsonParams implements BaseModel * * @var value-of|null $state */ - #[Api(enum: DocumentState::class, optional: true)] + #[Optional(enum: DocumentState::class)] public ?string $state; /** * The taxable base of the invoice. Should be the sum of all line items - allowances (for example commercial discounts) + charges with impact on VAT. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $subtotal; /** @@ -348,26 +348,25 @@ final class ValidateValidateJsonParams implements BaseModel * * @var value-of|null $tax_code */ - #[Api( - enum: ValidateValidateJsonParams\TaxCode::class, - optional: true, + #[Optional( + enum: ValidateValidateJsonParams\TaxCode::class )] public ?string $tax_code; /** @var list|null $tax_details */ - #[Api(list: TaxDetail::class, nullable: true, optional: true)] + #[Optional(list: TaxDetail::class, nullable: true)] public ?array $tax_details; /** * The net financial discount/charge of the invoice (non-VAT charges minus non-VAT allowances). Can be positive (net charge), negative (net discount), or zero. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $total_discount; /** * The total tax amount of the invoice. Must be positive and rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $total_tax; /** @@ -378,49 +377,49 @@ enum: ValidateValidateJsonParams\TaxCode::class, * * @var value-of|null $vatex */ - #[Api(enum: Vatex::class, nullable: true, optional: true)] + #[Optional(enum: Vatex::class, nullable: true)] public ?string $vatex; /** * Textual explanation for VAT exemption. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vatex_note; /** * The address of the vendor/seller. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_address; /** * The recipient name at the vendor address. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_address_recipient; /** * Vendor company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_company_id; /** * The email address of the vendor. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_email; /** * The name of the vendor/seller/supplier. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_name; /** * Vendor tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $vendor_tax_id; public function __construct() diff --git a/src/Validate/ValidateValidateJsonParams/Allowance.php b/src/Validate/ValidateValidateJsonParams/Allowance.php index 41e4e4c2..751bd782 100644 --- a/src/Validate/ValidateValidateJsonParams/Allowance.php +++ b/src/Validate/ValidateValidateJsonParams/Allowance.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Validate\ValidateValidateJsonParams; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Validate\ValidateValidateJsonParams\Allowance\ReasonCode; @@ -31,25 +31,25 @@ final class Allowance implements BaseModel /** * The allowance amount, without VAT. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** * The base amount that may be used, in conjunction with the allowance percentage, to calculate the allowance amount. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $base_amount; /** * The percentage that may be used, in conjunction with the allowance base amount, to calculate the allowance amount. To state 20%, use value 20. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $multiplier_factor; /** * The reason for the allowance. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $reason; /** @@ -57,7 +57,7 @@ final class Allowance implements BaseModel * * @var value-of|null $reason_code */ - #[Api(enum: ReasonCode::class, nullable: true, optional: true)] + #[Optional(enum: ReasonCode::class, nullable: true)] public ?string $reason_code; /** @@ -65,16 +65,15 @@ final class Allowance implements BaseModel * * @var value-of|null $tax_code */ - #[Api( + #[Optional( enum: TaxCode::class, - optional: true, )] public ?string $tax_code; /** * The VAT rate, represented as percentage that applies to the allowance. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax_rate; public function __construct() diff --git a/src/Validate/ValidateValidateJsonParams/Charge.php b/src/Validate/ValidateValidateJsonParams/Charge.php index 5960be04..75318a43 100644 --- a/src/Validate/ValidateValidateJsonParams/Charge.php +++ b/src/Validate/ValidateValidateJsonParams/Charge.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Validate\ValidateValidateJsonParams; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Validate\ValidateValidateJsonParams\Charge\ReasonCode; @@ -31,25 +31,25 @@ final class Charge implements BaseModel /** * The charge amount, without VAT. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** * The base amount that may be used, in conjunction with the charge percentage, to calculate the charge amount. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $base_amount; /** * The percentage that may be used, in conjunction with the charge base amount, to calculate the charge amount. To state 20%, use value 20. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $multiplier_factor; /** * The reason for the charge. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $reason; /** @@ -57,7 +57,7 @@ final class Charge implements BaseModel * * @var value-of|null $reason_code */ - #[Api(enum: ReasonCode::class, nullable: true, optional: true)] + #[Optional(enum: ReasonCode::class, nullable: true)] public ?string $reason_code; /** @@ -69,17 +69,16 @@ final class Charge implements BaseModel * * @var value-of|null $tax_code */ - #[Api( + #[Optional( enum: TaxCode::class, nullable: true, - optional: true, )] public ?string $tax_code; /** * The VAT rate, represented as percentage that applies to the charge. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax_rate; public function __construct() diff --git a/src/Validate/ValidateValidateJsonParams/Item.php b/src/Validate/ValidateValidateJsonParams/Item.php index bdf0028e..efc715d8 100644 --- a/src/Validate/ValidateValidateJsonParams/Item.php +++ b/src/Validate/ValidateValidateJsonParams/Item.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Validate\ValidateValidateJsonParams; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Documents\UnitOfMeasureCode; @@ -38,17 +38,16 @@ final class Item implements BaseModel * * @var list|null $allowances */ - #[Api( + #[Optional( list: Allowance::class, nullable: true, - optional: true, )] public ?array $allowances; /** * The invoice line net amount (BT-131), exclusive of VAT, inclusive of line level allowances and charges. Calculated as: ((unit_price / price_base_quantity) * quantity) - allowances + charges. Must be rounded to maximum 2 decimals. Can be negative for credit notes or corrections. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** @@ -56,45 +55,44 @@ final class Item implements BaseModel * * @var list|null $charges */ - #[Api( + #[Optional( list: Charge::class, nullable: true, - optional: true, )] public ?array $charges; /** @var null|null $date */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public null $date; /** * The description of the line item. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $description; /** * The product code of the line item. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $product_code; /** * The quantity of items (goods or services) that is the subject of the line item. Must be rounded to maximum 4 decimals. Can be negative for credit notes or corrections. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $quantity; /** * The total VAT amount for the line item. Must be rounded to maximum 2 decimals. Can be negative for credit notes or corrections. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax; /** * The VAT rate of the line item expressed as percentage with 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax_rate; /** @@ -102,13 +100,13 @@ final class Item implements BaseModel * * @var value-of|null $unit */ - #[Api(enum: UnitOfMeasureCode::class, nullable: true, optional: true)] + #[Optional(enum: UnitOfMeasureCode::class, nullable: true)] public ?string $unit; /** * The item net price (BT-146). The price of an item, exclusive of VAT, after subtracting item price discount. Must be rounded to maximum 4 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $unit_price; public function __construct() diff --git a/src/Validate/ValidateValidateJsonParams/Item/Allowance.php b/src/Validate/ValidateValidateJsonParams/Item/Allowance.php index 662da8a6..76dfe8c2 100644 --- a/src/Validate/ValidateValidateJsonParams/Item/Allowance.php +++ b/src/Validate/ValidateValidateJsonParams/Item/Allowance.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Validate\ValidateValidateJsonParams\Item; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Validate\ValidateValidateJsonParams\Item\Allowance\ReasonCode; @@ -31,25 +31,25 @@ final class Allowance implements BaseModel /** * The allowance amount, without VAT. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** * The base amount that may be used, in conjunction with the allowance percentage, to calculate the allowance amount. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $base_amount; /** * The percentage that may be used, in conjunction with the allowance base amount, to calculate the allowance amount. To state 20%, use value 20. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $multiplier_factor; /** * The reason for the allowance. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $reason; /** @@ -57,7 +57,7 @@ final class Allowance implements BaseModel * * @var value-of|null $reason_code */ - #[Api(enum: ReasonCode::class, nullable: true, optional: true)] + #[Optional(enum: ReasonCode::class, nullable: true)] public ?string $reason_code; /** @@ -65,13 +65,13 @@ final class Allowance implements BaseModel * * @var value-of|null $tax_code */ - #[Api(enum: TaxCode::class, optional: true)] + #[Optional(enum: TaxCode::class)] public ?string $tax_code; /** * The VAT rate, represented as percentage that applies to the allowance. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax_rate; public function __construct() diff --git a/src/Validate/ValidateValidateJsonParams/Item/Charge.php b/src/Validate/ValidateValidateJsonParams/Item/Charge.php index c2fa66e9..34e1f997 100644 --- a/src/Validate/ValidateValidateJsonParams/Item/Charge.php +++ b/src/Validate/ValidateValidateJsonParams/Item/Charge.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Validate\ValidateValidateJsonParams\Item; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Validate\ValidateValidateJsonParams\Item\Charge\ReasonCode; @@ -31,25 +31,25 @@ final class Charge implements BaseModel /** * The charge amount, without VAT. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** * The base amount that may be used, in conjunction with the charge percentage, to calculate the charge amount. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $base_amount; /** * The percentage that may be used, in conjunction with the charge base amount, to calculate the charge amount. To state 20%, use value 20. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $multiplier_factor; /** * The reason for the charge. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $reason; /** @@ -57,7 +57,7 @@ final class Charge implements BaseModel * * @var value-of|null $reason_code */ - #[Api(enum: ReasonCode::class, nullable: true, optional: true)] + #[Optional(enum: ReasonCode::class, nullable: true)] public ?string $reason_code; /** @@ -69,13 +69,13 @@ final class Charge implements BaseModel * * @var value-of|null $tax_code */ - #[Api(enum: TaxCode::class, nullable: true, optional: true)] + #[Optional(enum: TaxCode::class, nullable: true)] public ?string $tax_code; /** * The VAT rate, represented as percentage that applies to the charge. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $tax_rate; public function __construct() diff --git a/src/Validate/ValidateValidateJsonParams/TaxDetail.php b/src/Validate/ValidateValidateJsonParams/TaxDetail.php index 6d25840b..89b73471 100644 --- a/src/Validate/ValidateValidateJsonParams/TaxDetail.php +++ b/src/Validate/ValidateValidateJsonParams/TaxDetail.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Validate\ValidateValidateJsonParams; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -21,13 +21,13 @@ final class TaxDetail implements BaseModel /** * The tax amount for this tax category. Must be rounded to maximum 2 decimals. */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public float|string|null $amount; /** * The tax rate as a percentage (e.g., '21.00', '6.00', '0.00'). */ - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $rate; public function __construct() diff --git a/src/Validate/ValidateValidatePeppolIDParams.php b/src/Validate/ValidateValidatePeppolIDParams.php index 3389fed5..5825b895 100644 --- a/src/Validate/ValidateValidatePeppolIDParams.php +++ b/src/Validate/ValidateValidatePeppolIDParams.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Validate; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -25,7 +25,7 @@ final class ValidateValidatePeppolIDParams implements BaseModel /** * Peppol ID in the format `:`. Example: `0208:1018265814` for a Belgian company. */ - #[Api] + #[Required] public string $peppol_id; /** diff --git a/src/Validate/ValidateValidatePeppolIDResponse.php b/src/Validate/ValidateValidatePeppolIDResponse.php index 7297366b..bf918cd7 100644 --- a/src/Validate/ValidateValidatePeppolIDResponse.php +++ b/src/Validate/ValidateValidatePeppolIDResponse.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Validate; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use EInvoiceAPI\Validate\ValidateValidatePeppolIDResponse\BusinessCard; @@ -31,29 +32,29 @@ final class ValidateValidatePeppolIDResponse implements BaseModel /** * Business card information for the Peppol ID. */ - #[Api] + #[Required] public ?BusinessCard $business_card; /** * Whether a business card is set at the SMP. */ - #[Api] + #[Required] public bool $business_card_valid; /** * Whether the DNS resolves to a valid SMP. */ - #[Api] + #[Required] public bool $dns_valid; /** * Whether the Peppol ID is valid and registered in the Peppol network. */ - #[Api] + #[Required] public bool $is_valid; /** @var list|null $supported_document_types */ - #[Api(list: 'string', optional: true)] + #[Optional(list: 'string')] public ?array $supported_document_types; /** diff --git a/src/Validate/ValidateValidatePeppolIDResponse/BusinessCard.php b/src/Validate/ValidateValidatePeppolIDResponse/BusinessCard.php index 131684ac..fc369eeb 100644 --- a/src/Validate/ValidateValidatePeppolIDResponse/BusinessCard.php +++ b/src/Validate/ValidateValidatePeppolIDResponse/BusinessCard.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Validate\ValidateValidatePeppolIDResponse; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -22,13 +22,13 @@ final class BusinessCard implements BaseModel /** @use SdkModel */ use SdkModel; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $country_code; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $name; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?\DateTimeInterface $registration_date; public function __construct() diff --git a/src/Validate/ValidateValidateUblParams.php b/src/Validate/ValidateValidateUblParams.php index 27181cee..42149bfb 100644 --- a/src/Validate/ValidateValidateUblParams.php +++ b/src/Validate/ValidateValidateUblParams.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Validate; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -22,7 +22,7 @@ final class ValidateValidateUblParams implements BaseModel use SdkModel; use SdkParams; - #[Api] + #[Required] public string $file; /** diff --git a/src/Webhooks/WebhookCreateParams.php b/src/Webhooks/WebhookCreateParams.php index 710e0963..2082c3a2 100644 --- a/src/Webhooks/WebhookCreateParams.php +++ b/src/Webhooks/WebhookCreateParams.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Webhooks; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -25,13 +26,13 @@ final class WebhookCreateParams implements BaseModel use SdkParams; /** @var list $events */ - #[Api(list: 'string')] + #[Required(list: 'string')] public array $events; - #[Api] + #[Required] public string $url; - #[Api(optional: true)] + #[Optional] public ?bool $enabled; /** diff --git a/src/Webhooks/WebhookDeleteResponse.php b/src/Webhooks/WebhookDeleteResponse.php index db9cbfbd..88869136 100644 --- a/src/Webhooks/WebhookDeleteResponse.php +++ b/src/Webhooks/WebhookDeleteResponse.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Webhooks; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -18,7 +18,7 @@ final class WebhookDeleteResponse implements BaseModel /** @use SdkModel */ use SdkModel; - #[Api] + #[Required] public bool $is_deleted; /** diff --git a/src/Webhooks/WebhookResponse.php b/src/Webhooks/WebhookResponse.php index 2b3087bc..73b3f632 100644 --- a/src/Webhooks/WebhookResponse.php +++ b/src/Webhooks/WebhookResponse.php @@ -4,7 +4,8 @@ namespace EInvoiceAPI\Webhooks; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -24,20 +25,20 @@ final class WebhookResponse implements BaseModel /** @use SdkModel */ use SdkModel; - #[Api] + #[Required] public string $id; /** @var list $events */ - #[Api(list: 'string')] + #[Required(list: 'string')] public array $events; - #[Api] + #[Required] public string $secret; - #[Api] + #[Required] public string $url; - #[Api(optional: true)] + #[Optional] public ?bool $enabled; /** diff --git a/src/Webhooks/WebhookUpdateParams.php b/src/Webhooks/WebhookUpdateParams.php index 73dab7e2..426a9157 100644 --- a/src/Webhooks/WebhookUpdateParams.php +++ b/src/Webhooks/WebhookUpdateParams.php @@ -4,7 +4,7 @@ namespace EInvoiceAPI\Webhooks; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Concerns\SdkParams; use EInvoiceAPI\Core\Contracts\BaseModel; @@ -24,14 +24,14 @@ final class WebhookUpdateParams implements BaseModel use SdkModel; use SdkParams; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?bool $enabled; /** @var list|null $events */ - #[Api(list: 'string', nullable: true, optional: true)] + #[Optional(list: 'string', nullable: true)] public ?array $events; - #[Api(nullable: true, optional: true)] + #[Optional(nullable: true)] public ?string $url; public function __construct() diff --git a/tests/Core/TestModel.php b/tests/Core/TestModel.php index 4d934225..2308d030 100644 --- a/tests/Core/TestModel.php +++ b/tests/Core/TestModel.php @@ -2,7 +2,8 @@ namespace Tests\Core; -use EInvoiceAPI\Core\Attributes\Api; +use EInvoiceAPI\Core\Attributes\Optional; +use EInvoiceAPI\Core\Attributes\Required; use EInvoiceAPI\Core\Concerns\SdkModel; use EInvoiceAPI\Core\Contracts\BaseModel; use PHPUnit\Framework\Attributes\CoversNothing; @@ -14,17 +15,17 @@ class TestModel implements BaseModel /** @use SdkModel> */ use SdkModel; - #[Api] + #[Required] public string $name; - #[Api('age_years')] + #[Required('age_years')] public int $ageYears; /** @var list|null */ - #[Api(optional: true)] + #[Optional] public ?array $friends; - #[Api] + #[Required] public ?string $owner; /** From 9cf11779ff1e150b328100531e3e52d3f5f4d2ba Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 03:19:19 +0000 Subject: [PATCH 4/9] chore: ensure constant values are marked as optional in array types --- src/Services/DocumentsService.php | 12 +++++++----- src/Services/ValidateService.php | 12 +++++++----- tests/Services/Documents/AttachmentsTest.php | 4 ++-- tests/Services/Documents/UblTest.php | 8 ++------ tests/Services/DocumentsTest.php | 6 ++---- tests/Services/ValidateTest.php | 8 ++------ 6 files changed, 22 insertions(+), 28 deletions(-) diff --git a/src/Services/DocumentsService.php b/src/Services/DocumentsService.php index 819e546e..d9c2a3b3 100644 --- a/src/Services/DocumentsService.php +++ b/src/Services/DocumentsService.php @@ -11,6 +11,8 @@ use EInvoiceAPI\Documents\DocumentAttachmentCreate; use EInvoiceAPI\Documents\DocumentCreateFromPdfParams; use EInvoiceAPI\Documents\DocumentCreateParams; +use EInvoiceAPI\Documents\DocumentCreateParams\Allowance\ReasonCode; +use EInvoiceAPI\Documents\DocumentCreateParams\Allowance\TaxCode; use EInvoiceAPI\Documents\DocumentCreateParams\Vatex; use EInvoiceAPI\Documents\DocumentDeleteResponse; use EInvoiceAPI\Documents\DocumentDirection; @@ -59,8 +61,8 @@ public function __construct(private Client $client) * base_amount?: float|string|null, * multiplier_factor?: float|string|null, * reason?: string|null, - * reason_code?: '41'|'42'|'60'|'62'|'63'|'64'|'65'|'66'|'67'|'68'|'70'|'71'|'88'|'95'|'100'|'102'|'103'|'104'|'105'|null, - * tax_code?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B', + * reason_code?: '41'|'42'|'60'|'62'|'63'|'64'|'65'|'66'|'67'|'68'|'70'|'71'|'88'|'95'|'100'|'102'|'103'|'104'|'105'|ReasonCode|null, + * tax_code?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|TaxCode, * tax_rate?: float|string|null, * }>|null, * amount_due?: float|string|null, @@ -77,8 +79,8 @@ public function __construct(private Client $client) * base_amount?: float|string|null, * multiplier_factor?: float|string|null, * reason?: string|null, - * reason_code?: 'AA'|'AAA'|'AAC'|'AAD'|'AAE'|'AAF'|'AAH'|'AAI'|'AAS'|'AAT'|'AAV'|'AAY'|'AAZ'|'ABA'|'ABB'|'ABC'|'ABD'|'ABF'|'ABK'|'ABL'|'ABN'|'ABR'|'ABS'|'ABT'|'ABU'|'ACF'|'ACG'|'ACH'|'ACI'|'ACJ'|'ACK'|'ACL'|'ACM'|'ACS'|'ADC'|'ADE'|'ADJ'|'ADK'|'ADL'|'ADM'|'ADN'|'ADO'|'ADP'|'ADQ'|'ADR'|'ADT'|'ADW'|'ADY'|'ADZ'|'AEA'|'AEB'|'AEC'|'AED'|'AEF'|'AEH'|'AEI'|'AEJ'|'AEK'|'AEL'|'AEM'|'AEN'|'AEO'|'AEP'|'AES'|'AET'|'AEU'|'AEV'|'AEW'|'AEX'|'AEY'|'AEZ'|'AJ'|'AU'|'CA'|'CAB'|'CAD'|'CAE'|'CAF'|'CAI'|'CAJ'|'CAK'|'CAL'|'CAM'|'CAN'|'CAO'|'CAP'|'CAQ'|'CAR'|'CAS'|'CAT'|'CAU'|'CAV'|'CAW'|'CAX'|'CAY'|'CAZ'|'CD'|'CG'|'CS'|'CT'|'DAB'|'DAC'|'DAD'|'DAF'|'DAG'|'DAH'|'DAI'|'DAJ'|'DAK'|'DAL'|'DAM'|'DAN'|'DAO'|'DAP'|'DAQ'|'DL'|'EG'|'EP'|'ER'|'FAA'|'FAB'|'FAC'|'FC'|'FH'|'FI'|'GAA'|'HAA'|'HD'|'HH'|'IAA'|'IAB'|'ID'|'IF'|'IR'|'IS'|'KO'|'L1'|'LA'|'LAA'|'LAB'|'LF'|'MAE'|'MI'|'ML'|'NAA'|'OA'|'PA'|'PAA'|'PC'|'PL'|'PRV'|'RAB'|'RAC'|'RAD'|'RAF'|'RE'|'RF'|'RH'|'RV'|'SA'|'SAA'|'SAD'|'SAE'|'SAI'|'SG'|'SH'|'SM'|'SU'|'TAB'|'TAC'|'TT'|'TV'|'V1'|'V2'|'WH'|'XAA'|'YY'|'ZZZ'|null, - * tax_code?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|null, + * reason_code?: 'AA'|'AAA'|'AAC'|'AAD'|'AAE'|'AAF'|'AAH'|'AAI'|'AAS'|'AAT'|'AAV'|'AAY'|'AAZ'|'ABA'|'ABB'|'ABC'|'ABD'|'ABF'|'ABK'|'ABL'|'ABN'|'ABR'|'ABS'|'ABT'|'ABU'|'ACF'|'ACG'|'ACH'|'ACI'|'ACJ'|'ACK'|'ACL'|'ACM'|'ACS'|'ADC'|'ADE'|'ADJ'|'ADK'|'ADL'|'ADM'|'ADN'|'ADO'|'ADP'|'ADQ'|'ADR'|'ADT'|'ADW'|'ADY'|'ADZ'|'AEA'|'AEB'|'AEC'|'AED'|'AEF'|'AEH'|'AEI'|'AEJ'|'AEK'|'AEL'|'AEM'|'AEN'|'AEO'|'AEP'|'AES'|'AET'|'AEU'|'AEV'|'AEW'|'AEX'|'AEY'|'AEZ'|'AJ'|'AU'|'CA'|'CAB'|'CAD'|'CAE'|'CAF'|'CAI'|'CAJ'|'CAK'|'CAL'|'CAM'|'CAN'|'CAO'|'CAP'|'CAQ'|'CAR'|'CAS'|'CAT'|'CAU'|'CAV'|'CAW'|'CAX'|'CAY'|'CAZ'|'CD'|'CG'|'CS'|'CT'|'DAB'|'DAC'|'DAD'|'DAF'|'DAG'|'DAH'|'DAI'|'DAJ'|'DAK'|'DAL'|'DAM'|'DAN'|'DAO'|'DAP'|'DAQ'|'DL'|'EG'|'EP'|'ER'|'FAA'|'FAB'|'FAC'|'FC'|'FH'|'FI'|'GAA'|'HAA'|'HD'|'HH'|'IAA'|'IAB'|'ID'|'IF'|'IR'|'IS'|'KO'|'L1'|'LA'|'LAA'|'LAB'|'LF'|'MAE'|'MI'|'ML'|'NAA'|'OA'|'PA'|'PAA'|'PC'|'PL'|'PRV'|'RAB'|'RAC'|'RAD'|'RAF'|'RE'|'RF'|'RH'|'RV'|'SA'|'SAA'|'SAD'|'SAE'|'SAI'|'SG'|'SH'|'SM'|'SU'|'TAB'|'TAC'|'TT'|'TV'|'V1'|'V2'|'WH'|'XAA'|'YY'|'ZZZ'|DocumentCreateParams\Charge\ReasonCode|null, + * tax_code?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|DocumentCreateParams\Charge\TaxCode|null, * tax_rate?: float|string|null, * }>|null, * currency?: value-of, @@ -128,7 +130,7 @@ public function __construct(private Client $client) * shipping_address_recipient?: string|null, * state?: 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState, * subtotal?: float|string|null, - * tax_code?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B', + * tax_code?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|DocumentCreateParams\TaxCode, * tax_details?: list|null, diff --git a/src/Services/ValidateService.php b/src/Services/ValidateService.php index 49b925b9..aae7bf99 100644 --- a/src/Services/ValidateService.php +++ b/src/Services/ValidateService.php @@ -18,6 +18,8 @@ use EInvoiceAPI\ServiceContracts\ValidateContract; use EInvoiceAPI\Validate\UblDocumentValidation; use EInvoiceAPI\Validate\ValidateValidateJsonParams; +use EInvoiceAPI\Validate\ValidateValidateJsonParams\Allowance\ReasonCode; +use EInvoiceAPI\Validate\ValidateValidateJsonParams\Allowance\TaxCode; use EInvoiceAPI\Validate\ValidateValidateJsonParams\Vatex; use EInvoiceAPI\Validate\ValidateValidatePeppolIDParams; use EInvoiceAPI\Validate\ValidateValidatePeppolIDResponse; @@ -41,8 +43,8 @@ public function __construct(private Client $client) {} * base_amount?: float|string|null, * multiplier_factor?: float|string|null, * reason?: string|null, - * reason_code?: '41'|'42'|'60'|'62'|'63'|'64'|'65'|'66'|'67'|'68'|'70'|'71'|'88'|'95'|'100'|'102'|'103'|'104'|'105'|null, - * tax_code?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B', + * reason_code?: '41'|'42'|'60'|'62'|'63'|'64'|'65'|'66'|'67'|'68'|'70'|'71'|'88'|'95'|'100'|'102'|'103'|'104'|'105'|ReasonCode|null, + * tax_code?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|TaxCode, * tax_rate?: float|string|null, * }>|null, * amount_due?: float|string|null, @@ -59,8 +61,8 @@ public function __construct(private Client $client) {} * base_amount?: float|string|null, * multiplier_factor?: float|string|null, * reason?: string|null, - * reason_code?: 'AA'|'AAA'|'AAC'|'AAD'|'AAE'|'AAF'|'AAH'|'AAI'|'AAS'|'AAT'|'AAV'|'AAY'|'AAZ'|'ABA'|'ABB'|'ABC'|'ABD'|'ABF'|'ABK'|'ABL'|'ABN'|'ABR'|'ABS'|'ABT'|'ABU'|'ACF'|'ACG'|'ACH'|'ACI'|'ACJ'|'ACK'|'ACL'|'ACM'|'ACS'|'ADC'|'ADE'|'ADJ'|'ADK'|'ADL'|'ADM'|'ADN'|'ADO'|'ADP'|'ADQ'|'ADR'|'ADT'|'ADW'|'ADY'|'ADZ'|'AEA'|'AEB'|'AEC'|'AED'|'AEF'|'AEH'|'AEI'|'AEJ'|'AEK'|'AEL'|'AEM'|'AEN'|'AEO'|'AEP'|'AES'|'AET'|'AEU'|'AEV'|'AEW'|'AEX'|'AEY'|'AEZ'|'AJ'|'AU'|'CA'|'CAB'|'CAD'|'CAE'|'CAF'|'CAI'|'CAJ'|'CAK'|'CAL'|'CAM'|'CAN'|'CAO'|'CAP'|'CAQ'|'CAR'|'CAS'|'CAT'|'CAU'|'CAV'|'CAW'|'CAX'|'CAY'|'CAZ'|'CD'|'CG'|'CS'|'CT'|'DAB'|'DAC'|'DAD'|'DAF'|'DAG'|'DAH'|'DAI'|'DAJ'|'DAK'|'DAL'|'DAM'|'DAN'|'DAO'|'DAP'|'DAQ'|'DL'|'EG'|'EP'|'ER'|'FAA'|'FAB'|'FAC'|'FC'|'FH'|'FI'|'GAA'|'HAA'|'HD'|'HH'|'IAA'|'IAB'|'ID'|'IF'|'IR'|'IS'|'KO'|'L1'|'LA'|'LAA'|'LAB'|'LF'|'MAE'|'MI'|'ML'|'NAA'|'OA'|'PA'|'PAA'|'PC'|'PL'|'PRV'|'RAB'|'RAC'|'RAD'|'RAF'|'RE'|'RF'|'RH'|'RV'|'SA'|'SAA'|'SAD'|'SAE'|'SAI'|'SG'|'SH'|'SM'|'SU'|'TAB'|'TAC'|'TT'|'TV'|'V1'|'V2'|'WH'|'XAA'|'YY'|'ZZZ'|null, - * tax_code?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|null, + * reason_code?: 'AA'|'AAA'|'AAC'|'AAD'|'AAE'|'AAF'|'AAH'|'AAI'|'AAS'|'AAT'|'AAV'|'AAY'|'AAZ'|'ABA'|'ABB'|'ABC'|'ABD'|'ABF'|'ABK'|'ABL'|'ABN'|'ABR'|'ABS'|'ABT'|'ABU'|'ACF'|'ACG'|'ACH'|'ACI'|'ACJ'|'ACK'|'ACL'|'ACM'|'ACS'|'ADC'|'ADE'|'ADJ'|'ADK'|'ADL'|'ADM'|'ADN'|'ADO'|'ADP'|'ADQ'|'ADR'|'ADT'|'ADW'|'ADY'|'ADZ'|'AEA'|'AEB'|'AEC'|'AED'|'AEF'|'AEH'|'AEI'|'AEJ'|'AEK'|'AEL'|'AEM'|'AEN'|'AEO'|'AEP'|'AES'|'AET'|'AEU'|'AEV'|'AEW'|'AEX'|'AEY'|'AEZ'|'AJ'|'AU'|'CA'|'CAB'|'CAD'|'CAE'|'CAF'|'CAI'|'CAJ'|'CAK'|'CAL'|'CAM'|'CAN'|'CAO'|'CAP'|'CAQ'|'CAR'|'CAS'|'CAT'|'CAU'|'CAV'|'CAW'|'CAX'|'CAY'|'CAZ'|'CD'|'CG'|'CS'|'CT'|'DAB'|'DAC'|'DAD'|'DAF'|'DAG'|'DAH'|'DAI'|'DAJ'|'DAK'|'DAL'|'DAM'|'DAN'|'DAO'|'DAP'|'DAQ'|'DL'|'EG'|'EP'|'ER'|'FAA'|'FAB'|'FAC'|'FC'|'FH'|'FI'|'GAA'|'HAA'|'HD'|'HH'|'IAA'|'IAB'|'ID'|'IF'|'IR'|'IS'|'KO'|'L1'|'LA'|'LAA'|'LAB'|'LF'|'MAE'|'MI'|'ML'|'NAA'|'OA'|'PA'|'PAA'|'PC'|'PL'|'PRV'|'RAB'|'RAC'|'RAD'|'RAF'|'RE'|'RF'|'RH'|'RV'|'SA'|'SAA'|'SAD'|'SAE'|'SAI'|'SG'|'SH'|'SM'|'SU'|'TAB'|'TAC'|'TT'|'TV'|'V1'|'V2'|'WH'|'XAA'|'YY'|'ZZZ'|ValidateValidateJsonParams\Charge\ReasonCode|null, + * tax_code?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|ValidateValidateJsonParams\Charge\TaxCode|null, * tax_rate?: float|string|null, * }>|null, * currency?: value-of, @@ -110,7 +112,7 @@ public function __construct(private Client $client) {} * shipping_address_recipient?: string|null, * state?: 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState, * subtotal?: float|string|null, - * tax_code?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B', + * tax_code?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|ValidateValidateJsonParams\TaxCode, * tax_details?: list|null, diff --git a/tests/Services/Documents/AttachmentsTest.php b/tests/Services/Documents/AttachmentsTest.php index 2dcb3a72..da9ff81d 100644 --- a/tests/Services/Documents/AttachmentsTest.php +++ b/tests/Services/Documents/AttachmentsTest.php @@ -114,7 +114,7 @@ public function testAdd(): void $result = $this->client->documents->attachments->add( 'document_id', - ['file' => file_get_contents(__FILE__) ?: ''] + ['file' => 'file'] ); // @phpstan-ignore-next-line method.alreadyNarrowedType @@ -130,7 +130,7 @@ public function testAddWithOptionalParams(): void $result = $this->client->documents->attachments->add( 'document_id', - ['file' => file_get_contents(__FILE__) ?: ''] + ['file' => 'file'] ); // @phpstan-ignore-next-line method.alreadyNarrowedType diff --git a/tests/Services/Documents/UblTest.php b/tests/Services/Documents/UblTest.php index 4d259e60..1966cc8a 100644 --- a/tests/Services/Documents/UblTest.php +++ b/tests/Services/Documents/UblTest.php @@ -35,9 +35,7 @@ public function testCreateFromUbl(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->documents->ubl->createFromUbl([ - 'file' => file_get_contents(__FILE__) ?: '', - ]); + $result = $this->client->documents->ubl->createFromUbl(['file' => 'file']); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(DocumentResponse::class, $result); @@ -50,9 +48,7 @@ public function testCreateFromUblWithOptionalParams(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->documents->ubl->createFromUbl([ - 'file' => file_get_contents(__FILE__) ?: '', - ]); + $result = $this->client->documents->ubl->createFromUbl(['file' => 'file']); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(DocumentResponse::class, $result); diff --git a/tests/Services/DocumentsTest.php b/tests/Services/DocumentsTest.php index 938d6c25..2cfb9c92 100644 --- a/tests/Services/DocumentsTest.php +++ b/tests/Services/DocumentsTest.php @@ -76,9 +76,7 @@ public function testCreateFromPdf(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->documents->createFromPdf([ - 'file' => file_get_contents(__FILE__) ?: '', - ]); + $result = $this->client->documents->createFromPdf(['file' => 'file']); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(DocumentNewFromPdfResponse::class, $result); @@ -92,7 +90,7 @@ public function testCreateFromPdfWithOptionalParams(): void } $result = $this->client->documents->createFromPdf([ - 'file' => file_get_contents(__FILE__) ?: '', + 'file' => 'file', 'customer_tax_id' => 'customer_tax_id', 'vendor_tax_id' => 'vendor_tax_id', ]); diff --git a/tests/Services/ValidateTest.php b/tests/Services/ValidateTest.php index c4a42d5f..8e310273 100644 --- a/tests/Services/ValidateTest.php +++ b/tests/Services/ValidateTest.php @@ -78,9 +78,7 @@ public function testValidateUbl(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->validate->validateUbl([ - 'file' => file_get_contents(__FILE__) ?: '', - ]); + $result = $this->client->validate->validateUbl(['file' => 'file']); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(UblDocumentValidation::class, $result); @@ -93,9 +91,7 @@ public function testValidateUblWithOptionalParams(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->validate->validateUbl([ - 'file' => file_get_contents(__FILE__) ?: '', - ]); + $result = $this->client->validate->validateUbl(['file' => 'file']); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(UblDocumentValidation::class, $result); From 9a81036ee96d23c0ab1cc22f68fde1555cb51f56 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 03:21:14 +0000 Subject: [PATCH 5/9] feat!: use camel casing for all class properties --- src/Core/Conversion.php | 37 +- src/Core/Conversion/Concerns/ArrayOf.php | 19 +- src/Core/Conversion/DumpState.php | 5 + src/Core/Conversion/EnumOf.php | 21 +- src/Core/Conversion/ModelOf.php | 30 +- src/Core/Conversion/UnionOf.php | 35 +- src/Documents/Allowance.php | 68 +- .../Attachments/AttachmentDeleteParams.php | 12 +- .../Attachments/AttachmentDeleteResponse.php | 14 +- .../Attachments/AttachmentRetrieveParams.php | 12 +- .../Attachments/DocumentAttachment.php | 50 +- src/Documents/Charge.php | 68 +- src/Documents/DocumentAttachmentCreate.php | 50 +- src/Documents/DocumentCreate.php | 552 ++++++++-------- src/Documents/DocumentCreate/Allowance.php | 69 +- src/Documents/DocumentCreate/Charge.php | 67 +- src/Documents/DocumentCreate/Item.php | 76 +-- .../DocumentCreate/Item/Allowance.php | 68 +- src/Documents/DocumentCreate/Item/Charge.php | 68 +- src/Documents/DocumentCreateFromPdfParams.php | 18 +- src/Documents/DocumentCreateParams.php | 593 +++++++++--------- .../DocumentCreateParams/Allowance.php | 69 +- src/Documents/DocumentCreateParams/Charge.php | 67 +- src/Documents/DocumentCreateParams/Item.php | 76 +-- .../DocumentCreateParams/Item/Allowance.php | 68 +- .../DocumentCreateParams/Item/Charge.php | 68 +- src/Documents/DocumentDeleteResponse.php | 14 +- src/Documents/DocumentNewFromPdfResponse.php | 552 ++++++++-------- .../DocumentNewFromPdfResponse/Item.php | 76 +-- src/Documents/DocumentResponse.php | 536 ++++++++-------- src/Documents/DocumentResponse/Allowance.php | 69 +- src/Documents/DocumentResponse/Charge.php | 67 +- src/Documents/DocumentResponse/Item.php | 76 +-- .../DocumentResponse/PaymentDetail.php | 24 +- src/Documents/DocumentSendParams.php | 40 +- src/Documents/PaymentDetailCreate.php | 24 +- src/Documents/Ubl/UblGetResponse.php | 110 ++-- src/DocumentsNumberPage.php | 6 +- src/Inbox/InboxListCreditNotesParams.php | 10 +- src/Inbox/InboxListInvoicesParams.php | 10 +- src/Inbox/InboxListParams.php | 30 +- src/Inbox/PaginatedDocumentResponse.php | 162 ++--- src/Lookup/LookupGetParticipantsResponse.php | 62 +- .../Participant.php | 58 +- .../Participant/Entity.php | 48 +- .../ServiceMetadata/Endpoint.php | 4 +- .../ServiceMetadata/Endpoint/Process.php | 24 +- .../Endpoint/Process/Endpoint.php | 24 +- src/Lookup/LookupRetrieveParams.php | 12 +- .../LookupRetrieveParticipantsParams.php | 10 +- src/Me/MeGetResponse.php | 162 ++--- src/Outbox/OutboxListDraftDocumentsParams.php | 10 +- .../OutboxListReceivedDocumentsParams.php | 30 +- src/Services/Documents/AttachmentsService.php | 12 +- src/Services/DocumentsService.php | 141 +++-- src/Services/InboxService.php | 24 +- src/Services/LookupService.php | 12 +- src/Services/OutboxService.php | 20 +- src/Services/ValidateService.php | 118 ++-- src/Validate/UblDocumentValidation.php | 42 +- src/Validate/UblDocumentValidation/Issue.php | 12 +- src/Validate/ValidateValidateJsonParams.php | 591 ++++++++--------- .../ValidateValidateJsonParams/Allowance.php | 67 +- .../ValidateValidateJsonParams/Charge.php | 67 +- .../ValidateValidateJsonParams/Item.php | 76 +-- .../Item/Allowance.php | 68 +- .../Item/Charge.php | 68 +- .../ValidateValidatePeppolIDParams.php | 12 +- .../ValidateValidatePeppolIDResponse.php | 76 +-- .../BusinessCard.php | 24 +- src/Webhooks/WebhookDeleteResponse.php | 14 +- tests/Services/Documents/AttachmentsTest.php | 8 +- tests/Services/DocumentsTest.php | 4 +- tests/Services/LookupTest.php | 6 +- tests/Services/ValidateTest.php | 4 +- 75 files changed, 3059 insertions(+), 2937 deletions(-) diff --git a/src/Core/Conversion.php b/src/Core/Conversion.php index 3186c50f..f0c6bc28 100644 --- a/src/Core/Conversion.php +++ b/src/Core/Conversion.php @@ -25,6 +25,10 @@ public static function dump_unknown(mixed $value, DumpState $state): mixed return $value::converter()->dump($value, state: $state); } + if (is_a($value, class: \BackedEnum::class)) { + return $value->value; + } + if (is_a($value, class: \DateTimeInterface::class)) { return $value->format(format: \DateTimeInterface::RFC3339); } @@ -57,6 +61,26 @@ public static function coerce(Converter|ConverterSource|string $target, mixed $v return $target->coerce($value, state: $state); } + return self::tryConvert($target, value: $value, state: $state); + } + + public static function dump(Converter|ConverterSource|string $target, mixed $value, DumpState $state = new DumpState): mixed + { + if ($target instanceof Converter) { + return $target->dump($value, state: $state); + } + + if (is_a($target, class: ConverterSource::class, allow_string: true)) { + return $target::converter()->dump($value, state: $state); + } + + self::tryConvert($target, value: $value, state: $state); + + return self::dump_unknown($value, state: $state); + } + + private static function tryConvert(Converter|ConverterSource|string $target, mixed $value, CoerceState|DumpState $state): mixed + { switch ($target) { case 'mixed': ++$state->yes; @@ -152,17 +176,4 @@ public static function coerce(Converter|ConverterSource|string $target, mixed $v return $value; } } - - public static function dump(Converter|ConverterSource|string $target, mixed $value, DumpState $state = new DumpState): mixed - { - if ($target instanceof Converter) { - return $target->dump($value, state: $state); - } - - if (is_a($target, class: ConverterSource::class, allow_string: true)) { - return $target::converter()->dump($value, state: $state); - } - - return self::dump_unknown($value, state: $state); - } } diff --git a/src/Core/Conversion/Concerns/ArrayOf.php b/src/Core/Conversion/Concerns/ArrayOf.php index 5b720146..fb041b72 100644 --- a/src/Core/Conversion/Concerns/ArrayOf.php +++ b/src/Core/Conversion/Concerns/ArrayOf.php @@ -32,10 +32,11 @@ public function coerce(mixed $value, CoerceState $state): mixed if (!is_array($value)) { return $value; } + ++$state->yes; $acc = []; foreach ($value as $k => $v) { - if ($this->nullable && null === $v) { + if ($this->nullable && is_null($v)) { ++$state->yes; $acc[$k] = null; } else { @@ -51,15 +52,27 @@ public function dump(mixed $value, DumpState $state): mixed if (!is_array($value)) { return Conversion::dump_unknown($value, state: $state); } + ++$state->yes; if (empty($value)) { return $this->empty(); } - return array_map(fn ($v) => Conversion::dump($this->type, value: $v, state: $state), array: $value); + $acc = []; + foreach ($value as $k => $v) { + if ($this->nullable && is_null($v)) { + ++$state->yes; + $acc[$k] = null; + } else { + $acc[$k] = Conversion::dump($this->type, value: $v, state: $state); + } + } + + return $acc; } - private function empty(): array|object // @phpstan-ignore-line + // @phpstan-ignore-next-line missingType.iterableValue + private function empty(): array|object { return (object) []; } diff --git a/src/Core/Conversion/DumpState.php b/src/Core/Conversion/DumpState.php index 1a657189..9fb2eb22 100644 --- a/src/Core/Conversion/DumpState.php +++ b/src/Core/Conversion/DumpState.php @@ -10,6 +10,11 @@ final class DumpState { public function __construct( + public bool $translateNames = true, + public int $yes = 0, + public int $no = 0, + public int $maybe = 0, + public int $branched = 0, public bool $canRetry = true ) {} } diff --git a/src/Core/Conversion/EnumOf.php b/src/Core/Conversion/EnumOf.php index 1925ce5a..6530426e 100644 --- a/src/Core/Conversion/EnumOf.php +++ b/src/Core/Conversion/EnumOf.php @@ -28,19 +28,26 @@ public function __construct(private readonly array $members) public function coerce(mixed $value, CoerceState $state): mixed { - if (in_array($value, haystack: $this->members, strict: true)) { - ++$state->yes; - } elseif ($this->type === gettype($value)) { - ++$state->maybe; - } else { - ++$state->no; - } + $this->tally($value, state: $state); return $value; } public function dump(mixed $value, DumpState $state): mixed { + $this->tally($value, state: $state); + return Conversion::dump_unknown($value, state: $state); } + + private function tally(mixed $value, CoerceState|DumpState $state): void + { + if (in_array($value, haystack: $this->members, strict: true)) { + ++$state->yes; + } elseif ($this->type === gettype($value)) { + ++$state->maybe; + } else { + ++$state->no; + } + } } diff --git a/src/Core/Conversion/ModelOf.php b/src/Core/Conversion/ModelOf.php index 097a4340..c8c8cdd9 100644 --- a/src/Core/Conversion/ModelOf.php +++ b/src/Core/Conversion/ModelOf.php @@ -94,18 +94,6 @@ public function coerce(mixed $value, CoerceState $state): mixed return $this->from($acc); // @phpstan-ignore-line } - /** - * @param array $data - */ - public function from(array $data): BaseModel - { - $instance = $this->class->newInstanceWithoutConstructor(); - // @phpstan-ignore-next-line - $instance->__unserialize($data); - - return $instance; - } - public function dump(mixed $value, DumpState $state): mixed { if ($value instanceof BaseModel) { @@ -113,10 +101,12 @@ public function dump(mixed $value, DumpState $state): mixed } if (is_array($value)) { + ++$state->yes; $acc = []; foreach ($value as $name => $item) { if (array_key_exists($name, array: $this->properties)) { + ++$state->yes; $info = $this->properties[$name]; $acc[$info->apiName] = Conversion::dump($info->type, value: $item, state: $state); } else { @@ -124,9 +114,23 @@ public function dump(mixed $value, DumpState $state): mixed } } - return empty($acc) ? ((object) []) : $acc; + return empty($acc) ? ((object) $acc) : $acc; } + ++$state->no; + return Conversion::dump_unknown($value, state: $state); } + + /** + * @param array $data + */ + public function from(array $data): BaseModel + { + $instance = $this->class->newInstanceWithoutConstructor(); + // @phpstan-ignore-next-line + $instance->__unserialize($data); + + return $instance; + } } diff --git a/src/Core/Conversion/UnionOf.php b/src/Core/Conversion/UnionOf.php index efd24e01..f6671d5e 100644 --- a/src/Core/Conversion/UnionOf.php +++ b/src/Core/Conversion/UnionOf.php @@ -65,17 +65,46 @@ public function coerce(mixed $value, CoerceState $state): mixed public function dump(mixed $value, DumpState $state): mixed { - if (null !== ($target = $this->resolveVariant(value: $value))) { + if (!is_null($target = $this->resolveVariant(value: $value))) { return Conversion::dump($target, value: $value, state: $state); } - foreach ($this->variants as $variant) { + $alternatives = []; + foreach ($this->variants as $_ => $variant) { + ++$state->branched; if ($value instanceof $variant) { return Conversion::dump($variant, value: $value, state: $state); } + + $newState = new DumpState; + $dumped = Conversion::dump($variant, value: $value, state: $newState); + if (($newState->no + $newState->maybe) === 0) { + $state->yes += $newState->yes; + + return $dumped; + } + if ($newState->maybe > 0) { + $alternatives[] = [[-$newState->yes, -$newState->maybe, $newState->no], $newState, $dumped]; + } } - return Conversion::dump_unknown($value, state: $state); + usort( + $alternatives, + static fn (array $a, array $b): int => $a[0][0] <=> $b[0][0] ?: $a[0][1] <=> $b[0][1] ?: $a[0][2] <=> $b[0][2] + ); + + if (empty($alternatives)) { + ++$state->no; + + return Conversion::dump_unknown($value, state: $state); + } + + [[,$newState, $best]] = $alternatives; + $state->yes += $newState->yes; + $state->maybe += $newState->maybe; + $state->no += $newState->no; + + return $best; } private function resolveVariant( diff --git a/src/Documents/Allowance.php b/src/Documents/Allowance.php index 8ab40c05..559bd4d5 100644 --- a/src/Documents/Allowance.php +++ b/src/Documents/Allowance.php @@ -15,12 +15,12 @@ * * @phpstan-type AllowanceShape = array{ * amount?: string|null, - * base_amount?: string|null, - * multiplier_factor?: string|null, + * baseAmount?: string|null, + * multiplierFactor?: string|null, * reason?: string|null, - * reason_code?: value-of|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * } */ final class Allowance implements BaseModel @@ -37,14 +37,14 @@ final class Allowance implements BaseModel /** * The base amount that may be used, in conjunction with the allowance percentage, to calculate the allowance amount. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public ?string $base_amount; + #[Optional('base_amount', nullable: true)] + public ?string $baseAmount; /** * The percentage that may be used, in conjunction with the allowance base amount, to calculate the allowance amount. To state 20%, use value 20. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public ?string $multiplier_factor; + #[Optional('multiplier_factor', nullable: true)] + public ?string $multiplierFactor; /** * The reason for the allowance. @@ -55,24 +55,24 @@ final class Allowance implements BaseModel /** * Allowance reason codes for invoice discounts and charges. * - * @var value-of|null $reason_code + * @var value-of|null $reasonCode */ - #[Optional(enum: ReasonCode::class, nullable: true)] - public ?string $reason_code; + #[Optional('reason_code', enum: ReasonCode::class, nullable: true)] + public ?string $reasonCode; /** * The VAT category code that applies to the allowance. * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ - #[Optional(enum: TaxCode::class)] - public ?string $tax_code; + #[Optional('tax_code', enum: TaxCode::class)] + public ?string $taxCode; /** * The VAT rate, represented as percentage that applies to the allowance. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public ?string $tax_rate; + #[Optional('tax_rate', nullable: true)] + public ?string $taxRate; public function __construct() { @@ -84,27 +84,27 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ReasonCode|value-of|null $reason_code - * @param TaxCode|value-of $tax_code + * @param ReasonCode|value-of|null $reasonCode + * @param TaxCode|value-of $taxCode */ public static function with( ?string $amount = null, - ?string $base_amount = null, - ?string $multiplier_factor = null, + ?string $baseAmount = null, + ?string $multiplierFactor = null, ?string $reason = null, - ReasonCode|string|null $reason_code = null, - TaxCode|string|null $tax_code = null, - ?string $tax_rate = null, + ReasonCode|string|null $reasonCode = null, + TaxCode|string|null $taxCode = null, + ?string $taxRate = null, ): self { $obj = new self; null !== $amount && $obj['amount'] = $amount; - null !== $base_amount && $obj['base_amount'] = $base_amount; - null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $baseAmount && $obj['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; null !== $reason && $obj['reason'] = $reason; - null !== $reason_code && $obj['reason_code'] = $reason_code; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $reasonCode && $obj['reasonCode'] = $reasonCode; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxRate && $obj['taxRate'] = $taxRate; return $obj; } @@ -126,7 +126,7 @@ public function withAmount(?string $amount): self public function withBaseAmount(?string $baseAmount): self { $obj = clone $this; - $obj['base_amount'] = $baseAmount; + $obj['baseAmount'] = $baseAmount; return $obj; } @@ -137,7 +137,7 @@ public function withBaseAmount(?string $baseAmount): self public function withMultiplierFactor(?string $multiplierFactor): self { $obj = clone $this; - $obj['multiplier_factor'] = $multiplierFactor; + $obj['multiplierFactor'] = $multiplierFactor; return $obj; } @@ -161,7 +161,7 @@ public function withReason(?string $reason): self public function withReasonCode(ReasonCode|string|null $reasonCode): self { $obj = clone $this; - $obj['reason_code'] = $reasonCode; + $obj['reasonCode'] = $reasonCode; return $obj; } @@ -174,7 +174,7 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self public function withTaxCode(TaxCode|string $taxCode): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -185,7 +185,7 @@ public function withTaxCode(TaxCode|string $taxCode): self public function withTaxRate(?string $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } diff --git a/src/Documents/Attachments/AttachmentDeleteParams.php b/src/Documents/Attachments/AttachmentDeleteParams.php index df1130c1..0ce0698b 100644 --- a/src/Documents/Attachments/AttachmentDeleteParams.php +++ b/src/Documents/Attachments/AttachmentDeleteParams.php @@ -14,7 +14,7 @@ * * @see EInvoiceAPI\Services\Documents\AttachmentsService::delete() * - * @phpstan-type AttachmentDeleteParamsShape = array{document_id: string} + * @phpstan-type AttachmentDeleteParamsShape = array{documentID: string} */ final class AttachmentDeleteParams implements BaseModel { @@ -23,14 +23,14 @@ final class AttachmentDeleteParams implements BaseModel use SdkParams; #[Required] - public string $document_id; + public string $documentID; /** * `new AttachmentDeleteParams()` is missing required properties by the API. * * To enforce required parameters use * ``` - * AttachmentDeleteParams::with(document_id: ...) + * AttachmentDeleteParams::with(documentID: ...) * ``` * * Otherwise ensure the following setters are called @@ -49,11 +49,11 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(string $document_id): self + public static function with(string $documentID): self { $obj = new self; - $obj['document_id'] = $document_id; + $obj['documentID'] = $documentID; return $obj; } @@ -61,7 +61,7 @@ public static function with(string $document_id): self public function withDocumentID(string $documentID): self { $obj = clone $this; - $obj['document_id'] = $documentID; + $obj['documentID'] = $documentID; return $obj; } diff --git a/src/Documents/Attachments/AttachmentDeleteResponse.php b/src/Documents/Attachments/AttachmentDeleteResponse.php index 2922a50b..2ebad120 100644 --- a/src/Documents/Attachments/AttachmentDeleteResponse.php +++ b/src/Documents/Attachments/AttachmentDeleteResponse.php @@ -9,22 +9,22 @@ use EInvoiceAPI\Core\Contracts\BaseModel; /** - * @phpstan-type AttachmentDeleteResponseShape = array{is_deleted: bool} + * @phpstan-type AttachmentDeleteResponseShape = array{isDeleted: bool} */ final class AttachmentDeleteResponse implements BaseModel { /** @use SdkModel */ use SdkModel; - #[Required] - public bool $is_deleted; + #[Required('is_deleted')] + public bool $isDeleted; /** * `new AttachmentDeleteResponse()` is missing required properties by the API. * * To enforce required parameters use * ``` - * AttachmentDeleteResponse::with(is_deleted: ...) + * AttachmentDeleteResponse::with(isDeleted: ...) * ``` * * Otherwise ensure the following setters are called @@ -43,11 +43,11 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(bool $is_deleted): self + public static function with(bool $isDeleted): self { $obj = new self; - $obj['is_deleted'] = $is_deleted; + $obj['isDeleted'] = $isDeleted; return $obj; } @@ -55,7 +55,7 @@ public static function with(bool $is_deleted): self public function withIsDeleted(bool $isDeleted): self { $obj = clone $this; - $obj['is_deleted'] = $isDeleted; + $obj['isDeleted'] = $isDeleted; return $obj; } diff --git a/src/Documents/Attachments/AttachmentRetrieveParams.php b/src/Documents/Attachments/AttachmentRetrieveParams.php index eae132b9..5a38860f 100644 --- a/src/Documents/Attachments/AttachmentRetrieveParams.php +++ b/src/Documents/Attachments/AttachmentRetrieveParams.php @@ -14,7 +14,7 @@ * * @see EInvoiceAPI\Services\Documents\AttachmentsService::retrieve() * - * @phpstan-type AttachmentRetrieveParamsShape = array{document_id: string} + * @phpstan-type AttachmentRetrieveParamsShape = array{documentID: string} */ final class AttachmentRetrieveParams implements BaseModel { @@ -23,14 +23,14 @@ final class AttachmentRetrieveParams implements BaseModel use SdkParams; #[Required] - public string $document_id; + public string $documentID; /** * `new AttachmentRetrieveParams()` is missing required properties by the API. * * To enforce required parameters use * ``` - * AttachmentRetrieveParams::with(document_id: ...) + * AttachmentRetrieveParams::with(documentID: ...) * ``` * * Otherwise ensure the following setters are called @@ -49,11 +49,11 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(string $document_id): self + public static function with(string $documentID): self { $obj = new self; - $obj['document_id'] = $document_id; + $obj['documentID'] = $documentID; return $obj; } @@ -61,7 +61,7 @@ public static function with(string $document_id): self public function withDocumentID(string $documentID): self { $obj = clone $this; - $obj['document_id'] = $documentID; + $obj['documentID'] = $documentID; return $obj; } diff --git a/src/Documents/Attachments/DocumentAttachment.php b/src/Documents/Attachments/DocumentAttachment.php index 40af9918..8c9db23b 100644 --- a/src/Documents/Attachments/DocumentAttachment.php +++ b/src/Documents/Attachments/DocumentAttachment.php @@ -12,10 +12,10 @@ /** * @phpstan-type DocumentAttachmentShape = array{ * id: string, - * file_name: string, - * file_size?: int|null, - * file_type?: string|null, - * file_url?: string|null, + * fileName: string, + * fileSize?: int|null, + * fileType?: string|null, + * fileURL?: string|null, * } */ final class DocumentAttachment implements BaseModel @@ -26,24 +26,24 @@ final class DocumentAttachment implements BaseModel #[Required] public string $id; - #[Required] - public string $file_name; + #[Required('file_name')] + public string $fileName; - #[Optional] - public ?int $file_size; + #[Optional('file_size')] + public ?int $fileSize; - #[Optional] - public ?string $file_type; + #[Optional('file_type')] + public ?string $fileType; - #[Optional(nullable: true)] - public ?string $file_url; + #[Optional('file_url', nullable: true)] + public ?string $fileURL; /** * `new DocumentAttachment()` is missing required properties by the API. * * To enforce required parameters use * ``` - * DocumentAttachment::with(id: ..., file_name: ...) + * DocumentAttachment::with(id: ..., fileName: ...) * ``` * * Otherwise ensure the following setters are called @@ -64,19 +64,19 @@ public function __construct() */ public static function with( string $id, - string $file_name, - ?int $file_size = null, - ?string $file_type = null, - ?string $file_url = null, + string $fileName, + ?int $fileSize = null, + ?string $fileType = null, + ?string $fileURL = null, ): self { $obj = new self; $obj['id'] = $id; - $obj['file_name'] = $file_name; + $obj['fileName'] = $fileName; - null !== $file_size && $obj['file_size'] = $file_size; - null !== $file_type && $obj['file_type'] = $file_type; - null !== $file_url && $obj['file_url'] = $file_url; + null !== $fileSize && $obj['fileSize'] = $fileSize; + null !== $fileType && $obj['fileType'] = $fileType; + null !== $fileURL && $obj['fileURL'] = $fileURL; return $obj; } @@ -92,7 +92,7 @@ public function withID(string $id): self public function withFileName(string $fileName): self { $obj = clone $this; - $obj['file_name'] = $fileName; + $obj['fileName'] = $fileName; return $obj; } @@ -100,7 +100,7 @@ public function withFileName(string $fileName): self public function withFileSize(int $fileSize): self { $obj = clone $this; - $obj['file_size'] = $fileSize; + $obj['fileSize'] = $fileSize; return $obj; } @@ -108,7 +108,7 @@ public function withFileSize(int $fileSize): self public function withFileType(string $fileType): self { $obj = clone $this; - $obj['file_type'] = $fileType; + $obj['fileType'] = $fileType; return $obj; } @@ -116,7 +116,7 @@ public function withFileType(string $fileType): self public function withFileURL(?string $fileURL): self { $obj = clone $this; - $obj['file_url'] = $fileURL; + $obj['fileURL'] = $fileURL; return $obj; } diff --git a/src/Documents/Charge.php b/src/Documents/Charge.php index 0732ce1f..1e7a701a 100644 --- a/src/Documents/Charge.php +++ b/src/Documents/Charge.php @@ -15,12 +15,12 @@ * * @phpstan-type ChargeShape = array{ * amount?: string|null, - * base_amount?: string|null, - * multiplier_factor?: string|null, + * baseAmount?: string|null, + * multiplierFactor?: string|null, * reason?: string|null, - * reason_code?: value-of|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * } */ final class Charge implements BaseModel @@ -37,14 +37,14 @@ final class Charge implements BaseModel /** * The base amount that may be used, in conjunction with the charge percentage, to calculate the charge amount. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public ?string $base_amount; + #[Optional('base_amount', nullable: true)] + public ?string $baseAmount; /** * The percentage that may be used, in conjunction with the charge base amount, to calculate the charge amount. To state 20%, use value 20. */ - #[Optional(nullable: true)] - public ?string $multiplier_factor; + #[Optional('multiplier_factor', nullable: true)] + public ?string $multiplierFactor; /** * The reason for the charge. @@ -55,10 +55,10 @@ final class Charge implements BaseModel /** * Charge reason codes for invoice charges and fees. * - * @var value-of|null $reason_code + * @var value-of|null $reasonCode */ - #[Optional(enum: ReasonCode::class, nullable: true)] - public ?string $reason_code; + #[Optional('reason_code', enum: ReasonCode::class, nullable: true)] + public ?string $reasonCode; /** * Duty or tax or fee category codes (Subset of UNCL5305). @@ -67,16 +67,16 @@ final class Charge implements BaseModel * Version: D.16B * Subset: OpenPEPPOL * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ - #[Optional(enum: TaxCode::class, nullable: true)] - public ?string $tax_code; + #[Optional('tax_code', enum: TaxCode::class, nullable: true)] + public ?string $taxCode; /** * The VAT rate, represented as percentage that applies to the charge. */ - #[Optional(nullable: true)] - public ?string $tax_rate; + #[Optional('tax_rate', nullable: true)] + public ?string $taxRate; public function __construct() { @@ -88,27 +88,27 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ReasonCode|value-of|null $reason_code - * @param TaxCode|value-of|null $tax_code + * @param ReasonCode|value-of|null $reasonCode + * @param TaxCode|value-of|null $taxCode */ public static function with( ?string $amount = null, - ?string $base_amount = null, - ?string $multiplier_factor = null, + ?string $baseAmount = null, + ?string $multiplierFactor = null, ?string $reason = null, - ReasonCode|string|null $reason_code = null, - TaxCode|string|null $tax_code = null, - ?string $tax_rate = null, + ReasonCode|string|null $reasonCode = null, + TaxCode|string|null $taxCode = null, + ?string $taxRate = null, ): self { $obj = new self; null !== $amount && $obj['amount'] = $amount; - null !== $base_amount && $obj['base_amount'] = $base_amount; - null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $baseAmount && $obj['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; null !== $reason && $obj['reason'] = $reason; - null !== $reason_code && $obj['reason_code'] = $reason_code; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $reasonCode && $obj['reasonCode'] = $reasonCode; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxRate && $obj['taxRate'] = $taxRate; return $obj; } @@ -130,7 +130,7 @@ public function withAmount(?string $amount): self public function withBaseAmount(?string $baseAmount): self { $obj = clone $this; - $obj['base_amount'] = $baseAmount; + $obj['baseAmount'] = $baseAmount; return $obj; } @@ -141,7 +141,7 @@ public function withBaseAmount(?string $baseAmount): self public function withMultiplierFactor(?string $multiplierFactor): self { $obj = clone $this; - $obj['multiplier_factor'] = $multiplierFactor; + $obj['multiplierFactor'] = $multiplierFactor; return $obj; } @@ -165,7 +165,7 @@ public function withReason(?string $reason): self public function withReasonCode(ReasonCode|string|null $reasonCode): self { $obj = clone $this; - $obj['reason_code'] = $reasonCode; + $obj['reasonCode'] = $reasonCode; return $obj; } @@ -182,7 +182,7 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self public function withTaxCode(TaxCode|string|null $taxCode): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -193,7 +193,7 @@ public function withTaxCode(TaxCode|string|null $taxCode): self public function withTaxRate(?string $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentAttachmentCreate.php b/src/Documents/DocumentAttachmentCreate.php index e212adb3..1fa7ba68 100644 --- a/src/Documents/DocumentAttachmentCreate.php +++ b/src/Documents/DocumentAttachmentCreate.php @@ -11,10 +11,10 @@ /** * @phpstan-type DocumentAttachmentCreateShape = array{ - * file_name: string, - * file_data?: string|null, - * file_size?: int|null, - * file_type?: string|null, + * fileName: string, + * fileData?: string|null, + * fileSize?: int|null, + * fileType?: string|null, * } */ final class DocumentAttachmentCreate implements BaseModel @@ -22,27 +22,27 @@ final class DocumentAttachmentCreate implements BaseModel /** @use SdkModel */ use SdkModel; - #[Required] - public string $file_name; + #[Required('file_name')] + public string $fileName; /** * Base64 encoded file data. */ - #[Optional(nullable: true)] - public ?string $file_data; + #[Optional('file_data', nullable: true)] + public ?string $fileData; - #[Optional] - public ?int $file_size; + #[Optional('file_size')] + public ?int $fileSize; - #[Optional] - public ?string $file_type; + #[Optional('file_type')] + public ?string $fileType; /** * `new DocumentAttachmentCreate()` is missing required properties by the API. * * To enforce required parameters use * ``` - * DocumentAttachmentCreate::with(file_name: ...) + * DocumentAttachmentCreate::with(fileName: ...) * ``` * * Otherwise ensure the following setters are called @@ -62,18 +62,18 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. */ public static function with( - string $file_name, - ?string $file_data = null, - ?int $file_size = null, - ?string $file_type = null, + string $fileName, + ?string $fileData = null, + ?int $fileSize = null, + ?string $fileType = null, ): self { $obj = new self; - $obj['file_name'] = $file_name; + $obj['fileName'] = $fileName; - null !== $file_data && $obj['file_data'] = $file_data; - null !== $file_size && $obj['file_size'] = $file_size; - null !== $file_type && $obj['file_type'] = $file_type; + null !== $fileData && $obj['fileData'] = $fileData; + null !== $fileSize && $obj['fileSize'] = $fileSize; + null !== $fileType && $obj['fileType'] = $fileType; return $obj; } @@ -81,7 +81,7 @@ public static function with( public function withFileName(string $fileName): self { $obj = clone $this; - $obj['file_name'] = $fileName; + $obj['fileName'] = $fileName; return $obj; } @@ -92,7 +92,7 @@ public function withFileName(string $fileName): self public function withFileData(?string $fileData): self { $obj = clone $this; - $obj['file_data'] = $fileData; + $obj['fileData'] = $fileData; return $obj; } @@ -100,7 +100,7 @@ public function withFileData(?string $fileData): self public function withFileSize(int $fileSize): self { $obj = clone $this; - $obj['file_size'] = $fileSize; + $obj['fileSize'] = $fileSize; return $obj; } @@ -108,7 +108,7 @@ public function withFileSize(int $fileSize): self public function withFileType(string $fileType): self { $obj = clone $this; - $obj['file_type'] = $fileType; + $obj['fileType'] = $fileType; return $obj; } diff --git a/src/Documents/DocumentCreate.php b/src/Documents/DocumentCreate.php index 838d2b76..cb8ecdd7 100644 --- a/src/Documents/DocumentCreate.php +++ b/src/Documents/DocumentCreate.php @@ -19,53 +19,53 @@ /** * @phpstan-type DocumentCreateShape = array{ * allowances?: list<\EInvoiceAPI\Documents\DocumentCreate\Allowance>|null, - * amount_due?: float|string|null, + * amountDue?: float|string|null, * attachments?: list|null, - * billing_address?: string|null, - * billing_address_recipient?: string|null, + * billingAddress?: string|null, + * billingAddressRecipient?: string|null, * charges?: list<\EInvoiceAPI\Documents\DocumentCreate\Charge>|null, * currency?: value-of|null, - * customer_address?: string|null, - * customer_address_recipient?: string|null, - * customer_company_id?: string|null, - * customer_email?: string|null, - * customer_id?: string|null, - * customer_name?: string|null, - * customer_tax_id?: string|null, + * customerAddress?: string|null, + * customerAddressRecipient?: string|null, + * customerCompanyID?: string|null, + * customerEmail?: string|null, + * customerID?: string|null, + * customerName?: string|null, + * customerTaxID?: string|null, * direction?: value-of|null, - * document_type?: value-of|null, - * due_date?: \DateTimeInterface|null, - * invoice_date?: \DateTimeInterface|null, - * invoice_id?: string|null, - * invoice_total?: float|string|null, + * documentType?: value-of|null, + * dueDate?: \DateTimeInterface|null, + * invoiceDate?: \DateTimeInterface|null, + * invoiceID?: string|null, + * invoiceTotal?: float|string|null, * items?: list|null, * note?: string|null, - * payment_details?: list|null, - * payment_term?: string|null, - * previous_unpaid_balance?: float|string|null, - * purchase_order?: string|null, - * remittance_address?: string|null, - * remittance_address_recipient?: string|null, - * service_address?: string|null, - * service_address_recipient?: string|null, - * service_end_date?: \DateTimeInterface|null, - * service_start_date?: \DateTimeInterface|null, - * shipping_address?: string|null, - * shipping_address_recipient?: string|null, + * paymentDetails?: list|null, + * paymentTerm?: string|null, + * previousUnpaidBalance?: float|string|null, + * purchaseOrder?: string|null, + * remittanceAddress?: string|null, + * remittanceAddressRecipient?: string|null, + * serviceAddress?: string|null, + * serviceAddressRecipient?: string|null, + * serviceEndDate?: \DateTimeInterface|null, + * serviceStartDate?: \DateTimeInterface|null, + * shippingAddress?: string|null, + * shippingAddressRecipient?: string|null, * state?: value-of|null, * subtotal?: float|string|null, - * tax_code?: value-of|null, - * tax_details?: list|null, - * total_discount?: float|string|null, - * total_tax?: float|string|null, + * taxCode?: value-of|null, + * taxDetails?: list|null, + * totalDiscount?: float|string|null, + * totalTax?: float|string|null, * vatex?: value-of|null, - * vatex_note?: string|null, - * vendor_address?: string|null, - * vendor_address_recipient?: string|null, - * vendor_company_id?: string|null, - * vendor_email?: string|null, - * vendor_name?: string|null, - * vendor_tax_id?: string|null, + * vatexNote?: string|null, + * vendorAddress?: string|null, + * vendorAddressRecipient?: string|null, + * vendorCompanyID?: string|null, + * vendorEmail?: string|null, + * vendorName?: string|null, + * vendorTaxID?: string|null, * } */ final class DocumentCreate implements BaseModel @@ -83,8 +83,8 @@ final class DocumentCreate implements BaseModel /** * The amount due for payment. Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $amount_due; + #[Optional('amount_due', nullable: true)] + public float|string|null $amountDue; /** @var list|null $attachments */ #[Optional(list: DocumentAttachmentCreate::class, nullable: true)] @@ -93,14 +93,14 @@ final class DocumentCreate implements BaseModel /** * The billing address (if different from customer address). */ - #[Optional(nullable: true)] - public ?string $billing_address; + #[Optional('billing_address', nullable: true)] + public ?string $billingAddress; /** * The recipient name at the billing address. */ - #[Optional(nullable: true)] - public ?string $billing_address_recipient; + #[Optional('billing_address_recipient', nullable: true)] + public ?string $billingAddressRecipient; /** @var list|null $charges */ #[Optional( @@ -120,44 +120,44 @@ final class DocumentCreate implements BaseModel /** * The address of the customer/buyer. */ - #[Optional(nullable: true)] - public ?string $customer_address; + #[Optional('customer_address', nullable: true)] + public ?string $customerAddress; /** * The recipient name at the customer address. */ - #[Optional(nullable: true)] - public ?string $customer_address_recipient; + #[Optional('customer_address_recipient', nullable: true)] + public ?string $customerAddressRecipient; /** * Customer company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Optional(nullable: true)] - public ?string $customer_company_id; + #[Optional('customer_company_id', nullable: true)] + public ?string $customerCompanyID; /** * The email address of the customer. */ - #[Optional(nullable: true)] - public ?string $customer_email; + #[Optional('customer_email', nullable: true)] + public ?string $customerEmail; /** * The unique identifier for the customer in your system. */ - #[Optional(nullable: true)] - public ?string $customer_id; + #[Optional('customer_id', nullable: true)] + public ?string $customerID; /** * The company name of the customer/buyer. */ - #[Optional(nullable: true)] - public ?string $customer_name; + #[Optional('customer_name', nullable: true)] + public ?string $customerName; /** * Customer tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Optional(nullable: true)] - public ?string $customer_tax_id; + #[Optional('customer_tax_id', nullable: true)] + public ?string $customerTaxID; /** * The direction of the document: INBOUND (purchases) or OUTBOUND (sales). @@ -170,34 +170,34 @@ final class DocumentCreate implements BaseModel /** * The type of document: INVOICE, CREDIT_NOTE, or DEBIT_NOTE. * - * @var value-of|null $document_type + * @var value-of|null $documentType */ - #[Optional(enum: DocumentType::class)] - public ?string $document_type; + #[Optional('document_type', enum: DocumentType::class)] + public ?string $documentType; /** * The date when payment is due. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $due_date; + #[Optional('due_date', nullable: true)] + public ?\DateTimeInterface $dueDate; /** * The date when the invoice was issued. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $invoice_date; + #[Optional('invoice_date', nullable: true)] + public ?\DateTimeInterface $invoiceDate; /** * The unique invoice identifier/number. */ - #[Optional(nullable: true)] - public ?string $invoice_id; + #[Optional('invoice_id', nullable: true)] + public ?string $invoiceID; /** * The total amount of the invoice including tax (invoice_total = subtotal + total_tax + total_discount). Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $invoice_total; + #[Optional('invoice_total', nullable: true)] + public float|string|null $invoiceTotal; /** * At least one line item is required. @@ -213,75 +213,79 @@ final class DocumentCreate implements BaseModel #[Optional(nullable: true)] public ?string $note; - /** @var list|null $payment_details */ - #[Optional(list: PaymentDetailCreate::class, nullable: true)] - public ?array $payment_details; + /** @var list|null $paymentDetails */ + #[Optional( + 'payment_details', + list: PaymentDetailCreate::class, + nullable: true + )] + public ?array $paymentDetails; /** * The payment terms (e.g., 'Net 30', 'Due on receipt', '2/10 Net 30'). */ - #[Optional(nullable: true)] - public ?string $payment_term; + #[Optional('payment_term', nullable: true)] + public ?string $paymentTerm; /** * The previous unpaid balance from prior invoices, if any. Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $previous_unpaid_balance; + #[Optional('previous_unpaid_balance', nullable: true)] + public float|string|null $previousUnpaidBalance; /** * The purchase order reference number. */ - #[Optional(nullable: true)] - public ?string $purchase_order; + #[Optional('purchase_order', nullable: true)] + public ?string $purchaseOrder; /** * The address where payment should be sent or remitted to. */ - #[Optional(nullable: true)] - public ?string $remittance_address; + #[Optional('remittance_address', nullable: true)] + public ?string $remittanceAddress; /** * The recipient name at the remittance address. */ - #[Optional(nullable: true)] - public ?string $remittance_address_recipient; + #[Optional('remittance_address_recipient', nullable: true)] + public ?string $remittanceAddressRecipient; /** * The address where services were performed or goods were delivered. */ - #[Optional(nullable: true)] - public ?string $service_address; + #[Optional('service_address', nullable: true)] + public ?string $serviceAddress; /** * The recipient name at the service address. */ - #[Optional(nullable: true)] - public ?string $service_address_recipient; + #[Optional('service_address_recipient', nullable: true)] + public ?string $serviceAddressRecipient; /** * The end date of the service period or delivery period. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $service_end_date; + #[Optional('service_end_date', nullable: true)] + public ?\DateTimeInterface $serviceEndDate; /** * The start date of the service period or delivery period. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $service_start_date; + #[Optional('service_start_date', nullable: true)] + public ?\DateTimeInterface $serviceStartDate; /** * The shipping/delivery address. */ - #[Optional(nullable: true)] - public ?string $shipping_address; + #[Optional('shipping_address', nullable: true)] + public ?string $shippingAddress; /** * The recipient name at the shipping address. */ - #[Optional(nullable: true)] - public ?string $shipping_address_recipient; + #[Optional('shipping_address_recipient', nullable: true)] + public ?string $shippingAddressRecipient; /** * The current state of the document: DRAFT, TRANSIT, FAILED, SENT, or RECEIVED. @@ -300,26 +304,26 @@ final class DocumentCreate implements BaseModel /** * Tax category code of the invoice (e.g., S for standard rate, Z for zero rate, E for exempt). * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ - #[Optional(enum: TaxCode::class)] - public ?string $tax_code; + #[Optional('tax_code', enum: TaxCode::class)] + public ?string $taxCode; - /** @var list|null $tax_details */ - #[Optional(list: TaxDetail::class, nullable: true)] - public ?array $tax_details; + /** @var list|null $taxDetails */ + #[Optional('tax_details', list: TaxDetail::class, nullable: true)] + public ?array $taxDetails; /** * The net financial discount/charge of the invoice (non-VAT charges minus non-VAT allowances). Can be positive (net charge), negative (net discount), or zero. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $total_discount; + #[Optional('total_discount', nullable: true)] + public float|string|null $totalDiscount; /** * The total tax amount of the invoice. Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $total_tax; + #[Optional('total_tax', nullable: true)] + public float|string|null $totalTax; /** * VATEX code list for VAT exemption reasons. @@ -335,44 +339,44 @@ final class DocumentCreate implements BaseModel /** * Textual explanation for VAT exemption. */ - #[Optional(nullable: true)] - public ?string $vatex_note; + #[Optional('vatex_note', nullable: true)] + public ?string $vatexNote; /** * The address of the vendor/seller. */ - #[Optional(nullable: true)] - public ?string $vendor_address; + #[Optional('vendor_address', nullable: true)] + public ?string $vendorAddress; /** * The recipient name at the vendor address. */ - #[Optional(nullable: true)] - public ?string $vendor_address_recipient; + #[Optional('vendor_address_recipient', nullable: true)] + public ?string $vendorAddressRecipient; /** * Vendor company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Optional(nullable: true)] - public ?string $vendor_company_id; + #[Optional('vendor_company_id', nullable: true)] + public ?string $vendorCompanyID; /** * The email address of the vendor. */ - #[Optional(nullable: true)] - public ?string $vendor_email; + #[Optional('vendor_email', nullable: true)] + public ?string $vendorEmail; /** * The name of the vendor/seller/supplier. */ - #[Optional(nullable: true)] - public ?string $vendor_name; + #[Optional('vendor_name', nullable: true)] + public ?string $vendorName; /** * Vendor tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Optional(nullable: true)] - public ?string $vendor_tax_id; + #[Optional('vendor_tax_id', nullable: true)] + public ?string $vendorTaxID; public function __construct() { @@ -386,157 +390,157 @@ public function __construct() * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $allowances * @param list|null $attachments * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $charges * @param CurrencyCode|value-of $currency * @param DocumentDirection|value-of $direction - * @param DocumentType|value-of $document_type + * @param DocumentType|value-of $documentType * @param list|null, * amount?: float|string|null, * charges?: list|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: float|string|null, * tax?: float|string|null, - * tax_rate?: float|string|null, + * taxRate?: float|string|null, * unit?: value-of|null, - * unit_price?: float|string|null, + * unitPrice?: float|string|null, * }> $items * @param list|null $payment_details + * }>|null $paymentDetails * @param DocumentState|value-of $state - * @param TaxCode|value-of $tax_code + * @param TaxCode|value-of $taxCode * @param list|null $tax_details + * }>|null $taxDetails * @param Vatex|value-of|null $vatex */ public static function with( ?array $allowances = null, - float|string|null $amount_due = null, + float|string|null $amountDue = null, ?array $attachments = null, - ?string $billing_address = null, - ?string $billing_address_recipient = null, + ?string $billingAddress = null, + ?string $billingAddressRecipient = null, ?array $charges = null, CurrencyCode|string|null $currency = null, - ?string $customer_address = null, - ?string $customer_address_recipient = null, - ?string $customer_company_id = null, - ?string $customer_email = null, - ?string $customer_id = null, - ?string $customer_name = null, - ?string $customer_tax_id = null, + ?string $customerAddress = null, + ?string $customerAddressRecipient = null, + ?string $customerCompanyID = null, + ?string $customerEmail = null, + ?string $customerID = null, + ?string $customerName = null, + ?string $customerTaxID = null, DocumentDirection|string|null $direction = null, - DocumentType|string|null $document_type = null, - ?\DateTimeInterface $due_date = null, - ?\DateTimeInterface $invoice_date = null, - ?string $invoice_id = null, - float|string|null $invoice_total = null, + DocumentType|string|null $documentType = null, + ?\DateTimeInterface $dueDate = null, + ?\DateTimeInterface $invoiceDate = null, + ?string $invoiceID = null, + float|string|null $invoiceTotal = null, ?array $items = null, ?string $note = null, - ?array $payment_details = null, - ?string $payment_term = null, - float|string|null $previous_unpaid_balance = null, - ?string $purchase_order = null, - ?string $remittance_address = null, - ?string $remittance_address_recipient = null, - ?string $service_address = null, - ?string $service_address_recipient = null, - ?\DateTimeInterface $service_end_date = null, - ?\DateTimeInterface $service_start_date = null, - ?string $shipping_address = null, - ?string $shipping_address_recipient = null, + ?array $paymentDetails = null, + ?string $paymentTerm = null, + float|string|null $previousUnpaidBalance = null, + ?string $purchaseOrder = null, + ?string $remittanceAddress = null, + ?string $remittanceAddressRecipient = null, + ?string $serviceAddress = null, + ?string $serviceAddressRecipient = null, + ?\DateTimeInterface $serviceEndDate = null, + ?\DateTimeInterface $serviceStartDate = null, + ?string $shippingAddress = null, + ?string $shippingAddressRecipient = null, DocumentState|string|null $state = null, float|string|null $subtotal = null, - TaxCode|string|null $tax_code = null, - ?array $tax_details = null, - float|string|null $total_discount = null, - float|string|null $total_tax = null, + TaxCode|string|null $taxCode = null, + ?array $taxDetails = null, + float|string|null $totalDiscount = null, + float|string|null $totalTax = null, Vatex|string|null $vatex = null, - ?string $vatex_note = null, - ?string $vendor_address = null, - ?string $vendor_address_recipient = null, - ?string $vendor_company_id = null, - ?string $vendor_email = null, - ?string $vendor_name = null, - ?string $vendor_tax_id = null, + ?string $vatexNote = null, + ?string $vendorAddress = null, + ?string $vendorAddressRecipient = null, + ?string $vendorCompanyID = null, + ?string $vendorEmail = null, + ?string $vendorName = null, + ?string $vendorTaxID = null, ): self { $obj = new self; null !== $allowances && $obj['allowances'] = $allowances; - null !== $amount_due && $obj['amount_due'] = $amount_due; + null !== $amountDue && $obj['amountDue'] = $amountDue; null !== $attachments && $obj['attachments'] = $attachments; - null !== $billing_address && $obj['billing_address'] = $billing_address; - null !== $billing_address_recipient && $obj['billing_address_recipient'] = $billing_address_recipient; + null !== $billingAddress && $obj['billingAddress'] = $billingAddress; + null !== $billingAddressRecipient && $obj['billingAddressRecipient'] = $billingAddressRecipient; null !== $charges && $obj['charges'] = $charges; null !== $currency && $obj['currency'] = $currency; - null !== $customer_address && $obj['customer_address'] = $customer_address; - null !== $customer_address_recipient && $obj['customer_address_recipient'] = $customer_address_recipient; - null !== $customer_company_id && $obj['customer_company_id'] = $customer_company_id; - null !== $customer_email && $obj['customer_email'] = $customer_email; - null !== $customer_id && $obj['customer_id'] = $customer_id; - null !== $customer_name && $obj['customer_name'] = $customer_name; - null !== $customer_tax_id && $obj['customer_tax_id'] = $customer_tax_id; + null !== $customerAddress && $obj['customerAddress'] = $customerAddress; + null !== $customerAddressRecipient && $obj['customerAddressRecipient'] = $customerAddressRecipient; + null !== $customerCompanyID && $obj['customerCompanyID'] = $customerCompanyID; + null !== $customerEmail && $obj['customerEmail'] = $customerEmail; + null !== $customerID && $obj['customerID'] = $customerID; + null !== $customerName && $obj['customerName'] = $customerName; + null !== $customerTaxID && $obj['customerTaxID'] = $customerTaxID; null !== $direction && $obj['direction'] = $direction; - null !== $document_type && $obj['document_type'] = $document_type; - null !== $due_date && $obj['due_date'] = $due_date; - null !== $invoice_date && $obj['invoice_date'] = $invoice_date; - null !== $invoice_id && $obj['invoice_id'] = $invoice_id; - null !== $invoice_total && $obj['invoice_total'] = $invoice_total; + null !== $documentType && $obj['documentType'] = $documentType; + null !== $dueDate && $obj['dueDate'] = $dueDate; + null !== $invoiceDate && $obj['invoiceDate'] = $invoiceDate; + null !== $invoiceID && $obj['invoiceID'] = $invoiceID; + null !== $invoiceTotal && $obj['invoiceTotal'] = $invoiceTotal; null !== $items && $obj['items'] = $items; null !== $note && $obj['note'] = $note; - null !== $payment_details && $obj['payment_details'] = $payment_details; - null !== $payment_term && $obj['payment_term'] = $payment_term; - null !== $previous_unpaid_balance && $obj['previous_unpaid_balance'] = $previous_unpaid_balance; - null !== $purchase_order && $obj['purchase_order'] = $purchase_order; - null !== $remittance_address && $obj['remittance_address'] = $remittance_address; - null !== $remittance_address_recipient && $obj['remittance_address_recipient'] = $remittance_address_recipient; - null !== $service_address && $obj['service_address'] = $service_address; - null !== $service_address_recipient && $obj['service_address_recipient'] = $service_address_recipient; - null !== $service_end_date && $obj['service_end_date'] = $service_end_date; - null !== $service_start_date && $obj['service_start_date'] = $service_start_date; - null !== $shipping_address && $obj['shipping_address'] = $shipping_address; - null !== $shipping_address_recipient && $obj['shipping_address_recipient'] = $shipping_address_recipient; + null !== $paymentDetails && $obj['paymentDetails'] = $paymentDetails; + null !== $paymentTerm && $obj['paymentTerm'] = $paymentTerm; + null !== $previousUnpaidBalance && $obj['previousUnpaidBalance'] = $previousUnpaidBalance; + null !== $purchaseOrder && $obj['purchaseOrder'] = $purchaseOrder; + null !== $remittanceAddress && $obj['remittanceAddress'] = $remittanceAddress; + null !== $remittanceAddressRecipient && $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; + null !== $serviceAddress && $obj['serviceAddress'] = $serviceAddress; + null !== $serviceAddressRecipient && $obj['serviceAddressRecipient'] = $serviceAddressRecipient; + null !== $serviceEndDate && $obj['serviceEndDate'] = $serviceEndDate; + null !== $serviceStartDate && $obj['serviceStartDate'] = $serviceStartDate; + null !== $shippingAddress && $obj['shippingAddress'] = $shippingAddress; + null !== $shippingAddressRecipient && $obj['shippingAddressRecipient'] = $shippingAddressRecipient; null !== $state && $obj['state'] = $state; null !== $subtotal && $obj['subtotal'] = $subtotal; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_details && $obj['tax_details'] = $tax_details; - null !== $total_discount && $obj['total_discount'] = $total_discount; - null !== $total_tax && $obj['total_tax'] = $total_tax; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxDetails && $obj['taxDetails'] = $taxDetails; + null !== $totalDiscount && $obj['totalDiscount'] = $totalDiscount; + null !== $totalTax && $obj['totalTax'] = $totalTax; null !== $vatex && $obj['vatex'] = $vatex; - null !== $vatex_note && $obj['vatex_note'] = $vatex_note; - null !== $vendor_address && $obj['vendor_address'] = $vendor_address; - null !== $vendor_address_recipient && $obj['vendor_address_recipient'] = $vendor_address_recipient; - null !== $vendor_company_id && $obj['vendor_company_id'] = $vendor_company_id; - null !== $vendor_email && $obj['vendor_email'] = $vendor_email; - null !== $vendor_name && $obj['vendor_name'] = $vendor_name; - null !== $vendor_tax_id && $obj['vendor_tax_id'] = $vendor_tax_id; + null !== $vatexNote && $obj['vatexNote'] = $vatexNote; + null !== $vendorAddress && $obj['vendorAddress'] = $vendorAddress; + null !== $vendorAddressRecipient && $obj['vendorAddressRecipient'] = $vendorAddressRecipient; + null !== $vendorCompanyID && $obj['vendorCompanyID'] = $vendorCompanyID; + null !== $vendorEmail && $obj['vendorEmail'] = $vendorEmail; + null !== $vendorName && $obj['vendorName'] = $vendorName; + null !== $vendorTaxID && $obj['vendorTaxID'] = $vendorTaxID; return $obj; } @@ -544,12 +548,12 @@ public static function with( /** * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $allowances */ public function withAllowances(?array $allowances): self @@ -566,17 +570,17 @@ public function withAllowances(?array $allowances): self public function withAmountDue(float|string|null $amountDue): self { $obj = clone $this; - $obj['amount_due'] = $amountDue; + $obj['amountDue'] = $amountDue; return $obj; } /** * @param list|null $attachments */ public function withAttachments(?array $attachments): self @@ -593,7 +597,7 @@ public function withAttachments(?array $attachments): self public function withBillingAddress(?string $billingAddress): self { $obj = clone $this; - $obj['billing_address'] = $billingAddress; + $obj['billingAddress'] = $billingAddress; return $obj; } @@ -605,7 +609,7 @@ public function withBillingAddressRecipient( ?string $billingAddressRecipient ): self { $obj = clone $this; - $obj['billing_address_recipient'] = $billingAddressRecipient; + $obj['billingAddressRecipient'] = $billingAddressRecipient; return $obj; } @@ -613,12 +617,12 @@ public function withBillingAddressRecipient( /** * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $charges */ public function withCharges(?array $charges): self @@ -648,7 +652,7 @@ public function withCurrency(CurrencyCode|string $currency): self public function withCustomerAddress(?string $customerAddress): self { $obj = clone $this; - $obj['customer_address'] = $customerAddress; + $obj['customerAddress'] = $customerAddress; return $obj; } @@ -660,7 +664,7 @@ public function withCustomerAddressRecipient( ?string $customerAddressRecipient ): self { $obj = clone $this; - $obj['customer_address_recipient'] = $customerAddressRecipient; + $obj['customerAddressRecipient'] = $customerAddressRecipient; return $obj; } @@ -671,7 +675,7 @@ public function withCustomerAddressRecipient( public function withCustomerCompanyID(?string $customerCompanyID): self { $obj = clone $this; - $obj['customer_company_id'] = $customerCompanyID; + $obj['customerCompanyID'] = $customerCompanyID; return $obj; } @@ -682,7 +686,7 @@ public function withCustomerCompanyID(?string $customerCompanyID): self public function withCustomerEmail(?string $customerEmail): self { $obj = clone $this; - $obj['customer_email'] = $customerEmail; + $obj['customerEmail'] = $customerEmail; return $obj; } @@ -693,7 +697,7 @@ public function withCustomerEmail(?string $customerEmail): self public function withCustomerID(?string $customerID): self { $obj = clone $this; - $obj['customer_id'] = $customerID; + $obj['customerID'] = $customerID; return $obj; } @@ -704,7 +708,7 @@ public function withCustomerID(?string $customerID): self public function withCustomerName(?string $customerName): self { $obj = clone $this; - $obj['customer_name'] = $customerName; + $obj['customerName'] = $customerName; return $obj; } @@ -715,7 +719,7 @@ public function withCustomerName(?string $customerName): self public function withCustomerTaxID(?string $customerTaxID): self { $obj = clone $this; - $obj['customer_tax_id'] = $customerTaxID; + $obj['customerTaxID'] = $customerTaxID; return $obj; } @@ -741,7 +745,7 @@ public function withDirection(DocumentDirection|string $direction): self public function withDocumentType(DocumentType|string $documentType): self { $obj = clone $this; - $obj['document_type'] = $documentType; + $obj['documentType'] = $documentType; return $obj; } @@ -752,7 +756,7 @@ public function withDocumentType(DocumentType|string $documentType): self public function withDueDate(?\DateTimeInterface $dueDate): self { $obj = clone $this; - $obj['due_date'] = $dueDate; + $obj['dueDate'] = $dueDate; return $obj; } @@ -763,7 +767,7 @@ public function withDueDate(?\DateTimeInterface $dueDate): self public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self { $obj = clone $this; - $obj['invoice_date'] = $invoiceDate; + $obj['invoiceDate'] = $invoiceDate; return $obj; } @@ -774,7 +778,7 @@ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self public function withInvoiceID(?string $invoiceID): self { $obj = clone $this; - $obj['invoice_id'] = $invoiceID; + $obj['invoiceID'] = $invoiceID; return $obj; } @@ -785,7 +789,7 @@ public function withInvoiceID(?string $invoiceID): self public function withInvoiceTotal(float|string|null $invoiceTotal): self { $obj = clone $this; - $obj['invoice_total'] = $invoiceTotal; + $obj['invoiceTotal'] = $invoiceTotal; return $obj; } @@ -799,12 +803,12 @@ public function withInvoiceTotal(float|string|null $invoiceTotal): self * charges?: list|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: float|string|null, * tax?: float|string|null, - * tax_rate?: float|string|null, + * taxRate?: float|string|null, * unit?: value-of|null, - * unit_price?: float|string|null, + * unitPrice?: float|string|null, * }> $items */ public function withItems(array $items): self @@ -828,16 +832,16 @@ public function withNote(?string $note): self /** * @param list|null $paymentDetails */ public function withPaymentDetails(?array $paymentDetails): self { $obj = clone $this; - $obj['payment_details'] = $paymentDetails; + $obj['paymentDetails'] = $paymentDetails; return $obj; } @@ -848,7 +852,7 @@ public function withPaymentDetails(?array $paymentDetails): self public function withPaymentTerm(?string $paymentTerm): self { $obj = clone $this; - $obj['payment_term'] = $paymentTerm; + $obj['paymentTerm'] = $paymentTerm; return $obj; } @@ -860,7 +864,7 @@ public function withPreviousUnpaidBalance( float|string|null $previousUnpaidBalance ): self { $obj = clone $this; - $obj['previous_unpaid_balance'] = $previousUnpaidBalance; + $obj['previousUnpaidBalance'] = $previousUnpaidBalance; return $obj; } @@ -871,7 +875,7 @@ public function withPreviousUnpaidBalance( public function withPurchaseOrder(?string $purchaseOrder): self { $obj = clone $this; - $obj['purchase_order'] = $purchaseOrder; + $obj['purchaseOrder'] = $purchaseOrder; return $obj; } @@ -882,7 +886,7 @@ public function withPurchaseOrder(?string $purchaseOrder): self public function withRemittanceAddress(?string $remittanceAddress): self { $obj = clone $this; - $obj['remittance_address'] = $remittanceAddress; + $obj['remittanceAddress'] = $remittanceAddress; return $obj; } @@ -894,7 +898,7 @@ public function withRemittanceAddressRecipient( ?string $remittanceAddressRecipient ): self { $obj = clone $this; - $obj['remittance_address_recipient'] = $remittanceAddressRecipient; + $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; return $obj; } @@ -905,7 +909,7 @@ public function withRemittanceAddressRecipient( public function withServiceAddress(?string $serviceAddress): self { $obj = clone $this; - $obj['service_address'] = $serviceAddress; + $obj['serviceAddress'] = $serviceAddress; return $obj; } @@ -917,7 +921,7 @@ public function withServiceAddressRecipient( ?string $serviceAddressRecipient ): self { $obj = clone $this; - $obj['service_address_recipient'] = $serviceAddressRecipient; + $obj['serviceAddressRecipient'] = $serviceAddressRecipient; return $obj; } @@ -929,7 +933,7 @@ public function withServiceEndDate( ?\DateTimeInterface $serviceEndDate ): self { $obj = clone $this; - $obj['service_end_date'] = $serviceEndDate; + $obj['serviceEndDate'] = $serviceEndDate; return $obj; } @@ -941,7 +945,7 @@ public function withServiceStartDate( ?\DateTimeInterface $serviceStartDate ): self { $obj = clone $this; - $obj['service_start_date'] = $serviceStartDate; + $obj['serviceStartDate'] = $serviceStartDate; return $obj; } @@ -952,7 +956,7 @@ public function withServiceStartDate( public function withShippingAddress(?string $shippingAddress): self { $obj = clone $this; - $obj['shipping_address'] = $shippingAddress; + $obj['shippingAddress'] = $shippingAddress; return $obj; } @@ -964,7 +968,7 @@ public function withShippingAddressRecipient( ?string $shippingAddressRecipient ): self { $obj = clone $this; - $obj['shipping_address_recipient'] = $shippingAddressRecipient; + $obj['shippingAddressRecipient'] = $shippingAddressRecipient; return $obj; } @@ -1001,7 +1005,7 @@ public function withSubtotal(float|string|null $subtotal): self public function withTaxCode(TaxCode|string $taxCode): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -1014,7 +1018,7 @@ public function withTaxCode(TaxCode|string $taxCode): self public function withTaxDetails(?array $taxDetails): self { $obj = clone $this; - $obj['tax_details'] = $taxDetails; + $obj['taxDetails'] = $taxDetails; return $obj; } @@ -1025,7 +1029,7 @@ public function withTaxDetails(?array $taxDetails): self public function withTotalDiscount(float|string|null $totalDiscount): self { $obj = clone $this; - $obj['total_discount'] = $totalDiscount; + $obj['totalDiscount'] = $totalDiscount; return $obj; } @@ -1036,7 +1040,7 @@ public function withTotalDiscount(float|string|null $totalDiscount): self public function withTotalTax(float|string|null $totalTax): self { $obj = clone $this; - $obj['total_tax'] = $totalTax; + $obj['totalTax'] = $totalTax; return $obj; } @@ -1063,7 +1067,7 @@ public function withVatex(Vatex|string|null $vatex): self public function withVatexNote(?string $vatexNote): self { $obj = clone $this; - $obj['vatex_note'] = $vatexNote; + $obj['vatexNote'] = $vatexNote; return $obj; } @@ -1074,7 +1078,7 @@ public function withVatexNote(?string $vatexNote): self public function withVendorAddress(?string $vendorAddress): self { $obj = clone $this; - $obj['vendor_address'] = $vendorAddress; + $obj['vendorAddress'] = $vendorAddress; return $obj; } @@ -1086,7 +1090,7 @@ public function withVendorAddressRecipient( ?string $vendorAddressRecipient ): self { $obj = clone $this; - $obj['vendor_address_recipient'] = $vendorAddressRecipient; + $obj['vendorAddressRecipient'] = $vendorAddressRecipient; return $obj; } @@ -1097,7 +1101,7 @@ public function withVendorAddressRecipient( public function withVendorCompanyID(?string $vendorCompanyID): self { $obj = clone $this; - $obj['vendor_company_id'] = $vendorCompanyID; + $obj['vendorCompanyID'] = $vendorCompanyID; return $obj; } @@ -1108,7 +1112,7 @@ public function withVendorCompanyID(?string $vendorCompanyID): self public function withVendorEmail(?string $vendorEmail): self { $obj = clone $this; - $obj['vendor_email'] = $vendorEmail; + $obj['vendorEmail'] = $vendorEmail; return $obj; } @@ -1119,7 +1123,7 @@ public function withVendorEmail(?string $vendorEmail): self public function withVendorName(?string $vendorName): self { $obj = clone $this; - $obj['vendor_name'] = $vendorName; + $obj['vendorName'] = $vendorName; return $obj; } @@ -1130,7 +1134,7 @@ public function withVendorName(?string $vendorName): self public function withVendorTaxID(?string $vendorTaxID): self { $obj = clone $this; - $obj['vendor_tax_id'] = $vendorTaxID; + $obj['vendorTaxID'] = $vendorTaxID; return $obj; } diff --git a/src/Documents/DocumentCreate/Allowance.php b/src/Documents/DocumentCreate/Allowance.php index 0c3e5fea..ab61142d 100644 --- a/src/Documents/DocumentCreate/Allowance.php +++ b/src/Documents/DocumentCreate/Allowance.php @@ -15,12 +15,12 @@ * * @phpstan-type AllowanceShape = array{ * amount?: float|string|null, - * base_amount?: float|string|null, - * multiplier_factor?: float|string|null, + * baseAmount?: float|string|null, + * multiplierFactor?: float|string|null, * reason?: string|null, - * reason_code?: value-of|null, - * tax_code?: value-of<\EInvoiceAPI\Documents\DocumentCreate\Allowance\TaxCode>|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of<\EInvoiceAPI\Documents\DocumentCreate\Allowance\TaxCode>|null, + * taxRate?: float|string|null, * } */ final class Allowance implements BaseModel @@ -37,14 +37,14 @@ final class Allowance implements BaseModel /** * The base amount that may be used, in conjunction with the allowance percentage, to calculate the allowance amount. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $base_amount; + #[Optional('base_amount', nullable: true)] + public float|string|null $baseAmount; /** * The percentage that may be used, in conjunction with the allowance base amount, to calculate the allowance amount. To state 20%, use value 20. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $multiplier_factor; + #[Optional('multiplier_factor', nullable: true)] + public float|string|null $multiplierFactor; /** * The reason for the allowance. @@ -55,26 +55,27 @@ final class Allowance implements BaseModel /** * Allowance reason codes for invoice discounts and charges. * - * @var value-of|null $reason_code + * @var value-of|null $reasonCode */ - #[Optional(enum: ReasonCode::class, nullable: true)] - public ?string $reason_code; + #[Optional('reason_code', enum: ReasonCode::class, nullable: true)] + public ?string $reasonCode; /** * The VAT category code that applies to the allowance. * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ #[Optional( - enum: TaxCode::class + 'tax_code', + enum: TaxCode::class, )] - public ?string $tax_code; + public ?string $taxCode; /** * The VAT rate, represented as percentage that applies to the allowance. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $tax_rate; + #[Optional('tax_rate', nullable: true)] + public float|string|null $taxRate; public function __construct() { @@ -86,27 +87,27 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ReasonCode|value-of|null $reason_code - * @param TaxCode|value-of $tax_code + * @param ReasonCode|value-of|null $reasonCode + * @param TaxCode|value-of $taxCode */ public static function with( float|string|null $amount = null, - float|string|null $base_amount = null, - float|string|null $multiplier_factor = null, + float|string|null $baseAmount = null, + float|string|null $multiplierFactor = null, ?string $reason = null, - ReasonCode|string|null $reason_code = null, - TaxCode|string|null $tax_code = null, - float|string|null $tax_rate = null, + ReasonCode|string|null $reasonCode = null, + TaxCode|string|null $taxCode = null, + float|string|null $taxRate = null, ): self { $obj = new self; null !== $amount && $obj['amount'] = $amount; - null !== $base_amount && $obj['base_amount'] = $base_amount; - null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $baseAmount && $obj['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; null !== $reason && $obj['reason'] = $reason; - null !== $reason_code && $obj['reason_code'] = $reason_code; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $reasonCode && $obj['reasonCode'] = $reasonCode; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxRate && $obj['taxRate'] = $taxRate; return $obj; } @@ -128,7 +129,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj['base_amount'] = $baseAmount; + $obj['baseAmount'] = $baseAmount; return $obj; } @@ -140,7 +141,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj['multiplier_factor'] = $multiplierFactor; + $obj['multiplierFactor'] = $multiplierFactor; return $obj; } @@ -164,7 +165,7 @@ public function withReason(?string $reason): self public function withReasonCode(ReasonCode|string|null $reasonCode): self { $obj = clone $this; - $obj['reason_code'] = $reasonCode; + $obj['reasonCode'] = $reasonCode; return $obj; } @@ -178,7 +179,7 @@ public function withTaxCode( TaxCode|string $taxCode ): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -189,7 +190,7 @@ public function withTaxCode( public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentCreate/Charge.php b/src/Documents/DocumentCreate/Charge.php index bf566aa8..48a63e1b 100644 --- a/src/Documents/DocumentCreate/Charge.php +++ b/src/Documents/DocumentCreate/Charge.php @@ -15,12 +15,12 @@ * * @phpstan-type ChargeShape = array{ * amount?: float|string|null, - * base_amount?: float|string|null, - * multiplier_factor?: float|string|null, + * baseAmount?: float|string|null, + * multiplierFactor?: float|string|null, * reason?: string|null, - * reason_code?: value-of|null, - * tax_code?: value-of<\EInvoiceAPI\Documents\DocumentCreate\Charge\TaxCode>|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of<\EInvoiceAPI\Documents\DocumentCreate\Charge\TaxCode>|null, + * taxRate?: float|string|null, * } */ final class Charge implements BaseModel @@ -37,14 +37,14 @@ final class Charge implements BaseModel /** * The base amount that may be used, in conjunction with the charge percentage, to calculate the charge amount. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $base_amount; + #[Optional('base_amount', nullable: true)] + public float|string|null $baseAmount; /** * The percentage that may be used, in conjunction with the charge base amount, to calculate the charge amount. To state 20%, use value 20. */ - #[Optional(nullable: true)] - public float|string|null $multiplier_factor; + #[Optional('multiplier_factor', nullable: true)] + public float|string|null $multiplierFactor; /** * The reason for the charge. @@ -55,10 +55,10 @@ final class Charge implements BaseModel /** * Charge reason codes for invoice charges and fees. * - * @var value-of|null $reason_code + * @var value-of|null $reasonCode */ - #[Optional(enum: ReasonCode::class, nullable: true)] - public ?string $reason_code; + #[Optional('reason_code', enum: ReasonCode::class, nullable: true)] + public ?string $reasonCode; /** * Duty or tax or fee category codes (Subset of UNCL5305). @@ -67,19 +67,20 @@ final class Charge implements BaseModel * Version: D.16B * Subset: OpenPEPPOL * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ #[Optional( + 'tax_code', enum: TaxCode::class, nullable: true, )] - public ?string $tax_code; + public ?string $taxCode; /** * The VAT rate, represented as percentage that applies to the charge. */ - #[Optional(nullable: true)] - public float|string|null $tax_rate; + #[Optional('tax_rate', nullable: true)] + public float|string|null $taxRate; public function __construct() { @@ -91,27 +92,27 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ReasonCode|value-of|null $reason_code - * @param TaxCode|value-of|null $tax_code + * @param ReasonCode|value-of|null $reasonCode + * @param TaxCode|value-of|null $taxCode */ public static function with( float|string|null $amount = null, - float|string|null $base_amount = null, - float|string|null $multiplier_factor = null, + float|string|null $baseAmount = null, + float|string|null $multiplierFactor = null, ?string $reason = null, - ReasonCode|string|null $reason_code = null, - TaxCode|string|null $tax_code = null, - float|string|null $tax_rate = null, + ReasonCode|string|null $reasonCode = null, + TaxCode|string|null $taxCode = null, + float|string|null $taxRate = null, ): self { $obj = new self; null !== $amount && $obj['amount'] = $amount; - null !== $base_amount && $obj['base_amount'] = $base_amount; - null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $baseAmount && $obj['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; null !== $reason && $obj['reason'] = $reason; - null !== $reason_code && $obj['reason_code'] = $reason_code; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $reasonCode && $obj['reasonCode'] = $reasonCode; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxRate && $obj['taxRate'] = $taxRate; return $obj; } @@ -133,7 +134,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj['base_amount'] = $baseAmount; + $obj['baseAmount'] = $baseAmount; return $obj; } @@ -145,7 +146,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj['multiplier_factor'] = $multiplierFactor; + $obj['multiplierFactor'] = $multiplierFactor; return $obj; } @@ -169,7 +170,7 @@ public function withReason(?string $reason): self public function withReasonCode(ReasonCode|string|null $reasonCode): self { $obj = clone $this; - $obj['reason_code'] = $reasonCode; + $obj['reasonCode'] = $reasonCode; return $obj; } @@ -187,7 +188,7 @@ public function withTaxCode( TaxCode|string|null $taxCode ): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -198,7 +199,7 @@ public function withTaxCode( public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentCreate/Item.php b/src/Documents/DocumentCreate/Item.php index 1483f0eb..7a62b6fc 100644 --- a/src/Documents/DocumentCreate/Item.php +++ b/src/Documents/DocumentCreate/Item.php @@ -20,12 +20,12 @@ * charges?: list<\EInvoiceAPI\Documents\DocumentCreate\Item\Charge>|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: float|string|null, * tax?: float|string|null, - * tax_rate?: float|string|null, + * taxRate?: float|string|null, * unit?: value-of|null, - * unit_price?: float|string|null, + * unitPrice?: float|string|null, * } */ final class Item implements BaseModel @@ -74,8 +74,8 @@ final class Item implements BaseModel /** * The product code of the line item. */ - #[Optional(nullable: true)] - public ?string $product_code; + #[Optional('product_code', nullable: true)] + public ?string $productCode; /** * The quantity of items (goods or services) that is the subject of the line item. Must be rounded to maximum 4 decimals. Can be negative for credit notes or corrections. @@ -92,8 +92,8 @@ final class Item implements BaseModel /** * The VAT rate of the line item expressed as percentage with 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $tax_rate; + #[Optional('tax_rate', nullable: true)] + public float|string|null $taxRate; /** * Unit of Measure Codes from UNECERec20 used in Peppol BIS Billing 3.0. @@ -106,8 +106,8 @@ final class Item implements BaseModel /** * The item net price (BT-146). The price of an item, exclusive of VAT, after subtracting item price discount. Must be rounded to maximum 4 decimals. */ - #[Optional(nullable: true)] - public float|string|null $unit_price; + #[Optional('unit_price', nullable: true)] + public float|string|null $unitPrice; public function __construct() { @@ -121,21 +121,21 @@ public function __construct() * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $allowances * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $charges * @param UnitOfMeasureCode|value-of|null $unit */ @@ -145,12 +145,12 @@ public static function with( ?array $charges = null, null $date = null, ?string $description = null, - ?string $product_code = null, + ?string $productCode = null, float|string|null $quantity = null, float|string|null $tax = null, - float|string|null $tax_rate = null, + float|string|null $taxRate = null, UnitOfMeasureCode|string|null $unit = null, - float|string|null $unit_price = null, + float|string|null $unitPrice = null, ): self { $obj = new self; @@ -160,12 +160,12 @@ public static function with( null !== $amount && $obj['amount'] = $amount; null !== $charges && $obj['charges'] = $charges; null !== $description && $obj['description'] = $description; - null !== $product_code && $obj['product_code'] = $product_code; + null !== $productCode && $obj['productCode'] = $productCode; null !== $quantity && $obj['quantity'] = $quantity; null !== $tax && $obj['tax'] = $tax; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $taxRate && $obj['taxRate'] = $taxRate; null !== $unit && $obj['unit'] = $unit; - null !== $unit_price && $obj['unit_price'] = $unit_price; + null !== $unitPrice && $obj['unitPrice'] = $unitPrice; return $obj; } @@ -175,12 +175,12 @@ public static function with( * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $allowances */ public function withAllowances(?array $allowances): self @@ -207,12 +207,12 @@ public function withAmount(float|string|null $amount): self * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $charges */ public function withCharges(?array $charges): self @@ -251,7 +251,7 @@ public function withDescription(?string $description): self public function withProductCode(?string $productCode): self { $obj = clone $this; - $obj['product_code'] = $productCode; + $obj['productCode'] = $productCode; return $obj; } @@ -284,7 +284,7 @@ public function withTax(float|string|null $tax): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } @@ -308,7 +308,7 @@ public function withUnit(UnitOfMeasureCode|string|null $unit): self public function withUnitPrice(float|string|null $unitPrice): self { $obj = clone $this; - $obj['unit_price'] = $unitPrice; + $obj['unitPrice'] = $unitPrice; return $obj; } diff --git a/src/Documents/DocumentCreate/Item/Allowance.php b/src/Documents/DocumentCreate/Item/Allowance.php index 0c952a30..78d315bc 100644 --- a/src/Documents/DocumentCreate/Item/Allowance.php +++ b/src/Documents/DocumentCreate/Item/Allowance.php @@ -15,12 +15,12 @@ * * @phpstan-type AllowanceShape = array{ * amount?: float|string|null, - * base_amount?: float|string|null, - * multiplier_factor?: float|string|null, + * baseAmount?: float|string|null, + * multiplierFactor?: float|string|null, * reason?: string|null, - * reason_code?: value-of|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * } */ final class Allowance implements BaseModel @@ -37,14 +37,14 @@ final class Allowance implements BaseModel /** * The base amount that may be used, in conjunction with the allowance percentage, to calculate the allowance amount. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $base_amount; + #[Optional('base_amount', nullable: true)] + public float|string|null $baseAmount; /** * The percentage that may be used, in conjunction with the allowance base amount, to calculate the allowance amount. To state 20%, use value 20. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $multiplier_factor; + #[Optional('multiplier_factor', nullable: true)] + public float|string|null $multiplierFactor; /** * The reason for the allowance. @@ -55,24 +55,24 @@ final class Allowance implements BaseModel /** * Allowance reason codes for invoice discounts and charges. * - * @var value-of|null $reason_code + * @var value-of|null $reasonCode */ - #[Optional(enum: ReasonCode::class, nullable: true)] - public ?string $reason_code; + #[Optional('reason_code', enum: ReasonCode::class, nullable: true)] + public ?string $reasonCode; /** * The VAT category code that applies to the allowance. * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ - #[Optional(enum: TaxCode::class)] - public ?string $tax_code; + #[Optional('tax_code', enum: TaxCode::class)] + public ?string $taxCode; /** * The VAT rate, represented as percentage that applies to the allowance. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $tax_rate; + #[Optional('tax_rate', nullable: true)] + public float|string|null $taxRate; public function __construct() { @@ -84,27 +84,27 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ReasonCode|value-of|null $reason_code - * @param TaxCode|value-of $tax_code + * @param ReasonCode|value-of|null $reasonCode + * @param TaxCode|value-of $taxCode */ public static function with( float|string|null $amount = null, - float|string|null $base_amount = null, - float|string|null $multiplier_factor = null, + float|string|null $baseAmount = null, + float|string|null $multiplierFactor = null, ?string $reason = null, - ReasonCode|string|null $reason_code = null, - TaxCode|string|null $tax_code = null, - float|string|null $tax_rate = null, + ReasonCode|string|null $reasonCode = null, + TaxCode|string|null $taxCode = null, + float|string|null $taxRate = null, ): self { $obj = new self; null !== $amount && $obj['amount'] = $amount; - null !== $base_amount && $obj['base_amount'] = $base_amount; - null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $baseAmount && $obj['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; null !== $reason && $obj['reason'] = $reason; - null !== $reason_code && $obj['reason_code'] = $reason_code; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $reasonCode && $obj['reasonCode'] = $reasonCode; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxRate && $obj['taxRate'] = $taxRate; return $obj; } @@ -126,7 +126,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj['base_amount'] = $baseAmount; + $obj['baseAmount'] = $baseAmount; return $obj; } @@ -138,7 +138,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj['multiplier_factor'] = $multiplierFactor; + $obj['multiplierFactor'] = $multiplierFactor; return $obj; } @@ -162,7 +162,7 @@ public function withReason(?string $reason): self public function withReasonCode(ReasonCode|string|null $reasonCode): self { $obj = clone $this; - $obj['reason_code'] = $reasonCode; + $obj['reasonCode'] = $reasonCode; return $obj; } @@ -175,7 +175,7 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self public function withTaxCode(TaxCode|string $taxCode): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -186,7 +186,7 @@ public function withTaxCode(TaxCode|string $taxCode): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentCreate/Item/Charge.php b/src/Documents/DocumentCreate/Item/Charge.php index 68368a2b..da32a271 100644 --- a/src/Documents/DocumentCreate/Item/Charge.php +++ b/src/Documents/DocumentCreate/Item/Charge.php @@ -15,12 +15,12 @@ * * @phpstan-type ChargeShape = array{ * amount?: float|string|null, - * base_amount?: float|string|null, - * multiplier_factor?: float|string|null, + * baseAmount?: float|string|null, + * multiplierFactor?: float|string|null, * reason?: string|null, - * reason_code?: value-of|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * } */ final class Charge implements BaseModel @@ -37,14 +37,14 @@ final class Charge implements BaseModel /** * The base amount that may be used, in conjunction with the charge percentage, to calculate the charge amount. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $base_amount; + #[Optional('base_amount', nullable: true)] + public float|string|null $baseAmount; /** * The percentage that may be used, in conjunction with the charge base amount, to calculate the charge amount. To state 20%, use value 20. */ - #[Optional(nullable: true)] - public float|string|null $multiplier_factor; + #[Optional('multiplier_factor', nullable: true)] + public float|string|null $multiplierFactor; /** * The reason for the charge. @@ -55,10 +55,10 @@ final class Charge implements BaseModel /** * Charge reason codes for invoice charges and fees. * - * @var value-of|null $reason_code + * @var value-of|null $reasonCode */ - #[Optional(enum: ReasonCode::class, nullable: true)] - public ?string $reason_code; + #[Optional('reason_code', enum: ReasonCode::class, nullable: true)] + public ?string $reasonCode; /** * Duty or tax or fee category codes (Subset of UNCL5305). @@ -67,16 +67,16 @@ final class Charge implements BaseModel * Version: D.16B * Subset: OpenPEPPOL * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ - #[Optional(enum: TaxCode::class, nullable: true)] - public ?string $tax_code; + #[Optional('tax_code', enum: TaxCode::class, nullable: true)] + public ?string $taxCode; /** * The VAT rate, represented as percentage that applies to the charge. */ - #[Optional(nullable: true)] - public float|string|null $tax_rate; + #[Optional('tax_rate', nullable: true)] + public float|string|null $taxRate; public function __construct() { @@ -88,27 +88,27 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ReasonCode|value-of|null $reason_code - * @param TaxCode|value-of|null $tax_code + * @param ReasonCode|value-of|null $reasonCode + * @param TaxCode|value-of|null $taxCode */ public static function with( float|string|null $amount = null, - float|string|null $base_amount = null, - float|string|null $multiplier_factor = null, + float|string|null $baseAmount = null, + float|string|null $multiplierFactor = null, ?string $reason = null, - ReasonCode|string|null $reason_code = null, - TaxCode|string|null $tax_code = null, - float|string|null $tax_rate = null, + ReasonCode|string|null $reasonCode = null, + TaxCode|string|null $taxCode = null, + float|string|null $taxRate = null, ): self { $obj = new self; null !== $amount && $obj['amount'] = $amount; - null !== $base_amount && $obj['base_amount'] = $base_amount; - null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $baseAmount && $obj['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; null !== $reason && $obj['reason'] = $reason; - null !== $reason_code && $obj['reason_code'] = $reason_code; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $reasonCode && $obj['reasonCode'] = $reasonCode; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxRate && $obj['taxRate'] = $taxRate; return $obj; } @@ -130,7 +130,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj['base_amount'] = $baseAmount; + $obj['baseAmount'] = $baseAmount; return $obj; } @@ -142,7 +142,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj['multiplier_factor'] = $multiplierFactor; + $obj['multiplierFactor'] = $multiplierFactor; return $obj; } @@ -166,7 +166,7 @@ public function withReason(?string $reason): self public function withReasonCode(ReasonCode|string|null $reasonCode): self { $obj = clone $this; - $obj['reason_code'] = $reasonCode; + $obj['reasonCode'] = $reasonCode; return $obj; } @@ -183,7 +183,7 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self public function withTaxCode(TaxCode|string|null $taxCode): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -194,7 +194,7 @@ public function withTaxCode(TaxCode|string|null $taxCode): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentCreateFromPdfParams.php b/src/Documents/DocumentCreateFromPdfParams.php index 8a818303..5af6556d 100644 --- a/src/Documents/DocumentCreateFromPdfParams.php +++ b/src/Documents/DocumentCreateFromPdfParams.php @@ -16,7 +16,7 @@ * @see EInvoiceAPI\Services\DocumentsService::createFromPdf() * * @phpstan-type DocumentCreateFromPdfParamsShape = array{ - * file: string, customer_tax_id?: string|null, vendor_tax_id?: string|null + * file: string, customerTaxID?: string|null, vendorTaxID?: string|null * } */ final class DocumentCreateFromPdfParams implements BaseModel @@ -29,10 +29,10 @@ final class DocumentCreateFromPdfParams implements BaseModel public string $file; #[Optional(nullable: true)] - public ?string $customer_tax_id; + public ?string $customerTaxID; #[Optional(nullable: true)] - public ?string $vendor_tax_id; + public ?string $vendorTaxID; /** * `new DocumentCreateFromPdfParams()` is missing required properties by the API. @@ -60,15 +60,15 @@ public function __construct() */ public static function with( string $file, - ?string $customer_tax_id = null, - ?string $vendor_tax_id = null + ?string $customerTaxID = null, + ?string $vendorTaxID = null ): self { $obj = new self; $obj['file'] = $file; - null !== $customer_tax_id && $obj['customer_tax_id'] = $customer_tax_id; - null !== $vendor_tax_id && $obj['vendor_tax_id'] = $vendor_tax_id; + null !== $customerTaxID && $obj['customerTaxID'] = $customerTaxID; + null !== $vendorTaxID && $obj['vendorTaxID'] = $vendorTaxID; return $obj; } @@ -84,7 +84,7 @@ public function withFile(string $file): self public function withCustomerTaxID(?string $customerTaxID): self { $obj = clone $this; - $obj['customer_tax_id'] = $customerTaxID; + $obj['customerTaxID'] = $customerTaxID; return $obj; } @@ -92,7 +92,7 @@ public function withCustomerTaxID(?string $customerTaxID): self public function withVendorTaxID(?string $vendorTaxID): self { $obj = clone $this; - $obj['vendor_tax_id'] = $vendorTaxID; + $obj['vendorTaxID'] = $vendorTaxID; return $obj; } diff --git a/src/Documents/DocumentCreateParams.php b/src/Documents/DocumentCreateParams.php index 9b1f34b1..bfa82c7f 100644 --- a/src/Documents/DocumentCreateParams.php +++ b/src/Documents/DocumentCreateParams.php @@ -25,92 +25,92 @@ * @phpstan-type DocumentCreateParamsShape = array{ * allowances?: list<\EInvoiceAPI\Documents\DocumentCreateParams\Allowance|array{ * amount?: float|string|null, - * base_amount?: float|string|null, - * multiplier_factor?: float|string|null, + * baseAmount?: float|string|null, + * multiplierFactor?: float|string|null, * reason?: string|null, - * reason_code?: value-of|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null, - * amount_due?: float|string|null, + * amountDue?: float|string|null, * attachments?: list|null, - * billing_address?: string|null, - * billing_address_recipient?: string|null, + * billingAddress?: string|null, + * billingAddressRecipient?: string|null, * charges?: list<\EInvoiceAPI\Documents\DocumentCreateParams\Charge|array{ * amount?: float|string|null, - * base_amount?: float|string|null, - * multiplier_factor?: float|string|null, + * baseAmount?: float|string|null, + * multiplierFactor?: float|string|null, * reason?: string|null, - * reason_code?: value-of<\EInvoiceAPI\Documents\DocumentCreateParams\Charge\ReasonCode>|null, - * tax_code?: value-of<\EInvoiceAPI\Documents\DocumentCreateParams\Charge\TaxCode>|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of<\EInvoiceAPI\Documents\DocumentCreateParams\Charge\ReasonCode>|null, + * taxCode?: value-of<\EInvoiceAPI\Documents\DocumentCreateParams\Charge\TaxCode>|null, + * taxRate?: float|string|null, * }>|null, * currency?: CurrencyCode|value-of, - * customer_address?: string|null, - * customer_address_recipient?: string|null, - * customer_company_id?: string|null, - * customer_email?: string|null, - * customer_id?: string|null, - * customer_name?: string|null, - * customer_tax_id?: string|null, + * customerAddress?: string|null, + * customerAddressRecipient?: string|null, + * customerCompanyID?: string|null, + * customerEmail?: string|null, + * customerID?: string|null, + * customerName?: string|null, + * customerTaxID?: string|null, * direction?: DocumentDirection|value-of, - * document_type?: DocumentType|value-of, - * due_date?: \DateTimeInterface|null, - * invoice_date?: \DateTimeInterface|null, - * invoice_id?: string|null, - * invoice_total?: float|string|null, + * documentType?: DocumentType|value-of, + * dueDate?: \DateTimeInterface|null, + * invoiceDate?: \DateTimeInterface|null, + * invoiceID?: string|null, + * invoiceTotal?: float|string|null, * items?: list|null, * amount?: float|string|null, * charges?: list<\EInvoiceAPI\Documents\DocumentCreateParams\Item\Charge>|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: float|string|null, * tax?: float|string|null, - * tax_rate?: float|string|null, + * taxRate?: float|string|null, * unit?: value-of|null, - * unit_price?: float|string|null, + * unitPrice?: float|string|null, * }>, * note?: string|null, - * payment_details?: list|null, - * payment_term?: string|null, - * previous_unpaid_balance?: float|string|null, - * purchase_order?: string|null, - * remittance_address?: string|null, - * remittance_address_recipient?: string|null, - * service_address?: string|null, - * service_address_recipient?: string|null, - * service_end_date?: \DateTimeInterface|null, - * service_start_date?: \DateTimeInterface|null, - * shipping_address?: string|null, - * shipping_address_recipient?: string|null, + * paymentTerm?: string|null, + * previousUnpaidBalance?: float|string|null, + * purchaseOrder?: string|null, + * remittanceAddress?: string|null, + * remittanceAddressRecipient?: string|null, + * serviceAddress?: string|null, + * serviceAddressRecipient?: string|null, + * serviceEndDate?: \DateTimeInterface|null, + * serviceStartDate?: \DateTimeInterface|null, + * shippingAddress?: string|null, + * shippingAddressRecipient?: string|null, * state?: DocumentState|value-of, * subtotal?: float|string|null, - * tax_code?: \EInvoiceAPI\Documents\DocumentCreateParams\TaxCode|value-of<\EInvoiceAPI\Documents\DocumentCreateParams\TaxCode>, - * tax_details?: list, + * taxDetails?: list|null, - * total_discount?: float|string|null, - * total_tax?: float|string|null, + * totalDiscount?: float|string|null, + * totalTax?: float|string|null, * vatex?: null|Vatex|value-of, - * vatex_note?: string|null, - * vendor_address?: string|null, - * vendor_address_recipient?: string|null, - * vendor_company_id?: string|null, - * vendor_email?: string|null, - * vendor_name?: string|null, - * vendor_tax_id?: string|null, + * vatexNote?: string|null, + * vendorAddress?: string|null, + * vendorAddressRecipient?: string|null, + * vendorCompanyID?: string|null, + * vendorEmail?: string|null, + * vendorName?: string|null, + * vendorTaxID?: string|null, * } */ final class DocumentCreateParams implements BaseModel @@ -131,8 +131,8 @@ final class DocumentCreateParams implements BaseModel /** * The amount due for payment. Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $amount_due; + #[Optional('amount_due', nullable: true)] + public float|string|null $amountDue; /** @var list|null $attachments */ #[Optional(list: DocumentAttachmentCreate::class, nullable: true)] @@ -141,14 +141,14 @@ final class DocumentCreateParams implements BaseModel /** * The billing address (if different from customer address). */ - #[Optional(nullable: true)] - public ?string $billing_address; + #[Optional('billing_address', nullable: true)] + public ?string $billingAddress; /** * The recipient name at the billing address. */ - #[Optional(nullable: true)] - public ?string $billing_address_recipient; + #[Optional('billing_address_recipient', nullable: true)] + public ?string $billingAddressRecipient; /** @var list|null $charges */ #[Optional( @@ -168,44 +168,44 @@ final class DocumentCreateParams implements BaseModel /** * The address of the customer/buyer. */ - #[Optional(nullable: true)] - public ?string $customer_address; + #[Optional('customer_address', nullable: true)] + public ?string $customerAddress; /** * The recipient name at the customer address. */ - #[Optional(nullable: true)] - public ?string $customer_address_recipient; + #[Optional('customer_address_recipient', nullable: true)] + public ?string $customerAddressRecipient; /** * Customer company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Optional(nullable: true)] - public ?string $customer_company_id; + #[Optional('customer_company_id', nullable: true)] + public ?string $customerCompanyID; /** * The email address of the customer. */ - #[Optional(nullable: true)] - public ?string $customer_email; + #[Optional('customer_email', nullable: true)] + public ?string $customerEmail; /** * The unique identifier for the customer in your system. */ - #[Optional(nullable: true)] - public ?string $customer_id; + #[Optional('customer_id', nullable: true)] + public ?string $customerID; /** * The company name of the customer/buyer. */ - #[Optional(nullable: true)] - public ?string $customer_name; + #[Optional('customer_name', nullable: true)] + public ?string $customerName; /** * Customer tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Optional(nullable: true)] - public ?string $customer_tax_id; + #[Optional('customer_tax_id', nullable: true)] + public ?string $customerTaxID; /** * The direction of the document: INBOUND (purchases) or OUTBOUND (sales). @@ -218,34 +218,34 @@ final class DocumentCreateParams implements BaseModel /** * The type of document: INVOICE, CREDIT_NOTE, or DEBIT_NOTE. * - * @var value-of|null $document_type + * @var value-of|null $documentType */ - #[Optional(enum: DocumentType::class)] - public ?string $document_type; + #[Optional('document_type', enum: DocumentType::class)] + public ?string $documentType; /** * The date when payment is due. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $due_date; + #[Optional('due_date', nullable: true)] + public ?\DateTimeInterface $dueDate; /** * The date when the invoice was issued. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $invoice_date; + #[Optional('invoice_date', nullable: true)] + public ?\DateTimeInterface $invoiceDate; /** * The unique invoice identifier/number. */ - #[Optional(nullable: true)] - public ?string $invoice_id; + #[Optional('invoice_id', nullable: true)] + public ?string $invoiceID; /** * The total amount of the invoice including tax (invoice_total = subtotal + total_tax + total_discount). Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $invoice_total; + #[Optional('invoice_total', nullable: true)] + public float|string|null $invoiceTotal; /** * At least one line item is required. @@ -261,75 +261,79 @@ final class DocumentCreateParams implements BaseModel #[Optional(nullable: true)] public ?string $note; - /** @var list|null $payment_details */ - #[Optional(list: PaymentDetailCreate::class, nullable: true)] - public ?array $payment_details; + /** @var list|null $paymentDetails */ + #[Optional( + 'payment_details', + list: PaymentDetailCreate::class, + nullable: true + )] + public ?array $paymentDetails; /** * The payment terms (e.g., 'Net 30', 'Due on receipt', '2/10 Net 30'). */ - #[Optional(nullable: true)] - public ?string $payment_term; + #[Optional('payment_term', nullable: true)] + public ?string $paymentTerm; /** * The previous unpaid balance from prior invoices, if any. Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $previous_unpaid_balance; + #[Optional('previous_unpaid_balance', nullable: true)] + public float|string|null $previousUnpaidBalance; /** * The purchase order reference number. */ - #[Optional(nullable: true)] - public ?string $purchase_order; + #[Optional('purchase_order', nullable: true)] + public ?string $purchaseOrder; /** * The address where payment should be sent or remitted to. */ - #[Optional(nullable: true)] - public ?string $remittance_address; + #[Optional('remittance_address', nullable: true)] + public ?string $remittanceAddress; /** * The recipient name at the remittance address. */ - #[Optional(nullable: true)] - public ?string $remittance_address_recipient; + #[Optional('remittance_address_recipient', nullable: true)] + public ?string $remittanceAddressRecipient; /** * The address where services were performed or goods were delivered. */ - #[Optional(nullable: true)] - public ?string $service_address; + #[Optional('service_address', nullable: true)] + public ?string $serviceAddress; /** * The recipient name at the service address. */ - #[Optional(nullable: true)] - public ?string $service_address_recipient; + #[Optional('service_address_recipient', nullable: true)] + public ?string $serviceAddressRecipient; /** * The end date of the service period or delivery period. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $service_end_date; + #[Optional('service_end_date', nullable: true)] + public ?\DateTimeInterface $serviceEndDate; /** * The start date of the service period or delivery period. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $service_start_date; + #[Optional('service_start_date', nullable: true)] + public ?\DateTimeInterface $serviceStartDate; /** * The shipping/delivery address. */ - #[Optional(nullable: true)] - public ?string $shipping_address; + #[Optional('shipping_address', nullable: true)] + public ?string $shippingAddress; /** * The recipient name at the shipping address. */ - #[Optional(nullable: true)] - public ?string $shipping_address_recipient; + #[Optional('shipping_address_recipient', nullable: true)] + public ?string $shippingAddressRecipient; /** * The current state of the document: DRAFT, TRANSIT, FAILED, SENT, or RECEIVED. @@ -348,26 +352,29 @@ final class DocumentCreateParams implements BaseModel /** * Tax category code of the invoice (e.g., S for standard rate, Z for zero rate, E for exempt). * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ - #[Optional(enum: DocumentCreateParams\TaxCode::class)] - public ?string $tax_code; + #[Optional( + 'tax_code', + enum: DocumentCreateParams\TaxCode::class + )] + public ?string $taxCode; - /** @var list|null $tax_details */ - #[Optional(list: TaxDetail::class, nullable: true)] - public ?array $tax_details; + /** @var list|null $taxDetails */ + #[Optional('tax_details', list: TaxDetail::class, nullable: true)] + public ?array $taxDetails; /** * The net financial discount/charge of the invoice (non-VAT charges minus non-VAT allowances). Can be positive (net charge), negative (net discount), or zero. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $total_discount; + #[Optional('total_discount', nullable: true)] + public float|string|null $totalDiscount; /** * The total tax amount of the invoice. Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $total_tax; + #[Optional('total_tax', nullable: true)] + public float|string|null $totalTax; /** * VATEX code list for VAT exemption reasons. @@ -383,44 +390,44 @@ final class DocumentCreateParams implements BaseModel /** * Textual explanation for VAT exemption. */ - #[Optional(nullable: true)] - public ?string $vatex_note; + #[Optional('vatex_note', nullable: true)] + public ?string $vatexNote; /** * The address of the vendor/seller. */ - #[Optional(nullable: true)] - public ?string $vendor_address; + #[Optional('vendor_address', nullable: true)] + public ?string $vendorAddress; /** * The recipient name at the vendor address. */ - #[Optional(nullable: true)] - public ?string $vendor_address_recipient; + #[Optional('vendor_address_recipient', nullable: true)] + public ?string $vendorAddressRecipient; /** * Vendor company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Optional(nullable: true)] - public ?string $vendor_company_id; + #[Optional('vendor_company_id', nullable: true)] + public ?string $vendorCompanyID; /** * The email address of the vendor. */ - #[Optional(nullable: true)] - public ?string $vendor_email; + #[Optional('vendor_email', nullable: true)] + public ?string $vendorEmail; /** * The name of the vendor/seller/supplier. */ - #[Optional(nullable: true)] - public ?string $vendor_name; + #[Optional('vendor_name', nullable: true)] + public ?string $vendorName; /** * Vendor tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Optional(nullable: true)] - public ?string $vendor_tax_id; + #[Optional('vendor_tax_id', nullable: true)] + public ?string $vendorTaxID; public function __construct() { @@ -434,157 +441,157 @@ public function __construct() * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $allowances * @param list|null $attachments * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $charges * @param CurrencyCode|value-of $currency * @param DocumentDirection|value-of $direction - * @param DocumentType|value-of $document_type + * @param DocumentType|value-of $documentType * @param list|null, * amount?: float|string|null, * charges?: list|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: float|string|null, * tax?: float|string|null, - * tax_rate?: float|string|null, + * taxRate?: float|string|null, * unit?: value-of|null, - * unit_price?: float|string|null, + * unitPrice?: float|string|null, * }> $items * @param list|null $payment_details + * }>|null $paymentDetails * @param DocumentState|value-of $state - * @param DocumentCreateParams\TaxCode|value-of $tax_code + * @param DocumentCreateParams\TaxCode|value-of $taxCode * @param list|null $tax_details + * }>|null $taxDetails * @param Vatex|value-of|null $vatex */ public static function with( ?array $allowances = null, - float|string|null $amount_due = null, + float|string|null $amountDue = null, ?array $attachments = null, - ?string $billing_address = null, - ?string $billing_address_recipient = null, + ?string $billingAddress = null, + ?string $billingAddressRecipient = null, ?array $charges = null, CurrencyCode|string|null $currency = null, - ?string $customer_address = null, - ?string $customer_address_recipient = null, - ?string $customer_company_id = null, - ?string $customer_email = null, - ?string $customer_id = null, - ?string $customer_name = null, - ?string $customer_tax_id = null, + ?string $customerAddress = null, + ?string $customerAddressRecipient = null, + ?string $customerCompanyID = null, + ?string $customerEmail = null, + ?string $customerID = null, + ?string $customerName = null, + ?string $customerTaxID = null, DocumentDirection|string|null $direction = null, - DocumentType|string|null $document_type = null, - ?\DateTimeInterface $due_date = null, - ?\DateTimeInterface $invoice_date = null, - ?string $invoice_id = null, - float|string|null $invoice_total = null, + DocumentType|string|null $documentType = null, + ?\DateTimeInterface $dueDate = null, + ?\DateTimeInterface $invoiceDate = null, + ?string $invoiceID = null, + float|string|null $invoiceTotal = null, ?array $items = null, ?string $note = null, - ?array $payment_details = null, - ?string $payment_term = null, - float|string|null $previous_unpaid_balance = null, - ?string $purchase_order = null, - ?string $remittance_address = null, - ?string $remittance_address_recipient = null, - ?string $service_address = null, - ?string $service_address_recipient = null, - ?\DateTimeInterface $service_end_date = null, - ?\DateTimeInterface $service_start_date = null, - ?string $shipping_address = null, - ?string $shipping_address_recipient = null, + ?array $paymentDetails = null, + ?string $paymentTerm = null, + float|string|null $previousUnpaidBalance = null, + ?string $purchaseOrder = null, + ?string $remittanceAddress = null, + ?string $remittanceAddressRecipient = null, + ?string $serviceAddress = null, + ?string $serviceAddressRecipient = null, + ?\DateTimeInterface $serviceEndDate = null, + ?\DateTimeInterface $serviceStartDate = null, + ?string $shippingAddress = null, + ?string $shippingAddressRecipient = null, DocumentState|string|null $state = null, float|string|null $subtotal = null, - DocumentCreateParams\TaxCode|string|null $tax_code = null, - ?array $tax_details = null, - float|string|null $total_discount = null, - float|string|null $total_tax = null, + DocumentCreateParams\TaxCode|string|null $taxCode = null, + ?array $taxDetails = null, + float|string|null $totalDiscount = null, + float|string|null $totalTax = null, Vatex|string|null $vatex = null, - ?string $vatex_note = null, - ?string $vendor_address = null, - ?string $vendor_address_recipient = null, - ?string $vendor_company_id = null, - ?string $vendor_email = null, - ?string $vendor_name = null, - ?string $vendor_tax_id = null, + ?string $vatexNote = null, + ?string $vendorAddress = null, + ?string $vendorAddressRecipient = null, + ?string $vendorCompanyID = null, + ?string $vendorEmail = null, + ?string $vendorName = null, + ?string $vendorTaxID = null, ): self { $obj = new self; null !== $allowances && $obj['allowances'] = $allowances; - null !== $amount_due && $obj['amount_due'] = $amount_due; + null !== $amountDue && $obj['amountDue'] = $amountDue; null !== $attachments && $obj['attachments'] = $attachments; - null !== $billing_address && $obj['billing_address'] = $billing_address; - null !== $billing_address_recipient && $obj['billing_address_recipient'] = $billing_address_recipient; + null !== $billingAddress && $obj['billingAddress'] = $billingAddress; + null !== $billingAddressRecipient && $obj['billingAddressRecipient'] = $billingAddressRecipient; null !== $charges && $obj['charges'] = $charges; null !== $currency && $obj['currency'] = $currency; - null !== $customer_address && $obj['customer_address'] = $customer_address; - null !== $customer_address_recipient && $obj['customer_address_recipient'] = $customer_address_recipient; - null !== $customer_company_id && $obj['customer_company_id'] = $customer_company_id; - null !== $customer_email && $obj['customer_email'] = $customer_email; - null !== $customer_id && $obj['customer_id'] = $customer_id; - null !== $customer_name && $obj['customer_name'] = $customer_name; - null !== $customer_tax_id && $obj['customer_tax_id'] = $customer_tax_id; + null !== $customerAddress && $obj['customerAddress'] = $customerAddress; + null !== $customerAddressRecipient && $obj['customerAddressRecipient'] = $customerAddressRecipient; + null !== $customerCompanyID && $obj['customerCompanyID'] = $customerCompanyID; + null !== $customerEmail && $obj['customerEmail'] = $customerEmail; + null !== $customerID && $obj['customerID'] = $customerID; + null !== $customerName && $obj['customerName'] = $customerName; + null !== $customerTaxID && $obj['customerTaxID'] = $customerTaxID; null !== $direction && $obj['direction'] = $direction; - null !== $document_type && $obj['document_type'] = $document_type; - null !== $due_date && $obj['due_date'] = $due_date; - null !== $invoice_date && $obj['invoice_date'] = $invoice_date; - null !== $invoice_id && $obj['invoice_id'] = $invoice_id; - null !== $invoice_total && $obj['invoice_total'] = $invoice_total; + null !== $documentType && $obj['documentType'] = $documentType; + null !== $dueDate && $obj['dueDate'] = $dueDate; + null !== $invoiceDate && $obj['invoiceDate'] = $invoiceDate; + null !== $invoiceID && $obj['invoiceID'] = $invoiceID; + null !== $invoiceTotal && $obj['invoiceTotal'] = $invoiceTotal; null !== $items && $obj['items'] = $items; null !== $note && $obj['note'] = $note; - null !== $payment_details && $obj['payment_details'] = $payment_details; - null !== $payment_term && $obj['payment_term'] = $payment_term; - null !== $previous_unpaid_balance && $obj['previous_unpaid_balance'] = $previous_unpaid_balance; - null !== $purchase_order && $obj['purchase_order'] = $purchase_order; - null !== $remittance_address && $obj['remittance_address'] = $remittance_address; - null !== $remittance_address_recipient && $obj['remittance_address_recipient'] = $remittance_address_recipient; - null !== $service_address && $obj['service_address'] = $service_address; - null !== $service_address_recipient && $obj['service_address_recipient'] = $service_address_recipient; - null !== $service_end_date && $obj['service_end_date'] = $service_end_date; - null !== $service_start_date && $obj['service_start_date'] = $service_start_date; - null !== $shipping_address && $obj['shipping_address'] = $shipping_address; - null !== $shipping_address_recipient && $obj['shipping_address_recipient'] = $shipping_address_recipient; + null !== $paymentDetails && $obj['paymentDetails'] = $paymentDetails; + null !== $paymentTerm && $obj['paymentTerm'] = $paymentTerm; + null !== $previousUnpaidBalance && $obj['previousUnpaidBalance'] = $previousUnpaidBalance; + null !== $purchaseOrder && $obj['purchaseOrder'] = $purchaseOrder; + null !== $remittanceAddress && $obj['remittanceAddress'] = $remittanceAddress; + null !== $remittanceAddressRecipient && $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; + null !== $serviceAddress && $obj['serviceAddress'] = $serviceAddress; + null !== $serviceAddressRecipient && $obj['serviceAddressRecipient'] = $serviceAddressRecipient; + null !== $serviceEndDate && $obj['serviceEndDate'] = $serviceEndDate; + null !== $serviceStartDate && $obj['serviceStartDate'] = $serviceStartDate; + null !== $shippingAddress && $obj['shippingAddress'] = $shippingAddress; + null !== $shippingAddressRecipient && $obj['shippingAddressRecipient'] = $shippingAddressRecipient; null !== $state && $obj['state'] = $state; null !== $subtotal && $obj['subtotal'] = $subtotal; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_details && $obj['tax_details'] = $tax_details; - null !== $total_discount && $obj['total_discount'] = $total_discount; - null !== $total_tax && $obj['total_tax'] = $total_tax; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxDetails && $obj['taxDetails'] = $taxDetails; + null !== $totalDiscount && $obj['totalDiscount'] = $totalDiscount; + null !== $totalTax && $obj['totalTax'] = $totalTax; null !== $vatex && $obj['vatex'] = $vatex; - null !== $vatex_note && $obj['vatex_note'] = $vatex_note; - null !== $vendor_address && $obj['vendor_address'] = $vendor_address; - null !== $vendor_address_recipient && $obj['vendor_address_recipient'] = $vendor_address_recipient; - null !== $vendor_company_id && $obj['vendor_company_id'] = $vendor_company_id; - null !== $vendor_email && $obj['vendor_email'] = $vendor_email; - null !== $vendor_name && $obj['vendor_name'] = $vendor_name; - null !== $vendor_tax_id && $obj['vendor_tax_id'] = $vendor_tax_id; + null !== $vatexNote && $obj['vatexNote'] = $vatexNote; + null !== $vendorAddress && $obj['vendorAddress'] = $vendorAddress; + null !== $vendorAddressRecipient && $obj['vendorAddressRecipient'] = $vendorAddressRecipient; + null !== $vendorCompanyID && $obj['vendorCompanyID'] = $vendorCompanyID; + null !== $vendorEmail && $obj['vendorEmail'] = $vendorEmail; + null !== $vendorName && $obj['vendorName'] = $vendorName; + null !== $vendorTaxID && $obj['vendorTaxID'] = $vendorTaxID; return $obj; } @@ -592,12 +599,12 @@ public static function with( /** * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $allowances */ public function withAllowances(?array $allowances): self @@ -614,17 +621,17 @@ public function withAllowances(?array $allowances): self public function withAmountDue(float|string|null $amountDue): self { $obj = clone $this; - $obj['amount_due'] = $amountDue; + $obj['amountDue'] = $amountDue; return $obj; } /** * @param list|null $attachments */ public function withAttachments(?array $attachments): self @@ -641,7 +648,7 @@ public function withAttachments(?array $attachments): self public function withBillingAddress(?string $billingAddress): self { $obj = clone $this; - $obj['billing_address'] = $billingAddress; + $obj['billingAddress'] = $billingAddress; return $obj; } @@ -653,7 +660,7 @@ public function withBillingAddressRecipient( ?string $billingAddressRecipient ): self { $obj = clone $this; - $obj['billing_address_recipient'] = $billingAddressRecipient; + $obj['billingAddressRecipient'] = $billingAddressRecipient; return $obj; } @@ -661,12 +668,12 @@ public function withBillingAddressRecipient( /** * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $charges */ public function withCharges(?array $charges): self @@ -696,7 +703,7 @@ public function withCurrency(CurrencyCode|string $currency): self public function withCustomerAddress(?string $customerAddress): self { $obj = clone $this; - $obj['customer_address'] = $customerAddress; + $obj['customerAddress'] = $customerAddress; return $obj; } @@ -708,7 +715,7 @@ public function withCustomerAddressRecipient( ?string $customerAddressRecipient ): self { $obj = clone $this; - $obj['customer_address_recipient'] = $customerAddressRecipient; + $obj['customerAddressRecipient'] = $customerAddressRecipient; return $obj; } @@ -719,7 +726,7 @@ public function withCustomerAddressRecipient( public function withCustomerCompanyID(?string $customerCompanyID): self { $obj = clone $this; - $obj['customer_company_id'] = $customerCompanyID; + $obj['customerCompanyID'] = $customerCompanyID; return $obj; } @@ -730,7 +737,7 @@ public function withCustomerCompanyID(?string $customerCompanyID): self public function withCustomerEmail(?string $customerEmail): self { $obj = clone $this; - $obj['customer_email'] = $customerEmail; + $obj['customerEmail'] = $customerEmail; return $obj; } @@ -741,7 +748,7 @@ public function withCustomerEmail(?string $customerEmail): self public function withCustomerID(?string $customerID): self { $obj = clone $this; - $obj['customer_id'] = $customerID; + $obj['customerID'] = $customerID; return $obj; } @@ -752,7 +759,7 @@ public function withCustomerID(?string $customerID): self public function withCustomerName(?string $customerName): self { $obj = clone $this; - $obj['customer_name'] = $customerName; + $obj['customerName'] = $customerName; return $obj; } @@ -763,7 +770,7 @@ public function withCustomerName(?string $customerName): self public function withCustomerTaxID(?string $customerTaxID): self { $obj = clone $this; - $obj['customer_tax_id'] = $customerTaxID; + $obj['customerTaxID'] = $customerTaxID; return $obj; } @@ -789,7 +796,7 @@ public function withDirection(DocumentDirection|string $direction): self public function withDocumentType(DocumentType|string $documentType): self { $obj = clone $this; - $obj['document_type'] = $documentType; + $obj['documentType'] = $documentType; return $obj; } @@ -800,7 +807,7 @@ public function withDocumentType(DocumentType|string $documentType): self public function withDueDate(?\DateTimeInterface $dueDate): self { $obj = clone $this; - $obj['due_date'] = $dueDate; + $obj['dueDate'] = $dueDate; return $obj; } @@ -811,7 +818,7 @@ public function withDueDate(?\DateTimeInterface $dueDate): self public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self { $obj = clone $this; - $obj['invoice_date'] = $invoiceDate; + $obj['invoiceDate'] = $invoiceDate; return $obj; } @@ -822,7 +829,7 @@ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self public function withInvoiceID(?string $invoiceID): self { $obj = clone $this; - $obj['invoice_id'] = $invoiceID; + $obj['invoiceID'] = $invoiceID; return $obj; } @@ -833,7 +840,7 @@ public function withInvoiceID(?string $invoiceID): self public function withInvoiceTotal(float|string|null $invoiceTotal): self { $obj = clone $this; - $obj['invoice_total'] = $invoiceTotal; + $obj['invoiceTotal'] = $invoiceTotal; return $obj; } @@ -847,12 +854,12 @@ public function withInvoiceTotal(float|string|null $invoiceTotal): self * charges?: list|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: float|string|null, * tax?: float|string|null, - * tax_rate?: float|string|null, + * taxRate?: float|string|null, * unit?: value-of|null, - * unit_price?: float|string|null, + * unitPrice?: float|string|null, * }> $items */ public function withItems(array $items): self @@ -876,16 +883,16 @@ public function withNote(?string $note): self /** * @param list|null $paymentDetails */ public function withPaymentDetails(?array $paymentDetails): self { $obj = clone $this; - $obj['payment_details'] = $paymentDetails; + $obj['paymentDetails'] = $paymentDetails; return $obj; } @@ -896,7 +903,7 @@ public function withPaymentDetails(?array $paymentDetails): self public function withPaymentTerm(?string $paymentTerm): self { $obj = clone $this; - $obj['payment_term'] = $paymentTerm; + $obj['paymentTerm'] = $paymentTerm; return $obj; } @@ -908,7 +915,7 @@ public function withPreviousUnpaidBalance( float|string|null $previousUnpaidBalance ): self { $obj = clone $this; - $obj['previous_unpaid_balance'] = $previousUnpaidBalance; + $obj['previousUnpaidBalance'] = $previousUnpaidBalance; return $obj; } @@ -919,7 +926,7 @@ public function withPreviousUnpaidBalance( public function withPurchaseOrder(?string $purchaseOrder): self { $obj = clone $this; - $obj['purchase_order'] = $purchaseOrder; + $obj['purchaseOrder'] = $purchaseOrder; return $obj; } @@ -930,7 +937,7 @@ public function withPurchaseOrder(?string $purchaseOrder): self public function withRemittanceAddress(?string $remittanceAddress): self { $obj = clone $this; - $obj['remittance_address'] = $remittanceAddress; + $obj['remittanceAddress'] = $remittanceAddress; return $obj; } @@ -942,7 +949,7 @@ public function withRemittanceAddressRecipient( ?string $remittanceAddressRecipient ): self { $obj = clone $this; - $obj['remittance_address_recipient'] = $remittanceAddressRecipient; + $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; return $obj; } @@ -953,7 +960,7 @@ public function withRemittanceAddressRecipient( public function withServiceAddress(?string $serviceAddress): self { $obj = clone $this; - $obj['service_address'] = $serviceAddress; + $obj['serviceAddress'] = $serviceAddress; return $obj; } @@ -965,7 +972,7 @@ public function withServiceAddressRecipient( ?string $serviceAddressRecipient ): self { $obj = clone $this; - $obj['service_address_recipient'] = $serviceAddressRecipient; + $obj['serviceAddressRecipient'] = $serviceAddressRecipient; return $obj; } @@ -977,7 +984,7 @@ public function withServiceEndDate( ?\DateTimeInterface $serviceEndDate ): self { $obj = clone $this; - $obj['service_end_date'] = $serviceEndDate; + $obj['serviceEndDate'] = $serviceEndDate; return $obj; } @@ -989,7 +996,7 @@ public function withServiceStartDate( ?\DateTimeInterface $serviceStartDate ): self { $obj = clone $this; - $obj['service_start_date'] = $serviceStartDate; + $obj['serviceStartDate'] = $serviceStartDate; return $obj; } @@ -1000,7 +1007,7 @@ public function withServiceStartDate( public function withShippingAddress(?string $shippingAddress): self { $obj = clone $this; - $obj['shipping_address'] = $shippingAddress; + $obj['shippingAddress'] = $shippingAddress; return $obj; } @@ -1012,7 +1019,7 @@ public function withShippingAddressRecipient( ?string $shippingAddressRecipient ): self { $obj = clone $this; - $obj['shipping_address_recipient'] = $shippingAddressRecipient; + $obj['shippingAddressRecipient'] = $shippingAddressRecipient; return $obj; } @@ -1050,7 +1057,7 @@ public function withTaxCode( DocumentCreateParams\TaxCode|string $taxCode ): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -1063,7 +1070,7 @@ public function withTaxCode( public function withTaxDetails(?array $taxDetails): self { $obj = clone $this; - $obj['tax_details'] = $taxDetails; + $obj['taxDetails'] = $taxDetails; return $obj; } @@ -1074,7 +1081,7 @@ public function withTaxDetails(?array $taxDetails): self public function withTotalDiscount(float|string|null $totalDiscount): self { $obj = clone $this; - $obj['total_discount'] = $totalDiscount; + $obj['totalDiscount'] = $totalDiscount; return $obj; } @@ -1085,7 +1092,7 @@ public function withTotalDiscount(float|string|null $totalDiscount): self public function withTotalTax(float|string|null $totalTax): self { $obj = clone $this; - $obj['total_tax'] = $totalTax; + $obj['totalTax'] = $totalTax; return $obj; } @@ -1112,7 +1119,7 @@ public function withVatex(Vatex|string|null $vatex): self public function withVatexNote(?string $vatexNote): self { $obj = clone $this; - $obj['vatex_note'] = $vatexNote; + $obj['vatexNote'] = $vatexNote; return $obj; } @@ -1123,7 +1130,7 @@ public function withVatexNote(?string $vatexNote): self public function withVendorAddress(?string $vendorAddress): self { $obj = clone $this; - $obj['vendor_address'] = $vendorAddress; + $obj['vendorAddress'] = $vendorAddress; return $obj; } @@ -1135,7 +1142,7 @@ public function withVendorAddressRecipient( ?string $vendorAddressRecipient ): self { $obj = clone $this; - $obj['vendor_address_recipient'] = $vendorAddressRecipient; + $obj['vendorAddressRecipient'] = $vendorAddressRecipient; return $obj; } @@ -1146,7 +1153,7 @@ public function withVendorAddressRecipient( public function withVendorCompanyID(?string $vendorCompanyID): self { $obj = clone $this; - $obj['vendor_company_id'] = $vendorCompanyID; + $obj['vendorCompanyID'] = $vendorCompanyID; return $obj; } @@ -1157,7 +1164,7 @@ public function withVendorCompanyID(?string $vendorCompanyID): self public function withVendorEmail(?string $vendorEmail): self { $obj = clone $this; - $obj['vendor_email'] = $vendorEmail; + $obj['vendorEmail'] = $vendorEmail; return $obj; } @@ -1168,7 +1175,7 @@ public function withVendorEmail(?string $vendorEmail): self public function withVendorName(?string $vendorName): self { $obj = clone $this; - $obj['vendor_name'] = $vendorName; + $obj['vendorName'] = $vendorName; return $obj; } @@ -1179,7 +1186,7 @@ public function withVendorName(?string $vendorName): self public function withVendorTaxID(?string $vendorTaxID): self { $obj = clone $this; - $obj['vendor_tax_id'] = $vendorTaxID; + $obj['vendorTaxID'] = $vendorTaxID; return $obj; } diff --git a/src/Documents/DocumentCreateParams/Allowance.php b/src/Documents/DocumentCreateParams/Allowance.php index c5a53ed8..fbc0f793 100644 --- a/src/Documents/DocumentCreateParams/Allowance.php +++ b/src/Documents/DocumentCreateParams/Allowance.php @@ -15,12 +15,12 @@ * * @phpstan-type AllowanceShape = array{ * amount?: float|string|null, - * base_amount?: float|string|null, - * multiplier_factor?: float|string|null, + * baseAmount?: float|string|null, + * multiplierFactor?: float|string|null, * reason?: string|null, - * reason_code?: value-of|null, - * tax_code?: value-of<\EInvoiceAPI\Documents\DocumentCreateParams\Allowance\TaxCode>|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of<\EInvoiceAPI\Documents\DocumentCreateParams\Allowance\TaxCode>|null, + * taxRate?: float|string|null, * } */ final class Allowance implements BaseModel @@ -37,14 +37,14 @@ final class Allowance implements BaseModel /** * The base amount that may be used, in conjunction with the allowance percentage, to calculate the allowance amount. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $base_amount; + #[Optional('base_amount', nullable: true)] + public float|string|null $baseAmount; /** * The percentage that may be used, in conjunction with the allowance base amount, to calculate the allowance amount. To state 20%, use value 20. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $multiplier_factor; + #[Optional('multiplier_factor', nullable: true)] + public float|string|null $multiplierFactor; /** * The reason for the allowance. @@ -55,26 +55,27 @@ final class Allowance implements BaseModel /** * Allowance reason codes for invoice discounts and charges. * - * @var value-of|null $reason_code + * @var value-of|null $reasonCode */ - #[Optional(enum: ReasonCode::class, nullable: true)] - public ?string $reason_code; + #[Optional('reason_code', enum: ReasonCode::class, nullable: true)] + public ?string $reasonCode; /** * The VAT category code that applies to the allowance. * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ #[Optional( - enum: TaxCode::class + 'tax_code', + enum: TaxCode::class, )] - public ?string $tax_code; + public ?string $taxCode; /** * The VAT rate, represented as percentage that applies to the allowance. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $tax_rate; + #[Optional('tax_rate', nullable: true)] + public float|string|null $taxRate; public function __construct() { @@ -86,27 +87,27 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ReasonCode|value-of|null $reason_code - * @param TaxCode|value-of $tax_code + * @param ReasonCode|value-of|null $reasonCode + * @param TaxCode|value-of $taxCode */ public static function with( float|string|null $amount = null, - float|string|null $base_amount = null, - float|string|null $multiplier_factor = null, + float|string|null $baseAmount = null, + float|string|null $multiplierFactor = null, ?string $reason = null, - ReasonCode|string|null $reason_code = null, - TaxCode|string|null $tax_code = null, - float|string|null $tax_rate = null, + ReasonCode|string|null $reasonCode = null, + TaxCode|string|null $taxCode = null, + float|string|null $taxRate = null, ): self { $obj = new self; null !== $amount && $obj['amount'] = $amount; - null !== $base_amount && $obj['base_amount'] = $base_amount; - null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $baseAmount && $obj['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; null !== $reason && $obj['reason'] = $reason; - null !== $reason_code && $obj['reason_code'] = $reason_code; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $reasonCode && $obj['reasonCode'] = $reasonCode; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxRate && $obj['taxRate'] = $taxRate; return $obj; } @@ -128,7 +129,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj['base_amount'] = $baseAmount; + $obj['baseAmount'] = $baseAmount; return $obj; } @@ -140,7 +141,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj['multiplier_factor'] = $multiplierFactor; + $obj['multiplierFactor'] = $multiplierFactor; return $obj; } @@ -164,7 +165,7 @@ public function withReason(?string $reason): self public function withReasonCode(ReasonCode|string|null $reasonCode): self { $obj = clone $this; - $obj['reason_code'] = $reasonCode; + $obj['reasonCode'] = $reasonCode; return $obj; } @@ -178,7 +179,7 @@ public function withTaxCode( TaxCode|string $taxCode, ): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -189,7 +190,7 @@ public function withTaxCode( public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentCreateParams/Charge.php b/src/Documents/DocumentCreateParams/Charge.php index f1739e19..da8574ab 100644 --- a/src/Documents/DocumentCreateParams/Charge.php +++ b/src/Documents/DocumentCreateParams/Charge.php @@ -15,12 +15,12 @@ * * @phpstan-type ChargeShape = array{ * amount?: float|string|null, - * base_amount?: float|string|null, - * multiplier_factor?: float|string|null, + * baseAmount?: float|string|null, + * multiplierFactor?: float|string|null, * reason?: string|null, - * reason_code?: value-of|null, - * tax_code?: value-of<\EInvoiceAPI\Documents\DocumentCreateParams\Charge\TaxCode>|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of<\EInvoiceAPI\Documents\DocumentCreateParams\Charge\TaxCode>|null, + * taxRate?: float|string|null, * } */ final class Charge implements BaseModel @@ -37,14 +37,14 @@ final class Charge implements BaseModel /** * The base amount that may be used, in conjunction with the charge percentage, to calculate the charge amount. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $base_amount; + #[Optional('base_amount', nullable: true)] + public float|string|null $baseAmount; /** * The percentage that may be used, in conjunction with the charge base amount, to calculate the charge amount. To state 20%, use value 20. */ - #[Optional(nullable: true)] - public float|string|null $multiplier_factor; + #[Optional('multiplier_factor', nullable: true)] + public float|string|null $multiplierFactor; /** * The reason for the charge. @@ -55,10 +55,10 @@ final class Charge implements BaseModel /** * Charge reason codes for invoice charges and fees. * - * @var value-of|null $reason_code + * @var value-of|null $reasonCode */ - #[Optional(enum: ReasonCode::class, nullable: true)] - public ?string $reason_code; + #[Optional('reason_code', enum: ReasonCode::class, nullable: true)] + public ?string $reasonCode; /** * Duty or tax or fee category codes (Subset of UNCL5305). @@ -67,19 +67,20 @@ final class Charge implements BaseModel * Version: D.16B * Subset: OpenPEPPOL * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ #[Optional( + 'tax_code', enum: TaxCode::class, nullable: true, )] - public ?string $tax_code; + public ?string $taxCode; /** * The VAT rate, represented as percentage that applies to the charge. */ - #[Optional(nullable: true)] - public float|string|null $tax_rate; + #[Optional('tax_rate', nullable: true)] + public float|string|null $taxRate; public function __construct() { @@ -91,27 +92,27 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ReasonCode|value-of|null $reason_code - * @param TaxCode|value-of|null $tax_code + * @param ReasonCode|value-of|null $reasonCode + * @param TaxCode|value-of|null $taxCode */ public static function with( float|string|null $amount = null, - float|string|null $base_amount = null, - float|string|null $multiplier_factor = null, + float|string|null $baseAmount = null, + float|string|null $multiplierFactor = null, ?string $reason = null, - ReasonCode|string|null $reason_code = null, - TaxCode|string|null $tax_code = null, - float|string|null $tax_rate = null, + ReasonCode|string|null $reasonCode = null, + TaxCode|string|null $taxCode = null, + float|string|null $taxRate = null, ): self { $obj = new self; null !== $amount && $obj['amount'] = $amount; - null !== $base_amount && $obj['base_amount'] = $base_amount; - null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $baseAmount && $obj['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; null !== $reason && $obj['reason'] = $reason; - null !== $reason_code && $obj['reason_code'] = $reason_code; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $reasonCode && $obj['reasonCode'] = $reasonCode; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxRate && $obj['taxRate'] = $taxRate; return $obj; } @@ -133,7 +134,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj['base_amount'] = $baseAmount; + $obj['baseAmount'] = $baseAmount; return $obj; } @@ -145,7 +146,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj['multiplier_factor'] = $multiplierFactor; + $obj['multiplierFactor'] = $multiplierFactor; return $obj; } @@ -169,7 +170,7 @@ public function withReason(?string $reason): self public function withReasonCode(ReasonCode|string|null $reasonCode): self { $obj = clone $this; - $obj['reason_code'] = $reasonCode; + $obj['reasonCode'] = $reasonCode; return $obj; } @@ -187,7 +188,7 @@ public function withTaxCode( TaxCode|string|null $taxCode, ): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -198,7 +199,7 @@ public function withTaxCode( public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentCreateParams/Item.php b/src/Documents/DocumentCreateParams/Item.php index 8be7efd0..8768ca62 100644 --- a/src/Documents/DocumentCreateParams/Item.php +++ b/src/Documents/DocumentCreateParams/Item.php @@ -20,12 +20,12 @@ * charges?: list<\EInvoiceAPI\Documents\DocumentCreateParams\Item\Charge>|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: float|string|null, * tax?: float|string|null, - * tax_rate?: float|string|null, + * taxRate?: float|string|null, * unit?: value-of|null, - * unit_price?: float|string|null, + * unitPrice?: float|string|null, * } */ final class Item implements BaseModel @@ -74,8 +74,8 @@ final class Item implements BaseModel /** * The product code of the line item. */ - #[Optional(nullable: true)] - public ?string $product_code; + #[Optional('product_code', nullable: true)] + public ?string $productCode; /** * The quantity of items (goods or services) that is the subject of the line item. Must be rounded to maximum 4 decimals. Can be negative for credit notes or corrections. @@ -92,8 +92,8 @@ final class Item implements BaseModel /** * The VAT rate of the line item expressed as percentage with 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $tax_rate; + #[Optional('tax_rate', nullable: true)] + public float|string|null $taxRate; /** * Unit of Measure Codes from UNECERec20 used in Peppol BIS Billing 3.0. @@ -106,8 +106,8 @@ final class Item implements BaseModel /** * The item net price (BT-146). The price of an item, exclusive of VAT, after subtracting item price discount. Must be rounded to maximum 4 decimals. */ - #[Optional(nullable: true)] - public float|string|null $unit_price; + #[Optional('unit_price', nullable: true)] + public float|string|null $unitPrice; public function __construct() { @@ -121,21 +121,21 @@ public function __construct() * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $allowances * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $charges * @param UnitOfMeasureCode|value-of|null $unit */ @@ -145,12 +145,12 @@ public static function with( ?array $charges = null, null $date = null, ?string $description = null, - ?string $product_code = null, + ?string $productCode = null, float|string|null $quantity = null, float|string|null $tax = null, - float|string|null $tax_rate = null, + float|string|null $taxRate = null, UnitOfMeasureCode|string|null $unit = null, - float|string|null $unit_price = null, + float|string|null $unitPrice = null, ): self { $obj = new self; @@ -160,12 +160,12 @@ public static function with( null !== $amount && $obj['amount'] = $amount; null !== $charges && $obj['charges'] = $charges; null !== $description && $obj['description'] = $description; - null !== $product_code && $obj['product_code'] = $product_code; + null !== $productCode && $obj['productCode'] = $productCode; null !== $quantity && $obj['quantity'] = $quantity; null !== $tax && $obj['tax'] = $tax; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $taxRate && $obj['taxRate'] = $taxRate; null !== $unit && $obj['unit'] = $unit; - null !== $unit_price && $obj['unit_price'] = $unit_price; + null !== $unitPrice && $obj['unitPrice'] = $unitPrice; return $obj; } @@ -175,12 +175,12 @@ public static function with( * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $allowances */ public function withAllowances(?array $allowances): self @@ -207,12 +207,12 @@ public function withAmount(float|string|null $amount): self * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $charges */ public function withCharges(?array $charges): self @@ -251,7 +251,7 @@ public function withDescription(?string $description): self public function withProductCode(?string $productCode): self { $obj = clone $this; - $obj['product_code'] = $productCode; + $obj['productCode'] = $productCode; return $obj; } @@ -284,7 +284,7 @@ public function withTax(float|string|null $tax): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } @@ -308,7 +308,7 @@ public function withUnit(UnitOfMeasureCode|string|null $unit): self public function withUnitPrice(float|string|null $unitPrice): self { $obj = clone $this; - $obj['unit_price'] = $unitPrice; + $obj['unitPrice'] = $unitPrice; return $obj; } diff --git a/src/Documents/DocumentCreateParams/Item/Allowance.php b/src/Documents/DocumentCreateParams/Item/Allowance.php index 981578e7..f7c2c0b7 100644 --- a/src/Documents/DocumentCreateParams/Item/Allowance.php +++ b/src/Documents/DocumentCreateParams/Item/Allowance.php @@ -15,12 +15,12 @@ * * @phpstan-type AllowanceShape = array{ * amount?: float|string|null, - * base_amount?: float|string|null, - * multiplier_factor?: float|string|null, + * baseAmount?: float|string|null, + * multiplierFactor?: float|string|null, * reason?: string|null, - * reason_code?: value-of|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * } */ final class Allowance implements BaseModel @@ -37,14 +37,14 @@ final class Allowance implements BaseModel /** * The base amount that may be used, in conjunction with the allowance percentage, to calculate the allowance amount. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $base_amount; + #[Optional('base_amount', nullable: true)] + public float|string|null $baseAmount; /** * The percentage that may be used, in conjunction with the allowance base amount, to calculate the allowance amount. To state 20%, use value 20. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $multiplier_factor; + #[Optional('multiplier_factor', nullable: true)] + public float|string|null $multiplierFactor; /** * The reason for the allowance. @@ -55,24 +55,24 @@ final class Allowance implements BaseModel /** * Allowance reason codes for invoice discounts and charges. * - * @var value-of|null $reason_code + * @var value-of|null $reasonCode */ - #[Optional(enum: ReasonCode::class, nullable: true)] - public ?string $reason_code; + #[Optional('reason_code', enum: ReasonCode::class, nullable: true)] + public ?string $reasonCode; /** * The VAT category code that applies to the allowance. * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ - #[Optional(enum: TaxCode::class)] - public ?string $tax_code; + #[Optional('tax_code', enum: TaxCode::class)] + public ?string $taxCode; /** * The VAT rate, represented as percentage that applies to the allowance. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $tax_rate; + #[Optional('tax_rate', nullable: true)] + public float|string|null $taxRate; public function __construct() { @@ -84,27 +84,27 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ReasonCode|value-of|null $reason_code - * @param TaxCode|value-of $tax_code + * @param ReasonCode|value-of|null $reasonCode + * @param TaxCode|value-of $taxCode */ public static function with( float|string|null $amount = null, - float|string|null $base_amount = null, - float|string|null $multiplier_factor = null, + float|string|null $baseAmount = null, + float|string|null $multiplierFactor = null, ?string $reason = null, - ReasonCode|string|null $reason_code = null, - TaxCode|string|null $tax_code = null, - float|string|null $tax_rate = null, + ReasonCode|string|null $reasonCode = null, + TaxCode|string|null $taxCode = null, + float|string|null $taxRate = null, ): self { $obj = new self; null !== $amount && $obj['amount'] = $amount; - null !== $base_amount && $obj['base_amount'] = $base_amount; - null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $baseAmount && $obj['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; null !== $reason && $obj['reason'] = $reason; - null !== $reason_code && $obj['reason_code'] = $reason_code; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $reasonCode && $obj['reasonCode'] = $reasonCode; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxRate && $obj['taxRate'] = $taxRate; return $obj; } @@ -126,7 +126,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj['base_amount'] = $baseAmount; + $obj['baseAmount'] = $baseAmount; return $obj; } @@ -138,7 +138,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj['multiplier_factor'] = $multiplierFactor; + $obj['multiplierFactor'] = $multiplierFactor; return $obj; } @@ -162,7 +162,7 @@ public function withReason(?string $reason): self public function withReasonCode(ReasonCode|string|null $reasonCode): self { $obj = clone $this; - $obj['reason_code'] = $reasonCode; + $obj['reasonCode'] = $reasonCode; return $obj; } @@ -175,7 +175,7 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self public function withTaxCode(TaxCode|string $taxCode): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -186,7 +186,7 @@ public function withTaxCode(TaxCode|string $taxCode): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentCreateParams/Item/Charge.php b/src/Documents/DocumentCreateParams/Item/Charge.php index 921ea9a0..cf76a0cf 100644 --- a/src/Documents/DocumentCreateParams/Item/Charge.php +++ b/src/Documents/DocumentCreateParams/Item/Charge.php @@ -15,12 +15,12 @@ * * @phpstan-type ChargeShape = array{ * amount?: float|string|null, - * base_amount?: float|string|null, - * multiplier_factor?: float|string|null, + * baseAmount?: float|string|null, + * multiplierFactor?: float|string|null, * reason?: string|null, - * reason_code?: value-of|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * } */ final class Charge implements BaseModel @@ -37,14 +37,14 @@ final class Charge implements BaseModel /** * The base amount that may be used, in conjunction with the charge percentage, to calculate the charge amount. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $base_amount; + #[Optional('base_amount', nullable: true)] + public float|string|null $baseAmount; /** * The percentage that may be used, in conjunction with the charge base amount, to calculate the charge amount. To state 20%, use value 20. */ - #[Optional(nullable: true)] - public float|string|null $multiplier_factor; + #[Optional('multiplier_factor', nullable: true)] + public float|string|null $multiplierFactor; /** * The reason for the charge. @@ -55,10 +55,10 @@ final class Charge implements BaseModel /** * Charge reason codes for invoice charges and fees. * - * @var value-of|null $reason_code + * @var value-of|null $reasonCode */ - #[Optional(enum: ReasonCode::class, nullable: true)] - public ?string $reason_code; + #[Optional('reason_code', enum: ReasonCode::class, nullable: true)] + public ?string $reasonCode; /** * Duty or tax or fee category codes (Subset of UNCL5305). @@ -67,16 +67,16 @@ final class Charge implements BaseModel * Version: D.16B * Subset: OpenPEPPOL * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ - #[Optional(enum: TaxCode::class, nullable: true)] - public ?string $tax_code; + #[Optional('tax_code', enum: TaxCode::class, nullable: true)] + public ?string $taxCode; /** * The VAT rate, represented as percentage that applies to the charge. */ - #[Optional(nullable: true)] - public float|string|null $tax_rate; + #[Optional('tax_rate', nullable: true)] + public float|string|null $taxRate; public function __construct() { @@ -88,27 +88,27 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ReasonCode|value-of|null $reason_code - * @param TaxCode|value-of|null $tax_code + * @param ReasonCode|value-of|null $reasonCode + * @param TaxCode|value-of|null $taxCode */ public static function with( float|string|null $amount = null, - float|string|null $base_amount = null, - float|string|null $multiplier_factor = null, + float|string|null $baseAmount = null, + float|string|null $multiplierFactor = null, ?string $reason = null, - ReasonCode|string|null $reason_code = null, - TaxCode|string|null $tax_code = null, - float|string|null $tax_rate = null, + ReasonCode|string|null $reasonCode = null, + TaxCode|string|null $taxCode = null, + float|string|null $taxRate = null, ): self { $obj = new self; null !== $amount && $obj['amount'] = $amount; - null !== $base_amount && $obj['base_amount'] = $base_amount; - null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $baseAmount && $obj['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; null !== $reason && $obj['reason'] = $reason; - null !== $reason_code && $obj['reason_code'] = $reason_code; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $reasonCode && $obj['reasonCode'] = $reasonCode; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxRate && $obj['taxRate'] = $taxRate; return $obj; } @@ -130,7 +130,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj['base_amount'] = $baseAmount; + $obj['baseAmount'] = $baseAmount; return $obj; } @@ -142,7 +142,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj['multiplier_factor'] = $multiplierFactor; + $obj['multiplierFactor'] = $multiplierFactor; return $obj; } @@ -166,7 +166,7 @@ public function withReason(?string $reason): self public function withReasonCode(ReasonCode|string|null $reasonCode): self { $obj = clone $this; - $obj['reason_code'] = $reasonCode; + $obj['reasonCode'] = $reasonCode; return $obj; } @@ -183,7 +183,7 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self public function withTaxCode(TaxCode|string|null $taxCode): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -194,7 +194,7 @@ public function withTaxCode(TaxCode|string|null $taxCode): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentDeleteResponse.php b/src/Documents/DocumentDeleteResponse.php index 0a3a3c39..cb6f416e 100644 --- a/src/Documents/DocumentDeleteResponse.php +++ b/src/Documents/DocumentDeleteResponse.php @@ -9,22 +9,22 @@ use EInvoiceAPI\Core\Contracts\BaseModel; /** - * @phpstan-type DocumentDeleteResponseShape = array{is_deleted: bool} + * @phpstan-type DocumentDeleteResponseShape = array{isDeleted: bool} */ final class DocumentDeleteResponse implements BaseModel { /** @use SdkModel */ use SdkModel; - #[Required] - public bool $is_deleted; + #[Required('is_deleted')] + public bool $isDeleted; /** * `new DocumentDeleteResponse()` is missing required properties by the API. * * To enforce required parameters use * ``` - * DocumentDeleteResponse::with(is_deleted: ...) + * DocumentDeleteResponse::with(isDeleted: ...) * ``` * * Otherwise ensure the following setters are called @@ -43,11 +43,11 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(bool $is_deleted): self + public static function with(bool $isDeleted): self { $obj = new self; - $obj['is_deleted'] = $is_deleted; + $obj['isDeleted'] = $isDeleted; return $obj; } @@ -55,7 +55,7 @@ public static function with(bool $is_deleted): self public function withIsDeleted(bool $isDeleted): self { $obj = clone $this; - $obj['is_deleted'] = $isDeleted; + $obj['isDeleted'] = $isDeleted; return $obj; } diff --git a/src/Documents/DocumentNewFromPdfResponse.php b/src/Documents/DocumentNewFromPdfResponse.php index 45c3d7ef..a8f22f44 100644 --- a/src/Documents/DocumentNewFromPdfResponse.php +++ b/src/Documents/DocumentNewFromPdfResponse.php @@ -17,54 +17,54 @@ /** * @phpstan-type DocumentNewFromPdfResponseShape = array{ * allowances?: list|null, - * amount_due?: string|null, + * amountDue?: string|null, * attachments?: list|null, - * billing_address?: string|null, - * billing_address_recipient?: string|null, + * billingAddress?: string|null, + * billingAddressRecipient?: string|null, * charges?: list|null, * currency?: value-of|null, - * customer_address?: string|null, - * customer_address_recipient?: string|null, - * customer_company_id?: string|null, - * customer_email?: string|null, - * customer_id?: string|null, - * customer_name?: string|null, - * customer_tax_id?: string|null, + * customerAddress?: string|null, + * customerAddressRecipient?: string|null, + * customerCompanyID?: string|null, + * customerEmail?: string|null, + * customerID?: string|null, + * customerName?: string|null, + * customerTaxID?: string|null, * direction?: value-of|null, - * document_type?: value-of|null, - * due_date?: \DateTimeInterface|null, - * invoice_date?: \DateTimeInterface|null, - * invoice_id?: string|null, - * invoice_total?: string|null, + * documentType?: value-of|null, + * dueDate?: \DateTimeInterface|null, + * invoiceDate?: \DateTimeInterface|null, + * invoiceID?: string|null, + * invoiceTotal?: string|null, * items?: list|null, * note?: string|null, - * payment_details?: list|null, - * payment_term?: string|null, - * purchase_order?: string|null, - * remittance_address?: string|null, - * remittance_address_recipient?: string|null, - * service_address?: string|null, - * service_address_recipient?: string|null, - * service_end_date?: \DateTimeInterface|null, - * service_start_date?: \DateTimeInterface|null, - * shipping_address?: string|null, - * shipping_address_recipient?: string|null, + * paymentDetails?: list|null, + * paymentTerm?: string|null, + * purchaseOrder?: string|null, + * remittanceAddress?: string|null, + * remittanceAddressRecipient?: string|null, + * serviceAddress?: string|null, + * serviceAddressRecipient?: string|null, + * serviceEndDate?: \DateTimeInterface|null, + * serviceStartDate?: \DateTimeInterface|null, + * shippingAddress?: string|null, + * shippingAddressRecipient?: string|null, * state?: value-of|null, * subtotal?: string|null, * success?: bool|null, - * tax_code?: value-of|null, - * tax_details?: list|null, - * total_discount?: string|null, - * total_tax?: string|null, - * ubl_document?: string|null, + * taxCode?: value-of|null, + * taxDetails?: list|null, + * totalDiscount?: string|null, + * totalTax?: string|null, + * ublDocument?: string|null, * vatex?: value-of|null, - * vatex_note?: string|null, - * vendor_address?: string|null, - * vendor_address_recipient?: string|null, - * vendor_company_id?: string|null, - * vendor_email?: string|null, - * vendor_name?: string|null, - * vendor_tax_id?: string|null, + * vatexNote?: string|null, + * vendorAddress?: string|null, + * vendorAddressRecipient?: string|null, + * vendorCompanyID?: string|null, + * vendorEmail?: string|null, + * vendorName?: string|null, + * vendorTaxID?: string|null, * } */ final class DocumentNewFromPdfResponse implements BaseModel @@ -79,8 +79,8 @@ final class DocumentNewFromPdfResponse implements BaseModel /** * The amount due for payment. Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public ?string $amount_due; + #[Optional('amount_due', nullable: true)] + public ?string $amountDue; /** @var list|null $attachments */ #[Optional(list: DocumentAttachmentCreate::class, nullable: true)] @@ -89,14 +89,14 @@ final class DocumentNewFromPdfResponse implements BaseModel /** * The billing address (if different from customer address). */ - #[Optional(nullable: true)] - public ?string $billing_address; + #[Optional('billing_address', nullable: true)] + public ?string $billingAddress; /** * The recipient name at the billing address. */ - #[Optional(nullable: true)] - public ?string $billing_address_recipient; + #[Optional('billing_address_recipient', nullable: true)] + public ?string $billingAddressRecipient; /** @var list|null $charges */ #[Optional(list: Charge::class, nullable: true)] @@ -113,44 +113,44 @@ final class DocumentNewFromPdfResponse implements BaseModel /** * The address of the customer/buyer. */ - #[Optional(nullable: true)] - public ?string $customer_address; + #[Optional('customer_address', nullable: true)] + public ?string $customerAddress; /** * The recipient name at the customer address. */ - #[Optional(nullable: true)] - public ?string $customer_address_recipient; + #[Optional('customer_address_recipient', nullable: true)] + public ?string $customerAddressRecipient; /** * Customer company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Optional(nullable: true)] - public ?string $customer_company_id; + #[Optional('customer_company_id', nullable: true)] + public ?string $customerCompanyID; /** * The email address of the customer. */ - #[Optional(nullable: true)] - public ?string $customer_email; + #[Optional('customer_email', nullable: true)] + public ?string $customerEmail; /** * The unique identifier for the customer in your system. */ - #[Optional(nullable: true)] - public ?string $customer_id; + #[Optional('customer_id', nullable: true)] + public ?string $customerID; /** * The company name of the customer/buyer. */ - #[Optional(nullable: true)] - public ?string $customer_name; + #[Optional('customer_name', nullable: true)] + public ?string $customerName; /** * Customer tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Optional(nullable: true)] - public ?string $customer_tax_id; + #[Optional('customer_tax_id', nullable: true)] + public ?string $customerTaxID; /** * The direction of the document: INBOUND (purchases) or OUTBOUND (sales). @@ -163,34 +163,34 @@ final class DocumentNewFromPdfResponse implements BaseModel /** * The type of document: INVOICE, CREDIT_NOTE, or DEBIT_NOTE. * - * @var value-of|null $document_type + * @var value-of|null $documentType */ - #[Optional(enum: DocumentType::class)] - public ?string $document_type; + #[Optional('document_type', enum: DocumentType::class)] + public ?string $documentType; /** * The date when payment is due. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $due_date; + #[Optional('due_date', nullable: true)] + public ?\DateTimeInterface $dueDate; /** * The date when the invoice was issued. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $invoice_date; + #[Optional('invoice_date', nullable: true)] + public ?\DateTimeInterface $invoiceDate; /** * The unique invoice identifier/number. */ - #[Optional(nullable: true)] - public ?string $invoice_id; + #[Optional('invoice_id', nullable: true)] + public ?string $invoiceID; /** * The total amount of the invoice including tax (invoice_total = subtotal + total_tax + total_discount). Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public ?string $invoice_total; + #[Optional('invoice_total', nullable: true)] + public ?string $invoiceTotal; /** * At least one line item is required. @@ -206,69 +206,73 @@ final class DocumentNewFromPdfResponse implements BaseModel #[Optional(nullable: true)] public ?string $note; - /** @var list|null $payment_details */ - #[Optional(list: PaymentDetailCreate::class, nullable: true)] - public ?array $payment_details; + /** @var list|null $paymentDetails */ + #[Optional( + 'payment_details', + list: PaymentDetailCreate::class, + nullable: true + )] + public ?array $paymentDetails; /** * The payment terms (e.g., 'Net 30', 'Due on receipt', '2/10 Net 30'). */ - #[Optional(nullable: true)] - public ?string $payment_term; + #[Optional('payment_term', nullable: true)] + public ?string $paymentTerm; /** * The purchase order reference number. */ - #[Optional(nullable: true)] - public ?string $purchase_order; + #[Optional('purchase_order', nullable: true)] + public ?string $purchaseOrder; /** * The address where payment should be sent or remitted to. */ - #[Optional(nullable: true)] - public ?string $remittance_address; + #[Optional('remittance_address', nullable: true)] + public ?string $remittanceAddress; /** * The recipient name at the remittance address. */ - #[Optional(nullable: true)] - public ?string $remittance_address_recipient; + #[Optional('remittance_address_recipient', nullable: true)] + public ?string $remittanceAddressRecipient; /** * The address where services were performed or goods were delivered. */ - #[Optional(nullable: true)] - public ?string $service_address; + #[Optional('service_address', nullable: true)] + public ?string $serviceAddress; /** * The recipient name at the service address. */ - #[Optional(nullable: true)] - public ?string $service_address_recipient; + #[Optional('service_address_recipient', nullable: true)] + public ?string $serviceAddressRecipient; /** * The end date of the service period or delivery period. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $service_end_date; + #[Optional('service_end_date', nullable: true)] + public ?\DateTimeInterface $serviceEndDate; /** * The start date of the service period or delivery period. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $service_start_date; + #[Optional('service_start_date', nullable: true)] + public ?\DateTimeInterface $serviceStartDate; /** * The shipping/delivery address. */ - #[Optional(nullable: true)] - public ?string $shipping_address; + #[Optional('shipping_address', nullable: true)] + public ?string $shippingAddress; /** * The recipient name at the shipping address. */ - #[Optional(nullable: true)] - public ?string $shipping_address_recipient; + #[Optional('shipping_address_recipient', nullable: true)] + public ?string $shippingAddressRecipient; /** * The current state of the document: DRAFT, TRANSIT, FAILED, SENT, or RECEIVED. @@ -293,32 +297,32 @@ final class DocumentNewFromPdfResponse implements BaseModel /** * Tax category code of the invoice (e.g., S for standard rate, Z for zero rate, E for exempt). * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ - #[Optional(enum: TaxCode::class)] - public ?string $tax_code; + #[Optional('tax_code', enum: TaxCode::class)] + public ?string $taxCode; - /** @var list|null $tax_details */ - #[Optional(list: TaxDetail::class, nullable: true)] - public ?array $tax_details; + /** @var list|null $taxDetails */ + #[Optional('tax_details', list: TaxDetail::class, nullable: true)] + public ?array $taxDetails; /** * The net financial discount/charge of the invoice (non-VAT charges minus non-VAT allowances). Can be positive (net charge), negative (net discount), or zero. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public ?string $total_discount; + #[Optional('total_discount', nullable: true)] + public ?string $totalDiscount; /** * The total tax amount of the invoice. Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public ?string $total_tax; + #[Optional('total_tax', nullable: true)] + public ?string $totalTax; /** * The UBL document as an XML string. */ - #[Optional(nullable: true)] - public ?string $ubl_document; + #[Optional('ubl_document', nullable: true)] + public ?string $ublDocument; /** * VATEX code list for VAT exemption reasons. @@ -334,44 +338,44 @@ final class DocumentNewFromPdfResponse implements BaseModel /** * Textual explanation for VAT exemption. */ - #[Optional(nullable: true)] - public ?string $vatex_note; + #[Optional('vatex_note', nullable: true)] + public ?string $vatexNote; /** * The address of the vendor/seller. */ - #[Optional(nullable: true)] - public ?string $vendor_address; + #[Optional('vendor_address', nullable: true)] + public ?string $vendorAddress; /** * The recipient name at the vendor address. */ - #[Optional(nullable: true)] - public ?string $vendor_address_recipient; + #[Optional('vendor_address_recipient', nullable: true)] + public ?string $vendorAddressRecipient; /** * Vendor company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Optional(nullable: true)] - public ?string $vendor_company_id; + #[Optional('vendor_company_id', nullable: true)] + public ?string $vendorCompanyID; /** * The email address of the vendor. */ - #[Optional(nullable: true)] - public ?string $vendor_email; + #[Optional('vendor_email', nullable: true)] + public ?string $vendorEmail; /** * The name of the vendor/seller/supplier. */ - #[Optional(nullable: true)] - public ?string $vendor_name; + #[Optional('vendor_name', nullable: true)] + public ?string $vendorName; /** * Vendor tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Optional(nullable: true)] - public ?string $vendor_tax_id; + #[Optional('vendor_tax_id', nullable: true)] + public ?string $vendorTaxID; public function __construct() { @@ -385,159 +389,159 @@ public function __construct() * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * }>|null $allowances * @param list|null $attachments * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * }>|null $charges * @param CurrencyCode|value-of $currency * @param DocumentDirection|value-of $direction - * @param DocumentType|value-of $document_type + * @param DocumentType|value-of $documentType * @param list|null, * amount?: string|null, * charges?: list|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: string|null, * tax?: string|null, - * tax_rate?: string|null, + * taxRate?: string|null, * unit?: value-of|null, - * unit_price?: string|null, + * unitPrice?: string|null, * }> $items * @param list|null $payment_details + * }>|null $paymentDetails * @param DocumentState|value-of $state - * @param TaxCode|value-of $tax_code + * @param TaxCode|value-of $taxCode * @param list|null $tax_details + * }>|null $taxDetails * @param Vatex|value-of|null $vatex */ public static function with( ?array $allowances = null, - ?string $amount_due = null, + ?string $amountDue = null, ?array $attachments = null, - ?string $billing_address = null, - ?string $billing_address_recipient = null, + ?string $billingAddress = null, + ?string $billingAddressRecipient = null, ?array $charges = null, CurrencyCode|string|null $currency = null, - ?string $customer_address = null, - ?string $customer_address_recipient = null, - ?string $customer_company_id = null, - ?string $customer_email = null, - ?string $customer_id = null, - ?string $customer_name = null, - ?string $customer_tax_id = null, + ?string $customerAddress = null, + ?string $customerAddressRecipient = null, + ?string $customerCompanyID = null, + ?string $customerEmail = null, + ?string $customerID = null, + ?string $customerName = null, + ?string $customerTaxID = null, DocumentDirection|string|null $direction = null, - DocumentType|string|null $document_type = null, - ?\DateTimeInterface $due_date = null, - ?\DateTimeInterface $invoice_date = null, - ?string $invoice_id = null, - ?string $invoice_total = null, + DocumentType|string|null $documentType = null, + ?\DateTimeInterface $dueDate = null, + ?\DateTimeInterface $invoiceDate = null, + ?string $invoiceID = null, + ?string $invoiceTotal = null, ?array $items = null, ?string $note = null, - ?array $payment_details = null, - ?string $payment_term = null, - ?string $purchase_order = null, - ?string $remittance_address = null, - ?string $remittance_address_recipient = null, - ?string $service_address = null, - ?string $service_address_recipient = null, - ?\DateTimeInterface $service_end_date = null, - ?\DateTimeInterface $service_start_date = null, - ?string $shipping_address = null, - ?string $shipping_address_recipient = null, + ?array $paymentDetails = null, + ?string $paymentTerm = null, + ?string $purchaseOrder = null, + ?string $remittanceAddress = null, + ?string $remittanceAddressRecipient = null, + ?string $serviceAddress = null, + ?string $serviceAddressRecipient = null, + ?\DateTimeInterface $serviceEndDate = null, + ?\DateTimeInterface $serviceStartDate = null, + ?string $shippingAddress = null, + ?string $shippingAddressRecipient = null, DocumentState|string|null $state = null, ?string $subtotal = null, ?bool $success = null, - TaxCode|string|null $tax_code = null, - ?array $tax_details = null, - ?string $total_discount = null, - ?string $total_tax = null, - ?string $ubl_document = null, + TaxCode|string|null $taxCode = null, + ?array $taxDetails = null, + ?string $totalDiscount = null, + ?string $totalTax = null, + ?string $ublDocument = null, Vatex|string|null $vatex = null, - ?string $vatex_note = null, - ?string $vendor_address = null, - ?string $vendor_address_recipient = null, - ?string $vendor_company_id = null, - ?string $vendor_email = null, - ?string $vendor_name = null, - ?string $vendor_tax_id = null, + ?string $vatexNote = null, + ?string $vendorAddress = null, + ?string $vendorAddressRecipient = null, + ?string $vendorCompanyID = null, + ?string $vendorEmail = null, + ?string $vendorName = null, + ?string $vendorTaxID = null, ): self { $obj = new self; null !== $allowances && $obj['allowances'] = $allowances; - null !== $amount_due && $obj['amount_due'] = $amount_due; + null !== $amountDue && $obj['amountDue'] = $amountDue; null !== $attachments && $obj['attachments'] = $attachments; - null !== $billing_address && $obj['billing_address'] = $billing_address; - null !== $billing_address_recipient && $obj['billing_address_recipient'] = $billing_address_recipient; + null !== $billingAddress && $obj['billingAddress'] = $billingAddress; + null !== $billingAddressRecipient && $obj['billingAddressRecipient'] = $billingAddressRecipient; null !== $charges && $obj['charges'] = $charges; null !== $currency && $obj['currency'] = $currency; - null !== $customer_address && $obj['customer_address'] = $customer_address; - null !== $customer_address_recipient && $obj['customer_address_recipient'] = $customer_address_recipient; - null !== $customer_company_id && $obj['customer_company_id'] = $customer_company_id; - null !== $customer_email && $obj['customer_email'] = $customer_email; - null !== $customer_id && $obj['customer_id'] = $customer_id; - null !== $customer_name && $obj['customer_name'] = $customer_name; - null !== $customer_tax_id && $obj['customer_tax_id'] = $customer_tax_id; + null !== $customerAddress && $obj['customerAddress'] = $customerAddress; + null !== $customerAddressRecipient && $obj['customerAddressRecipient'] = $customerAddressRecipient; + null !== $customerCompanyID && $obj['customerCompanyID'] = $customerCompanyID; + null !== $customerEmail && $obj['customerEmail'] = $customerEmail; + null !== $customerID && $obj['customerID'] = $customerID; + null !== $customerName && $obj['customerName'] = $customerName; + null !== $customerTaxID && $obj['customerTaxID'] = $customerTaxID; null !== $direction && $obj['direction'] = $direction; - null !== $document_type && $obj['document_type'] = $document_type; - null !== $due_date && $obj['due_date'] = $due_date; - null !== $invoice_date && $obj['invoice_date'] = $invoice_date; - null !== $invoice_id && $obj['invoice_id'] = $invoice_id; - null !== $invoice_total && $obj['invoice_total'] = $invoice_total; + null !== $documentType && $obj['documentType'] = $documentType; + null !== $dueDate && $obj['dueDate'] = $dueDate; + null !== $invoiceDate && $obj['invoiceDate'] = $invoiceDate; + null !== $invoiceID && $obj['invoiceID'] = $invoiceID; + null !== $invoiceTotal && $obj['invoiceTotal'] = $invoiceTotal; null !== $items && $obj['items'] = $items; null !== $note && $obj['note'] = $note; - null !== $payment_details && $obj['payment_details'] = $payment_details; - null !== $payment_term && $obj['payment_term'] = $payment_term; - null !== $purchase_order && $obj['purchase_order'] = $purchase_order; - null !== $remittance_address && $obj['remittance_address'] = $remittance_address; - null !== $remittance_address_recipient && $obj['remittance_address_recipient'] = $remittance_address_recipient; - null !== $service_address && $obj['service_address'] = $service_address; - null !== $service_address_recipient && $obj['service_address_recipient'] = $service_address_recipient; - null !== $service_end_date && $obj['service_end_date'] = $service_end_date; - null !== $service_start_date && $obj['service_start_date'] = $service_start_date; - null !== $shipping_address && $obj['shipping_address'] = $shipping_address; - null !== $shipping_address_recipient && $obj['shipping_address_recipient'] = $shipping_address_recipient; + null !== $paymentDetails && $obj['paymentDetails'] = $paymentDetails; + null !== $paymentTerm && $obj['paymentTerm'] = $paymentTerm; + null !== $purchaseOrder && $obj['purchaseOrder'] = $purchaseOrder; + null !== $remittanceAddress && $obj['remittanceAddress'] = $remittanceAddress; + null !== $remittanceAddressRecipient && $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; + null !== $serviceAddress && $obj['serviceAddress'] = $serviceAddress; + null !== $serviceAddressRecipient && $obj['serviceAddressRecipient'] = $serviceAddressRecipient; + null !== $serviceEndDate && $obj['serviceEndDate'] = $serviceEndDate; + null !== $serviceStartDate && $obj['serviceStartDate'] = $serviceStartDate; + null !== $shippingAddress && $obj['shippingAddress'] = $shippingAddress; + null !== $shippingAddressRecipient && $obj['shippingAddressRecipient'] = $shippingAddressRecipient; null !== $state && $obj['state'] = $state; null !== $subtotal && $obj['subtotal'] = $subtotal; null !== $success && $obj['success'] = $success; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_details && $obj['tax_details'] = $tax_details; - null !== $total_discount && $obj['total_discount'] = $total_discount; - null !== $total_tax && $obj['total_tax'] = $total_tax; - null !== $ubl_document && $obj['ubl_document'] = $ubl_document; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxDetails && $obj['taxDetails'] = $taxDetails; + null !== $totalDiscount && $obj['totalDiscount'] = $totalDiscount; + null !== $totalTax && $obj['totalTax'] = $totalTax; + null !== $ublDocument && $obj['ublDocument'] = $ublDocument; null !== $vatex && $obj['vatex'] = $vatex; - null !== $vatex_note && $obj['vatex_note'] = $vatex_note; - null !== $vendor_address && $obj['vendor_address'] = $vendor_address; - null !== $vendor_address_recipient && $obj['vendor_address_recipient'] = $vendor_address_recipient; - null !== $vendor_company_id && $obj['vendor_company_id'] = $vendor_company_id; - null !== $vendor_email && $obj['vendor_email'] = $vendor_email; - null !== $vendor_name && $obj['vendor_name'] = $vendor_name; - null !== $vendor_tax_id && $obj['vendor_tax_id'] = $vendor_tax_id; + null !== $vatexNote && $obj['vatexNote'] = $vatexNote; + null !== $vendorAddress && $obj['vendorAddress'] = $vendorAddress; + null !== $vendorAddressRecipient && $obj['vendorAddressRecipient'] = $vendorAddressRecipient; + null !== $vendorCompanyID && $obj['vendorCompanyID'] = $vendorCompanyID; + null !== $vendorEmail && $obj['vendorEmail'] = $vendorEmail; + null !== $vendorName && $obj['vendorName'] = $vendorName; + null !== $vendorTaxID && $obj['vendorTaxID'] = $vendorTaxID; return $obj; } @@ -545,12 +549,12 @@ public static function with( /** * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * }>|null $allowances */ public function withAllowances(?array $allowances): self @@ -567,17 +571,17 @@ public function withAllowances(?array $allowances): self public function withAmountDue(?string $amountDue): self { $obj = clone $this; - $obj['amount_due'] = $amountDue; + $obj['amountDue'] = $amountDue; return $obj; } /** * @param list|null $attachments */ public function withAttachments(?array $attachments): self @@ -594,7 +598,7 @@ public function withAttachments(?array $attachments): self public function withBillingAddress(?string $billingAddress): self { $obj = clone $this; - $obj['billing_address'] = $billingAddress; + $obj['billingAddress'] = $billingAddress; return $obj; } @@ -606,7 +610,7 @@ public function withBillingAddressRecipient( ?string $billingAddressRecipient ): self { $obj = clone $this; - $obj['billing_address_recipient'] = $billingAddressRecipient; + $obj['billingAddressRecipient'] = $billingAddressRecipient; return $obj; } @@ -614,12 +618,12 @@ public function withBillingAddressRecipient( /** * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * }>|null $charges */ public function withCharges(?array $charges): self @@ -649,7 +653,7 @@ public function withCurrency(CurrencyCode|string $currency): self public function withCustomerAddress(?string $customerAddress): self { $obj = clone $this; - $obj['customer_address'] = $customerAddress; + $obj['customerAddress'] = $customerAddress; return $obj; } @@ -661,7 +665,7 @@ public function withCustomerAddressRecipient( ?string $customerAddressRecipient ): self { $obj = clone $this; - $obj['customer_address_recipient'] = $customerAddressRecipient; + $obj['customerAddressRecipient'] = $customerAddressRecipient; return $obj; } @@ -672,7 +676,7 @@ public function withCustomerAddressRecipient( public function withCustomerCompanyID(?string $customerCompanyID): self { $obj = clone $this; - $obj['customer_company_id'] = $customerCompanyID; + $obj['customerCompanyID'] = $customerCompanyID; return $obj; } @@ -683,7 +687,7 @@ public function withCustomerCompanyID(?string $customerCompanyID): self public function withCustomerEmail(?string $customerEmail): self { $obj = clone $this; - $obj['customer_email'] = $customerEmail; + $obj['customerEmail'] = $customerEmail; return $obj; } @@ -694,7 +698,7 @@ public function withCustomerEmail(?string $customerEmail): self public function withCustomerID(?string $customerID): self { $obj = clone $this; - $obj['customer_id'] = $customerID; + $obj['customerID'] = $customerID; return $obj; } @@ -705,7 +709,7 @@ public function withCustomerID(?string $customerID): self public function withCustomerName(?string $customerName): self { $obj = clone $this; - $obj['customer_name'] = $customerName; + $obj['customerName'] = $customerName; return $obj; } @@ -716,7 +720,7 @@ public function withCustomerName(?string $customerName): self public function withCustomerTaxID(?string $customerTaxID): self { $obj = clone $this; - $obj['customer_tax_id'] = $customerTaxID; + $obj['customerTaxID'] = $customerTaxID; return $obj; } @@ -742,7 +746,7 @@ public function withDirection(DocumentDirection|string $direction): self public function withDocumentType(DocumentType|string $documentType): self { $obj = clone $this; - $obj['document_type'] = $documentType; + $obj['documentType'] = $documentType; return $obj; } @@ -753,7 +757,7 @@ public function withDocumentType(DocumentType|string $documentType): self public function withDueDate(?\DateTimeInterface $dueDate): self { $obj = clone $this; - $obj['due_date'] = $dueDate; + $obj['dueDate'] = $dueDate; return $obj; } @@ -764,7 +768,7 @@ public function withDueDate(?\DateTimeInterface $dueDate): self public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self { $obj = clone $this; - $obj['invoice_date'] = $invoiceDate; + $obj['invoiceDate'] = $invoiceDate; return $obj; } @@ -775,7 +779,7 @@ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self public function withInvoiceID(?string $invoiceID): self { $obj = clone $this; - $obj['invoice_id'] = $invoiceID; + $obj['invoiceID'] = $invoiceID; return $obj; } @@ -786,7 +790,7 @@ public function withInvoiceID(?string $invoiceID): self public function withInvoiceTotal(?string $invoiceTotal): self { $obj = clone $this; - $obj['invoice_total'] = $invoiceTotal; + $obj['invoiceTotal'] = $invoiceTotal; return $obj; } @@ -800,12 +804,12 @@ public function withInvoiceTotal(?string $invoiceTotal): self * charges?: list|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: string|null, * tax?: string|null, - * tax_rate?: string|null, + * taxRate?: string|null, * unit?: value-of|null, - * unit_price?: string|null, + * unitPrice?: string|null, * }> $items */ public function withItems(array $items): self @@ -829,16 +833,16 @@ public function withNote(?string $note): self /** * @param list|null $paymentDetails */ public function withPaymentDetails(?array $paymentDetails): self { $obj = clone $this; - $obj['payment_details'] = $paymentDetails; + $obj['paymentDetails'] = $paymentDetails; return $obj; } @@ -849,7 +853,7 @@ public function withPaymentDetails(?array $paymentDetails): self public function withPaymentTerm(?string $paymentTerm): self { $obj = clone $this; - $obj['payment_term'] = $paymentTerm; + $obj['paymentTerm'] = $paymentTerm; return $obj; } @@ -860,7 +864,7 @@ public function withPaymentTerm(?string $paymentTerm): self public function withPurchaseOrder(?string $purchaseOrder): self { $obj = clone $this; - $obj['purchase_order'] = $purchaseOrder; + $obj['purchaseOrder'] = $purchaseOrder; return $obj; } @@ -871,7 +875,7 @@ public function withPurchaseOrder(?string $purchaseOrder): self public function withRemittanceAddress(?string $remittanceAddress): self { $obj = clone $this; - $obj['remittance_address'] = $remittanceAddress; + $obj['remittanceAddress'] = $remittanceAddress; return $obj; } @@ -883,7 +887,7 @@ public function withRemittanceAddressRecipient( ?string $remittanceAddressRecipient ): self { $obj = clone $this; - $obj['remittance_address_recipient'] = $remittanceAddressRecipient; + $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; return $obj; } @@ -894,7 +898,7 @@ public function withRemittanceAddressRecipient( public function withServiceAddress(?string $serviceAddress): self { $obj = clone $this; - $obj['service_address'] = $serviceAddress; + $obj['serviceAddress'] = $serviceAddress; return $obj; } @@ -906,7 +910,7 @@ public function withServiceAddressRecipient( ?string $serviceAddressRecipient ): self { $obj = clone $this; - $obj['service_address_recipient'] = $serviceAddressRecipient; + $obj['serviceAddressRecipient'] = $serviceAddressRecipient; return $obj; } @@ -918,7 +922,7 @@ public function withServiceEndDate( ?\DateTimeInterface $serviceEndDate ): self { $obj = clone $this; - $obj['service_end_date'] = $serviceEndDate; + $obj['serviceEndDate'] = $serviceEndDate; return $obj; } @@ -930,7 +934,7 @@ public function withServiceStartDate( ?\DateTimeInterface $serviceStartDate ): self { $obj = clone $this; - $obj['service_start_date'] = $serviceStartDate; + $obj['serviceStartDate'] = $serviceStartDate; return $obj; } @@ -941,7 +945,7 @@ public function withServiceStartDate( public function withShippingAddress(?string $shippingAddress): self { $obj = clone $this; - $obj['shipping_address'] = $shippingAddress; + $obj['shippingAddress'] = $shippingAddress; return $obj; } @@ -953,7 +957,7 @@ public function withShippingAddressRecipient( ?string $shippingAddressRecipient ): self { $obj = clone $this; - $obj['shipping_address_recipient'] = $shippingAddressRecipient; + $obj['shippingAddressRecipient'] = $shippingAddressRecipient; return $obj; } @@ -1001,7 +1005,7 @@ public function withSuccess(bool $success): self public function withTaxCode(TaxCode|string $taxCode): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -1014,7 +1018,7 @@ public function withTaxCode(TaxCode|string $taxCode): self public function withTaxDetails(?array $taxDetails): self { $obj = clone $this; - $obj['tax_details'] = $taxDetails; + $obj['taxDetails'] = $taxDetails; return $obj; } @@ -1025,7 +1029,7 @@ public function withTaxDetails(?array $taxDetails): self public function withTotalDiscount(?string $totalDiscount): self { $obj = clone $this; - $obj['total_discount'] = $totalDiscount; + $obj['totalDiscount'] = $totalDiscount; return $obj; } @@ -1036,7 +1040,7 @@ public function withTotalDiscount(?string $totalDiscount): self public function withTotalTax(?string $totalTax): self { $obj = clone $this; - $obj['total_tax'] = $totalTax; + $obj['totalTax'] = $totalTax; return $obj; } @@ -1047,7 +1051,7 @@ public function withTotalTax(?string $totalTax): self public function withUblDocument(?string $ublDocument): self { $obj = clone $this; - $obj['ubl_document'] = $ublDocument; + $obj['ublDocument'] = $ublDocument; return $obj; } @@ -1074,7 +1078,7 @@ public function withVatex(Vatex|string|null $vatex): self public function withVatexNote(?string $vatexNote): self { $obj = clone $this; - $obj['vatex_note'] = $vatexNote; + $obj['vatexNote'] = $vatexNote; return $obj; } @@ -1085,7 +1089,7 @@ public function withVatexNote(?string $vatexNote): self public function withVendorAddress(?string $vendorAddress): self { $obj = clone $this; - $obj['vendor_address'] = $vendorAddress; + $obj['vendorAddress'] = $vendorAddress; return $obj; } @@ -1097,7 +1101,7 @@ public function withVendorAddressRecipient( ?string $vendorAddressRecipient ): self { $obj = clone $this; - $obj['vendor_address_recipient'] = $vendorAddressRecipient; + $obj['vendorAddressRecipient'] = $vendorAddressRecipient; return $obj; } @@ -1108,7 +1112,7 @@ public function withVendorAddressRecipient( public function withVendorCompanyID(?string $vendorCompanyID): self { $obj = clone $this; - $obj['vendor_company_id'] = $vendorCompanyID; + $obj['vendorCompanyID'] = $vendorCompanyID; return $obj; } @@ -1119,7 +1123,7 @@ public function withVendorCompanyID(?string $vendorCompanyID): self public function withVendorEmail(?string $vendorEmail): self { $obj = clone $this; - $obj['vendor_email'] = $vendorEmail; + $obj['vendorEmail'] = $vendorEmail; return $obj; } @@ -1130,7 +1134,7 @@ public function withVendorEmail(?string $vendorEmail): self public function withVendorName(?string $vendorName): self { $obj = clone $this; - $obj['vendor_name'] = $vendorName; + $obj['vendorName'] = $vendorName; return $obj; } @@ -1141,7 +1145,7 @@ public function withVendorName(?string $vendorName): self public function withVendorTaxID(?string $vendorTaxID): self { $obj = clone $this; - $obj['vendor_tax_id'] = $vendorTaxID; + $obj['vendorTaxID'] = $vendorTaxID; return $obj; } diff --git a/src/Documents/DocumentNewFromPdfResponse/Item.php b/src/Documents/DocumentNewFromPdfResponse/Item.php index 45325b45..4f7937df 100644 --- a/src/Documents/DocumentNewFromPdfResponse/Item.php +++ b/src/Documents/DocumentNewFromPdfResponse/Item.php @@ -20,12 +20,12 @@ * charges?: list|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: string|null, * tax?: string|null, - * tax_rate?: string|null, + * taxRate?: string|null, * unit?: value-of|null, - * unit_price?: string|null, + * unitPrice?: string|null, * } */ final class Item implements BaseModel @@ -68,8 +68,8 @@ final class Item implements BaseModel /** * The product code of the line item. */ - #[Optional(nullable: true)] - public ?string $product_code; + #[Optional('product_code', nullable: true)] + public ?string $productCode; /** * The quantity of items (goods or services) that is the subject of the line item. Must be rounded to maximum 4 decimals. Can be negative for credit notes or corrections. @@ -86,8 +86,8 @@ final class Item implements BaseModel /** * The VAT rate of the line item expressed as percentage with 2 decimals. */ - #[Optional(nullable: true)] - public ?string $tax_rate; + #[Optional('tax_rate', nullable: true)] + public ?string $taxRate; /** * Unit of Measure Codes from UNECERec20 used in Peppol BIS Billing 3.0. @@ -100,8 +100,8 @@ final class Item implements BaseModel /** * The item net price (BT-146). The price of an item, exclusive of VAT, after subtracting item price discount. Must be rounded to maximum 4 decimals. */ - #[Optional(nullable: true)] - public ?string $unit_price; + #[Optional('unit_price', nullable: true)] + public ?string $unitPrice; public function __construct() { @@ -115,21 +115,21 @@ public function __construct() * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * }>|null $allowances * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * }>|null $charges * @param UnitOfMeasureCode|value-of|null $unit */ @@ -139,12 +139,12 @@ public static function with( ?array $charges = null, null $date = null, ?string $description = null, - ?string $product_code = null, + ?string $productCode = null, ?string $quantity = null, ?string $tax = null, - ?string $tax_rate = null, + ?string $taxRate = null, UnitOfMeasureCode|string|null $unit = null, - ?string $unit_price = null, + ?string $unitPrice = null, ): self { $obj = new self; @@ -154,12 +154,12 @@ public static function with( null !== $amount && $obj['amount'] = $amount; null !== $charges && $obj['charges'] = $charges; null !== $description && $obj['description'] = $description; - null !== $product_code && $obj['product_code'] = $product_code; + null !== $productCode && $obj['productCode'] = $productCode; null !== $quantity && $obj['quantity'] = $quantity; null !== $tax && $obj['tax'] = $tax; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $taxRate && $obj['taxRate'] = $taxRate; null !== $unit && $obj['unit'] = $unit; - null !== $unit_price && $obj['unit_price'] = $unit_price; + null !== $unitPrice && $obj['unitPrice'] = $unitPrice; return $obj; } @@ -169,12 +169,12 @@ public static function with( * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * }>|null $allowances */ public function withAllowances(?array $allowances): self @@ -201,12 +201,12 @@ public function withAmount(?string $amount): self * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * }>|null $charges */ public function withCharges(?array $charges): self @@ -245,7 +245,7 @@ public function withDescription(?string $description): self public function withProductCode(?string $productCode): self { $obj = clone $this; - $obj['product_code'] = $productCode; + $obj['productCode'] = $productCode; return $obj; } @@ -278,7 +278,7 @@ public function withTax(?string $tax): self public function withTaxRate(?string $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } @@ -302,7 +302,7 @@ public function withUnit(UnitOfMeasureCode|string|null $unit): self public function withUnitPrice(?string $unitPrice): self { $obj = clone $this; - $obj['unit_price'] = $unitPrice; + $obj['unitPrice'] = $unitPrice; return $obj; } diff --git a/src/Documents/DocumentResponse.php b/src/Documents/DocumentResponse.php index 8231c582..8870a8c7 100644 --- a/src/Documents/DocumentResponse.php +++ b/src/Documents/DocumentResponse.php @@ -21,52 +21,52 @@ * @phpstan-type DocumentResponseShape = array{ * id: string, * allowances?: list<\EInvoiceAPI\Documents\DocumentResponse\Allowance>|null, - * amount_due?: string|null, + * amountDue?: string|null, * attachments?: list|null, - * billing_address?: string|null, - * billing_address_recipient?: string|null, + * billingAddress?: string|null, + * billingAddressRecipient?: string|null, * charges?: list<\EInvoiceAPI\Documents\DocumentResponse\Charge>|null, * currency?: value-of|null, - * customer_address?: string|null, - * customer_address_recipient?: string|null, - * customer_company_id?: string|null, - * customer_email?: string|null, - * customer_id?: string|null, - * customer_name?: string|null, - * customer_tax_id?: string|null, + * customerAddress?: string|null, + * customerAddressRecipient?: string|null, + * customerCompanyID?: string|null, + * customerEmail?: string|null, + * customerID?: string|null, + * customerName?: string|null, + * customerTaxID?: string|null, * direction?: value-of|null, - * document_type?: value-of|null, - * due_date?: \DateTimeInterface|null, - * invoice_date?: \DateTimeInterface|null, - * invoice_id?: string|null, - * invoice_total?: string|null, + * documentType?: value-of|null, + * dueDate?: \DateTimeInterface|null, + * invoiceDate?: \DateTimeInterface|null, + * invoiceID?: string|null, + * invoiceTotal?: string|null, * items?: list|null, * note?: string|null, - * payment_details?: list|null, - * payment_term?: string|null, - * purchase_order?: string|null, - * remittance_address?: string|null, - * remittance_address_recipient?: string|null, - * service_address?: string|null, - * service_address_recipient?: string|null, - * service_end_date?: \DateTimeInterface|null, - * service_start_date?: \DateTimeInterface|null, - * shipping_address?: string|null, - * shipping_address_recipient?: string|null, + * paymentDetails?: list|null, + * paymentTerm?: string|null, + * purchaseOrder?: string|null, + * remittanceAddress?: string|null, + * remittanceAddressRecipient?: string|null, + * serviceAddress?: string|null, + * serviceAddressRecipient?: string|null, + * serviceEndDate?: \DateTimeInterface|null, + * serviceStartDate?: \DateTimeInterface|null, + * shippingAddress?: string|null, + * shippingAddressRecipient?: string|null, * state?: value-of|null, * subtotal?: string|null, - * tax_code?: value-of|null, - * tax_details?: list|null, - * total_discount?: string|null, - * total_tax?: string|null, + * taxCode?: value-of|null, + * taxDetails?: list|null, + * totalDiscount?: string|null, + * totalTax?: string|null, * vatex?: value-of|null, - * vatex_note?: string|null, - * vendor_address?: string|null, - * vendor_address_recipient?: string|null, - * vendor_company_id?: string|null, - * vendor_email?: string|null, - * vendor_name?: string|null, - * vendor_tax_id?: string|null, + * vatexNote?: string|null, + * vendorAddress?: string|null, + * vendorAddressRecipient?: string|null, + * vendorCompanyID?: string|null, + * vendorEmail?: string|null, + * vendorName?: string|null, + * vendorTaxID?: string|null, * } */ final class DocumentResponse implements BaseModel @@ -87,8 +87,8 @@ final class DocumentResponse implements BaseModel /** * The amount due for payment. Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public ?string $amount_due; + #[Optional('amount_due', nullable: true)] + public ?string $amountDue; /** @var list|null $attachments */ #[Optional(list: DocumentAttachment::class, nullable: true)] @@ -97,14 +97,14 @@ final class DocumentResponse implements BaseModel /** * The billing address (if different from customer address). */ - #[Optional(nullable: true)] - public ?string $billing_address; + #[Optional('billing_address', nullable: true)] + public ?string $billingAddress; /** * The recipient name at the billing address. */ - #[Optional(nullable: true)] - public ?string $billing_address_recipient; + #[Optional('billing_address_recipient', nullable: true)] + public ?string $billingAddressRecipient; /** @var list|null $charges */ #[Optional( @@ -124,44 +124,44 @@ final class DocumentResponse implements BaseModel /** * The address of the customer/buyer. */ - #[Optional(nullable: true)] - public ?string $customer_address; + #[Optional('customer_address', nullable: true)] + public ?string $customerAddress; /** * The recipient name at the customer address. */ - #[Optional(nullable: true)] - public ?string $customer_address_recipient; + #[Optional('customer_address_recipient', nullable: true)] + public ?string $customerAddressRecipient; /** * Customer company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Optional(nullable: true)] - public ?string $customer_company_id; + #[Optional('customer_company_id', nullable: true)] + public ?string $customerCompanyID; /** * The email address of the customer. */ - #[Optional(nullable: true)] - public ?string $customer_email; + #[Optional('customer_email', nullable: true)] + public ?string $customerEmail; /** * The unique identifier for the customer in your system. */ - #[Optional(nullable: true)] - public ?string $customer_id; + #[Optional('customer_id', nullable: true)] + public ?string $customerID; /** * The company name of the customer/buyer. */ - #[Optional(nullable: true)] - public ?string $customer_name; + #[Optional('customer_name', nullable: true)] + public ?string $customerName; /** * Customer tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Optional(nullable: true)] - public ?string $customer_tax_id; + #[Optional('customer_tax_id', nullable: true)] + public ?string $customerTaxID; /** * The direction of the document: INBOUND (purchases) or OUTBOUND (sales). @@ -174,34 +174,34 @@ final class DocumentResponse implements BaseModel /** * The type of document: INVOICE, CREDIT_NOTE, or DEBIT_NOTE. * - * @var value-of|null $document_type + * @var value-of|null $documentType */ - #[Optional(enum: DocumentType::class)] - public ?string $document_type; + #[Optional('document_type', enum: DocumentType::class)] + public ?string $documentType; /** * The date when payment is due. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $due_date; + #[Optional('due_date', nullable: true)] + public ?\DateTimeInterface $dueDate; /** * The date when the invoice was issued. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $invoice_date; + #[Optional('invoice_date', nullable: true)] + public ?\DateTimeInterface $invoiceDate; /** * The unique invoice identifier/number. */ - #[Optional(nullable: true)] - public ?string $invoice_id; + #[Optional('invoice_id', nullable: true)] + public ?string $invoiceID; /** * The total amount of the invoice including tax (invoice_total = subtotal + total_tax + total_discount). Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public ?string $invoice_total; + #[Optional('invoice_total', nullable: true)] + public ?string $invoiceTotal; /** @var list|null $items */ #[Optional(list: Item::class, nullable: true)] @@ -213,69 +213,69 @@ final class DocumentResponse implements BaseModel #[Optional(nullable: true)] public ?string $note; - /** @var list|null $payment_details */ - #[Optional(list: PaymentDetail::class, nullable: true)] - public ?array $payment_details; + /** @var list|null $paymentDetails */ + #[Optional('payment_details', list: PaymentDetail::class, nullable: true)] + public ?array $paymentDetails; /** * The payment terms (e.g., 'Net 30', 'Due on receipt', '2/10 Net 30'). */ - #[Optional(nullable: true)] - public ?string $payment_term; + #[Optional('payment_term', nullable: true)] + public ?string $paymentTerm; /** * The purchase order reference number. */ - #[Optional(nullable: true)] - public ?string $purchase_order; + #[Optional('purchase_order', nullable: true)] + public ?string $purchaseOrder; /** * The address where payment should be sent or remitted to. */ - #[Optional(nullable: true)] - public ?string $remittance_address; + #[Optional('remittance_address', nullable: true)] + public ?string $remittanceAddress; /** * The recipient name at the remittance address. */ - #[Optional(nullable: true)] - public ?string $remittance_address_recipient; + #[Optional('remittance_address_recipient', nullable: true)] + public ?string $remittanceAddressRecipient; /** * The address where services were performed or goods were delivered. */ - #[Optional(nullable: true)] - public ?string $service_address; + #[Optional('service_address', nullable: true)] + public ?string $serviceAddress; /** * The recipient name at the service address. */ - #[Optional(nullable: true)] - public ?string $service_address_recipient; + #[Optional('service_address_recipient', nullable: true)] + public ?string $serviceAddressRecipient; /** * The end date of the service period or delivery period. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $service_end_date; + #[Optional('service_end_date', nullable: true)] + public ?\DateTimeInterface $serviceEndDate; /** * The start date of the service period or delivery period. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $service_start_date; + #[Optional('service_start_date', nullable: true)] + public ?\DateTimeInterface $serviceStartDate; /** * The shipping/delivery address. */ - #[Optional(nullable: true)] - public ?string $shipping_address; + #[Optional('shipping_address', nullable: true)] + public ?string $shippingAddress; /** * The recipient name at the shipping address. */ - #[Optional(nullable: true)] - public ?string $shipping_address_recipient; + #[Optional('shipping_address_recipient', nullable: true)] + public ?string $shippingAddressRecipient; /** * The current state of the document: DRAFT, TRANSIT, FAILED, SENT, or RECEIVED. @@ -294,26 +294,26 @@ final class DocumentResponse implements BaseModel /** * Tax category code of the invoice (e.g., S for standard rate, Z for zero rate, E for exempt). * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ - #[Optional(enum: TaxCode::class)] - public ?string $tax_code; + #[Optional('tax_code', enum: TaxCode::class)] + public ?string $taxCode; - /** @var list|null $tax_details */ - #[Optional(list: TaxDetail::class, nullable: true)] - public ?array $tax_details; + /** @var list|null $taxDetails */ + #[Optional('tax_details', list: TaxDetail::class, nullable: true)] + public ?array $taxDetails; /** * The net financial discount/charge of the invoice (non-VAT charges minus non-VAT allowances). Can be positive (net charge), negative (net discount), or zero. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public ?string $total_discount; + #[Optional('total_discount', nullable: true)] + public ?string $totalDiscount; /** * The total tax amount of the invoice. Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public ?string $total_tax; + #[Optional('total_tax', nullable: true)] + public ?string $totalTax; /** * VATEX code list for VAT exemption reasons. @@ -329,44 +329,44 @@ final class DocumentResponse implements BaseModel /** * Textual explanation for VAT exemption. */ - #[Optional(nullable: true)] - public ?string $vatex_note; + #[Optional('vatex_note', nullable: true)] + public ?string $vatexNote; /** * The address of the vendor/seller. */ - #[Optional(nullable: true)] - public ?string $vendor_address; + #[Optional('vendor_address', nullable: true)] + public ?string $vendorAddress; /** * The recipient name at the vendor address. */ - #[Optional(nullable: true)] - public ?string $vendor_address_recipient; + #[Optional('vendor_address_recipient', nullable: true)] + public ?string $vendorAddressRecipient; /** * Vendor company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Optional(nullable: true)] - public ?string $vendor_company_id; + #[Optional('vendor_company_id', nullable: true)] + public ?string $vendorCompanyID; /** * The email address of the vendor. */ - #[Optional(nullable: true)] - public ?string $vendor_email; + #[Optional('vendor_email', nullable: true)] + public ?string $vendorEmail; /** * The name of the vendor/seller/supplier. */ - #[Optional(nullable: true)] - public ?string $vendor_name; + #[Optional('vendor_name', nullable: true)] + public ?string $vendorName; /** * Vendor tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Optional(nullable: true)] - public ?string $vendor_tax_id; + #[Optional('vendor_tax_id', nullable: true)] + public ?string $vendorTaxID; /** * `new DocumentResponse()` is missing required properties by the API. @@ -394,159 +394,159 @@ public function __construct() * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * }>|null $allowances * @param list|null $attachments * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * }>|null $charges * @param CurrencyCode|value-of $currency * @param DocumentDirection|value-of $direction - * @param DocumentType|value-of $document_type + * @param DocumentType|value-of $documentType * @param list|null, * amount?: string|null, * charges?: list|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: string|null, * tax?: string|null, - * tax_rate?: string|null, + * taxRate?: string|null, * unit?: value-of|null, - * unit_price?: string|null, + * unitPrice?: string|null, * }>|null $items * @param list|null $payment_details + * }>|null $paymentDetails * @param DocumentState|value-of $state - * @param TaxCode|value-of $tax_code + * @param TaxCode|value-of $taxCode * @param list|null $tax_details + * }>|null $taxDetails * @param Vatex|value-of|null $vatex */ public static function with( string $id, ?array $allowances = null, - ?string $amount_due = null, + ?string $amountDue = null, ?array $attachments = null, - ?string $billing_address = null, - ?string $billing_address_recipient = null, + ?string $billingAddress = null, + ?string $billingAddressRecipient = null, ?array $charges = null, CurrencyCode|string|null $currency = null, - ?string $customer_address = null, - ?string $customer_address_recipient = null, - ?string $customer_company_id = null, - ?string $customer_email = null, - ?string $customer_id = null, - ?string $customer_name = null, - ?string $customer_tax_id = null, + ?string $customerAddress = null, + ?string $customerAddressRecipient = null, + ?string $customerCompanyID = null, + ?string $customerEmail = null, + ?string $customerID = null, + ?string $customerName = null, + ?string $customerTaxID = null, DocumentDirection|string|null $direction = null, - DocumentType|string|null $document_type = null, - ?\DateTimeInterface $due_date = null, - ?\DateTimeInterface $invoice_date = null, - ?string $invoice_id = null, - ?string $invoice_total = null, + DocumentType|string|null $documentType = null, + ?\DateTimeInterface $dueDate = null, + ?\DateTimeInterface $invoiceDate = null, + ?string $invoiceID = null, + ?string $invoiceTotal = null, ?array $items = null, ?string $note = null, - ?array $payment_details = null, - ?string $payment_term = null, - ?string $purchase_order = null, - ?string $remittance_address = null, - ?string $remittance_address_recipient = null, - ?string $service_address = null, - ?string $service_address_recipient = null, - ?\DateTimeInterface $service_end_date = null, - ?\DateTimeInterface $service_start_date = null, - ?string $shipping_address = null, - ?string $shipping_address_recipient = null, + ?array $paymentDetails = null, + ?string $paymentTerm = null, + ?string $purchaseOrder = null, + ?string $remittanceAddress = null, + ?string $remittanceAddressRecipient = null, + ?string $serviceAddress = null, + ?string $serviceAddressRecipient = null, + ?\DateTimeInterface $serviceEndDate = null, + ?\DateTimeInterface $serviceStartDate = null, + ?string $shippingAddress = null, + ?string $shippingAddressRecipient = null, DocumentState|string|null $state = null, ?string $subtotal = null, - TaxCode|string|null $tax_code = null, - ?array $tax_details = null, - ?string $total_discount = null, - ?string $total_tax = null, + TaxCode|string|null $taxCode = null, + ?array $taxDetails = null, + ?string $totalDiscount = null, + ?string $totalTax = null, Vatex|string|null $vatex = null, - ?string $vatex_note = null, - ?string $vendor_address = null, - ?string $vendor_address_recipient = null, - ?string $vendor_company_id = null, - ?string $vendor_email = null, - ?string $vendor_name = null, - ?string $vendor_tax_id = null, + ?string $vatexNote = null, + ?string $vendorAddress = null, + ?string $vendorAddressRecipient = null, + ?string $vendorCompanyID = null, + ?string $vendorEmail = null, + ?string $vendorName = null, + ?string $vendorTaxID = null, ): self { $obj = new self; $obj['id'] = $id; null !== $allowances && $obj['allowances'] = $allowances; - null !== $amount_due && $obj['amount_due'] = $amount_due; + null !== $amountDue && $obj['amountDue'] = $amountDue; null !== $attachments && $obj['attachments'] = $attachments; - null !== $billing_address && $obj['billing_address'] = $billing_address; - null !== $billing_address_recipient && $obj['billing_address_recipient'] = $billing_address_recipient; + null !== $billingAddress && $obj['billingAddress'] = $billingAddress; + null !== $billingAddressRecipient && $obj['billingAddressRecipient'] = $billingAddressRecipient; null !== $charges && $obj['charges'] = $charges; null !== $currency && $obj['currency'] = $currency; - null !== $customer_address && $obj['customer_address'] = $customer_address; - null !== $customer_address_recipient && $obj['customer_address_recipient'] = $customer_address_recipient; - null !== $customer_company_id && $obj['customer_company_id'] = $customer_company_id; - null !== $customer_email && $obj['customer_email'] = $customer_email; - null !== $customer_id && $obj['customer_id'] = $customer_id; - null !== $customer_name && $obj['customer_name'] = $customer_name; - null !== $customer_tax_id && $obj['customer_tax_id'] = $customer_tax_id; + null !== $customerAddress && $obj['customerAddress'] = $customerAddress; + null !== $customerAddressRecipient && $obj['customerAddressRecipient'] = $customerAddressRecipient; + null !== $customerCompanyID && $obj['customerCompanyID'] = $customerCompanyID; + null !== $customerEmail && $obj['customerEmail'] = $customerEmail; + null !== $customerID && $obj['customerID'] = $customerID; + null !== $customerName && $obj['customerName'] = $customerName; + null !== $customerTaxID && $obj['customerTaxID'] = $customerTaxID; null !== $direction && $obj['direction'] = $direction; - null !== $document_type && $obj['document_type'] = $document_type; - null !== $due_date && $obj['due_date'] = $due_date; - null !== $invoice_date && $obj['invoice_date'] = $invoice_date; - null !== $invoice_id && $obj['invoice_id'] = $invoice_id; - null !== $invoice_total && $obj['invoice_total'] = $invoice_total; + null !== $documentType && $obj['documentType'] = $documentType; + null !== $dueDate && $obj['dueDate'] = $dueDate; + null !== $invoiceDate && $obj['invoiceDate'] = $invoiceDate; + null !== $invoiceID && $obj['invoiceID'] = $invoiceID; + null !== $invoiceTotal && $obj['invoiceTotal'] = $invoiceTotal; null !== $items && $obj['items'] = $items; null !== $note && $obj['note'] = $note; - null !== $payment_details && $obj['payment_details'] = $payment_details; - null !== $payment_term && $obj['payment_term'] = $payment_term; - null !== $purchase_order && $obj['purchase_order'] = $purchase_order; - null !== $remittance_address && $obj['remittance_address'] = $remittance_address; - null !== $remittance_address_recipient && $obj['remittance_address_recipient'] = $remittance_address_recipient; - null !== $service_address && $obj['service_address'] = $service_address; - null !== $service_address_recipient && $obj['service_address_recipient'] = $service_address_recipient; - null !== $service_end_date && $obj['service_end_date'] = $service_end_date; - null !== $service_start_date && $obj['service_start_date'] = $service_start_date; - null !== $shipping_address && $obj['shipping_address'] = $shipping_address; - null !== $shipping_address_recipient && $obj['shipping_address_recipient'] = $shipping_address_recipient; + null !== $paymentDetails && $obj['paymentDetails'] = $paymentDetails; + null !== $paymentTerm && $obj['paymentTerm'] = $paymentTerm; + null !== $purchaseOrder && $obj['purchaseOrder'] = $purchaseOrder; + null !== $remittanceAddress && $obj['remittanceAddress'] = $remittanceAddress; + null !== $remittanceAddressRecipient && $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; + null !== $serviceAddress && $obj['serviceAddress'] = $serviceAddress; + null !== $serviceAddressRecipient && $obj['serviceAddressRecipient'] = $serviceAddressRecipient; + null !== $serviceEndDate && $obj['serviceEndDate'] = $serviceEndDate; + null !== $serviceStartDate && $obj['serviceStartDate'] = $serviceStartDate; + null !== $shippingAddress && $obj['shippingAddress'] = $shippingAddress; + null !== $shippingAddressRecipient && $obj['shippingAddressRecipient'] = $shippingAddressRecipient; null !== $state && $obj['state'] = $state; null !== $subtotal && $obj['subtotal'] = $subtotal; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_details && $obj['tax_details'] = $tax_details; - null !== $total_discount && $obj['total_discount'] = $total_discount; - null !== $total_tax && $obj['total_tax'] = $total_tax; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxDetails && $obj['taxDetails'] = $taxDetails; + null !== $totalDiscount && $obj['totalDiscount'] = $totalDiscount; + null !== $totalTax && $obj['totalTax'] = $totalTax; null !== $vatex && $obj['vatex'] = $vatex; - null !== $vatex_note && $obj['vatex_note'] = $vatex_note; - null !== $vendor_address && $obj['vendor_address'] = $vendor_address; - null !== $vendor_address_recipient && $obj['vendor_address_recipient'] = $vendor_address_recipient; - null !== $vendor_company_id && $obj['vendor_company_id'] = $vendor_company_id; - null !== $vendor_email && $obj['vendor_email'] = $vendor_email; - null !== $vendor_name && $obj['vendor_name'] = $vendor_name; - null !== $vendor_tax_id && $obj['vendor_tax_id'] = $vendor_tax_id; + null !== $vatexNote && $obj['vatexNote'] = $vatexNote; + null !== $vendorAddress && $obj['vendorAddress'] = $vendorAddress; + null !== $vendorAddressRecipient && $obj['vendorAddressRecipient'] = $vendorAddressRecipient; + null !== $vendorCompanyID && $obj['vendorCompanyID'] = $vendorCompanyID; + null !== $vendorEmail && $obj['vendorEmail'] = $vendorEmail; + null !== $vendorName && $obj['vendorName'] = $vendorName; + null !== $vendorTaxID && $obj['vendorTaxID'] = $vendorTaxID; return $obj; } @@ -562,12 +562,12 @@ public function withID(string $id): self /** * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * }>|null $allowances */ public function withAllowances(?array $allowances): self @@ -584,7 +584,7 @@ public function withAllowances(?array $allowances): self public function withAmountDue(?string $amountDue): self { $obj = clone $this; - $obj['amount_due'] = $amountDue; + $obj['amountDue'] = $amountDue; return $obj; } @@ -592,10 +592,10 @@ public function withAmountDue(?string $amountDue): self /** * @param list|null $attachments */ public function withAttachments(?array $attachments): self @@ -612,7 +612,7 @@ public function withAttachments(?array $attachments): self public function withBillingAddress(?string $billingAddress): self { $obj = clone $this; - $obj['billing_address'] = $billingAddress; + $obj['billingAddress'] = $billingAddress; return $obj; } @@ -624,7 +624,7 @@ public function withBillingAddressRecipient( ?string $billingAddressRecipient ): self { $obj = clone $this; - $obj['billing_address_recipient'] = $billingAddressRecipient; + $obj['billingAddressRecipient'] = $billingAddressRecipient; return $obj; } @@ -632,12 +632,12 @@ public function withBillingAddressRecipient( /** * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * }>|null $charges */ public function withCharges(?array $charges): self @@ -667,7 +667,7 @@ public function withCurrency(CurrencyCode|string $currency): self public function withCustomerAddress(?string $customerAddress): self { $obj = clone $this; - $obj['customer_address'] = $customerAddress; + $obj['customerAddress'] = $customerAddress; return $obj; } @@ -679,7 +679,7 @@ public function withCustomerAddressRecipient( ?string $customerAddressRecipient ): self { $obj = clone $this; - $obj['customer_address_recipient'] = $customerAddressRecipient; + $obj['customerAddressRecipient'] = $customerAddressRecipient; return $obj; } @@ -690,7 +690,7 @@ public function withCustomerAddressRecipient( public function withCustomerCompanyID(?string $customerCompanyID): self { $obj = clone $this; - $obj['customer_company_id'] = $customerCompanyID; + $obj['customerCompanyID'] = $customerCompanyID; return $obj; } @@ -701,7 +701,7 @@ public function withCustomerCompanyID(?string $customerCompanyID): self public function withCustomerEmail(?string $customerEmail): self { $obj = clone $this; - $obj['customer_email'] = $customerEmail; + $obj['customerEmail'] = $customerEmail; return $obj; } @@ -712,7 +712,7 @@ public function withCustomerEmail(?string $customerEmail): self public function withCustomerID(?string $customerID): self { $obj = clone $this; - $obj['customer_id'] = $customerID; + $obj['customerID'] = $customerID; return $obj; } @@ -723,7 +723,7 @@ public function withCustomerID(?string $customerID): self public function withCustomerName(?string $customerName): self { $obj = clone $this; - $obj['customer_name'] = $customerName; + $obj['customerName'] = $customerName; return $obj; } @@ -734,7 +734,7 @@ public function withCustomerName(?string $customerName): self public function withCustomerTaxID(?string $customerTaxID): self { $obj = clone $this; - $obj['customer_tax_id'] = $customerTaxID; + $obj['customerTaxID'] = $customerTaxID; return $obj; } @@ -760,7 +760,7 @@ public function withDirection(DocumentDirection|string $direction): self public function withDocumentType(DocumentType|string $documentType): self { $obj = clone $this; - $obj['document_type'] = $documentType; + $obj['documentType'] = $documentType; return $obj; } @@ -771,7 +771,7 @@ public function withDocumentType(DocumentType|string $documentType): self public function withDueDate(?\DateTimeInterface $dueDate): self { $obj = clone $this; - $obj['due_date'] = $dueDate; + $obj['dueDate'] = $dueDate; return $obj; } @@ -782,7 +782,7 @@ public function withDueDate(?\DateTimeInterface $dueDate): self public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self { $obj = clone $this; - $obj['invoice_date'] = $invoiceDate; + $obj['invoiceDate'] = $invoiceDate; return $obj; } @@ -793,7 +793,7 @@ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self public function withInvoiceID(?string $invoiceID): self { $obj = clone $this; - $obj['invoice_id'] = $invoiceID; + $obj['invoiceID'] = $invoiceID; return $obj; } @@ -804,7 +804,7 @@ public function withInvoiceID(?string $invoiceID): self public function withInvoiceTotal(?string $invoiceTotal): self { $obj = clone $this; - $obj['invoice_total'] = $invoiceTotal; + $obj['invoiceTotal'] = $invoiceTotal; return $obj; } @@ -816,12 +816,12 @@ public function withInvoiceTotal(?string $invoiceTotal): self * charges?: list|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: string|null, * tax?: string|null, - * tax_rate?: string|null, + * taxRate?: string|null, * unit?: value-of|null, - * unit_price?: string|null, + * unitPrice?: string|null, * }>|null $items */ public function withItems(?array $items): self @@ -845,16 +845,16 @@ public function withNote(?string $note): self /** * @param list|null $paymentDetails */ public function withPaymentDetails(?array $paymentDetails): self { $obj = clone $this; - $obj['payment_details'] = $paymentDetails; + $obj['paymentDetails'] = $paymentDetails; return $obj; } @@ -865,7 +865,7 @@ public function withPaymentDetails(?array $paymentDetails): self public function withPaymentTerm(?string $paymentTerm): self { $obj = clone $this; - $obj['payment_term'] = $paymentTerm; + $obj['paymentTerm'] = $paymentTerm; return $obj; } @@ -876,7 +876,7 @@ public function withPaymentTerm(?string $paymentTerm): self public function withPurchaseOrder(?string $purchaseOrder): self { $obj = clone $this; - $obj['purchase_order'] = $purchaseOrder; + $obj['purchaseOrder'] = $purchaseOrder; return $obj; } @@ -887,7 +887,7 @@ public function withPurchaseOrder(?string $purchaseOrder): self public function withRemittanceAddress(?string $remittanceAddress): self { $obj = clone $this; - $obj['remittance_address'] = $remittanceAddress; + $obj['remittanceAddress'] = $remittanceAddress; return $obj; } @@ -899,7 +899,7 @@ public function withRemittanceAddressRecipient( ?string $remittanceAddressRecipient ): self { $obj = clone $this; - $obj['remittance_address_recipient'] = $remittanceAddressRecipient; + $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; return $obj; } @@ -910,7 +910,7 @@ public function withRemittanceAddressRecipient( public function withServiceAddress(?string $serviceAddress): self { $obj = clone $this; - $obj['service_address'] = $serviceAddress; + $obj['serviceAddress'] = $serviceAddress; return $obj; } @@ -922,7 +922,7 @@ public function withServiceAddressRecipient( ?string $serviceAddressRecipient ): self { $obj = clone $this; - $obj['service_address_recipient'] = $serviceAddressRecipient; + $obj['serviceAddressRecipient'] = $serviceAddressRecipient; return $obj; } @@ -934,7 +934,7 @@ public function withServiceEndDate( ?\DateTimeInterface $serviceEndDate ): self { $obj = clone $this; - $obj['service_end_date'] = $serviceEndDate; + $obj['serviceEndDate'] = $serviceEndDate; return $obj; } @@ -946,7 +946,7 @@ public function withServiceStartDate( ?\DateTimeInterface $serviceStartDate ): self { $obj = clone $this; - $obj['service_start_date'] = $serviceStartDate; + $obj['serviceStartDate'] = $serviceStartDate; return $obj; } @@ -957,7 +957,7 @@ public function withServiceStartDate( public function withShippingAddress(?string $shippingAddress): self { $obj = clone $this; - $obj['shipping_address'] = $shippingAddress; + $obj['shippingAddress'] = $shippingAddress; return $obj; } @@ -969,7 +969,7 @@ public function withShippingAddressRecipient( ?string $shippingAddressRecipient ): self { $obj = clone $this; - $obj['shipping_address_recipient'] = $shippingAddressRecipient; + $obj['shippingAddressRecipient'] = $shippingAddressRecipient; return $obj; } @@ -1006,7 +1006,7 @@ public function withSubtotal(?string $subtotal): self public function withTaxCode(TaxCode|string $taxCode): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -1019,7 +1019,7 @@ public function withTaxCode(TaxCode|string $taxCode): self public function withTaxDetails(?array $taxDetails): self { $obj = clone $this; - $obj['tax_details'] = $taxDetails; + $obj['taxDetails'] = $taxDetails; return $obj; } @@ -1030,7 +1030,7 @@ public function withTaxDetails(?array $taxDetails): self public function withTotalDiscount(?string $totalDiscount): self { $obj = clone $this; - $obj['total_discount'] = $totalDiscount; + $obj['totalDiscount'] = $totalDiscount; return $obj; } @@ -1041,7 +1041,7 @@ public function withTotalDiscount(?string $totalDiscount): self public function withTotalTax(?string $totalTax): self { $obj = clone $this; - $obj['total_tax'] = $totalTax; + $obj['totalTax'] = $totalTax; return $obj; } @@ -1068,7 +1068,7 @@ public function withVatex(Vatex|string|null $vatex): self public function withVatexNote(?string $vatexNote): self { $obj = clone $this; - $obj['vatex_note'] = $vatexNote; + $obj['vatexNote'] = $vatexNote; return $obj; } @@ -1079,7 +1079,7 @@ public function withVatexNote(?string $vatexNote): self public function withVendorAddress(?string $vendorAddress): self { $obj = clone $this; - $obj['vendor_address'] = $vendorAddress; + $obj['vendorAddress'] = $vendorAddress; return $obj; } @@ -1091,7 +1091,7 @@ public function withVendorAddressRecipient( ?string $vendorAddressRecipient ): self { $obj = clone $this; - $obj['vendor_address_recipient'] = $vendorAddressRecipient; + $obj['vendorAddressRecipient'] = $vendorAddressRecipient; return $obj; } @@ -1102,7 +1102,7 @@ public function withVendorAddressRecipient( public function withVendorCompanyID(?string $vendorCompanyID): self { $obj = clone $this; - $obj['vendor_company_id'] = $vendorCompanyID; + $obj['vendorCompanyID'] = $vendorCompanyID; return $obj; } @@ -1113,7 +1113,7 @@ public function withVendorCompanyID(?string $vendorCompanyID): self public function withVendorEmail(?string $vendorEmail): self { $obj = clone $this; - $obj['vendor_email'] = $vendorEmail; + $obj['vendorEmail'] = $vendorEmail; return $obj; } @@ -1124,7 +1124,7 @@ public function withVendorEmail(?string $vendorEmail): self public function withVendorName(?string $vendorName): self { $obj = clone $this; - $obj['vendor_name'] = $vendorName; + $obj['vendorName'] = $vendorName; return $obj; } @@ -1135,7 +1135,7 @@ public function withVendorName(?string $vendorName): self public function withVendorTaxID(?string $vendorTaxID): self { $obj = clone $this; - $obj['vendor_tax_id'] = $vendorTaxID; + $obj['vendorTaxID'] = $vendorTaxID; return $obj; } diff --git a/src/Documents/DocumentResponse/Allowance.php b/src/Documents/DocumentResponse/Allowance.php index 53e9eeb5..07c10a48 100644 --- a/src/Documents/DocumentResponse/Allowance.php +++ b/src/Documents/DocumentResponse/Allowance.php @@ -13,12 +13,12 @@ /** * @phpstan-type AllowanceShape = array{ * amount?: string|null, - * base_amount?: string|null, - * multiplier_factor?: string|null, + * baseAmount?: string|null, + * multiplierFactor?: string|null, * reason?: string|null, - * reason_code?: value-of|null, - * tax_code?: value-of<\EInvoiceAPI\Documents\DocumentResponse\Allowance\TaxCode>|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of<\EInvoiceAPI\Documents\DocumentResponse\Allowance\TaxCode>|null, + * taxRate?: string|null, * } */ final class Allowance implements BaseModel @@ -35,14 +35,14 @@ final class Allowance implements BaseModel /** * The base amount that may be used, in conjunction with the allowance percentage, to calculate the allowance amount. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public ?string $base_amount; + #[Optional('base_amount', nullable: true)] + public ?string $baseAmount; /** * The percentage that may be used, in conjunction with the allowance base amount, to calculate the allowance amount. To state 20%, use value 20. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public ?string $multiplier_factor; + #[Optional('multiplier_factor', nullable: true)] + public ?string $multiplierFactor; /** * The reason for the allowance. @@ -53,26 +53,27 @@ final class Allowance implements BaseModel /** * Allowance reason codes for invoice discounts and charges. * - * @var value-of|null $reason_code + * @var value-of|null $reasonCode */ - #[Optional(enum: ReasonCode::class, nullable: true)] - public ?string $reason_code; + #[Optional('reason_code', enum: ReasonCode::class, nullable: true)] + public ?string $reasonCode; /** * The VAT category code that applies to the allowance. * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ #[Optional( - enum: TaxCode::class + 'tax_code', + enum: TaxCode::class, )] - public ?string $tax_code; + public ?string $taxCode; /** * The VAT rate, represented as percentage that applies to the allowance. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public ?string $tax_rate; + #[Optional('tax_rate', nullable: true)] + public ?string $taxRate; public function __construct() { @@ -84,27 +85,27 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ReasonCode|value-of|null $reason_code - * @param TaxCode|value-of $tax_code + * @param ReasonCode|value-of|null $reasonCode + * @param TaxCode|value-of $taxCode */ public static function with( ?string $amount = null, - ?string $base_amount = null, - ?string $multiplier_factor = null, + ?string $baseAmount = null, + ?string $multiplierFactor = null, ?string $reason = null, - ReasonCode|string|null $reason_code = null, - TaxCode|string|null $tax_code = null, - ?string $tax_rate = null, + ReasonCode|string|null $reasonCode = null, + TaxCode|string|null $taxCode = null, + ?string $taxRate = null, ): self { $obj = new self; null !== $amount && $obj['amount'] = $amount; - null !== $base_amount && $obj['base_amount'] = $base_amount; - null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $baseAmount && $obj['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; null !== $reason && $obj['reason'] = $reason; - null !== $reason_code && $obj['reason_code'] = $reason_code; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $reasonCode && $obj['reasonCode'] = $reasonCode; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxRate && $obj['taxRate'] = $taxRate; return $obj; } @@ -126,7 +127,7 @@ public function withAmount(?string $amount): self public function withBaseAmount(?string $baseAmount): self { $obj = clone $this; - $obj['base_amount'] = $baseAmount; + $obj['baseAmount'] = $baseAmount; return $obj; } @@ -137,7 +138,7 @@ public function withBaseAmount(?string $baseAmount): self public function withMultiplierFactor(?string $multiplierFactor): self { $obj = clone $this; - $obj['multiplier_factor'] = $multiplierFactor; + $obj['multiplierFactor'] = $multiplierFactor; return $obj; } @@ -161,7 +162,7 @@ public function withReason(?string $reason): self public function withReasonCode(ReasonCode|string|null $reasonCode): self { $obj = clone $this; - $obj['reason_code'] = $reasonCode; + $obj['reasonCode'] = $reasonCode; return $obj; } @@ -175,7 +176,7 @@ public function withTaxCode( TaxCode|string $taxCode ): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -186,7 +187,7 @@ public function withTaxCode( public function withTaxRate(?string $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentResponse/Charge.php b/src/Documents/DocumentResponse/Charge.php index 835ac501..7c80d5e0 100644 --- a/src/Documents/DocumentResponse/Charge.php +++ b/src/Documents/DocumentResponse/Charge.php @@ -13,12 +13,12 @@ /** * @phpstan-type ChargeShape = array{ * amount?: string|null, - * base_amount?: string|null, - * multiplier_factor?: string|null, + * baseAmount?: string|null, + * multiplierFactor?: string|null, * reason?: string|null, - * reason_code?: value-of|null, - * tax_code?: value-of<\EInvoiceAPI\Documents\DocumentResponse\Charge\TaxCode>|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of<\EInvoiceAPI\Documents\DocumentResponse\Charge\TaxCode>|null, + * taxRate?: string|null, * } */ final class Charge implements BaseModel @@ -35,14 +35,14 @@ final class Charge implements BaseModel /** * The base amount that may be used, in conjunction with the charge percentage, to calculate the charge amount. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public ?string $base_amount; + #[Optional('base_amount', nullable: true)] + public ?string $baseAmount; /** * The percentage that may be used, in conjunction with the charge base amount, to calculate the charge amount. To state 20%, use value 20. */ - #[Optional(nullable: true)] - public ?string $multiplier_factor; + #[Optional('multiplier_factor', nullable: true)] + public ?string $multiplierFactor; /** * The reason for the charge. @@ -53,10 +53,10 @@ final class Charge implements BaseModel /** * Charge reason codes for invoice charges and fees. * - * @var value-of|null $reason_code + * @var value-of|null $reasonCode */ - #[Optional(enum: ReasonCode::class, nullable: true)] - public ?string $reason_code; + #[Optional('reason_code', enum: ReasonCode::class, nullable: true)] + public ?string $reasonCode; /** * Duty or tax or fee category codes (Subset of UNCL5305). @@ -65,19 +65,20 @@ final class Charge implements BaseModel * Version: D.16B * Subset: OpenPEPPOL * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ #[Optional( + 'tax_code', enum: TaxCode::class, nullable: true, )] - public ?string $tax_code; + public ?string $taxCode; /** * The VAT rate, represented as percentage that applies to the charge. */ - #[Optional(nullable: true)] - public ?string $tax_rate; + #[Optional('tax_rate', nullable: true)] + public ?string $taxRate; public function __construct() { @@ -89,27 +90,27 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ReasonCode|value-of|null $reason_code - * @param TaxCode|value-of|null $tax_code + * @param ReasonCode|value-of|null $reasonCode + * @param TaxCode|value-of|null $taxCode */ public static function with( ?string $amount = null, - ?string $base_amount = null, - ?string $multiplier_factor = null, + ?string $baseAmount = null, + ?string $multiplierFactor = null, ?string $reason = null, - ReasonCode|string|null $reason_code = null, - TaxCode|string|null $tax_code = null, - ?string $tax_rate = null, + ReasonCode|string|null $reasonCode = null, + TaxCode|string|null $taxCode = null, + ?string $taxRate = null, ): self { $obj = new self; null !== $amount && $obj['amount'] = $amount; - null !== $base_amount && $obj['base_amount'] = $base_amount; - null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $baseAmount && $obj['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; null !== $reason && $obj['reason'] = $reason; - null !== $reason_code && $obj['reason_code'] = $reason_code; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $reasonCode && $obj['reasonCode'] = $reasonCode; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxRate && $obj['taxRate'] = $taxRate; return $obj; } @@ -131,7 +132,7 @@ public function withAmount(?string $amount): self public function withBaseAmount(?string $baseAmount): self { $obj = clone $this; - $obj['base_amount'] = $baseAmount; + $obj['baseAmount'] = $baseAmount; return $obj; } @@ -142,7 +143,7 @@ public function withBaseAmount(?string $baseAmount): self public function withMultiplierFactor(?string $multiplierFactor): self { $obj = clone $this; - $obj['multiplier_factor'] = $multiplierFactor; + $obj['multiplierFactor'] = $multiplierFactor; return $obj; } @@ -166,7 +167,7 @@ public function withReason(?string $reason): self public function withReasonCode(ReasonCode|string|null $reasonCode): self { $obj = clone $this; - $obj['reason_code'] = $reasonCode; + $obj['reasonCode'] = $reasonCode; return $obj; } @@ -184,7 +185,7 @@ public function withTaxCode( TaxCode|string|null $taxCode ): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -195,7 +196,7 @@ public function withTaxCode( public function withTaxRate(?string $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } diff --git a/src/Documents/DocumentResponse/Item.php b/src/Documents/DocumentResponse/Item.php index 6ba64130..5554d8f3 100644 --- a/src/Documents/DocumentResponse/Item.php +++ b/src/Documents/DocumentResponse/Item.php @@ -20,12 +20,12 @@ * charges?: list<\EInvoiceAPI\Documents\Charge>|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: string|null, * tax?: string|null, - * tax_rate?: string|null, + * taxRate?: string|null, * unit?: value-of|null, - * unit_price?: string|null, + * unitPrice?: string|null, * } */ final class Item implements BaseModel @@ -68,8 +68,8 @@ final class Item implements BaseModel /** * The product code of the line item. */ - #[Optional(nullable: true)] - public ?string $product_code; + #[Optional('product_code', nullable: true)] + public ?string $productCode; /** * The quantity of items (goods or services) that is the subject of the line item. Must be rounded to maximum 4 decimals. Can be negative for credit notes or corrections. @@ -86,8 +86,8 @@ final class Item implements BaseModel /** * The VAT rate of the line item expressed as percentage with 2 decimals. */ - #[Optional(nullable: true)] - public ?string $tax_rate; + #[Optional('tax_rate', nullable: true)] + public ?string $taxRate; /** * Unit of Measure Codes from UNECERec20 used in Peppol BIS Billing 3.0. @@ -100,8 +100,8 @@ final class Item implements BaseModel /** * The item net price (BT-146). The price of an item, exclusive of VAT, after subtracting item price discount. Must be rounded to maximum 4 decimals. */ - #[Optional(nullable: true)] - public ?string $unit_price; + #[Optional('unit_price', nullable: true)] + public ?string $unitPrice; public function __construct() { @@ -115,21 +115,21 @@ public function __construct() * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * }>|null $allowances * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * }>|null $charges * @param UnitOfMeasureCode|value-of|null $unit */ @@ -139,12 +139,12 @@ public static function with( ?array $charges = null, null $date = null, ?string $description = null, - ?string $product_code = null, + ?string $productCode = null, ?string $quantity = null, ?string $tax = null, - ?string $tax_rate = null, + ?string $taxRate = null, UnitOfMeasureCode|string|null $unit = null, - ?string $unit_price = null, + ?string $unitPrice = null, ): self { $obj = new self; @@ -154,12 +154,12 @@ public static function with( null !== $amount && $obj['amount'] = $amount; null !== $charges && $obj['charges'] = $charges; null !== $description && $obj['description'] = $description; - null !== $product_code && $obj['product_code'] = $product_code; + null !== $productCode && $obj['productCode'] = $productCode; null !== $quantity && $obj['quantity'] = $quantity; null !== $tax && $obj['tax'] = $tax; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $taxRate && $obj['taxRate'] = $taxRate; null !== $unit && $obj['unit'] = $unit; - null !== $unit_price && $obj['unit_price'] = $unit_price; + null !== $unitPrice && $obj['unitPrice'] = $unitPrice; return $obj; } @@ -169,12 +169,12 @@ public static function with( * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * }>|null $allowances */ public function withAllowances(?array $allowances): self @@ -201,12 +201,12 @@ public function withAmount(?string $amount): self * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: string|null, * }>|null $charges */ public function withCharges(?array $charges): self @@ -245,7 +245,7 @@ public function withDescription(?string $description): self public function withProductCode(?string $productCode): self { $obj = clone $this; - $obj['product_code'] = $productCode; + $obj['productCode'] = $productCode; return $obj; } @@ -278,7 +278,7 @@ public function withTax(?string $tax): self public function withTaxRate(?string $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } @@ -302,7 +302,7 @@ public function withUnit(UnitOfMeasureCode|string|null $unit): self public function withUnitPrice(?string $unitPrice): self { $obj = clone $this; - $obj['unit_price'] = $unitPrice; + $obj['unitPrice'] = $unitPrice; return $obj; } diff --git a/src/Documents/DocumentResponse/PaymentDetail.php b/src/Documents/DocumentResponse/PaymentDetail.php index 550b43d3..2eb1424f 100644 --- a/src/Documents/DocumentResponse/PaymentDetail.php +++ b/src/Documents/DocumentResponse/PaymentDetail.php @@ -10,9 +10,9 @@ /** * @phpstan-type PaymentDetailShape = array{ - * bank_account_number?: string|null, + * bankAccountNumber?: string|null, * iban?: string|null, - * payment_reference?: string|null, + * paymentReference?: string|null, * swift?: string|null, * } */ @@ -24,8 +24,8 @@ final class PaymentDetail implements BaseModel /** * Bank account number (for non-IBAN accounts). */ - #[Optional(nullable: true)] - public ?string $bank_account_number; + #[Optional('bank_account_number', nullable: true)] + public ?string $bankAccountNumber; /** * International Bank Account Number for payment transfers. @@ -36,8 +36,8 @@ final class PaymentDetail implements BaseModel /** * Structured payment reference or communication (e.g., structured communication for Belgian bank transfers). */ - #[Optional(nullable: true)] - public ?string $payment_reference; + #[Optional('payment_reference', nullable: true)] + public ?string $paymentReference; /** * SWIFT/BIC code of the bank. @@ -56,16 +56,16 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. */ public static function with( - ?string $bank_account_number = null, + ?string $bankAccountNumber = null, ?string $iban = null, - ?string $payment_reference = null, + ?string $paymentReference = null, ?string $swift = null, ): self { $obj = new self; - null !== $bank_account_number && $obj['bank_account_number'] = $bank_account_number; + null !== $bankAccountNumber && $obj['bankAccountNumber'] = $bankAccountNumber; null !== $iban && $obj['iban'] = $iban; - null !== $payment_reference && $obj['payment_reference'] = $payment_reference; + null !== $paymentReference && $obj['paymentReference'] = $paymentReference; null !== $swift && $obj['swift'] = $swift; return $obj; @@ -77,7 +77,7 @@ public static function with( public function withBankAccountNumber(?string $bankAccountNumber): self { $obj = clone $this; - $obj['bank_account_number'] = $bankAccountNumber; + $obj['bankAccountNumber'] = $bankAccountNumber; return $obj; } @@ -99,7 +99,7 @@ public function withIban(?string $iban): self public function withPaymentReference(?string $paymentReference): self { $obj = clone $this; - $obj['payment_reference'] = $paymentReference; + $obj['paymentReference'] = $paymentReference; return $obj; } diff --git a/src/Documents/DocumentSendParams.php b/src/Documents/DocumentSendParams.php index e6b8ba5b..0e2556a6 100644 --- a/src/Documents/DocumentSendParams.php +++ b/src/Documents/DocumentSendParams.php @@ -16,10 +16,10 @@ * * @phpstan-type DocumentSendParamsShape = array{ * email?: string|null, - * receiver_peppol_id?: string|null, - * receiver_peppol_scheme?: string|null, - * sender_peppol_id?: string|null, - * sender_peppol_scheme?: string|null, + * receiverPeppolID?: string|null, + * receiverPeppolScheme?: string|null, + * senderPeppolID?: string|null, + * senderPeppolScheme?: string|null, * } */ final class DocumentSendParams implements BaseModel @@ -32,16 +32,16 @@ final class DocumentSendParams implements BaseModel public ?string $email; #[Optional(nullable: true)] - public ?string $receiver_peppol_id; + public ?string $receiverPeppolID; #[Optional(nullable: true)] - public ?string $receiver_peppol_scheme; + public ?string $receiverPeppolScheme; #[Optional(nullable: true)] - public ?string $sender_peppol_id; + public ?string $senderPeppolID; #[Optional(nullable: true)] - public ?string $sender_peppol_scheme; + public ?string $senderPeppolScheme; public function __construct() { @@ -55,18 +55,18 @@ public function __construct() */ public static function with( ?string $email = null, - ?string $receiver_peppol_id = null, - ?string $receiver_peppol_scheme = null, - ?string $sender_peppol_id = null, - ?string $sender_peppol_scheme = null, + ?string $receiverPeppolID = null, + ?string $receiverPeppolScheme = null, + ?string $senderPeppolID = null, + ?string $senderPeppolScheme = null, ): self { $obj = new self; null !== $email && $obj['email'] = $email; - null !== $receiver_peppol_id && $obj['receiver_peppol_id'] = $receiver_peppol_id; - null !== $receiver_peppol_scheme && $obj['receiver_peppol_scheme'] = $receiver_peppol_scheme; - null !== $sender_peppol_id && $obj['sender_peppol_id'] = $sender_peppol_id; - null !== $sender_peppol_scheme && $obj['sender_peppol_scheme'] = $sender_peppol_scheme; + null !== $receiverPeppolID && $obj['receiverPeppolID'] = $receiverPeppolID; + null !== $receiverPeppolScheme && $obj['receiverPeppolScheme'] = $receiverPeppolScheme; + null !== $senderPeppolID && $obj['senderPeppolID'] = $senderPeppolID; + null !== $senderPeppolScheme && $obj['senderPeppolScheme'] = $senderPeppolScheme; return $obj; } @@ -82,7 +82,7 @@ public function withEmail(?string $email): self public function withReceiverPeppolID(?string $receiverPeppolID): self { $obj = clone $this; - $obj['receiver_peppol_id'] = $receiverPeppolID; + $obj['receiverPeppolID'] = $receiverPeppolID; return $obj; } @@ -91,7 +91,7 @@ public function withReceiverPeppolScheme( ?string $receiverPeppolScheme ): self { $obj = clone $this; - $obj['receiver_peppol_scheme'] = $receiverPeppolScheme; + $obj['receiverPeppolScheme'] = $receiverPeppolScheme; return $obj; } @@ -99,7 +99,7 @@ public function withReceiverPeppolScheme( public function withSenderPeppolID(?string $senderPeppolID): self { $obj = clone $this; - $obj['sender_peppol_id'] = $senderPeppolID; + $obj['senderPeppolID'] = $senderPeppolID; return $obj; } @@ -107,7 +107,7 @@ public function withSenderPeppolID(?string $senderPeppolID): self public function withSenderPeppolScheme(?string $senderPeppolScheme): self { $obj = clone $this; - $obj['sender_peppol_scheme'] = $senderPeppolScheme; + $obj['senderPeppolScheme'] = $senderPeppolScheme; return $obj; } diff --git a/src/Documents/PaymentDetailCreate.php b/src/Documents/PaymentDetailCreate.php index 9f8184c9..fbc9bb40 100644 --- a/src/Documents/PaymentDetailCreate.php +++ b/src/Documents/PaymentDetailCreate.php @@ -10,9 +10,9 @@ /** * @phpstan-type PaymentDetailCreateShape = array{ - * bank_account_number?: string|null, + * bankAccountNumber?: string|null, * iban?: string|null, - * payment_reference?: string|null, + * paymentReference?: string|null, * swift?: string|null, * } */ @@ -24,8 +24,8 @@ final class PaymentDetailCreate implements BaseModel /** * Bank account number (for non-IBAN accounts). */ - #[Optional(nullable: true)] - public ?string $bank_account_number; + #[Optional('bank_account_number', nullable: true)] + public ?string $bankAccountNumber; /** * International Bank Account Number for payment transfers. @@ -36,8 +36,8 @@ final class PaymentDetailCreate implements BaseModel /** * Structured payment reference or communication (e.g., structured communication for Belgian bank transfers). */ - #[Optional(nullable: true)] - public ?string $payment_reference; + #[Optional('payment_reference', nullable: true)] + public ?string $paymentReference; /** * SWIFT/BIC code of the bank. @@ -56,16 +56,16 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. */ public static function with( - ?string $bank_account_number = null, + ?string $bankAccountNumber = null, ?string $iban = null, - ?string $payment_reference = null, + ?string $paymentReference = null, ?string $swift = null, ): self { $obj = new self; - null !== $bank_account_number && $obj['bank_account_number'] = $bank_account_number; + null !== $bankAccountNumber && $obj['bankAccountNumber'] = $bankAccountNumber; null !== $iban && $obj['iban'] = $iban; - null !== $payment_reference && $obj['payment_reference'] = $payment_reference; + null !== $paymentReference && $obj['paymentReference'] = $paymentReference; null !== $swift && $obj['swift'] = $swift; return $obj; @@ -77,7 +77,7 @@ public static function with( public function withBankAccountNumber(?string $bankAccountNumber): self { $obj = clone $this; - $obj['bank_account_number'] = $bankAccountNumber; + $obj['bankAccountNumber'] = $bankAccountNumber; return $obj; } @@ -99,7 +99,7 @@ public function withIban(?string $iban): self public function withPaymentReference(?string $paymentReference): self { $obj = clone $this; - $obj['payment_reference'] = $paymentReference; + $obj['paymentReference'] = $paymentReference; return $obj; } diff --git a/src/Documents/Ubl/UblGetResponse.php b/src/Documents/Ubl/UblGetResponse.php index 19b2dcd3..e94b0a73 100644 --- a/src/Documents/Ubl/UblGetResponse.php +++ b/src/Documents/Ubl/UblGetResponse.php @@ -12,15 +12,15 @@ /** * @phpstan-type UblGetResponseShape = array{ * id: string, - * file_name: string, - * file_hash?: string|null, - * file_size?: int|null, - * receiver_peppol_id?: string|null, - * receiver_peppol_scheme?: string|null, - * sender_peppol_id?: string|null, - * sender_peppol_scheme?: string|null, - * signed_url?: string|null, - * validated_at?: \DateTimeInterface|null, + * fileName: string, + * fileHash?: string|null, + * fileSize?: int|null, + * receiverPeppolID?: string|null, + * receiverPeppolScheme?: string|null, + * senderPeppolID?: string|null, + * senderPeppolScheme?: string|null, + * signedURL?: string|null, + * validatedAt?: \DateTimeInterface|null, * } */ final class UblGetResponse implements BaseModel @@ -31,39 +31,39 @@ final class UblGetResponse implements BaseModel #[Required] public string $id; - #[Required] - public string $file_name; + #[Required('file_name')] + public string $fileName; - #[Optional(nullable: true)] - public ?string $file_hash; + #[Optional('file_hash', nullable: true)] + public ?string $fileHash; - #[Optional] - public ?int $file_size; + #[Optional('file_size')] + public ?int $fileSize; - #[Optional(nullable: true)] - public ?string $receiver_peppol_id; + #[Optional('receiver_peppol_id', nullable: true)] + public ?string $receiverPeppolID; - #[Optional(nullable: true)] - public ?string $receiver_peppol_scheme; + #[Optional('receiver_peppol_scheme', nullable: true)] + public ?string $receiverPeppolScheme; - #[Optional(nullable: true)] - public ?string $sender_peppol_id; + #[Optional('sender_peppol_id', nullable: true)] + public ?string $senderPeppolID; - #[Optional(nullable: true)] - public ?string $sender_peppol_scheme; + #[Optional('sender_peppol_scheme', nullable: true)] + public ?string $senderPeppolScheme; - #[Optional(nullable: true)] - public ?string $signed_url; + #[Optional('signed_url', nullable: true)] + public ?string $signedURL; - #[Optional(nullable: true)] - public ?\DateTimeInterface $validated_at; + #[Optional('validated_at', nullable: true)] + public ?\DateTimeInterface $validatedAt; /** * `new UblGetResponse()` is missing required properties by the API. * * To enforce required parameters use * ``` - * UblGetResponse::with(id: ..., file_name: ...) + * UblGetResponse::with(id: ..., fileName: ...) * ``` * * Otherwise ensure the following setters are called @@ -84,29 +84,29 @@ public function __construct() */ public static function with( string $id, - string $file_name, - ?string $file_hash = null, - ?int $file_size = null, - ?string $receiver_peppol_id = null, - ?string $receiver_peppol_scheme = null, - ?string $sender_peppol_id = null, - ?string $sender_peppol_scheme = null, - ?string $signed_url = null, - ?\DateTimeInterface $validated_at = null, + string $fileName, + ?string $fileHash = null, + ?int $fileSize = null, + ?string $receiverPeppolID = null, + ?string $receiverPeppolScheme = null, + ?string $senderPeppolID = null, + ?string $senderPeppolScheme = null, + ?string $signedURL = null, + ?\DateTimeInterface $validatedAt = null, ): self { $obj = new self; $obj['id'] = $id; - $obj['file_name'] = $file_name; + $obj['fileName'] = $fileName; - null !== $file_hash && $obj['file_hash'] = $file_hash; - null !== $file_size && $obj['file_size'] = $file_size; - null !== $receiver_peppol_id && $obj['receiver_peppol_id'] = $receiver_peppol_id; - null !== $receiver_peppol_scheme && $obj['receiver_peppol_scheme'] = $receiver_peppol_scheme; - null !== $sender_peppol_id && $obj['sender_peppol_id'] = $sender_peppol_id; - null !== $sender_peppol_scheme && $obj['sender_peppol_scheme'] = $sender_peppol_scheme; - null !== $signed_url && $obj['signed_url'] = $signed_url; - null !== $validated_at && $obj['validated_at'] = $validated_at; + null !== $fileHash && $obj['fileHash'] = $fileHash; + null !== $fileSize && $obj['fileSize'] = $fileSize; + null !== $receiverPeppolID && $obj['receiverPeppolID'] = $receiverPeppolID; + null !== $receiverPeppolScheme && $obj['receiverPeppolScheme'] = $receiverPeppolScheme; + null !== $senderPeppolID && $obj['senderPeppolID'] = $senderPeppolID; + null !== $senderPeppolScheme && $obj['senderPeppolScheme'] = $senderPeppolScheme; + null !== $signedURL && $obj['signedURL'] = $signedURL; + null !== $validatedAt && $obj['validatedAt'] = $validatedAt; return $obj; } @@ -122,7 +122,7 @@ public function withID(string $id): self public function withFileName(string $fileName): self { $obj = clone $this; - $obj['file_name'] = $fileName; + $obj['fileName'] = $fileName; return $obj; } @@ -130,7 +130,7 @@ public function withFileName(string $fileName): self public function withFileHash(?string $fileHash): self { $obj = clone $this; - $obj['file_hash'] = $fileHash; + $obj['fileHash'] = $fileHash; return $obj; } @@ -138,7 +138,7 @@ public function withFileHash(?string $fileHash): self public function withFileSize(int $fileSize): self { $obj = clone $this; - $obj['file_size'] = $fileSize; + $obj['fileSize'] = $fileSize; return $obj; } @@ -146,7 +146,7 @@ public function withFileSize(int $fileSize): self public function withReceiverPeppolID(?string $receiverPeppolID): self { $obj = clone $this; - $obj['receiver_peppol_id'] = $receiverPeppolID; + $obj['receiverPeppolID'] = $receiverPeppolID; return $obj; } @@ -155,7 +155,7 @@ public function withReceiverPeppolScheme( ?string $receiverPeppolScheme ): self { $obj = clone $this; - $obj['receiver_peppol_scheme'] = $receiverPeppolScheme; + $obj['receiverPeppolScheme'] = $receiverPeppolScheme; return $obj; } @@ -163,7 +163,7 @@ public function withReceiverPeppolScheme( public function withSenderPeppolID(?string $senderPeppolID): self { $obj = clone $this; - $obj['sender_peppol_id'] = $senderPeppolID; + $obj['senderPeppolID'] = $senderPeppolID; return $obj; } @@ -171,7 +171,7 @@ public function withSenderPeppolID(?string $senderPeppolID): self public function withSenderPeppolScheme(?string $senderPeppolScheme): self { $obj = clone $this; - $obj['sender_peppol_scheme'] = $senderPeppolScheme; + $obj['senderPeppolScheme'] = $senderPeppolScheme; return $obj; } @@ -179,7 +179,7 @@ public function withSenderPeppolScheme(?string $senderPeppolScheme): self public function withSignedURL(?string $signedURL): self { $obj = clone $this; - $obj['signed_url'] = $signedURL; + $obj['signedURL'] = $signedURL; return $obj; } @@ -187,7 +187,7 @@ public function withSignedURL(?string $signedURL): self public function withValidatedAt(?\DateTimeInterface $validatedAt): self { $obj = clone $this; - $obj['validated_at'] = $validatedAt; + $obj['validatedAt'] = $validatedAt; return $obj; } diff --git a/src/DocumentsNumberPage.php b/src/DocumentsNumberPage.php index a9837233..696efb39 100644 --- a/src/DocumentsNumberPage.php +++ b/src/DocumentsNumberPage.php @@ -18,7 +18,7 @@ * @phpstan-type DocumentsNumberPageShape = array{ * items?: list|null, * page?: int|null, - * page_size?: int|null, + * pageSize?: int|null, * total?: int|null, * } * @@ -41,8 +41,8 @@ final class DocumentsNumberPage implements BaseModel, BasePage #[Optional] public ?int $page; - #[Optional] - public ?int $page_size; + #[Optional('page_size')] + public ?int $pageSize; #[Optional] public ?int $total; diff --git a/src/Inbox/InboxListCreditNotesParams.php b/src/Inbox/InboxListCreditNotesParams.php index 81f89092..4c041eb0 100644 --- a/src/Inbox/InboxListCreditNotesParams.php +++ b/src/Inbox/InboxListCreditNotesParams.php @@ -15,7 +15,7 @@ * @see EInvoiceAPI\Services\InboxService::listCreditNotes() * * @phpstan-type InboxListCreditNotesParamsShape = array{ - * page?: int, page_size?: int + * page?: int, pageSize?: int * } */ final class InboxListCreditNotesParams implements BaseModel @@ -34,7 +34,7 @@ final class InboxListCreditNotesParams implements BaseModel * Number of items per page. */ #[Optional] - public ?int $page_size; + public ?int $pageSize; public function __construct() { @@ -46,12 +46,12 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(?int $page = null, ?int $page_size = null): self + public static function with(?int $page = null, ?int $pageSize = null): self { $obj = new self; null !== $page && $obj['page'] = $page; - null !== $page_size && $obj['page_size'] = $page_size; + null !== $pageSize && $obj['pageSize'] = $pageSize; return $obj; } @@ -73,7 +73,7 @@ public function withPage(int $page): self public function withPageSize(int $pageSize): self { $obj = clone $this; - $obj['page_size'] = $pageSize; + $obj['pageSize'] = $pageSize; return $obj; } diff --git a/src/Inbox/InboxListInvoicesParams.php b/src/Inbox/InboxListInvoicesParams.php index c412fd7e..5b449446 100644 --- a/src/Inbox/InboxListInvoicesParams.php +++ b/src/Inbox/InboxListInvoicesParams.php @@ -14,7 +14,7 @@ * * @see EInvoiceAPI\Services\InboxService::listInvoices() * - * @phpstan-type InboxListInvoicesParamsShape = array{page?: int, page_size?: int} + * @phpstan-type InboxListInvoicesParamsShape = array{page?: int, pageSize?: int} */ final class InboxListInvoicesParams implements BaseModel { @@ -32,7 +32,7 @@ final class InboxListInvoicesParams implements BaseModel * Number of items per page. */ #[Optional] - public ?int $page_size; + public ?int $pageSize; public function __construct() { @@ -44,12 +44,12 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(?int $page = null, ?int $page_size = null): self + public static function with(?int $page = null, ?int $pageSize = null): self { $obj = new self; null !== $page && $obj['page'] = $page; - null !== $page_size && $obj['page_size'] = $page_size; + null !== $pageSize && $obj['pageSize'] = $pageSize; return $obj; } @@ -71,7 +71,7 @@ public function withPage(int $page): self public function withPageSize(int $pageSize): self { $obj = clone $this; - $obj['page_size'] = $pageSize; + $obj['pageSize'] = $pageSize; return $obj; } diff --git a/src/Inbox/InboxListParams.php b/src/Inbox/InboxListParams.php index 32e63b8f..66ad58f8 100644 --- a/src/Inbox/InboxListParams.php +++ b/src/Inbox/InboxListParams.php @@ -16,10 +16,10 @@ * @see EInvoiceAPI\Services\InboxService::list() * * @phpstan-type InboxListParamsShape = array{ - * date_from?: \DateTimeInterface|null, - * date_to?: \DateTimeInterface|null, + * dateFrom?: \DateTimeInterface|null, + * dateTo?: \DateTimeInterface|null, * page?: int, - * page_size?: int, + * pageSize?: int, * search?: string|null, * sender?: string|null, * state?: null|DocumentState|value-of, @@ -36,13 +36,13 @@ final class InboxListParams implements BaseModel * Filter by issue date (from). */ #[Optional(nullable: true)] - public ?\DateTimeInterface $date_from; + public ?\DateTimeInterface $dateFrom; /** * Filter by issue date (to). */ #[Optional(nullable: true)] - public ?\DateTimeInterface $date_to; + public ?\DateTimeInterface $dateTo; /** * Page number. @@ -54,7 +54,7 @@ final class InboxListParams implements BaseModel * Number of items per page. */ #[Optional] - public ?int $page_size; + public ?int $pageSize; /** * Search in invoice number, seller/buyer names. @@ -98,10 +98,10 @@ public function __construct() * @param DocumentType|value-of|null $type */ public static function with( - ?\DateTimeInterface $date_from = null, - ?\DateTimeInterface $date_to = null, + ?\DateTimeInterface $dateFrom = null, + ?\DateTimeInterface $dateTo = null, ?int $page = null, - ?int $page_size = null, + ?int $pageSize = null, ?string $search = null, ?string $sender = null, DocumentState|string|null $state = null, @@ -109,10 +109,10 @@ public static function with( ): self { $obj = new self; - null !== $date_from && $obj['date_from'] = $date_from; - null !== $date_to && $obj['date_to'] = $date_to; + null !== $dateFrom && $obj['dateFrom'] = $dateFrom; + null !== $dateTo && $obj['dateTo'] = $dateTo; null !== $page && $obj['page'] = $page; - null !== $page_size && $obj['page_size'] = $page_size; + null !== $pageSize && $obj['pageSize'] = $pageSize; null !== $search && $obj['search'] = $search; null !== $sender && $obj['sender'] = $sender; null !== $state && $obj['state'] = $state; @@ -127,7 +127,7 @@ public static function with( public function withDateFrom(?\DateTimeInterface $dateFrom): self { $obj = clone $this; - $obj['date_from'] = $dateFrom; + $obj['dateFrom'] = $dateFrom; return $obj; } @@ -138,7 +138,7 @@ public function withDateFrom(?\DateTimeInterface $dateFrom): self public function withDateTo(?\DateTimeInterface $dateTo): self { $obj = clone $this; - $obj['date_to'] = $dateTo; + $obj['dateTo'] = $dateTo; return $obj; } @@ -160,7 +160,7 @@ public function withPage(int $page): self public function withPageSize(int $pageSize): self { $obj = clone $this; - $obj['page_size'] = $pageSize; + $obj['pageSize'] = $pageSize; return $obj; } diff --git a/src/Inbox/PaginatedDocumentResponse.php b/src/Inbox/PaginatedDocumentResponse.php index 97ff6829..1c4cba8c 100644 --- a/src/Inbox/PaginatedDocumentResponse.php +++ b/src/Inbox/PaginatedDocumentResponse.php @@ -24,7 +24,7 @@ * @phpstan-type PaginatedDocumentResponseShape = array{ * items: list, * page: int, - * page_size: int, + * pageSize: int, * pages: int, * total: int, * } @@ -41,8 +41,8 @@ final class PaginatedDocumentResponse implements BaseModel #[Required] public int $page; - #[Required] - public int $page_size; + #[Required('page_size')] + public int $pageSize; #[Required] public int $pages; @@ -56,7 +56,7 @@ final class PaginatedDocumentResponse implements BaseModel * To enforce required parameters use * ``` * PaginatedDocumentResponse::with( - * items: ..., page: ..., page_size: ..., pages: ..., total: ... + * items: ..., page: ..., pageSize: ..., pages: ..., total: ... * ) * ``` * @@ -84,58 +84,58 @@ public function __construct() * @param list|null, - * amount_due?: string|null, + * amountDue?: string|null, * attachments?: list|null, - * billing_address?: string|null, - * billing_address_recipient?: string|null, + * billingAddress?: string|null, + * billingAddressRecipient?: string|null, * charges?: list|null, * currency?: value-of|null, - * customer_address?: string|null, - * customer_address_recipient?: string|null, - * customer_company_id?: string|null, - * customer_email?: string|null, - * customer_id?: string|null, - * customer_name?: string|null, - * customer_tax_id?: string|null, + * customerAddress?: string|null, + * customerAddressRecipient?: string|null, + * customerCompanyID?: string|null, + * customerEmail?: string|null, + * customerID?: string|null, + * customerName?: string|null, + * customerTaxID?: string|null, * direction?: value-of|null, - * document_type?: value-of|null, - * due_date?: \DateTimeInterface|null, - * invoice_date?: \DateTimeInterface|null, - * invoice_id?: string|null, - * invoice_total?: string|null, + * documentType?: value-of|null, + * dueDate?: \DateTimeInterface|null, + * invoiceDate?: \DateTimeInterface|null, + * invoiceID?: string|null, + * invoiceTotal?: string|null, * items?: list|null, * note?: string|null, - * payment_details?: list|null, - * payment_term?: string|null, - * purchase_order?: string|null, - * remittance_address?: string|null, - * remittance_address_recipient?: string|null, - * service_address?: string|null, - * service_address_recipient?: string|null, - * service_end_date?: \DateTimeInterface|null, - * service_start_date?: \DateTimeInterface|null, - * shipping_address?: string|null, - * shipping_address_recipient?: string|null, + * paymentDetails?: list|null, + * paymentTerm?: string|null, + * purchaseOrder?: string|null, + * remittanceAddress?: string|null, + * remittanceAddressRecipient?: string|null, + * serviceAddress?: string|null, + * serviceAddressRecipient?: string|null, + * serviceEndDate?: \DateTimeInterface|null, + * serviceStartDate?: \DateTimeInterface|null, + * shippingAddress?: string|null, + * shippingAddressRecipient?: string|null, * state?: value-of|null, * subtotal?: string|null, - * tax_code?: value-of|null, - * tax_details?: list|null, - * total_discount?: string|null, - * total_tax?: string|null, + * taxCode?: value-of|null, + * taxDetails?: list|null, + * totalDiscount?: string|null, + * totalTax?: string|null, * vatex?: value-of|null, - * vatex_note?: string|null, - * vendor_address?: string|null, - * vendor_address_recipient?: string|null, - * vendor_company_id?: string|null, - * vendor_email?: string|null, - * vendor_name?: string|null, - * vendor_tax_id?: string|null, + * vatexNote?: string|null, + * vendorAddress?: string|null, + * vendorAddressRecipient?: string|null, + * vendorCompanyID?: string|null, + * vendorEmail?: string|null, + * vendorName?: string|null, + * vendorTaxID?: string|null, * }> $items */ public static function with( array $items, int $page, - int $page_size, + int $pageSize, int $pages, int $total ): self { @@ -143,7 +143,7 @@ public static function with( $obj['items'] = $items; $obj['page'] = $page; - $obj['page_size'] = $page_size; + $obj['pageSize'] = $pageSize; $obj['pages'] = $pages; $obj['total'] = $total; @@ -154,52 +154,52 @@ public static function with( * @param list|null, - * amount_due?: string|null, + * amountDue?: string|null, * attachments?: list|null, - * billing_address?: string|null, - * billing_address_recipient?: string|null, + * billingAddress?: string|null, + * billingAddressRecipient?: string|null, * charges?: list|null, * currency?: value-of|null, - * customer_address?: string|null, - * customer_address_recipient?: string|null, - * customer_company_id?: string|null, - * customer_email?: string|null, - * customer_id?: string|null, - * customer_name?: string|null, - * customer_tax_id?: string|null, + * customerAddress?: string|null, + * customerAddressRecipient?: string|null, + * customerCompanyID?: string|null, + * customerEmail?: string|null, + * customerID?: string|null, + * customerName?: string|null, + * customerTaxID?: string|null, * direction?: value-of|null, - * document_type?: value-of|null, - * due_date?: \DateTimeInterface|null, - * invoice_date?: \DateTimeInterface|null, - * invoice_id?: string|null, - * invoice_total?: string|null, + * documentType?: value-of|null, + * dueDate?: \DateTimeInterface|null, + * invoiceDate?: \DateTimeInterface|null, + * invoiceID?: string|null, + * invoiceTotal?: string|null, * items?: list|null, * note?: string|null, - * payment_details?: list|null, - * payment_term?: string|null, - * purchase_order?: string|null, - * remittance_address?: string|null, - * remittance_address_recipient?: string|null, - * service_address?: string|null, - * service_address_recipient?: string|null, - * service_end_date?: \DateTimeInterface|null, - * service_start_date?: \DateTimeInterface|null, - * shipping_address?: string|null, - * shipping_address_recipient?: string|null, + * paymentDetails?: list|null, + * paymentTerm?: string|null, + * purchaseOrder?: string|null, + * remittanceAddress?: string|null, + * remittanceAddressRecipient?: string|null, + * serviceAddress?: string|null, + * serviceAddressRecipient?: string|null, + * serviceEndDate?: \DateTimeInterface|null, + * serviceStartDate?: \DateTimeInterface|null, + * shippingAddress?: string|null, + * shippingAddressRecipient?: string|null, * state?: value-of|null, * subtotal?: string|null, - * tax_code?: value-of|null, - * tax_details?: list|null, - * total_discount?: string|null, - * total_tax?: string|null, + * taxCode?: value-of|null, + * taxDetails?: list|null, + * totalDiscount?: string|null, + * totalTax?: string|null, * vatex?: value-of|null, - * vatex_note?: string|null, - * vendor_address?: string|null, - * vendor_address_recipient?: string|null, - * vendor_company_id?: string|null, - * vendor_email?: string|null, - * vendor_name?: string|null, - * vendor_tax_id?: string|null, + * vatexNote?: string|null, + * vendorAddress?: string|null, + * vendorAddressRecipient?: string|null, + * vendorCompanyID?: string|null, + * vendorEmail?: string|null, + * vendorName?: string|null, + * vendorTaxID?: string|null, * }> $items */ public function withItems(array $items): self @@ -221,7 +221,7 @@ public function withPage(int $page): self public function withPageSize(int $pageSize): self { $obj = clone $this; - $obj['page_size'] = $pageSize; + $obj['pageSize'] = $pageSize; return $obj; } diff --git a/src/Lookup/LookupGetParticipantsResponse.php b/src/Lookup/LookupGetParticipantsResponse.php index 768dd762..55caa650 100644 --- a/src/Lookup/LookupGetParticipantsResponse.php +++ b/src/Lookup/LookupGetParticipantsResponse.php @@ -16,10 +16,10 @@ * Represents the result of a Peppol directory search. * * @phpstan-type LookupGetParticipantsResponseShape = array{ - * query_terms: string, - * search_date: string, - * total_count: int, - * used_count: int, + * queryTerms: string, + * searchDate: string, + * totalCount: int, + * usedCount: int, * participants?: list|null, * } */ @@ -31,26 +31,26 @@ final class LookupGetParticipantsResponse implements BaseModel /** * Query terms used for search. */ - #[Required] - public string $query_terms; + #[Required('query_terms')] + public string $queryTerms; /** * Search date of the result. */ - #[Required] - public string $search_date; + #[Required('search_date')] + public string $searchDate; /** * Total number of results. */ - #[Required] - public int $total_count; + #[Required('total_count')] + public int $totalCount; /** * Number of results returned by the API. */ - #[Required] - public int $used_count; + #[Required('used_count')] + public int $usedCount; /** * List of participants. @@ -66,7 +66,7 @@ final class LookupGetParticipantsResponse implements BaseModel * To enforce required parameters use * ``` * LookupGetParticipantsResponse::with( - * query_terms: ..., search_date: ..., total_count: ..., used_count: ... + * queryTerms: ..., searchDate: ..., totalCount: ..., usedCount: ... * ) * ``` * @@ -91,25 +91,25 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param list|null, + * peppolID: string, + * peppolScheme: string, + * documentTypes?: list|null, * entities?: list|null, * }> $participants */ public static function with( - string $query_terms, - string $search_date, - int $total_count, - int $used_count, + string $queryTerms, + string $searchDate, + int $totalCount, + int $usedCount, ?array $participants = null, ): self { $obj = new self; - $obj['query_terms'] = $query_terms; - $obj['search_date'] = $search_date; - $obj['total_count'] = $total_count; - $obj['used_count'] = $used_count; + $obj['queryTerms'] = $queryTerms; + $obj['searchDate'] = $searchDate; + $obj['totalCount'] = $totalCount; + $obj['usedCount'] = $usedCount; null !== $participants && $obj['participants'] = $participants; @@ -122,7 +122,7 @@ public static function with( public function withQueryTerms(string $queryTerms): self { $obj = clone $this; - $obj['query_terms'] = $queryTerms; + $obj['queryTerms'] = $queryTerms; return $obj; } @@ -133,7 +133,7 @@ public function withQueryTerms(string $queryTerms): self public function withSearchDate(string $searchDate): self { $obj = clone $this; - $obj['search_date'] = $searchDate; + $obj['searchDate'] = $searchDate; return $obj; } @@ -144,7 +144,7 @@ public function withSearchDate(string $searchDate): self public function withTotalCount(int $totalCount): self { $obj = clone $this; - $obj['total_count'] = $totalCount; + $obj['totalCount'] = $totalCount; return $obj; } @@ -155,7 +155,7 @@ public function withTotalCount(int $totalCount): self public function withUsedCount(int $usedCount): self { $obj = clone $this; - $obj['used_count'] = $usedCount; + $obj['usedCount'] = $usedCount; return $obj; } @@ -164,9 +164,9 @@ public function withUsedCount(int $usedCount): self * List of participants. * * @param list|null, + * peppolID: string, + * peppolScheme: string, + * documentTypes?: list|null, * entities?: list|null, * }> $participants */ diff --git a/src/Lookup/LookupGetParticipantsResponse/Participant.php b/src/Lookup/LookupGetParticipantsResponse/Participant.php index 67add1c2..6d629e7a 100644 --- a/src/Lookup/LookupGetParticipantsResponse/Participant.php +++ b/src/Lookup/LookupGetParticipantsResponse/Participant.php @@ -16,9 +16,9 @@ * Represents a Peppol participant with their details. * * @phpstan-type ParticipantShape = array{ - * peppol_id: string, - * peppol_scheme: string, - * document_types?: list|null, + * peppolID: string, + * peppolScheme: string, + * documentTypes?: list|null, * entities?: list|null, * } */ @@ -30,22 +30,22 @@ final class Participant implements BaseModel /** * Peppol ID of the participant. */ - #[Required] - public string $peppol_id; + #[Required('peppol_id')] + public string $peppolID; /** * Peppol scheme of the participant. */ - #[Required] - public string $peppol_scheme; + #[Required('peppol_scheme')] + public string $peppolScheme; /** * List of supported document types. * - * @var list|null $document_types + * @var list|null $documentTypes */ - #[Optional(list: DocumentType::class)] - public ?array $document_types; + #[Optional('document_types', list: DocumentType::class)] + public ?array $documentTypes; /** * List of business entities. @@ -60,7 +60,7 @@ final class Participant implements BaseModel * * To enforce required parameters use * ``` - * Participant::with(peppol_id: ..., peppol_scheme: ...) + * Participant::with(peppolID: ..., peppolScheme: ...) * ``` * * Otherwise ensure the following setters are called @@ -79,29 +79,29 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list $document_types + * @param list $documentTypes * @param list|null, * name?: string|null, - * registration_date?: string|null, + * registrationDate?: string|null, * website?: string|null, * }> $entities */ public static function with( - string $peppol_id, - string $peppol_scheme, - ?array $document_types = null, + string $peppolID, + string $peppolScheme, + ?array $documentTypes = null, ?array $entities = null, ): self { $obj = new self; - $obj['peppol_id'] = $peppol_id; - $obj['peppol_scheme'] = $peppol_scheme; + $obj['peppolID'] = $peppolID; + $obj['peppolScheme'] = $peppolScheme; - null !== $document_types && $obj['document_types'] = $document_types; + null !== $documentTypes && $obj['documentTypes'] = $documentTypes; null !== $entities && $obj['entities'] = $entities; return $obj; @@ -113,7 +113,7 @@ public static function with( public function withPeppolID(string $peppolID): self { $obj = clone $this; - $obj['peppol_id'] = $peppolID; + $obj['peppolID'] = $peppolID; return $obj; } @@ -124,7 +124,7 @@ public function withPeppolID(string $peppolID): self public function withPeppolScheme(string $peppolScheme): self { $obj = clone $this; - $obj['peppol_scheme'] = $peppolScheme; + $obj['peppolScheme'] = $peppolScheme; return $obj; } @@ -137,7 +137,7 @@ public function withPeppolScheme(string $peppolScheme): self public function withDocumentTypes(array $documentTypes): self { $obj = clone $this; - $obj['document_types'] = $documentTypes; + $obj['documentTypes'] = $documentTypes; return $obj; } @@ -146,12 +146,12 @@ public function withDocumentTypes(array $documentTypes): self * List of business entities. * * @param list|null, * name?: string|null, - * registration_date?: string|null, + * registrationDate?: string|null, * website?: string|null, * }> $entities */ diff --git a/src/Lookup/LookupGetParticipantsResponse/Participant/Entity.php b/src/Lookup/LookupGetParticipantsResponse/Participant/Entity.php index e1dfa9f5..9d097628 100644 --- a/src/Lookup/LookupGetParticipantsResponse/Participant/Entity.php +++ b/src/Lookup/LookupGetParticipantsResponse/Participant/Entity.php @@ -13,12 +13,12 @@ * Represents a business entity. * * @phpstan-type EntityShape = array{ - * additional_info?: string|null, - * country_code?: string|null, - * geo_info?: string|null, + * additionalInfo?: string|null, + * countryCode?: string|null, + * geoInfo?: string|null, * identifiers?: list|null, * name?: string|null, - * registration_date?: string|null, + * registrationDate?: string|null, * website?: string|null, * } */ @@ -30,20 +30,20 @@ final class Entity implements BaseModel /** * Additional information. */ - #[Optional(nullable: true)] - public ?string $additional_info; + #[Optional('additional_info', nullable: true)] + public ?string $additionalInfo; /** * Country code. */ - #[Optional(nullable: true)] - public ?string $country_code; + #[Optional('country_code', nullable: true)] + public ?string $countryCode; /** * Geographic information. */ - #[Optional(nullable: true)] - public ?string $geo_info; + #[Optional('geo_info', nullable: true)] + public ?string $geoInfo; /** * List of business identifiers. @@ -62,8 +62,8 @@ final class Entity implements BaseModel /** * Registration date. */ - #[Optional(nullable: true)] - public ?string $registration_date; + #[Optional('registration_date', nullable: true)] + public ?string $registrationDate; /** * Website URL. @@ -84,22 +84,22 @@ public function __construct() * @param list $identifiers */ public static function with( - ?string $additional_info = null, - ?string $country_code = null, - ?string $geo_info = null, + ?string $additionalInfo = null, + ?string $countryCode = null, + ?string $geoInfo = null, ?array $identifiers = null, ?string $name = null, - ?string $registration_date = null, + ?string $registrationDate = null, ?string $website = null, ): self { $obj = new self; - null !== $additional_info && $obj['additional_info'] = $additional_info; - null !== $country_code && $obj['country_code'] = $country_code; - null !== $geo_info && $obj['geo_info'] = $geo_info; + null !== $additionalInfo && $obj['additionalInfo'] = $additionalInfo; + null !== $countryCode && $obj['countryCode'] = $countryCode; + null !== $geoInfo && $obj['geoInfo'] = $geoInfo; null !== $identifiers && $obj['identifiers'] = $identifiers; null !== $name && $obj['name'] = $name; - null !== $registration_date && $obj['registration_date'] = $registration_date; + null !== $registrationDate && $obj['registrationDate'] = $registrationDate; null !== $website && $obj['website'] = $website; return $obj; @@ -111,7 +111,7 @@ public static function with( public function withAdditionalInfo(?string $additionalInfo): self { $obj = clone $this; - $obj['additional_info'] = $additionalInfo; + $obj['additionalInfo'] = $additionalInfo; return $obj; } @@ -122,7 +122,7 @@ public function withAdditionalInfo(?string $additionalInfo): self public function withCountryCode(?string $countryCode): self { $obj = clone $this; - $obj['country_code'] = $countryCode; + $obj['countryCode'] = $countryCode; return $obj; } @@ -133,7 +133,7 @@ public function withCountryCode(?string $countryCode): self public function withGeoInfo(?string $geoInfo): self { $obj = clone $this; - $obj['geo_info'] = $geoInfo; + $obj['geoInfo'] = $geoInfo; return $obj; } @@ -168,7 +168,7 @@ public function withName(?string $name): self public function withRegistrationDate(?string $registrationDate): self { $obj = clone $this; - $obj['registration_date'] = $registrationDate; + $obj['registrationDate'] = $registrationDate; return $obj; } diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint.php index c7f4727c..def570ad 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint.php @@ -89,7 +89,7 @@ public function __construct() * @param list $documentTypes * @param list, - * processId: ProcessID, + * processID: ProcessID, * }>|null $processes */ public static function with( @@ -162,7 +162,7 @@ public function withError(?string $error): self * * @param list, - * processId: ProcessID, + * processID: ProcessID, * }>|null $processes */ public function withProcesses(?array $processes): self diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process.php index 44e3e7ae..ff4b49ef 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process.php @@ -15,7 +15,7 @@ * Process information in the Peppol network. * * @phpstan-type ProcessShape = array{ - * endpoints: list, processId: ProcessID + * endpoints: list, processID: ProcessID * } */ final class Process implements BaseModel @@ -34,15 +34,15 @@ final class Process implements BaseModel /** * Identifier of the process. */ - #[Required] - public ProcessID $processId; + #[Required('processId')] + public ProcessID $processID; /** * `new Process()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Process::with(endpoints: ..., processId: ...) + * Process::with(endpoints: ..., processID: ...) * ``` * * Otherwise ensure the following setters are called @@ -68,19 +68,19 @@ public function __construct() * serviceActivationDate?: string|null, * serviceDescription?: string|null, * serviceExpirationDate?: string|null, - * technicalContactUrl?: string|null, - * technicalInformationUrl?: string|null, + * technicalContactURL?: string|null, + * technicalInformationURL?: string|null, * }> $endpoints - * @param ProcessID|array{scheme: string, value: string} $processId + * @param ProcessID|array{scheme: string, value: string} $processID */ public static function with( array $endpoints, - ProcessID|array $processId + ProcessID|array $processID ): self { $obj = new self; $obj['endpoints'] = $endpoints; - $obj['processId'] = $processId; + $obj['processID'] = $processID; return $obj; } @@ -95,8 +95,8 @@ public static function with( * serviceActivationDate?: string|null, * serviceDescription?: string|null, * serviceExpirationDate?: string|null, - * technicalContactUrl?: string|null, - * technicalInformationUrl?: string|null, + * technicalContactURL?: string|null, + * technicalInformationURL?: string|null, * }> $endpoints */ public function withEndpoints(array $endpoints): self @@ -115,7 +115,7 @@ public function withEndpoints(array $endpoints): self public function withProcessID(ProcessID|array $processID): self { $obj = clone $this; - $obj['processId'] = $processID; + $obj['processID'] = $processID; return $obj; } diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/Endpoint.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/Endpoint.php index 23acd2c9..f5311d0e 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/Endpoint.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/Endpoint.php @@ -20,8 +20,8 @@ * serviceActivationDate?: string|null, * serviceDescription?: string|null, * serviceExpirationDate?: string|null, - * technicalContactUrl?: string|null, - * technicalInformationUrl?: string|null, + * technicalContactURL?: string|null, + * technicalInformationURL?: string|null, * } */ final class Endpoint implements BaseModel @@ -68,14 +68,14 @@ final class Endpoint implements BaseModel /** * URL for technical contact information. */ - #[Optional(nullable: true)] - public ?string $technicalContactUrl; + #[Optional('technicalContactUrl', nullable: true)] + public ?string $technicalContactURL; /** * URL for technical documentation. */ - #[Optional(nullable: true)] - public ?string $technicalInformationUrl; + #[Optional('technicalInformationUrl', nullable: true)] + public ?string $technicalInformationURL; /** * `new Endpoint()` is missing required properties by the API. @@ -112,8 +112,8 @@ public static function with( ?string $serviceActivationDate = null, ?string $serviceDescription = null, ?string $serviceExpirationDate = null, - ?string $technicalContactUrl = null, - ?string $technicalInformationUrl = null, + ?string $technicalContactURL = null, + ?string $technicalInformationURL = null, ): self { $obj = new self; @@ -124,8 +124,8 @@ public static function with( null !== $serviceActivationDate && $obj['serviceActivationDate'] = $serviceActivationDate; null !== $serviceDescription && $obj['serviceDescription'] = $serviceDescription; null !== $serviceExpirationDate && $obj['serviceExpirationDate'] = $serviceExpirationDate; - null !== $technicalContactUrl && $obj['technicalContactUrl'] = $technicalContactUrl; - null !== $technicalInformationUrl && $obj['technicalInformationUrl'] = $technicalInformationUrl; + null !== $technicalContactURL && $obj['technicalContactURL'] = $technicalContactURL; + null !== $technicalInformationURL && $obj['technicalInformationURL'] = $technicalInformationURL; return $obj; } @@ -208,7 +208,7 @@ public function withServiceExpirationDate( public function withTechnicalContactURL(?string $technicalContactURL): self { $obj = clone $this; - $obj['technicalContactUrl'] = $technicalContactURL; + $obj['technicalContactURL'] = $technicalContactURL; return $obj; } @@ -220,7 +220,7 @@ public function withTechnicalInformationURL( ?string $technicalInformationURL ): self { $obj = clone $this; - $obj['technicalInformationUrl'] = $technicalInformationURL; + $obj['technicalInformationURL'] = $technicalInformationURL; return $obj; } diff --git a/src/Lookup/LookupRetrieveParams.php b/src/Lookup/LookupRetrieveParams.php index cf3b399d..a7f17140 100644 --- a/src/Lookup/LookupRetrieveParams.php +++ b/src/Lookup/LookupRetrieveParams.php @@ -14,7 +14,7 @@ * * @see EInvoiceAPI\Services\LookupService::retrieve() * - * @phpstan-type LookupRetrieveParamsShape = array{peppol_id: string} + * @phpstan-type LookupRetrieveParamsShape = array{peppolID: string} */ final class LookupRetrieveParams implements BaseModel { @@ -26,14 +26,14 @@ final class LookupRetrieveParams implements BaseModel * Peppol ID in the format `:`. Example: `0208:1018265814` for a Belgian company. */ #[Required] - public string $peppol_id; + public string $peppolID; /** * `new LookupRetrieveParams()` is missing required properties by the API. * * To enforce required parameters use * ``` - * LookupRetrieveParams::with(peppol_id: ...) + * LookupRetrieveParams::with(peppolID: ...) * ``` * * Otherwise ensure the following setters are called @@ -52,11 +52,11 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(string $peppol_id): self + public static function with(string $peppolID): self { $obj = new self; - $obj['peppol_id'] = $peppol_id; + $obj['peppolID'] = $peppolID; return $obj; } @@ -67,7 +67,7 @@ public static function with(string $peppol_id): self public function withPeppolID(string $peppolID): self { $obj = clone $this; - $obj['peppol_id'] = $peppolID; + $obj['peppolID'] = $peppolID; return $obj; } diff --git a/src/Lookup/LookupRetrieveParticipantsParams.php b/src/Lookup/LookupRetrieveParticipantsParams.php index 1280fd09..ef91659f 100644 --- a/src/Lookup/LookupRetrieveParticipantsParams.php +++ b/src/Lookup/LookupRetrieveParticipantsParams.php @@ -16,7 +16,7 @@ * @see EInvoiceAPI\Services\LookupService::retrieveParticipants() * * @phpstan-type LookupRetrieveParticipantsParamsShape = array{ - * query: string, country_code?: string|null + * query: string, countryCode?: string|null * } */ final class LookupRetrieveParticipantsParams implements BaseModel @@ -35,7 +35,7 @@ final class LookupRetrieveParticipantsParams implements BaseModel * Country code of the company to lookup. If not provided, the search will be global. */ #[Optional(nullable: true)] - public ?string $country_code; + public ?string $countryCode; /** * `new LookupRetrieveParticipantsParams()` is missing required properties by the API. @@ -63,13 +63,13 @@ public function __construct() */ public static function with( string $query, - ?string $country_code = null + ?string $countryCode = null ): self { $obj = new self; $obj['query'] = $query; - null !== $country_code && $obj['country_code'] = $country_code; + null !== $countryCode && $obj['countryCode'] = $countryCode; return $obj; } @@ -91,7 +91,7 @@ public function withQuery(string $query): self public function withCountryCode(?string $countryCode): self { $obj = clone $this; - $obj['country_code'] = $countryCode; + $obj['countryCode'] = $countryCode; return $obj; } diff --git a/src/Me/MeGetResponse.php b/src/Me/MeGetResponse.php index 91a92cdc..69a7af84 100644 --- a/src/Me/MeGetResponse.php +++ b/src/Me/MeGetResponse.php @@ -12,23 +12,23 @@ /** * @phpstan-type MeGetResponseShape = array{ - * credit_balance: int, + * creditBalance: int, * name: string, * plan: value-of, - * bcc_recipient_email?: string|null, - * company_address?: string|null, - * company_city?: string|null, - * company_country?: string|null, - * company_email?: string|null, - * company_name?: string|null, - * company_number?: string|null, - * company_tax_id?: string|null, - * company_zip?: string|null, + * bccRecipientEmail?: string|null, + * companyAddress?: string|null, + * companyCity?: string|null, + * companyCountry?: string|null, + * companyEmail?: string|null, + * companyName?: string|null, + * companyNumber?: string|null, + * companyTaxID?: string|null, + * companyZip?: string|null, * description?: string|null, * ibans?: list|null, - * peppol_ids?: list|null, - * smp_registration?: bool|null, - * smp_registration_date?: \DateTimeInterface|null, + * peppolIDs?: list|null, + * smpRegistration?: bool|null, + * smpRegistrationDate?: \DateTimeInterface|null, * } */ final class MeGetResponse implements BaseModel @@ -39,8 +39,8 @@ final class MeGetResponse implements BaseModel /** * Credit balance of the tenant. */ - #[Required] - public int $credit_balance; + #[Required('credit_balance')] + public int $creditBalance; #[Required] public string $name; @@ -56,56 +56,56 @@ final class MeGetResponse implements BaseModel /** * BCC recipient email to deliver documents. */ - #[Optional(nullable: true)] - public ?string $bcc_recipient_email; + #[Optional('bcc_recipient_email', nullable: true)] + public ?string $bccRecipientEmail; /** * Address of the company. Must be in the form of `Street Name Street Number`. */ - #[Optional(nullable: true)] - public ?string $company_address; + #[Optional('company_address', nullable: true)] + public ?string $companyAddress; /** * City of the company. */ - #[Optional(nullable: true)] - public ?string $company_city; + #[Optional('company_city', nullable: true)] + public ?string $companyCity; /** * Country of the company. */ - #[Optional(nullable: true)] - public ?string $company_country; + #[Optional('company_country', nullable: true)] + public ?string $companyCountry; /** * Email of the company. */ - #[Optional(nullable: true)] - public ?string $company_email; + #[Optional('company_email', nullable: true)] + public ?string $companyEmail; /** * Name of the company. Must include the company type. For example: `BV`, `NV`, `CVBA`, `VOF`. */ - #[Optional(nullable: true)] - public ?string $company_name; + #[Optional('company_name', nullable: true)] + public ?string $companyName; /** * Company number. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. */ - #[Optional(nullable: true)] - public ?string $company_number; + #[Optional('company_number', nullable: true)] + public ?string $companyNumber; /** * Company tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Optional(nullable: true)] - public ?string $company_tax_id; + #[Optional('company_tax_id', nullable: true)] + public ?string $companyTaxID; /** * Zip code of the company. */ - #[Optional(nullable: true)] - public ?string $company_zip; + #[Optional('company_zip', nullable: true)] + public ?string $companyZip; #[Optional(nullable: true)] public ?string $description; @@ -121,29 +121,29 @@ final class MeGetResponse implements BaseModel /** * Peppol IDs of the tenant. * - * @var list|null $peppol_ids + * @var list|null $peppolIDs */ - #[Optional(list: 'string', nullable: true)] - public ?array $peppol_ids; + #[Optional('peppol_ids', list: 'string', nullable: true)] + public ?array $peppolIDs; /** * Whether the tenant is registered on our SMP. */ - #[Optional(nullable: true)] - public ?bool $smp_registration; + #[Optional('smp_registration', nullable: true)] + public ?bool $smpRegistration; /** * Date when the tenant was registered on SMP. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $smp_registration_date; + #[Optional('smp_registration_date', nullable: true)] + public ?\DateTimeInterface $smpRegistrationDate; /** * `new MeGetResponse()` is missing required properties by the API. * * To enforce required parameters use * ``` - * MeGetResponse::with(credit_balance: ..., name: ..., plan: ...) + * MeGetResponse::with(creditBalance: ..., name: ..., plan: ...) * ``` * * Otherwise ensure the following setters are called @@ -164,47 +164,47 @@ public function __construct() * * @param Plan|value-of $plan * @param list|null $ibans - * @param list|null $peppol_ids + * @param list|null $peppolIDs */ public static function with( - int $credit_balance, + int $creditBalance, string $name, Plan|string $plan, - ?string $bcc_recipient_email = null, - ?string $company_address = null, - ?string $company_city = null, - ?string $company_country = null, - ?string $company_email = null, - ?string $company_name = null, - ?string $company_number = null, - ?string $company_tax_id = null, - ?string $company_zip = null, + ?string $bccRecipientEmail = null, + ?string $companyAddress = null, + ?string $companyCity = null, + ?string $companyCountry = null, + ?string $companyEmail = null, + ?string $companyName = null, + ?string $companyNumber = null, + ?string $companyTaxID = null, + ?string $companyZip = null, ?string $description = null, ?array $ibans = null, - ?array $peppol_ids = null, - ?bool $smp_registration = null, - ?\DateTimeInterface $smp_registration_date = null, + ?array $peppolIDs = null, + ?bool $smpRegistration = null, + ?\DateTimeInterface $smpRegistrationDate = null, ): self { $obj = new self; - $obj['credit_balance'] = $credit_balance; + $obj['creditBalance'] = $creditBalance; $obj['name'] = $name; $obj['plan'] = $plan; - null !== $bcc_recipient_email && $obj['bcc_recipient_email'] = $bcc_recipient_email; - null !== $company_address && $obj['company_address'] = $company_address; - null !== $company_city && $obj['company_city'] = $company_city; - null !== $company_country && $obj['company_country'] = $company_country; - null !== $company_email && $obj['company_email'] = $company_email; - null !== $company_name && $obj['company_name'] = $company_name; - null !== $company_number && $obj['company_number'] = $company_number; - null !== $company_tax_id && $obj['company_tax_id'] = $company_tax_id; - null !== $company_zip && $obj['company_zip'] = $company_zip; + null !== $bccRecipientEmail && $obj['bccRecipientEmail'] = $bccRecipientEmail; + null !== $companyAddress && $obj['companyAddress'] = $companyAddress; + null !== $companyCity && $obj['companyCity'] = $companyCity; + null !== $companyCountry && $obj['companyCountry'] = $companyCountry; + null !== $companyEmail && $obj['companyEmail'] = $companyEmail; + null !== $companyName && $obj['companyName'] = $companyName; + null !== $companyNumber && $obj['companyNumber'] = $companyNumber; + null !== $companyTaxID && $obj['companyTaxID'] = $companyTaxID; + null !== $companyZip && $obj['companyZip'] = $companyZip; null !== $description && $obj['description'] = $description; null !== $ibans && $obj['ibans'] = $ibans; - null !== $peppol_ids && $obj['peppol_ids'] = $peppol_ids; - null !== $smp_registration && $obj['smp_registration'] = $smp_registration; - null !== $smp_registration_date && $obj['smp_registration_date'] = $smp_registration_date; + null !== $peppolIDs && $obj['peppolIDs'] = $peppolIDs; + null !== $smpRegistration && $obj['smpRegistration'] = $smpRegistration; + null !== $smpRegistrationDate && $obj['smpRegistrationDate'] = $smpRegistrationDate; return $obj; } @@ -215,7 +215,7 @@ public static function with( public function withCreditBalance(int $creditBalance): self { $obj = clone $this; - $obj['credit_balance'] = $creditBalance; + $obj['creditBalance'] = $creditBalance; return $obj; } @@ -247,7 +247,7 @@ public function withPlan(Plan|string $plan): self public function withBccRecipientEmail(?string $bccRecipientEmail): self { $obj = clone $this; - $obj['bcc_recipient_email'] = $bccRecipientEmail; + $obj['bccRecipientEmail'] = $bccRecipientEmail; return $obj; } @@ -258,7 +258,7 @@ public function withBccRecipientEmail(?string $bccRecipientEmail): self public function withCompanyAddress(?string $companyAddress): self { $obj = clone $this; - $obj['company_address'] = $companyAddress; + $obj['companyAddress'] = $companyAddress; return $obj; } @@ -269,7 +269,7 @@ public function withCompanyAddress(?string $companyAddress): self public function withCompanyCity(?string $companyCity): self { $obj = clone $this; - $obj['company_city'] = $companyCity; + $obj['companyCity'] = $companyCity; return $obj; } @@ -280,7 +280,7 @@ public function withCompanyCity(?string $companyCity): self public function withCompanyCountry(?string $companyCountry): self { $obj = clone $this; - $obj['company_country'] = $companyCountry; + $obj['companyCountry'] = $companyCountry; return $obj; } @@ -291,7 +291,7 @@ public function withCompanyCountry(?string $companyCountry): self public function withCompanyEmail(?string $companyEmail): self { $obj = clone $this; - $obj['company_email'] = $companyEmail; + $obj['companyEmail'] = $companyEmail; return $obj; } @@ -302,7 +302,7 @@ public function withCompanyEmail(?string $companyEmail): self public function withCompanyName(?string $companyName): self { $obj = clone $this; - $obj['company_name'] = $companyName; + $obj['companyName'] = $companyName; return $obj; } @@ -313,7 +313,7 @@ public function withCompanyName(?string $companyName): self public function withCompanyNumber(?string $companyNumber): self { $obj = clone $this; - $obj['company_number'] = $companyNumber; + $obj['companyNumber'] = $companyNumber; return $obj; } @@ -324,7 +324,7 @@ public function withCompanyNumber(?string $companyNumber): self public function withCompanyTaxID(?string $companyTaxID): self { $obj = clone $this; - $obj['company_tax_id'] = $companyTaxID; + $obj['companyTaxID'] = $companyTaxID; return $obj; } @@ -335,7 +335,7 @@ public function withCompanyTaxID(?string $companyTaxID): self public function withCompanyZip(?string $companyZip): self { $obj = clone $this; - $obj['company_zip'] = $companyZip; + $obj['companyZip'] = $companyZip; return $obj; } @@ -369,7 +369,7 @@ public function withIbans(?array $ibans): self public function withPeppolIDs(?array $peppolIDs): self { $obj = clone $this; - $obj['peppol_ids'] = $peppolIDs; + $obj['peppolIDs'] = $peppolIDs; return $obj; } @@ -380,7 +380,7 @@ public function withPeppolIDs(?array $peppolIDs): self public function withSmpRegistration(?bool $smpRegistration): self { $obj = clone $this; - $obj['smp_registration'] = $smpRegistration; + $obj['smpRegistration'] = $smpRegistration; return $obj; } @@ -392,7 +392,7 @@ public function withSmpRegistrationDate( ?\DateTimeInterface $smpRegistrationDate ): self { $obj = clone $this; - $obj['smp_registration_date'] = $smpRegistrationDate; + $obj['smpRegistrationDate'] = $smpRegistrationDate; return $obj; } diff --git a/src/Outbox/OutboxListDraftDocumentsParams.php b/src/Outbox/OutboxListDraftDocumentsParams.php index ece97329..39e0a9ff 100644 --- a/src/Outbox/OutboxListDraftDocumentsParams.php +++ b/src/Outbox/OutboxListDraftDocumentsParams.php @@ -15,7 +15,7 @@ * @see EInvoiceAPI\Services\OutboxService::listDraftDocuments() * * @phpstan-type OutboxListDraftDocumentsParamsShape = array{ - * page?: int, page_size?: int + * page?: int, pageSize?: int * } */ final class OutboxListDraftDocumentsParams implements BaseModel @@ -34,7 +34,7 @@ final class OutboxListDraftDocumentsParams implements BaseModel * Number of items per page. */ #[Optional] - public ?int $page_size; + public ?int $pageSize; public function __construct() { @@ -46,12 +46,12 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(?int $page = null, ?int $page_size = null): self + public static function with(?int $page = null, ?int $pageSize = null): self { $obj = new self; null !== $page && $obj['page'] = $page; - null !== $page_size && $obj['page_size'] = $page_size; + null !== $pageSize && $obj['pageSize'] = $pageSize; return $obj; } @@ -73,7 +73,7 @@ public function withPage(int $page): self public function withPageSize(int $pageSize): self { $obj = clone $this; - $obj['page_size'] = $pageSize; + $obj['pageSize'] = $pageSize; return $obj; } diff --git a/src/Outbox/OutboxListReceivedDocumentsParams.php b/src/Outbox/OutboxListReceivedDocumentsParams.php index e8282e99..6e85ddda 100644 --- a/src/Outbox/OutboxListReceivedDocumentsParams.php +++ b/src/Outbox/OutboxListReceivedDocumentsParams.php @@ -17,10 +17,10 @@ * @see EInvoiceAPI\Services\OutboxService::listReceivedDocuments() * * @phpstan-type OutboxListReceivedDocumentsParamsShape = array{ - * date_from?: \DateTimeInterface|null, - * date_to?: \DateTimeInterface|null, + * dateFrom?: \DateTimeInterface|null, + * dateTo?: \DateTimeInterface|null, * page?: int, - * page_size?: int, + * pageSize?: int, * search?: string|null, * sender?: string|null, * state?: null|DocumentState|value-of, @@ -37,13 +37,13 @@ final class OutboxListReceivedDocumentsParams implements BaseModel * Filter by issue date (from). */ #[Optional(nullable: true)] - public ?\DateTimeInterface $date_from; + public ?\DateTimeInterface $dateFrom; /** * Filter by issue date (to). */ #[Optional(nullable: true)] - public ?\DateTimeInterface $date_to; + public ?\DateTimeInterface $dateTo; /** * Page number. @@ -55,7 +55,7 @@ final class OutboxListReceivedDocumentsParams implements BaseModel * Number of items per page. */ #[Optional] - public ?int $page_size; + public ?int $pageSize; /** * Search in invoice number, seller/buyer names. @@ -99,10 +99,10 @@ public function __construct() * @param DocumentType|value-of|null $type */ public static function with( - ?\DateTimeInterface $date_from = null, - ?\DateTimeInterface $date_to = null, + ?\DateTimeInterface $dateFrom = null, + ?\DateTimeInterface $dateTo = null, ?int $page = null, - ?int $page_size = null, + ?int $pageSize = null, ?string $search = null, ?string $sender = null, DocumentState|string|null $state = null, @@ -110,10 +110,10 @@ public static function with( ): self { $obj = new self; - null !== $date_from && $obj['date_from'] = $date_from; - null !== $date_to && $obj['date_to'] = $date_to; + null !== $dateFrom && $obj['dateFrom'] = $dateFrom; + null !== $dateTo && $obj['dateTo'] = $dateTo; null !== $page && $obj['page'] = $page; - null !== $page_size && $obj['page_size'] = $page_size; + null !== $pageSize && $obj['pageSize'] = $pageSize; null !== $search && $obj['search'] = $search; null !== $sender && $obj['sender'] = $sender; null !== $state && $obj['state'] = $state; @@ -128,7 +128,7 @@ public static function with( public function withDateFrom(?\DateTimeInterface $dateFrom): self { $obj = clone $this; - $obj['date_from'] = $dateFrom; + $obj['dateFrom'] = $dateFrom; return $obj; } @@ -139,7 +139,7 @@ public function withDateFrom(?\DateTimeInterface $dateFrom): self public function withDateTo(?\DateTimeInterface $dateTo): self { $obj = clone $this; - $obj['date_to'] = $dateTo; + $obj['dateTo'] = $dateTo; return $obj; } @@ -161,7 +161,7 @@ public function withPage(int $page): self public function withPageSize(int $pageSize): self { $obj = clone $this; - $obj['page_size'] = $pageSize; + $obj['pageSize'] = $pageSize; return $obj; } diff --git a/src/Services/Documents/AttachmentsService.php b/src/Services/Documents/AttachmentsService.php index 52489802..b058a442 100644 --- a/src/Services/Documents/AttachmentsService.php +++ b/src/Services/Documents/AttachmentsService.php @@ -28,7 +28,7 @@ public function __construct(private Client $client) {} * * Get attachment details with for an invoice or credit note with link to download file (signed URL, valid for 1 hour) * - * @param array{document_id: string}|AttachmentRetrieveParams $params + * @param array{documentID: string}|AttachmentRetrieveParams $params * * @throws APIException */ @@ -41,8 +41,8 @@ public function retrieve( $params, $requestOptions, ); - $documentID = $parsed['document_id']; - unset($parsed['document_id']); + $documentID = $parsed['documentID']; + unset($parsed['documentID']); /** @var BaseResponse */ $response = $this->client->request( @@ -84,7 +84,7 @@ public function list( * * Delete an attachment from an invoice or credit note * - * @param array{document_id: string}|AttachmentDeleteParams $params + * @param array{documentID: string}|AttachmentDeleteParams $params * * @throws APIException */ @@ -97,8 +97,8 @@ public function delete( $params, $requestOptions, ); - $documentID = $parsed['document_id']; - unset($parsed['document_id']); + $documentID = $parsed['documentID']; + unset($parsed['documentID']); /** @var BaseResponse */ $response = $this->client->request( diff --git a/src/Services/DocumentsService.php b/src/Services/DocumentsService.php index d9c2a3b3..4ec9dc87 100644 --- a/src/Services/DocumentsService.php +++ b/src/Services/DocumentsService.php @@ -7,6 +7,7 @@ use EInvoiceAPI\Client; use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; +use EInvoiceAPI\Core\Util; use EInvoiceAPI\Documents\CurrencyCode; use EInvoiceAPI\Documents\DocumentAttachmentCreate; use EInvoiceAPI\Documents\DocumentCreateFromPdfParams; @@ -58,92 +59,87 @@ public function __construct(private Client $client) * @param array{ * allowances?: list|null, - * amount_due?: float|string|null, + * amountDue?: float|string|null, * attachments?: list|null, - * billing_address?: string|null, - * billing_address_recipient?: string|null, + * billingAddress?: string|null, + * billingAddressRecipient?: string|null, * charges?: list|null, * currency?: value-of, - * customer_address?: string|null, - * customer_address_recipient?: string|null, - * customer_company_id?: string|null, - * customer_email?: string|null, - * customer_id?: string|null, - * customer_name?: string|null, - * customer_tax_id?: string|null, + * customerAddress?: string|null, + * customerAddressRecipient?: string|null, + * customerCompanyID?: string|null, + * customerEmail?: string|null, + * customerID?: string|null, + * customerName?: string|null, + * customerTaxID?: string|null, * direction?: 'INBOUND'|'OUTBOUND'|DocumentDirection, - * document_type?: 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType, - * due_date?: string|\DateTimeInterface|null, - * invoice_date?: string|\DateTimeInterface|null, - * invoice_id?: string|null, - * invoice_total?: float|string|null, + * documentType?: 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType, + * dueDate?: string|\DateTimeInterface|null, + * invoiceDate?: string|\DateTimeInterface|null, + * invoiceID?: string|null, + * invoiceTotal?: float|string|null, * items?: list>|null, * amount?: float|string|null, * charges?: list>|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: float|string|null, * tax?: float|string|null, - * tax_rate?: float|string|null, + * taxRate?: float|string|null, * unit?: '10'|'11'|'13'|'14'|'15'|'20'|'21'|'22'|'23'|'24'|'25'|'27'|'28'|'33'|'34'|'35'|'37'|'38'|'40'|'41'|'56'|'57'|'58'|'59'|'60'|'61'|'74'|'77'|'80'|'81'|'85'|'87'|'89'|'91'|'1I'|'EA'|'E01'|'E07'|'E09'|'E10'|'E12'|'E14'|'E17'|'E20'|'E23'|'E25'|'E27'|'E31'|'E34'|'E35'|'E36'|'E37'|'E38'|'E39'|'E40'|'E41'|'E42'|'E43'|'E44'|'E45'|'E46'|'E47'|'E48'|'E49'|'E50'|'E51'|'E52'|'E53'|'E54'|'E55'|'E56'|'E57'|'E58'|'E60'|'E62'|'E65'|'E66'|'E67'|'E69'|'E70'|'E71'|'E73'|'E75'|'E76'|'2A'|'2B'|'2C'|'2G'|'2H'|'2I'|'2J'|'2K'|'2L'|'2M'|'2N'|'2P'|'2Q'|'2R'|'2U'|'2X'|'2Y'|'2Z'|'3B'|'3C'|'4C'|'4G'|'4H'|'4K'|'4L'|'4M'|'4N'|'4O'|'4P'|'4Q'|'4R'|'4T'|'4U'|'4W'|'4X'|'5A'|'5B'|'5E'|'5J'|'A10'|'A11'|'A12'|'A13'|'A14'|'A15'|'A16'|'A17'|'A18'|'A19'|'A2'|'A20'|'A21'|'A22'|'A23'|'A24'|'A26'|'A27'|'A28'|'A29'|'A3'|'A30'|'A31'|'A32'|'A33'|'A34'|'A35'|'A36'|'A37'|'A38'|'A39'|'A4'|'A40'|'A41'|'A42'|'A43'|'A44'|'A45'|'A46'|'A47'|'A48'|'A49'|'A5'|'A50'|'A51'|'A52'|'A53'|'A54'|'A55'|'A56'|'A57'|'A58'|'A59'|'A6'|'A60'|'A61'|'A62'|'A63'|'A64'|'A65'|'A66'|'A67'|'A68'|'A69'|'A7'|'A70'|'A71'|'A72'|'A73'|'A74'|'A75'|'A76'|'A77'|'A78'|'A79'|'A8'|'A80'|'A81'|'A82'|'A83'|'A84'|'A85'|'A86'|'A87'|'A88'|'A89'|'A9'|'A90'|'A91'|'A92'|'A93'|'A94'|'A95'|'A96'|'A97'|'A98'|'A99'|'ACR'|'AH'|'AI'|'AK'|'AMH'|'AMT'|'ANN'|'B1'|'B11'|'B12'|'B13'|'B14'|'B15'|'B16'|'B17'|'B18'|'B19'|'B20'|'B21'|'B22'|'B23'|'B24'|'B25'|'B26'|'B27'|'B28'|'B29'|'B3'|'B30'|'B31'|'B32'|'B33'|'B34'|'B35'|'B36'|'B37'|'B38'|'B39'|'B4'|'B40'|'B41'|'B42'|'B43'|'B44'|'B45'|'B46'|'B47'|'B48'|'B49'|'B5'|'B50'|'B52'|'B53'|'B54'|'B55'|'B56'|'B57'|'B58'|'B59'|'B6'|'B60'|'B61'|'B62'|'B63'|'B64'|'B65'|'B66'|'B67'|'B68'|'B69'|'B7'|'B70'|'B71'|'B72'|'B73'|'B74'|'B75'|'B76'|'B77'|'B78'|'B79'|'B8'|'B80'|'B81'|'B82'|'B83'|'B84'|'B85'|'B86'|'B87'|'B88'|'B89'|'B9'|'B90'|'B91'|'B92'|'B93'|'B94'|'B95'|'B96'|'B97'|'B98'|'B99'|'BAR'|'BB'|'BFT'|'BHP'|'BIL'|'BLD'|'BLL'|'BUA'|'BUI'|'C0'|'C10'|'C11'|'C12'|'C13'|'C14'|'C15'|'C16'|'C17'|'C18'|'C19'|'C20'|'C21'|'C22'|'C23'|'C24'|'C25'|'C26'|'C27'|'C28'|'C29'|'C30'|'C31'|'C32'|'C33'|'C34'|'C35'|'C36'|'C37'|'C38'|'C39'|'C40'|'C41'|'C42'|'C43'|'C44'|'C45'|'C46'|'C47'|'C48'|'C49'|'C50'|'C51'|'C52'|'C53'|'C54'|'C55'|'C56'|'C57'|'C58'|'C59'|'C60'|'C61'|'C63'|'C64'|'C65'|'C66'|'C67'|'C68'|'C69'|'C70'|'C71'|'C72'|'C73'|'C74'|'C75'|'C76'|'C77'|'C78'|'C79'|'C80'|'C81'|'C82'|'C83'|'C84'|'C85'|'C86'|'C87'|'C88'|'C89'|'C90'|'C91'|'C92'|'C93'|'C94'|'C95'|'C96'|'C97'|'C98'|'C99'|'CDL'|'CEL'|'CHU'|'CIU'|'CLT'|'CMK'|'CMQ'|'CMT'|'CNP'|'CNT'|'COU'|'CTG'|'CTN'|'CUR'|'CWA'|'CWI'|'DAN'|'DAY'|'DB'|'DD'|'DG'|'DI'|'DLT'|'DMK'|'DMQ'|'DMT'|'DPC'|'DPT'|'DRA'|'DZN'|'DZP'|'FOT'|'GLL'|'GLI'|'GRM'|'GRO'|'HUR'|'HTZ'|'INH'|'KGM'|'KMT'|'MTR'|'SMI'|'MIN'|'MON'|'ONZ'|'LBR'|'QT'|'SEC'|'FTK'|'INK'|'MTK'|'YDK'|'TNE'|'VLT'|'WTT'|'YRD'|'FTQ'|'INQ'|'MTQ'|'YDQ'|'HAR'|'KLT'|'MLT'|'MMT'|'KMK'|'MMK'|'XAA'|'XAB'|'XAC'|'XAD'|'XAE'|'XAF'|'XAG'|'XAH'|'XAI'|'XAJ'|'XAL'|'XAM'|'XAP'|'XAT'|'XAV'|'XB4'|'XBA'|'XBB'|'XBC'|'XBD'|'XBE'|'XBF'|'XBG'|'XBH'|'XBI'|'XBJ'|'XBK'|'XBL'|'XBM'|'XBN'|'XBO'|'XBP'|'XBQ'|'XBR'|'XBS'|'XBT'|'XBU'|'XBV'|'XBW'|'XBX'|'XBY'|'XBZ'|'XCA'|'XCB'|'XCC'|'XCD'|'XCE'|'XCF'|'XCG'|'XCH'|'XCI'|'XCJ'|'XCK'|'XCL'|'XCM'|'XCN'|'XCO'|'XCP'|'XCQ'|'XCR'|'XCS'|'XCT'|'XCU'|'XCV'|'XCW'|'XCX'|'XCY'|'XCZ'|'XDA'|'XDB'|'XDC'|'XDD'|'XDE'|'XDF'|'XDG'|'XDH'|'XDI'|'XDJ'|'XDK'|'XDL'|'XDM'|'XDN'|'XDP'|'XDQ'|'XDR'|'XDS'|'XDT'|'XDU'|'XDV'|'XDW'|'XDX'|'XDY'|'XDZ'|'XEA'|'XEB'|'XEC'|'XED'|'XEE'|'XEF'|'XEG'|'XEH'|'XEI'|'XEJ'|'XEK'|'XEL'|'XEM'|'XEN'|'XEP'|'XEQ'|'XER'|'XES'|'XET'|'XEU'|'XEV'|'XEW'|'XEX'|'XEY'|'XFB'|'XFC'|'XFD'|'XFE'|'XFF'|'XFG'|'XFH'|'XFI'|'XFJ'|'XFK'|'XFL'|'XFM'|'XFN'|'XFO'|'XFP'|'XFQ'|'XFR'|'XFS'|'XFT'|'XFU'|'XFV'|'XFW'|'XFX'|'XFY'|'XFZ'|'XGA'|'XGB'|'XGC'|'XGD'|'XGE'|'XGF'|'XGG'|'XGH'|'XGI'|'XGJ'|'XGK'|'XGL'|'XGM'|'XGN'|'XGO'|'XGP'|'XGQ'|'XGR'|'XGS'|'XGT'|'XGU'|'XGV'|'XGW'|'XGX'|'XGY'|'XGZ'|'XHA'|'XHB'|'XHC'|'XHD'|'XHE'|'XHF'|'XHG'|'XHH'|'XHI'|'XHJ'|'XHK'|'XHL'|'XHM'|'XHN'|'XHP'|'XHQ'|'XHR'|'XHS'|'XHT'|'XHU'|'XHV'|'XHW'|'XHX'|'XHY'|'XHZ'|'XIA'|'XIB'|'XIC'|'XID'|'XIE'|'XIF'|'XIG'|'XIH'|'XII'|'XIJ'|'XIK'|'XIL'|'XIM'|'XIN'|'XIO'|'XJA'|'XJB'|'XJC'|'XJD'|'XJE'|'XJF'|'XJG'|'XJH'|'XJI'|'XJJ'|'XJK'|'XJL'|'XJM'|'XJN'|'XJO'|'XJP'|'XJQ'|'XJR'|'XJS'|'XJT'|'XJU'|'XJV'|'XJW'|'XJX'|'XJY'|'XJZ'|'XLA'|'XLB'|'XLC'|'XLD'|'XLE'|'XLF'|'XLG'|'XLH'|'XLI'|'XLJ'|'XLK'|'XLL'|'XLM'|'XLN'|'XLO'|'XLP'|'XLQ'|'XLR'|'XLS'|'XLT'|'XLU'|'XLV'|'XLW'|'XLX'|'XLY'|'XLZ'|'XMA'|'XMB'|'XMC'|'XMD'|'XME'|'XMF'|'XMG'|'XMH'|'XMI'|'XMJ'|'XMK'|'XML'|'XMM'|'XMN'|'XMO'|'XMP'|'XMQ'|'XMR'|'XMS'|'XMT'|'XMU'|'XMV'|'XMW'|'XMX'|'XMY'|'XMZ'|'XNA'|'XNB'|'XNC'|'XND'|'XNE'|'XNF'|'XNG'|'XNH'|'XNI'|'XNJ'|'XNK'|'XNL'|'XNM'|'XOA'|'XOB'|'XOC'|'XOD'|'XOE'|'XOF'|'XOG'|'XOH'|'XOI'|'XOJ'|'XOK'|'XOL'|'XOM'|'XON'|'XOO'|'XOP'|'XOQ'|'XOR'|'XOS'|'XOT'|'XOU'|'XOV'|'XOW'|'XOX'|'XOY'|'XOZ'|'XP1'|'XP2'|'XP3'|'XP4'|'XPA'|'XPB'|'XPC'|'XPD'|'XPE'|'XPF'|'XPG'|'XPH'|'XPI'|'XPJ'|'XPK'|'XPL'|'XPM'|'XPN'|'XPO'|'XPP'|'XPQ'|'XPR'|'XPS'|'XPT'|'XPU'|'XPV'|'XPW'|'XPX'|'XPY'|'XPZ'|'XQA'|'XQB'|'XQC'|'XQD'|'XQE'|'XQF'|'XQG'|'XQH'|'XQI'|'XQJ'|'XQK'|'XQL'|'XQM'|'XQN'|'XQO'|'XQP'|'XQQ'|'XQR'|'XQS'|'XRD'|'XRE'|'XRF'|'XRG'|'XRH'|'XRI'|'XRJ'|'XRK'|'XRL'|'XRM'|'XRN'|'XRO'|'XRP'|'XRQ'|'XRR'|'XRS'|'XRT'|'XRU'|'XRV'|'XRW'|'XRX'|'XRY'|'XRZ'|'XSA'|'XSB'|'XSC'|'XSD'|'XSE'|'XSF'|'XSG'|'XSH'|'XSI'|'XSJ'|'XSK'|'XSL'|'XSM'|'XSN'|'XSO'|'XSP'|'XSQ'|'XSR'|'XSS'|'XST'|'XSU'|'XSV'|'XSW'|'XSX'|'XSY'|'XSZ'|'XTA'|'XTB'|'XTC'|'XTD'|'XTE'|'XTF'|'XTG'|'XTI'|'XTJ'|'XTK'|'XTL'|'XTM'|'XTN'|'XTO'|'XTR'|'XTS'|'XTT'|'XTU'|'XTV'|'XTW'|'XTX'|'XTY'|'XTZ'|'XUC'|'XUN'|'XVA'|'XVG'|'XVI'|'XVK'|'XVL'|'XVN'|'XVO'|'XVP'|'XVQ'|'XVR'|'XVS'|'XVY'|'XWA'|'XWB'|'XWC'|'XWD'|'XWF'|'XWG'|'XWH'|'XWJ'|'XWK'|'XWL'|'XWM'|'XWN'|'XWP'|'XWQ'|'XWR'|'XWS'|'XWT'|'XWU'|'XWV'|'XWW'|'XWX'|'XWY'|'XWZ'|'XXA'|'XXB'|'XXC'|'XXD'|'XXF'|'XXG'|'XXH'|'XXJ'|'XXK'|'XYA'|'XYB'|'XYC'|'XYD'|'XYF'|'XYG'|'XYH'|'XYJ'|'XYK'|'XYL'|'XYM'|'XYN'|'XYP'|'XYQ'|'XYR'|'XYS'|'XYT'|'XYV'|'XYW'|'XYX'|'XYY'|'XYZ'|'XZA'|'XZB'|'XZC'|'XZD'|'XZF'|'XZG'|'XZH'|'XZJ'|'XZK'|'XZL'|'XZM'|'XZN'|'XZP'|'XZQ'|'XZR'|'XZS'|'XZT'|'XZU'|'XZV'|'XZW'|'XZX'|'XZY'|'XZZ'|'ZZ'|'NAR'|'C62'|'LTR'|'H87'|UnitOfMeasureCode|null, - * unit_price?: float|string|null, + * unitPrice?: float|string|null, * }>, * note?: string|null, - * payment_details?: list|null, - * payment_term?: string|null, - * previous_unpaid_balance?: float|string|null, - * purchase_order?: string|null, - * remittance_address?: string|null, - * remittance_address_recipient?: string|null, - * service_address?: string|null, - * service_address_recipient?: string|null, - * service_end_date?: string|\DateTimeInterface|null, - * service_start_date?: string|\DateTimeInterface|null, - * shipping_address?: string|null, - * shipping_address_recipient?: string|null, + * paymentTerm?: string|null, + * previousUnpaidBalance?: float|string|null, + * purchaseOrder?: string|null, + * remittanceAddress?: string|null, + * remittanceAddressRecipient?: string|null, + * serviceAddress?: string|null, + * serviceAddressRecipient?: string|null, + * serviceEndDate?: string|\DateTimeInterface|null, + * serviceStartDate?: string|\DateTimeInterface|null, + * shippingAddress?: string|null, + * shippingAddressRecipient?: string|null, * state?: 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState, * subtotal?: float|string|null, - * tax_code?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|DocumentCreateParams\TaxCode, - * tax_details?: list|null, - * total_discount?: float|string|null, - * total_tax?: float|string|null, + * taxCode?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|DocumentCreateParams\TaxCode, + * taxDetails?: list|null, + * totalDiscount?: float|string|null, + * totalTax?: float|string|null, * vatex?: value-of, - * vatex_note?: string|null, - * vendor_address?: string|null, - * vendor_address_recipient?: string|null, - * vendor_company_id?: string|null, - * vendor_email?: string|null, - * vendor_name?: string|null, - * vendor_tax_id?: string|null, + * vatexNote?: string|null, + * vendorAddress?: string|null, + * vendorAddressRecipient?: string|null, + * vendorCompanyID?: string|null, + * vendorEmail?: string|null, + * vendorName?: string|null, + * vendorTaxID?: string|null, * }|DocumentCreateParams $params * * @throws APIException @@ -219,7 +215,7 @@ public function delete( * Create a new invoice or credit note from a PDF file. If the 'ubl_document' field is set in the response, it indicates that sufficient details were extracted from the PDF to automatically generate a valid UBL document ready for sending. If 'ubl_document' is not set, human intervention may be required to ensure compliance. * * @param array{ - * file: string, customer_tax_id?: string|null, vendor_tax_id?: string|null + * file: string, customerTaxID?: string|null, vendorTaxID?: string|null * }|DocumentCreateFromPdfParams $params * * @throws APIException @@ -238,7 +234,12 @@ public function createFromPdf( $response = $this->client->request( method: 'post', path: 'api/documents/pdf', - query: array_diff_key($parsed, $query_params), + query: Util::array_transform_keys( + array_diff_key($parsed, $query_params), + [ + 'customerTaxID' => 'customer_tax_id', 'vendorTaxID' => 'vendor_tax_id', + ], + ), headers: ['Content-Type' => 'multipart/form-data'], body: (object) array_diff_key($parsed, $query_params), options: $options, @@ -255,10 +256,10 @@ public function createFromPdf( * * @param array{ * email?: string|null, - * receiver_peppol_id?: string|null, - * receiver_peppol_scheme?: string|null, - * sender_peppol_id?: string|null, - * sender_peppol_scheme?: string|null, + * receiverPeppolID?: string|null, + * receiverPeppolScheme?: string|null, + * senderPeppolID?: string|null, + * senderPeppolScheme?: string|null, * }|DocumentSendParams $params * * @throws APIException @@ -277,7 +278,15 @@ public function send( $response = $this->client->request( method: 'post', path: ['api/documents/%1$s/send', $documentID], - query: $parsed, + query: Util::array_transform_keys( + $parsed, + [ + 'receiverPeppolID' => 'receiver_peppol_id', + 'receiverPeppolScheme' => 'receiver_peppol_scheme', + 'senderPeppolID' => 'sender_peppol_id', + 'senderPeppolScheme' => 'sender_peppol_scheme', + ], + ), options: $options, convert: DocumentResponse::class, ); diff --git a/src/Services/InboxService.php b/src/Services/InboxService.php index 9b1ad398..fa344dd0 100644 --- a/src/Services/InboxService.php +++ b/src/Services/InboxService.php @@ -7,6 +7,7 @@ use EInvoiceAPI\Client; use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; +use EInvoiceAPI\Core\Util; use EInvoiceAPI\Documents\DocumentResponse; use EInvoiceAPI\Documents\DocumentType; use EInvoiceAPI\DocumentsNumberPage; @@ -30,10 +31,10 @@ public function __construct(private Client $client) {} * Retrieve a paginated list of received documents with filtering options including state, type, sender, date range, and text search. * * @param array{ - * date_from?: string|\DateTimeInterface|null, - * date_to?: string|\DateTimeInterface|null, + * dateFrom?: string|\DateTimeInterface|null, + * dateTo?: string|\DateTimeInterface|null, * page?: int, - * page_size?: int, + * pageSize?: int, * search?: string|null, * sender?: string|null, * state?: 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState|null, @@ -57,7 +58,14 @@ public function list( $response = $this->client->request( method: 'get', path: 'api/inbox/', - query: $parsed, + query: Util::array_transform_keys( + $parsed, + [ + 'dateFrom' => 'date_from', + 'dateTo' => 'date_to', + 'pageSize' => 'page_size', + ], + ), options: $options, convert: DocumentResponse::class, page: DocumentsNumberPage::class, @@ -71,7 +79,7 @@ public function list( * * Retrieve a paginated list of received credit notes with filtering options. * - * @param array{page?: int, page_size?: int}|InboxListCreditNotesParams $params + * @param array{page?: int, pageSize?: int}|InboxListCreditNotesParams $params * * @return DocumentsNumberPage * @@ -90,7 +98,7 @@ public function listCreditNotes( $response = $this->client->request( method: 'get', path: 'api/inbox/credit-notes', - query: $parsed, + query: Util::array_transform_keys($parsed, ['pageSize' => 'page_size']), options: $options, convert: DocumentResponse::class, page: DocumentsNumberPage::class, @@ -104,7 +112,7 @@ public function listCreditNotes( * * Retrieve a paginated list of received invoices with filtering options. * - * @param array{page?: int, page_size?: int}|InboxListInvoicesParams $params + * @param array{page?: int, pageSize?: int}|InboxListInvoicesParams $params * * @return DocumentsNumberPage * @@ -123,7 +131,7 @@ public function listInvoices( $response = $this->client->request( method: 'get', path: 'api/inbox/invoices', - query: $parsed, + query: Util::array_transform_keys($parsed, ['pageSize' => 'page_size']), options: $options, convert: DocumentResponse::class, page: DocumentsNumberPage::class, diff --git a/src/Services/LookupService.php b/src/Services/LookupService.php index 5f1db8cb..dd1bbb32 100644 --- a/src/Services/LookupService.php +++ b/src/Services/LookupService.php @@ -7,6 +7,7 @@ use EInvoiceAPI\Client; use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; +use EInvoiceAPI\Core\Util; use EInvoiceAPI\Lookup\LookupGetParticipantsResponse; use EInvoiceAPI\Lookup\LookupGetResponse; use EInvoiceAPI\Lookup\LookupRetrieveParams; @@ -26,7 +27,7 @@ public function __construct(private Client $client) {} * * Lookup Peppol ID. The peppol_id must be in the form of `:`. The scheme is a 4-digit code representing the identifier scheme, and the id is the actual identifier value. For example, for a Belgian company it is `0208:0123456789` (where 0208 is the scheme for Belgian enterprises, followed by the 10 digits of the official BTW / KBO number). * - * @param array{peppol_id: string}|LookupRetrieveParams $params + * @param array{peppolID: string}|LookupRetrieveParams $params * * @throws APIException */ @@ -43,7 +44,7 @@ public function retrieve( $response = $this->client->request( method: 'get', path: 'api/lookup', - query: $parsed, + query: Util::array_transform_keys($parsed, ['peppolID' => 'peppol_id']), options: $options, convert: LookupGetResponse::class, ); @@ -57,7 +58,7 @@ public function retrieve( * Lookup Peppol participants by name or other identifiers. You can limit the search to a specific country by providing the country code. * * @param array{ - * query: string, country_code?: string|null + * query: string, countryCode?: string|null * }|LookupRetrieveParticipantsParams $params * * @throws APIException @@ -75,7 +76,10 @@ public function retrieveParticipants( $response = $this->client->request( method: 'get', path: 'api/lookup/participants', - query: $parsed, + query: Util::array_transform_keys( + $parsed, + ['countryCode' => 'country_code'] + ), options: $options, convert: LookupGetParticipantsResponse::class, ); diff --git a/src/Services/OutboxService.php b/src/Services/OutboxService.php index 8af9ba24..ccf88053 100644 --- a/src/Services/OutboxService.php +++ b/src/Services/OutboxService.php @@ -7,6 +7,7 @@ use EInvoiceAPI\Client; use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; +use EInvoiceAPI\Core\Util; use EInvoiceAPI\Documents\DocumentResponse; use EInvoiceAPI\Documents\DocumentType; use EInvoiceAPI\DocumentsNumberPage; @@ -28,7 +29,7 @@ public function __construct(private Client $client) {} * * Retrieve a paginated list of draft documents with filtering options. * - * @param array{page?: int, page_size?: int}|OutboxListDraftDocumentsParams $params + * @param array{page?: int, pageSize?: int}|OutboxListDraftDocumentsParams $params * * @return DocumentsNumberPage * @@ -47,7 +48,7 @@ public function listDraftDocuments( $response = $this->client->request( method: 'get', path: 'api/outbox/drafts', - query: $parsed, + query: Util::array_transform_keys($parsed, ['pageSize' => 'page_size']), options: $options, convert: DocumentResponse::class, page: DocumentsNumberPage::class, @@ -62,10 +63,10 @@ public function listDraftDocuments( * Retrieve a paginated list of sent documents with filtering options including state, type, sender, date range, and text search. * * @param array{ - * date_from?: string|\DateTimeInterface|null, - * date_to?: string|\DateTimeInterface|null, + * dateFrom?: string|\DateTimeInterface|null, + * dateTo?: string|\DateTimeInterface|null, * page?: int, - * page_size?: int, + * pageSize?: int, * search?: string|null, * sender?: string|null, * state?: 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState|null, @@ -89,7 +90,14 @@ public function listReceivedDocuments( $response = $this->client->request( method: 'get', path: 'api/outbox/', - query: $parsed, + query: Util::array_transform_keys( + $parsed, + [ + 'dateFrom' => 'date_from', + 'dateTo' => 'date_to', + 'pageSize' => 'page_size', + ], + ), options: $options, convert: DocumentResponse::class, page: DocumentsNumberPage::class, diff --git a/src/Services/ValidateService.php b/src/Services/ValidateService.php index aae7bf99..0071cb0e 100644 --- a/src/Services/ValidateService.php +++ b/src/Services/ValidateService.php @@ -7,6 +7,7 @@ use EInvoiceAPI\Client; use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; +use EInvoiceAPI\Core\Util; use EInvoiceAPI\Documents\CurrencyCode; use EInvoiceAPI\Documents\DocumentAttachmentCreate; use EInvoiceAPI\Documents\DocumentDirection; @@ -40,92 +41,87 @@ public function __construct(private Client $client) {} * @param array{ * allowances?: list|null, - * amount_due?: float|string|null, + * amountDue?: float|string|null, * attachments?: list|null, - * billing_address?: string|null, - * billing_address_recipient?: string|null, + * billingAddress?: string|null, + * billingAddressRecipient?: string|null, * charges?: list|null, * currency?: value-of, - * customer_address?: string|null, - * customer_address_recipient?: string|null, - * customer_company_id?: string|null, - * customer_email?: string|null, - * customer_id?: string|null, - * customer_name?: string|null, - * customer_tax_id?: string|null, + * customerAddress?: string|null, + * customerAddressRecipient?: string|null, + * customerCompanyID?: string|null, + * customerEmail?: string|null, + * customerID?: string|null, + * customerName?: string|null, + * customerTaxID?: string|null, * direction?: 'INBOUND'|'OUTBOUND'|DocumentDirection, - * document_type?: 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType, - * due_date?: string|\DateTimeInterface|null, - * invoice_date?: string|\DateTimeInterface|null, - * invoice_id?: string|null, - * invoice_total?: float|string|null, + * documentType?: 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType, + * dueDate?: string|\DateTimeInterface|null, + * invoiceDate?: string|\DateTimeInterface|null, + * invoiceID?: string|null, + * invoiceTotal?: float|string|null, * items?: list>|null, * amount?: float|string|null, * charges?: list>|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: float|string|null, * tax?: float|string|null, - * tax_rate?: float|string|null, + * taxRate?: float|string|null, * unit?: '10'|'11'|'13'|'14'|'15'|'20'|'21'|'22'|'23'|'24'|'25'|'27'|'28'|'33'|'34'|'35'|'37'|'38'|'40'|'41'|'56'|'57'|'58'|'59'|'60'|'61'|'74'|'77'|'80'|'81'|'85'|'87'|'89'|'91'|'1I'|'EA'|'E01'|'E07'|'E09'|'E10'|'E12'|'E14'|'E17'|'E20'|'E23'|'E25'|'E27'|'E31'|'E34'|'E35'|'E36'|'E37'|'E38'|'E39'|'E40'|'E41'|'E42'|'E43'|'E44'|'E45'|'E46'|'E47'|'E48'|'E49'|'E50'|'E51'|'E52'|'E53'|'E54'|'E55'|'E56'|'E57'|'E58'|'E60'|'E62'|'E65'|'E66'|'E67'|'E69'|'E70'|'E71'|'E73'|'E75'|'E76'|'2A'|'2B'|'2C'|'2G'|'2H'|'2I'|'2J'|'2K'|'2L'|'2M'|'2N'|'2P'|'2Q'|'2R'|'2U'|'2X'|'2Y'|'2Z'|'3B'|'3C'|'4C'|'4G'|'4H'|'4K'|'4L'|'4M'|'4N'|'4O'|'4P'|'4Q'|'4R'|'4T'|'4U'|'4W'|'4X'|'5A'|'5B'|'5E'|'5J'|'A10'|'A11'|'A12'|'A13'|'A14'|'A15'|'A16'|'A17'|'A18'|'A19'|'A2'|'A20'|'A21'|'A22'|'A23'|'A24'|'A26'|'A27'|'A28'|'A29'|'A3'|'A30'|'A31'|'A32'|'A33'|'A34'|'A35'|'A36'|'A37'|'A38'|'A39'|'A4'|'A40'|'A41'|'A42'|'A43'|'A44'|'A45'|'A46'|'A47'|'A48'|'A49'|'A5'|'A50'|'A51'|'A52'|'A53'|'A54'|'A55'|'A56'|'A57'|'A58'|'A59'|'A6'|'A60'|'A61'|'A62'|'A63'|'A64'|'A65'|'A66'|'A67'|'A68'|'A69'|'A7'|'A70'|'A71'|'A72'|'A73'|'A74'|'A75'|'A76'|'A77'|'A78'|'A79'|'A8'|'A80'|'A81'|'A82'|'A83'|'A84'|'A85'|'A86'|'A87'|'A88'|'A89'|'A9'|'A90'|'A91'|'A92'|'A93'|'A94'|'A95'|'A96'|'A97'|'A98'|'A99'|'ACR'|'AH'|'AI'|'AK'|'AMH'|'AMT'|'ANN'|'B1'|'B11'|'B12'|'B13'|'B14'|'B15'|'B16'|'B17'|'B18'|'B19'|'B20'|'B21'|'B22'|'B23'|'B24'|'B25'|'B26'|'B27'|'B28'|'B29'|'B3'|'B30'|'B31'|'B32'|'B33'|'B34'|'B35'|'B36'|'B37'|'B38'|'B39'|'B4'|'B40'|'B41'|'B42'|'B43'|'B44'|'B45'|'B46'|'B47'|'B48'|'B49'|'B5'|'B50'|'B52'|'B53'|'B54'|'B55'|'B56'|'B57'|'B58'|'B59'|'B6'|'B60'|'B61'|'B62'|'B63'|'B64'|'B65'|'B66'|'B67'|'B68'|'B69'|'B7'|'B70'|'B71'|'B72'|'B73'|'B74'|'B75'|'B76'|'B77'|'B78'|'B79'|'B8'|'B80'|'B81'|'B82'|'B83'|'B84'|'B85'|'B86'|'B87'|'B88'|'B89'|'B9'|'B90'|'B91'|'B92'|'B93'|'B94'|'B95'|'B96'|'B97'|'B98'|'B99'|'BAR'|'BB'|'BFT'|'BHP'|'BIL'|'BLD'|'BLL'|'BUA'|'BUI'|'C0'|'C10'|'C11'|'C12'|'C13'|'C14'|'C15'|'C16'|'C17'|'C18'|'C19'|'C20'|'C21'|'C22'|'C23'|'C24'|'C25'|'C26'|'C27'|'C28'|'C29'|'C30'|'C31'|'C32'|'C33'|'C34'|'C35'|'C36'|'C37'|'C38'|'C39'|'C40'|'C41'|'C42'|'C43'|'C44'|'C45'|'C46'|'C47'|'C48'|'C49'|'C50'|'C51'|'C52'|'C53'|'C54'|'C55'|'C56'|'C57'|'C58'|'C59'|'C60'|'C61'|'C63'|'C64'|'C65'|'C66'|'C67'|'C68'|'C69'|'C70'|'C71'|'C72'|'C73'|'C74'|'C75'|'C76'|'C77'|'C78'|'C79'|'C80'|'C81'|'C82'|'C83'|'C84'|'C85'|'C86'|'C87'|'C88'|'C89'|'C90'|'C91'|'C92'|'C93'|'C94'|'C95'|'C96'|'C97'|'C98'|'C99'|'CDL'|'CEL'|'CHU'|'CIU'|'CLT'|'CMK'|'CMQ'|'CMT'|'CNP'|'CNT'|'COU'|'CTG'|'CTN'|'CUR'|'CWA'|'CWI'|'DAN'|'DAY'|'DB'|'DD'|'DG'|'DI'|'DLT'|'DMK'|'DMQ'|'DMT'|'DPC'|'DPT'|'DRA'|'DZN'|'DZP'|'FOT'|'GLL'|'GLI'|'GRM'|'GRO'|'HUR'|'HTZ'|'INH'|'KGM'|'KMT'|'MTR'|'SMI'|'MIN'|'MON'|'ONZ'|'LBR'|'QT'|'SEC'|'FTK'|'INK'|'MTK'|'YDK'|'TNE'|'VLT'|'WTT'|'YRD'|'FTQ'|'INQ'|'MTQ'|'YDQ'|'HAR'|'KLT'|'MLT'|'MMT'|'KMK'|'MMK'|'XAA'|'XAB'|'XAC'|'XAD'|'XAE'|'XAF'|'XAG'|'XAH'|'XAI'|'XAJ'|'XAL'|'XAM'|'XAP'|'XAT'|'XAV'|'XB4'|'XBA'|'XBB'|'XBC'|'XBD'|'XBE'|'XBF'|'XBG'|'XBH'|'XBI'|'XBJ'|'XBK'|'XBL'|'XBM'|'XBN'|'XBO'|'XBP'|'XBQ'|'XBR'|'XBS'|'XBT'|'XBU'|'XBV'|'XBW'|'XBX'|'XBY'|'XBZ'|'XCA'|'XCB'|'XCC'|'XCD'|'XCE'|'XCF'|'XCG'|'XCH'|'XCI'|'XCJ'|'XCK'|'XCL'|'XCM'|'XCN'|'XCO'|'XCP'|'XCQ'|'XCR'|'XCS'|'XCT'|'XCU'|'XCV'|'XCW'|'XCX'|'XCY'|'XCZ'|'XDA'|'XDB'|'XDC'|'XDD'|'XDE'|'XDF'|'XDG'|'XDH'|'XDI'|'XDJ'|'XDK'|'XDL'|'XDM'|'XDN'|'XDP'|'XDQ'|'XDR'|'XDS'|'XDT'|'XDU'|'XDV'|'XDW'|'XDX'|'XDY'|'XDZ'|'XEA'|'XEB'|'XEC'|'XED'|'XEE'|'XEF'|'XEG'|'XEH'|'XEI'|'XEJ'|'XEK'|'XEL'|'XEM'|'XEN'|'XEP'|'XEQ'|'XER'|'XES'|'XET'|'XEU'|'XEV'|'XEW'|'XEX'|'XEY'|'XFB'|'XFC'|'XFD'|'XFE'|'XFF'|'XFG'|'XFH'|'XFI'|'XFJ'|'XFK'|'XFL'|'XFM'|'XFN'|'XFO'|'XFP'|'XFQ'|'XFR'|'XFS'|'XFT'|'XFU'|'XFV'|'XFW'|'XFX'|'XFY'|'XFZ'|'XGA'|'XGB'|'XGC'|'XGD'|'XGE'|'XGF'|'XGG'|'XGH'|'XGI'|'XGJ'|'XGK'|'XGL'|'XGM'|'XGN'|'XGO'|'XGP'|'XGQ'|'XGR'|'XGS'|'XGT'|'XGU'|'XGV'|'XGW'|'XGX'|'XGY'|'XGZ'|'XHA'|'XHB'|'XHC'|'XHD'|'XHE'|'XHF'|'XHG'|'XHH'|'XHI'|'XHJ'|'XHK'|'XHL'|'XHM'|'XHN'|'XHP'|'XHQ'|'XHR'|'XHS'|'XHT'|'XHU'|'XHV'|'XHW'|'XHX'|'XHY'|'XHZ'|'XIA'|'XIB'|'XIC'|'XID'|'XIE'|'XIF'|'XIG'|'XIH'|'XII'|'XIJ'|'XIK'|'XIL'|'XIM'|'XIN'|'XIO'|'XJA'|'XJB'|'XJC'|'XJD'|'XJE'|'XJF'|'XJG'|'XJH'|'XJI'|'XJJ'|'XJK'|'XJL'|'XJM'|'XJN'|'XJO'|'XJP'|'XJQ'|'XJR'|'XJS'|'XJT'|'XJU'|'XJV'|'XJW'|'XJX'|'XJY'|'XJZ'|'XLA'|'XLB'|'XLC'|'XLD'|'XLE'|'XLF'|'XLG'|'XLH'|'XLI'|'XLJ'|'XLK'|'XLL'|'XLM'|'XLN'|'XLO'|'XLP'|'XLQ'|'XLR'|'XLS'|'XLT'|'XLU'|'XLV'|'XLW'|'XLX'|'XLY'|'XLZ'|'XMA'|'XMB'|'XMC'|'XMD'|'XME'|'XMF'|'XMG'|'XMH'|'XMI'|'XMJ'|'XMK'|'XML'|'XMM'|'XMN'|'XMO'|'XMP'|'XMQ'|'XMR'|'XMS'|'XMT'|'XMU'|'XMV'|'XMW'|'XMX'|'XMY'|'XMZ'|'XNA'|'XNB'|'XNC'|'XND'|'XNE'|'XNF'|'XNG'|'XNH'|'XNI'|'XNJ'|'XNK'|'XNL'|'XNM'|'XOA'|'XOB'|'XOC'|'XOD'|'XOE'|'XOF'|'XOG'|'XOH'|'XOI'|'XOJ'|'XOK'|'XOL'|'XOM'|'XON'|'XOO'|'XOP'|'XOQ'|'XOR'|'XOS'|'XOT'|'XOU'|'XOV'|'XOW'|'XOX'|'XOY'|'XOZ'|'XP1'|'XP2'|'XP3'|'XP4'|'XPA'|'XPB'|'XPC'|'XPD'|'XPE'|'XPF'|'XPG'|'XPH'|'XPI'|'XPJ'|'XPK'|'XPL'|'XPM'|'XPN'|'XPO'|'XPP'|'XPQ'|'XPR'|'XPS'|'XPT'|'XPU'|'XPV'|'XPW'|'XPX'|'XPY'|'XPZ'|'XQA'|'XQB'|'XQC'|'XQD'|'XQE'|'XQF'|'XQG'|'XQH'|'XQI'|'XQJ'|'XQK'|'XQL'|'XQM'|'XQN'|'XQO'|'XQP'|'XQQ'|'XQR'|'XQS'|'XRD'|'XRE'|'XRF'|'XRG'|'XRH'|'XRI'|'XRJ'|'XRK'|'XRL'|'XRM'|'XRN'|'XRO'|'XRP'|'XRQ'|'XRR'|'XRS'|'XRT'|'XRU'|'XRV'|'XRW'|'XRX'|'XRY'|'XRZ'|'XSA'|'XSB'|'XSC'|'XSD'|'XSE'|'XSF'|'XSG'|'XSH'|'XSI'|'XSJ'|'XSK'|'XSL'|'XSM'|'XSN'|'XSO'|'XSP'|'XSQ'|'XSR'|'XSS'|'XST'|'XSU'|'XSV'|'XSW'|'XSX'|'XSY'|'XSZ'|'XTA'|'XTB'|'XTC'|'XTD'|'XTE'|'XTF'|'XTG'|'XTI'|'XTJ'|'XTK'|'XTL'|'XTM'|'XTN'|'XTO'|'XTR'|'XTS'|'XTT'|'XTU'|'XTV'|'XTW'|'XTX'|'XTY'|'XTZ'|'XUC'|'XUN'|'XVA'|'XVG'|'XVI'|'XVK'|'XVL'|'XVN'|'XVO'|'XVP'|'XVQ'|'XVR'|'XVS'|'XVY'|'XWA'|'XWB'|'XWC'|'XWD'|'XWF'|'XWG'|'XWH'|'XWJ'|'XWK'|'XWL'|'XWM'|'XWN'|'XWP'|'XWQ'|'XWR'|'XWS'|'XWT'|'XWU'|'XWV'|'XWW'|'XWX'|'XWY'|'XWZ'|'XXA'|'XXB'|'XXC'|'XXD'|'XXF'|'XXG'|'XXH'|'XXJ'|'XXK'|'XYA'|'XYB'|'XYC'|'XYD'|'XYF'|'XYG'|'XYH'|'XYJ'|'XYK'|'XYL'|'XYM'|'XYN'|'XYP'|'XYQ'|'XYR'|'XYS'|'XYT'|'XYV'|'XYW'|'XYX'|'XYY'|'XYZ'|'XZA'|'XZB'|'XZC'|'XZD'|'XZF'|'XZG'|'XZH'|'XZJ'|'XZK'|'XZL'|'XZM'|'XZN'|'XZP'|'XZQ'|'XZR'|'XZS'|'XZT'|'XZU'|'XZV'|'XZW'|'XZX'|'XZY'|'XZZ'|'ZZ'|'NAR'|'C62'|'LTR'|'H87'|UnitOfMeasureCode|null, - * unit_price?: float|string|null, + * unitPrice?: float|string|null, * }>, * note?: string|null, - * payment_details?: list|null, - * payment_term?: string|null, - * previous_unpaid_balance?: float|string|null, - * purchase_order?: string|null, - * remittance_address?: string|null, - * remittance_address_recipient?: string|null, - * service_address?: string|null, - * service_address_recipient?: string|null, - * service_end_date?: string|\DateTimeInterface|null, - * service_start_date?: string|\DateTimeInterface|null, - * shipping_address?: string|null, - * shipping_address_recipient?: string|null, + * paymentTerm?: string|null, + * previousUnpaidBalance?: float|string|null, + * purchaseOrder?: string|null, + * remittanceAddress?: string|null, + * remittanceAddressRecipient?: string|null, + * serviceAddress?: string|null, + * serviceAddressRecipient?: string|null, + * serviceEndDate?: string|\DateTimeInterface|null, + * serviceStartDate?: string|\DateTimeInterface|null, + * shippingAddress?: string|null, + * shippingAddressRecipient?: string|null, * state?: 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState, * subtotal?: float|string|null, - * tax_code?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|ValidateValidateJsonParams\TaxCode, - * tax_details?: list|null, - * total_discount?: float|string|null, - * total_tax?: float|string|null, + * taxCode?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|ValidateValidateJsonParams\TaxCode, + * taxDetails?: list|null, + * totalDiscount?: float|string|null, + * totalTax?: float|string|null, * vatex?: value-of, - * vatex_note?: string|null, - * vendor_address?: string|null, - * vendor_address_recipient?: string|null, - * vendor_company_id?: string|null, - * vendor_email?: string|null, - * vendor_name?: string|null, - * vendor_tax_id?: string|null, + * vatexNote?: string|null, + * vendorAddress?: string|null, + * vendorAddressRecipient?: string|null, + * vendorCompanyID?: string|null, + * vendorEmail?: string|null, + * vendorName?: string|null, + * vendorTaxID?: string|null, * }|ValidateValidateJsonParams $params * * @throws APIException @@ -156,7 +152,7 @@ public function validateJson( * * Validate if a Peppol ID exists in the Peppol network and retrieve supported document types. The peppol_id must be in the form of `:`. The scheme is a 4-digit code representing the identifier scheme, and the id is the actual identifier value. For example, for a Belgian company it is `0208:0123456789` (where 0208 is the scheme for Belgian enterprises, followed by the 10 digits of the official BTW / KBO number). * - * @param array{peppol_id: string}|ValidateValidatePeppolIDParams $params + * @param array{peppolID: string}|ValidateValidatePeppolIDParams $params * * @throws APIException */ @@ -173,7 +169,7 @@ public function validatePeppolID( $response = $this->client->request( method: 'get', path: 'api/validate/peppol-id', - query: $parsed, + query: Util::array_transform_keys($parsed, ['peppolID' => 'peppol_id']), options: $options, convert: ValidateValidatePeppolIDResponse::class, ); diff --git a/src/Validate/UblDocumentValidation.php b/src/Validate/UblDocumentValidation.php index 6c6896b7..77a06f2d 100644 --- a/src/Validate/UblDocumentValidation.php +++ b/src/Validate/UblDocumentValidation.php @@ -14,10 +14,10 @@ /** * @phpstan-type UblDocumentValidationShape = array{ * id: string, - * file_name: string|null, - * is_valid: bool, + * fileName: string|null, + * isValid: bool, * issues: list, - * ubl_document?: string|null, + * ublDocument?: string|null, * } */ final class UblDocumentValidation implements BaseModel @@ -28,25 +28,25 @@ final class UblDocumentValidation implements BaseModel #[Required] public string $id; - #[Required] - public ?string $file_name; + #[Required('file_name')] + public ?string $fileName; - #[Required] - public bool $is_valid; + #[Required('is_valid')] + public bool $isValid; /** @var list $issues */ #[Required(list: Issue::class)] public array $issues; - #[Optional(nullable: true)] - public ?string $ubl_document; + #[Optional('ubl_document', nullable: true)] + public ?string $ublDocument; /** * `new UblDocumentValidation()` is missing required properties by the API. * * To enforce required parameters use * ``` - * UblDocumentValidation::with(id: ..., file_name: ..., is_valid: ..., issues: ...) + * UblDocumentValidation::with(id: ..., fileName: ..., isValid: ..., issues: ...) * ``` * * Otherwise ensure the following setters are called @@ -75,25 +75,25 @@ public function __construct() * type: value-of, * flag?: string|null, * location?: string|null, - * rule_id?: string|null, + * ruleID?: string|null, * test?: string|null, * }> $issues */ public static function with( string $id, - ?string $file_name, - bool $is_valid, + ?string $fileName, + bool $isValid, array $issues, - ?string $ubl_document = null, + ?string $ublDocument = null, ): self { $obj = new self; $obj['id'] = $id; - $obj['file_name'] = $file_name; - $obj['is_valid'] = $is_valid; + $obj['fileName'] = $fileName; + $obj['isValid'] = $isValid; $obj['issues'] = $issues; - null !== $ubl_document && $obj['ubl_document'] = $ubl_document; + null !== $ublDocument && $obj['ublDocument'] = $ublDocument; return $obj; } @@ -109,7 +109,7 @@ public function withID(string $id): self public function withFileName(?string $fileName): self { $obj = clone $this; - $obj['file_name'] = $fileName; + $obj['fileName'] = $fileName; return $obj; } @@ -117,7 +117,7 @@ public function withFileName(?string $fileName): self public function withIsValid(bool $isValid): self { $obj = clone $this; - $obj['is_valid'] = $isValid; + $obj['isValid'] = $isValid; return $obj; } @@ -129,7 +129,7 @@ public function withIsValid(bool $isValid): self * type: value-of, * flag?: string|null, * location?: string|null, - * rule_id?: string|null, + * ruleID?: string|null, * test?: string|null, * }> $issues */ @@ -144,7 +144,7 @@ public function withIssues(array $issues): self public function withUblDocument(?string $ublDocument): self { $obj = clone $this; - $obj['ubl_document'] = $ublDocument; + $obj['ublDocument'] = $ublDocument; return $obj; } diff --git a/src/Validate/UblDocumentValidation/Issue.php b/src/Validate/UblDocumentValidation/Issue.php index d00364c3..3e76a5a3 100644 --- a/src/Validate/UblDocumentValidation/Issue.php +++ b/src/Validate/UblDocumentValidation/Issue.php @@ -17,7 +17,7 @@ * type: value-of, * flag?: string|null, * location?: string|null, - * rule_id?: string|null, + * ruleID?: string|null, * test?: string|null, * } */ @@ -42,8 +42,8 @@ final class Issue implements BaseModel #[Optional(nullable: true)] public ?string $location; - #[Optional(nullable: true)] - public ?string $rule_id; + #[Optional('rule_id', nullable: true)] + public ?string $ruleID; #[Optional(nullable: true)] public ?string $test; @@ -80,7 +80,7 @@ public static function with( Type|string $type, ?string $flag = null, ?string $location = null, - ?string $rule_id = null, + ?string $ruleID = null, ?string $test = null, ): self { $obj = new self; @@ -91,7 +91,7 @@ public static function with( null !== $flag && $obj['flag'] = $flag; null !== $location && $obj['location'] = $location; - null !== $rule_id && $obj['rule_id'] = $rule_id; + null !== $ruleID && $obj['ruleID'] = $ruleID; null !== $test && $obj['test'] = $test; return $obj; @@ -143,7 +143,7 @@ public function withLocation(?string $location): self public function withRuleID(?string $ruleID): self { $obj = clone $this; - $obj['rule_id'] = $ruleID; + $obj['ruleID'] = $ruleID; return $obj; } diff --git a/src/Validate/ValidateValidateJsonParams.php b/src/Validate/ValidateValidateJsonParams.php index 36f3d990..2b307b65 100644 --- a/src/Validate/ValidateValidateJsonParams.php +++ b/src/Validate/ValidateValidateJsonParams.php @@ -31,92 +31,92 @@ * @phpstan-type ValidateValidateJsonParamsShape = array{ * allowances?: list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null, - * amount_due?: float|string|null, + * amountDue?: float|string|null, * attachments?: list|null, - * billing_address?: string|null, - * billing_address_recipient?: string|null, + * billingAddress?: string|null, + * billingAddressRecipient?: string|null, * charges?: list|null, - * tax_code?: value-of<\EInvoiceAPI\Validate\ValidateValidateJsonParams\Charge\TaxCode>|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of<\EInvoiceAPI\Validate\ValidateValidateJsonParams\Charge\ReasonCode>|null, + * taxCode?: value-of<\EInvoiceAPI\Validate\ValidateValidateJsonParams\Charge\TaxCode>|null, + * taxRate?: float|string|null, * }>|null, * currency?: CurrencyCode|value-of, - * customer_address?: string|null, - * customer_address_recipient?: string|null, - * customer_company_id?: string|null, - * customer_email?: string|null, - * customer_id?: string|null, - * customer_name?: string|null, - * customer_tax_id?: string|null, + * customerAddress?: string|null, + * customerAddressRecipient?: string|null, + * customerCompanyID?: string|null, + * customerEmail?: string|null, + * customerID?: string|null, + * customerName?: string|null, + * customerTaxID?: string|null, * direction?: DocumentDirection|value-of, - * document_type?: DocumentType|value-of, - * due_date?: \DateTimeInterface|null, - * invoice_date?: \DateTimeInterface|null, - * invoice_id?: string|null, - * invoice_total?: float|string|null, + * documentType?: DocumentType|value-of, + * dueDate?: \DateTimeInterface|null, + * invoiceDate?: \DateTimeInterface|null, + * invoiceID?: string|null, + * invoiceTotal?: float|string|null, * items?: list|null, * amount?: float|string|null, * charges?: list<\EInvoiceAPI\Validate\ValidateValidateJsonParams\Item\Charge>|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: float|string|null, * tax?: float|string|null, - * tax_rate?: float|string|null, + * taxRate?: float|string|null, * unit?: value-of|null, - * unit_price?: float|string|null, + * unitPrice?: float|string|null, * }>, * note?: string|null, - * payment_details?: list|null, - * payment_term?: string|null, - * previous_unpaid_balance?: float|string|null, - * purchase_order?: string|null, - * remittance_address?: string|null, - * remittance_address_recipient?: string|null, - * service_address?: string|null, - * service_address_recipient?: string|null, - * service_end_date?: \DateTimeInterface|null, - * service_start_date?: \DateTimeInterface|null, - * shipping_address?: string|null, - * shipping_address_recipient?: string|null, + * paymentTerm?: string|null, + * previousUnpaidBalance?: float|string|null, + * purchaseOrder?: string|null, + * remittanceAddress?: string|null, + * remittanceAddressRecipient?: string|null, + * serviceAddress?: string|null, + * serviceAddressRecipient?: string|null, + * serviceEndDate?: \DateTimeInterface|null, + * serviceStartDate?: \DateTimeInterface|null, + * shippingAddress?: string|null, + * shippingAddressRecipient?: string|null, * state?: DocumentState|value-of, * subtotal?: float|string|null, - * tax_code?: \EInvoiceAPI\Validate\ValidateValidateJsonParams\TaxCode|value-of<\EInvoiceAPI\Validate\ValidateValidateJsonParams\TaxCode>, - * tax_details?: list, + * taxDetails?: list|null, - * total_discount?: float|string|null, - * total_tax?: float|string|null, + * totalDiscount?: float|string|null, + * totalTax?: float|string|null, * vatex?: null|Vatex|value-of, - * vatex_note?: string|null, - * vendor_address?: string|null, - * vendor_address_recipient?: string|null, - * vendor_company_id?: string|null, - * vendor_email?: string|null, - * vendor_name?: string|null, - * vendor_tax_id?: string|null, + * vatexNote?: string|null, + * vendorAddress?: string|null, + * vendorAddressRecipient?: string|null, + * vendorCompanyID?: string|null, + * vendorEmail?: string|null, + * vendorName?: string|null, + * vendorTaxID?: string|null, * } */ final class ValidateValidateJsonParams implements BaseModel @@ -132,8 +132,8 @@ final class ValidateValidateJsonParams implements BaseModel /** * The amount due for payment. Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $amount_due; + #[Optional('amount_due', nullable: true)] + public float|string|null $amountDue; /** @var list|null $attachments */ #[Optional(list: DocumentAttachmentCreate::class, nullable: true)] @@ -142,14 +142,14 @@ final class ValidateValidateJsonParams implements BaseModel /** * The billing address (if different from customer address). */ - #[Optional(nullable: true)] - public ?string $billing_address; + #[Optional('billing_address', nullable: true)] + public ?string $billingAddress; /** * The recipient name at the billing address. */ - #[Optional(nullable: true)] - public ?string $billing_address_recipient; + #[Optional('billing_address_recipient', nullable: true)] + public ?string $billingAddressRecipient; /** @var list|null $charges */ #[Optional(list: Charge::class, nullable: true)] @@ -166,44 +166,44 @@ final class ValidateValidateJsonParams implements BaseModel /** * The address of the customer/buyer. */ - #[Optional(nullable: true)] - public ?string $customer_address; + #[Optional('customer_address', nullable: true)] + public ?string $customerAddress; /** * The recipient name at the customer address. */ - #[Optional(nullable: true)] - public ?string $customer_address_recipient; + #[Optional('customer_address_recipient', nullable: true)] + public ?string $customerAddressRecipient; /** * Customer company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Optional(nullable: true)] - public ?string $customer_company_id; + #[Optional('customer_company_id', nullable: true)] + public ?string $customerCompanyID; /** * The email address of the customer. */ - #[Optional(nullable: true)] - public ?string $customer_email; + #[Optional('customer_email', nullable: true)] + public ?string $customerEmail; /** * The unique identifier for the customer in your system. */ - #[Optional(nullable: true)] - public ?string $customer_id; + #[Optional('customer_id', nullable: true)] + public ?string $customerID; /** * The company name of the customer/buyer. */ - #[Optional(nullable: true)] - public ?string $customer_name; + #[Optional('customer_name', nullable: true)] + public ?string $customerName; /** * Customer tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Optional(nullable: true)] - public ?string $customer_tax_id; + #[Optional('customer_tax_id', nullable: true)] + public ?string $customerTaxID; /** * The direction of the document: INBOUND (purchases) or OUTBOUND (sales). @@ -216,34 +216,34 @@ final class ValidateValidateJsonParams implements BaseModel /** * The type of document: INVOICE, CREDIT_NOTE, or DEBIT_NOTE. * - * @var value-of|null $document_type + * @var value-of|null $documentType */ - #[Optional(enum: DocumentType::class)] - public ?string $document_type; + #[Optional('document_type', enum: DocumentType::class)] + public ?string $documentType; /** * The date when payment is due. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $due_date; + #[Optional('due_date', nullable: true)] + public ?\DateTimeInterface $dueDate; /** * The date when the invoice was issued. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $invoice_date; + #[Optional('invoice_date', nullable: true)] + public ?\DateTimeInterface $invoiceDate; /** * The unique invoice identifier/number. */ - #[Optional(nullable: true)] - public ?string $invoice_id; + #[Optional('invoice_id', nullable: true)] + public ?string $invoiceID; /** * The total amount of the invoice including tax (invoice_total = subtotal + total_tax + total_discount). Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $invoice_total; + #[Optional('invoice_total', nullable: true)] + public float|string|null $invoiceTotal; /** * At least one line item is required. @@ -259,75 +259,79 @@ final class ValidateValidateJsonParams implements BaseModel #[Optional(nullable: true)] public ?string $note; - /** @var list|null $payment_details */ - #[Optional(list: PaymentDetailCreate::class, nullable: true)] - public ?array $payment_details; + /** @var list|null $paymentDetails */ + #[Optional( + 'payment_details', + list: PaymentDetailCreate::class, + nullable: true + )] + public ?array $paymentDetails; /** * The payment terms (e.g., 'Net 30', 'Due on receipt', '2/10 Net 30'). */ - #[Optional(nullable: true)] - public ?string $payment_term; + #[Optional('payment_term', nullable: true)] + public ?string $paymentTerm; /** * The previous unpaid balance from prior invoices, if any. Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $previous_unpaid_balance; + #[Optional('previous_unpaid_balance', nullable: true)] + public float|string|null $previousUnpaidBalance; /** * The purchase order reference number. */ - #[Optional(nullable: true)] - public ?string $purchase_order; + #[Optional('purchase_order', nullable: true)] + public ?string $purchaseOrder; /** * The address where payment should be sent or remitted to. */ - #[Optional(nullable: true)] - public ?string $remittance_address; + #[Optional('remittance_address', nullable: true)] + public ?string $remittanceAddress; /** * The recipient name at the remittance address. */ - #[Optional(nullable: true)] - public ?string $remittance_address_recipient; + #[Optional('remittance_address_recipient', nullable: true)] + public ?string $remittanceAddressRecipient; /** * The address where services were performed or goods were delivered. */ - #[Optional(nullable: true)] - public ?string $service_address; + #[Optional('service_address', nullable: true)] + public ?string $serviceAddress; /** * The recipient name at the service address. */ - #[Optional(nullable: true)] - public ?string $service_address_recipient; + #[Optional('service_address_recipient', nullable: true)] + public ?string $serviceAddressRecipient; /** * The end date of the service period or delivery period. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $service_end_date; + #[Optional('service_end_date', nullable: true)] + public ?\DateTimeInterface $serviceEndDate; /** * The start date of the service period or delivery period. */ - #[Optional(nullable: true)] - public ?\DateTimeInterface $service_start_date; + #[Optional('service_start_date', nullable: true)] + public ?\DateTimeInterface $serviceStartDate; /** * The shipping/delivery address. */ - #[Optional(nullable: true)] - public ?string $shipping_address; + #[Optional('shipping_address', nullable: true)] + public ?string $shippingAddress; /** * The recipient name at the shipping address. */ - #[Optional(nullable: true)] - public ?string $shipping_address_recipient; + #[Optional('shipping_address_recipient', nullable: true)] + public ?string $shippingAddressRecipient; /** * The current state of the document: DRAFT, TRANSIT, FAILED, SENT, or RECEIVED. @@ -346,28 +350,29 @@ final class ValidateValidateJsonParams implements BaseModel /** * Tax category code of the invoice (e.g., S for standard rate, Z for zero rate, E for exempt). * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ #[Optional( - enum: ValidateValidateJsonParams\TaxCode::class + 'tax_code', + enum: ValidateValidateJsonParams\TaxCode::class, )] - public ?string $tax_code; + public ?string $taxCode; - /** @var list|null $tax_details */ - #[Optional(list: TaxDetail::class, nullable: true)] - public ?array $tax_details; + /** @var list|null $taxDetails */ + #[Optional('tax_details', list: TaxDetail::class, nullable: true)] + public ?array $taxDetails; /** * The net financial discount/charge of the invoice (non-VAT charges minus non-VAT allowances). Can be positive (net charge), negative (net discount), or zero. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $total_discount; + #[Optional('total_discount', nullable: true)] + public float|string|null $totalDiscount; /** * The total tax amount of the invoice. Must be positive and rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $total_tax; + #[Optional('total_tax', nullable: true)] + public float|string|null $totalTax; /** * VATEX code list for VAT exemption reasons. @@ -383,44 +388,44 @@ enum: ValidateValidateJsonParams\TaxCode::class /** * Textual explanation for VAT exemption. */ - #[Optional(nullable: true)] - public ?string $vatex_note; + #[Optional('vatex_note', nullable: true)] + public ?string $vatexNote; /** * The address of the vendor/seller. */ - #[Optional(nullable: true)] - public ?string $vendor_address; + #[Optional('vendor_address', nullable: true)] + public ?string $vendorAddress; /** * The recipient name at the vendor address. */ - #[Optional(nullable: true)] - public ?string $vendor_address_recipient; + #[Optional('vendor_address_recipient', nullable: true)] + public ?string $vendorAddressRecipient; /** * Vendor company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. */ - #[Optional(nullable: true)] - public ?string $vendor_company_id; + #[Optional('vendor_company_id', nullable: true)] + public ?string $vendorCompanyID; /** * The email address of the vendor. */ - #[Optional(nullable: true)] - public ?string $vendor_email; + #[Optional('vendor_email', nullable: true)] + public ?string $vendorEmail; /** * The name of the vendor/seller/supplier. */ - #[Optional(nullable: true)] - public ?string $vendor_name; + #[Optional('vendor_name', nullable: true)] + public ?string $vendorName; /** * Vendor tax ID. For Belgium this is the VAT number. Must include the country prefix. */ - #[Optional(nullable: true)] - public ?string $vendor_tax_id; + #[Optional('vendor_tax_id', nullable: true)] + public ?string $vendorTaxID; public function __construct() { @@ -434,157 +439,157 @@ public function __construct() * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $allowances * @param list|null $attachments * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $charges * @param CurrencyCode|value-of $currency * @param DocumentDirection|value-of $direction - * @param DocumentType|value-of $document_type + * @param DocumentType|value-of $documentType * @param list|null, * amount?: float|string|null, * charges?: list|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: float|string|null, * tax?: float|string|null, - * tax_rate?: float|string|null, + * taxRate?: float|string|null, * unit?: value-of|null, - * unit_price?: float|string|null, + * unitPrice?: float|string|null, * }> $items * @param list|null $payment_details + * }>|null $paymentDetails * @param DocumentState|value-of $state - * @param ValidateValidateJsonParams\TaxCode|value-of $tax_code + * @param ValidateValidateJsonParams\TaxCode|value-of $taxCode * @param list|null $tax_details + * }>|null $taxDetails * @param Vatex|value-of|null $vatex */ public static function with( ?array $allowances = null, - float|string|null $amount_due = null, + float|string|null $amountDue = null, ?array $attachments = null, - ?string $billing_address = null, - ?string $billing_address_recipient = null, + ?string $billingAddress = null, + ?string $billingAddressRecipient = null, ?array $charges = null, CurrencyCode|string|null $currency = null, - ?string $customer_address = null, - ?string $customer_address_recipient = null, - ?string $customer_company_id = null, - ?string $customer_email = null, - ?string $customer_id = null, - ?string $customer_name = null, - ?string $customer_tax_id = null, + ?string $customerAddress = null, + ?string $customerAddressRecipient = null, + ?string $customerCompanyID = null, + ?string $customerEmail = null, + ?string $customerID = null, + ?string $customerName = null, + ?string $customerTaxID = null, DocumentDirection|string|null $direction = null, - DocumentType|string|null $document_type = null, - ?\DateTimeInterface $due_date = null, - ?\DateTimeInterface $invoice_date = null, - ?string $invoice_id = null, - float|string|null $invoice_total = null, + DocumentType|string|null $documentType = null, + ?\DateTimeInterface $dueDate = null, + ?\DateTimeInterface $invoiceDate = null, + ?string $invoiceID = null, + float|string|null $invoiceTotal = null, ?array $items = null, ?string $note = null, - ?array $payment_details = null, - ?string $payment_term = null, - float|string|null $previous_unpaid_balance = null, - ?string $purchase_order = null, - ?string $remittance_address = null, - ?string $remittance_address_recipient = null, - ?string $service_address = null, - ?string $service_address_recipient = null, - ?\DateTimeInterface $service_end_date = null, - ?\DateTimeInterface $service_start_date = null, - ?string $shipping_address = null, - ?string $shipping_address_recipient = null, + ?array $paymentDetails = null, + ?string $paymentTerm = null, + float|string|null $previousUnpaidBalance = null, + ?string $purchaseOrder = null, + ?string $remittanceAddress = null, + ?string $remittanceAddressRecipient = null, + ?string $serviceAddress = null, + ?string $serviceAddressRecipient = null, + ?\DateTimeInterface $serviceEndDate = null, + ?\DateTimeInterface $serviceStartDate = null, + ?string $shippingAddress = null, + ?string $shippingAddressRecipient = null, DocumentState|string|null $state = null, float|string|null $subtotal = null, - ValidateValidateJsonParams\TaxCode|string|null $tax_code = null, - ?array $tax_details = null, - float|string|null $total_discount = null, - float|string|null $total_tax = null, + ValidateValidateJsonParams\TaxCode|string|null $taxCode = null, + ?array $taxDetails = null, + float|string|null $totalDiscount = null, + float|string|null $totalTax = null, Vatex|string|null $vatex = null, - ?string $vatex_note = null, - ?string $vendor_address = null, - ?string $vendor_address_recipient = null, - ?string $vendor_company_id = null, - ?string $vendor_email = null, - ?string $vendor_name = null, - ?string $vendor_tax_id = null, + ?string $vatexNote = null, + ?string $vendorAddress = null, + ?string $vendorAddressRecipient = null, + ?string $vendorCompanyID = null, + ?string $vendorEmail = null, + ?string $vendorName = null, + ?string $vendorTaxID = null, ): self { $obj = new self; null !== $allowances && $obj['allowances'] = $allowances; - null !== $amount_due && $obj['amount_due'] = $amount_due; + null !== $amountDue && $obj['amountDue'] = $amountDue; null !== $attachments && $obj['attachments'] = $attachments; - null !== $billing_address && $obj['billing_address'] = $billing_address; - null !== $billing_address_recipient && $obj['billing_address_recipient'] = $billing_address_recipient; + null !== $billingAddress && $obj['billingAddress'] = $billingAddress; + null !== $billingAddressRecipient && $obj['billingAddressRecipient'] = $billingAddressRecipient; null !== $charges && $obj['charges'] = $charges; null !== $currency && $obj['currency'] = $currency; - null !== $customer_address && $obj['customer_address'] = $customer_address; - null !== $customer_address_recipient && $obj['customer_address_recipient'] = $customer_address_recipient; - null !== $customer_company_id && $obj['customer_company_id'] = $customer_company_id; - null !== $customer_email && $obj['customer_email'] = $customer_email; - null !== $customer_id && $obj['customer_id'] = $customer_id; - null !== $customer_name && $obj['customer_name'] = $customer_name; - null !== $customer_tax_id && $obj['customer_tax_id'] = $customer_tax_id; + null !== $customerAddress && $obj['customerAddress'] = $customerAddress; + null !== $customerAddressRecipient && $obj['customerAddressRecipient'] = $customerAddressRecipient; + null !== $customerCompanyID && $obj['customerCompanyID'] = $customerCompanyID; + null !== $customerEmail && $obj['customerEmail'] = $customerEmail; + null !== $customerID && $obj['customerID'] = $customerID; + null !== $customerName && $obj['customerName'] = $customerName; + null !== $customerTaxID && $obj['customerTaxID'] = $customerTaxID; null !== $direction && $obj['direction'] = $direction; - null !== $document_type && $obj['document_type'] = $document_type; - null !== $due_date && $obj['due_date'] = $due_date; - null !== $invoice_date && $obj['invoice_date'] = $invoice_date; - null !== $invoice_id && $obj['invoice_id'] = $invoice_id; - null !== $invoice_total && $obj['invoice_total'] = $invoice_total; + null !== $documentType && $obj['documentType'] = $documentType; + null !== $dueDate && $obj['dueDate'] = $dueDate; + null !== $invoiceDate && $obj['invoiceDate'] = $invoiceDate; + null !== $invoiceID && $obj['invoiceID'] = $invoiceID; + null !== $invoiceTotal && $obj['invoiceTotal'] = $invoiceTotal; null !== $items && $obj['items'] = $items; null !== $note && $obj['note'] = $note; - null !== $payment_details && $obj['payment_details'] = $payment_details; - null !== $payment_term && $obj['payment_term'] = $payment_term; - null !== $previous_unpaid_balance && $obj['previous_unpaid_balance'] = $previous_unpaid_balance; - null !== $purchase_order && $obj['purchase_order'] = $purchase_order; - null !== $remittance_address && $obj['remittance_address'] = $remittance_address; - null !== $remittance_address_recipient && $obj['remittance_address_recipient'] = $remittance_address_recipient; - null !== $service_address && $obj['service_address'] = $service_address; - null !== $service_address_recipient && $obj['service_address_recipient'] = $service_address_recipient; - null !== $service_end_date && $obj['service_end_date'] = $service_end_date; - null !== $service_start_date && $obj['service_start_date'] = $service_start_date; - null !== $shipping_address && $obj['shipping_address'] = $shipping_address; - null !== $shipping_address_recipient && $obj['shipping_address_recipient'] = $shipping_address_recipient; + null !== $paymentDetails && $obj['paymentDetails'] = $paymentDetails; + null !== $paymentTerm && $obj['paymentTerm'] = $paymentTerm; + null !== $previousUnpaidBalance && $obj['previousUnpaidBalance'] = $previousUnpaidBalance; + null !== $purchaseOrder && $obj['purchaseOrder'] = $purchaseOrder; + null !== $remittanceAddress && $obj['remittanceAddress'] = $remittanceAddress; + null !== $remittanceAddressRecipient && $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; + null !== $serviceAddress && $obj['serviceAddress'] = $serviceAddress; + null !== $serviceAddressRecipient && $obj['serviceAddressRecipient'] = $serviceAddressRecipient; + null !== $serviceEndDate && $obj['serviceEndDate'] = $serviceEndDate; + null !== $serviceStartDate && $obj['serviceStartDate'] = $serviceStartDate; + null !== $shippingAddress && $obj['shippingAddress'] = $shippingAddress; + null !== $shippingAddressRecipient && $obj['shippingAddressRecipient'] = $shippingAddressRecipient; null !== $state && $obj['state'] = $state; null !== $subtotal && $obj['subtotal'] = $subtotal; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_details && $obj['tax_details'] = $tax_details; - null !== $total_discount && $obj['total_discount'] = $total_discount; - null !== $total_tax && $obj['total_tax'] = $total_tax; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxDetails && $obj['taxDetails'] = $taxDetails; + null !== $totalDiscount && $obj['totalDiscount'] = $totalDiscount; + null !== $totalTax && $obj['totalTax'] = $totalTax; null !== $vatex && $obj['vatex'] = $vatex; - null !== $vatex_note && $obj['vatex_note'] = $vatex_note; - null !== $vendor_address && $obj['vendor_address'] = $vendor_address; - null !== $vendor_address_recipient && $obj['vendor_address_recipient'] = $vendor_address_recipient; - null !== $vendor_company_id && $obj['vendor_company_id'] = $vendor_company_id; - null !== $vendor_email && $obj['vendor_email'] = $vendor_email; - null !== $vendor_name && $obj['vendor_name'] = $vendor_name; - null !== $vendor_tax_id && $obj['vendor_tax_id'] = $vendor_tax_id; + null !== $vatexNote && $obj['vatexNote'] = $vatexNote; + null !== $vendorAddress && $obj['vendorAddress'] = $vendorAddress; + null !== $vendorAddressRecipient && $obj['vendorAddressRecipient'] = $vendorAddressRecipient; + null !== $vendorCompanyID && $obj['vendorCompanyID'] = $vendorCompanyID; + null !== $vendorEmail && $obj['vendorEmail'] = $vendorEmail; + null !== $vendorName && $obj['vendorName'] = $vendorName; + null !== $vendorTaxID && $obj['vendorTaxID'] = $vendorTaxID; return $obj; } @@ -592,12 +597,12 @@ public static function with( /** * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $allowances */ public function withAllowances(?array $allowances): self @@ -614,17 +619,17 @@ public function withAllowances(?array $allowances): self public function withAmountDue(float|string|null $amountDue): self { $obj = clone $this; - $obj['amount_due'] = $amountDue; + $obj['amountDue'] = $amountDue; return $obj; } /** * @param list|null $attachments */ public function withAttachments(?array $attachments): self @@ -641,7 +646,7 @@ public function withAttachments(?array $attachments): self public function withBillingAddress(?string $billingAddress): self { $obj = clone $this; - $obj['billing_address'] = $billingAddress; + $obj['billingAddress'] = $billingAddress; return $obj; } @@ -653,7 +658,7 @@ public function withBillingAddressRecipient( ?string $billingAddressRecipient ): self { $obj = clone $this; - $obj['billing_address_recipient'] = $billingAddressRecipient; + $obj['billingAddressRecipient'] = $billingAddressRecipient; return $obj; } @@ -661,12 +666,12 @@ public function withBillingAddressRecipient( /** * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $charges */ public function withCharges(?array $charges): self @@ -696,7 +701,7 @@ public function withCurrency(CurrencyCode|string $currency): self public function withCustomerAddress(?string $customerAddress): self { $obj = clone $this; - $obj['customer_address'] = $customerAddress; + $obj['customerAddress'] = $customerAddress; return $obj; } @@ -708,7 +713,7 @@ public function withCustomerAddressRecipient( ?string $customerAddressRecipient ): self { $obj = clone $this; - $obj['customer_address_recipient'] = $customerAddressRecipient; + $obj['customerAddressRecipient'] = $customerAddressRecipient; return $obj; } @@ -719,7 +724,7 @@ public function withCustomerAddressRecipient( public function withCustomerCompanyID(?string $customerCompanyID): self { $obj = clone $this; - $obj['customer_company_id'] = $customerCompanyID; + $obj['customerCompanyID'] = $customerCompanyID; return $obj; } @@ -730,7 +735,7 @@ public function withCustomerCompanyID(?string $customerCompanyID): self public function withCustomerEmail(?string $customerEmail): self { $obj = clone $this; - $obj['customer_email'] = $customerEmail; + $obj['customerEmail'] = $customerEmail; return $obj; } @@ -741,7 +746,7 @@ public function withCustomerEmail(?string $customerEmail): self public function withCustomerID(?string $customerID): self { $obj = clone $this; - $obj['customer_id'] = $customerID; + $obj['customerID'] = $customerID; return $obj; } @@ -752,7 +757,7 @@ public function withCustomerID(?string $customerID): self public function withCustomerName(?string $customerName): self { $obj = clone $this; - $obj['customer_name'] = $customerName; + $obj['customerName'] = $customerName; return $obj; } @@ -763,7 +768,7 @@ public function withCustomerName(?string $customerName): self public function withCustomerTaxID(?string $customerTaxID): self { $obj = clone $this; - $obj['customer_tax_id'] = $customerTaxID; + $obj['customerTaxID'] = $customerTaxID; return $obj; } @@ -789,7 +794,7 @@ public function withDirection(DocumentDirection|string $direction): self public function withDocumentType(DocumentType|string $documentType): self { $obj = clone $this; - $obj['document_type'] = $documentType; + $obj['documentType'] = $documentType; return $obj; } @@ -800,7 +805,7 @@ public function withDocumentType(DocumentType|string $documentType): self public function withDueDate(?\DateTimeInterface $dueDate): self { $obj = clone $this; - $obj['due_date'] = $dueDate; + $obj['dueDate'] = $dueDate; return $obj; } @@ -811,7 +816,7 @@ public function withDueDate(?\DateTimeInterface $dueDate): self public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self { $obj = clone $this; - $obj['invoice_date'] = $invoiceDate; + $obj['invoiceDate'] = $invoiceDate; return $obj; } @@ -822,7 +827,7 @@ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self public function withInvoiceID(?string $invoiceID): self { $obj = clone $this; - $obj['invoice_id'] = $invoiceID; + $obj['invoiceID'] = $invoiceID; return $obj; } @@ -833,7 +838,7 @@ public function withInvoiceID(?string $invoiceID): self public function withInvoiceTotal(float|string|null $invoiceTotal): self { $obj = clone $this; - $obj['invoice_total'] = $invoiceTotal; + $obj['invoiceTotal'] = $invoiceTotal; return $obj; } @@ -847,12 +852,12 @@ public function withInvoiceTotal(float|string|null $invoiceTotal): self * charges?: list|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: float|string|null, * tax?: float|string|null, - * tax_rate?: float|string|null, + * taxRate?: float|string|null, * unit?: value-of|null, - * unit_price?: float|string|null, + * unitPrice?: float|string|null, * }> $items */ public function withItems(array $items): self @@ -876,16 +881,16 @@ public function withNote(?string $note): self /** * @param list|null $paymentDetails */ public function withPaymentDetails(?array $paymentDetails): self { $obj = clone $this; - $obj['payment_details'] = $paymentDetails; + $obj['paymentDetails'] = $paymentDetails; return $obj; } @@ -896,7 +901,7 @@ public function withPaymentDetails(?array $paymentDetails): self public function withPaymentTerm(?string $paymentTerm): self { $obj = clone $this; - $obj['payment_term'] = $paymentTerm; + $obj['paymentTerm'] = $paymentTerm; return $obj; } @@ -908,7 +913,7 @@ public function withPreviousUnpaidBalance( float|string|null $previousUnpaidBalance ): self { $obj = clone $this; - $obj['previous_unpaid_balance'] = $previousUnpaidBalance; + $obj['previousUnpaidBalance'] = $previousUnpaidBalance; return $obj; } @@ -919,7 +924,7 @@ public function withPreviousUnpaidBalance( public function withPurchaseOrder(?string $purchaseOrder): self { $obj = clone $this; - $obj['purchase_order'] = $purchaseOrder; + $obj['purchaseOrder'] = $purchaseOrder; return $obj; } @@ -930,7 +935,7 @@ public function withPurchaseOrder(?string $purchaseOrder): self public function withRemittanceAddress(?string $remittanceAddress): self { $obj = clone $this; - $obj['remittance_address'] = $remittanceAddress; + $obj['remittanceAddress'] = $remittanceAddress; return $obj; } @@ -942,7 +947,7 @@ public function withRemittanceAddressRecipient( ?string $remittanceAddressRecipient ): self { $obj = clone $this; - $obj['remittance_address_recipient'] = $remittanceAddressRecipient; + $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; return $obj; } @@ -953,7 +958,7 @@ public function withRemittanceAddressRecipient( public function withServiceAddress(?string $serviceAddress): self { $obj = clone $this; - $obj['service_address'] = $serviceAddress; + $obj['serviceAddress'] = $serviceAddress; return $obj; } @@ -965,7 +970,7 @@ public function withServiceAddressRecipient( ?string $serviceAddressRecipient ): self { $obj = clone $this; - $obj['service_address_recipient'] = $serviceAddressRecipient; + $obj['serviceAddressRecipient'] = $serviceAddressRecipient; return $obj; } @@ -977,7 +982,7 @@ public function withServiceEndDate( ?\DateTimeInterface $serviceEndDate ): self { $obj = clone $this; - $obj['service_end_date'] = $serviceEndDate; + $obj['serviceEndDate'] = $serviceEndDate; return $obj; } @@ -989,7 +994,7 @@ public function withServiceStartDate( ?\DateTimeInterface $serviceStartDate ): self { $obj = clone $this; - $obj['service_start_date'] = $serviceStartDate; + $obj['serviceStartDate'] = $serviceStartDate; return $obj; } @@ -1000,7 +1005,7 @@ public function withServiceStartDate( public function withShippingAddress(?string $shippingAddress): self { $obj = clone $this; - $obj['shipping_address'] = $shippingAddress; + $obj['shippingAddress'] = $shippingAddress; return $obj; } @@ -1012,7 +1017,7 @@ public function withShippingAddressRecipient( ?string $shippingAddressRecipient ): self { $obj = clone $this; - $obj['shipping_address_recipient'] = $shippingAddressRecipient; + $obj['shippingAddressRecipient'] = $shippingAddressRecipient; return $obj; } @@ -1050,7 +1055,7 @@ public function withTaxCode( ValidateValidateJsonParams\TaxCode|string $taxCode ): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -1063,7 +1068,7 @@ public function withTaxCode( public function withTaxDetails(?array $taxDetails): self { $obj = clone $this; - $obj['tax_details'] = $taxDetails; + $obj['taxDetails'] = $taxDetails; return $obj; } @@ -1074,7 +1079,7 @@ public function withTaxDetails(?array $taxDetails): self public function withTotalDiscount(float|string|null $totalDiscount): self { $obj = clone $this; - $obj['total_discount'] = $totalDiscount; + $obj['totalDiscount'] = $totalDiscount; return $obj; } @@ -1085,7 +1090,7 @@ public function withTotalDiscount(float|string|null $totalDiscount): self public function withTotalTax(float|string|null $totalTax): self { $obj = clone $this; - $obj['total_tax'] = $totalTax; + $obj['totalTax'] = $totalTax; return $obj; } @@ -1112,7 +1117,7 @@ public function withVatex(Vatex|string|null $vatex): self public function withVatexNote(?string $vatexNote): self { $obj = clone $this; - $obj['vatex_note'] = $vatexNote; + $obj['vatexNote'] = $vatexNote; return $obj; } @@ -1123,7 +1128,7 @@ public function withVatexNote(?string $vatexNote): self public function withVendorAddress(?string $vendorAddress): self { $obj = clone $this; - $obj['vendor_address'] = $vendorAddress; + $obj['vendorAddress'] = $vendorAddress; return $obj; } @@ -1135,7 +1140,7 @@ public function withVendorAddressRecipient( ?string $vendorAddressRecipient ): self { $obj = clone $this; - $obj['vendor_address_recipient'] = $vendorAddressRecipient; + $obj['vendorAddressRecipient'] = $vendorAddressRecipient; return $obj; } @@ -1146,7 +1151,7 @@ public function withVendorAddressRecipient( public function withVendorCompanyID(?string $vendorCompanyID): self { $obj = clone $this; - $obj['vendor_company_id'] = $vendorCompanyID; + $obj['vendorCompanyID'] = $vendorCompanyID; return $obj; } @@ -1157,7 +1162,7 @@ public function withVendorCompanyID(?string $vendorCompanyID): self public function withVendorEmail(?string $vendorEmail): self { $obj = clone $this; - $obj['vendor_email'] = $vendorEmail; + $obj['vendorEmail'] = $vendorEmail; return $obj; } @@ -1168,7 +1173,7 @@ public function withVendorEmail(?string $vendorEmail): self public function withVendorName(?string $vendorName): self { $obj = clone $this; - $obj['vendor_name'] = $vendorName; + $obj['vendorName'] = $vendorName; return $obj; } @@ -1179,7 +1184,7 @@ public function withVendorName(?string $vendorName): self public function withVendorTaxID(?string $vendorTaxID): self { $obj = clone $this; - $obj['vendor_tax_id'] = $vendorTaxID; + $obj['vendorTaxID'] = $vendorTaxID; return $obj; } diff --git a/src/Validate/ValidateValidateJsonParams/Allowance.php b/src/Validate/ValidateValidateJsonParams/Allowance.php index 751bd782..5974381b 100644 --- a/src/Validate/ValidateValidateJsonParams/Allowance.php +++ b/src/Validate/ValidateValidateJsonParams/Allowance.php @@ -15,12 +15,12 @@ * * @phpstan-type AllowanceShape = array{ * amount?: float|string|null, - * base_amount?: float|string|null, - * multiplier_factor?: float|string|null, + * baseAmount?: float|string|null, + * multiplierFactor?: float|string|null, * reason?: string|null, - * reason_code?: value-of|null, - * tax_code?: value-of<\EInvoiceAPI\Validate\ValidateValidateJsonParams\Allowance\TaxCode>|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of<\EInvoiceAPI\Validate\ValidateValidateJsonParams\Allowance\TaxCode>|null, + * taxRate?: float|string|null, * } */ final class Allowance implements BaseModel @@ -37,14 +37,14 @@ final class Allowance implements BaseModel /** * The base amount that may be used, in conjunction with the allowance percentage, to calculate the allowance amount. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $base_amount; + #[Optional('base_amount', nullable: true)] + public float|string|null $baseAmount; /** * The percentage that may be used, in conjunction with the allowance base amount, to calculate the allowance amount. To state 20%, use value 20. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $multiplier_factor; + #[Optional('multiplier_factor', nullable: true)] + public float|string|null $multiplierFactor; /** * The reason for the allowance. @@ -55,26 +55,27 @@ final class Allowance implements BaseModel /** * Allowance reason codes for invoice discounts and charges. * - * @var value-of|null $reason_code + * @var value-of|null $reasonCode */ - #[Optional(enum: ReasonCode::class, nullable: true)] - public ?string $reason_code; + #[Optional('reason_code', enum: ReasonCode::class, nullable: true)] + public ?string $reasonCode; /** * The VAT category code that applies to the allowance. * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ #[Optional( + 'tax_code', enum: TaxCode::class, )] - public ?string $tax_code; + public ?string $taxCode; /** * The VAT rate, represented as percentage that applies to the allowance. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $tax_rate; + #[Optional('tax_rate', nullable: true)] + public float|string|null $taxRate; public function __construct() { @@ -86,27 +87,27 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ReasonCode|value-of|null $reason_code - * @param TaxCode|value-of $tax_code + * @param ReasonCode|value-of|null $reasonCode + * @param TaxCode|value-of $taxCode */ public static function with( float|string|null $amount = null, - float|string|null $base_amount = null, - float|string|null $multiplier_factor = null, + float|string|null $baseAmount = null, + float|string|null $multiplierFactor = null, ?string $reason = null, - ReasonCode|string|null $reason_code = null, - TaxCode|string|null $tax_code = null, - float|string|null $tax_rate = null, + ReasonCode|string|null $reasonCode = null, + TaxCode|string|null $taxCode = null, + float|string|null $taxRate = null, ): self { $obj = new self; null !== $amount && $obj['amount'] = $amount; - null !== $base_amount && $obj['base_amount'] = $base_amount; - null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $baseAmount && $obj['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; null !== $reason && $obj['reason'] = $reason; - null !== $reason_code && $obj['reason_code'] = $reason_code; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $reasonCode && $obj['reasonCode'] = $reasonCode; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxRate && $obj['taxRate'] = $taxRate; return $obj; } @@ -128,7 +129,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj['base_amount'] = $baseAmount; + $obj['baseAmount'] = $baseAmount; return $obj; } @@ -140,7 +141,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj['multiplier_factor'] = $multiplierFactor; + $obj['multiplierFactor'] = $multiplierFactor; return $obj; } @@ -164,7 +165,7 @@ public function withReason(?string $reason): self public function withReasonCode(ReasonCode|string|null $reasonCode): self { $obj = clone $this; - $obj['reason_code'] = $reasonCode; + $obj['reasonCode'] = $reasonCode; return $obj; } @@ -178,7 +179,7 @@ public function withTaxCode( TaxCode|string $taxCode, ): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -189,7 +190,7 @@ public function withTaxCode( public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } diff --git a/src/Validate/ValidateValidateJsonParams/Charge.php b/src/Validate/ValidateValidateJsonParams/Charge.php index 75318a43..c8d8a08a 100644 --- a/src/Validate/ValidateValidateJsonParams/Charge.php +++ b/src/Validate/ValidateValidateJsonParams/Charge.php @@ -15,12 +15,12 @@ * * @phpstan-type ChargeShape = array{ * amount?: float|string|null, - * base_amount?: float|string|null, - * multiplier_factor?: float|string|null, + * baseAmount?: float|string|null, + * multiplierFactor?: float|string|null, * reason?: string|null, - * reason_code?: value-of|null, - * tax_code?: value-of<\EInvoiceAPI\Validate\ValidateValidateJsonParams\Charge\TaxCode>|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of<\EInvoiceAPI\Validate\ValidateValidateJsonParams\Charge\TaxCode>|null, + * taxRate?: float|string|null, * } */ final class Charge implements BaseModel @@ -37,14 +37,14 @@ final class Charge implements BaseModel /** * The base amount that may be used, in conjunction with the charge percentage, to calculate the charge amount. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $base_amount; + #[Optional('base_amount', nullable: true)] + public float|string|null $baseAmount; /** * The percentage that may be used, in conjunction with the charge base amount, to calculate the charge amount. To state 20%, use value 20. */ - #[Optional(nullable: true)] - public float|string|null $multiplier_factor; + #[Optional('multiplier_factor', nullable: true)] + public float|string|null $multiplierFactor; /** * The reason for the charge. @@ -55,10 +55,10 @@ final class Charge implements BaseModel /** * Charge reason codes for invoice charges and fees. * - * @var value-of|null $reason_code + * @var value-of|null $reasonCode */ - #[Optional(enum: ReasonCode::class, nullable: true)] - public ?string $reason_code; + #[Optional('reason_code', enum: ReasonCode::class, nullable: true)] + public ?string $reasonCode; /** * Duty or tax or fee category codes (Subset of UNCL5305). @@ -67,19 +67,20 @@ final class Charge implements BaseModel * Version: D.16B * Subset: OpenPEPPOL * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ #[Optional( + 'tax_code', enum: TaxCode::class, nullable: true, )] - public ?string $tax_code; + public ?string $taxCode; /** * The VAT rate, represented as percentage that applies to the charge. */ - #[Optional(nullable: true)] - public float|string|null $tax_rate; + #[Optional('tax_rate', nullable: true)] + public float|string|null $taxRate; public function __construct() { @@ -91,27 +92,27 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ReasonCode|value-of|null $reason_code - * @param TaxCode|value-of|null $tax_code + * @param ReasonCode|value-of|null $reasonCode + * @param TaxCode|value-of|null $taxCode */ public static function with( float|string|null $amount = null, - float|string|null $base_amount = null, - float|string|null $multiplier_factor = null, + float|string|null $baseAmount = null, + float|string|null $multiplierFactor = null, ?string $reason = null, - ReasonCode|string|null $reason_code = null, - TaxCode|string|null $tax_code = null, - float|string|null $tax_rate = null, + ReasonCode|string|null $reasonCode = null, + TaxCode|string|null $taxCode = null, + float|string|null $taxRate = null, ): self { $obj = new self; null !== $amount && $obj['amount'] = $amount; - null !== $base_amount && $obj['base_amount'] = $base_amount; - null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $baseAmount && $obj['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; null !== $reason && $obj['reason'] = $reason; - null !== $reason_code && $obj['reason_code'] = $reason_code; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $reasonCode && $obj['reasonCode'] = $reasonCode; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxRate && $obj['taxRate'] = $taxRate; return $obj; } @@ -133,7 +134,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj['base_amount'] = $baseAmount; + $obj['baseAmount'] = $baseAmount; return $obj; } @@ -145,7 +146,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj['multiplier_factor'] = $multiplierFactor; + $obj['multiplierFactor'] = $multiplierFactor; return $obj; } @@ -169,7 +170,7 @@ public function withReason(?string $reason): self public function withReasonCode(ReasonCode|string|null $reasonCode): self { $obj = clone $this; - $obj['reason_code'] = $reasonCode; + $obj['reasonCode'] = $reasonCode; return $obj; } @@ -187,7 +188,7 @@ public function withTaxCode( TaxCode|string|null $taxCode, ): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -198,7 +199,7 @@ public function withTaxCode( public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } diff --git a/src/Validate/ValidateValidateJsonParams/Item.php b/src/Validate/ValidateValidateJsonParams/Item.php index efc715d8..97f47ded 100644 --- a/src/Validate/ValidateValidateJsonParams/Item.php +++ b/src/Validate/ValidateValidateJsonParams/Item.php @@ -20,12 +20,12 @@ * charges?: list<\EInvoiceAPI\Validate\ValidateValidateJsonParams\Item\Charge>|null, * date?: null|null, * description?: string|null, - * product_code?: string|null, + * productCode?: string|null, * quantity?: float|string|null, * tax?: float|string|null, - * tax_rate?: float|string|null, + * taxRate?: float|string|null, * unit?: value-of|null, - * unit_price?: float|string|null, + * unitPrice?: float|string|null, * } */ final class Item implements BaseModel @@ -74,8 +74,8 @@ final class Item implements BaseModel /** * The product code of the line item. */ - #[Optional(nullable: true)] - public ?string $product_code; + #[Optional('product_code', nullable: true)] + public ?string $productCode; /** * The quantity of items (goods or services) that is the subject of the line item. Must be rounded to maximum 4 decimals. Can be negative for credit notes or corrections. @@ -92,8 +92,8 @@ final class Item implements BaseModel /** * The VAT rate of the line item expressed as percentage with 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $tax_rate; + #[Optional('tax_rate', nullable: true)] + public float|string|null $taxRate; /** * Unit of Measure Codes from UNECERec20 used in Peppol BIS Billing 3.0. @@ -106,8 +106,8 @@ final class Item implements BaseModel /** * The item net price (BT-146). The price of an item, exclusive of VAT, after subtracting item price discount. Must be rounded to maximum 4 decimals. */ - #[Optional(nullable: true)] - public float|string|null $unit_price; + #[Optional('unit_price', nullable: true)] + public float|string|null $unitPrice; public function __construct() { @@ -121,21 +121,21 @@ public function __construct() * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $allowances * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $charges * @param UnitOfMeasureCode|value-of|null $unit */ @@ -145,12 +145,12 @@ public static function with( ?array $charges = null, null $date = null, ?string $description = null, - ?string $product_code = null, + ?string $productCode = null, float|string|null $quantity = null, float|string|null $tax = null, - float|string|null $tax_rate = null, + float|string|null $taxRate = null, UnitOfMeasureCode|string|null $unit = null, - float|string|null $unit_price = null, + float|string|null $unitPrice = null, ): self { $obj = new self; @@ -160,12 +160,12 @@ public static function with( null !== $amount && $obj['amount'] = $amount; null !== $charges && $obj['charges'] = $charges; null !== $description && $obj['description'] = $description; - null !== $product_code && $obj['product_code'] = $product_code; + null !== $productCode && $obj['productCode'] = $productCode; null !== $quantity && $obj['quantity'] = $quantity; null !== $tax && $obj['tax'] = $tax; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $taxRate && $obj['taxRate'] = $taxRate; null !== $unit && $obj['unit'] = $unit; - null !== $unit_price && $obj['unit_price'] = $unit_price; + null !== $unitPrice && $obj['unitPrice'] = $unitPrice; return $obj; } @@ -175,12 +175,12 @@ public static function with( * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $allowances */ public function withAllowances(?array $allowances): self @@ -207,12 +207,12 @@ public function withAmount(float|string|null $amount): self * * @param list|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * }>|null $charges */ public function withCharges(?array $charges): self @@ -251,7 +251,7 @@ public function withDescription(?string $description): self public function withProductCode(?string $productCode): self { $obj = clone $this; - $obj['product_code'] = $productCode; + $obj['productCode'] = $productCode; return $obj; } @@ -284,7 +284,7 @@ public function withTax(float|string|null $tax): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } @@ -308,7 +308,7 @@ public function withUnit(UnitOfMeasureCode|string|null $unit): self public function withUnitPrice(float|string|null $unitPrice): self { $obj = clone $this; - $obj['unit_price'] = $unitPrice; + $obj['unitPrice'] = $unitPrice; return $obj; } diff --git a/src/Validate/ValidateValidateJsonParams/Item/Allowance.php b/src/Validate/ValidateValidateJsonParams/Item/Allowance.php index 76dfe8c2..a1a4a274 100644 --- a/src/Validate/ValidateValidateJsonParams/Item/Allowance.php +++ b/src/Validate/ValidateValidateJsonParams/Item/Allowance.php @@ -15,12 +15,12 @@ * * @phpstan-type AllowanceShape = array{ * amount?: float|string|null, - * base_amount?: float|string|null, - * multiplier_factor?: float|string|null, + * baseAmount?: float|string|null, + * multiplierFactor?: float|string|null, * reason?: string|null, - * reason_code?: value-of|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * } */ final class Allowance implements BaseModel @@ -37,14 +37,14 @@ final class Allowance implements BaseModel /** * The base amount that may be used, in conjunction with the allowance percentage, to calculate the allowance amount. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $base_amount; + #[Optional('base_amount', nullable: true)] + public float|string|null $baseAmount; /** * The percentage that may be used, in conjunction with the allowance base amount, to calculate the allowance amount. To state 20%, use value 20. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $multiplier_factor; + #[Optional('multiplier_factor', nullable: true)] + public float|string|null $multiplierFactor; /** * The reason for the allowance. @@ -55,24 +55,24 @@ final class Allowance implements BaseModel /** * Allowance reason codes for invoice discounts and charges. * - * @var value-of|null $reason_code + * @var value-of|null $reasonCode */ - #[Optional(enum: ReasonCode::class, nullable: true)] - public ?string $reason_code; + #[Optional('reason_code', enum: ReasonCode::class, nullable: true)] + public ?string $reasonCode; /** * The VAT category code that applies to the allowance. * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ - #[Optional(enum: TaxCode::class)] - public ?string $tax_code; + #[Optional('tax_code', enum: TaxCode::class)] + public ?string $taxCode; /** * The VAT rate, represented as percentage that applies to the allowance. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $tax_rate; + #[Optional('tax_rate', nullable: true)] + public float|string|null $taxRate; public function __construct() { @@ -84,27 +84,27 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ReasonCode|value-of|null $reason_code - * @param TaxCode|value-of $tax_code + * @param ReasonCode|value-of|null $reasonCode + * @param TaxCode|value-of $taxCode */ public static function with( float|string|null $amount = null, - float|string|null $base_amount = null, - float|string|null $multiplier_factor = null, + float|string|null $baseAmount = null, + float|string|null $multiplierFactor = null, ?string $reason = null, - ReasonCode|string|null $reason_code = null, - TaxCode|string|null $tax_code = null, - float|string|null $tax_rate = null, + ReasonCode|string|null $reasonCode = null, + TaxCode|string|null $taxCode = null, + float|string|null $taxRate = null, ): self { $obj = new self; null !== $amount && $obj['amount'] = $amount; - null !== $base_amount && $obj['base_amount'] = $base_amount; - null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $baseAmount && $obj['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; null !== $reason && $obj['reason'] = $reason; - null !== $reason_code && $obj['reason_code'] = $reason_code; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $reasonCode && $obj['reasonCode'] = $reasonCode; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxRate && $obj['taxRate'] = $taxRate; return $obj; } @@ -126,7 +126,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj['base_amount'] = $baseAmount; + $obj['baseAmount'] = $baseAmount; return $obj; } @@ -138,7 +138,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj['multiplier_factor'] = $multiplierFactor; + $obj['multiplierFactor'] = $multiplierFactor; return $obj; } @@ -162,7 +162,7 @@ public function withReason(?string $reason): self public function withReasonCode(ReasonCode|string|null $reasonCode): self { $obj = clone $this; - $obj['reason_code'] = $reasonCode; + $obj['reasonCode'] = $reasonCode; return $obj; } @@ -175,7 +175,7 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self public function withTaxCode(TaxCode|string $taxCode): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -186,7 +186,7 @@ public function withTaxCode(TaxCode|string $taxCode): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } diff --git a/src/Validate/ValidateValidateJsonParams/Item/Charge.php b/src/Validate/ValidateValidateJsonParams/Item/Charge.php index 34e1f997..1e05750a 100644 --- a/src/Validate/ValidateValidateJsonParams/Item/Charge.php +++ b/src/Validate/ValidateValidateJsonParams/Item/Charge.php @@ -15,12 +15,12 @@ * * @phpstan-type ChargeShape = array{ * amount?: float|string|null, - * base_amount?: float|string|null, - * multiplier_factor?: float|string|null, + * baseAmount?: float|string|null, + * multiplierFactor?: float|string|null, * reason?: string|null, - * reason_code?: value-of|null, - * tax_code?: value-of|null, - * tax_rate?: float|string|null, + * reasonCode?: value-of|null, + * taxCode?: value-of|null, + * taxRate?: float|string|null, * } */ final class Charge implements BaseModel @@ -37,14 +37,14 @@ final class Charge implements BaseModel /** * The base amount that may be used, in conjunction with the charge percentage, to calculate the charge amount. Must be rounded to maximum 2 decimals. */ - #[Optional(nullable: true)] - public float|string|null $base_amount; + #[Optional('base_amount', nullable: true)] + public float|string|null $baseAmount; /** * The percentage that may be used, in conjunction with the charge base amount, to calculate the charge amount. To state 20%, use value 20. */ - #[Optional(nullable: true)] - public float|string|null $multiplier_factor; + #[Optional('multiplier_factor', nullable: true)] + public float|string|null $multiplierFactor; /** * The reason for the charge. @@ -55,10 +55,10 @@ final class Charge implements BaseModel /** * Charge reason codes for invoice charges and fees. * - * @var value-of|null $reason_code + * @var value-of|null $reasonCode */ - #[Optional(enum: ReasonCode::class, nullable: true)] - public ?string $reason_code; + #[Optional('reason_code', enum: ReasonCode::class, nullable: true)] + public ?string $reasonCode; /** * Duty or tax or fee category codes (Subset of UNCL5305). @@ -67,16 +67,16 @@ final class Charge implements BaseModel * Version: D.16B * Subset: OpenPEPPOL * - * @var value-of|null $tax_code + * @var value-of|null $taxCode */ - #[Optional(enum: TaxCode::class, nullable: true)] - public ?string $tax_code; + #[Optional('tax_code', enum: TaxCode::class, nullable: true)] + public ?string $taxCode; /** * The VAT rate, represented as percentage that applies to the charge. */ - #[Optional(nullable: true)] - public float|string|null $tax_rate; + #[Optional('tax_rate', nullable: true)] + public float|string|null $taxRate; public function __construct() { @@ -88,27 +88,27 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ReasonCode|value-of|null $reason_code - * @param TaxCode|value-of|null $tax_code + * @param ReasonCode|value-of|null $reasonCode + * @param TaxCode|value-of|null $taxCode */ public static function with( float|string|null $amount = null, - float|string|null $base_amount = null, - float|string|null $multiplier_factor = null, + float|string|null $baseAmount = null, + float|string|null $multiplierFactor = null, ?string $reason = null, - ReasonCode|string|null $reason_code = null, - TaxCode|string|null $tax_code = null, - float|string|null $tax_rate = null, + ReasonCode|string|null $reasonCode = null, + TaxCode|string|null $taxCode = null, + float|string|null $taxRate = null, ): self { $obj = new self; null !== $amount && $obj['amount'] = $amount; - null !== $base_amount && $obj['base_amount'] = $base_amount; - null !== $multiplier_factor && $obj['multiplier_factor'] = $multiplier_factor; + null !== $baseAmount && $obj['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; null !== $reason && $obj['reason'] = $reason; - null !== $reason_code && $obj['reason_code'] = $reason_code; - null !== $tax_code && $obj['tax_code'] = $tax_code; - null !== $tax_rate && $obj['tax_rate'] = $tax_rate; + null !== $reasonCode && $obj['reasonCode'] = $reasonCode; + null !== $taxCode && $obj['taxCode'] = $taxCode; + null !== $taxRate && $obj['taxRate'] = $taxRate; return $obj; } @@ -130,7 +130,7 @@ public function withAmount(float|string|null $amount): self public function withBaseAmount(float|string|null $baseAmount): self { $obj = clone $this; - $obj['base_amount'] = $baseAmount; + $obj['baseAmount'] = $baseAmount; return $obj; } @@ -142,7 +142,7 @@ public function withMultiplierFactor( float|string|null $multiplierFactor ): self { $obj = clone $this; - $obj['multiplier_factor'] = $multiplierFactor; + $obj['multiplierFactor'] = $multiplierFactor; return $obj; } @@ -166,7 +166,7 @@ public function withReason(?string $reason): self public function withReasonCode(ReasonCode|string|null $reasonCode): self { $obj = clone $this; - $obj['reason_code'] = $reasonCode; + $obj['reasonCode'] = $reasonCode; return $obj; } @@ -183,7 +183,7 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self public function withTaxCode(TaxCode|string|null $taxCode): self { $obj = clone $this; - $obj['tax_code'] = $taxCode; + $obj['taxCode'] = $taxCode; return $obj; } @@ -194,7 +194,7 @@ public function withTaxCode(TaxCode|string|null $taxCode): self public function withTaxRate(float|string|null $taxRate): self { $obj = clone $this; - $obj['tax_rate'] = $taxRate; + $obj['taxRate'] = $taxRate; return $obj; } diff --git a/src/Validate/ValidateValidatePeppolIDParams.php b/src/Validate/ValidateValidatePeppolIDParams.php index 5825b895..8e464e89 100644 --- a/src/Validate/ValidateValidatePeppolIDParams.php +++ b/src/Validate/ValidateValidatePeppolIDParams.php @@ -14,7 +14,7 @@ * * @see EInvoiceAPI\Services\ValidateService::validatePeppolID() * - * @phpstan-type ValidateValidatePeppolIDParamsShape = array{peppol_id: string} + * @phpstan-type ValidateValidatePeppolIDParamsShape = array{peppolID: string} */ final class ValidateValidatePeppolIDParams implements BaseModel { @@ -26,14 +26,14 @@ final class ValidateValidatePeppolIDParams implements BaseModel * Peppol ID in the format `:`. Example: `0208:1018265814` for a Belgian company. */ #[Required] - public string $peppol_id; + public string $peppolID; /** * `new ValidateValidatePeppolIDParams()` is missing required properties by the API. * * To enforce required parameters use * ``` - * ValidateValidatePeppolIDParams::with(peppol_id: ...) + * ValidateValidatePeppolIDParams::with(peppolID: ...) * ``` * * Otherwise ensure the following setters are called @@ -52,11 +52,11 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(string $peppol_id): self + public static function with(string $peppolID): self { $obj = new self; - $obj['peppol_id'] = $peppol_id; + $obj['peppolID'] = $peppolID; return $obj; } @@ -67,7 +67,7 @@ public static function with(string $peppol_id): self public function withPeppolID(string $peppolID): self { $obj = clone $this; - $obj['peppol_id'] = $peppolID; + $obj['peppolID'] = $peppolID; return $obj; } diff --git a/src/Validate/ValidateValidatePeppolIDResponse.php b/src/Validate/ValidateValidatePeppolIDResponse.php index bf918cd7..4d8d42f0 100644 --- a/src/Validate/ValidateValidatePeppolIDResponse.php +++ b/src/Validate/ValidateValidatePeppolIDResponse.php @@ -17,11 +17,11 @@ * including whether the ID is valid and what document types it supports. * * @phpstan-type ValidateValidatePeppolIDResponseShape = array{ - * business_card: BusinessCard|null, - * business_card_valid: bool, - * dns_valid: bool, - * is_valid: bool, - * supported_document_types?: list|null, + * businessCard: BusinessCard|null, + * businessCardValid: bool, + * dnsValid: bool, + * isValid: bool, + * supportedDocumentTypes?: list|null, * } */ final class ValidateValidatePeppolIDResponse implements BaseModel @@ -32,30 +32,30 @@ final class ValidateValidatePeppolIDResponse implements BaseModel /** * Business card information for the Peppol ID. */ - #[Required] - public ?BusinessCard $business_card; + #[Required('business_card')] + public ?BusinessCard $businessCard; /** * Whether a business card is set at the SMP. */ - #[Required] - public bool $business_card_valid; + #[Required('business_card_valid')] + public bool $businessCardValid; /** * Whether the DNS resolves to a valid SMP. */ - #[Required] - public bool $dns_valid; + #[Required('dns_valid')] + public bool $dnsValid; /** * Whether the Peppol ID is valid and registered in the Peppol network. */ - #[Required] - public bool $is_valid; + #[Required('is_valid')] + public bool $isValid; - /** @var list|null $supported_document_types */ - #[Optional(list: 'string')] - public ?array $supported_document_types; + /** @var list|null $supportedDocumentTypes */ + #[Optional('supported_document_types', list: 'string')] + public ?array $supportedDocumentTypes; /** * `new ValidateValidatePeppolIDResponse()` is missing required properties by the API. @@ -63,7 +63,7 @@ final class ValidateValidatePeppolIDResponse implements BaseModel * To enforce required parameters use * ``` * ValidateValidatePeppolIDResponse::with( - * business_card: ..., business_card_valid: ..., dns_valid: ..., is_valid: ... + * businessCard: ..., businessCardValid: ..., dnsValid: ..., isValid: ... * ) * ``` * @@ -88,27 +88,27 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param BusinessCard|array{ - * country_code?: string|null, + * countryCode?: string|null, * name?: string|null, - * registration_date?: \DateTimeInterface|null, - * }|null $business_card - * @param list $supported_document_types + * registrationDate?: \DateTimeInterface|null, + * }|null $businessCard + * @param list $supportedDocumentTypes */ public static function with( - BusinessCard|array|null $business_card, - bool $business_card_valid, - bool $dns_valid, - bool $is_valid, - ?array $supported_document_types = null, + BusinessCard|array|null $businessCard, + bool $businessCardValid, + bool $dnsValid, + bool $isValid, + ?array $supportedDocumentTypes = null, ): self { $obj = new self; - $obj['business_card'] = $business_card; - $obj['business_card_valid'] = $business_card_valid; - $obj['dns_valid'] = $dns_valid; - $obj['is_valid'] = $is_valid; + $obj['businessCard'] = $businessCard; + $obj['businessCardValid'] = $businessCardValid; + $obj['dnsValid'] = $dnsValid; + $obj['isValid'] = $isValid; - null !== $supported_document_types && $obj['supported_document_types'] = $supported_document_types; + null !== $supportedDocumentTypes && $obj['supportedDocumentTypes'] = $supportedDocumentTypes; return $obj; } @@ -117,16 +117,16 @@ public static function with( * Business card information for the Peppol ID. * * @param BusinessCard|array{ - * country_code?: string|null, + * countryCode?: string|null, * name?: string|null, - * registration_date?: \DateTimeInterface|null, + * registrationDate?: \DateTimeInterface|null, * }|null $businessCard */ public function withBusinessCard( BusinessCard|array|null $businessCard ): self { $obj = clone $this; - $obj['business_card'] = $businessCard; + $obj['businessCard'] = $businessCard; return $obj; } @@ -137,7 +137,7 @@ public function withBusinessCard( public function withBusinessCardValid(bool $businessCardValid): self { $obj = clone $this; - $obj['business_card_valid'] = $businessCardValid; + $obj['businessCardValid'] = $businessCardValid; return $obj; } @@ -148,7 +148,7 @@ public function withBusinessCardValid(bool $businessCardValid): self public function withDNSValid(bool $dnsValid): self { $obj = clone $this; - $obj['dns_valid'] = $dnsValid; + $obj['dnsValid'] = $dnsValid; return $obj; } @@ -159,7 +159,7 @@ public function withDNSValid(bool $dnsValid): self public function withIsValid(bool $isValid): self { $obj = clone $this; - $obj['is_valid'] = $isValid; + $obj['isValid'] = $isValid; return $obj; } @@ -171,7 +171,7 @@ public function withSupportedDocumentTypes( array $supportedDocumentTypes ): self { $obj = clone $this; - $obj['supported_document_types'] = $supportedDocumentTypes; + $obj['supportedDocumentTypes'] = $supportedDocumentTypes; return $obj; } diff --git a/src/Validate/ValidateValidatePeppolIDResponse/BusinessCard.php b/src/Validate/ValidateValidatePeppolIDResponse/BusinessCard.php index fc369eeb..28441e23 100644 --- a/src/Validate/ValidateValidatePeppolIDResponse/BusinessCard.php +++ b/src/Validate/ValidateValidatePeppolIDResponse/BusinessCard.php @@ -12,9 +12,9 @@ * Business card information for the Peppol ID. * * @phpstan-type BusinessCardShape = array{ - * country_code?: string|null, + * countryCode?: string|null, * name?: string|null, - * registration_date?: \DateTimeInterface|null, + * registrationDate?: \DateTimeInterface|null, * } */ final class BusinessCard implements BaseModel @@ -22,14 +22,14 @@ final class BusinessCard implements BaseModel /** @use SdkModel */ use SdkModel; - #[Optional(nullable: true)] - public ?string $country_code; + #[Optional('country_code', nullable: true)] + public ?string $countryCode; #[Optional(nullable: true)] public ?string $name; - #[Optional(nullable: true)] - public ?\DateTimeInterface $registration_date; + #[Optional('registration_date', nullable: true)] + public ?\DateTimeInterface $registrationDate; public function __construct() { @@ -42,15 +42,15 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. */ public static function with( - ?string $country_code = null, + ?string $countryCode = null, ?string $name = null, - ?\DateTimeInterface $registration_date = null, + ?\DateTimeInterface $registrationDate = null, ): self { $obj = new self; - null !== $country_code && $obj['country_code'] = $country_code; + null !== $countryCode && $obj['countryCode'] = $countryCode; null !== $name && $obj['name'] = $name; - null !== $registration_date && $obj['registration_date'] = $registration_date; + null !== $registrationDate && $obj['registrationDate'] = $registrationDate; return $obj; } @@ -58,7 +58,7 @@ public static function with( public function withCountryCode(?string $countryCode): self { $obj = clone $this; - $obj['country_code'] = $countryCode; + $obj['countryCode'] = $countryCode; return $obj; } @@ -75,7 +75,7 @@ public function withRegistrationDate( ?\DateTimeInterface $registrationDate ): self { $obj = clone $this; - $obj['registration_date'] = $registrationDate; + $obj['registrationDate'] = $registrationDate; return $obj; } diff --git a/src/Webhooks/WebhookDeleteResponse.php b/src/Webhooks/WebhookDeleteResponse.php index 88869136..72da6b5f 100644 --- a/src/Webhooks/WebhookDeleteResponse.php +++ b/src/Webhooks/WebhookDeleteResponse.php @@ -11,22 +11,22 @@ /** * Model for webhook deletion. * - * @phpstan-type WebhookDeleteResponseShape = array{is_deleted: bool} + * @phpstan-type WebhookDeleteResponseShape = array{isDeleted: bool} */ final class WebhookDeleteResponse implements BaseModel { /** @use SdkModel */ use SdkModel; - #[Required] - public bool $is_deleted; + #[Required('is_deleted')] + public bool $isDeleted; /** * `new WebhookDeleteResponse()` is missing required properties by the API. * * To enforce required parameters use * ``` - * WebhookDeleteResponse::with(is_deleted: ...) + * WebhookDeleteResponse::with(isDeleted: ...) * ``` * * Otherwise ensure the following setters are called @@ -45,11 +45,11 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(bool $is_deleted): self + public static function with(bool $isDeleted): self { $obj = new self; - $obj['is_deleted'] = $is_deleted; + $obj['isDeleted'] = $isDeleted; return $obj; } @@ -57,7 +57,7 @@ public static function with(bool $is_deleted): self public function withIsDeleted(bool $isDeleted): self { $obj = clone $this; - $obj['is_deleted'] = $isDeleted; + $obj['isDeleted'] = $isDeleted; return $obj; } diff --git a/tests/Services/Documents/AttachmentsTest.php b/tests/Services/Documents/AttachmentsTest.php index da9ff81d..a6a0491b 100644 --- a/tests/Services/Documents/AttachmentsTest.php +++ b/tests/Services/Documents/AttachmentsTest.php @@ -37,7 +37,7 @@ public function testRetrieve(): void $result = $this->client->documents->attachments->retrieve( 'attachment_id', - ['document_id' => 'document_id'] + ['documentID' => 'document_id'] ); // @phpstan-ignore-next-line method.alreadyNarrowedType @@ -53,7 +53,7 @@ public function testRetrieveWithOptionalParams(): void $result = $this->client->documents->attachments->retrieve( 'attachment_id', - ['document_id' => 'document_id'] + ['documentID' => 'document_id'] ); // @phpstan-ignore-next-line method.alreadyNarrowedType @@ -82,7 +82,7 @@ public function testDelete(): void $result = $this->client->documents->attachments->delete( 'attachment_id', - ['document_id' => 'document_id'] + ['documentID' => 'document_id'] ); // @phpstan-ignore-next-line method.alreadyNarrowedType @@ -98,7 +98,7 @@ public function testDeleteWithOptionalParams(): void $result = $this->client->documents->attachments->delete( 'attachment_id', - ['document_id' => 'document_id'] + ['documentID' => 'document_id'] ); // @phpstan-ignore-next-line method.alreadyNarrowedType diff --git a/tests/Services/DocumentsTest.php b/tests/Services/DocumentsTest.php index 2cfb9c92..e7bee5a6 100644 --- a/tests/Services/DocumentsTest.php +++ b/tests/Services/DocumentsTest.php @@ -91,8 +91,8 @@ public function testCreateFromPdfWithOptionalParams(): void $result = $this->client->documents->createFromPdf([ 'file' => 'file', - 'customer_tax_id' => 'customer_tax_id', - 'vendor_tax_id' => 'vendor_tax_id', + 'customerTaxID' => 'customer_tax_id', + 'vendorTaxID' => 'vendor_tax_id', ]); // @phpstan-ignore-next-line method.alreadyNarrowedType diff --git a/tests/Services/LookupTest.php b/tests/Services/LookupTest.php index 83526a24..60b47ebd 100644 --- a/tests/Services/LookupTest.php +++ b/tests/Services/LookupTest.php @@ -35,7 +35,7 @@ public function testRetrieve(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->lookup->retrieve(['peppol_id' => 'peppol_id']); + $result = $this->client->lookup->retrieve(['peppolID' => 'peppol_id']); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(LookupGetResponse::class, $result); @@ -48,7 +48,7 @@ public function testRetrieveWithOptionalParams(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->lookup->retrieve(['peppol_id' => 'peppol_id']); + $result = $this->client->lookup->retrieve(['peppolID' => 'peppol_id']); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(LookupGetResponse::class, $result); @@ -75,7 +75,7 @@ public function testRetrieveParticipantsWithOptionalParams(): void } $result = $this->client->lookup->retrieveParticipants([ - 'query' => 'query', 'country_code' => 'country_code', + 'query' => 'query', 'countryCode' => 'country_code', ]); // @phpstan-ignore-next-line method.alreadyNarrowedType diff --git a/tests/Services/ValidateTest.php b/tests/Services/ValidateTest.php index 8e310273..2835ddb5 100644 --- a/tests/Services/ValidateTest.php +++ b/tests/Services/ValidateTest.php @@ -49,7 +49,7 @@ public function testValidatePeppolID(): void } $result = $this->client->validate->validatePeppolID([ - 'peppol_id' => 'peppol_id', + 'peppolID' => 'peppol_id', ]); // @phpstan-ignore-next-line method.alreadyNarrowedType @@ -64,7 +64,7 @@ public function testValidatePeppolIDWithOptionalParams(): void } $result = $this->client->validate->validatePeppolID([ - 'peppol_id' => 'peppol_id', + 'peppolID' => 'peppol_id', ]); // @phpstan-ignore-next-line method.alreadyNarrowedType From 3d841fa738d64708d78b6b321b66bf13651c774f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Dec 2025 03:15:25 +0000 Subject: [PATCH 6/9] chore: use `$self = clone $this;` instead of `$obj = clone $this;` --- src/Documents/Allowance.php | 60 +-- .../Attachments/AttachmentAddParams.php | 12 +- .../Attachments/AttachmentDeleteParams.php | 12 +- .../Attachments/AttachmentDeleteResponse.php | 12 +- .../Attachments/AttachmentRetrieveParams.php | 12 +- .../Attachments/DocumentAttachment.php | 44 +- src/Documents/Charge.php | 60 +-- src/Documents/DocumentAttachmentCreate.php | 36 +- src/Documents/DocumentCreate.php | 392 ++++++++--------- src/Documents/DocumentCreate/Allowance.php | 60 +-- src/Documents/DocumentCreate/Charge.php | 60 +-- src/Documents/DocumentCreate/Item.php | 98 ++--- .../DocumentCreate/Item/Allowance.php | 60 +-- src/Documents/DocumentCreate/Item/Charge.php | 60 +-- src/Documents/DocumentCreate/TaxDetail.php | 20 +- src/Documents/DocumentCreateFromPdfParams.php | 28 +- src/Documents/DocumentCreateParams.php | 392 ++++++++--------- .../DocumentCreateParams/Allowance.php | 60 +-- src/Documents/DocumentCreateParams/Charge.php | 60 +-- src/Documents/DocumentCreateParams/Item.php | 98 ++--- .../DocumentCreateParams/Item/Allowance.php | 60 +-- .../DocumentCreateParams/Item/Charge.php | 60 +-- .../DocumentCreateParams/TaxDetail.php | 20 +- src/Documents/DocumentDeleteResponse.php | 12 +- src/Documents/DocumentNewFromPdfResponse.php | 400 +++++++++--------- .../DocumentNewFromPdfResponse/Item.php | 98 ++--- .../DocumentNewFromPdfResponse/TaxDetail.php | 20 +- src/Documents/DocumentResponse.php | 394 ++++++++--------- src/Documents/DocumentResponse/Allowance.php | 60 +-- src/Documents/DocumentResponse/Charge.php | 60 +-- src/Documents/DocumentResponse/Item.php | 98 ++--- .../DocumentResponse/PaymentDetail.php | 36 +- src/Documents/DocumentResponse/TaxDetail.php | 20 +- src/Documents/DocumentSendParams.php | 44 +- src/Documents/PaymentDetailCreate.php | 36 +- src/Documents/Ubl/UblCreateFromUblParams.php | 12 +- src/Documents/Ubl/UblGetResponse.php | 84 ++-- src/Inbox/InboxListCreditNotesParams.php | 20 +- src/Inbox/InboxListInvoicesParams.php | 20 +- src/Inbox/InboxListParams.php | 72 ++-- src/Inbox/PaginatedDocumentResponse.php | 44 +- src/Lookup/Certificate.php | 28 +- src/Lookup/LookupGetParticipantsResponse.php | 44 +- .../Participant.php | 36 +- .../Participant/DocumentType.php | 20 +- .../Participant/Entity.php | 60 +-- .../Participant/Entity/Identifier.php | 20 +- src/Lookup/LookupGetResponse.php | 72 ++-- src/Lookup/LookupGetResponse/BusinessCard.php | 36 +- .../LookupGetResponse/BusinessCard/Entity.php | 36 +- src/Lookup/LookupGetResponse/DNSInfo.php | 36 +- .../LookupGetResponse/DNSInfo/DNSRecord.php | 12 +- .../LookupGetResponse/QueryMetadata.php | 44 +- .../LookupGetResponse/ServiceMetadata.php | 36 +- .../ServiceMetadata/Endpoint.php | 44 +- .../ServiceMetadata/Endpoint/DocumentType.php | 20 +- .../ServiceMetadata/Endpoint/Process.php | 20 +- .../Endpoint/Process/Endpoint.php | 68 +-- .../Endpoint/Process/ProcessID.php | 20 +- src/Lookup/LookupRetrieveParams.php | 12 +- .../LookupRetrieveParticipantsParams.php | 20 +- src/Me/MeGetResponse.php | 146 +++---- src/Outbox/OutboxListDraftDocumentsParams.php | 20 +- .../OutboxListReceivedDocumentsParams.php | 72 ++-- src/RequestOptions.php | 98 ++--- src/Validate/UblDocumentValidation.php | 44 +- src/Validate/UblDocumentValidation/Issue.php | 60 +-- src/Validate/ValidateValidateJsonParams.php | 392 ++++++++--------- .../ValidateValidateJsonParams/Allowance.php | 60 +-- .../ValidateValidateJsonParams/Charge.php | 60 +-- .../ValidateValidateJsonParams/Item.php | 98 ++--- .../Item/Allowance.php | 60 +-- .../Item/Charge.php | 60 +-- .../ValidateValidateJsonParams/TaxDetail.php | 20 +- .../ValidateValidatePeppolIDParams.php | 12 +- .../ValidateValidatePeppolIDResponse.php | 44 +- .../BusinessCard.php | 28 +- src/Validate/ValidateValidateUblParams.php | 12 +- src/Webhooks/WebhookCreateParams.php | 28 +- src/Webhooks/WebhookDeleteResponse.php | 12 +- src/Webhooks/WebhookResponse.php | 44 +- src/Webhooks/WebhookUpdateParams.php | 28 +- 82 files changed, 2695 insertions(+), 2693 deletions(-) diff --git a/src/Documents/Allowance.php b/src/Documents/Allowance.php index 559bd4d5..f192c177 100644 --- a/src/Documents/Allowance.php +++ b/src/Documents/Allowance.php @@ -96,17 +96,17 @@ public static function with( TaxCode|string|null $taxCode = null, ?string $taxRate = null, ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $baseAmount && $obj['baseAmount'] = $baseAmount; - null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; - null !== $reason && $obj['reason'] = $reason; - null !== $reasonCode && $obj['reasonCode'] = $reasonCode; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxRate && $obj['taxRate'] = $taxRate; + null !== $amount && $self['amount'] = $amount; + null !== $baseAmount && $self['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $self['multiplierFactor'] = $multiplierFactor; + null !== $reason && $self['reason'] = $reason; + null !== $reasonCode && $self['reasonCode'] = $reasonCode; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxRate && $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -114,10 +114,10 @@ public static function with( */ public function withAmount(?string $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -125,10 +125,10 @@ public function withAmount(?string $amount): self */ public function withBaseAmount(?string $baseAmount): self { - $obj = clone $this; - $obj['baseAmount'] = $baseAmount; + $self = clone $this; + $self['baseAmount'] = $baseAmount; - return $obj; + return $self; } /** @@ -136,10 +136,10 @@ public function withBaseAmount(?string $baseAmount): self */ public function withMultiplierFactor(?string $multiplierFactor): self { - $obj = clone $this; - $obj['multiplierFactor'] = $multiplierFactor; + $self = clone $this; + $self['multiplierFactor'] = $multiplierFactor; - return $obj; + return $self; } /** @@ -147,10 +147,10 @@ public function withMultiplierFactor(?string $multiplierFactor): self */ public function withReason(?string $reason): self { - $obj = clone $this; - $obj['reason'] = $reason; + $self = clone $this; + $self['reason'] = $reason; - return $obj; + return $self; } /** @@ -160,10 +160,10 @@ public function withReason(?string $reason): self */ public function withReasonCode(ReasonCode|string|null $reasonCode): self { - $obj = clone $this; - $obj['reasonCode'] = $reasonCode; + $self = clone $this; + $self['reasonCode'] = $reasonCode; - return $obj; + return $self; } /** @@ -173,10 +173,10 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self */ public function withTaxCode(TaxCode|string $taxCode): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -184,9 +184,9 @@ public function withTaxCode(TaxCode|string $taxCode): self */ public function withTaxRate(?string $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } } diff --git a/src/Documents/Attachments/AttachmentAddParams.php b/src/Documents/Attachments/AttachmentAddParams.php index 33a09602..e1b36224 100644 --- a/src/Documents/Attachments/AttachmentAddParams.php +++ b/src/Documents/Attachments/AttachmentAddParams.php @@ -51,18 +51,18 @@ public function __construct() */ public static function with(string $file): self { - $obj = new self; + $self = new self; - $obj['file'] = $file; + $self['file'] = $file; - return $obj; + return $self; } public function withFile(string $file): self { - $obj = clone $this; - $obj['file'] = $file; + $self = clone $this; + $self['file'] = $file; - return $obj; + return $self; } } diff --git a/src/Documents/Attachments/AttachmentDeleteParams.php b/src/Documents/Attachments/AttachmentDeleteParams.php index 0ce0698b..6d0bc23b 100644 --- a/src/Documents/Attachments/AttachmentDeleteParams.php +++ b/src/Documents/Attachments/AttachmentDeleteParams.php @@ -51,18 +51,18 @@ public function __construct() */ public static function with(string $documentID): self { - $obj = new self; + $self = new self; - $obj['documentID'] = $documentID; + $self['documentID'] = $documentID; - return $obj; + return $self; } public function withDocumentID(string $documentID): self { - $obj = clone $this; - $obj['documentID'] = $documentID; + $self = clone $this; + $self['documentID'] = $documentID; - return $obj; + return $self; } } diff --git a/src/Documents/Attachments/AttachmentDeleteResponse.php b/src/Documents/Attachments/AttachmentDeleteResponse.php index 2ebad120..b747ad44 100644 --- a/src/Documents/Attachments/AttachmentDeleteResponse.php +++ b/src/Documents/Attachments/AttachmentDeleteResponse.php @@ -45,18 +45,18 @@ public function __construct() */ public static function with(bool $isDeleted): self { - $obj = new self; + $self = new self; - $obj['isDeleted'] = $isDeleted; + $self['isDeleted'] = $isDeleted; - return $obj; + return $self; } public function withIsDeleted(bool $isDeleted): self { - $obj = clone $this; - $obj['isDeleted'] = $isDeleted; + $self = clone $this; + $self['isDeleted'] = $isDeleted; - return $obj; + return $self; } } diff --git a/src/Documents/Attachments/AttachmentRetrieveParams.php b/src/Documents/Attachments/AttachmentRetrieveParams.php index 5a38860f..ffc06b86 100644 --- a/src/Documents/Attachments/AttachmentRetrieveParams.php +++ b/src/Documents/Attachments/AttachmentRetrieveParams.php @@ -51,18 +51,18 @@ public function __construct() */ public static function with(string $documentID): self { - $obj = new self; + $self = new self; - $obj['documentID'] = $documentID; + $self['documentID'] = $documentID; - return $obj; + return $self; } public function withDocumentID(string $documentID): self { - $obj = clone $this; - $obj['documentID'] = $documentID; + $self = clone $this; + $self['documentID'] = $documentID; - return $obj; + return $self; } } diff --git a/src/Documents/Attachments/DocumentAttachment.php b/src/Documents/Attachments/DocumentAttachment.php index 8c9db23b..f84c8818 100644 --- a/src/Documents/Attachments/DocumentAttachment.php +++ b/src/Documents/Attachments/DocumentAttachment.php @@ -69,55 +69,55 @@ public static function with( ?string $fileType = null, ?string $fileURL = null, ): self { - $obj = new self; + $self = new self; - $obj['id'] = $id; - $obj['fileName'] = $fileName; + $self['id'] = $id; + $self['fileName'] = $fileName; - null !== $fileSize && $obj['fileSize'] = $fileSize; - null !== $fileType && $obj['fileType'] = $fileType; - null !== $fileURL && $obj['fileURL'] = $fileURL; + null !== $fileSize && $self['fileSize'] = $fileSize; + null !== $fileType && $self['fileType'] = $fileType; + null !== $fileURL && $self['fileURL'] = $fileURL; - return $obj; + return $self; } public function withID(string $id): self { - $obj = clone $this; - $obj['id'] = $id; + $self = clone $this; + $self['id'] = $id; - return $obj; + return $self; } public function withFileName(string $fileName): self { - $obj = clone $this; - $obj['fileName'] = $fileName; + $self = clone $this; + $self['fileName'] = $fileName; - return $obj; + return $self; } public function withFileSize(int $fileSize): self { - $obj = clone $this; - $obj['fileSize'] = $fileSize; + $self = clone $this; + $self['fileSize'] = $fileSize; - return $obj; + return $self; } public function withFileType(string $fileType): self { - $obj = clone $this; - $obj['fileType'] = $fileType; + $self = clone $this; + $self['fileType'] = $fileType; - return $obj; + return $self; } public function withFileURL(?string $fileURL): self { - $obj = clone $this; - $obj['fileURL'] = $fileURL; + $self = clone $this; + $self['fileURL'] = $fileURL; - return $obj; + return $self; } } diff --git a/src/Documents/Charge.php b/src/Documents/Charge.php index 1e7a701a..f189ee13 100644 --- a/src/Documents/Charge.php +++ b/src/Documents/Charge.php @@ -100,17 +100,17 @@ public static function with( TaxCode|string|null $taxCode = null, ?string $taxRate = null, ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $baseAmount && $obj['baseAmount'] = $baseAmount; - null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; - null !== $reason && $obj['reason'] = $reason; - null !== $reasonCode && $obj['reasonCode'] = $reasonCode; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxRate && $obj['taxRate'] = $taxRate; + null !== $amount && $self['amount'] = $amount; + null !== $baseAmount && $self['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $self['multiplierFactor'] = $multiplierFactor; + null !== $reason && $self['reason'] = $reason; + null !== $reasonCode && $self['reasonCode'] = $reasonCode; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxRate && $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -118,10 +118,10 @@ public static function with( */ public function withAmount(?string $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -129,10 +129,10 @@ public function withAmount(?string $amount): self */ public function withBaseAmount(?string $baseAmount): self { - $obj = clone $this; - $obj['baseAmount'] = $baseAmount; + $self = clone $this; + $self['baseAmount'] = $baseAmount; - return $obj; + return $self; } /** @@ -140,10 +140,10 @@ public function withBaseAmount(?string $baseAmount): self */ public function withMultiplierFactor(?string $multiplierFactor): self { - $obj = clone $this; - $obj['multiplierFactor'] = $multiplierFactor; + $self = clone $this; + $self['multiplierFactor'] = $multiplierFactor; - return $obj; + return $self; } /** @@ -151,10 +151,10 @@ public function withMultiplierFactor(?string $multiplierFactor): self */ public function withReason(?string $reason): self { - $obj = clone $this; - $obj['reason'] = $reason; + $self = clone $this; + $self['reason'] = $reason; - return $obj; + return $self; } /** @@ -164,10 +164,10 @@ public function withReason(?string $reason): self */ public function withReasonCode(ReasonCode|string|null $reasonCode): self { - $obj = clone $this; - $obj['reasonCode'] = $reasonCode; + $self = clone $this; + $self['reasonCode'] = $reasonCode; - return $obj; + return $self; } /** @@ -181,10 +181,10 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self */ public function withTaxCode(TaxCode|string|null $taxCode): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -192,9 +192,9 @@ public function withTaxCode(TaxCode|string|null $taxCode): self */ public function withTaxRate(?string $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentAttachmentCreate.php b/src/Documents/DocumentAttachmentCreate.php index 1fa7ba68..5127212d 100644 --- a/src/Documents/DocumentAttachmentCreate.php +++ b/src/Documents/DocumentAttachmentCreate.php @@ -67,23 +67,23 @@ public static function with( ?int $fileSize = null, ?string $fileType = null, ): self { - $obj = new self; + $self = new self; - $obj['fileName'] = $fileName; + $self['fileName'] = $fileName; - null !== $fileData && $obj['fileData'] = $fileData; - null !== $fileSize && $obj['fileSize'] = $fileSize; - null !== $fileType && $obj['fileType'] = $fileType; + null !== $fileData && $self['fileData'] = $fileData; + null !== $fileSize && $self['fileSize'] = $fileSize; + null !== $fileType && $self['fileType'] = $fileType; - return $obj; + return $self; } public function withFileName(string $fileName): self { - $obj = clone $this; - $obj['fileName'] = $fileName; + $self = clone $this; + $self['fileName'] = $fileName; - return $obj; + return $self; } /** @@ -91,25 +91,25 @@ public function withFileName(string $fileName): self */ public function withFileData(?string $fileData): self { - $obj = clone $this; - $obj['fileData'] = $fileData; + $self = clone $this; + $self['fileData'] = $fileData; - return $obj; + return $self; } public function withFileSize(int $fileSize): self { - $obj = clone $this; - $obj['fileSize'] = $fileSize; + $self = clone $this; + $self['fileSize'] = $fileSize; - return $obj; + return $self; } public function withFileType(string $fileType): self { - $obj = clone $this; - $obj['fileType'] = $fileType; + $self = clone $this; + $self['fileType'] = $fileType; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentCreate.php b/src/Documents/DocumentCreate.php index cb8ecdd7..b053e149 100644 --- a/src/Documents/DocumentCreate.php +++ b/src/Documents/DocumentCreate.php @@ -491,58 +491,58 @@ public static function with( ?string $vendorName = null, ?string $vendorTaxID = null, ): self { - $obj = new self; - - null !== $allowances && $obj['allowances'] = $allowances; - null !== $amountDue && $obj['amountDue'] = $amountDue; - null !== $attachments && $obj['attachments'] = $attachments; - null !== $billingAddress && $obj['billingAddress'] = $billingAddress; - null !== $billingAddressRecipient && $obj['billingAddressRecipient'] = $billingAddressRecipient; - null !== $charges && $obj['charges'] = $charges; - null !== $currency && $obj['currency'] = $currency; - null !== $customerAddress && $obj['customerAddress'] = $customerAddress; - null !== $customerAddressRecipient && $obj['customerAddressRecipient'] = $customerAddressRecipient; - null !== $customerCompanyID && $obj['customerCompanyID'] = $customerCompanyID; - null !== $customerEmail && $obj['customerEmail'] = $customerEmail; - null !== $customerID && $obj['customerID'] = $customerID; - null !== $customerName && $obj['customerName'] = $customerName; - null !== $customerTaxID && $obj['customerTaxID'] = $customerTaxID; - null !== $direction && $obj['direction'] = $direction; - null !== $documentType && $obj['documentType'] = $documentType; - null !== $dueDate && $obj['dueDate'] = $dueDate; - null !== $invoiceDate && $obj['invoiceDate'] = $invoiceDate; - null !== $invoiceID && $obj['invoiceID'] = $invoiceID; - null !== $invoiceTotal && $obj['invoiceTotal'] = $invoiceTotal; - null !== $items && $obj['items'] = $items; - null !== $note && $obj['note'] = $note; - null !== $paymentDetails && $obj['paymentDetails'] = $paymentDetails; - null !== $paymentTerm && $obj['paymentTerm'] = $paymentTerm; - null !== $previousUnpaidBalance && $obj['previousUnpaidBalance'] = $previousUnpaidBalance; - null !== $purchaseOrder && $obj['purchaseOrder'] = $purchaseOrder; - null !== $remittanceAddress && $obj['remittanceAddress'] = $remittanceAddress; - null !== $remittanceAddressRecipient && $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; - null !== $serviceAddress && $obj['serviceAddress'] = $serviceAddress; - null !== $serviceAddressRecipient && $obj['serviceAddressRecipient'] = $serviceAddressRecipient; - null !== $serviceEndDate && $obj['serviceEndDate'] = $serviceEndDate; - null !== $serviceStartDate && $obj['serviceStartDate'] = $serviceStartDate; - null !== $shippingAddress && $obj['shippingAddress'] = $shippingAddress; - null !== $shippingAddressRecipient && $obj['shippingAddressRecipient'] = $shippingAddressRecipient; - null !== $state && $obj['state'] = $state; - null !== $subtotal && $obj['subtotal'] = $subtotal; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxDetails && $obj['taxDetails'] = $taxDetails; - null !== $totalDiscount && $obj['totalDiscount'] = $totalDiscount; - null !== $totalTax && $obj['totalTax'] = $totalTax; - null !== $vatex && $obj['vatex'] = $vatex; - null !== $vatexNote && $obj['vatexNote'] = $vatexNote; - null !== $vendorAddress && $obj['vendorAddress'] = $vendorAddress; - null !== $vendorAddressRecipient && $obj['vendorAddressRecipient'] = $vendorAddressRecipient; - null !== $vendorCompanyID && $obj['vendorCompanyID'] = $vendorCompanyID; - null !== $vendorEmail && $obj['vendorEmail'] = $vendorEmail; - null !== $vendorName && $obj['vendorName'] = $vendorName; - null !== $vendorTaxID && $obj['vendorTaxID'] = $vendorTaxID; - - return $obj; + $self = new self; + + null !== $allowances && $self['allowances'] = $allowances; + null !== $amountDue && $self['amountDue'] = $amountDue; + null !== $attachments && $self['attachments'] = $attachments; + null !== $billingAddress && $self['billingAddress'] = $billingAddress; + null !== $billingAddressRecipient && $self['billingAddressRecipient'] = $billingAddressRecipient; + null !== $charges && $self['charges'] = $charges; + null !== $currency && $self['currency'] = $currency; + null !== $customerAddress && $self['customerAddress'] = $customerAddress; + null !== $customerAddressRecipient && $self['customerAddressRecipient'] = $customerAddressRecipient; + null !== $customerCompanyID && $self['customerCompanyID'] = $customerCompanyID; + null !== $customerEmail && $self['customerEmail'] = $customerEmail; + null !== $customerID && $self['customerID'] = $customerID; + null !== $customerName && $self['customerName'] = $customerName; + null !== $customerTaxID && $self['customerTaxID'] = $customerTaxID; + null !== $direction && $self['direction'] = $direction; + null !== $documentType && $self['documentType'] = $documentType; + null !== $dueDate && $self['dueDate'] = $dueDate; + null !== $invoiceDate && $self['invoiceDate'] = $invoiceDate; + null !== $invoiceID && $self['invoiceID'] = $invoiceID; + null !== $invoiceTotal && $self['invoiceTotal'] = $invoiceTotal; + null !== $items && $self['items'] = $items; + null !== $note && $self['note'] = $note; + null !== $paymentDetails && $self['paymentDetails'] = $paymentDetails; + null !== $paymentTerm && $self['paymentTerm'] = $paymentTerm; + null !== $previousUnpaidBalance && $self['previousUnpaidBalance'] = $previousUnpaidBalance; + null !== $purchaseOrder && $self['purchaseOrder'] = $purchaseOrder; + null !== $remittanceAddress && $self['remittanceAddress'] = $remittanceAddress; + null !== $remittanceAddressRecipient && $self['remittanceAddressRecipient'] = $remittanceAddressRecipient; + null !== $serviceAddress && $self['serviceAddress'] = $serviceAddress; + null !== $serviceAddressRecipient && $self['serviceAddressRecipient'] = $serviceAddressRecipient; + null !== $serviceEndDate && $self['serviceEndDate'] = $serviceEndDate; + null !== $serviceStartDate && $self['serviceStartDate'] = $serviceStartDate; + null !== $shippingAddress && $self['shippingAddress'] = $shippingAddress; + null !== $shippingAddressRecipient && $self['shippingAddressRecipient'] = $shippingAddressRecipient; + null !== $state && $self['state'] = $state; + null !== $subtotal && $self['subtotal'] = $subtotal; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxDetails && $self['taxDetails'] = $taxDetails; + null !== $totalDiscount && $self['totalDiscount'] = $totalDiscount; + null !== $totalTax && $self['totalTax'] = $totalTax; + null !== $vatex && $self['vatex'] = $vatex; + null !== $vatexNote && $self['vatexNote'] = $vatexNote; + null !== $vendorAddress && $self['vendorAddress'] = $vendorAddress; + null !== $vendorAddressRecipient && $self['vendorAddressRecipient'] = $vendorAddressRecipient; + null !== $vendorCompanyID && $self['vendorCompanyID'] = $vendorCompanyID; + null !== $vendorEmail && $self['vendorEmail'] = $vendorEmail; + null !== $vendorName && $self['vendorName'] = $vendorName; + null !== $vendorTaxID && $self['vendorTaxID'] = $vendorTaxID; + + return $self; } /** @@ -558,10 +558,10 @@ public static function with( */ public function withAllowances(?array $allowances): self { - $obj = clone $this; - $obj['allowances'] = $allowances; + $self = clone $this; + $self['allowances'] = $allowances; - return $obj; + return $self; } /** @@ -569,10 +569,10 @@ public function withAllowances(?array $allowances): self */ public function withAmountDue(float|string|null $amountDue): self { - $obj = clone $this; - $obj['amountDue'] = $amountDue; + $self = clone $this; + $self['amountDue'] = $amountDue; - return $obj; + return $self; } /** @@ -585,10 +585,10 @@ public function withAmountDue(float|string|null $amountDue): self */ public function withAttachments(?array $attachments): self { - $obj = clone $this; - $obj['attachments'] = $attachments; + $self = clone $this; + $self['attachments'] = $attachments; - return $obj; + return $self; } /** @@ -596,10 +596,10 @@ public function withAttachments(?array $attachments): self */ public function withBillingAddress(?string $billingAddress): self { - $obj = clone $this; - $obj['billingAddress'] = $billingAddress; + $self = clone $this; + $self['billingAddress'] = $billingAddress; - return $obj; + return $self; } /** @@ -608,10 +608,10 @@ public function withBillingAddress(?string $billingAddress): self public function withBillingAddressRecipient( ?string $billingAddressRecipient ): self { - $obj = clone $this; - $obj['billingAddressRecipient'] = $billingAddressRecipient; + $self = clone $this; + $self['billingAddressRecipient'] = $billingAddressRecipient; - return $obj; + return $self; } /** @@ -627,10 +627,10 @@ public function withBillingAddressRecipient( */ public function withCharges(?array $charges): self { - $obj = clone $this; - $obj['charges'] = $charges; + $self = clone $this; + $self['charges'] = $charges; - return $obj; + return $self; } /** @@ -640,10 +640,10 @@ public function withCharges(?array $charges): self */ public function withCurrency(CurrencyCode|string $currency): self { - $obj = clone $this; - $obj['currency'] = $currency; + $self = clone $this; + $self['currency'] = $currency; - return $obj; + return $self; } /** @@ -651,10 +651,10 @@ public function withCurrency(CurrencyCode|string $currency): self */ public function withCustomerAddress(?string $customerAddress): self { - $obj = clone $this; - $obj['customerAddress'] = $customerAddress; + $self = clone $this; + $self['customerAddress'] = $customerAddress; - return $obj; + return $self; } /** @@ -663,10 +663,10 @@ public function withCustomerAddress(?string $customerAddress): self public function withCustomerAddressRecipient( ?string $customerAddressRecipient ): self { - $obj = clone $this; - $obj['customerAddressRecipient'] = $customerAddressRecipient; + $self = clone $this; + $self['customerAddressRecipient'] = $customerAddressRecipient; - return $obj; + return $self; } /** @@ -674,10 +674,10 @@ public function withCustomerAddressRecipient( */ public function withCustomerCompanyID(?string $customerCompanyID): self { - $obj = clone $this; - $obj['customerCompanyID'] = $customerCompanyID; + $self = clone $this; + $self['customerCompanyID'] = $customerCompanyID; - return $obj; + return $self; } /** @@ -685,10 +685,10 @@ public function withCustomerCompanyID(?string $customerCompanyID): self */ public function withCustomerEmail(?string $customerEmail): self { - $obj = clone $this; - $obj['customerEmail'] = $customerEmail; + $self = clone $this; + $self['customerEmail'] = $customerEmail; - return $obj; + return $self; } /** @@ -696,10 +696,10 @@ public function withCustomerEmail(?string $customerEmail): self */ public function withCustomerID(?string $customerID): self { - $obj = clone $this; - $obj['customerID'] = $customerID; + $self = clone $this; + $self['customerID'] = $customerID; - return $obj; + return $self; } /** @@ -707,10 +707,10 @@ public function withCustomerID(?string $customerID): self */ public function withCustomerName(?string $customerName): self { - $obj = clone $this; - $obj['customerName'] = $customerName; + $self = clone $this; + $self['customerName'] = $customerName; - return $obj; + return $self; } /** @@ -718,10 +718,10 @@ public function withCustomerName(?string $customerName): self */ public function withCustomerTaxID(?string $customerTaxID): self { - $obj = clone $this; - $obj['customerTaxID'] = $customerTaxID; + $self = clone $this; + $self['customerTaxID'] = $customerTaxID; - return $obj; + return $self; } /** @@ -731,10 +731,10 @@ public function withCustomerTaxID(?string $customerTaxID): self */ public function withDirection(DocumentDirection|string $direction): self { - $obj = clone $this; - $obj['direction'] = $direction; + $self = clone $this; + $self['direction'] = $direction; - return $obj; + return $self; } /** @@ -744,10 +744,10 @@ public function withDirection(DocumentDirection|string $direction): self */ public function withDocumentType(DocumentType|string $documentType): self { - $obj = clone $this; - $obj['documentType'] = $documentType; + $self = clone $this; + $self['documentType'] = $documentType; - return $obj; + return $self; } /** @@ -755,10 +755,10 @@ public function withDocumentType(DocumentType|string $documentType): self */ public function withDueDate(?\DateTimeInterface $dueDate): self { - $obj = clone $this; - $obj['dueDate'] = $dueDate; + $self = clone $this; + $self['dueDate'] = $dueDate; - return $obj; + return $self; } /** @@ -766,10 +766,10 @@ public function withDueDate(?\DateTimeInterface $dueDate): self */ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self { - $obj = clone $this; - $obj['invoiceDate'] = $invoiceDate; + $self = clone $this; + $self['invoiceDate'] = $invoiceDate; - return $obj; + return $self; } /** @@ -777,10 +777,10 @@ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self */ public function withInvoiceID(?string $invoiceID): self { - $obj = clone $this; - $obj['invoiceID'] = $invoiceID; + $self = clone $this; + $self['invoiceID'] = $invoiceID; - return $obj; + return $self; } /** @@ -788,10 +788,10 @@ public function withInvoiceID(?string $invoiceID): self */ public function withInvoiceTotal(float|string|null $invoiceTotal): self { - $obj = clone $this; - $obj['invoiceTotal'] = $invoiceTotal; + $self = clone $this; + $self['invoiceTotal'] = $invoiceTotal; - return $obj; + return $self; } /** @@ -813,10 +813,10 @@ public function withInvoiceTotal(float|string|null $invoiceTotal): self */ public function withItems(array $items): self { - $obj = clone $this; - $obj['items'] = $items; + $self = clone $this; + $self['items'] = $items; - return $obj; + return $self; } /** @@ -824,10 +824,10 @@ public function withItems(array $items): self */ public function withNote(?string $note): self { - $obj = clone $this; - $obj['note'] = $note; + $self = clone $this; + $self['note'] = $note; - return $obj; + return $self; } /** @@ -840,10 +840,10 @@ public function withNote(?string $note): self */ public function withPaymentDetails(?array $paymentDetails): self { - $obj = clone $this; - $obj['paymentDetails'] = $paymentDetails; + $self = clone $this; + $self['paymentDetails'] = $paymentDetails; - return $obj; + return $self; } /** @@ -851,10 +851,10 @@ public function withPaymentDetails(?array $paymentDetails): self */ public function withPaymentTerm(?string $paymentTerm): self { - $obj = clone $this; - $obj['paymentTerm'] = $paymentTerm; + $self = clone $this; + $self['paymentTerm'] = $paymentTerm; - return $obj; + return $self; } /** @@ -863,10 +863,10 @@ public function withPaymentTerm(?string $paymentTerm): self public function withPreviousUnpaidBalance( float|string|null $previousUnpaidBalance ): self { - $obj = clone $this; - $obj['previousUnpaidBalance'] = $previousUnpaidBalance; + $self = clone $this; + $self['previousUnpaidBalance'] = $previousUnpaidBalance; - return $obj; + return $self; } /** @@ -874,10 +874,10 @@ public function withPreviousUnpaidBalance( */ public function withPurchaseOrder(?string $purchaseOrder): self { - $obj = clone $this; - $obj['purchaseOrder'] = $purchaseOrder; + $self = clone $this; + $self['purchaseOrder'] = $purchaseOrder; - return $obj; + return $self; } /** @@ -885,10 +885,10 @@ public function withPurchaseOrder(?string $purchaseOrder): self */ public function withRemittanceAddress(?string $remittanceAddress): self { - $obj = clone $this; - $obj['remittanceAddress'] = $remittanceAddress; + $self = clone $this; + $self['remittanceAddress'] = $remittanceAddress; - return $obj; + return $self; } /** @@ -897,10 +897,10 @@ public function withRemittanceAddress(?string $remittanceAddress): self public function withRemittanceAddressRecipient( ?string $remittanceAddressRecipient ): self { - $obj = clone $this; - $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; + $self = clone $this; + $self['remittanceAddressRecipient'] = $remittanceAddressRecipient; - return $obj; + return $self; } /** @@ -908,10 +908,10 @@ public function withRemittanceAddressRecipient( */ public function withServiceAddress(?string $serviceAddress): self { - $obj = clone $this; - $obj['serviceAddress'] = $serviceAddress; + $self = clone $this; + $self['serviceAddress'] = $serviceAddress; - return $obj; + return $self; } /** @@ -920,10 +920,10 @@ public function withServiceAddress(?string $serviceAddress): self public function withServiceAddressRecipient( ?string $serviceAddressRecipient ): self { - $obj = clone $this; - $obj['serviceAddressRecipient'] = $serviceAddressRecipient; + $self = clone $this; + $self['serviceAddressRecipient'] = $serviceAddressRecipient; - return $obj; + return $self; } /** @@ -932,10 +932,10 @@ public function withServiceAddressRecipient( public function withServiceEndDate( ?\DateTimeInterface $serviceEndDate ): self { - $obj = clone $this; - $obj['serviceEndDate'] = $serviceEndDate; + $self = clone $this; + $self['serviceEndDate'] = $serviceEndDate; - return $obj; + return $self; } /** @@ -944,10 +944,10 @@ public function withServiceEndDate( public function withServiceStartDate( ?\DateTimeInterface $serviceStartDate ): self { - $obj = clone $this; - $obj['serviceStartDate'] = $serviceStartDate; + $self = clone $this; + $self['serviceStartDate'] = $serviceStartDate; - return $obj; + return $self; } /** @@ -955,10 +955,10 @@ public function withServiceStartDate( */ public function withShippingAddress(?string $shippingAddress): self { - $obj = clone $this; - $obj['shippingAddress'] = $shippingAddress; + $self = clone $this; + $self['shippingAddress'] = $shippingAddress; - return $obj; + return $self; } /** @@ -967,10 +967,10 @@ public function withShippingAddress(?string $shippingAddress): self public function withShippingAddressRecipient( ?string $shippingAddressRecipient ): self { - $obj = clone $this; - $obj['shippingAddressRecipient'] = $shippingAddressRecipient; + $self = clone $this; + $self['shippingAddressRecipient'] = $shippingAddressRecipient; - return $obj; + return $self; } /** @@ -980,10 +980,10 @@ public function withShippingAddressRecipient( */ public function withState(DocumentState|string $state): self { - $obj = clone $this; - $obj['state'] = $state; + $self = clone $this; + $self['state'] = $state; - return $obj; + return $self; } /** @@ -991,10 +991,10 @@ public function withState(DocumentState|string $state): self */ public function withSubtotal(float|string|null $subtotal): self { - $obj = clone $this; - $obj['subtotal'] = $subtotal; + $self = clone $this; + $self['subtotal'] = $subtotal; - return $obj; + return $self; } /** @@ -1004,10 +1004,10 @@ public function withSubtotal(float|string|null $subtotal): self */ public function withTaxCode(TaxCode|string $taxCode): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -1017,10 +1017,10 @@ public function withTaxCode(TaxCode|string $taxCode): self */ public function withTaxDetails(?array $taxDetails): self { - $obj = clone $this; - $obj['taxDetails'] = $taxDetails; + $self = clone $this; + $self['taxDetails'] = $taxDetails; - return $obj; + return $self; } /** @@ -1028,10 +1028,10 @@ public function withTaxDetails(?array $taxDetails): self */ public function withTotalDiscount(float|string|null $totalDiscount): self { - $obj = clone $this; - $obj['totalDiscount'] = $totalDiscount; + $self = clone $this; + $self['totalDiscount'] = $totalDiscount; - return $obj; + return $self; } /** @@ -1039,10 +1039,10 @@ public function withTotalDiscount(float|string|null $totalDiscount): self */ public function withTotalTax(float|string|null $totalTax): self { - $obj = clone $this; - $obj['totalTax'] = $totalTax; + $self = clone $this; + $self['totalTax'] = $totalTax; - return $obj; + return $self; } /** @@ -1055,10 +1055,10 @@ public function withTotalTax(float|string|null $totalTax): self */ public function withVatex(Vatex|string|null $vatex): self { - $obj = clone $this; - $obj['vatex'] = $vatex; + $self = clone $this; + $self['vatex'] = $vatex; - return $obj; + return $self; } /** @@ -1066,10 +1066,10 @@ public function withVatex(Vatex|string|null $vatex): self */ public function withVatexNote(?string $vatexNote): self { - $obj = clone $this; - $obj['vatexNote'] = $vatexNote; + $self = clone $this; + $self['vatexNote'] = $vatexNote; - return $obj; + return $self; } /** @@ -1077,10 +1077,10 @@ public function withVatexNote(?string $vatexNote): self */ public function withVendorAddress(?string $vendorAddress): self { - $obj = clone $this; - $obj['vendorAddress'] = $vendorAddress; + $self = clone $this; + $self['vendorAddress'] = $vendorAddress; - return $obj; + return $self; } /** @@ -1089,10 +1089,10 @@ public function withVendorAddress(?string $vendorAddress): self public function withVendorAddressRecipient( ?string $vendorAddressRecipient ): self { - $obj = clone $this; - $obj['vendorAddressRecipient'] = $vendorAddressRecipient; + $self = clone $this; + $self['vendorAddressRecipient'] = $vendorAddressRecipient; - return $obj; + return $self; } /** @@ -1100,10 +1100,10 @@ public function withVendorAddressRecipient( */ public function withVendorCompanyID(?string $vendorCompanyID): self { - $obj = clone $this; - $obj['vendorCompanyID'] = $vendorCompanyID; + $self = clone $this; + $self['vendorCompanyID'] = $vendorCompanyID; - return $obj; + return $self; } /** @@ -1111,10 +1111,10 @@ public function withVendorCompanyID(?string $vendorCompanyID): self */ public function withVendorEmail(?string $vendorEmail): self { - $obj = clone $this; - $obj['vendorEmail'] = $vendorEmail; + $self = clone $this; + $self['vendorEmail'] = $vendorEmail; - return $obj; + return $self; } /** @@ -1122,10 +1122,10 @@ public function withVendorEmail(?string $vendorEmail): self */ public function withVendorName(?string $vendorName): self { - $obj = clone $this; - $obj['vendorName'] = $vendorName; + $self = clone $this; + $self['vendorName'] = $vendorName; - return $obj; + return $self; } /** @@ -1133,9 +1133,9 @@ public function withVendorName(?string $vendorName): self */ public function withVendorTaxID(?string $vendorTaxID): self { - $obj = clone $this; - $obj['vendorTaxID'] = $vendorTaxID; + $self = clone $this; + $self['vendorTaxID'] = $vendorTaxID; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentCreate/Allowance.php b/src/Documents/DocumentCreate/Allowance.php index ab61142d..baa0db57 100644 --- a/src/Documents/DocumentCreate/Allowance.php +++ b/src/Documents/DocumentCreate/Allowance.php @@ -99,17 +99,17 @@ public static function with( TaxCode|string|null $taxCode = null, float|string|null $taxRate = null, ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $baseAmount && $obj['baseAmount'] = $baseAmount; - null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; - null !== $reason && $obj['reason'] = $reason; - null !== $reasonCode && $obj['reasonCode'] = $reasonCode; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxRate && $obj['taxRate'] = $taxRate; + null !== $amount && $self['amount'] = $amount; + null !== $baseAmount && $self['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $self['multiplierFactor'] = $multiplierFactor; + null !== $reason && $self['reason'] = $reason; + null !== $reasonCode && $self['reasonCode'] = $reasonCode; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxRate && $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -117,10 +117,10 @@ public static function with( */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -128,10 +128,10 @@ public function withAmount(float|string|null $amount): self */ public function withBaseAmount(float|string|null $baseAmount): self { - $obj = clone $this; - $obj['baseAmount'] = $baseAmount; + $self = clone $this; + $self['baseAmount'] = $baseAmount; - return $obj; + return $self; } /** @@ -140,10 +140,10 @@ public function withBaseAmount(float|string|null $baseAmount): self public function withMultiplierFactor( float|string|null $multiplierFactor ): self { - $obj = clone $this; - $obj['multiplierFactor'] = $multiplierFactor; + $self = clone $this; + $self['multiplierFactor'] = $multiplierFactor; - return $obj; + return $self; } /** @@ -151,10 +151,10 @@ public function withMultiplierFactor( */ public function withReason(?string $reason): self { - $obj = clone $this; - $obj['reason'] = $reason; + $self = clone $this; + $self['reason'] = $reason; - return $obj; + return $self; } /** @@ -164,10 +164,10 @@ public function withReason(?string $reason): self */ public function withReasonCode(ReasonCode|string|null $reasonCode): self { - $obj = clone $this; - $obj['reasonCode'] = $reasonCode; + $self = clone $this; + $self['reasonCode'] = $reasonCode; - return $obj; + return $self; } /** @@ -178,10 +178,10 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self public function withTaxCode( TaxCode|string $taxCode ): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -189,9 +189,9 @@ public function withTaxCode( */ public function withTaxRate(float|string|null $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentCreate/Charge.php b/src/Documents/DocumentCreate/Charge.php index 48a63e1b..43b41379 100644 --- a/src/Documents/DocumentCreate/Charge.php +++ b/src/Documents/DocumentCreate/Charge.php @@ -104,17 +104,17 @@ public static function with( TaxCode|string|null $taxCode = null, float|string|null $taxRate = null, ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $baseAmount && $obj['baseAmount'] = $baseAmount; - null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; - null !== $reason && $obj['reason'] = $reason; - null !== $reasonCode && $obj['reasonCode'] = $reasonCode; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxRate && $obj['taxRate'] = $taxRate; + null !== $amount && $self['amount'] = $amount; + null !== $baseAmount && $self['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $self['multiplierFactor'] = $multiplierFactor; + null !== $reason && $self['reason'] = $reason; + null !== $reasonCode && $self['reasonCode'] = $reasonCode; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxRate && $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -122,10 +122,10 @@ public static function with( */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -133,10 +133,10 @@ public function withAmount(float|string|null $amount): self */ public function withBaseAmount(float|string|null $baseAmount): self { - $obj = clone $this; - $obj['baseAmount'] = $baseAmount; + $self = clone $this; + $self['baseAmount'] = $baseAmount; - return $obj; + return $self; } /** @@ -145,10 +145,10 @@ public function withBaseAmount(float|string|null $baseAmount): self public function withMultiplierFactor( float|string|null $multiplierFactor ): self { - $obj = clone $this; - $obj['multiplierFactor'] = $multiplierFactor; + $self = clone $this; + $self['multiplierFactor'] = $multiplierFactor; - return $obj; + return $self; } /** @@ -156,10 +156,10 @@ public function withMultiplierFactor( */ public function withReason(?string $reason): self { - $obj = clone $this; - $obj['reason'] = $reason; + $self = clone $this; + $self['reason'] = $reason; - return $obj; + return $self; } /** @@ -169,10 +169,10 @@ public function withReason(?string $reason): self */ public function withReasonCode(ReasonCode|string|null $reasonCode): self { - $obj = clone $this; - $obj['reasonCode'] = $reasonCode; + $self = clone $this; + $self['reasonCode'] = $reasonCode; - return $obj; + return $self; } /** @@ -187,10 +187,10 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self public function withTaxCode( TaxCode|string|null $taxCode ): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -198,9 +198,9 @@ public function withTaxCode( */ public function withTaxRate(float|string|null $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentCreate/Item.php b/src/Documents/DocumentCreate/Item.php index 7a62b6fc..64e7e2e9 100644 --- a/src/Documents/DocumentCreate/Item.php +++ b/src/Documents/DocumentCreate/Item.php @@ -152,22 +152,22 @@ public static function with( UnitOfMeasureCode|string|null $unit = null, float|string|null $unitPrice = null, ): self { - $obj = new self; - - $obj['date'] = $date; - - null !== $allowances && $obj['allowances'] = $allowances; - null !== $amount && $obj['amount'] = $amount; - null !== $charges && $obj['charges'] = $charges; - null !== $description && $obj['description'] = $description; - null !== $productCode && $obj['productCode'] = $productCode; - null !== $quantity && $obj['quantity'] = $quantity; - null !== $tax && $obj['tax'] = $tax; - null !== $taxRate && $obj['taxRate'] = $taxRate; - null !== $unit && $obj['unit'] = $unit; - null !== $unitPrice && $obj['unitPrice'] = $unitPrice; - - return $obj; + $self = new self; + + $self['date'] = $date; + + null !== $allowances && $self['allowances'] = $allowances; + null !== $amount && $self['amount'] = $amount; + null !== $charges && $self['charges'] = $charges; + null !== $description && $self['description'] = $description; + null !== $productCode && $self['productCode'] = $productCode; + null !== $quantity && $self['quantity'] = $quantity; + null !== $tax && $self['tax'] = $tax; + null !== $taxRate && $self['taxRate'] = $taxRate; + null !== $unit && $self['unit'] = $unit; + null !== $unitPrice && $self['unitPrice'] = $unitPrice; + + return $self; } /** @@ -185,10 +185,10 @@ public static function with( */ public function withAllowances(?array $allowances): self { - $obj = clone $this; - $obj['allowances'] = $allowances; + $self = clone $this; + $self['allowances'] = $allowances; - return $obj; + return $self; } /** @@ -196,10 +196,10 @@ public function withAllowances(?array $allowances): self */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -217,10 +217,10 @@ public function withAmount(float|string|null $amount): self */ public function withCharges(?array $charges): self { - $obj = clone $this; - $obj['charges'] = $charges; + $self = clone $this; + $self['charges'] = $charges; - return $obj; + return $self; } /** @@ -228,10 +228,10 @@ public function withCharges(?array $charges): self */ public function withDate(null $date): self { - $obj = clone $this; - $obj['date'] = $date; + $self = clone $this; + $self['date'] = $date; - return $obj; + return $self; } /** @@ -239,10 +239,10 @@ public function withDate(null $date): self */ public function withDescription(?string $description): self { - $obj = clone $this; - $obj['description'] = $description; + $self = clone $this; + $self['description'] = $description; - return $obj; + return $self; } /** @@ -250,10 +250,10 @@ public function withDescription(?string $description): self */ public function withProductCode(?string $productCode): self { - $obj = clone $this; - $obj['productCode'] = $productCode; + $self = clone $this; + $self['productCode'] = $productCode; - return $obj; + return $self; } /** @@ -261,10 +261,10 @@ public function withProductCode(?string $productCode): self */ public function withQuantity(float|string|null $quantity): self { - $obj = clone $this; - $obj['quantity'] = $quantity; + $self = clone $this; + $self['quantity'] = $quantity; - return $obj; + return $self; } /** @@ -272,10 +272,10 @@ public function withQuantity(float|string|null $quantity): self */ public function withTax(float|string|null $tax): self { - $obj = clone $this; - $obj['tax'] = $tax; + $self = clone $this; + $self['tax'] = $tax; - return $obj; + return $self; } /** @@ -283,10 +283,10 @@ public function withTax(float|string|null $tax): self */ public function withTaxRate(float|string|null $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -296,10 +296,10 @@ public function withTaxRate(float|string|null $taxRate): self */ public function withUnit(UnitOfMeasureCode|string|null $unit): self { - $obj = clone $this; - $obj['unit'] = $unit; + $self = clone $this; + $self['unit'] = $unit; - return $obj; + return $self; } /** @@ -307,9 +307,9 @@ public function withUnit(UnitOfMeasureCode|string|null $unit): self */ public function withUnitPrice(float|string|null $unitPrice): self { - $obj = clone $this; - $obj['unitPrice'] = $unitPrice; + $self = clone $this; + $self['unitPrice'] = $unitPrice; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentCreate/Item/Allowance.php b/src/Documents/DocumentCreate/Item/Allowance.php index 78d315bc..a690579d 100644 --- a/src/Documents/DocumentCreate/Item/Allowance.php +++ b/src/Documents/DocumentCreate/Item/Allowance.php @@ -96,17 +96,17 @@ public static function with( TaxCode|string|null $taxCode = null, float|string|null $taxRate = null, ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $baseAmount && $obj['baseAmount'] = $baseAmount; - null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; - null !== $reason && $obj['reason'] = $reason; - null !== $reasonCode && $obj['reasonCode'] = $reasonCode; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxRate && $obj['taxRate'] = $taxRate; + null !== $amount && $self['amount'] = $amount; + null !== $baseAmount && $self['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $self['multiplierFactor'] = $multiplierFactor; + null !== $reason && $self['reason'] = $reason; + null !== $reasonCode && $self['reasonCode'] = $reasonCode; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxRate && $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -114,10 +114,10 @@ public static function with( */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -125,10 +125,10 @@ public function withAmount(float|string|null $amount): self */ public function withBaseAmount(float|string|null $baseAmount): self { - $obj = clone $this; - $obj['baseAmount'] = $baseAmount; + $self = clone $this; + $self['baseAmount'] = $baseAmount; - return $obj; + return $self; } /** @@ -137,10 +137,10 @@ public function withBaseAmount(float|string|null $baseAmount): self public function withMultiplierFactor( float|string|null $multiplierFactor ): self { - $obj = clone $this; - $obj['multiplierFactor'] = $multiplierFactor; + $self = clone $this; + $self['multiplierFactor'] = $multiplierFactor; - return $obj; + return $self; } /** @@ -148,10 +148,10 @@ public function withMultiplierFactor( */ public function withReason(?string $reason): self { - $obj = clone $this; - $obj['reason'] = $reason; + $self = clone $this; + $self['reason'] = $reason; - return $obj; + return $self; } /** @@ -161,10 +161,10 @@ public function withReason(?string $reason): self */ public function withReasonCode(ReasonCode|string|null $reasonCode): self { - $obj = clone $this; - $obj['reasonCode'] = $reasonCode; + $self = clone $this; + $self['reasonCode'] = $reasonCode; - return $obj; + return $self; } /** @@ -174,10 +174,10 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self */ public function withTaxCode(TaxCode|string $taxCode): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -185,9 +185,9 @@ public function withTaxCode(TaxCode|string $taxCode): self */ public function withTaxRate(float|string|null $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentCreate/Item/Charge.php b/src/Documents/DocumentCreate/Item/Charge.php index da32a271..18c79867 100644 --- a/src/Documents/DocumentCreate/Item/Charge.php +++ b/src/Documents/DocumentCreate/Item/Charge.php @@ -100,17 +100,17 @@ public static function with( TaxCode|string|null $taxCode = null, float|string|null $taxRate = null, ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $baseAmount && $obj['baseAmount'] = $baseAmount; - null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; - null !== $reason && $obj['reason'] = $reason; - null !== $reasonCode && $obj['reasonCode'] = $reasonCode; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxRate && $obj['taxRate'] = $taxRate; + null !== $amount && $self['amount'] = $amount; + null !== $baseAmount && $self['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $self['multiplierFactor'] = $multiplierFactor; + null !== $reason && $self['reason'] = $reason; + null !== $reasonCode && $self['reasonCode'] = $reasonCode; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxRate && $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -118,10 +118,10 @@ public static function with( */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -129,10 +129,10 @@ public function withAmount(float|string|null $amount): self */ public function withBaseAmount(float|string|null $baseAmount): self { - $obj = clone $this; - $obj['baseAmount'] = $baseAmount; + $self = clone $this; + $self['baseAmount'] = $baseAmount; - return $obj; + return $self; } /** @@ -141,10 +141,10 @@ public function withBaseAmount(float|string|null $baseAmount): self public function withMultiplierFactor( float|string|null $multiplierFactor ): self { - $obj = clone $this; - $obj['multiplierFactor'] = $multiplierFactor; + $self = clone $this; + $self['multiplierFactor'] = $multiplierFactor; - return $obj; + return $self; } /** @@ -152,10 +152,10 @@ public function withMultiplierFactor( */ public function withReason(?string $reason): self { - $obj = clone $this; - $obj['reason'] = $reason; + $self = clone $this; + $self['reason'] = $reason; - return $obj; + return $self; } /** @@ -165,10 +165,10 @@ public function withReason(?string $reason): self */ public function withReasonCode(ReasonCode|string|null $reasonCode): self { - $obj = clone $this; - $obj['reasonCode'] = $reasonCode; + $self = clone $this; + $self['reasonCode'] = $reasonCode; - return $obj; + return $self; } /** @@ -182,10 +182,10 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self */ public function withTaxCode(TaxCode|string|null $taxCode): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -193,9 +193,9 @@ public function withTaxCode(TaxCode|string|null $taxCode): self */ public function withTaxRate(float|string|null $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentCreate/TaxDetail.php b/src/Documents/DocumentCreate/TaxDetail.php index 31fd8c3e..f0db831d 100644 --- a/src/Documents/DocumentCreate/TaxDetail.php +++ b/src/Documents/DocumentCreate/TaxDetail.php @@ -44,12 +44,12 @@ public static function with( float|string|null $amount = null, ?string $rate = null ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $rate && $obj['rate'] = $rate; + null !== $amount && $self['amount'] = $amount; + null !== $rate && $self['rate'] = $rate; - return $obj; + return $self; } /** @@ -57,10 +57,10 @@ public static function with( */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -68,9 +68,9 @@ public function withAmount(float|string|null $amount): self */ public function withRate(?string $rate): self { - $obj = clone $this; - $obj['rate'] = $rate; + $self = clone $this; + $self['rate'] = $rate; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentCreateFromPdfParams.php b/src/Documents/DocumentCreateFromPdfParams.php index 5af6556d..f3e275b7 100644 --- a/src/Documents/DocumentCreateFromPdfParams.php +++ b/src/Documents/DocumentCreateFromPdfParams.php @@ -63,37 +63,37 @@ public static function with( ?string $customerTaxID = null, ?string $vendorTaxID = null ): self { - $obj = new self; + $self = new self; - $obj['file'] = $file; + $self['file'] = $file; - null !== $customerTaxID && $obj['customerTaxID'] = $customerTaxID; - null !== $vendorTaxID && $obj['vendorTaxID'] = $vendorTaxID; + null !== $customerTaxID && $self['customerTaxID'] = $customerTaxID; + null !== $vendorTaxID && $self['vendorTaxID'] = $vendorTaxID; - return $obj; + return $self; } public function withFile(string $file): self { - $obj = clone $this; - $obj['file'] = $file; + $self = clone $this; + $self['file'] = $file; - return $obj; + return $self; } public function withCustomerTaxID(?string $customerTaxID): self { - $obj = clone $this; - $obj['customerTaxID'] = $customerTaxID; + $self = clone $this; + $self['customerTaxID'] = $customerTaxID; - return $obj; + return $self; } public function withVendorTaxID(?string $vendorTaxID): self { - $obj = clone $this; - $obj['vendorTaxID'] = $vendorTaxID; + $self = clone $this; + $self['vendorTaxID'] = $vendorTaxID; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentCreateParams.php b/src/Documents/DocumentCreateParams.php index bfa82c7f..722cb35d 100644 --- a/src/Documents/DocumentCreateParams.php +++ b/src/Documents/DocumentCreateParams.php @@ -542,58 +542,58 @@ public static function with( ?string $vendorName = null, ?string $vendorTaxID = null, ): self { - $obj = new self; - - null !== $allowances && $obj['allowances'] = $allowances; - null !== $amountDue && $obj['amountDue'] = $amountDue; - null !== $attachments && $obj['attachments'] = $attachments; - null !== $billingAddress && $obj['billingAddress'] = $billingAddress; - null !== $billingAddressRecipient && $obj['billingAddressRecipient'] = $billingAddressRecipient; - null !== $charges && $obj['charges'] = $charges; - null !== $currency && $obj['currency'] = $currency; - null !== $customerAddress && $obj['customerAddress'] = $customerAddress; - null !== $customerAddressRecipient && $obj['customerAddressRecipient'] = $customerAddressRecipient; - null !== $customerCompanyID && $obj['customerCompanyID'] = $customerCompanyID; - null !== $customerEmail && $obj['customerEmail'] = $customerEmail; - null !== $customerID && $obj['customerID'] = $customerID; - null !== $customerName && $obj['customerName'] = $customerName; - null !== $customerTaxID && $obj['customerTaxID'] = $customerTaxID; - null !== $direction && $obj['direction'] = $direction; - null !== $documentType && $obj['documentType'] = $documentType; - null !== $dueDate && $obj['dueDate'] = $dueDate; - null !== $invoiceDate && $obj['invoiceDate'] = $invoiceDate; - null !== $invoiceID && $obj['invoiceID'] = $invoiceID; - null !== $invoiceTotal && $obj['invoiceTotal'] = $invoiceTotal; - null !== $items && $obj['items'] = $items; - null !== $note && $obj['note'] = $note; - null !== $paymentDetails && $obj['paymentDetails'] = $paymentDetails; - null !== $paymentTerm && $obj['paymentTerm'] = $paymentTerm; - null !== $previousUnpaidBalance && $obj['previousUnpaidBalance'] = $previousUnpaidBalance; - null !== $purchaseOrder && $obj['purchaseOrder'] = $purchaseOrder; - null !== $remittanceAddress && $obj['remittanceAddress'] = $remittanceAddress; - null !== $remittanceAddressRecipient && $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; - null !== $serviceAddress && $obj['serviceAddress'] = $serviceAddress; - null !== $serviceAddressRecipient && $obj['serviceAddressRecipient'] = $serviceAddressRecipient; - null !== $serviceEndDate && $obj['serviceEndDate'] = $serviceEndDate; - null !== $serviceStartDate && $obj['serviceStartDate'] = $serviceStartDate; - null !== $shippingAddress && $obj['shippingAddress'] = $shippingAddress; - null !== $shippingAddressRecipient && $obj['shippingAddressRecipient'] = $shippingAddressRecipient; - null !== $state && $obj['state'] = $state; - null !== $subtotal && $obj['subtotal'] = $subtotal; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxDetails && $obj['taxDetails'] = $taxDetails; - null !== $totalDiscount && $obj['totalDiscount'] = $totalDiscount; - null !== $totalTax && $obj['totalTax'] = $totalTax; - null !== $vatex && $obj['vatex'] = $vatex; - null !== $vatexNote && $obj['vatexNote'] = $vatexNote; - null !== $vendorAddress && $obj['vendorAddress'] = $vendorAddress; - null !== $vendorAddressRecipient && $obj['vendorAddressRecipient'] = $vendorAddressRecipient; - null !== $vendorCompanyID && $obj['vendorCompanyID'] = $vendorCompanyID; - null !== $vendorEmail && $obj['vendorEmail'] = $vendorEmail; - null !== $vendorName && $obj['vendorName'] = $vendorName; - null !== $vendorTaxID && $obj['vendorTaxID'] = $vendorTaxID; - - return $obj; + $self = new self; + + null !== $allowances && $self['allowances'] = $allowances; + null !== $amountDue && $self['amountDue'] = $amountDue; + null !== $attachments && $self['attachments'] = $attachments; + null !== $billingAddress && $self['billingAddress'] = $billingAddress; + null !== $billingAddressRecipient && $self['billingAddressRecipient'] = $billingAddressRecipient; + null !== $charges && $self['charges'] = $charges; + null !== $currency && $self['currency'] = $currency; + null !== $customerAddress && $self['customerAddress'] = $customerAddress; + null !== $customerAddressRecipient && $self['customerAddressRecipient'] = $customerAddressRecipient; + null !== $customerCompanyID && $self['customerCompanyID'] = $customerCompanyID; + null !== $customerEmail && $self['customerEmail'] = $customerEmail; + null !== $customerID && $self['customerID'] = $customerID; + null !== $customerName && $self['customerName'] = $customerName; + null !== $customerTaxID && $self['customerTaxID'] = $customerTaxID; + null !== $direction && $self['direction'] = $direction; + null !== $documentType && $self['documentType'] = $documentType; + null !== $dueDate && $self['dueDate'] = $dueDate; + null !== $invoiceDate && $self['invoiceDate'] = $invoiceDate; + null !== $invoiceID && $self['invoiceID'] = $invoiceID; + null !== $invoiceTotal && $self['invoiceTotal'] = $invoiceTotal; + null !== $items && $self['items'] = $items; + null !== $note && $self['note'] = $note; + null !== $paymentDetails && $self['paymentDetails'] = $paymentDetails; + null !== $paymentTerm && $self['paymentTerm'] = $paymentTerm; + null !== $previousUnpaidBalance && $self['previousUnpaidBalance'] = $previousUnpaidBalance; + null !== $purchaseOrder && $self['purchaseOrder'] = $purchaseOrder; + null !== $remittanceAddress && $self['remittanceAddress'] = $remittanceAddress; + null !== $remittanceAddressRecipient && $self['remittanceAddressRecipient'] = $remittanceAddressRecipient; + null !== $serviceAddress && $self['serviceAddress'] = $serviceAddress; + null !== $serviceAddressRecipient && $self['serviceAddressRecipient'] = $serviceAddressRecipient; + null !== $serviceEndDate && $self['serviceEndDate'] = $serviceEndDate; + null !== $serviceStartDate && $self['serviceStartDate'] = $serviceStartDate; + null !== $shippingAddress && $self['shippingAddress'] = $shippingAddress; + null !== $shippingAddressRecipient && $self['shippingAddressRecipient'] = $shippingAddressRecipient; + null !== $state && $self['state'] = $state; + null !== $subtotal && $self['subtotal'] = $subtotal; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxDetails && $self['taxDetails'] = $taxDetails; + null !== $totalDiscount && $self['totalDiscount'] = $totalDiscount; + null !== $totalTax && $self['totalTax'] = $totalTax; + null !== $vatex && $self['vatex'] = $vatex; + null !== $vatexNote && $self['vatexNote'] = $vatexNote; + null !== $vendorAddress && $self['vendorAddress'] = $vendorAddress; + null !== $vendorAddressRecipient && $self['vendorAddressRecipient'] = $vendorAddressRecipient; + null !== $vendorCompanyID && $self['vendorCompanyID'] = $vendorCompanyID; + null !== $vendorEmail && $self['vendorEmail'] = $vendorEmail; + null !== $vendorName && $self['vendorName'] = $vendorName; + null !== $vendorTaxID && $self['vendorTaxID'] = $vendorTaxID; + + return $self; } /** @@ -609,10 +609,10 @@ public static function with( */ public function withAllowances(?array $allowances): self { - $obj = clone $this; - $obj['allowances'] = $allowances; + $self = clone $this; + $self['allowances'] = $allowances; - return $obj; + return $self; } /** @@ -620,10 +620,10 @@ public function withAllowances(?array $allowances): self */ public function withAmountDue(float|string|null $amountDue): self { - $obj = clone $this; - $obj['amountDue'] = $amountDue; + $self = clone $this; + $self['amountDue'] = $amountDue; - return $obj; + return $self; } /** @@ -636,10 +636,10 @@ public function withAmountDue(float|string|null $amountDue): self */ public function withAttachments(?array $attachments): self { - $obj = clone $this; - $obj['attachments'] = $attachments; + $self = clone $this; + $self['attachments'] = $attachments; - return $obj; + return $self; } /** @@ -647,10 +647,10 @@ public function withAttachments(?array $attachments): self */ public function withBillingAddress(?string $billingAddress): self { - $obj = clone $this; - $obj['billingAddress'] = $billingAddress; + $self = clone $this; + $self['billingAddress'] = $billingAddress; - return $obj; + return $self; } /** @@ -659,10 +659,10 @@ public function withBillingAddress(?string $billingAddress): self public function withBillingAddressRecipient( ?string $billingAddressRecipient ): self { - $obj = clone $this; - $obj['billingAddressRecipient'] = $billingAddressRecipient; + $self = clone $this; + $self['billingAddressRecipient'] = $billingAddressRecipient; - return $obj; + return $self; } /** @@ -678,10 +678,10 @@ public function withBillingAddressRecipient( */ public function withCharges(?array $charges): self { - $obj = clone $this; - $obj['charges'] = $charges; + $self = clone $this; + $self['charges'] = $charges; - return $obj; + return $self; } /** @@ -691,10 +691,10 @@ public function withCharges(?array $charges): self */ public function withCurrency(CurrencyCode|string $currency): self { - $obj = clone $this; - $obj['currency'] = $currency; + $self = clone $this; + $self['currency'] = $currency; - return $obj; + return $self; } /** @@ -702,10 +702,10 @@ public function withCurrency(CurrencyCode|string $currency): self */ public function withCustomerAddress(?string $customerAddress): self { - $obj = clone $this; - $obj['customerAddress'] = $customerAddress; + $self = clone $this; + $self['customerAddress'] = $customerAddress; - return $obj; + return $self; } /** @@ -714,10 +714,10 @@ public function withCustomerAddress(?string $customerAddress): self public function withCustomerAddressRecipient( ?string $customerAddressRecipient ): self { - $obj = clone $this; - $obj['customerAddressRecipient'] = $customerAddressRecipient; + $self = clone $this; + $self['customerAddressRecipient'] = $customerAddressRecipient; - return $obj; + return $self; } /** @@ -725,10 +725,10 @@ public function withCustomerAddressRecipient( */ public function withCustomerCompanyID(?string $customerCompanyID): self { - $obj = clone $this; - $obj['customerCompanyID'] = $customerCompanyID; + $self = clone $this; + $self['customerCompanyID'] = $customerCompanyID; - return $obj; + return $self; } /** @@ -736,10 +736,10 @@ public function withCustomerCompanyID(?string $customerCompanyID): self */ public function withCustomerEmail(?string $customerEmail): self { - $obj = clone $this; - $obj['customerEmail'] = $customerEmail; + $self = clone $this; + $self['customerEmail'] = $customerEmail; - return $obj; + return $self; } /** @@ -747,10 +747,10 @@ public function withCustomerEmail(?string $customerEmail): self */ public function withCustomerID(?string $customerID): self { - $obj = clone $this; - $obj['customerID'] = $customerID; + $self = clone $this; + $self['customerID'] = $customerID; - return $obj; + return $self; } /** @@ -758,10 +758,10 @@ public function withCustomerID(?string $customerID): self */ public function withCustomerName(?string $customerName): self { - $obj = clone $this; - $obj['customerName'] = $customerName; + $self = clone $this; + $self['customerName'] = $customerName; - return $obj; + return $self; } /** @@ -769,10 +769,10 @@ public function withCustomerName(?string $customerName): self */ public function withCustomerTaxID(?string $customerTaxID): self { - $obj = clone $this; - $obj['customerTaxID'] = $customerTaxID; + $self = clone $this; + $self['customerTaxID'] = $customerTaxID; - return $obj; + return $self; } /** @@ -782,10 +782,10 @@ public function withCustomerTaxID(?string $customerTaxID): self */ public function withDirection(DocumentDirection|string $direction): self { - $obj = clone $this; - $obj['direction'] = $direction; + $self = clone $this; + $self['direction'] = $direction; - return $obj; + return $self; } /** @@ -795,10 +795,10 @@ public function withDirection(DocumentDirection|string $direction): self */ public function withDocumentType(DocumentType|string $documentType): self { - $obj = clone $this; - $obj['documentType'] = $documentType; + $self = clone $this; + $self['documentType'] = $documentType; - return $obj; + return $self; } /** @@ -806,10 +806,10 @@ public function withDocumentType(DocumentType|string $documentType): self */ public function withDueDate(?\DateTimeInterface $dueDate): self { - $obj = clone $this; - $obj['dueDate'] = $dueDate; + $self = clone $this; + $self['dueDate'] = $dueDate; - return $obj; + return $self; } /** @@ -817,10 +817,10 @@ public function withDueDate(?\DateTimeInterface $dueDate): self */ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self { - $obj = clone $this; - $obj['invoiceDate'] = $invoiceDate; + $self = clone $this; + $self['invoiceDate'] = $invoiceDate; - return $obj; + return $self; } /** @@ -828,10 +828,10 @@ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self */ public function withInvoiceID(?string $invoiceID): self { - $obj = clone $this; - $obj['invoiceID'] = $invoiceID; + $self = clone $this; + $self['invoiceID'] = $invoiceID; - return $obj; + return $self; } /** @@ -839,10 +839,10 @@ public function withInvoiceID(?string $invoiceID): self */ public function withInvoiceTotal(float|string|null $invoiceTotal): self { - $obj = clone $this; - $obj['invoiceTotal'] = $invoiceTotal; + $self = clone $this; + $self['invoiceTotal'] = $invoiceTotal; - return $obj; + return $self; } /** @@ -864,10 +864,10 @@ public function withInvoiceTotal(float|string|null $invoiceTotal): self */ public function withItems(array $items): self { - $obj = clone $this; - $obj['items'] = $items; + $self = clone $this; + $self['items'] = $items; - return $obj; + return $self; } /** @@ -875,10 +875,10 @@ public function withItems(array $items): self */ public function withNote(?string $note): self { - $obj = clone $this; - $obj['note'] = $note; + $self = clone $this; + $self['note'] = $note; - return $obj; + return $self; } /** @@ -891,10 +891,10 @@ public function withNote(?string $note): self */ public function withPaymentDetails(?array $paymentDetails): self { - $obj = clone $this; - $obj['paymentDetails'] = $paymentDetails; + $self = clone $this; + $self['paymentDetails'] = $paymentDetails; - return $obj; + return $self; } /** @@ -902,10 +902,10 @@ public function withPaymentDetails(?array $paymentDetails): self */ public function withPaymentTerm(?string $paymentTerm): self { - $obj = clone $this; - $obj['paymentTerm'] = $paymentTerm; + $self = clone $this; + $self['paymentTerm'] = $paymentTerm; - return $obj; + return $self; } /** @@ -914,10 +914,10 @@ public function withPaymentTerm(?string $paymentTerm): self public function withPreviousUnpaidBalance( float|string|null $previousUnpaidBalance ): self { - $obj = clone $this; - $obj['previousUnpaidBalance'] = $previousUnpaidBalance; + $self = clone $this; + $self['previousUnpaidBalance'] = $previousUnpaidBalance; - return $obj; + return $self; } /** @@ -925,10 +925,10 @@ public function withPreviousUnpaidBalance( */ public function withPurchaseOrder(?string $purchaseOrder): self { - $obj = clone $this; - $obj['purchaseOrder'] = $purchaseOrder; + $self = clone $this; + $self['purchaseOrder'] = $purchaseOrder; - return $obj; + return $self; } /** @@ -936,10 +936,10 @@ public function withPurchaseOrder(?string $purchaseOrder): self */ public function withRemittanceAddress(?string $remittanceAddress): self { - $obj = clone $this; - $obj['remittanceAddress'] = $remittanceAddress; + $self = clone $this; + $self['remittanceAddress'] = $remittanceAddress; - return $obj; + return $self; } /** @@ -948,10 +948,10 @@ public function withRemittanceAddress(?string $remittanceAddress): self public function withRemittanceAddressRecipient( ?string $remittanceAddressRecipient ): self { - $obj = clone $this; - $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; + $self = clone $this; + $self['remittanceAddressRecipient'] = $remittanceAddressRecipient; - return $obj; + return $self; } /** @@ -959,10 +959,10 @@ public function withRemittanceAddressRecipient( */ public function withServiceAddress(?string $serviceAddress): self { - $obj = clone $this; - $obj['serviceAddress'] = $serviceAddress; + $self = clone $this; + $self['serviceAddress'] = $serviceAddress; - return $obj; + return $self; } /** @@ -971,10 +971,10 @@ public function withServiceAddress(?string $serviceAddress): self public function withServiceAddressRecipient( ?string $serviceAddressRecipient ): self { - $obj = clone $this; - $obj['serviceAddressRecipient'] = $serviceAddressRecipient; + $self = clone $this; + $self['serviceAddressRecipient'] = $serviceAddressRecipient; - return $obj; + return $self; } /** @@ -983,10 +983,10 @@ public function withServiceAddressRecipient( public function withServiceEndDate( ?\DateTimeInterface $serviceEndDate ): self { - $obj = clone $this; - $obj['serviceEndDate'] = $serviceEndDate; + $self = clone $this; + $self['serviceEndDate'] = $serviceEndDate; - return $obj; + return $self; } /** @@ -995,10 +995,10 @@ public function withServiceEndDate( public function withServiceStartDate( ?\DateTimeInterface $serviceStartDate ): self { - $obj = clone $this; - $obj['serviceStartDate'] = $serviceStartDate; + $self = clone $this; + $self['serviceStartDate'] = $serviceStartDate; - return $obj; + return $self; } /** @@ -1006,10 +1006,10 @@ public function withServiceStartDate( */ public function withShippingAddress(?string $shippingAddress): self { - $obj = clone $this; - $obj['shippingAddress'] = $shippingAddress; + $self = clone $this; + $self['shippingAddress'] = $shippingAddress; - return $obj; + return $self; } /** @@ -1018,10 +1018,10 @@ public function withShippingAddress(?string $shippingAddress): self public function withShippingAddressRecipient( ?string $shippingAddressRecipient ): self { - $obj = clone $this; - $obj['shippingAddressRecipient'] = $shippingAddressRecipient; + $self = clone $this; + $self['shippingAddressRecipient'] = $shippingAddressRecipient; - return $obj; + return $self; } /** @@ -1031,10 +1031,10 @@ public function withShippingAddressRecipient( */ public function withState(DocumentState|string $state): self { - $obj = clone $this; - $obj['state'] = $state; + $self = clone $this; + $self['state'] = $state; - return $obj; + return $self; } /** @@ -1042,10 +1042,10 @@ public function withState(DocumentState|string $state): self */ public function withSubtotal(float|string|null $subtotal): self { - $obj = clone $this; - $obj['subtotal'] = $subtotal; + $self = clone $this; + $self['subtotal'] = $subtotal; - return $obj; + return $self; } /** @@ -1056,10 +1056,10 @@ public function withSubtotal(float|string|null $subtotal): self public function withTaxCode( DocumentCreateParams\TaxCode|string $taxCode ): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -1069,10 +1069,10 @@ public function withTaxCode( */ public function withTaxDetails(?array $taxDetails): self { - $obj = clone $this; - $obj['taxDetails'] = $taxDetails; + $self = clone $this; + $self['taxDetails'] = $taxDetails; - return $obj; + return $self; } /** @@ -1080,10 +1080,10 @@ public function withTaxDetails(?array $taxDetails): self */ public function withTotalDiscount(float|string|null $totalDiscount): self { - $obj = clone $this; - $obj['totalDiscount'] = $totalDiscount; + $self = clone $this; + $self['totalDiscount'] = $totalDiscount; - return $obj; + return $self; } /** @@ -1091,10 +1091,10 @@ public function withTotalDiscount(float|string|null $totalDiscount): self */ public function withTotalTax(float|string|null $totalTax): self { - $obj = clone $this; - $obj['totalTax'] = $totalTax; + $self = clone $this; + $self['totalTax'] = $totalTax; - return $obj; + return $self; } /** @@ -1107,10 +1107,10 @@ public function withTotalTax(float|string|null $totalTax): self */ public function withVatex(Vatex|string|null $vatex): self { - $obj = clone $this; - $obj['vatex'] = $vatex; + $self = clone $this; + $self['vatex'] = $vatex; - return $obj; + return $self; } /** @@ -1118,10 +1118,10 @@ public function withVatex(Vatex|string|null $vatex): self */ public function withVatexNote(?string $vatexNote): self { - $obj = clone $this; - $obj['vatexNote'] = $vatexNote; + $self = clone $this; + $self['vatexNote'] = $vatexNote; - return $obj; + return $self; } /** @@ -1129,10 +1129,10 @@ public function withVatexNote(?string $vatexNote): self */ public function withVendorAddress(?string $vendorAddress): self { - $obj = clone $this; - $obj['vendorAddress'] = $vendorAddress; + $self = clone $this; + $self['vendorAddress'] = $vendorAddress; - return $obj; + return $self; } /** @@ -1141,10 +1141,10 @@ public function withVendorAddress(?string $vendorAddress): self public function withVendorAddressRecipient( ?string $vendorAddressRecipient ): self { - $obj = clone $this; - $obj['vendorAddressRecipient'] = $vendorAddressRecipient; + $self = clone $this; + $self['vendorAddressRecipient'] = $vendorAddressRecipient; - return $obj; + return $self; } /** @@ -1152,10 +1152,10 @@ public function withVendorAddressRecipient( */ public function withVendorCompanyID(?string $vendorCompanyID): self { - $obj = clone $this; - $obj['vendorCompanyID'] = $vendorCompanyID; + $self = clone $this; + $self['vendorCompanyID'] = $vendorCompanyID; - return $obj; + return $self; } /** @@ -1163,10 +1163,10 @@ public function withVendorCompanyID(?string $vendorCompanyID): self */ public function withVendorEmail(?string $vendorEmail): self { - $obj = clone $this; - $obj['vendorEmail'] = $vendorEmail; + $self = clone $this; + $self['vendorEmail'] = $vendorEmail; - return $obj; + return $self; } /** @@ -1174,10 +1174,10 @@ public function withVendorEmail(?string $vendorEmail): self */ public function withVendorName(?string $vendorName): self { - $obj = clone $this; - $obj['vendorName'] = $vendorName; + $self = clone $this; + $self['vendorName'] = $vendorName; - return $obj; + return $self; } /** @@ -1185,9 +1185,9 @@ public function withVendorName(?string $vendorName): self */ public function withVendorTaxID(?string $vendorTaxID): self { - $obj = clone $this; - $obj['vendorTaxID'] = $vendorTaxID; + $self = clone $this; + $self['vendorTaxID'] = $vendorTaxID; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentCreateParams/Allowance.php b/src/Documents/DocumentCreateParams/Allowance.php index fbc0f793..44d9c779 100644 --- a/src/Documents/DocumentCreateParams/Allowance.php +++ b/src/Documents/DocumentCreateParams/Allowance.php @@ -99,17 +99,17 @@ public static function with( TaxCode|string|null $taxCode = null, float|string|null $taxRate = null, ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $baseAmount && $obj['baseAmount'] = $baseAmount; - null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; - null !== $reason && $obj['reason'] = $reason; - null !== $reasonCode && $obj['reasonCode'] = $reasonCode; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxRate && $obj['taxRate'] = $taxRate; + null !== $amount && $self['amount'] = $amount; + null !== $baseAmount && $self['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $self['multiplierFactor'] = $multiplierFactor; + null !== $reason && $self['reason'] = $reason; + null !== $reasonCode && $self['reasonCode'] = $reasonCode; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxRate && $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -117,10 +117,10 @@ public static function with( */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -128,10 +128,10 @@ public function withAmount(float|string|null $amount): self */ public function withBaseAmount(float|string|null $baseAmount): self { - $obj = clone $this; - $obj['baseAmount'] = $baseAmount; + $self = clone $this; + $self['baseAmount'] = $baseAmount; - return $obj; + return $self; } /** @@ -140,10 +140,10 @@ public function withBaseAmount(float|string|null $baseAmount): self public function withMultiplierFactor( float|string|null $multiplierFactor ): self { - $obj = clone $this; - $obj['multiplierFactor'] = $multiplierFactor; + $self = clone $this; + $self['multiplierFactor'] = $multiplierFactor; - return $obj; + return $self; } /** @@ -151,10 +151,10 @@ public function withMultiplierFactor( */ public function withReason(?string $reason): self { - $obj = clone $this; - $obj['reason'] = $reason; + $self = clone $this; + $self['reason'] = $reason; - return $obj; + return $self; } /** @@ -164,10 +164,10 @@ public function withReason(?string $reason): self */ public function withReasonCode(ReasonCode|string|null $reasonCode): self { - $obj = clone $this; - $obj['reasonCode'] = $reasonCode; + $self = clone $this; + $self['reasonCode'] = $reasonCode; - return $obj; + return $self; } /** @@ -178,10 +178,10 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self public function withTaxCode( TaxCode|string $taxCode, ): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -189,9 +189,9 @@ public function withTaxCode( */ public function withTaxRate(float|string|null $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentCreateParams/Charge.php b/src/Documents/DocumentCreateParams/Charge.php index da8574ab..6701c0eb 100644 --- a/src/Documents/DocumentCreateParams/Charge.php +++ b/src/Documents/DocumentCreateParams/Charge.php @@ -104,17 +104,17 @@ public static function with( TaxCode|string|null $taxCode = null, float|string|null $taxRate = null, ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $baseAmount && $obj['baseAmount'] = $baseAmount; - null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; - null !== $reason && $obj['reason'] = $reason; - null !== $reasonCode && $obj['reasonCode'] = $reasonCode; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxRate && $obj['taxRate'] = $taxRate; + null !== $amount && $self['amount'] = $amount; + null !== $baseAmount && $self['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $self['multiplierFactor'] = $multiplierFactor; + null !== $reason && $self['reason'] = $reason; + null !== $reasonCode && $self['reasonCode'] = $reasonCode; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxRate && $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -122,10 +122,10 @@ public static function with( */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -133,10 +133,10 @@ public function withAmount(float|string|null $amount): self */ public function withBaseAmount(float|string|null $baseAmount): self { - $obj = clone $this; - $obj['baseAmount'] = $baseAmount; + $self = clone $this; + $self['baseAmount'] = $baseAmount; - return $obj; + return $self; } /** @@ -145,10 +145,10 @@ public function withBaseAmount(float|string|null $baseAmount): self public function withMultiplierFactor( float|string|null $multiplierFactor ): self { - $obj = clone $this; - $obj['multiplierFactor'] = $multiplierFactor; + $self = clone $this; + $self['multiplierFactor'] = $multiplierFactor; - return $obj; + return $self; } /** @@ -156,10 +156,10 @@ public function withMultiplierFactor( */ public function withReason(?string $reason): self { - $obj = clone $this; - $obj['reason'] = $reason; + $self = clone $this; + $self['reason'] = $reason; - return $obj; + return $self; } /** @@ -169,10 +169,10 @@ public function withReason(?string $reason): self */ public function withReasonCode(ReasonCode|string|null $reasonCode): self { - $obj = clone $this; - $obj['reasonCode'] = $reasonCode; + $self = clone $this; + $self['reasonCode'] = $reasonCode; - return $obj; + return $self; } /** @@ -187,10 +187,10 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self public function withTaxCode( TaxCode|string|null $taxCode, ): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -198,9 +198,9 @@ public function withTaxCode( */ public function withTaxRate(float|string|null $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentCreateParams/Item.php b/src/Documents/DocumentCreateParams/Item.php index 8768ca62..e5394a63 100644 --- a/src/Documents/DocumentCreateParams/Item.php +++ b/src/Documents/DocumentCreateParams/Item.php @@ -152,22 +152,22 @@ public static function with( UnitOfMeasureCode|string|null $unit = null, float|string|null $unitPrice = null, ): self { - $obj = new self; - - $obj['date'] = $date; - - null !== $allowances && $obj['allowances'] = $allowances; - null !== $amount && $obj['amount'] = $amount; - null !== $charges && $obj['charges'] = $charges; - null !== $description && $obj['description'] = $description; - null !== $productCode && $obj['productCode'] = $productCode; - null !== $quantity && $obj['quantity'] = $quantity; - null !== $tax && $obj['tax'] = $tax; - null !== $taxRate && $obj['taxRate'] = $taxRate; - null !== $unit && $obj['unit'] = $unit; - null !== $unitPrice && $obj['unitPrice'] = $unitPrice; - - return $obj; + $self = new self; + + $self['date'] = $date; + + null !== $allowances && $self['allowances'] = $allowances; + null !== $amount && $self['amount'] = $amount; + null !== $charges && $self['charges'] = $charges; + null !== $description && $self['description'] = $description; + null !== $productCode && $self['productCode'] = $productCode; + null !== $quantity && $self['quantity'] = $quantity; + null !== $tax && $self['tax'] = $tax; + null !== $taxRate && $self['taxRate'] = $taxRate; + null !== $unit && $self['unit'] = $unit; + null !== $unitPrice && $self['unitPrice'] = $unitPrice; + + return $self; } /** @@ -185,10 +185,10 @@ public static function with( */ public function withAllowances(?array $allowances): self { - $obj = clone $this; - $obj['allowances'] = $allowances; + $self = clone $this; + $self['allowances'] = $allowances; - return $obj; + return $self; } /** @@ -196,10 +196,10 @@ public function withAllowances(?array $allowances): self */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -217,10 +217,10 @@ public function withAmount(float|string|null $amount): self */ public function withCharges(?array $charges): self { - $obj = clone $this; - $obj['charges'] = $charges; + $self = clone $this; + $self['charges'] = $charges; - return $obj; + return $self; } /** @@ -228,10 +228,10 @@ public function withCharges(?array $charges): self */ public function withDate(null $date): self { - $obj = clone $this; - $obj['date'] = $date; + $self = clone $this; + $self['date'] = $date; - return $obj; + return $self; } /** @@ -239,10 +239,10 @@ public function withDate(null $date): self */ public function withDescription(?string $description): self { - $obj = clone $this; - $obj['description'] = $description; + $self = clone $this; + $self['description'] = $description; - return $obj; + return $self; } /** @@ -250,10 +250,10 @@ public function withDescription(?string $description): self */ public function withProductCode(?string $productCode): self { - $obj = clone $this; - $obj['productCode'] = $productCode; + $self = clone $this; + $self['productCode'] = $productCode; - return $obj; + return $self; } /** @@ -261,10 +261,10 @@ public function withProductCode(?string $productCode): self */ public function withQuantity(float|string|null $quantity): self { - $obj = clone $this; - $obj['quantity'] = $quantity; + $self = clone $this; + $self['quantity'] = $quantity; - return $obj; + return $self; } /** @@ -272,10 +272,10 @@ public function withQuantity(float|string|null $quantity): self */ public function withTax(float|string|null $tax): self { - $obj = clone $this; - $obj['tax'] = $tax; + $self = clone $this; + $self['tax'] = $tax; - return $obj; + return $self; } /** @@ -283,10 +283,10 @@ public function withTax(float|string|null $tax): self */ public function withTaxRate(float|string|null $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -296,10 +296,10 @@ public function withTaxRate(float|string|null $taxRate): self */ public function withUnit(UnitOfMeasureCode|string|null $unit): self { - $obj = clone $this; - $obj['unit'] = $unit; + $self = clone $this; + $self['unit'] = $unit; - return $obj; + return $self; } /** @@ -307,9 +307,9 @@ public function withUnit(UnitOfMeasureCode|string|null $unit): self */ public function withUnitPrice(float|string|null $unitPrice): self { - $obj = clone $this; - $obj['unitPrice'] = $unitPrice; + $self = clone $this; + $self['unitPrice'] = $unitPrice; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentCreateParams/Item/Allowance.php b/src/Documents/DocumentCreateParams/Item/Allowance.php index f7c2c0b7..a966e652 100644 --- a/src/Documents/DocumentCreateParams/Item/Allowance.php +++ b/src/Documents/DocumentCreateParams/Item/Allowance.php @@ -96,17 +96,17 @@ public static function with( TaxCode|string|null $taxCode = null, float|string|null $taxRate = null, ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $baseAmount && $obj['baseAmount'] = $baseAmount; - null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; - null !== $reason && $obj['reason'] = $reason; - null !== $reasonCode && $obj['reasonCode'] = $reasonCode; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxRate && $obj['taxRate'] = $taxRate; + null !== $amount && $self['amount'] = $amount; + null !== $baseAmount && $self['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $self['multiplierFactor'] = $multiplierFactor; + null !== $reason && $self['reason'] = $reason; + null !== $reasonCode && $self['reasonCode'] = $reasonCode; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxRate && $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -114,10 +114,10 @@ public static function with( */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -125,10 +125,10 @@ public function withAmount(float|string|null $amount): self */ public function withBaseAmount(float|string|null $baseAmount): self { - $obj = clone $this; - $obj['baseAmount'] = $baseAmount; + $self = clone $this; + $self['baseAmount'] = $baseAmount; - return $obj; + return $self; } /** @@ -137,10 +137,10 @@ public function withBaseAmount(float|string|null $baseAmount): self public function withMultiplierFactor( float|string|null $multiplierFactor ): self { - $obj = clone $this; - $obj['multiplierFactor'] = $multiplierFactor; + $self = clone $this; + $self['multiplierFactor'] = $multiplierFactor; - return $obj; + return $self; } /** @@ -148,10 +148,10 @@ public function withMultiplierFactor( */ public function withReason(?string $reason): self { - $obj = clone $this; - $obj['reason'] = $reason; + $self = clone $this; + $self['reason'] = $reason; - return $obj; + return $self; } /** @@ -161,10 +161,10 @@ public function withReason(?string $reason): self */ public function withReasonCode(ReasonCode|string|null $reasonCode): self { - $obj = clone $this; - $obj['reasonCode'] = $reasonCode; + $self = clone $this; + $self['reasonCode'] = $reasonCode; - return $obj; + return $self; } /** @@ -174,10 +174,10 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self */ public function withTaxCode(TaxCode|string $taxCode): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -185,9 +185,9 @@ public function withTaxCode(TaxCode|string $taxCode): self */ public function withTaxRate(float|string|null $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentCreateParams/Item/Charge.php b/src/Documents/DocumentCreateParams/Item/Charge.php index cf76a0cf..27c1f305 100644 --- a/src/Documents/DocumentCreateParams/Item/Charge.php +++ b/src/Documents/DocumentCreateParams/Item/Charge.php @@ -100,17 +100,17 @@ public static function with( TaxCode|string|null $taxCode = null, float|string|null $taxRate = null, ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $baseAmount && $obj['baseAmount'] = $baseAmount; - null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; - null !== $reason && $obj['reason'] = $reason; - null !== $reasonCode && $obj['reasonCode'] = $reasonCode; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxRate && $obj['taxRate'] = $taxRate; + null !== $amount && $self['amount'] = $amount; + null !== $baseAmount && $self['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $self['multiplierFactor'] = $multiplierFactor; + null !== $reason && $self['reason'] = $reason; + null !== $reasonCode && $self['reasonCode'] = $reasonCode; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxRate && $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -118,10 +118,10 @@ public static function with( */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -129,10 +129,10 @@ public function withAmount(float|string|null $amount): self */ public function withBaseAmount(float|string|null $baseAmount): self { - $obj = clone $this; - $obj['baseAmount'] = $baseAmount; + $self = clone $this; + $self['baseAmount'] = $baseAmount; - return $obj; + return $self; } /** @@ -141,10 +141,10 @@ public function withBaseAmount(float|string|null $baseAmount): self public function withMultiplierFactor( float|string|null $multiplierFactor ): self { - $obj = clone $this; - $obj['multiplierFactor'] = $multiplierFactor; + $self = clone $this; + $self['multiplierFactor'] = $multiplierFactor; - return $obj; + return $self; } /** @@ -152,10 +152,10 @@ public function withMultiplierFactor( */ public function withReason(?string $reason): self { - $obj = clone $this; - $obj['reason'] = $reason; + $self = clone $this; + $self['reason'] = $reason; - return $obj; + return $self; } /** @@ -165,10 +165,10 @@ public function withReason(?string $reason): self */ public function withReasonCode(ReasonCode|string|null $reasonCode): self { - $obj = clone $this; - $obj['reasonCode'] = $reasonCode; + $self = clone $this; + $self['reasonCode'] = $reasonCode; - return $obj; + return $self; } /** @@ -182,10 +182,10 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self */ public function withTaxCode(TaxCode|string|null $taxCode): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -193,9 +193,9 @@ public function withTaxCode(TaxCode|string|null $taxCode): self */ public function withTaxRate(float|string|null $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentCreateParams/TaxDetail.php b/src/Documents/DocumentCreateParams/TaxDetail.php index 199528b3..c63ebb8e 100644 --- a/src/Documents/DocumentCreateParams/TaxDetail.php +++ b/src/Documents/DocumentCreateParams/TaxDetail.php @@ -44,12 +44,12 @@ public static function with( float|string|null $amount = null, ?string $rate = null ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $rate && $obj['rate'] = $rate; + null !== $amount && $self['amount'] = $amount; + null !== $rate && $self['rate'] = $rate; - return $obj; + return $self; } /** @@ -57,10 +57,10 @@ public static function with( */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -68,9 +68,9 @@ public function withAmount(float|string|null $amount): self */ public function withRate(?string $rate): self { - $obj = clone $this; - $obj['rate'] = $rate; + $self = clone $this; + $self['rate'] = $rate; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentDeleteResponse.php b/src/Documents/DocumentDeleteResponse.php index cb6f416e..a1aef7e3 100644 --- a/src/Documents/DocumentDeleteResponse.php +++ b/src/Documents/DocumentDeleteResponse.php @@ -45,18 +45,18 @@ public function __construct() */ public static function with(bool $isDeleted): self { - $obj = new self; + $self = new self; - $obj['isDeleted'] = $isDeleted; + $self['isDeleted'] = $isDeleted; - return $obj; + return $self; } public function withIsDeleted(bool $isDeleted): self { - $obj = clone $this; - $obj['isDeleted'] = $isDeleted; + $self = clone $this; + $self['isDeleted'] = $isDeleted; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentNewFromPdfResponse.php b/src/Documents/DocumentNewFromPdfResponse.php index a8f22f44..1372a2c5 100644 --- a/src/Documents/DocumentNewFromPdfResponse.php +++ b/src/Documents/DocumentNewFromPdfResponse.php @@ -491,59 +491,59 @@ public static function with( ?string $vendorName = null, ?string $vendorTaxID = null, ): self { - $obj = new self; - - null !== $allowances && $obj['allowances'] = $allowances; - null !== $amountDue && $obj['amountDue'] = $amountDue; - null !== $attachments && $obj['attachments'] = $attachments; - null !== $billingAddress && $obj['billingAddress'] = $billingAddress; - null !== $billingAddressRecipient && $obj['billingAddressRecipient'] = $billingAddressRecipient; - null !== $charges && $obj['charges'] = $charges; - null !== $currency && $obj['currency'] = $currency; - null !== $customerAddress && $obj['customerAddress'] = $customerAddress; - null !== $customerAddressRecipient && $obj['customerAddressRecipient'] = $customerAddressRecipient; - null !== $customerCompanyID && $obj['customerCompanyID'] = $customerCompanyID; - null !== $customerEmail && $obj['customerEmail'] = $customerEmail; - null !== $customerID && $obj['customerID'] = $customerID; - null !== $customerName && $obj['customerName'] = $customerName; - null !== $customerTaxID && $obj['customerTaxID'] = $customerTaxID; - null !== $direction && $obj['direction'] = $direction; - null !== $documentType && $obj['documentType'] = $documentType; - null !== $dueDate && $obj['dueDate'] = $dueDate; - null !== $invoiceDate && $obj['invoiceDate'] = $invoiceDate; - null !== $invoiceID && $obj['invoiceID'] = $invoiceID; - null !== $invoiceTotal && $obj['invoiceTotal'] = $invoiceTotal; - null !== $items && $obj['items'] = $items; - null !== $note && $obj['note'] = $note; - null !== $paymentDetails && $obj['paymentDetails'] = $paymentDetails; - null !== $paymentTerm && $obj['paymentTerm'] = $paymentTerm; - null !== $purchaseOrder && $obj['purchaseOrder'] = $purchaseOrder; - null !== $remittanceAddress && $obj['remittanceAddress'] = $remittanceAddress; - null !== $remittanceAddressRecipient && $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; - null !== $serviceAddress && $obj['serviceAddress'] = $serviceAddress; - null !== $serviceAddressRecipient && $obj['serviceAddressRecipient'] = $serviceAddressRecipient; - null !== $serviceEndDate && $obj['serviceEndDate'] = $serviceEndDate; - null !== $serviceStartDate && $obj['serviceStartDate'] = $serviceStartDate; - null !== $shippingAddress && $obj['shippingAddress'] = $shippingAddress; - null !== $shippingAddressRecipient && $obj['shippingAddressRecipient'] = $shippingAddressRecipient; - null !== $state && $obj['state'] = $state; - null !== $subtotal && $obj['subtotal'] = $subtotal; - null !== $success && $obj['success'] = $success; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxDetails && $obj['taxDetails'] = $taxDetails; - null !== $totalDiscount && $obj['totalDiscount'] = $totalDiscount; - null !== $totalTax && $obj['totalTax'] = $totalTax; - null !== $ublDocument && $obj['ublDocument'] = $ublDocument; - null !== $vatex && $obj['vatex'] = $vatex; - null !== $vatexNote && $obj['vatexNote'] = $vatexNote; - null !== $vendorAddress && $obj['vendorAddress'] = $vendorAddress; - null !== $vendorAddressRecipient && $obj['vendorAddressRecipient'] = $vendorAddressRecipient; - null !== $vendorCompanyID && $obj['vendorCompanyID'] = $vendorCompanyID; - null !== $vendorEmail && $obj['vendorEmail'] = $vendorEmail; - null !== $vendorName && $obj['vendorName'] = $vendorName; - null !== $vendorTaxID && $obj['vendorTaxID'] = $vendorTaxID; - - return $obj; + $self = new self; + + null !== $allowances && $self['allowances'] = $allowances; + null !== $amountDue && $self['amountDue'] = $amountDue; + null !== $attachments && $self['attachments'] = $attachments; + null !== $billingAddress && $self['billingAddress'] = $billingAddress; + null !== $billingAddressRecipient && $self['billingAddressRecipient'] = $billingAddressRecipient; + null !== $charges && $self['charges'] = $charges; + null !== $currency && $self['currency'] = $currency; + null !== $customerAddress && $self['customerAddress'] = $customerAddress; + null !== $customerAddressRecipient && $self['customerAddressRecipient'] = $customerAddressRecipient; + null !== $customerCompanyID && $self['customerCompanyID'] = $customerCompanyID; + null !== $customerEmail && $self['customerEmail'] = $customerEmail; + null !== $customerID && $self['customerID'] = $customerID; + null !== $customerName && $self['customerName'] = $customerName; + null !== $customerTaxID && $self['customerTaxID'] = $customerTaxID; + null !== $direction && $self['direction'] = $direction; + null !== $documentType && $self['documentType'] = $documentType; + null !== $dueDate && $self['dueDate'] = $dueDate; + null !== $invoiceDate && $self['invoiceDate'] = $invoiceDate; + null !== $invoiceID && $self['invoiceID'] = $invoiceID; + null !== $invoiceTotal && $self['invoiceTotal'] = $invoiceTotal; + null !== $items && $self['items'] = $items; + null !== $note && $self['note'] = $note; + null !== $paymentDetails && $self['paymentDetails'] = $paymentDetails; + null !== $paymentTerm && $self['paymentTerm'] = $paymentTerm; + null !== $purchaseOrder && $self['purchaseOrder'] = $purchaseOrder; + null !== $remittanceAddress && $self['remittanceAddress'] = $remittanceAddress; + null !== $remittanceAddressRecipient && $self['remittanceAddressRecipient'] = $remittanceAddressRecipient; + null !== $serviceAddress && $self['serviceAddress'] = $serviceAddress; + null !== $serviceAddressRecipient && $self['serviceAddressRecipient'] = $serviceAddressRecipient; + null !== $serviceEndDate && $self['serviceEndDate'] = $serviceEndDate; + null !== $serviceStartDate && $self['serviceStartDate'] = $serviceStartDate; + null !== $shippingAddress && $self['shippingAddress'] = $shippingAddress; + null !== $shippingAddressRecipient && $self['shippingAddressRecipient'] = $shippingAddressRecipient; + null !== $state && $self['state'] = $state; + null !== $subtotal && $self['subtotal'] = $subtotal; + null !== $success && $self['success'] = $success; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxDetails && $self['taxDetails'] = $taxDetails; + null !== $totalDiscount && $self['totalDiscount'] = $totalDiscount; + null !== $totalTax && $self['totalTax'] = $totalTax; + null !== $ublDocument && $self['ublDocument'] = $ublDocument; + null !== $vatex && $self['vatex'] = $vatex; + null !== $vatexNote && $self['vatexNote'] = $vatexNote; + null !== $vendorAddress && $self['vendorAddress'] = $vendorAddress; + null !== $vendorAddressRecipient && $self['vendorAddressRecipient'] = $vendorAddressRecipient; + null !== $vendorCompanyID && $self['vendorCompanyID'] = $vendorCompanyID; + null !== $vendorEmail && $self['vendorEmail'] = $vendorEmail; + null !== $vendorName && $self['vendorName'] = $vendorName; + null !== $vendorTaxID && $self['vendorTaxID'] = $vendorTaxID; + + return $self; } /** @@ -559,10 +559,10 @@ public static function with( */ public function withAllowances(?array $allowances): self { - $obj = clone $this; - $obj['allowances'] = $allowances; + $self = clone $this; + $self['allowances'] = $allowances; - return $obj; + return $self; } /** @@ -570,10 +570,10 @@ public function withAllowances(?array $allowances): self */ public function withAmountDue(?string $amountDue): self { - $obj = clone $this; - $obj['amountDue'] = $amountDue; + $self = clone $this; + $self['amountDue'] = $amountDue; - return $obj; + return $self; } /** @@ -586,10 +586,10 @@ public function withAmountDue(?string $amountDue): self */ public function withAttachments(?array $attachments): self { - $obj = clone $this; - $obj['attachments'] = $attachments; + $self = clone $this; + $self['attachments'] = $attachments; - return $obj; + return $self; } /** @@ -597,10 +597,10 @@ public function withAttachments(?array $attachments): self */ public function withBillingAddress(?string $billingAddress): self { - $obj = clone $this; - $obj['billingAddress'] = $billingAddress; + $self = clone $this; + $self['billingAddress'] = $billingAddress; - return $obj; + return $self; } /** @@ -609,10 +609,10 @@ public function withBillingAddress(?string $billingAddress): self public function withBillingAddressRecipient( ?string $billingAddressRecipient ): self { - $obj = clone $this; - $obj['billingAddressRecipient'] = $billingAddressRecipient; + $self = clone $this; + $self['billingAddressRecipient'] = $billingAddressRecipient; - return $obj; + return $self; } /** @@ -628,10 +628,10 @@ public function withBillingAddressRecipient( */ public function withCharges(?array $charges): self { - $obj = clone $this; - $obj['charges'] = $charges; + $self = clone $this; + $self['charges'] = $charges; - return $obj; + return $self; } /** @@ -641,10 +641,10 @@ public function withCharges(?array $charges): self */ public function withCurrency(CurrencyCode|string $currency): self { - $obj = clone $this; - $obj['currency'] = $currency; + $self = clone $this; + $self['currency'] = $currency; - return $obj; + return $self; } /** @@ -652,10 +652,10 @@ public function withCurrency(CurrencyCode|string $currency): self */ public function withCustomerAddress(?string $customerAddress): self { - $obj = clone $this; - $obj['customerAddress'] = $customerAddress; + $self = clone $this; + $self['customerAddress'] = $customerAddress; - return $obj; + return $self; } /** @@ -664,10 +664,10 @@ public function withCustomerAddress(?string $customerAddress): self public function withCustomerAddressRecipient( ?string $customerAddressRecipient ): self { - $obj = clone $this; - $obj['customerAddressRecipient'] = $customerAddressRecipient; + $self = clone $this; + $self['customerAddressRecipient'] = $customerAddressRecipient; - return $obj; + return $self; } /** @@ -675,10 +675,10 @@ public function withCustomerAddressRecipient( */ public function withCustomerCompanyID(?string $customerCompanyID): self { - $obj = clone $this; - $obj['customerCompanyID'] = $customerCompanyID; + $self = clone $this; + $self['customerCompanyID'] = $customerCompanyID; - return $obj; + return $self; } /** @@ -686,10 +686,10 @@ public function withCustomerCompanyID(?string $customerCompanyID): self */ public function withCustomerEmail(?string $customerEmail): self { - $obj = clone $this; - $obj['customerEmail'] = $customerEmail; + $self = clone $this; + $self['customerEmail'] = $customerEmail; - return $obj; + return $self; } /** @@ -697,10 +697,10 @@ public function withCustomerEmail(?string $customerEmail): self */ public function withCustomerID(?string $customerID): self { - $obj = clone $this; - $obj['customerID'] = $customerID; + $self = clone $this; + $self['customerID'] = $customerID; - return $obj; + return $self; } /** @@ -708,10 +708,10 @@ public function withCustomerID(?string $customerID): self */ public function withCustomerName(?string $customerName): self { - $obj = clone $this; - $obj['customerName'] = $customerName; + $self = clone $this; + $self['customerName'] = $customerName; - return $obj; + return $self; } /** @@ -719,10 +719,10 @@ public function withCustomerName(?string $customerName): self */ public function withCustomerTaxID(?string $customerTaxID): self { - $obj = clone $this; - $obj['customerTaxID'] = $customerTaxID; + $self = clone $this; + $self['customerTaxID'] = $customerTaxID; - return $obj; + return $self; } /** @@ -732,10 +732,10 @@ public function withCustomerTaxID(?string $customerTaxID): self */ public function withDirection(DocumentDirection|string $direction): self { - $obj = clone $this; - $obj['direction'] = $direction; + $self = clone $this; + $self['direction'] = $direction; - return $obj; + return $self; } /** @@ -745,10 +745,10 @@ public function withDirection(DocumentDirection|string $direction): self */ public function withDocumentType(DocumentType|string $documentType): self { - $obj = clone $this; - $obj['documentType'] = $documentType; + $self = clone $this; + $self['documentType'] = $documentType; - return $obj; + return $self; } /** @@ -756,10 +756,10 @@ public function withDocumentType(DocumentType|string $documentType): self */ public function withDueDate(?\DateTimeInterface $dueDate): self { - $obj = clone $this; - $obj['dueDate'] = $dueDate; + $self = clone $this; + $self['dueDate'] = $dueDate; - return $obj; + return $self; } /** @@ -767,10 +767,10 @@ public function withDueDate(?\DateTimeInterface $dueDate): self */ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self { - $obj = clone $this; - $obj['invoiceDate'] = $invoiceDate; + $self = clone $this; + $self['invoiceDate'] = $invoiceDate; - return $obj; + return $self; } /** @@ -778,10 +778,10 @@ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self */ public function withInvoiceID(?string $invoiceID): self { - $obj = clone $this; - $obj['invoiceID'] = $invoiceID; + $self = clone $this; + $self['invoiceID'] = $invoiceID; - return $obj; + return $self; } /** @@ -789,10 +789,10 @@ public function withInvoiceID(?string $invoiceID): self */ public function withInvoiceTotal(?string $invoiceTotal): self { - $obj = clone $this; - $obj['invoiceTotal'] = $invoiceTotal; + $self = clone $this; + $self['invoiceTotal'] = $invoiceTotal; - return $obj; + return $self; } /** @@ -814,10 +814,10 @@ public function withInvoiceTotal(?string $invoiceTotal): self */ public function withItems(array $items): self { - $obj = clone $this; - $obj['items'] = $items; + $self = clone $this; + $self['items'] = $items; - return $obj; + return $self; } /** @@ -825,10 +825,10 @@ public function withItems(array $items): self */ public function withNote(?string $note): self { - $obj = clone $this; - $obj['note'] = $note; + $self = clone $this; + $self['note'] = $note; - return $obj; + return $self; } /** @@ -841,10 +841,10 @@ public function withNote(?string $note): self */ public function withPaymentDetails(?array $paymentDetails): self { - $obj = clone $this; - $obj['paymentDetails'] = $paymentDetails; + $self = clone $this; + $self['paymentDetails'] = $paymentDetails; - return $obj; + return $self; } /** @@ -852,10 +852,10 @@ public function withPaymentDetails(?array $paymentDetails): self */ public function withPaymentTerm(?string $paymentTerm): self { - $obj = clone $this; - $obj['paymentTerm'] = $paymentTerm; + $self = clone $this; + $self['paymentTerm'] = $paymentTerm; - return $obj; + return $self; } /** @@ -863,10 +863,10 @@ public function withPaymentTerm(?string $paymentTerm): self */ public function withPurchaseOrder(?string $purchaseOrder): self { - $obj = clone $this; - $obj['purchaseOrder'] = $purchaseOrder; + $self = clone $this; + $self['purchaseOrder'] = $purchaseOrder; - return $obj; + return $self; } /** @@ -874,10 +874,10 @@ public function withPurchaseOrder(?string $purchaseOrder): self */ public function withRemittanceAddress(?string $remittanceAddress): self { - $obj = clone $this; - $obj['remittanceAddress'] = $remittanceAddress; + $self = clone $this; + $self['remittanceAddress'] = $remittanceAddress; - return $obj; + return $self; } /** @@ -886,10 +886,10 @@ public function withRemittanceAddress(?string $remittanceAddress): self public function withRemittanceAddressRecipient( ?string $remittanceAddressRecipient ): self { - $obj = clone $this; - $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; + $self = clone $this; + $self['remittanceAddressRecipient'] = $remittanceAddressRecipient; - return $obj; + return $self; } /** @@ -897,10 +897,10 @@ public function withRemittanceAddressRecipient( */ public function withServiceAddress(?string $serviceAddress): self { - $obj = clone $this; - $obj['serviceAddress'] = $serviceAddress; + $self = clone $this; + $self['serviceAddress'] = $serviceAddress; - return $obj; + return $self; } /** @@ -909,10 +909,10 @@ public function withServiceAddress(?string $serviceAddress): self public function withServiceAddressRecipient( ?string $serviceAddressRecipient ): self { - $obj = clone $this; - $obj['serviceAddressRecipient'] = $serviceAddressRecipient; + $self = clone $this; + $self['serviceAddressRecipient'] = $serviceAddressRecipient; - return $obj; + return $self; } /** @@ -921,10 +921,10 @@ public function withServiceAddressRecipient( public function withServiceEndDate( ?\DateTimeInterface $serviceEndDate ): self { - $obj = clone $this; - $obj['serviceEndDate'] = $serviceEndDate; + $self = clone $this; + $self['serviceEndDate'] = $serviceEndDate; - return $obj; + return $self; } /** @@ -933,10 +933,10 @@ public function withServiceEndDate( public function withServiceStartDate( ?\DateTimeInterface $serviceStartDate ): self { - $obj = clone $this; - $obj['serviceStartDate'] = $serviceStartDate; + $self = clone $this; + $self['serviceStartDate'] = $serviceStartDate; - return $obj; + return $self; } /** @@ -944,10 +944,10 @@ public function withServiceStartDate( */ public function withShippingAddress(?string $shippingAddress): self { - $obj = clone $this; - $obj['shippingAddress'] = $shippingAddress; + $self = clone $this; + $self['shippingAddress'] = $shippingAddress; - return $obj; + return $self; } /** @@ -956,10 +956,10 @@ public function withShippingAddress(?string $shippingAddress): self public function withShippingAddressRecipient( ?string $shippingAddressRecipient ): self { - $obj = clone $this; - $obj['shippingAddressRecipient'] = $shippingAddressRecipient; + $self = clone $this; + $self['shippingAddressRecipient'] = $shippingAddressRecipient; - return $obj; + return $self; } /** @@ -969,10 +969,10 @@ public function withShippingAddressRecipient( */ public function withState(DocumentState|string $state): self { - $obj = clone $this; - $obj['state'] = $state; + $self = clone $this; + $self['state'] = $state; - return $obj; + return $self; } /** @@ -980,10 +980,10 @@ public function withState(DocumentState|string $state): self */ public function withSubtotal(?string $subtotal): self { - $obj = clone $this; - $obj['subtotal'] = $subtotal; + $self = clone $this; + $self['subtotal'] = $subtotal; - return $obj; + return $self; } /** @@ -991,10 +991,10 @@ public function withSubtotal(?string $subtotal): self */ public function withSuccess(bool $success): self { - $obj = clone $this; - $obj['success'] = $success; + $self = clone $this; + $self['success'] = $success; - return $obj; + return $self; } /** @@ -1004,10 +1004,10 @@ public function withSuccess(bool $success): self */ public function withTaxCode(TaxCode|string $taxCode): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -1017,10 +1017,10 @@ public function withTaxCode(TaxCode|string $taxCode): self */ public function withTaxDetails(?array $taxDetails): self { - $obj = clone $this; - $obj['taxDetails'] = $taxDetails; + $self = clone $this; + $self['taxDetails'] = $taxDetails; - return $obj; + return $self; } /** @@ -1028,10 +1028,10 @@ public function withTaxDetails(?array $taxDetails): self */ public function withTotalDiscount(?string $totalDiscount): self { - $obj = clone $this; - $obj['totalDiscount'] = $totalDiscount; + $self = clone $this; + $self['totalDiscount'] = $totalDiscount; - return $obj; + return $self; } /** @@ -1039,10 +1039,10 @@ public function withTotalDiscount(?string $totalDiscount): self */ public function withTotalTax(?string $totalTax): self { - $obj = clone $this; - $obj['totalTax'] = $totalTax; + $self = clone $this; + $self['totalTax'] = $totalTax; - return $obj; + return $self; } /** @@ -1050,10 +1050,10 @@ public function withTotalTax(?string $totalTax): self */ public function withUblDocument(?string $ublDocument): self { - $obj = clone $this; - $obj['ublDocument'] = $ublDocument; + $self = clone $this; + $self['ublDocument'] = $ublDocument; - return $obj; + return $self; } /** @@ -1066,10 +1066,10 @@ public function withUblDocument(?string $ublDocument): self */ public function withVatex(Vatex|string|null $vatex): self { - $obj = clone $this; - $obj['vatex'] = $vatex; + $self = clone $this; + $self['vatex'] = $vatex; - return $obj; + return $self; } /** @@ -1077,10 +1077,10 @@ public function withVatex(Vatex|string|null $vatex): self */ public function withVatexNote(?string $vatexNote): self { - $obj = clone $this; - $obj['vatexNote'] = $vatexNote; + $self = clone $this; + $self['vatexNote'] = $vatexNote; - return $obj; + return $self; } /** @@ -1088,10 +1088,10 @@ public function withVatexNote(?string $vatexNote): self */ public function withVendorAddress(?string $vendorAddress): self { - $obj = clone $this; - $obj['vendorAddress'] = $vendorAddress; + $self = clone $this; + $self['vendorAddress'] = $vendorAddress; - return $obj; + return $self; } /** @@ -1100,10 +1100,10 @@ public function withVendorAddress(?string $vendorAddress): self public function withVendorAddressRecipient( ?string $vendorAddressRecipient ): self { - $obj = clone $this; - $obj['vendorAddressRecipient'] = $vendorAddressRecipient; + $self = clone $this; + $self['vendorAddressRecipient'] = $vendorAddressRecipient; - return $obj; + return $self; } /** @@ -1111,10 +1111,10 @@ public function withVendorAddressRecipient( */ public function withVendorCompanyID(?string $vendorCompanyID): self { - $obj = clone $this; - $obj['vendorCompanyID'] = $vendorCompanyID; + $self = clone $this; + $self['vendorCompanyID'] = $vendorCompanyID; - return $obj; + return $self; } /** @@ -1122,10 +1122,10 @@ public function withVendorCompanyID(?string $vendorCompanyID): self */ public function withVendorEmail(?string $vendorEmail): self { - $obj = clone $this; - $obj['vendorEmail'] = $vendorEmail; + $self = clone $this; + $self['vendorEmail'] = $vendorEmail; - return $obj; + return $self; } /** @@ -1133,10 +1133,10 @@ public function withVendorEmail(?string $vendorEmail): self */ public function withVendorName(?string $vendorName): self { - $obj = clone $this; - $obj['vendorName'] = $vendorName; + $self = clone $this; + $self['vendorName'] = $vendorName; - return $obj; + return $self; } /** @@ -1144,9 +1144,9 @@ public function withVendorName(?string $vendorName): self */ public function withVendorTaxID(?string $vendorTaxID): self { - $obj = clone $this; - $obj['vendorTaxID'] = $vendorTaxID; + $self = clone $this; + $self['vendorTaxID'] = $vendorTaxID; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentNewFromPdfResponse/Item.php b/src/Documents/DocumentNewFromPdfResponse/Item.php index 4f7937df..092d3024 100644 --- a/src/Documents/DocumentNewFromPdfResponse/Item.php +++ b/src/Documents/DocumentNewFromPdfResponse/Item.php @@ -146,22 +146,22 @@ public static function with( UnitOfMeasureCode|string|null $unit = null, ?string $unitPrice = null, ): self { - $obj = new self; - - $obj['date'] = $date; - - null !== $allowances && $obj['allowances'] = $allowances; - null !== $amount && $obj['amount'] = $amount; - null !== $charges && $obj['charges'] = $charges; - null !== $description && $obj['description'] = $description; - null !== $productCode && $obj['productCode'] = $productCode; - null !== $quantity && $obj['quantity'] = $quantity; - null !== $tax && $obj['tax'] = $tax; - null !== $taxRate && $obj['taxRate'] = $taxRate; - null !== $unit && $obj['unit'] = $unit; - null !== $unitPrice && $obj['unitPrice'] = $unitPrice; - - return $obj; + $self = new self; + + $self['date'] = $date; + + null !== $allowances && $self['allowances'] = $allowances; + null !== $amount && $self['amount'] = $amount; + null !== $charges && $self['charges'] = $charges; + null !== $description && $self['description'] = $description; + null !== $productCode && $self['productCode'] = $productCode; + null !== $quantity && $self['quantity'] = $quantity; + null !== $tax && $self['tax'] = $tax; + null !== $taxRate && $self['taxRate'] = $taxRate; + null !== $unit && $self['unit'] = $unit; + null !== $unitPrice && $self['unitPrice'] = $unitPrice; + + return $self; } /** @@ -179,10 +179,10 @@ public static function with( */ public function withAllowances(?array $allowances): self { - $obj = clone $this; - $obj['allowances'] = $allowances; + $self = clone $this; + $self['allowances'] = $allowances; - return $obj; + return $self; } /** @@ -190,10 +190,10 @@ public function withAllowances(?array $allowances): self */ public function withAmount(?string $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -211,10 +211,10 @@ public function withAmount(?string $amount): self */ public function withCharges(?array $charges): self { - $obj = clone $this; - $obj['charges'] = $charges; + $self = clone $this; + $self['charges'] = $charges; - return $obj; + return $self; } /** @@ -222,10 +222,10 @@ public function withCharges(?array $charges): self */ public function withDate(null $date): self { - $obj = clone $this; - $obj['date'] = $date; + $self = clone $this; + $self['date'] = $date; - return $obj; + return $self; } /** @@ -233,10 +233,10 @@ public function withDate(null $date): self */ public function withDescription(?string $description): self { - $obj = clone $this; - $obj['description'] = $description; + $self = clone $this; + $self['description'] = $description; - return $obj; + return $self; } /** @@ -244,10 +244,10 @@ public function withDescription(?string $description): self */ public function withProductCode(?string $productCode): self { - $obj = clone $this; - $obj['productCode'] = $productCode; + $self = clone $this; + $self['productCode'] = $productCode; - return $obj; + return $self; } /** @@ -255,10 +255,10 @@ public function withProductCode(?string $productCode): self */ public function withQuantity(?string $quantity): self { - $obj = clone $this; - $obj['quantity'] = $quantity; + $self = clone $this; + $self['quantity'] = $quantity; - return $obj; + return $self; } /** @@ -266,10 +266,10 @@ public function withQuantity(?string $quantity): self */ public function withTax(?string $tax): self { - $obj = clone $this; - $obj['tax'] = $tax; + $self = clone $this; + $self['tax'] = $tax; - return $obj; + return $self; } /** @@ -277,10 +277,10 @@ public function withTax(?string $tax): self */ public function withTaxRate(?string $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -290,10 +290,10 @@ public function withTaxRate(?string $taxRate): self */ public function withUnit(UnitOfMeasureCode|string|null $unit): self { - $obj = clone $this; - $obj['unit'] = $unit; + $self = clone $this; + $self['unit'] = $unit; - return $obj; + return $self; } /** @@ -301,9 +301,9 @@ public function withUnit(UnitOfMeasureCode|string|null $unit): self */ public function withUnitPrice(?string $unitPrice): self { - $obj = clone $this; - $obj['unitPrice'] = $unitPrice; + $self = clone $this; + $self['unitPrice'] = $unitPrice; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentNewFromPdfResponse/TaxDetail.php b/src/Documents/DocumentNewFromPdfResponse/TaxDetail.php index 9115f9e5..b4064dce 100644 --- a/src/Documents/DocumentNewFromPdfResponse/TaxDetail.php +++ b/src/Documents/DocumentNewFromPdfResponse/TaxDetail.php @@ -42,12 +42,12 @@ public static function with( ?string $amount = null, ?string $rate = null ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $rate && $obj['rate'] = $rate; + null !== $amount && $self['amount'] = $amount; + null !== $rate && $self['rate'] = $rate; - return $obj; + return $self; } /** @@ -55,10 +55,10 @@ public static function with( */ public function withAmount(?string $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -66,9 +66,9 @@ public function withAmount(?string $amount): self */ public function withRate(?string $rate): self { - $obj = clone $this; - $obj['rate'] = $rate; + $self = clone $this; + $self['rate'] = $rate; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentResponse.php b/src/Documents/DocumentResponse.php index 8870a8c7..efd1c9fe 100644 --- a/src/Documents/DocumentResponse.php +++ b/src/Documents/DocumentResponse.php @@ -496,67 +496,67 @@ public static function with( ?string $vendorName = null, ?string $vendorTaxID = null, ): self { - $obj = new self; - - $obj['id'] = $id; - - null !== $allowances && $obj['allowances'] = $allowances; - null !== $amountDue && $obj['amountDue'] = $amountDue; - null !== $attachments && $obj['attachments'] = $attachments; - null !== $billingAddress && $obj['billingAddress'] = $billingAddress; - null !== $billingAddressRecipient && $obj['billingAddressRecipient'] = $billingAddressRecipient; - null !== $charges && $obj['charges'] = $charges; - null !== $currency && $obj['currency'] = $currency; - null !== $customerAddress && $obj['customerAddress'] = $customerAddress; - null !== $customerAddressRecipient && $obj['customerAddressRecipient'] = $customerAddressRecipient; - null !== $customerCompanyID && $obj['customerCompanyID'] = $customerCompanyID; - null !== $customerEmail && $obj['customerEmail'] = $customerEmail; - null !== $customerID && $obj['customerID'] = $customerID; - null !== $customerName && $obj['customerName'] = $customerName; - null !== $customerTaxID && $obj['customerTaxID'] = $customerTaxID; - null !== $direction && $obj['direction'] = $direction; - null !== $documentType && $obj['documentType'] = $documentType; - null !== $dueDate && $obj['dueDate'] = $dueDate; - null !== $invoiceDate && $obj['invoiceDate'] = $invoiceDate; - null !== $invoiceID && $obj['invoiceID'] = $invoiceID; - null !== $invoiceTotal && $obj['invoiceTotal'] = $invoiceTotal; - null !== $items && $obj['items'] = $items; - null !== $note && $obj['note'] = $note; - null !== $paymentDetails && $obj['paymentDetails'] = $paymentDetails; - null !== $paymentTerm && $obj['paymentTerm'] = $paymentTerm; - null !== $purchaseOrder && $obj['purchaseOrder'] = $purchaseOrder; - null !== $remittanceAddress && $obj['remittanceAddress'] = $remittanceAddress; - null !== $remittanceAddressRecipient && $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; - null !== $serviceAddress && $obj['serviceAddress'] = $serviceAddress; - null !== $serviceAddressRecipient && $obj['serviceAddressRecipient'] = $serviceAddressRecipient; - null !== $serviceEndDate && $obj['serviceEndDate'] = $serviceEndDate; - null !== $serviceStartDate && $obj['serviceStartDate'] = $serviceStartDate; - null !== $shippingAddress && $obj['shippingAddress'] = $shippingAddress; - null !== $shippingAddressRecipient && $obj['shippingAddressRecipient'] = $shippingAddressRecipient; - null !== $state && $obj['state'] = $state; - null !== $subtotal && $obj['subtotal'] = $subtotal; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxDetails && $obj['taxDetails'] = $taxDetails; - null !== $totalDiscount && $obj['totalDiscount'] = $totalDiscount; - null !== $totalTax && $obj['totalTax'] = $totalTax; - null !== $vatex && $obj['vatex'] = $vatex; - null !== $vatexNote && $obj['vatexNote'] = $vatexNote; - null !== $vendorAddress && $obj['vendorAddress'] = $vendorAddress; - null !== $vendorAddressRecipient && $obj['vendorAddressRecipient'] = $vendorAddressRecipient; - null !== $vendorCompanyID && $obj['vendorCompanyID'] = $vendorCompanyID; - null !== $vendorEmail && $obj['vendorEmail'] = $vendorEmail; - null !== $vendorName && $obj['vendorName'] = $vendorName; - null !== $vendorTaxID && $obj['vendorTaxID'] = $vendorTaxID; - - return $obj; + $self = new self; + + $self['id'] = $id; + + null !== $allowances && $self['allowances'] = $allowances; + null !== $amountDue && $self['amountDue'] = $amountDue; + null !== $attachments && $self['attachments'] = $attachments; + null !== $billingAddress && $self['billingAddress'] = $billingAddress; + null !== $billingAddressRecipient && $self['billingAddressRecipient'] = $billingAddressRecipient; + null !== $charges && $self['charges'] = $charges; + null !== $currency && $self['currency'] = $currency; + null !== $customerAddress && $self['customerAddress'] = $customerAddress; + null !== $customerAddressRecipient && $self['customerAddressRecipient'] = $customerAddressRecipient; + null !== $customerCompanyID && $self['customerCompanyID'] = $customerCompanyID; + null !== $customerEmail && $self['customerEmail'] = $customerEmail; + null !== $customerID && $self['customerID'] = $customerID; + null !== $customerName && $self['customerName'] = $customerName; + null !== $customerTaxID && $self['customerTaxID'] = $customerTaxID; + null !== $direction && $self['direction'] = $direction; + null !== $documentType && $self['documentType'] = $documentType; + null !== $dueDate && $self['dueDate'] = $dueDate; + null !== $invoiceDate && $self['invoiceDate'] = $invoiceDate; + null !== $invoiceID && $self['invoiceID'] = $invoiceID; + null !== $invoiceTotal && $self['invoiceTotal'] = $invoiceTotal; + null !== $items && $self['items'] = $items; + null !== $note && $self['note'] = $note; + null !== $paymentDetails && $self['paymentDetails'] = $paymentDetails; + null !== $paymentTerm && $self['paymentTerm'] = $paymentTerm; + null !== $purchaseOrder && $self['purchaseOrder'] = $purchaseOrder; + null !== $remittanceAddress && $self['remittanceAddress'] = $remittanceAddress; + null !== $remittanceAddressRecipient && $self['remittanceAddressRecipient'] = $remittanceAddressRecipient; + null !== $serviceAddress && $self['serviceAddress'] = $serviceAddress; + null !== $serviceAddressRecipient && $self['serviceAddressRecipient'] = $serviceAddressRecipient; + null !== $serviceEndDate && $self['serviceEndDate'] = $serviceEndDate; + null !== $serviceStartDate && $self['serviceStartDate'] = $serviceStartDate; + null !== $shippingAddress && $self['shippingAddress'] = $shippingAddress; + null !== $shippingAddressRecipient && $self['shippingAddressRecipient'] = $shippingAddressRecipient; + null !== $state && $self['state'] = $state; + null !== $subtotal && $self['subtotal'] = $subtotal; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxDetails && $self['taxDetails'] = $taxDetails; + null !== $totalDiscount && $self['totalDiscount'] = $totalDiscount; + null !== $totalTax && $self['totalTax'] = $totalTax; + null !== $vatex && $self['vatex'] = $vatex; + null !== $vatexNote && $self['vatexNote'] = $vatexNote; + null !== $vendorAddress && $self['vendorAddress'] = $vendorAddress; + null !== $vendorAddressRecipient && $self['vendorAddressRecipient'] = $vendorAddressRecipient; + null !== $vendorCompanyID && $self['vendorCompanyID'] = $vendorCompanyID; + null !== $vendorEmail && $self['vendorEmail'] = $vendorEmail; + null !== $vendorName && $self['vendorName'] = $vendorName; + null !== $vendorTaxID && $self['vendorTaxID'] = $vendorTaxID; + + return $self; } public function withID(string $id): self { - $obj = clone $this; - $obj['id'] = $id; + $self = clone $this; + $self['id'] = $id; - return $obj; + return $self; } /** @@ -572,10 +572,10 @@ public function withID(string $id): self */ public function withAllowances(?array $allowances): self { - $obj = clone $this; - $obj['allowances'] = $allowances; + $self = clone $this; + $self['allowances'] = $allowances; - return $obj; + return $self; } /** @@ -583,10 +583,10 @@ public function withAllowances(?array $allowances): self */ public function withAmountDue(?string $amountDue): self { - $obj = clone $this; - $obj['amountDue'] = $amountDue; + $self = clone $this; + $self['amountDue'] = $amountDue; - return $obj; + return $self; } /** @@ -600,10 +600,10 @@ public function withAmountDue(?string $amountDue): self */ public function withAttachments(?array $attachments): self { - $obj = clone $this; - $obj['attachments'] = $attachments; + $self = clone $this; + $self['attachments'] = $attachments; - return $obj; + return $self; } /** @@ -611,10 +611,10 @@ public function withAttachments(?array $attachments): self */ public function withBillingAddress(?string $billingAddress): self { - $obj = clone $this; - $obj['billingAddress'] = $billingAddress; + $self = clone $this; + $self['billingAddress'] = $billingAddress; - return $obj; + return $self; } /** @@ -623,10 +623,10 @@ public function withBillingAddress(?string $billingAddress): self public function withBillingAddressRecipient( ?string $billingAddressRecipient ): self { - $obj = clone $this; - $obj['billingAddressRecipient'] = $billingAddressRecipient; + $self = clone $this; + $self['billingAddressRecipient'] = $billingAddressRecipient; - return $obj; + return $self; } /** @@ -642,10 +642,10 @@ public function withBillingAddressRecipient( */ public function withCharges(?array $charges): self { - $obj = clone $this; - $obj['charges'] = $charges; + $self = clone $this; + $self['charges'] = $charges; - return $obj; + return $self; } /** @@ -655,10 +655,10 @@ public function withCharges(?array $charges): self */ public function withCurrency(CurrencyCode|string $currency): self { - $obj = clone $this; - $obj['currency'] = $currency; + $self = clone $this; + $self['currency'] = $currency; - return $obj; + return $self; } /** @@ -666,10 +666,10 @@ public function withCurrency(CurrencyCode|string $currency): self */ public function withCustomerAddress(?string $customerAddress): self { - $obj = clone $this; - $obj['customerAddress'] = $customerAddress; + $self = clone $this; + $self['customerAddress'] = $customerAddress; - return $obj; + return $self; } /** @@ -678,10 +678,10 @@ public function withCustomerAddress(?string $customerAddress): self public function withCustomerAddressRecipient( ?string $customerAddressRecipient ): self { - $obj = clone $this; - $obj['customerAddressRecipient'] = $customerAddressRecipient; + $self = clone $this; + $self['customerAddressRecipient'] = $customerAddressRecipient; - return $obj; + return $self; } /** @@ -689,10 +689,10 @@ public function withCustomerAddressRecipient( */ public function withCustomerCompanyID(?string $customerCompanyID): self { - $obj = clone $this; - $obj['customerCompanyID'] = $customerCompanyID; + $self = clone $this; + $self['customerCompanyID'] = $customerCompanyID; - return $obj; + return $self; } /** @@ -700,10 +700,10 @@ public function withCustomerCompanyID(?string $customerCompanyID): self */ public function withCustomerEmail(?string $customerEmail): self { - $obj = clone $this; - $obj['customerEmail'] = $customerEmail; + $self = clone $this; + $self['customerEmail'] = $customerEmail; - return $obj; + return $self; } /** @@ -711,10 +711,10 @@ public function withCustomerEmail(?string $customerEmail): self */ public function withCustomerID(?string $customerID): self { - $obj = clone $this; - $obj['customerID'] = $customerID; + $self = clone $this; + $self['customerID'] = $customerID; - return $obj; + return $self; } /** @@ -722,10 +722,10 @@ public function withCustomerID(?string $customerID): self */ public function withCustomerName(?string $customerName): self { - $obj = clone $this; - $obj['customerName'] = $customerName; + $self = clone $this; + $self['customerName'] = $customerName; - return $obj; + return $self; } /** @@ -733,10 +733,10 @@ public function withCustomerName(?string $customerName): self */ public function withCustomerTaxID(?string $customerTaxID): self { - $obj = clone $this; - $obj['customerTaxID'] = $customerTaxID; + $self = clone $this; + $self['customerTaxID'] = $customerTaxID; - return $obj; + return $self; } /** @@ -746,10 +746,10 @@ public function withCustomerTaxID(?string $customerTaxID): self */ public function withDirection(DocumentDirection|string $direction): self { - $obj = clone $this; - $obj['direction'] = $direction; + $self = clone $this; + $self['direction'] = $direction; - return $obj; + return $self; } /** @@ -759,10 +759,10 @@ public function withDirection(DocumentDirection|string $direction): self */ public function withDocumentType(DocumentType|string $documentType): self { - $obj = clone $this; - $obj['documentType'] = $documentType; + $self = clone $this; + $self['documentType'] = $documentType; - return $obj; + return $self; } /** @@ -770,10 +770,10 @@ public function withDocumentType(DocumentType|string $documentType): self */ public function withDueDate(?\DateTimeInterface $dueDate): self { - $obj = clone $this; - $obj['dueDate'] = $dueDate; + $self = clone $this; + $self['dueDate'] = $dueDate; - return $obj; + return $self; } /** @@ -781,10 +781,10 @@ public function withDueDate(?\DateTimeInterface $dueDate): self */ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self { - $obj = clone $this; - $obj['invoiceDate'] = $invoiceDate; + $self = clone $this; + $self['invoiceDate'] = $invoiceDate; - return $obj; + return $self; } /** @@ -792,10 +792,10 @@ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self */ public function withInvoiceID(?string $invoiceID): self { - $obj = clone $this; - $obj['invoiceID'] = $invoiceID; + $self = clone $this; + $self['invoiceID'] = $invoiceID; - return $obj; + return $self; } /** @@ -803,10 +803,10 @@ public function withInvoiceID(?string $invoiceID): self */ public function withInvoiceTotal(?string $invoiceTotal): self { - $obj = clone $this; - $obj['invoiceTotal'] = $invoiceTotal; + $self = clone $this; + $self['invoiceTotal'] = $invoiceTotal; - return $obj; + return $self; } /** @@ -826,10 +826,10 @@ public function withInvoiceTotal(?string $invoiceTotal): self */ public function withItems(?array $items): self { - $obj = clone $this; - $obj['items'] = $items; + $self = clone $this; + $self['items'] = $items; - return $obj; + return $self; } /** @@ -837,10 +837,10 @@ public function withItems(?array $items): self */ public function withNote(?string $note): self { - $obj = clone $this; - $obj['note'] = $note; + $self = clone $this; + $self['note'] = $note; - return $obj; + return $self; } /** @@ -853,10 +853,10 @@ public function withNote(?string $note): self */ public function withPaymentDetails(?array $paymentDetails): self { - $obj = clone $this; - $obj['paymentDetails'] = $paymentDetails; + $self = clone $this; + $self['paymentDetails'] = $paymentDetails; - return $obj; + return $self; } /** @@ -864,10 +864,10 @@ public function withPaymentDetails(?array $paymentDetails): self */ public function withPaymentTerm(?string $paymentTerm): self { - $obj = clone $this; - $obj['paymentTerm'] = $paymentTerm; + $self = clone $this; + $self['paymentTerm'] = $paymentTerm; - return $obj; + return $self; } /** @@ -875,10 +875,10 @@ public function withPaymentTerm(?string $paymentTerm): self */ public function withPurchaseOrder(?string $purchaseOrder): self { - $obj = clone $this; - $obj['purchaseOrder'] = $purchaseOrder; + $self = clone $this; + $self['purchaseOrder'] = $purchaseOrder; - return $obj; + return $self; } /** @@ -886,10 +886,10 @@ public function withPurchaseOrder(?string $purchaseOrder): self */ public function withRemittanceAddress(?string $remittanceAddress): self { - $obj = clone $this; - $obj['remittanceAddress'] = $remittanceAddress; + $self = clone $this; + $self['remittanceAddress'] = $remittanceAddress; - return $obj; + return $self; } /** @@ -898,10 +898,10 @@ public function withRemittanceAddress(?string $remittanceAddress): self public function withRemittanceAddressRecipient( ?string $remittanceAddressRecipient ): self { - $obj = clone $this; - $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; + $self = clone $this; + $self['remittanceAddressRecipient'] = $remittanceAddressRecipient; - return $obj; + return $self; } /** @@ -909,10 +909,10 @@ public function withRemittanceAddressRecipient( */ public function withServiceAddress(?string $serviceAddress): self { - $obj = clone $this; - $obj['serviceAddress'] = $serviceAddress; + $self = clone $this; + $self['serviceAddress'] = $serviceAddress; - return $obj; + return $self; } /** @@ -921,10 +921,10 @@ public function withServiceAddress(?string $serviceAddress): self public function withServiceAddressRecipient( ?string $serviceAddressRecipient ): self { - $obj = clone $this; - $obj['serviceAddressRecipient'] = $serviceAddressRecipient; + $self = clone $this; + $self['serviceAddressRecipient'] = $serviceAddressRecipient; - return $obj; + return $self; } /** @@ -933,10 +933,10 @@ public function withServiceAddressRecipient( public function withServiceEndDate( ?\DateTimeInterface $serviceEndDate ): self { - $obj = clone $this; - $obj['serviceEndDate'] = $serviceEndDate; + $self = clone $this; + $self['serviceEndDate'] = $serviceEndDate; - return $obj; + return $self; } /** @@ -945,10 +945,10 @@ public function withServiceEndDate( public function withServiceStartDate( ?\DateTimeInterface $serviceStartDate ): self { - $obj = clone $this; - $obj['serviceStartDate'] = $serviceStartDate; + $self = clone $this; + $self['serviceStartDate'] = $serviceStartDate; - return $obj; + return $self; } /** @@ -956,10 +956,10 @@ public function withServiceStartDate( */ public function withShippingAddress(?string $shippingAddress): self { - $obj = clone $this; - $obj['shippingAddress'] = $shippingAddress; + $self = clone $this; + $self['shippingAddress'] = $shippingAddress; - return $obj; + return $self; } /** @@ -968,10 +968,10 @@ public function withShippingAddress(?string $shippingAddress): self public function withShippingAddressRecipient( ?string $shippingAddressRecipient ): self { - $obj = clone $this; - $obj['shippingAddressRecipient'] = $shippingAddressRecipient; + $self = clone $this; + $self['shippingAddressRecipient'] = $shippingAddressRecipient; - return $obj; + return $self; } /** @@ -981,10 +981,10 @@ public function withShippingAddressRecipient( */ public function withState(DocumentState|string $state): self { - $obj = clone $this; - $obj['state'] = $state; + $self = clone $this; + $self['state'] = $state; - return $obj; + return $self; } /** @@ -992,10 +992,10 @@ public function withState(DocumentState|string $state): self */ public function withSubtotal(?string $subtotal): self { - $obj = clone $this; - $obj['subtotal'] = $subtotal; + $self = clone $this; + $self['subtotal'] = $subtotal; - return $obj; + return $self; } /** @@ -1005,10 +1005,10 @@ public function withSubtotal(?string $subtotal): self */ public function withTaxCode(TaxCode|string $taxCode): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -1018,10 +1018,10 @@ public function withTaxCode(TaxCode|string $taxCode): self */ public function withTaxDetails(?array $taxDetails): self { - $obj = clone $this; - $obj['taxDetails'] = $taxDetails; + $self = clone $this; + $self['taxDetails'] = $taxDetails; - return $obj; + return $self; } /** @@ -1029,10 +1029,10 @@ public function withTaxDetails(?array $taxDetails): self */ public function withTotalDiscount(?string $totalDiscount): self { - $obj = clone $this; - $obj['totalDiscount'] = $totalDiscount; + $self = clone $this; + $self['totalDiscount'] = $totalDiscount; - return $obj; + return $self; } /** @@ -1040,10 +1040,10 @@ public function withTotalDiscount(?string $totalDiscount): self */ public function withTotalTax(?string $totalTax): self { - $obj = clone $this; - $obj['totalTax'] = $totalTax; + $self = clone $this; + $self['totalTax'] = $totalTax; - return $obj; + return $self; } /** @@ -1056,10 +1056,10 @@ public function withTotalTax(?string $totalTax): self */ public function withVatex(Vatex|string|null $vatex): self { - $obj = clone $this; - $obj['vatex'] = $vatex; + $self = clone $this; + $self['vatex'] = $vatex; - return $obj; + return $self; } /** @@ -1067,10 +1067,10 @@ public function withVatex(Vatex|string|null $vatex): self */ public function withVatexNote(?string $vatexNote): self { - $obj = clone $this; - $obj['vatexNote'] = $vatexNote; + $self = clone $this; + $self['vatexNote'] = $vatexNote; - return $obj; + return $self; } /** @@ -1078,10 +1078,10 @@ public function withVatexNote(?string $vatexNote): self */ public function withVendorAddress(?string $vendorAddress): self { - $obj = clone $this; - $obj['vendorAddress'] = $vendorAddress; + $self = clone $this; + $self['vendorAddress'] = $vendorAddress; - return $obj; + return $self; } /** @@ -1090,10 +1090,10 @@ public function withVendorAddress(?string $vendorAddress): self public function withVendorAddressRecipient( ?string $vendorAddressRecipient ): self { - $obj = clone $this; - $obj['vendorAddressRecipient'] = $vendorAddressRecipient; + $self = clone $this; + $self['vendorAddressRecipient'] = $vendorAddressRecipient; - return $obj; + return $self; } /** @@ -1101,10 +1101,10 @@ public function withVendorAddressRecipient( */ public function withVendorCompanyID(?string $vendorCompanyID): self { - $obj = clone $this; - $obj['vendorCompanyID'] = $vendorCompanyID; + $self = clone $this; + $self['vendorCompanyID'] = $vendorCompanyID; - return $obj; + return $self; } /** @@ -1112,10 +1112,10 @@ public function withVendorCompanyID(?string $vendorCompanyID): self */ public function withVendorEmail(?string $vendorEmail): self { - $obj = clone $this; - $obj['vendorEmail'] = $vendorEmail; + $self = clone $this; + $self['vendorEmail'] = $vendorEmail; - return $obj; + return $self; } /** @@ -1123,10 +1123,10 @@ public function withVendorEmail(?string $vendorEmail): self */ public function withVendorName(?string $vendorName): self { - $obj = clone $this; - $obj['vendorName'] = $vendorName; + $self = clone $this; + $self['vendorName'] = $vendorName; - return $obj; + return $self; } /** @@ -1134,9 +1134,9 @@ public function withVendorName(?string $vendorName): self */ public function withVendorTaxID(?string $vendorTaxID): self { - $obj = clone $this; - $obj['vendorTaxID'] = $vendorTaxID; + $self = clone $this; + $self['vendorTaxID'] = $vendorTaxID; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentResponse/Allowance.php b/src/Documents/DocumentResponse/Allowance.php index 07c10a48..4eb7bb1b 100644 --- a/src/Documents/DocumentResponse/Allowance.php +++ b/src/Documents/DocumentResponse/Allowance.php @@ -97,17 +97,17 @@ public static function with( TaxCode|string|null $taxCode = null, ?string $taxRate = null, ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $baseAmount && $obj['baseAmount'] = $baseAmount; - null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; - null !== $reason && $obj['reason'] = $reason; - null !== $reasonCode && $obj['reasonCode'] = $reasonCode; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxRate && $obj['taxRate'] = $taxRate; + null !== $amount && $self['amount'] = $amount; + null !== $baseAmount && $self['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $self['multiplierFactor'] = $multiplierFactor; + null !== $reason && $self['reason'] = $reason; + null !== $reasonCode && $self['reasonCode'] = $reasonCode; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxRate && $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -115,10 +115,10 @@ public static function with( */ public function withAmount(?string $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -126,10 +126,10 @@ public function withAmount(?string $amount): self */ public function withBaseAmount(?string $baseAmount): self { - $obj = clone $this; - $obj['baseAmount'] = $baseAmount; + $self = clone $this; + $self['baseAmount'] = $baseAmount; - return $obj; + return $self; } /** @@ -137,10 +137,10 @@ public function withBaseAmount(?string $baseAmount): self */ public function withMultiplierFactor(?string $multiplierFactor): self { - $obj = clone $this; - $obj['multiplierFactor'] = $multiplierFactor; + $self = clone $this; + $self['multiplierFactor'] = $multiplierFactor; - return $obj; + return $self; } /** @@ -148,10 +148,10 @@ public function withMultiplierFactor(?string $multiplierFactor): self */ public function withReason(?string $reason): self { - $obj = clone $this; - $obj['reason'] = $reason; + $self = clone $this; + $self['reason'] = $reason; - return $obj; + return $self; } /** @@ -161,10 +161,10 @@ public function withReason(?string $reason): self */ public function withReasonCode(ReasonCode|string|null $reasonCode): self { - $obj = clone $this; - $obj['reasonCode'] = $reasonCode; + $self = clone $this; + $self['reasonCode'] = $reasonCode; - return $obj; + return $self; } /** @@ -175,10 +175,10 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self public function withTaxCode( TaxCode|string $taxCode ): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -186,9 +186,9 @@ public function withTaxCode( */ public function withTaxRate(?string $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentResponse/Charge.php b/src/Documents/DocumentResponse/Charge.php index 7c80d5e0..4a7b8f66 100644 --- a/src/Documents/DocumentResponse/Charge.php +++ b/src/Documents/DocumentResponse/Charge.php @@ -102,17 +102,17 @@ public static function with( TaxCode|string|null $taxCode = null, ?string $taxRate = null, ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $baseAmount && $obj['baseAmount'] = $baseAmount; - null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; - null !== $reason && $obj['reason'] = $reason; - null !== $reasonCode && $obj['reasonCode'] = $reasonCode; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxRate && $obj['taxRate'] = $taxRate; + null !== $amount && $self['amount'] = $amount; + null !== $baseAmount && $self['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $self['multiplierFactor'] = $multiplierFactor; + null !== $reason && $self['reason'] = $reason; + null !== $reasonCode && $self['reasonCode'] = $reasonCode; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxRate && $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -120,10 +120,10 @@ public static function with( */ public function withAmount(?string $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -131,10 +131,10 @@ public function withAmount(?string $amount): self */ public function withBaseAmount(?string $baseAmount): self { - $obj = clone $this; - $obj['baseAmount'] = $baseAmount; + $self = clone $this; + $self['baseAmount'] = $baseAmount; - return $obj; + return $self; } /** @@ -142,10 +142,10 @@ public function withBaseAmount(?string $baseAmount): self */ public function withMultiplierFactor(?string $multiplierFactor): self { - $obj = clone $this; - $obj['multiplierFactor'] = $multiplierFactor; + $self = clone $this; + $self['multiplierFactor'] = $multiplierFactor; - return $obj; + return $self; } /** @@ -153,10 +153,10 @@ public function withMultiplierFactor(?string $multiplierFactor): self */ public function withReason(?string $reason): self { - $obj = clone $this; - $obj['reason'] = $reason; + $self = clone $this; + $self['reason'] = $reason; - return $obj; + return $self; } /** @@ -166,10 +166,10 @@ public function withReason(?string $reason): self */ public function withReasonCode(ReasonCode|string|null $reasonCode): self { - $obj = clone $this; - $obj['reasonCode'] = $reasonCode; + $self = clone $this; + $self['reasonCode'] = $reasonCode; - return $obj; + return $self; } /** @@ -184,10 +184,10 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self public function withTaxCode( TaxCode|string|null $taxCode ): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -195,9 +195,9 @@ public function withTaxCode( */ public function withTaxRate(?string $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentResponse/Item.php b/src/Documents/DocumentResponse/Item.php index 5554d8f3..4dd3f017 100644 --- a/src/Documents/DocumentResponse/Item.php +++ b/src/Documents/DocumentResponse/Item.php @@ -146,22 +146,22 @@ public static function with( UnitOfMeasureCode|string|null $unit = null, ?string $unitPrice = null, ): self { - $obj = new self; - - $obj['date'] = $date; - - null !== $allowances && $obj['allowances'] = $allowances; - null !== $amount && $obj['amount'] = $amount; - null !== $charges && $obj['charges'] = $charges; - null !== $description && $obj['description'] = $description; - null !== $productCode && $obj['productCode'] = $productCode; - null !== $quantity && $obj['quantity'] = $quantity; - null !== $tax && $obj['tax'] = $tax; - null !== $taxRate && $obj['taxRate'] = $taxRate; - null !== $unit && $obj['unit'] = $unit; - null !== $unitPrice && $obj['unitPrice'] = $unitPrice; - - return $obj; + $self = new self; + + $self['date'] = $date; + + null !== $allowances && $self['allowances'] = $allowances; + null !== $amount && $self['amount'] = $amount; + null !== $charges && $self['charges'] = $charges; + null !== $description && $self['description'] = $description; + null !== $productCode && $self['productCode'] = $productCode; + null !== $quantity && $self['quantity'] = $quantity; + null !== $tax && $self['tax'] = $tax; + null !== $taxRate && $self['taxRate'] = $taxRate; + null !== $unit && $self['unit'] = $unit; + null !== $unitPrice && $self['unitPrice'] = $unitPrice; + + return $self; } /** @@ -179,10 +179,10 @@ public static function with( */ public function withAllowances(?array $allowances): self { - $obj = clone $this; - $obj['allowances'] = $allowances; + $self = clone $this; + $self['allowances'] = $allowances; - return $obj; + return $self; } /** @@ -190,10 +190,10 @@ public function withAllowances(?array $allowances): self */ public function withAmount(?string $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -211,10 +211,10 @@ public function withAmount(?string $amount): self */ public function withCharges(?array $charges): self { - $obj = clone $this; - $obj['charges'] = $charges; + $self = clone $this; + $self['charges'] = $charges; - return $obj; + return $self; } /** @@ -222,10 +222,10 @@ public function withCharges(?array $charges): self */ public function withDate(null $date): self { - $obj = clone $this; - $obj['date'] = $date; + $self = clone $this; + $self['date'] = $date; - return $obj; + return $self; } /** @@ -233,10 +233,10 @@ public function withDate(null $date): self */ public function withDescription(?string $description): self { - $obj = clone $this; - $obj['description'] = $description; + $self = clone $this; + $self['description'] = $description; - return $obj; + return $self; } /** @@ -244,10 +244,10 @@ public function withDescription(?string $description): self */ public function withProductCode(?string $productCode): self { - $obj = clone $this; - $obj['productCode'] = $productCode; + $self = clone $this; + $self['productCode'] = $productCode; - return $obj; + return $self; } /** @@ -255,10 +255,10 @@ public function withProductCode(?string $productCode): self */ public function withQuantity(?string $quantity): self { - $obj = clone $this; - $obj['quantity'] = $quantity; + $self = clone $this; + $self['quantity'] = $quantity; - return $obj; + return $self; } /** @@ -266,10 +266,10 @@ public function withQuantity(?string $quantity): self */ public function withTax(?string $tax): self { - $obj = clone $this; - $obj['tax'] = $tax; + $self = clone $this; + $self['tax'] = $tax; - return $obj; + return $self; } /** @@ -277,10 +277,10 @@ public function withTax(?string $tax): self */ public function withTaxRate(?string $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -290,10 +290,10 @@ public function withTaxRate(?string $taxRate): self */ public function withUnit(UnitOfMeasureCode|string|null $unit): self { - $obj = clone $this; - $obj['unit'] = $unit; + $self = clone $this; + $self['unit'] = $unit; - return $obj; + return $self; } /** @@ -301,9 +301,9 @@ public function withUnit(UnitOfMeasureCode|string|null $unit): self */ public function withUnitPrice(?string $unitPrice): self { - $obj = clone $this; - $obj['unitPrice'] = $unitPrice; + $self = clone $this; + $self['unitPrice'] = $unitPrice; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentResponse/PaymentDetail.php b/src/Documents/DocumentResponse/PaymentDetail.php index 2eb1424f..e4592f03 100644 --- a/src/Documents/DocumentResponse/PaymentDetail.php +++ b/src/Documents/DocumentResponse/PaymentDetail.php @@ -61,14 +61,14 @@ public static function with( ?string $paymentReference = null, ?string $swift = null, ): self { - $obj = new self; + $self = new self; - null !== $bankAccountNumber && $obj['bankAccountNumber'] = $bankAccountNumber; - null !== $iban && $obj['iban'] = $iban; - null !== $paymentReference && $obj['paymentReference'] = $paymentReference; - null !== $swift && $obj['swift'] = $swift; + null !== $bankAccountNumber && $self['bankAccountNumber'] = $bankAccountNumber; + null !== $iban && $self['iban'] = $iban; + null !== $paymentReference && $self['paymentReference'] = $paymentReference; + null !== $swift && $self['swift'] = $swift; - return $obj; + return $self; } /** @@ -76,10 +76,10 @@ public static function with( */ public function withBankAccountNumber(?string $bankAccountNumber): self { - $obj = clone $this; - $obj['bankAccountNumber'] = $bankAccountNumber; + $self = clone $this; + $self['bankAccountNumber'] = $bankAccountNumber; - return $obj; + return $self; } /** @@ -87,10 +87,10 @@ public function withBankAccountNumber(?string $bankAccountNumber): self */ public function withIban(?string $iban): self { - $obj = clone $this; - $obj['iban'] = $iban; + $self = clone $this; + $self['iban'] = $iban; - return $obj; + return $self; } /** @@ -98,10 +98,10 @@ public function withIban(?string $iban): self */ public function withPaymentReference(?string $paymentReference): self { - $obj = clone $this; - $obj['paymentReference'] = $paymentReference; + $self = clone $this; + $self['paymentReference'] = $paymentReference; - return $obj; + return $self; } /** @@ -109,9 +109,9 @@ public function withPaymentReference(?string $paymentReference): self */ public function withSwift(?string $swift): self { - $obj = clone $this; - $obj['swift'] = $swift; + $self = clone $this; + $self['swift'] = $swift; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentResponse/TaxDetail.php b/src/Documents/DocumentResponse/TaxDetail.php index 254805a3..1a42d3ef 100644 --- a/src/Documents/DocumentResponse/TaxDetail.php +++ b/src/Documents/DocumentResponse/TaxDetail.php @@ -42,12 +42,12 @@ public static function with( ?string $amount = null, ?string $rate = null ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $rate && $obj['rate'] = $rate; + null !== $amount && $self['amount'] = $amount; + null !== $rate && $self['rate'] = $rate; - return $obj; + return $self; } /** @@ -55,10 +55,10 @@ public static function with( */ public function withAmount(?string $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -66,9 +66,9 @@ public function withAmount(?string $amount): self */ public function withRate(?string $rate): self { - $obj = clone $this; - $obj['rate'] = $rate; + $self = clone $this; + $self['rate'] = $rate; - return $obj; + return $self; } } diff --git a/src/Documents/DocumentSendParams.php b/src/Documents/DocumentSendParams.php index 0e2556a6..c6b90f15 100644 --- a/src/Documents/DocumentSendParams.php +++ b/src/Documents/DocumentSendParams.php @@ -60,55 +60,55 @@ public static function with( ?string $senderPeppolID = null, ?string $senderPeppolScheme = null, ): self { - $obj = new self; + $self = new self; - null !== $email && $obj['email'] = $email; - null !== $receiverPeppolID && $obj['receiverPeppolID'] = $receiverPeppolID; - null !== $receiverPeppolScheme && $obj['receiverPeppolScheme'] = $receiverPeppolScheme; - null !== $senderPeppolID && $obj['senderPeppolID'] = $senderPeppolID; - null !== $senderPeppolScheme && $obj['senderPeppolScheme'] = $senderPeppolScheme; + null !== $email && $self['email'] = $email; + null !== $receiverPeppolID && $self['receiverPeppolID'] = $receiverPeppolID; + null !== $receiverPeppolScheme && $self['receiverPeppolScheme'] = $receiverPeppolScheme; + null !== $senderPeppolID && $self['senderPeppolID'] = $senderPeppolID; + null !== $senderPeppolScheme && $self['senderPeppolScheme'] = $senderPeppolScheme; - return $obj; + return $self; } public function withEmail(?string $email): self { - $obj = clone $this; - $obj['email'] = $email; + $self = clone $this; + $self['email'] = $email; - return $obj; + return $self; } public function withReceiverPeppolID(?string $receiverPeppolID): self { - $obj = clone $this; - $obj['receiverPeppolID'] = $receiverPeppolID; + $self = clone $this; + $self['receiverPeppolID'] = $receiverPeppolID; - return $obj; + return $self; } public function withReceiverPeppolScheme( ?string $receiverPeppolScheme ): self { - $obj = clone $this; - $obj['receiverPeppolScheme'] = $receiverPeppolScheme; + $self = clone $this; + $self['receiverPeppolScheme'] = $receiverPeppolScheme; - return $obj; + return $self; } public function withSenderPeppolID(?string $senderPeppolID): self { - $obj = clone $this; - $obj['senderPeppolID'] = $senderPeppolID; + $self = clone $this; + $self['senderPeppolID'] = $senderPeppolID; - return $obj; + return $self; } public function withSenderPeppolScheme(?string $senderPeppolScheme): self { - $obj = clone $this; - $obj['senderPeppolScheme'] = $senderPeppolScheme; + $self = clone $this; + $self['senderPeppolScheme'] = $senderPeppolScheme; - return $obj; + return $self; } } diff --git a/src/Documents/PaymentDetailCreate.php b/src/Documents/PaymentDetailCreate.php index fbc9bb40..cfe4883a 100644 --- a/src/Documents/PaymentDetailCreate.php +++ b/src/Documents/PaymentDetailCreate.php @@ -61,14 +61,14 @@ public static function with( ?string $paymentReference = null, ?string $swift = null, ): self { - $obj = new self; + $self = new self; - null !== $bankAccountNumber && $obj['bankAccountNumber'] = $bankAccountNumber; - null !== $iban && $obj['iban'] = $iban; - null !== $paymentReference && $obj['paymentReference'] = $paymentReference; - null !== $swift && $obj['swift'] = $swift; + null !== $bankAccountNumber && $self['bankAccountNumber'] = $bankAccountNumber; + null !== $iban && $self['iban'] = $iban; + null !== $paymentReference && $self['paymentReference'] = $paymentReference; + null !== $swift && $self['swift'] = $swift; - return $obj; + return $self; } /** @@ -76,10 +76,10 @@ public static function with( */ public function withBankAccountNumber(?string $bankAccountNumber): self { - $obj = clone $this; - $obj['bankAccountNumber'] = $bankAccountNumber; + $self = clone $this; + $self['bankAccountNumber'] = $bankAccountNumber; - return $obj; + return $self; } /** @@ -87,10 +87,10 @@ public function withBankAccountNumber(?string $bankAccountNumber): self */ public function withIban(?string $iban): self { - $obj = clone $this; - $obj['iban'] = $iban; + $self = clone $this; + $self['iban'] = $iban; - return $obj; + return $self; } /** @@ -98,10 +98,10 @@ public function withIban(?string $iban): self */ public function withPaymentReference(?string $paymentReference): self { - $obj = clone $this; - $obj['paymentReference'] = $paymentReference; + $self = clone $this; + $self['paymentReference'] = $paymentReference; - return $obj; + return $self; } /** @@ -109,9 +109,9 @@ public function withPaymentReference(?string $paymentReference): self */ public function withSwift(?string $swift): self { - $obj = clone $this; - $obj['swift'] = $swift; + $self = clone $this; + $self['swift'] = $swift; - return $obj; + return $self; } } diff --git a/src/Documents/Ubl/UblCreateFromUblParams.php b/src/Documents/Ubl/UblCreateFromUblParams.php index acf690f9..590c9fa6 100644 --- a/src/Documents/Ubl/UblCreateFromUblParams.php +++ b/src/Documents/Ubl/UblCreateFromUblParams.php @@ -51,18 +51,18 @@ public function __construct() */ public static function with(string $file): self { - $obj = new self; + $self = new self; - $obj['file'] = $file; + $self['file'] = $file; - return $obj; + return $self; } public function withFile(string $file): self { - $obj = clone $this; - $obj['file'] = $file; + $self = clone $this; + $self['file'] = $file; - return $obj; + return $self; } } diff --git a/src/Documents/Ubl/UblGetResponse.php b/src/Documents/Ubl/UblGetResponse.php index e94b0a73..9c8cd80c 100644 --- a/src/Documents/Ubl/UblGetResponse.php +++ b/src/Documents/Ubl/UblGetResponse.php @@ -94,101 +94,101 @@ public static function with( ?string $signedURL = null, ?\DateTimeInterface $validatedAt = null, ): self { - $obj = new self; + $self = new self; - $obj['id'] = $id; - $obj['fileName'] = $fileName; + $self['id'] = $id; + $self['fileName'] = $fileName; - null !== $fileHash && $obj['fileHash'] = $fileHash; - null !== $fileSize && $obj['fileSize'] = $fileSize; - null !== $receiverPeppolID && $obj['receiverPeppolID'] = $receiverPeppolID; - null !== $receiverPeppolScheme && $obj['receiverPeppolScheme'] = $receiverPeppolScheme; - null !== $senderPeppolID && $obj['senderPeppolID'] = $senderPeppolID; - null !== $senderPeppolScheme && $obj['senderPeppolScheme'] = $senderPeppolScheme; - null !== $signedURL && $obj['signedURL'] = $signedURL; - null !== $validatedAt && $obj['validatedAt'] = $validatedAt; + null !== $fileHash && $self['fileHash'] = $fileHash; + null !== $fileSize && $self['fileSize'] = $fileSize; + null !== $receiverPeppolID && $self['receiverPeppolID'] = $receiverPeppolID; + null !== $receiverPeppolScheme && $self['receiverPeppolScheme'] = $receiverPeppolScheme; + null !== $senderPeppolID && $self['senderPeppolID'] = $senderPeppolID; + null !== $senderPeppolScheme && $self['senderPeppolScheme'] = $senderPeppolScheme; + null !== $signedURL && $self['signedURL'] = $signedURL; + null !== $validatedAt && $self['validatedAt'] = $validatedAt; - return $obj; + return $self; } public function withID(string $id): self { - $obj = clone $this; - $obj['id'] = $id; + $self = clone $this; + $self['id'] = $id; - return $obj; + return $self; } public function withFileName(string $fileName): self { - $obj = clone $this; - $obj['fileName'] = $fileName; + $self = clone $this; + $self['fileName'] = $fileName; - return $obj; + return $self; } public function withFileHash(?string $fileHash): self { - $obj = clone $this; - $obj['fileHash'] = $fileHash; + $self = clone $this; + $self['fileHash'] = $fileHash; - return $obj; + return $self; } public function withFileSize(int $fileSize): self { - $obj = clone $this; - $obj['fileSize'] = $fileSize; + $self = clone $this; + $self['fileSize'] = $fileSize; - return $obj; + return $self; } public function withReceiverPeppolID(?string $receiverPeppolID): self { - $obj = clone $this; - $obj['receiverPeppolID'] = $receiverPeppolID; + $self = clone $this; + $self['receiverPeppolID'] = $receiverPeppolID; - return $obj; + return $self; } public function withReceiverPeppolScheme( ?string $receiverPeppolScheme ): self { - $obj = clone $this; - $obj['receiverPeppolScheme'] = $receiverPeppolScheme; + $self = clone $this; + $self['receiverPeppolScheme'] = $receiverPeppolScheme; - return $obj; + return $self; } public function withSenderPeppolID(?string $senderPeppolID): self { - $obj = clone $this; - $obj['senderPeppolID'] = $senderPeppolID; + $self = clone $this; + $self['senderPeppolID'] = $senderPeppolID; - return $obj; + return $self; } public function withSenderPeppolScheme(?string $senderPeppolScheme): self { - $obj = clone $this; - $obj['senderPeppolScheme'] = $senderPeppolScheme; + $self = clone $this; + $self['senderPeppolScheme'] = $senderPeppolScheme; - return $obj; + return $self; } public function withSignedURL(?string $signedURL): self { - $obj = clone $this; - $obj['signedURL'] = $signedURL; + $self = clone $this; + $self['signedURL'] = $signedURL; - return $obj; + return $self; } public function withValidatedAt(?\DateTimeInterface $validatedAt): self { - $obj = clone $this; - $obj['validatedAt'] = $validatedAt; + $self = clone $this; + $self['validatedAt'] = $validatedAt; - return $obj; + return $self; } } diff --git a/src/Inbox/InboxListCreditNotesParams.php b/src/Inbox/InboxListCreditNotesParams.php index 4c041eb0..0dc1720c 100644 --- a/src/Inbox/InboxListCreditNotesParams.php +++ b/src/Inbox/InboxListCreditNotesParams.php @@ -48,12 +48,12 @@ public function __construct() */ public static function with(?int $page = null, ?int $pageSize = null): self { - $obj = new self; + $self = new self; - null !== $page && $obj['page'] = $page; - null !== $pageSize && $obj['pageSize'] = $pageSize; + null !== $page && $self['page'] = $page; + null !== $pageSize && $self['pageSize'] = $pageSize; - return $obj; + return $self; } /** @@ -61,10 +61,10 @@ public static function with(?int $page = null, ?int $pageSize = null): self */ public function withPage(int $page): self { - $obj = clone $this; - $obj['page'] = $page; + $self = clone $this; + $self['page'] = $page; - return $obj; + return $self; } /** @@ -72,9 +72,9 @@ public function withPage(int $page): self */ public function withPageSize(int $pageSize): self { - $obj = clone $this; - $obj['pageSize'] = $pageSize; + $self = clone $this; + $self['pageSize'] = $pageSize; - return $obj; + return $self; } } diff --git a/src/Inbox/InboxListInvoicesParams.php b/src/Inbox/InboxListInvoicesParams.php index 5b449446..66852507 100644 --- a/src/Inbox/InboxListInvoicesParams.php +++ b/src/Inbox/InboxListInvoicesParams.php @@ -46,12 +46,12 @@ public function __construct() */ public static function with(?int $page = null, ?int $pageSize = null): self { - $obj = new self; + $self = new self; - null !== $page && $obj['page'] = $page; - null !== $pageSize && $obj['pageSize'] = $pageSize; + null !== $page && $self['page'] = $page; + null !== $pageSize && $self['pageSize'] = $pageSize; - return $obj; + return $self; } /** @@ -59,10 +59,10 @@ public static function with(?int $page = null, ?int $pageSize = null): self */ public function withPage(int $page): self { - $obj = clone $this; - $obj['page'] = $page; + $self = clone $this; + $self['page'] = $page; - return $obj; + return $self; } /** @@ -70,9 +70,9 @@ public function withPage(int $page): self */ public function withPageSize(int $pageSize): self { - $obj = clone $this; - $obj['pageSize'] = $pageSize; + $self = clone $this; + $self['pageSize'] = $pageSize; - return $obj; + return $self; } } diff --git a/src/Inbox/InboxListParams.php b/src/Inbox/InboxListParams.php index 66ad58f8..bda86874 100644 --- a/src/Inbox/InboxListParams.php +++ b/src/Inbox/InboxListParams.php @@ -107,18 +107,18 @@ public static function with( DocumentState|string|null $state = null, DocumentType|string|null $type = null, ): self { - $obj = new self; - - null !== $dateFrom && $obj['dateFrom'] = $dateFrom; - null !== $dateTo && $obj['dateTo'] = $dateTo; - null !== $page && $obj['page'] = $page; - null !== $pageSize && $obj['pageSize'] = $pageSize; - null !== $search && $obj['search'] = $search; - null !== $sender && $obj['sender'] = $sender; - null !== $state && $obj['state'] = $state; - null !== $type && $obj['type'] = $type; - - return $obj; + $self = new self; + + null !== $dateFrom && $self['dateFrom'] = $dateFrom; + null !== $dateTo && $self['dateTo'] = $dateTo; + null !== $page && $self['page'] = $page; + null !== $pageSize && $self['pageSize'] = $pageSize; + null !== $search && $self['search'] = $search; + null !== $sender && $self['sender'] = $sender; + null !== $state && $self['state'] = $state; + null !== $type && $self['type'] = $type; + + return $self; } /** @@ -126,10 +126,10 @@ public static function with( */ public function withDateFrom(?\DateTimeInterface $dateFrom): self { - $obj = clone $this; - $obj['dateFrom'] = $dateFrom; + $self = clone $this; + $self['dateFrom'] = $dateFrom; - return $obj; + return $self; } /** @@ -137,10 +137,10 @@ public function withDateFrom(?\DateTimeInterface $dateFrom): self */ public function withDateTo(?\DateTimeInterface $dateTo): self { - $obj = clone $this; - $obj['dateTo'] = $dateTo; + $self = clone $this; + $self['dateTo'] = $dateTo; - return $obj; + return $self; } /** @@ -148,10 +148,10 @@ public function withDateTo(?\DateTimeInterface $dateTo): self */ public function withPage(int $page): self { - $obj = clone $this; - $obj['page'] = $page; + $self = clone $this; + $self['page'] = $page; - return $obj; + return $self; } /** @@ -159,10 +159,10 @@ public function withPage(int $page): self */ public function withPageSize(int $pageSize): self { - $obj = clone $this; - $obj['pageSize'] = $pageSize; + $self = clone $this; + $self['pageSize'] = $pageSize; - return $obj; + return $self; } /** @@ -170,10 +170,10 @@ public function withPageSize(int $pageSize): self */ public function withSearch(?string $search): self { - $obj = clone $this; - $obj['search'] = $search; + $self = clone $this; + $self['search'] = $search; - return $obj; + return $self; } /** @@ -181,10 +181,10 @@ public function withSearch(?string $search): self */ public function withSender(?string $sender): self { - $obj = clone $this; - $obj['sender'] = $sender; + $self = clone $this; + $self['sender'] = $sender; - return $obj; + return $self; } /** @@ -194,10 +194,10 @@ public function withSender(?string $sender): self */ public function withState(DocumentState|string|null $state): self { - $obj = clone $this; - $obj['state'] = $state; + $self = clone $this; + $self['state'] = $state; - return $obj; + return $self; } /** @@ -207,9 +207,9 @@ public function withState(DocumentState|string|null $state): self */ public function withType(DocumentType|string|null $type): self { - $obj = clone $this; - $obj['type'] = $type; + $self = clone $this; + $self['type'] = $type; - return $obj; + return $self; } } diff --git a/src/Inbox/PaginatedDocumentResponse.php b/src/Inbox/PaginatedDocumentResponse.php index 1c4cba8c..8bc55295 100644 --- a/src/Inbox/PaginatedDocumentResponse.php +++ b/src/Inbox/PaginatedDocumentResponse.php @@ -139,15 +139,15 @@ public static function with( int $pages, int $total ): self { - $obj = new self; + $self = new self; - $obj['items'] = $items; - $obj['page'] = $page; - $obj['pageSize'] = $pageSize; - $obj['pages'] = $pages; - $obj['total'] = $total; + $self['items'] = $items; + $self['page'] = $page; + $self['pageSize'] = $pageSize; + $self['pages'] = $pages; + $self['total'] = $total; - return $obj; + return $self; } /** @@ -204,41 +204,41 @@ public static function with( */ public function withItems(array $items): self { - $obj = clone $this; - $obj['items'] = $items; + $self = clone $this; + $self['items'] = $items; - return $obj; + return $self; } public function withPage(int $page): self { - $obj = clone $this; - $obj['page'] = $page; + $self = clone $this; + $self['page'] = $page; - return $obj; + return $self; } public function withPageSize(int $pageSize): self { - $obj = clone $this; - $obj['pageSize'] = $pageSize; + $self = clone $this; + $self['pageSize'] = $pageSize; - return $obj; + return $self; } public function withPages(int $pages): self { - $obj = clone $this; - $obj['pages'] = $pages; + $self = clone $this; + $self['pages'] = $pages; - return $obj; + return $self; } public function withTotal(int $total): self { - $obj = clone $this; - $obj['total'] = $total; + $self = clone $this; + $self['total'] = $total; - return $obj; + return $self; } } diff --git a/src/Lookup/Certificate.php b/src/Lookup/Certificate.php index 86a3c7fe..aa42f621 100644 --- a/src/Lookup/Certificate.php +++ b/src/Lookup/Certificate.php @@ -72,14 +72,14 @@ public static function with( ?array $details = null, ?string $error = null ): self { - $obj = new self; + $self = new self; - $obj['status'] = $status; + $self['status'] = $status; - null !== $details && $obj['details'] = $details; - null !== $error && $obj['error'] = $error; + null !== $details && $self['details'] = $details; + null !== $error && $self['error'] = $error; - return $obj; + return $self; } /** @@ -87,10 +87,10 @@ public static function with( */ public function withStatus(string $status): self { - $obj = clone $this; - $obj['status'] = $status; + $self = clone $this; + $self['status'] = $status; - return $obj; + return $self; } /** @@ -100,10 +100,10 @@ public function withStatus(string $status): self */ public function withDetails(?array $details): self { - $obj = clone $this; - $obj['details'] = $details; + $self = clone $this; + $self['details'] = $details; - return $obj; + return $self; } /** @@ -111,9 +111,9 @@ public function withDetails(?array $details): self */ public function withError(?string $error): self { - $obj = clone $this; - $obj['error'] = $error; + $self = clone $this; + $self['error'] = $error; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupGetParticipantsResponse.php b/src/Lookup/LookupGetParticipantsResponse.php index 55caa650..67c8659a 100644 --- a/src/Lookup/LookupGetParticipantsResponse.php +++ b/src/Lookup/LookupGetParticipantsResponse.php @@ -104,16 +104,16 @@ public static function with( int $usedCount, ?array $participants = null, ): self { - $obj = new self; + $self = new self; - $obj['queryTerms'] = $queryTerms; - $obj['searchDate'] = $searchDate; - $obj['totalCount'] = $totalCount; - $obj['usedCount'] = $usedCount; + $self['queryTerms'] = $queryTerms; + $self['searchDate'] = $searchDate; + $self['totalCount'] = $totalCount; + $self['usedCount'] = $usedCount; - null !== $participants && $obj['participants'] = $participants; + null !== $participants && $self['participants'] = $participants; - return $obj; + return $self; } /** @@ -121,10 +121,10 @@ public static function with( */ public function withQueryTerms(string $queryTerms): self { - $obj = clone $this; - $obj['queryTerms'] = $queryTerms; + $self = clone $this; + $self['queryTerms'] = $queryTerms; - return $obj; + return $self; } /** @@ -132,10 +132,10 @@ public function withQueryTerms(string $queryTerms): self */ public function withSearchDate(string $searchDate): self { - $obj = clone $this; - $obj['searchDate'] = $searchDate; + $self = clone $this; + $self['searchDate'] = $searchDate; - return $obj; + return $self; } /** @@ -143,10 +143,10 @@ public function withSearchDate(string $searchDate): self */ public function withTotalCount(int $totalCount): self { - $obj = clone $this; - $obj['totalCount'] = $totalCount; + $self = clone $this; + $self['totalCount'] = $totalCount; - return $obj; + return $self; } /** @@ -154,10 +154,10 @@ public function withTotalCount(int $totalCount): self */ public function withUsedCount(int $usedCount): self { - $obj = clone $this; - $obj['usedCount'] = $usedCount; + $self = clone $this; + $self['usedCount'] = $usedCount; - return $obj; + return $self; } /** @@ -172,9 +172,9 @@ public function withUsedCount(int $usedCount): self */ public function withParticipants(array $participants): self { - $obj = clone $this; - $obj['participants'] = $participants; + $self = clone $this; + $self['participants'] = $participants; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupGetParticipantsResponse/Participant.php b/src/Lookup/LookupGetParticipantsResponse/Participant.php index 6d629e7a..307c71a9 100644 --- a/src/Lookup/LookupGetParticipantsResponse/Participant.php +++ b/src/Lookup/LookupGetParticipantsResponse/Participant.php @@ -96,15 +96,15 @@ public static function with( ?array $documentTypes = null, ?array $entities = null, ): self { - $obj = new self; + $self = new self; - $obj['peppolID'] = $peppolID; - $obj['peppolScheme'] = $peppolScheme; + $self['peppolID'] = $peppolID; + $self['peppolScheme'] = $peppolScheme; - null !== $documentTypes && $obj['documentTypes'] = $documentTypes; - null !== $entities && $obj['entities'] = $entities; + null !== $documentTypes && $self['documentTypes'] = $documentTypes; + null !== $entities && $self['entities'] = $entities; - return $obj; + return $self; } /** @@ -112,10 +112,10 @@ public static function with( */ public function withPeppolID(string $peppolID): self { - $obj = clone $this; - $obj['peppolID'] = $peppolID; + $self = clone $this; + $self['peppolID'] = $peppolID; - return $obj; + return $self; } /** @@ -123,10 +123,10 @@ public function withPeppolID(string $peppolID): self */ public function withPeppolScheme(string $peppolScheme): self { - $obj = clone $this; - $obj['peppolScheme'] = $peppolScheme; + $self = clone $this; + $self['peppolScheme'] = $peppolScheme; - return $obj; + return $self; } /** @@ -136,10 +136,10 @@ public function withPeppolScheme(string $peppolScheme): self */ public function withDocumentTypes(array $documentTypes): self { - $obj = clone $this; - $obj['documentTypes'] = $documentTypes; + $self = clone $this; + $self['documentTypes'] = $documentTypes; - return $obj; + return $self; } /** @@ -157,9 +157,9 @@ public function withDocumentTypes(array $documentTypes): self */ public function withEntities(array $entities): self { - $obj = clone $this; - $obj['entities'] = $entities; + $self = clone $this; + $self['entities'] = $entities; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupGetParticipantsResponse/Participant/DocumentType.php b/src/Lookup/LookupGetParticipantsResponse/Participant/DocumentType.php index f3e98066..95de15e7 100644 --- a/src/Lookup/LookupGetParticipantsResponse/Participant/DocumentType.php +++ b/src/Lookup/LookupGetParticipantsResponse/Participant/DocumentType.php @@ -56,12 +56,12 @@ public function __construct() */ public static function with(string $scheme, string $value): self { - $obj = new self; + $self = new self; - $obj['scheme'] = $scheme; - $obj['value'] = $value; + $self['scheme'] = $scheme; + $self['value'] = $value; - return $obj; + return $self; } /** @@ -69,10 +69,10 @@ public static function with(string $scheme, string $value): self */ public function withScheme(string $scheme): self { - $obj = clone $this; - $obj['scheme'] = $scheme; + $self = clone $this; + $self['scheme'] = $scheme; - return $obj; + return $self; } /** @@ -80,9 +80,9 @@ public function withScheme(string $scheme): self */ public function withValue(string $value): self { - $obj = clone $this; - $obj['value'] = $value; + $self = clone $this; + $self['value'] = $value; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupGetParticipantsResponse/Participant/Entity.php b/src/Lookup/LookupGetParticipantsResponse/Participant/Entity.php index 9d097628..a227470a 100644 --- a/src/Lookup/LookupGetParticipantsResponse/Participant/Entity.php +++ b/src/Lookup/LookupGetParticipantsResponse/Participant/Entity.php @@ -92,17 +92,17 @@ public static function with( ?string $registrationDate = null, ?string $website = null, ): self { - $obj = new self; + $self = new self; - null !== $additionalInfo && $obj['additionalInfo'] = $additionalInfo; - null !== $countryCode && $obj['countryCode'] = $countryCode; - null !== $geoInfo && $obj['geoInfo'] = $geoInfo; - null !== $identifiers && $obj['identifiers'] = $identifiers; - null !== $name && $obj['name'] = $name; - null !== $registrationDate && $obj['registrationDate'] = $registrationDate; - null !== $website && $obj['website'] = $website; + null !== $additionalInfo && $self['additionalInfo'] = $additionalInfo; + null !== $countryCode && $self['countryCode'] = $countryCode; + null !== $geoInfo && $self['geoInfo'] = $geoInfo; + null !== $identifiers && $self['identifiers'] = $identifiers; + null !== $name && $self['name'] = $name; + null !== $registrationDate && $self['registrationDate'] = $registrationDate; + null !== $website && $self['website'] = $website; - return $obj; + return $self; } /** @@ -110,10 +110,10 @@ public static function with( */ public function withAdditionalInfo(?string $additionalInfo): self { - $obj = clone $this; - $obj['additionalInfo'] = $additionalInfo; + $self = clone $this; + $self['additionalInfo'] = $additionalInfo; - return $obj; + return $self; } /** @@ -121,10 +121,10 @@ public function withAdditionalInfo(?string $additionalInfo): self */ public function withCountryCode(?string $countryCode): self { - $obj = clone $this; - $obj['countryCode'] = $countryCode; + $self = clone $this; + $self['countryCode'] = $countryCode; - return $obj; + return $self; } /** @@ -132,10 +132,10 @@ public function withCountryCode(?string $countryCode): self */ public function withGeoInfo(?string $geoInfo): self { - $obj = clone $this; - $obj['geoInfo'] = $geoInfo; + $self = clone $this; + $self['geoInfo'] = $geoInfo; - return $obj; + return $self; } /** @@ -145,10 +145,10 @@ public function withGeoInfo(?string $geoInfo): self */ public function withIdentifiers(array $identifiers): self { - $obj = clone $this; - $obj['identifiers'] = $identifiers; + $self = clone $this; + $self['identifiers'] = $identifiers; - return $obj; + return $self; } /** @@ -156,10 +156,10 @@ public function withIdentifiers(array $identifiers): self */ public function withName(?string $name): self { - $obj = clone $this; - $obj['name'] = $name; + $self = clone $this; + $self['name'] = $name; - return $obj; + return $self; } /** @@ -167,10 +167,10 @@ public function withName(?string $name): self */ public function withRegistrationDate(?string $registrationDate): self { - $obj = clone $this; - $obj['registrationDate'] = $registrationDate; + $self = clone $this; + $self['registrationDate'] = $registrationDate; - return $obj; + return $self; } /** @@ -178,9 +178,9 @@ public function withRegistrationDate(?string $registrationDate): self */ public function withWebsite(?string $website): self { - $obj = clone $this; - $obj['website'] = $website; + $self = clone $this; + $self['website'] = $website; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupGetParticipantsResponse/Participant/Entity/Identifier.php b/src/Lookup/LookupGetParticipantsResponse/Participant/Entity/Identifier.php index 34f10a34..533d3bdd 100644 --- a/src/Lookup/LookupGetParticipantsResponse/Participant/Entity/Identifier.php +++ b/src/Lookup/LookupGetParticipantsResponse/Participant/Entity/Identifier.php @@ -56,12 +56,12 @@ public function __construct() */ public static function with(string $scheme, string $value): self { - $obj = new self; + $self = new self; - $obj['scheme'] = $scheme; - $obj['value'] = $value; + $self['scheme'] = $scheme; + $self['value'] = $value; - return $obj; + return $self; } /** @@ -69,10 +69,10 @@ public static function with(string $scheme, string $value): self */ public function withScheme(string $scheme): self { - $obj = clone $this; - $obj['scheme'] = $scheme; + $self = clone $this; + $self['scheme'] = $scheme; - return $obj; + return $self; } /** @@ -80,9 +80,9 @@ public function withScheme(string $scheme): self */ public function withValue(string $value): self { - $obj = clone $this; - $obj['value'] = $value; + $self = clone $this; + $self['value'] = $value; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupGetResponse.php b/src/Lookup/LookupGetResponse.php index 48de37a2..aec82ec8 100644 --- a/src/Lookup/LookupGetResponse.php +++ b/src/Lookup/LookupGetResponse.php @@ -176,18 +176,18 @@ public static function with( ServiceMetadata|array $serviceMetadata, string $status, ): self { - $obj = new self; - - $obj['businessCard'] = $businessCard; - $obj['certificates'] = $certificates; - $obj['dnsInfo'] = $dnsInfo; - $obj['errors'] = $errors; - $obj['executionTimeMs'] = $executionTimeMs; - $obj['queryMetadata'] = $queryMetadata; - $obj['serviceMetadata'] = $serviceMetadata; - $obj['status'] = $status; - - return $obj; + $self = new self; + + $self['businessCard'] = $businessCard; + $self['certificates'] = $certificates; + $self['dnsInfo'] = $dnsInfo; + $self['errors'] = $errors; + $self['executionTimeMs'] = $executionTimeMs; + $self['queryMetadata'] = $queryMetadata; + $self['serviceMetadata'] = $serviceMetadata; + $self['status'] = $status; + + return $self; } /** @@ -202,10 +202,10 @@ public static function with( */ public function withBusinessCard(BusinessCard|array $businessCard): self { - $obj = clone $this; - $obj['businessCard'] = $businessCard; + $self = clone $this; + $self['businessCard'] = $businessCard; - return $obj; + return $self; } /** @@ -217,10 +217,10 @@ public function withBusinessCard(BusinessCard|array $businessCard): self */ public function withCertificates(array $certificates): self { - $obj = clone $this; - $obj['certificates'] = $certificates; + $self = clone $this; + $self['certificates'] = $certificates; - return $obj; + return $self; } /** @@ -235,10 +235,10 @@ public function withCertificates(array $certificates): self */ public function withDNSInfo(DNSInfo|array $dnsInfo): self { - $obj = clone $this; - $obj['dnsInfo'] = $dnsInfo; + $self = clone $this; + $self['dnsInfo'] = $dnsInfo; - return $obj; + return $self; } /** @@ -248,10 +248,10 @@ public function withDNSInfo(DNSInfo|array $dnsInfo): self */ public function withErrors(array $errors): self { - $obj = clone $this; - $obj['errors'] = $errors; + $self = clone $this; + $self['errors'] = $errors; - return $obj; + return $self; } /** @@ -259,10 +259,10 @@ public function withErrors(array $errors): self */ public function withExecutionTimeMs(float $executionTimeMs): self { - $obj = clone $this; - $obj['executionTimeMs'] = $executionTimeMs; + $self = clone $this; + $self['executionTimeMs'] = $executionTimeMs; - return $obj; + return $self; } /** @@ -278,10 +278,10 @@ public function withExecutionTimeMs(float $executionTimeMs): self */ public function withQueryMetadata(QueryMetadata|array $queryMetadata): self { - $obj = clone $this; - $obj['queryMetadata'] = $queryMetadata; + $self = clone $this; + $self['queryMetadata'] = $queryMetadata; - return $obj; + return $self; } /** @@ -297,10 +297,10 @@ public function withQueryMetadata(QueryMetadata|array $queryMetadata): self public function withServiceMetadata( ServiceMetadata|array $serviceMetadata ): self { - $obj = clone $this; - $obj['serviceMetadata'] = $serviceMetadata; + $self = clone $this; + $self['serviceMetadata'] = $serviceMetadata; - return $obj; + return $self; } /** @@ -308,9 +308,9 @@ public function withServiceMetadata( */ public function withStatus(string $status): self { - $obj = clone $this; - $obj['status'] = $status; + $self = clone $this; + $self['status'] = $status; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupGetResponse/BusinessCard.php b/src/Lookup/LookupGetResponse/BusinessCard.php index 5c4a2a37..bdd6dd6e 100644 --- a/src/Lookup/LookupGetResponse/BusinessCard.php +++ b/src/Lookup/LookupGetResponse/BusinessCard.php @@ -88,15 +88,15 @@ public static function with( string $status, ?string $error = null ): self { - $obj = new self; + $self = new self; - $obj['entities'] = $entities; - $obj['queryTimeMs'] = $queryTimeMs; - $obj['status'] = $status; + $self['entities'] = $entities; + $self['queryTimeMs'] = $queryTimeMs; + $self['status'] = $status; - null !== $error && $obj['error'] = $error; + null !== $error && $self['error'] = $error; - return $obj; + return $self; } /** @@ -111,10 +111,10 @@ public static function with( */ public function withEntities(array $entities): self { - $obj = clone $this; - $obj['entities'] = $entities; + $self = clone $this; + $self['entities'] = $entities; - return $obj; + return $self; } /** @@ -122,10 +122,10 @@ public function withEntities(array $entities): self */ public function withQueryTimeMs(float $queryTimeMs): self { - $obj = clone $this; - $obj['queryTimeMs'] = $queryTimeMs; + $self = clone $this; + $self['queryTimeMs'] = $queryTimeMs; - return $obj; + return $self; } /** @@ -133,10 +133,10 @@ public function withQueryTimeMs(float $queryTimeMs): self */ public function withStatus(string $status): self { - $obj = clone $this; - $obj['status'] = $status; + $self = clone $this; + $self['status'] = $status; - return $obj; + return $self; } /** @@ -144,9 +144,9 @@ public function withStatus(string $status): self */ public function withError(?string $error): self { - $obj = clone $this; - $obj['error'] = $error; + $self = clone $this; + $self['error'] = $error; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupGetResponse/BusinessCard/Entity.php b/src/Lookup/LookupGetResponse/BusinessCard/Entity.php index 8375929f..8974e3b3 100644 --- a/src/Lookup/LookupGetResponse/BusinessCard/Entity.php +++ b/src/Lookup/LookupGetResponse/BusinessCard/Entity.php @@ -67,14 +67,14 @@ public static function with( ?string $name = null, ?string $registrationDate = null, ): self { - $obj = new self; + $self = new self; - null !== $additionalInformation && $obj['additionalInformation'] = $additionalInformation; - null !== $countryCode && $obj['countryCode'] = $countryCode; - null !== $name && $obj['name'] = $name; - null !== $registrationDate && $obj['registrationDate'] = $registrationDate; + null !== $additionalInformation && $self['additionalInformation'] = $additionalInformation; + null !== $countryCode && $self['countryCode'] = $countryCode; + null !== $name && $self['name'] = $name; + null !== $registrationDate && $self['registrationDate'] = $registrationDate; - return $obj; + return $self; } /** @@ -85,10 +85,10 @@ public static function with( public function withAdditionalInformation( ?array $additionalInformation ): self { - $obj = clone $this; - $obj['additionalInformation'] = $additionalInformation; + $self = clone $this; + $self['additionalInformation'] = $additionalInformation; - return $obj; + return $self; } /** @@ -96,10 +96,10 @@ public function withAdditionalInformation( */ public function withCountryCode(?string $countryCode): self { - $obj = clone $this; - $obj['countryCode'] = $countryCode; + $self = clone $this; + $self['countryCode'] = $countryCode; - return $obj; + return $self; } /** @@ -107,10 +107,10 @@ public function withCountryCode(?string $countryCode): self */ public function withName(?string $name): self { - $obj = clone $this; - $obj['name'] = $name; + $self = clone $this; + $self['name'] = $name; - return $obj; + return $self; } /** @@ -118,9 +118,9 @@ public function withName(?string $name): self */ public function withRegistrationDate(?string $registrationDate): self { - $obj = clone $this; - $obj['registrationDate'] = $registrationDate; + $self = clone $this; + $self['registrationDate'] = $registrationDate; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupGetResponse/DNSInfo.php b/src/Lookup/LookupGetResponse/DNSInfo.php index 28b10e31..7c3801d7 100644 --- a/src/Lookup/LookupGetResponse/DNSInfo.php +++ b/src/Lookup/LookupGetResponse/DNSInfo.php @@ -83,15 +83,15 @@ public static function with( string $status, ?string $error = null, ): self { - $obj = new self; + $self = new self; - $obj['dnsRecords'] = $dnsRecords; - $obj['smlHostname'] = $smlHostname; - $obj['status'] = $status; + $self['dnsRecords'] = $dnsRecords; + $self['smlHostname'] = $smlHostname; + $self['status'] = $status; - null !== $error && $obj['error'] = $error; + null !== $error && $self['error'] = $error; - return $obj; + return $self; } /** @@ -101,10 +101,10 @@ public static function with( */ public function withDNSRecords(array $dnsRecords): self { - $obj = clone $this; - $obj['dnsRecords'] = $dnsRecords; + $self = clone $this; + $self['dnsRecords'] = $dnsRecords; - return $obj; + return $self; } /** @@ -112,10 +112,10 @@ public function withDNSRecords(array $dnsRecords): self */ public function withSmlHostname(string $smlHostname): self { - $obj = clone $this; - $obj['smlHostname'] = $smlHostname; + $self = clone $this; + $self['smlHostname'] = $smlHostname; - return $obj; + return $self; } /** @@ -123,10 +123,10 @@ public function withSmlHostname(string $smlHostname): self */ public function withStatus(string $status): self { - $obj = clone $this; - $obj['status'] = $status; + $self = clone $this; + $self['status'] = $status; - return $obj; + return $self; } /** @@ -134,9 +134,9 @@ public function withStatus(string $status): self */ public function withError(?string $error): self { - $obj = clone $this; - $obj['error'] = $error; + $self = clone $this; + $self['error'] = $error; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupGetResponse/DNSInfo/DNSRecord.php b/src/Lookup/LookupGetResponse/DNSInfo/DNSRecord.php index 95c1e30c..7b793573 100644 --- a/src/Lookup/LookupGetResponse/DNSInfo/DNSRecord.php +++ b/src/Lookup/LookupGetResponse/DNSInfo/DNSRecord.php @@ -50,11 +50,11 @@ public function __construct() */ public static function with(string $ip): self { - $obj = new self; + $self = new self; - $obj['ip'] = $ip; + $self['ip'] = $ip; - return $obj; + return $self; } /** @@ -62,9 +62,9 @@ public static function with(string $ip): self */ public function withIP(string $ip): self { - $obj = clone $this; - $obj['ip'] = $ip; + $self = clone $this; + $self['ip'] = $ip; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupGetResponse/QueryMetadata.php b/src/Lookup/LookupGetResponse/QueryMetadata.php index 53f5ae7b..bd968e2c 100644 --- a/src/Lookup/LookupGetResponse/QueryMetadata.php +++ b/src/Lookup/LookupGetResponse/QueryMetadata.php @@ -96,15 +96,15 @@ public static function with( string $timestamp, string $version, ): self { - $obj = new self; + $self = new self; - $obj['identifierScheme'] = $identifierScheme; - $obj['identifierValue'] = $identifierValue; - $obj['smlDomain'] = $smlDomain; - $obj['timestamp'] = $timestamp; - $obj['version'] = $version; + $self['identifierScheme'] = $identifierScheme; + $self['identifierValue'] = $identifierValue; + $self['smlDomain'] = $smlDomain; + $self['timestamp'] = $timestamp; + $self['version'] = $version; - return $obj; + return $self; } /** @@ -112,10 +112,10 @@ public static function with( */ public function withIdentifierScheme(string $identifierScheme): self { - $obj = clone $this; - $obj['identifierScheme'] = $identifierScheme; + $self = clone $this; + $self['identifierScheme'] = $identifierScheme; - return $obj; + return $self; } /** @@ -123,10 +123,10 @@ public function withIdentifierScheme(string $identifierScheme): self */ public function withIdentifierValue(string $identifierValue): self { - $obj = clone $this; - $obj['identifierValue'] = $identifierValue; + $self = clone $this; + $self['identifierValue'] = $identifierValue; - return $obj; + return $self; } /** @@ -134,10 +134,10 @@ public function withIdentifierValue(string $identifierValue): self */ public function withSmlDomain(string $smlDomain): self { - $obj = clone $this; - $obj['smlDomain'] = $smlDomain; + $self = clone $this; + $self['smlDomain'] = $smlDomain; - return $obj; + return $self; } /** @@ -145,10 +145,10 @@ public function withSmlDomain(string $smlDomain): self */ public function withTimestamp(string $timestamp): self { - $obj = clone $this; - $obj['timestamp'] = $timestamp; + $self = clone $this; + $self['timestamp'] = $timestamp; - return $obj; + return $self; } /** @@ -156,9 +156,9 @@ public function withTimestamp(string $timestamp): self */ public function withVersion(string $version): self { - $obj = clone $this; - $obj['version'] = $version; + $self = clone $this; + $self['version'] = $version; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata.php b/src/Lookup/LookupGetResponse/ServiceMetadata.php index da8e72f0..afcbb0aa 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata.php @@ -91,15 +91,15 @@ public static function with( string $status, ?string $error = null ): self { - $obj = new self; + $self = new self; - $obj['endpoints'] = $endpoints; - $obj['queryTimeMs'] = $queryTimeMs; - $obj['status'] = $status; + $self['endpoints'] = $endpoints; + $self['queryTimeMs'] = $queryTimeMs; + $self['status'] = $status; - null !== $error && $obj['error'] = $error; + null !== $error && $self['error'] = $error; - return $obj; + return $self; } /** @@ -115,10 +115,10 @@ public static function with( */ public function withEndpoints(array $endpoints): self { - $obj = clone $this; - $obj['endpoints'] = $endpoints; + $self = clone $this; + $self['endpoints'] = $endpoints; - return $obj; + return $self; } /** @@ -126,10 +126,10 @@ public function withEndpoints(array $endpoints): self */ public function withQueryTimeMs(float $queryTimeMs): self { - $obj = clone $this; - $obj['queryTimeMs'] = $queryTimeMs; + $self = clone $this; + $self['queryTimeMs'] = $queryTimeMs; - return $obj; + return $self; } /** @@ -137,10 +137,10 @@ public function withQueryTimeMs(float $queryTimeMs): self */ public function withStatus(string $status): self { - $obj = clone $this; - $obj['status'] = $status; + $self = clone $this; + $self['status'] = $status; - return $obj; + return $self; } /** @@ -148,9 +148,9 @@ public function withStatus(string $status): self */ public function withError(?string $error): self { - $obj = clone $this; - $obj['error'] = $error; + $self = clone $this; + $self['error'] = $error; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint.php index def570ad..499f6a01 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint.php @@ -99,16 +99,16 @@ public static function with( ?string $error = null, ?array $processes = null, ): self { - $obj = new self; + $self = new self; - $obj['documentTypes'] = $documentTypes; - $obj['status'] = $status; - $obj['url'] = $url; + $self['documentTypes'] = $documentTypes; + $self['status'] = $status; + $self['url'] = $url; - null !== $error && $obj['error'] = $error; - null !== $processes && $obj['processes'] = $processes; + null !== $error && $self['error'] = $error; + null !== $processes && $self['processes'] = $processes; - return $obj; + return $self; } /** @@ -118,10 +118,10 @@ public static function with( */ public function withDocumentTypes(array $documentTypes): self { - $obj = clone $this; - $obj['documentTypes'] = $documentTypes; + $self = clone $this; + $self['documentTypes'] = $documentTypes; - return $obj; + return $self; } /** @@ -129,10 +129,10 @@ public function withDocumentTypes(array $documentTypes): self */ public function withStatus(string $status): self { - $obj = clone $this; - $obj['status'] = $status; + $self = clone $this; + $self['status'] = $status; - return $obj; + return $self; } /** @@ -140,10 +140,10 @@ public function withStatus(string $status): self */ public function withURL(string $url): self { - $obj = clone $this; - $obj['url'] = $url; + $self = clone $this; + $self['url'] = $url; - return $obj; + return $self; } /** @@ -151,10 +151,10 @@ public function withURL(string $url): self */ public function withError(?string $error): self { - $obj = clone $this; - $obj['error'] = $error; + $self = clone $this; + $self['error'] = $error; - return $obj; + return $self; } /** @@ -167,9 +167,9 @@ public function withError(?string $error): self */ public function withProcesses(?array $processes): self { - $obj = clone $this; - $obj['processes'] = $processes; + $self = clone $this; + $self['processes'] = $processes; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/DocumentType.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/DocumentType.php index 632ff373..690b703f 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/DocumentType.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/DocumentType.php @@ -56,12 +56,12 @@ public function __construct() */ public static function with(string $scheme, string $value): self { - $obj = new self; + $self = new self; - $obj['scheme'] = $scheme; - $obj['value'] = $value; + $self['scheme'] = $scheme; + $self['value'] = $value; - return $obj; + return $self; } /** @@ -69,10 +69,10 @@ public static function with(string $scheme, string $value): self */ public function withScheme(string $scheme): self { - $obj = clone $this; - $obj['scheme'] = $scheme; + $self = clone $this; + $self['scheme'] = $scheme; - return $obj; + return $self; } /** @@ -80,9 +80,9 @@ public function withScheme(string $scheme): self */ public function withValue(string $value): self { - $obj = clone $this; - $obj['value'] = $value; + $self = clone $this; + $self['value'] = $value; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process.php index ff4b49ef..dca18dd9 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process.php @@ -77,12 +77,12 @@ public static function with( array $endpoints, ProcessID|array $processID ): self { - $obj = new self; + $self = new self; - $obj['endpoints'] = $endpoints; - $obj['processID'] = $processID; + $self['endpoints'] = $endpoints; + $self['processID'] = $processID; - return $obj; + return $self; } /** @@ -101,10 +101,10 @@ public static function with( */ public function withEndpoints(array $endpoints): self { - $obj = clone $this; - $obj['endpoints'] = $endpoints; + $self = clone $this; + $self['endpoints'] = $endpoints; - return $obj; + return $self; } /** @@ -114,9 +114,9 @@ public function withEndpoints(array $endpoints): self */ public function withProcessID(ProcessID|array $processID): self { - $obj = clone $this; - $obj['processID'] = $processID; + $self = clone $this; + $self['processID'] = $processID; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/Endpoint.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/Endpoint.php index f5311d0e..846138db 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/Endpoint.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/Endpoint.php @@ -115,19 +115,19 @@ public static function with( ?string $technicalContactURL = null, ?string $technicalInformationURL = null, ): self { - $obj = new self; + $self = new self; - $obj['address'] = $address; - $obj['transportProfile'] = $transportProfile; + $self['address'] = $address; + $self['transportProfile'] = $transportProfile; - null !== $certificate && $obj['certificate'] = $certificate; - null !== $serviceActivationDate && $obj['serviceActivationDate'] = $serviceActivationDate; - null !== $serviceDescription && $obj['serviceDescription'] = $serviceDescription; - null !== $serviceExpirationDate && $obj['serviceExpirationDate'] = $serviceExpirationDate; - null !== $technicalContactURL && $obj['technicalContactURL'] = $technicalContactURL; - null !== $technicalInformationURL && $obj['technicalInformationURL'] = $technicalInformationURL; + null !== $certificate && $self['certificate'] = $certificate; + null !== $serviceActivationDate && $self['serviceActivationDate'] = $serviceActivationDate; + null !== $serviceDescription && $self['serviceDescription'] = $serviceDescription; + null !== $serviceExpirationDate && $self['serviceExpirationDate'] = $serviceExpirationDate; + null !== $technicalContactURL && $self['technicalContactURL'] = $technicalContactURL; + null !== $technicalInformationURL && $self['technicalInformationURL'] = $technicalInformationURL; - return $obj; + return $self; } /** @@ -135,10 +135,10 @@ public static function with( */ public function withAddress(string $address): self { - $obj = clone $this; - $obj['address'] = $address; + $self = clone $this; + $self['address'] = $address; - return $obj; + return $self; } /** @@ -146,10 +146,10 @@ public function withAddress(string $address): self */ public function withTransportProfile(string $transportProfile): self { - $obj = clone $this; - $obj['transportProfile'] = $transportProfile; + $self = clone $this; + $self['transportProfile'] = $transportProfile; - return $obj; + return $self; } /** @@ -161,10 +161,10 @@ public function withTransportProfile(string $transportProfile): self */ public function withCertificate(Certificate|array|null $certificate): self { - $obj = clone $this; - $obj['certificate'] = $certificate; + $self = clone $this; + $self['certificate'] = $certificate; - return $obj; + return $self; } /** @@ -173,10 +173,10 @@ public function withCertificate(Certificate|array|null $certificate): self public function withServiceActivationDate( ?string $serviceActivationDate ): self { - $obj = clone $this; - $obj['serviceActivationDate'] = $serviceActivationDate; + $self = clone $this; + $self['serviceActivationDate'] = $serviceActivationDate; - return $obj; + return $self; } /** @@ -184,10 +184,10 @@ public function withServiceActivationDate( */ public function withServiceDescription(?string $serviceDescription): self { - $obj = clone $this; - $obj['serviceDescription'] = $serviceDescription; + $self = clone $this; + $self['serviceDescription'] = $serviceDescription; - return $obj; + return $self; } /** @@ -196,10 +196,10 @@ public function withServiceDescription(?string $serviceDescription): self public function withServiceExpirationDate( ?string $serviceExpirationDate ): self { - $obj = clone $this; - $obj['serviceExpirationDate'] = $serviceExpirationDate; + $self = clone $this; + $self['serviceExpirationDate'] = $serviceExpirationDate; - return $obj; + return $self; } /** @@ -207,10 +207,10 @@ public function withServiceExpirationDate( */ public function withTechnicalContactURL(?string $technicalContactURL): self { - $obj = clone $this; - $obj['technicalContactURL'] = $technicalContactURL; + $self = clone $this; + $self['technicalContactURL'] = $technicalContactURL; - return $obj; + return $self; } /** @@ -219,9 +219,9 @@ public function withTechnicalContactURL(?string $technicalContactURL): self public function withTechnicalInformationURL( ?string $technicalInformationURL ): self { - $obj = clone $this; - $obj['technicalInformationURL'] = $technicalInformationURL; + $self = clone $this; + $self['technicalInformationURL'] = $technicalInformationURL; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/ProcessID.php b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/ProcessID.php index 3b34b935..b7b263eb 100644 --- a/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/ProcessID.php +++ b/src/Lookup/LookupGetResponse/ServiceMetadata/Endpoint/Process/ProcessID.php @@ -56,12 +56,12 @@ public function __construct() */ public static function with(string $scheme, string $value): self { - $obj = new self; + $self = new self; - $obj['scheme'] = $scheme; - $obj['value'] = $value; + $self['scheme'] = $scheme; + $self['value'] = $value; - return $obj; + return $self; } /** @@ -69,10 +69,10 @@ public static function with(string $scheme, string $value): self */ public function withScheme(string $scheme): self { - $obj = clone $this; - $obj['scheme'] = $scheme; + $self = clone $this; + $self['scheme'] = $scheme; - return $obj; + return $self; } /** @@ -80,9 +80,9 @@ public function withScheme(string $scheme): self */ public function withValue(string $value): self { - $obj = clone $this; - $obj['value'] = $value; + $self = clone $this; + $self['value'] = $value; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupRetrieveParams.php b/src/Lookup/LookupRetrieveParams.php index a7f17140..2bb0c60d 100644 --- a/src/Lookup/LookupRetrieveParams.php +++ b/src/Lookup/LookupRetrieveParams.php @@ -54,11 +54,11 @@ public function __construct() */ public static function with(string $peppolID): self { - $obj = new self; + $self = new self; - $obj['peppolID'] = $peppolID; + $self['peppolID'] = $peppolID; - return $obj; + return $self; } /** @@ -66,9 +66,9 @@ public static function with(string $peppolID): self */ public function withPeppolID(string $peppolID): self { - $obj = clone $this; - $obj['peppolID'] = $peppolID; + $self = clone $this; + $self['peppolID'] = $peppolID; - return $obj; + return $self; } } diff --git a/src/Lookup/LookupRetrieveParticipantsParams.php b/src/Lookup/LookupRetrieveParticipantsParams.php index ef91659f..32ce1229 100644 --- a/src/Lookup/LookupRetrieveParticipantsParams.php +++ b/src/Lookup/LookupRetrieveParticipantsParams.php @@ -65,13 +65,13 @@ public static function with( string $query, ?string $countryCode = null ): self { - $obj = new self; + $self = new self; - $obj['query'] = $query; + $self['query'] = $query; - null !== $countryCode && $obj['countryCode'] = $countryCode; + null !== $countryCode && $self['countryCode'] = $countryCode; - return $obj; + return $self; } /** @@ -79,10 +79,10 @@ public static function with( */ public function withQuery(string $query): self { - $obj = clone $this; - $obj['query'] = $query; + $self = clone $this; + $self['query'] = $query; - return $obj; + return $self; } /** @@ -90,9 +90,9 @@ public function withQuery(string $query): self */ public function withCountryCode(?string $countryCode): self { - $obj = clone $this; - $obj['countryCode'] = $countryCode; + $self = clone $this; + $self['countryCode'] = $countryCode; - return $obj; + return $self; } } diff --git a/src/Me/MeGetResponse.php b/src/Me/MeGetResponse.php index 69a7af84..513e2cd5 100644 --- a/src/Me/MeGetResponse.php +++ b/src/Me/MeGetResponse.php @@ -185,28 +185,28 @@ public static function with( ?bool $smpRegistration = null, ?\DateTimeInterface $smpRegistrationDate = null, ): self { - $obj = new self; - - $obj['creditBalance'] = $creditBalance; - $obj['name'] = $name; - $obj['plan'] = $plan; - - null !== $bccRecipientEmail && $obj['bccRecipientEmail'] = $bccRecipientEmail; - null !== $companyAddress && $obj['companyAddress'] = $companyAddress; - null !== $companyCity && $obj['companyCity'] = $companyCity; - null !== $companyCountry && $obj['companyCountry'] = $companyCountry; - null !== $companyEmail && $obj['companyEmail'] = $companyEmail; - null !== $companyName && $obj['companyName'] = $companyName; - null !== $companyNumber && $obj['companyNumber'] = $companyNumber; - null !== $companyTaxID && $obj['companyTaxID'] = $companyTaxID; - null !== $companyZip && $obj['companyZip'] = $companyZip; - null !== $description && $obj['description'] = $description; - null !== $ibans && $obj['ibans'] = $ibans; - null !== $peppolIDs && $obj['peppolIDs'] = $peppolIDs; - null !== $smpRegistration && $obj['smpRegistration'] = $smpRegistration; - null !== $smpRegistrationDate && $obj['smpRegistrationDate'] = $smpRegistrationDate; - - return $obj; + $self = new self; + + $self['creditBalance'] = $creditBalance; + $self['name'] = $name; + $self['plan'] = $plan; + + null !== $bccRecipientEmail && $self['bccRecipientEmail'] = $bccRecipientEmail; + null !== $companyAddress && $self['companyAddress'] = $companyAddress; + null !== $companyCity && $self['companyCity'] = $companyCity; + null !== $companyCountry && $self['companyCountry'] = $companyCountry; + null !== $companyEmail && $self['companyEmail'] = $companyEmail; + null !== $companyName && $self['companyName'] = $companyName; + null !== $companyNumber && $self['companyNumber'] = $companyNumber; + null !== $companyTaxID && $self['companyTaxID'] = $companyTaxID; + null !== $companyZip && $self['companyZip'] = $companyZip; + null !== $description && $self['description'] = $description; + null !== $ibans && $self['ibans'] = $ibans; + null !== $peppolIDs && $self['peppolIDs'] = $peppolIDs; + null !== $smpRegistration && $self['smpRegistration'] = $smpRegistration; + null !== $smpRegistrationDate && $self['smpRegistrationDate'] = $smpRegistrationDate; + + return $self; } /** @@ -214,18 +214,18 @@ public static function with( */ public function withCreditBalance(int $creditBalance): self { - $obj = clone $this; - $obj['creditBalance'] = $creditBalance; + $self = clone $this; + $self['creditBalance'] = $creditBalance; - return $obj; + return $self; } public function withName(string $name): self { - $obj = clone $this; - $obj['name'] = $name; + $self = clone $this; + $self['name'] = $name; - return $obj; + return $self; } /** @@ -235,10 +235,10 @@ public function withName(string $name): self */ public function withPlan(Plan|string $plan): self { - $obj = clone $this; - $obj['plan'] = $plan; + $self = clone $this; + $self['plan'] = $plan; - return $obj; + return $self; } /** @@ -246,10 +246,10 @@ public function withPlan(Plan|string $plan): self */ public function withBccRecipientEmail(?string $bccRecipientEmail): self { - $obj = clone $this; - $obj['bccRecipientEmail'] = $bccRecipientEmail; + $self = clone $this; + $self['bccRecipientEmail'] = $bccRecipientEmail; - return $obj; + return $self; } /** @@ -257,10 +257,10 @@ public function withBccRecipientEmail(?string $bccRecipientEmail): self */ public function withCompanyAddress(?string $companyAddress): self { - $obj = clone $this; - $obj['companyAddress'] = $companyAddress; + $self = clone $this; + $self['companyAddress'] = $companyAddress; - return $obj; + return $self; } /** @@ -268,10 +268,10 @@ public function withCompanyAddress(?string $companyAddress): self */ public function withCompanyCity(?string $companyCity): self { - $obj = clone $this; - $obj['companyCity'] = $companyCity; + $self = clone $this; + $self['companyCity'] = $companyCity; - return $obj; + return $self; } /** @@ -279,10 +279,10 @@ public function withCompanyCity(?string $companyCity): self */ public function withCompanyCountry(?string $companyCountry): self { - $obj = clone $this; - $obj['companyCountry'] = $companyCountry; + $self = clone $this; + $self['companyCountry'] = $companyCountry; - return $obj; + return $self; } /** @@ -290,10 +290,10 @@ public function withCompanyCountry(?string $companyCountry): self */ public function withCompanyEmail(?string $companyEmail): self { - $obj = clone $this; - $obj['companyEmail'] = $companyEmail; + $self = clone $this; + $self['companyEmail'] = $companyEmail; - return $obj; + return $self; } /** @@ -301,10 +301,10 @@ public function withCompanyEmail(?string $companyEmail): self */ public function withCompanyName(?string $companyName): self { - $obj = clone $this; - $obj['companyName'] = $companyName; + $self = clone $this; + $self['companyName'] = $companyName; - return $obj; + return $self; } /** @@ -312,10 +312,10 @@ public function withCompanyName(?string $companyName): self */ public function withCompanyNumber(?string $companyNumber): self { - $obj = clone $this; - $obj['companyNumber'] = $companyNumber; + $self = clone $this; + $self['companyNumber'] = $companyNumber; - return $obj; + return $self; } /** @@ -323,10 +323,10 @@ public function withCompanyNumber(?string $companyNumber): self */ public function withCompanyTaxID(?string $companyTaxID): self { - $obj = clone $this; - $obj['companyTaxID'] = $companyTaxID; + $self = clone $this; + $self['companyTaxID'] = $companyTaxID; - return $obj; + return $self; } /** @@ -334,18 +334,18 @@ public function withCompanyTaxID(?string $companyTaxID): self */ public function withCompanyZip(?string $companyZip): self { - $obj = clone $this; - $obj['companyZip'] = $companyZip; + $self = clone $this; + $self['companyZip'] = $companyZip; - return $obj; + return $self; } public function withDescription(?string $description): self { - $obj = clone $this; - $obj['description'] = $description; + $self = clone $this; + $self['description'] = $description; - return $obj; + return $self; } /** @@ -355,10 +355,10 @@ public function withDescription(?string $description): self */ public function withIbans(?array $ibans): self { - $obj = clone $this; - $obj['ibans'] = $ibans; + $self = clone $this; + $self['ibans'] = $ibans; - return $obj; + return $self; } /** @@ -368,10 +368,10 @@ public function withIbans(?array $ibans): self */ public function withPeppolIDs(?array $peppolIDs): self { - $obj = clone $this; - $obj['peppolIDs'] = $peppolIDs; + $self = clone $this; + $self['peppolIDs'] = $peppolIDs; - return $obj; + return $self; } /** @@ -379,10 +379,10 @@ public function withPeppolIDs(?array $peppolIDs): self */ public function withSmpRegistration(?bool $smpRegistration): self { - $obj = clone $this; - $obj['smpRegistration'] = $smpRegistration; + $self = clone $this; + $self['smpRegistration'] = $smpRegistration; - return $obj; + return $self; } /** @@ -391,9 +391,9 @@ public function withSmpRegistration(?bool $smpRegistration): self public function withSmpRegistrationDate( ?\DateTimeInterface $smpRegistrationDate ): self { - $obj = clone $this; - $obj['smpRegistrationDate'] = $smpRegistrationDate; + $self = clone $this; + $self['smpRegistrationDate'] = $smpRegistrationDate; - return $obj; + return $self; } } diff --git a/src/Outbox/OutboxListDraftDocumentsParams.php b/src/Outbox/OutboxListDraftDocumentsParams.php index 39e0a9ff..f5bec6bc 100644 --- a/src/Outbox/OutboxListDraftDocumentsParams.php +++ b/src/Outbox/OutboxListDraftDocumentsParams.php @@ -48,12 +48,12 @@ public function __construct() */ public static function with(?int $page = null, ?int $pageSize = null): self { - $obj = new self; + $self = new self; - null !== $page && $obj['page'] = $page; - null !== $pageSize && $obj['pageSize'] = $pageSize; + null !== $page && $self['page'] = $page; + null !== $pageSize && $self['pageSize'] = $pageSize; - return $obj; + return $self; } /** @@ -61,10 +61,10 @@ public static function with(?int $page = null, ?int $pageSize = null): self */ public function withPage(int $page): self { - $obj = clone $this; - $obj['page'] = $page; + $self = clone $this; + $self['page'] = $page; - return $obj; + return $self; } /** @@ -72,9 +72,9 @@ public function withPage(int $page): self */ public function withPageSize(int $pageSize): self { - $obj = clone $this; - $obj['pageSize'] = $pageSize; + $self = clone $this; + $self['pageSize'] = $pageSize; - return $obj; + return $self; } } diff --git a/src/Outbox/OutboxListReceivedDocumentsParams.php b/src/Outbox/OutboxListReceivedDocumentsParams.php index 6e85ddda..7957ee5b 100644 --- a/src/Outbox/OutboxListReceivedDocumentsParams.php +++ b/src/Outbox/OutboxListReceivedDocumentsParams.php @@ -108,18 +108,18 @@ public static function with( DocumentState|string|null $state = null, DocumentType|string|null $type = null, ): self { - $obj = new self; - - null !== $dateFrom && $obj['dateFrom'] = $dateFrom; - null !== $dateTo && $obj['dateTo'] = $dateTo; - null !== $page && $obj['page'] = $page; - null !== $pageSize && $obj['pageSize'] = $pageSize; - null !== $search && $obj['search'] = $search; - null !== $sender && $obj['sender'] = $sender; - null !== $state && $obj['state'] = $state; - null !== $type && $obj['type'] = $type; - - return $obj; + $self = new self; + + null !== $dateFrom && $self['dateFrom'] = $dateFrom; + null !== $dateTo && $self['dateTo'] = $dateTo; + null !== $page && $self['page'] = $page; + null !== $pageSize && $self['pageSize'] = $pageSize; + null !== $search && $self['search'] = $search; + null !== $sender && $self['sender'] = $sender; + null !== $state && $self['state'] = $state; + null !== $type && $self['type'] = $type; + + return $self; } /** @@ -127,10 +127,10 @@ public static function with( */ public function withDateFrom(?\DateTimeInterface $dateFrom): self { - $obj = clone $this; - $obj['dateFrom'] = $dateFrom; + $self = clone $this; + $self['dateFrom'] = $dateFrom; - return $obj; + return $self; } /** @@ -138,10 +138,10 @@ public function withDateFrom(?\DateTimeInterface $dateFrom): self */ public function withDateTo(?\DateTimeInterface $dateTo): self { - $obj = clone $this; - $obj['dateTo'] = $dateTo; + $self = clone $this; + $self['dateTo'] = $dateTo; - return $obj; + return $self; } /** @@ -149,10 +149,10 @@ public function withDateTo(?\DateTimeInterface $dateTo): self */ public function withPage(int $page): self { - $obj = clone $this; - $obj['page'] = $page; + $self = clone $this; + $self['page'] = $page; - return $obj; + return $self; } /** @@ -160,10 +160,10 @@ public function withPage(int $page): self */ public function withPageSize(int $pageSize): self { - $obj = clone $this; - $obj['pageSize'] = $pageSize; + $self = clone $this; + $self['pageSize'] = $pageSize; - return $obj; + return $self; } /** @@ -171,10 +171,10 @@ public function withPageSize(int $pageSize): self */ public function withSearch(?string $search): self { - $obj = clone $this; - $obj['search'] = $search; + $self = clone $this; + $self['search'] = $search; - return $obj; + return $self; } /** @@ -182,10 +182,10 @@ public function withSearch(?string $search): self */ public function withSender(?string $sender): self { - $obj = clone $this; - $obj['sender'] = $sender; + $self = clone $this; + $self['sender'] = $sender; - return $obj; + return $self; } /** @@ -195,10 +195,10 @@ public function withSender(?string $sender): self */ public function withState(DocumentState|string|null $state): self { - $obj = clone $this; - $obj['state'] = $state; + $self = clone $this; + $self['state'] = $state; - return $obj; + return $self; } /** @@ -208,9 +208,9 @@ public function withState(DocumentState|string|null $state): self */ public function withType(DocumentType|string|null $type): self { - $obj = clone $this; - $obj['type'] = $type; + $self = clone $this; + $self['type'] = $type; - return $obj; + return $self; } } diff --git a/src/RequestOptions.php b/src/RequestOptions.php index cc2173ec..463f4f07 100644 --- a/src/RequestOptions.php +++ b/src/RequestOptions.php @@ -106,53 +106,55 @@ public static function with( ?StreamFactoryInterface $streamFactory = null, ?RequestFactoryInterface $requestFactory = null, ): self { - $obj = new self; - - null !== $timeout && $obj->timeout = $timeout; - null !== $maxRetries && $obj->maxRetries = $maxRetries; - null !== $initialRetryDelay && $obj->initialRetryDelay = $initialRetryDelay; - null !== $maxRetryDelay && $obj->maxRetryDelay = $maxRetryDelay; - null !== $extraHeaders && $obj->extraHeaders = $extraHeaders; - null !== $extraQueryParams && $obj->extraQueryParams = $extraQueryParams; - omit !== $extraBodyParams && $obj->extraBodyParams = $extraBodyParams; - null !== $transporter && $obj->transporter = $transporter; - null !== $uriFactory && $obj->uriFactory = $uriFactory; - null !== $streamFactory && $obj->streamFactory = $streamFactory; - null !== $requestFactory && $obj->requestFactory = $requestFactory; - - return $obj; + $self = new self; + + null !== $timeout && $self->timeout = $timeout; + null !== $maxRetries && $self->maxRetries = $maxRetries; + null !== $initialRetryDelay && $self + ->initialRetryDelay = $initialRetryDelay + ; + null !== $maxRetryDelay && $self->maxRetryDelay = $maxRetryDelay; + null !== $extraHeaders && $self->extraHeaders = $extraHeaders; + null !== $extraQueryParams && $self->extraQueryParams = $extraQueryParams; + omit !== $extraBodyParams && $self->extraBodyParams = $extraBodyParams; + null !== $transporter && $self->transporter = $transporter; + null !== $uriFactory && $self->uriFactory = $uriFactory; + null !== $streamFactory && $self->streamFactory = $streamFactory; + null !== $requestFactory && $self->requestFactory = $requestFactory; + + return $self; } public function withTimeout(float $timeout): self { - $obj = clone $this; - $obj->timeout = $timeout; + $self = clone $this; + $self->timeout = $timeout; - return $obj; + return $self; } public function withMaxRetries(int $maxRetries): self { - $obj = clone $this; - $obj->maxRetries = $maxRetries; + $self = clone $this; + $self->maxRetries = $maxRetries; - return $obj; + return $self; } public function withInitialRetryDelay(float $initialRetryDelay): self { - $obj = clone $this; - $obj->initialRetryDelay = $initialRetryDelay; + $self = clone $this; + $self->initialRetryDelay = $initialRetryDelay; - return $obj; + return $self; } public function withMaxRetryDelay(float $maxRetryDelay): self { - $obj = clone $this; - $obj->maxRetryDelay = $maxRetryDelay; + $self = clone $this; + $self->maxRetryDelay = $maxRetryDelay; - return $obj; + return $self; } /** @@ -160,10 +162,10 @@ public function withMaxRetryDelay(float $maxRetryDelay): self */ public function withExtraHeaders(array $extraHeaders): self { - $obj = clone $this; - $obj->extraHeaders = $extraHeaders; + $self = clone $this; + $self->extraHeaders = $extraHeaders; - return $obj; + return $self; } /** @@ -171,51 +173,51 @@ public function withExtraHeaders(array $extraHeaders): self */ public function withExtraQueryParams(array $extraQueryParams): self { - $obj = clone $this; - $obj->extraQueryParams = $extraQueryParams; + $self = clone $this; + $self->extraQueryParams = $extraQueryParams; - return $obj; + return $self; } public function withExtraBodyParams(mixed $extraBodyParams): self { - $obj = clone $this; - $obj->extraBodyParams = $extraBodyParams; + $self = clone $this; + $self->extraBodyParams = $extraBodyParams; - return $obj; + return $self; } public function withTransporter(ClientInterface $transporter): self { - $obj = clone $this; - $obj->transporter = $transporter; + $self = clone $this; + $self->transporter = $transporter; - return $obj; + return $self; } public function withUriFactory(UriFactoryInterface $uriFactory): self { - $obj = clone $this; - $obj->uriFactory = $uriFactory; + $self = clone $this; + $self->uriFactory = $uriFactory; - return $obj; + return $self; } public function withStreamFactory( StreamFactoryInterface $streamFactory ): self { - $obj = clone $this; - $obj->streamFactory = $streamFactory; + $self = clone $this; + $self->streamFactory = $streamFactory; - return $obj; + return $self; } public function withRequestFactory( RequestFactoryInterface $requestFactory ): self { - $obj = clone $this; - $obj->requestFactory = $requestFactory; + $self = clone $this; + $self->requestFactory = $requestFactory; - return $obj; + return $self; } } diff --git a/src/Validate/UblDocumentValidation.php b/src/Validate/UblDocumentValidation.php index 77a06f2d..331f2a92 100644 --- a/src/Validate/UblDocumentValidation.php +++ b/src/Validate/UblDocumentValidation.php @@ -86,40 +86,40 @@ public static function with( array $issues, ?string $ublDocument = null, ): self { - $obj = new self; + $self = new self; - $obj['id'] = $id; - $obj['fileName'] = $fileName; - $obj['isValid'] = $isValid; - $obj['issues'] = $issues; + $self['id'] = $id; + $self['fileName'] = $fileName; + $self['isValid'] = $isValid; + $self['issues'] = $issues; - null !== $ublDocument && $obj['ublDocument'] = $ublDocument; + null !== $ublDocument && $self['ublDocument'] = $ublDocument; - return $obj; + return $self; } public function withID(string $id): self { - $obj = clone $this; - $obj['id'] = $id; + $self = clone $this; + $self['id'] = $id; - return $obj; + return $self; } public function withFileName(?string $fileName): self { - $obj = clone $this; - $obj['fileName'] = $fileName; + $self = clone $this; + $self['fileName'] = $fileName; - return $obj; + return $self; } public function withIsValid(bool $isValid): self { - $obj = clone $this; - $obj['isValid'] = $isValid; + $self = clone $this; + $self['isValid'] = $isValid; - return $obj; + return $self; } /** @@ -135,17 +135,17 @@ public function withIsValid(bool $isValid): self */ public function withIssues(array $issues): self { - $obj = clone $this; - $obj['issues'] = $issues; + $self = clone $this; + $self['issues'] = $issues; - return $obj; + return $self; } public function withUblDocument(?string $ublDocument): self { - $obj = clone $this; - $obj['ublDocument'] = $ublDocument; + $self = clone $this; + $self['ublDocument'] = $ublDocument; - return $obj; + return $self; } } diff --git a/src/Validate/UblDocumentValidation/Issue.php b/src/Validate/UblDocumentValidation/Issue.php index 3e76a5a3..8e15e545 100644 --- a/src/Validate/UblDocumentValidation/Issue.php +++ b/src/Validate/UblDocumentValidation/Issue.php @@ -83,34 +83,34 @@ public static function with( ?string $ruleID = null, ?string $test = null, ): self { - $obj = new self; + $self = new self; - $obj['message'] = $message; - $obj['schematron'] = $schematron; - $obj['type'] = $type; + $self['message'] = $message; + $self['schematron'] = $schematron; + $self['type'] = $type; - null !== $flag && $obj['flag'] = $flag; - null !== $location && $obj['location'] = $location; - null !== $ruleID && $obj['ruleID'] = $ruleID; - null !== $test && $obj['test'] = $test; + null !== $flag && $self['flag'] = $flag; + null !== $location && $self['location'] = $location; + null !== $ruleID && $self['ruleID'] = $ruleID; + null !== $test && $self['test'] = $test; - return $obj; + return $self; } public function withMessage(string $message): self { - $obj = clone $this; - $obj['message'] = $message; + $self = clone $this; + $self['message'] = $message; - return $obj; + return $self; } public function withSchematron(string $schematron): self { - $obj = clone $this; - $obj['schematron'] = $schematron; + $self = clone $this; + $self['schematron'] = $schematron; - return $obj; + return $self; } /** @@ -118,41 +118,41 @@ public function withSchematron(string $schematron): self */ public function withType(Type|string $type): self { - $obj = clone $this; - $obj['type'] = $type; + $self = clone $this; + $self['type'] = $type; - return $obj; + return $self; } public function withFlag(?string $flag): self { - $obj = clone $this; - $obj['flag'] = $flag; + $self = clone $this; + $self['flag'] = $flag; - return $obj; + return $self; } public function withLocation(?string $location): self { - $obj = clone $this; - $obj['location'] = $location; + $self = clone $this; + $self['location'] = $location; - return $obj; + return $self; } public function withRuleID(?string $ruleID): self { - $obj = clone $this; - $obj['ruleID'] = $ruleID; + $self = clone $this; + $self['ruleID'] = $ruleID; - return $obj; + return $self; } public function withTest(?string $test): self { - $obj = clone $this; - $obj['test'] = $test; + $self = clone $this; + $self['test'] = $test; - return $obj; + return $self; } } diff --git a/src/Validate/ValidateValidateJsonParams.php b/src/Validate/ValidateValidateJsonParams.php index 2b307b65..d5797026 100644 --- a/src/Validate/ValidateValidateJsonParams.php +++ b/src/Validate/ValidateValidateJsonParams.php @@ -540,58 +540,58 @@ public static function with( ?string $vendorName = null, ?string $vendorTaxID = null, ): self { - $obj = new self; - - null !== $allowances && $obj['allowances'] = $allowances; - null !== $amountDue && $obj['amountDue'] = $amountDue; - null !== $attachments && $obj['attachments'] = $attachments; - null !== $billingAddress && $obj['billingAddress'] = $billingAddress; - null !== $billingAddressRecipient && $obj['billingAddressRecipient'] = $billingAddressRecipient; - null !== $charges && $obj['charges'] = $charges; - null !== $currency && $obj['currency'] = $currency; - null !== $customerAddress && $obj['customerAddress'] = $customerAddress; - null !== $customerAddressRecipient && $obj['customerAddressRecipient'] = $customerAddressRecipient; - null !== $customerCompanyID && $obj['customerCompanyID'] = $customerCompanyID; - null !== $customerEmail && $obj['customerEmail'] = $customerEmail; - null !== $customerID && $obj['customerID'] = $customerID; - null !== $customerName && $obj['customerName'] = $customerName; - null !== $customerTaxID && $obj['customerTaxID'] = $customerTaxID; - null !== $direction && $obj['direction'] = $direction; - null !== $documentType && $obj['documentType'] = $documentType; - null !== $dueDate && $obj['dueDate'] = $dueDate; - null !== $invoiceDate && $obj['invoiceDate'] = $invoiceDate; - null !== $invoiceID && $obj['invoiceID'] = $invoiceID; - null !== $invoiceTotal && $obj['invoiceTotal'] = $invoiceTotal; - null !== $items && $obj['items'] = $items; - null !== $note && $obj['note'] = $note; - null !== $paymentDetails && $obj['paymentDetails'] = $paymentDetails; - null !== $paymentTerm && $obj['paymentTerm'] = $paymentTerm; - null !== $previousUnpaidBalance && $obj['previousUnpaidBalance'] = $previousUnpaidBalance; - null !== $purchaseOrder && $obj['purchaseOrder'] = $purchaseOrder; - null !== $remittanceAddress && $obj['remittanceAddress'] = $remittanceAddress; - null !== $remittanceAddressRecipient && $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; - null !== $serviceAddress && $obj['serviceAddress'] = $serviceAddress; - null !== $serviceAddressRecipient && $obj['serviceAddressRecipient'] = $serviceAddressRecipient; - null !== $serviceEndDate && $obj['serviceEndDate'] = $serviceEndDate; - null !== $serviceStartDate && $obj['serviceStartDate'] = $serviceStartDate; - null !== $shippingAddress && $obj['shippingAddress'] = $shippingAddress; - null !== $shippingAddressRecipient && $obj['shippingAddressRecipient'] = $shippingAddressRecipient; - null !== $state && $obj['state'] = $state; - null !== $subtotal && $obj['subtotal'] = $subtotal; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxDetails && $obj['taxDetails'] = $taxDetails; - null !== $totalDiscount && $obj['totalDiscount'] = $totalDiscount; - null !== $totalTax && $obj['totalTax'] = $totalTax; - null !== $vatex && $obj['vatex'] = $vatex; - null !== $vatexNote && $obj['vatexNote'] = $vatexNote; - null !== $vendorAddress && $obj['vendorAddress'] = $vendorAddress; - null !== $vendorAddressRecipient && $obj['vendorAddressRecipient'] = $vendorAddressRecipient; - null !== $vendorCompanyID && $obj['vendorCompanyID'] = $vendorCompanyID; - null !== $vendorEmail && $obj['vendorEmail'] = $vendorEmail; - null !== $vendorName && $obj['vendorName'] = $vendorName; - null !== $vendorTaxID && $obj['vendorTaxID'] = $vendorTaxID; - - return $obj; + $self = new self; + + null !== $allowances && $self['allowances'] = $allowances; + null !== $amountDue && $self['amountDue'] = $amountDue; + null !== $attachments && $self['attachments'] = $attachments; + null !== $billingAddress && $self['billingAddress'] = $billingAddress; + null !== $billingAddressRecipient && $self['billingAddressRecipient'] = $billingAddressRecipient; + null !== $charges && $self['charges'] = $charges; + null !== $currency && $self['currency'] = $currency; + null !== $customerAddress && $self['customerAddress'] = $customerAddress; + null !== $customerAddressRecipient && $self['customerAddressRecipient'] = $customerAddressRecipient; + null !== $customerCompanyID && $self['customerCompanyID'] = $customerCompanyID; + null !== $customerEmail && $self['customerEmail'] = $customerEmail; + null !== $customerID && $self['customerID'] = $customerID; + null !== $customerName && $self['customerName'] = $customerName; + null !== $customerTaxID && $self['customerTaxID'] = $customerTaxID; + null !== $direction && $self['direction'] = $direction; + null !== $documentType && $self['documentType'] = $documentType; + null !== $dueDate && $self['dueDate'] = $dueDate; + null !== $invoiceDate && $self['invoiceDate'] = $invoiceDate; + null !== $invoiceID && $self['invoiceID'] = $invoiceID; + null !== $invoiceTotal && $self['invoiceTotal'] = $invoiceTotal; + null !== $items && $self['items'] = $items; + null !== $note && $self['note'] = $note; + null !== $paymentDetails && $self['paymentDetails'] = $paymentDetails; + null !== $paymentTerm && $self['paymentTerm'] = $paymentTerm; + null !== $previousUnpaidBalance && $self['previousUnpaidBalance'] = $previousUnpaidBalance; + null !== $purchaseOrder && $self['purchaseOrder'] = $purchaseOrder; + null !== $remittanceAddress && $self['remittanceAddress'] = $remittanceAddress; + null !== $remittanceAddressRecipient && $self['remittanceAddressRecipient'] = $remittanceAddressRecipient; + null !== $serviceAddress && $self['serviceAddress'] = $serviceAddress; + null !== $serviceAddressRecipient && $self['serviceAddressRecipient'] = $serviceAddressRecipient; + null !== $serviceEndDate && $self['serviceEndDate'] = $serviceEndDate; + null !== $serviceStartDate && $self['serviceStartDate'] = $serviceStartDate; + null !== $shippingAddress && $self['shippingAddress'] = $shippingAddress; + null !== $shippingAddressRecipient && $self['shippingAddressRecipient'] = $shippingAddressRecipient; + null !== $state && $self['state'] = $state; + null !== $subtotal && $self['subtotal'] = $subtotal; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxDetails && $self['taxDetails'] = $taxDetails; + null !== $totalDiscount && $self['totalDiscount'] = $totalDiscount; + null !== $totalTax && $self['totalTax'] = $totalTax; + null !== $vatex && $self['vatex'] = $vatex; + null !== $vatexNote && $self['vatexNote'] = $vatexNote; + null !== $vendorAddress && $self['vendorAddress'] = $vendorAddress; + null !== $vendorAddressRecipient && $self['vendorAddressRecipient'] = $vendorAddressRecipient; + null !== $vendorCompanyID && $self['vendorCompanyID'] = $vendorCompanyID; + null !== $vendorEmail && $self['vendorEmail'] = $vendorEmail; + null !== $vendorName && $self['vendorName'] = $vendorName; + null !== $vendorTaxID && $self['vendorTaxID'] = $vendorTaxID; + + return $self; } /** @@ -607,10 +607,10 @@ public static function with( */ public function withAllowances(?array $allowances): self { - $obj = clone $this; - $obj['allowances'] = $allowances; + $self = clone $this; + $self['allowances'] = $allowances; - return $obj; + return $self; } /** @@ -618,10 +618,10 @@ public function withAllowances(?array $allowances): self */ public function withAmountDue(float|string|null $amountDue): self { - $obj = clone $this; - $obj['amountDue'] = $amountDue; + $self = clone $this; + $self['amountDue'] = $amountDue; - return $obj; + return $self; } /** @@ -634,10 +634,10 @@ public function withAmountDue(float|string|null $amountDue): self */ public function withAttachments(?array $attachments): self { - $obj = clone $this; - $obj['attachments'] = $attachments; + $self = clone $this; + $self['attachments'] = $attachments; - return $obj; + return $self; } /** @@ -645,10 +645,10 @@ public function withAttachments(?array $attachments): self */ public function withBillingAddress(?string $billingAddress): self { - $obj = clone $this; - $obj['billingAddress'] = $billingAddress; + $self = clone $this; + $self['billingAddress'] = $billingAddress; - return $obj; + return $self; } /** @@ -657,10 +657,10 @@ public function withBillingAddress(?string $billingAddress): self public function withBillingAddressRecipient( ?string $billingAddressRecipient ): self { - $obj = clone $this; - $obj['billingAddressRecipient'] = $billingAddressRecipient; + $self = clone $this; + $self['billingAddressRecipient'] = $billingAddressRecipient; - return $obj; + return $self; } /** @@ -676,10 +676,10 @@ public function withBillingAddressRecipient( */ public function withCharges(?array $charges): self { - $obj = clone $this; - $obj['charges'] = $charges; + $self = clone $this; + $self['charges'] = $charges; - return $obj; + return $self; } /** @@ -689,10 +689,10 @@ public function withCharges(?array $charges): self */ public function withCurrency(CurrencyCode|string $currency): self { - $obj = clone $this; - $obj['currency'] = $currency; + $self = clone $this; + $self['currency'] = $currency; - return $obj; + return $self; } /** @@ -700,10 +700,10 @@ public function withCurrency(CurrencyCode|string $currency): self */ public function withCustomerAddress(?string $customerAddress): self { - $obj = clone $this; - $obj['customerAddress'] = $customerAddress; + $self = clone $this; + $self['customerAddress'] = $customerAddress; - return $obj; + return $self; } /** @@ -712,10 +712,10 @@ public function withCustomerAddress(?string $customerAddress): self public function withCustomerAddressRecipient( ?string $customerAddressRecipient ): self { - $obj = clone $this; - $obj['customerAddressRecipient'] = $customerAddressRecipient; + $self = clone $this; + $self['customerAddressRecipient'] = $customerAddressRecipient; - return $obj; + return $self; } /** @@ -723,10 +723,10 @@ public function withCustomerAddressRecipient( */ public function withCustomerCompanyID(?string $customerCompanyID): self { - $obj = clone $this; - $obj['customerCompanyID'] = $customerCompanyID; + $self = clone $this; + $self['customerCompanyID'] = $customerCompanyID; - return $obj; + return $self; } /** @@ -734,10 +734,10 @@ public function withCustomerCompanyID(?string $customerCompanyID): self */ public function withCustomerEmail(?string $customerEmail): self { - $obj = clone $this; - $obj['customerEmail'] = $customerEmail; + $self = clone $this; + $self['customerEmail'] = $customerEmail; - return $obj; + return $self; } /** @@ -745,10 +745,10 @@ public function withCustomerEmail(?string $customerEmail): self */ public function withCustomerID(?string $customerID): self { - $obj = clone $this; - $obj['customerID'] = $customerID; + $self = clone $this; + $self['customerID'] = $customerID; - return $obj; + return $self; } /** @@ -756,10 +756,10 @@ public function withCustomerID(?string $customerID): self */ public function withCustomerName(?string $customerName): self { - $obj = clone $this; - $obj['customerName'] = $customerName; + $self = clone $this; + $self['customerName'] = $customerName; - return $obj; + return $self; } /** @@ -767,10 +767,10 @@ public function withCustomerName(?string $customerName): self */ public function withCustomerTaxID(?string $customerTaxID): self { - $obj = clone $this; - $obj['customerTaxID'] = $customerTaxID; + $self = clone $this; + $self['customerTaxID'] = $customerTaxID; - return $obj; + return $self; } /** @@ -780,10 +780,10 @@ public function withCustomerTaxID(?string $customerTaxID): self */ public function withDirection(DocumentDirection|string $direction): self { - $obj = clone $this; - $obj['direction'] = $direction; + $self = clone $this; + $self['direction'] = $direction; - return $obj; + return $self; } /** @@ -793,10 +793,10 @@ public function withDirection(DocumentDirection|string $direction): self */ public function withDocumentType(DocumentType|string $documentType): self { - $obj = clone $this; - $obj['documentType'] = $documentType; + $self = clone $this; + $self['documentType'] = $documentType; - return $obj; + return $self; } /** @@ -804,10 +804,10 @@ public function withDocumentType(DocumentType|string $documentType): self */ public function withDueDate(?\DateTimeInterface $dueDate): self { - $obj = clone $this; - $obj['dueDate'] = $dueDate; + $self = clone $this; + $self['dueDate'] = $dueDate; - return $obj; + return $self; } /** @@ -815,10 +815,10 @@ public function withDueDate(?\DateTimeInterface $dueDate): self */ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self { - $obj = clone $this; - $obj['invoiceDate'] = $invoiceDate; + $self = clone $this; + $self['invoiceDate'] = $invoiceDate; - return $obj; + return $self; } /** @@ -826,10 +826,10 @@ public function withInvoiceDate(?\DateTimeInterface $invoiceDate): self */ public function withInvoiceID(?string $invoiceID): self { - $obj = clone $this; - $obj['invoiceID'] = $invoiceID; + $self = clone $this; + $self['invoiceID'] = $invoiceID; - return $obj; + return $self; } /** @@ -837,10 +837,10 @@ public function withInvoiceID(?string $invoiceID): self */ public function withInvoiceTotal(float|string|null $invoiceTotal): self { - $obj = clone $this; - $obj['invoiceTotal'] = $invoiceTotal; + $self = clone $this; + $self['invoiceTotal'] = $invoiceTotal; - return $obj; + return $self; } /** @@ -862,10 +862,10 @@ public function withInvoiceTotal(float|string|null $invoiceTotal): self */ public function withItems(array $items): self { - $obj = clone $this; - $obj['items'] = $items; + $self = clone $this; + $self['items'] = $items; - return $obj; + return $self; } /** @@ -873,10 +873,10 @@ public function withItems(array $items): self */ public function withNote(?string $note): self { - $obj = clone $this; - $obj['note'] = $note; + $self = clone $this; + $self['note'] = $note; - return $obj; + return $self; } /** @@ -889,10 +889,10 @@ public function withNote(?string $note): self */ public function withPaymentDetails(?array $paymentDetails): self { - $obj = clone $this; - $obj['paymentDetails'] = $paymentDetails; + $self = clone $this; + $self['paymentDetails'] = $paymentDetails; - return $obj; + return $self; } /** @@ -900,10 +900,10 @@ public function withPaymentDetails(?array $paymentDetails): self */ public function withPaymentTerm(?string $paymentTerm): self { - $obj = clone $this; - $obj['paymentTerm'] = $paymentTerm; + $self = clone $this; + $self['paymentTerm'] = $paymentTerm; - return $obj; + return $self; } /** @@ -912,10 +912,10 @@ public function withPaymentTerm(?string $paymentTerm): self public function withPreviousUnpaidBalance( float|string|null $previousUnpaidBalance ): self { - $obj = clone $this; - $obj['previousUnpaidBalance'] = $previousUnpaidBalance; + $self = clone $this; + $self['previousUnpaidBalance'] = $previousUnpaidBalance; - return $obj; + return $self; } /** @@ -923,10 +923,10 @@ public function withPreviousUnpaidBalance( */ public function withPurchaseOrder(?string $purchaseOrder): self { - $obj = clone $this; - $obj['purchaseOrder'] = $purchaseOrder; + $self = clone $this; + $self['purchaseOrder'] = $purchaseOrder; - return $obj; + return $self; } /** @@ -934,10 +934,10 @@ public function withPurchaseOrder(?string $purchaseOrder): self */ public function withRemittanceAddress(?string $remittanceAddress): self { - $obj = clone $this; - $obj['remittanceAddress'] = $remittanceAddress; + $self = clone $this; + $self['remittanceAddress'] = $remittanceAddress; - return $obj; + return $self; } /** @@ -946,10 +946,10 @@ public function withRemittanceAddress(?string $remittanceAddress): self public function withRemittanceAddressRecipient( ?string $remittanceAddressRecipient ): self { - $obj = clone $this; - $obj['remittanceAddressRecipient'] = $remittanceAddressRecipient; + $self = clone $this; + $self['remittanceAddressRecipient'] = $remittanceAddressRecipient; - return $obj; + return $self; } /** @@ -957,10 +957,10 @@ public function withRemittanceAddressRecipient( */ public function withServiceAddress(?string $serviceAddress): self { - $obj = clone $this; - $obj['serviceAddress'] = $serviceAddress; + $self = clone $this; + $self['serviceAddress'] = $serviceAddress; - return $obj; + return $self; } /** @@ -969,10 +969,10 @@ public function withServiceAddress(?string $serviceAddress): self public function withServiceAddressRecipient( ?string $serviceAddressRecipient ): self { - $obj = clone $this; - $obj['serviceAddressRecipient'] = $serviceAddressRecipient; + $self = clone $this; + $self['serviceAddressRecipient'] = $serviceAddressRecipient; - return $obj; + return $self; } /** @@ -981,10 +981,10 @@ public function withServiceAddressRecipient( public function withServiceEndDate( ?\DateTimeInterface $serviceEndDate ): self { - $obj = clone $this; - $obj['serviceEndDate'] = $serviceEndDate; + $self = clone $this; + $self['serviceEndDate'] = $serviceEndDate; - return $obj; + return $self; } /** @@ -993,10 +993,10 @@ public function withServiceEndDate( public function withServiceStartDate( ?\DateTimeInterface $serviceStartDate ): self { - $obj = clone $this; - $obj['serviceStartDate'] = $serviceStartDate; + $self = clone $this; + $self['serviceStartDate'] = $serviceStartDate; - return $obj; + return $self; } /** @@ -1004,10 +1004,10 @@ public function withServiceStartDate( */ public function withShippingAddress(?string $shippingAddress): self { - $obj = clone $this; - $obj['shippingAddress'] = $shippingAddress; + $self = clone $this; + $self['shippingAddress'] = $shippingAddress; - return $obj; + return $self; } /** @@ -1016,10 +1016,10 @@ public function withShippingAddress(?string $shippingAddress): self public function withShippingAddressRecipient( ?string $shippingAddressRecipient ): self { - $obj = clone $this; - $obj['shippingAddressRecipient'] = $shippingAddressRecipient; + $self = clone $this; + $self['shippingAddressRecipient'] = $shippingAddressRecipient; - return $obj; + return $self; } /** @@ -1029,10 +1029,10 @@ public function withShippingAddressRecipient( */ public function withState(DocumentState|string $state): self { - $obj = clone $this; - $obj['state'] = $state; + $self = clone $this; + $self['state'] = $state; - return $obj; + return $self; } /** @@ -1040,10 +1040,10 @@ public function withState(DocumentState|string $state): self */ public function withSubtotal(float|string|null $subtotal): self { - $obj = clone $this; - $obj['subtotal'] = $subtotal; + $self = clone $this; + $self['subtotal'] = $subtotal; - return $obj; + return $self; } /** @@ -1054,10 +1054,10 @@ public function withSubtotal(float|string|null $subtotal): self public function withTaxCode( ValidateValidateJsonParams\TaxCode|string $taxCode ): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -1067,10 +1067,10 @@ public function withTaxCode( */ public function withTaxDetails(?array $taxDetails): self { - $obj = clone $this; - $obj['taxDetails'] = $taxDetails; + $self = clone $this; + $self['taxDetails'] = $taxDetails; - return $obj; + return $self; } /** @@ -1078,10 +1078,10 @@ public function withTaxDetails(?array $taxDetails): self */ public function withTotalDiscount(float|string|null $totalDiscount): self { - $obj = clone $this; - $obj['totalDiscount'] = $totalDiscount; + $self = clone $this; + $self['totalDiscount'] = $totalDiscount; - return $obj; + return $self; } /** @@ -1089,10 +1089,10 @@ public function withTotalDiscount(float|string|null $totalDiscount): self */ public function withTotalTax(float|string|null $totalTax): self { - $obj = clone $this; - $obj['totalTax'] = $totalTax; + $self = clone $this; + $self['totalTax'] = $totalTax; - return $obj; + return $self; } /** @@ -1105,10 +1105,10 @@ public function withTotalTax(float|string|null $totalTax): self */ public function withVatex(Vatex|string|null $vatex): self { - $obj = clone $this; - $obj['vatex'] = $vatex; + $self = clone $this; + $self['vatex'] = $vatex; - return $obj; + return $self; } /** @@ -1116,10 +1116,10 @@ public function withVatex(Vatex|string|null $vatex): self */ public function withVatexNote(?string $vatexNote): self { - $obj = clone $this; - $obj['vatexNote'] = $vatexNote; + $self = clone $this; + $self['vatexNote'] = $vatexNote; - return $obj; + return $self; } /** @@ -1127,10 +1127,10 @@ public function withVatexNote(?string $vatexNote): self */ public function withVendorAddress(?string $vendorAddress): self { - $obj = clone $this; - $obj['vendorAddress'] = $vendorAddress; + $self = clone $this; + $self['vendorAddress'] = $vendorAddress; - return $obj; + return $self; } /** @@ -1139,10 +1139,10 @@ public function withVendorAddress(?string $vendorAddress): self public function withVendorAddressRecipient( ?string $vendorAddressRecipient ): self { - $obj = clone $this; - $obj['vendorAddressRecipient'] = $vendorAddressRecipient; + $self = clone $this; + $self['vendorAddressRecipient'] = $vendorAddressRecipient; - return $obj; + return $self; } /** @@ -1150,10 +1150,10 @@ public function withVendorAddressRecipient( */ public function withVendorCompanyID(?string $vendorCompanyID): self { - $obj = clone $this; - $obj['vendorCompanyID'] = $vendorCompanyID; + $self = clone $this; + $self['vendorCompanyID'] = $vendorCompanyID; - return $obj; + return $self; } /** @@ -1161,10 +1161,10 @@ public function withVendorCompanyID(?string $vendorCompanyID): self */ public function withVendorEmail(?string $vendorEmail): self { - $obj = clone $this; - $obj['vendorEmail'] = $vendorEmail; + $self = clone $this; + $self['vendorEmail'] = $vendorEmail; - return $obj; + return $self; } /** @@ -1172,10 +1172,10 @@ public function withVendorEmail(?string $vendorEmail): self */ public function withVendorName(?string $vendorName): self { - $obj = clone $this; - $obj['vendorName'] = $vendorName; + $self = clone $this; + $self['vendorName'] = $vendorName; - return $obj; + return $self; } /** @@ -1183,9 +1183,9 @@ public function withVendorName(?string $vendorName): self */ public function withVendorTaxID(?string $vendorTaxID): self { - $obj = clone $this; - $obj['vendorTaxID'] = $vendorTaxID; + $self = clone $this; + $self['vendorTaxID'] = $vendorTaxID; - return $obj; + return $self; } } diff --git a/src/Validate/ValidateValidateJsonParams/Allowance.php b/src/Validate/ValidateValidateJsonParams/Allowance.php index 5974381b..7a07853e 100644 --- a/src/Validate/ValidateValidateJsonParams/Allowance.php +++ b/src/Validate/ValidateValidateJsonParams/Allowance.php @@ -99,17 +99,17 @@ public static function with( TaxCode|string|null $taxCode = null, float|string|null $taxRate = null, ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $baseAmount && $obj['baseAmount'] = $baseAmount; - null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; - null !== $reason && $obj['reason'] = $reason; - null !== $reasonCode && $obj['reasonCode'] = $reasonCode; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxRate && $obj['taxRate'] = $taxRate; + null !== $amount && $self['amount'] = $amount; + null !== $baseAmount && $self['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $self['multiplierFactor'] = $multiplierFactor; + null !== $reason && $self['reason'] = $reason; + null !== $reasonCode && $self['reasonCode'] = $reasonCode; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxRate && $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -117,10 +117,10 @@ public static function with( */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -128,10 +128,10 @@ public function withAmount(float|string|null $amount): self */ public function withBaseAmount(float|string|null $baseAmount): self { - $obj = clone $this; - $obj['baseAmount'] = $baseAmount; + $self = clone $this; + $self['baseAmount'] = $baseAmount; - return $obj; + return $self; } /** @@ -140,10 +140,10 @@ public function withBaseAmount(float|string|null $baseAmount): self public function withMultiplierFactor( float|string|null $multiplierFactor ): self { - $obj = clone $this; - $obj['multiplierFactor'] = $multiplierFactor; + $self = clone $this; + $self['multiplierFactor'] = $multiplierFactor; - return $obj; + return $self; } /** @@ -151,10 +151,10 @@ public function withMultiplierFactor( */ public function withReason(?string $reason): self { - $obj = clone $this; - $obj['reason'] = $reason; + $self = clone $this; + $self['reason'] = $reason; - return $obj; + return $self; } /** @@ -164,10 +164,10 @@ public function withReason(?string $reason): self */ public function withReasonCode(ReasonCode|string|null $reasonCode): self { - $obj = clone $this; - $obj['reasonCode'] = $reasonCode; + $self = clone $this; + $self['reasonCode'] = $reasonCode; - return $obj; + return $self; } /** @@ -178,10 +178,10 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self public function withTaxCode( TaxCode|string $taxCode, ): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -189,9 +189,9 @@ public function withTaxCode( */ public function withTaxRate(float|string|null $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } } diff --git a/src/Validate/ValidateValidateJsonParams/Charge.php b/src/Validate/ValidateValidateJsonParams/Charge.php index c8d8a08a..02791093 100644 --- a/src/Validate/ValidateValidateJsonParams/Charge.php +++ b/src/Validate/ValidateValidateJsonParams/Charge.php @@ -104,17 +104,17 @@ public static function with( TaxCode|string|null $taxCode = null, float|string|null $taxRate = null, ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $baseAmount && $obj['baseAmount'] = $baseAmount; - null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; - null !== $reason && $obj['reason'] = $reason; - null !== $reasonCode && $obj['reasonCode'] = $reasonCode; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxRate && $obj['taxRate'] = $taxRate; + null !== $amount && $self['amount'] = $amount; + null !== $baseAmount && $self['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $self['multiplierFactor'] = $multiplierFactor; + null !== $reason && $self['reason'] = $reason; + null !== $reasonCode && $self['reasonCode'] = $reasonCode; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxRate && $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -122,10 +122,10 @@ public static function with( */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -133,10 +133,10 @@ public function withAmount(float|string|null $amount): self */ public function withBaseAmount(float|string|null $baseAmount): self { - $obj = clone $this; - $obj['baseAmount'] = $baseAmount; + $self = clone $this; + $self['baseAmount'] = $baseAmount; - return $obj; + return $self; } /** @@ -145,10 +145,10 @@ public function withBaseAmount(float|string|null $baseAmount): self public function withMultiplierFactor( float|string|null $multiplierFactor ): self { - $obj = clone $this; - $obj['multiplierFactor'] = $multiplierFactor; + $self = clone $this; + $self['multiplierFactor'] = $multiplierFactor; - return $obj; + return $self; } /** @@ -156,10 +156,10 @@ public function withMultiplierFactor( */ public function withReason(?string $reason): self { - $obj = clone $this; - $obj['reason'] = $reason; + $self = clone $this; + $self['reason'] = $reason; - return $obj; + return $self; } /** @@ -169,10 +169,10 @@ public function withReason(?string $reason): self */ public function withReasonCode(ReasonCode|string|null $reasonCode): self { - $obj = clone $this; - $obj['reasonCode'] = $reasonCode; + $self = clone $this; + $self['reasonCode'] = $reasonCode; - return $obj; + return $self; } /** @@ -187,10 +187,10 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self public function withTaxCode( TaxCode|string|null $taxCode, ): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -198,9 +198,9 @@ public function withTaxCode( */ public function withTaxRate(float|string|null $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } } diff --git a/src/Validate/ValidateValidateJsonParams/Item.php b/src/Validate/ValidateValidateJsonParams/Item.php index 97f47ded..7b438856 100644 --- a/src/Validate/ValidateValidateJsonParams/Item.php +++ b/src/Validate/ValidateValidateJsonParams/Item.php @@ -152,22 +152,22 @@ public static function with( UnitOfMeasureCode|string|null $unit = null, float|string|null $unitPrice = null, ): self { - $obj = new self; - - $obj['date'] = $date; - - null !== $allowances && $obj['allowances'] = $allowances; - null !== $amount && $obj['amount'] = $amount; - null !== $charges && $obj['charges'] = $charges; - null !== $description && $obj['description'] = $description; - null !== $productCode && $obj['productCode'] = $productCode; - null !== $quantity && $obj['quantity'] = $quantity; - null !== $tax && $obj['tax'] = $tax; - null !== $taxRate && $obj['taxRate'] = $taxRate; - null !== $unit && $obj['unit'] = $unit; - null !== $unitPrice && $obj['unitPrice'] = $unitPrice; - - return $obj; + $self = new self; + + $self['date'] = $date; + + null !== $allowances && $self['allowances'] = $allowances; + null !== $amount && $self['amount'] = $amount; + null !== $charges && $self['charges'] = $charges; + null !== $description && $self['description'] = $description; + null !== $productCode && $self['productCode'] = $productCode; + null !== $quantity && $self['quantity'] = $quantity; + null !== $tax && $self['tax'] = $tax; + null !== $taxRate && $self['taxRate'] = $taxRate; + null !== $unit && $self['unit'] = $unit; + null !== $unitPrice && $self['unitPrice'] = $unitPrice; + + return $self; } /** @@ -185,10 +185,10 @@ public static function with( */ public function withAllowances(?array $allowances): self { - $obj = clone $this; - $obj['allowances'] = $allowances; + $self = clone $this; + $self['allowances'] = $allowances; - return $obj; + return $self; } /** @@ -196,10 +196,10 @@ public function withAllowances(?array $allowances): self */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -217,10 +217,10 @@ public function withAmount(float|string|null $amount): self */ public function withCharges(?array $charges): self { - $obj = clone $this; - $obj['charges'] = $charges; + $self = clone $this; + $self['charges'] = $charges; - return $obj; + return $self; } /** @@ -228,10 +228,10 @@ public function withCharges(?array $charges): self */ public function withDate(null $date): self { - $obj = clone $this; - $obj['date'] = $date; + $self = clone $this; + $self['date'] = $date; - return $obj; + return $self; } /** @@ -239,10 +239,10 @@ public function withDate(null $date): self */ public function withDescription(?string $description): self { - $obj = clone $this; - $obj['description'] = $description; + $self = clone $this; + $self['description'] = $description; - return $obj; + return $self; } /** @@ -250,10 +250,10 @@ public function withDescription(?string $description): self */ public function withProductCode(?string $productCode): self { - $obj = clone $this; - $obj['productCode'] = $productCode; + $self = clone $this; + $self['productCode'] = $productCode; - return $obj; + return $self; } /** @@ -261,10 +261,10 @@ public function withProductCode(?string $productCode): self */ public function withQuantity(float|string|null $quantity): self { - $obj = clone $this; - $obj['quantity'] = $quantity; + $self = clone $this; + $self['quantity'] = $quantity; - return $obj; + return $self; } /** @@ -272,10 +272,10 @@ public function withQuantity(float|string|null $quantity): self */ public function withTax(float|string|null $tax): self { - $obj = clone $this; - $obj['tax'] = $tax; + $self = clone $this; + $self['tax'] = $tax; - return $obj; + return $self; } /** @@ -283,10 +283,10 @@ public function withTax(float|string|null $tax): self */ public function withTaxRate(float|string|null $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -296,10 +296,10 @@ public function withTaxRate(float|string|null $taxRate): self */ public function withUnit(UnitOfMeasureCode|string|null $unit): self { - $obj = clone $this; - $obj['unit'] = $unit; + $self = clone $this; + $self['unit'] = $unit; - return $obj; + return $self; } /** @@ -307,9 +307,9 @@ public function withUnit(UnitOfMeasureCode|string|null $unit): self */ public function withUnitPrice(float|string|null $unitPrice): self { - $obj = clone $this; - $obj['unitPrice'] = $unitPrice; + $self = clone $this; + $self['unitPrice'] = $unitPrice; - return $obj; + return $self; } } diff --git a/src/Validate/ValidateValidateJsonParams/Item/Allowance.php b/src/Validate/ValidateValidateJsonParams/Item/Allowance.php index a1a4a274..3c6f5ad9 100644 --- a/src/Validate/ValidateValidateJsonParams/Item/Allowance.php +++ b/src/Validate/ValidateValidateJsonParams/Item/Allowance.php @@ -96,17 +96,17 @@ public static function with( TaxCode|string|null $taxCode = null, float|string|null $taxRate = null, ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $baseAmount && $obj['baseAmount'] = $baseAmount; - null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; - null !== $reason && $obj['reason'] = $reason; - null !== $reasonCode && $obj['reasonCode'] = $reasonCode; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxRate && $obj['taxRate'] = $taxRate; + null !== $amount && $self['amount'] = $amount; + null !== $baseAmount && $self['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $self['multiplierFactor'] = $multiplierFactor; + null !== $reason && $self['reason'] = $reason; + null !== $reasonCode && $self['reasonCode'] = $reasonCode; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxRate && $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -114,10 +114,10 @@ public static function with( */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -125,10 +125,10 @@ public function withAmount(float|string|null $amount): self */ public function withBaseAmount(float|string|null $baseAmount): self { - $obj = clone $this; - $obj['baseAmount'] = $baseAmount; + $self = clone $this; + $self['baseAmount'] = $baseAmount; - return $obj; + return $self; } /** @@ -137,10 +137,10 @@ public function withBaseAmount(float|string|null $baseAmount): self public function withMultiplierFactor( float|string|null $multiplierFactor ): self { - $obj = clone $this; - $obj['multiplierFactor'] = $multiplierFactor; + $self = clone $this; + $self['multiplierFactor'] = $multiplierFactor; - return $obj; + return $self; } /** @@ -148,10 +148,10 @@ public function withMultiplierFactor( */ public function withReason(?string $reason): self { - $obj = clone $this; - $obj['reason'] = $reason; + $self = clone $this; + $self['reason'] = $reason; - return $obj; + return $self; } /** @@ -161,10 +161,10 @@ public function withReason(?string $reason): self */ public function withReasonCode(ReasonCode|string|null $reasonCode): self { - $obj = clone $this; - $obj['reasonCode'] = $reasonCode; + $self = clone $this; + $self['reasonCode'] = $reasonCode; - return $obj; + return $self; } /** @@ -174,10 +174,10 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self */ public function withTaxCode(TaxCode|string $taxCode): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -185,9 +185,9 @@ public function withTaxCode(TaxCode|string $taxCode): self */ public function withTaxRate(float|string|null $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } } diff --git a/src/Validate/ValidateValidateJsonParams/Item/Charge.php b/src/Validate/ValidateValidateJsonParams/Item/Charge.php index 1e05750a..141db725 100644 --- a/src/Validate/ValidateValidateJsonParams/Item/Charge.php +++ b/src/Validate/ValidateValidateJsonParams/Item/Charge.php @@ -100,17 +100,17 @@ public static function with( TaxCode|string|null $taxCode = null, float|string|null $taxRate = null, ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $baseAmount && $obj['baseAmount'] = $baseAmount; - null !== $multiplierFactor && $obj['multiplierFactor'] = $multiplierFactor; - null !== $reason && $obj['reason'] = $reason; - null !== $reasonCode && $obj['reasonCode'] = $reasonCode; - null !== $taxCode && $obj['taxCode'] = $taxCode; - null !== $taxRate && $obj['taxRate'] = $taxRate; + null !== $amount && $self['amount'] = $amount; + null !== $baseAmount && $self['baseAmount'] = $baseAmount; + null !== $multiplierFactor && $self['multiplierFactor'] = $multiplierFactor; + null !== $reason && $self['reason'] = $reason; + null !== $reasonCode && $self['reasonCode'] = $reasonCode; + null !== $taxCode && $self['taxCode'] = $taxCode; + null !== $taxRate && $self['taxRate'] = $taxRate; - return $obj; + return $self; } /** @@ -118,10 +118,10 @@ public static function with( */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -129,10 +129,10 @@ public function withAmount(float|string|null $amount): self */ public function withBaseAmount(float|string|null $baseAmount): self { - $obj = clone $this; - $obj['baseAmount'] = $baseAmount; + $self = clone $this; + $self['baseAmount'] = $baseAmount; - return $obj; + return $self; } /** @@ -141,10 +141,10 @@ public function withBaseAmount(float|string|null $baseAmount): self public function withMultiplierFactor( float|string|null $multiplierFactor ): self { - $obj = clone $this; - $obj['multiplierFactor'] = $multiplierFactor; + $self = clone $this; + $self['multiplierFactor'] = $multiplierFactor; - return $obj; + return $self; } /** @@ -152,10 +152,10 @@ public function withMultiplierFactor( */ public function withReason(?string $reason): self { - $obj = clone $this; - $obj['reason'] = $reason; + $self = clone $this; + $self['reason'] = $reason; - return $obj; + return $self; } /** @@ -165,10 +165,10 @@ public function withReason(?string $reason): self */ public function withReasonCode(ReasonCode|string|null $reasonCode): self { - $obj = clone $this; - $obj['reasonCode'] = $reasonCode; + $self = clone $this; + $self['reasonCode'] = $reasonCode; - return $obj; + return $self; } /** @@ -182,10 +182,10 @@ public function withReasonCode(ReasonCode|string|null $reasonCode): self */ public function withTaxCode(TaxCode|string|null $taxCode): self { - $obj = clone $this; - $obj['taxCode'] = $taxCode; + $self = clone $this; + $self['taxCode'] = $taxCode; - return $obj; + return $self; } /** @@ -193,9 +193,9 @@ public function withTaxCode(TaxCode|string|null $taxCode): self */ public function withTaxRate(float|string|null $taxRate): self { - $obj = clone $this; - $obj['taxRate'] = $taxRate; + $self = clone $this; + $self['taxRate'] = $taxRate; - return $obj; + return $self; } } diff --git a/src/Validate/ValidateValidateJsonParams/TaxDetail.php b/src/Validate/ValidateValidateJsonParams/TaxDetail.php index 89b73471..e493fcce 100644 --- a/src/Validate/ValidateValidateJsonParams/TaxDetail.php +++ b/src/Validate/ValidateValidateJsonParams/TaxDetail.php @@ -44,12 +44,12 @@ public static function with( float|string|null $amount = null, ?string $rate = null ): self { - $obj = new self; + $self = new self; - null !== $amount && $obj['amount'] = $amount; - null !== $rate && $obj['rate'] = $rate; + null !== $amount && $self['amount'] = $amount; + null !== $rate && $self['rate'] = $rate; - return $obj; + return $self; } /** @@ -57,10 +57,10 @@ public static function with( */ public function withAmount(float|string|null $amount): self { - $obj = clone $this; - $obj['amount'] = $amount; + $self = clone $this; + $self['amount'] = $amount; - return $obj; + return $self; } /** @@ -68,9 +68,9 @@ public function withAmount(float|string|null $amount): self */ public function withRate(?string $rate): self { - $obj = clone $this; - $obj['rate'] = $rate; + $self = clone $this; + $self['rate'] = $rate; - return $obj; + return $self; } } diff --git a/src/Validate/ValidateValidatePeppolIDParams.php b/src/Validate/ValidateValidatePeppolIDParams.php index 8e464e89..90f9f769 100644 --- a/src/Validate/ValidateValidatePeppolIDParams.php +++ b/src/Validate/ValidateValidatePeppolIDParams.php @@ -54,11 +54,11 @@ public function __construct() */ public static function with(string $peppolID): self { - $obj = new self; + $self = new self; - $obj['peppolID'] = $peppolID; + $self['peppolID'] = $peppolID; - return $obj; + return $self; } /** @@ -66,9 +66,9 @@ public static function with(string $peppolID): self */ public function withPeppolID(string $peppolID): self { - $obj = clone $this; - $obj['peppolID'] = $peppolID; + $self = clone $this; + $self['peppolID'] = $peppolID; - return $obj; + return $self; } } diff --git a/src/Validate/ValidateValidatePeppolIDResponse.php b/src/Validate/ValidateValidatePeppolIDResponse.php index 4d8d42f0..064a2f5a 100644 --- a/src/Validate/ValidateValidatePeppolIDResponse.php +++ b/src/Validate/ValidateValidatePeppolIDResponse.php @@ -101,16 +101,16 @@ public static function with( bool $isValid, ?array $supportedDocumentTypes = null, ): self { - $obj = new self; + $self = new self; - $obj['businessCard'] = $businessCard; - $obj['businessCardValid'] = $businessCardValid; - $obj['dnsValid'] = $dnsValid; - $obj['isValid'] = $isValid; + $self['businessCard'] = $businessCard; + $self['businessCardValid'] = $businessCardValid; + $self['dnsValid'] = $dnsValid; + $self['isValid'] = $isValid; - null !== $supportedDocumentTypes && $obj['supportedDocumentTypes'] = $supportedDocumentTypes; + null !== $supportedDocumentTypes && $self['supportedDocumentTypes'] = $supportedDocumentTypes; - return $obj; + return $self; } /** @@ -125,10 +125,10 @@ public static function with( public function withBusinessCard( BusinessCard|array|null $businessCard ): self { - $obj = clone $this; - $obj['businessCard'] = $businessCard; + $self = clone $this; + $self['businessCard'] = $businessCard; - return $obj; + return $self; } /** @@ -136,10 +136,10 @@ public function withBusinessCard( */ public function withBusinessCardValid(bool $businessCardValid): self { - $obj = clone $this; - $obj['businessCardValid'] = $businessCardValid; + $self = clone $this; + $self['businessCardValid'] = $businessCardValid; - return $obj; + return $self; } /** @@ -147,10 +147,10 @@ public function withBusinessCardValid(bool $businessCardValid): self */ public function withDNSValid(bool $dnsValid): self { - $obj = clone $this; - $obj['dnsValid'] = $dnsValid; + $self = clone $this; + $self['dnsValid'] = $dnsValid; - return $obj; + return $self; } /** @@ -158,10 +158,10 @@ public function withDNSValid(bool $dnsValid): self */ public function withIsValid(bool $isValid): self { - $obj = clone $this; - $obj['isValid'] = $isValid; + $self = clone $this; + $self['isValid'] = $isValid; - return $obj; + return $self; } /** @@ -170,9 +170,9 @@ public function withIsValid(bool $isValid): self public function withSupportedDocumentTypes( array $supportedDocumentTypes ): self { - $obj = clone $this; - $obj['supportedDocumentTypes'] = $supportedDocumentTypes; + $self = clone $this; + $self['supportedDocumentTypes'] = $supportedDocumentTypes; - return $obj; + return $self; } } diff --git a/src/Validate/ValidateValidatePeppolIDResponse/BusinessCard.php b/src/Validate/ValidateValidatePeppolIDResponse/BusinessCard.php index 28441e23..eef6c39a 100644 --- a/src/Validate/ValidateValidatePeppolIDResponse/BusinessCard.php +++ b/src/Validate/ValidateValidatePeppolIDResponse/BusinessCard.php @@ -46,37 +46,37 @@ public static function with( ?string $name = null, ?\DateTimeInterface $registrationDate = null, ): self { - $obj = new self; + $self = new self; - null !== $countryCode && $obj['countryCode'] = $countryCode; - null !== $name && $obj['name'] = $name; - null !== $registrationDate && $obj['registrationDate'] = $registrationDate; + null !== $countryCode && $self['countryCode'] = $countryCode; + null !== $name && $self['name'] = $name; + null !== $registrationDate && $self['registrationDate'] = $registrationDate; - return $obj; + return $self; } public function withCountryCode(?string $countryCode): self { - $obj = clone $this; - $obj['countryCode'] = $countryCode; + $self = clone $this; + $self['countryCode'] = $countryCode; - return $obj; + return $self; } public function withName(?string $name): self { - $obj = clone $this; - $obj['name'] = $name; + $self = clone $this; + $self['name'] = $name; - return $obj; + return $self; } public function withRegistrationDate( ?\DateTimeInterface $registrationDate ): self { - $obj = clone $this; - $obj['registrationDate'] = $registrationDate; + $self = clone $this; + $self['registrationDate'] = $registrationDate; - return $obj; + return $self; } } diff --git a/src/Validate/ValidateValidateUblParams.php b/src/Validate/ValidateValidateUblParams.php index 42149bfb..c83902bd 100644 --- a/src/Validate/ValidateValidateUblParams.php +++ b/src/Validate/ValidateValidateUblParams.php @@ -51,18 +51,18 @@ public function __construct() */ public static function with(string $file): self { - $obj = new self; + $self = new self; - $obj['file'] = $file; + $self['file'] = $file; - return $obj; + return $self; } public function withFile(string $file): self { - $obj = clone $this; - $obj['file'] = $file; + $self = clone $this; + $self['file'] = $file; - return $obj; + return $self; } } diff --git a/src/Webhooks/WebhookCreateParams.php b/src/Webhooks/WebhookCreateParams.php index 2082c3a2..49cd6327 100644 --- a/src/Webhooks/WebhookCreateParams.php +++ b/src/Webhooks/WebhookCreateParams.php @@ -66,14 +66,14 @@ public static function with( string $url, ?bool $enabled = null ): self { - $obj = new self; + $self = new self; - $obj['events'] = $events; - $obj['url'] = $url; + $self['events'] = $events; + $self['url'] = $url; - null !== $enabled && $obj['enabled'] = $enabled; + null !== $enabled && $self['enabled'] = $enabled; - return $obj; + return $self; } /** @@ -81,25 +81,25 @@ public static function with( */ public function withEvents(array $events): self { - $obj = clone $this; - $obj['events'] = $events; + $self = clone $this; + $self['events'] = $events; - return $obj; + return $self; } public function withURL(string $url): self { - $obj = clone $this; - $obj['url'] = $url; + $self = clone $this; + $self['url'] = $url; - return $obj; + return $self; } public function withEnabled(bool $enabled): self { - $obj = clone $this; - $obj['enabled'] = $enabled; + $self = clone $this; + $self['enabled'] = $enabled; - return $obj; + return $self; } } diff --git a/src/Webhooks/WebhookDeleteResponse.php b/src/Webhooks/WebhookDeleteResponse.php index 72da6b5f..39a67c73 100644 --- a/src/Webhooks/WebhookDeleteResponse.php +++ b/src/Webhooks/WebhookDeleteResponse.php @@ -47,18 +47,18 @@ public function __construct() */ public static function with(bool $isDeleted): self { - $obj = new self; + $self = new self; - $obj['isDeleted'] = $isDeleted; + $self['isDeleted'] = $isDeleted; - return $obj; + return $self; } public function withIsDeleted(bool $isDeleted): self { - $obj = clone $this; - $obj['isDeleted'] = $isDeleted; + $self = clone $this; + $self['isDeleted'] = $isDeleted; - return $obj; + return $self; } } diff --git a/src/Webhooks/WebhookResponse.php b/src/Webhooks/WebhookResponse.php index 73b3f632..9db6d400 100644 --- a/src/Webhooks/WebhookResponse.php +++ b/src/Webhooks/WebhookResponse.php @@ -78,24 +78,24 @@ public static function with( string $url, ?bool $enabled = null ): self { - $obj = new self; + $self = new self; - $obj['id'] = $id; - $obj['events'] = $events; - $obj['secret'] = $secret; - $obj['url'] = $url; + $self['id'] = $id; + $self['events'] = $events; + $self['secret'] = $secret; + $self['url'] = $url; - null !== $enabled && $obj['enabled'] = $enabled; + null !== $enabled && $self['enabled'] = $enabled; - return $obj; + return $self; } public function withID(string $id): self { - $obj = clone $this; - $obj['id'] = $id; + $self = clone $this; + $self['id'] = $id; - return $obj; + return $self; } /** @@ -103,33 +103,33 @@ public function withID(string $id): self */ public function withEvents(array $events): self { - $obj = clone $this; - $obj['events'] = $events; + $self = clone $this; + $self['events'] = $events; - return $obj; + return $self; } public function withSecret(string $secret): self { - $obj = clone $this; - $obj['secret'] = $secret; + $self = clone $this; + $self['secret'] = $secret; - return $obj; + return $self; } public function withURL(string $url): self { - $obj = clone $this; - $obj['url'] = $url; + $self = clone $this; + $self['url'] = $url; - return $obj; + return $self; } public function withEnabled(bool $enabled): self { - $obj = clone $this; - $obj['enabled'] = $enabled; + $self = clone $this; + $self['enabled'] = $enabled; - return $obj; + return $self; } } diff --git a/src/Webhooks/WebhookUpdateParams.php b/src/Webhooks/WebhookUpdateParams.php index 426a9157..9cb36276 100644 --- a/src/Webhooks/WebhookUpdateParams.php +++ b/src/Webhooks/WebhookUpdateParams.php @@ -51,21 +51,21 @@ public static function with( ?array $events = null, ?string $url = null ): self { - $obj = new self; + $self = new self; - null !== $enabled && $obj['enabled'] = $enabled; - null !== $events && $obj['events'] = $events; - null !== $url && $obj['url'] = $url; + null !== $enabled && $self['enabled'] = $enabled; + null !== $events && $self['events'] = $events; + null !== $url && $self['url'] = $url; - return $obj; + return $self; } public function withEnabled(?bool $enabled): self { - $obj = clone $this; - $obj['enabled'] = $enabled; + $self = clone $this; + $self['enabled'] = $enabled; - return $obj; + return $self; } /** @@ -73,17 +73,17 @@ public function withEnabled(?bool $enabled): self */ public function withEvents(?array $events): self { - $obj = clone $this; - $obj['events'] = $events; + $self = clone $this; + $self['events'] = $events; - return $obj; + return $self; } public function withURL(?string $url): self { - $obj = clone $this; - $obj['url'] = $url; + $self = clone $this; + $self['url'] = $url; - return $obj; + return $self; } } From e290c6404f5c8db7ebea93902d3e69e54d9d9bf4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Dec 2025 03:17:32 +0000 Subject: [PATCH 7/9] feat: split out services into normal & raw types --- README.md | 15 +- .../Documents/AttachmentsContract.php | 17 +- .../Documents/AttachmentsRawContract.php | 74 ++++ .../Documents/UblContract.php | 7 +- .../Documents/UblRawContract.php | 41 ++ src/ServiceContracts/DocumentsContract.php | 185 +++++++- src/ServiceContracts/DocumentsRawContract.php | 98 +++++ src/ServiceContracts/InboxContract.php | 41 +- src/ServiceContracts/InboxRawContract.php | 59 +++ src/ServiceContracts/LookupContract.php | 12 +- src/ServiceContracts/LookupRawContract.php | 44 ++ src/ServiceContracts/MeRawContract.php | 24 ++ src/ServiceContracts/OutboxContract.php | 30 +- src/ServiceContracts/OutboxRawContract.php | 44 ++ src/ServiceContracts/ValidateContract.php | 179 +++++++- src/ServiceContracts/ValidateRawContract.php | 59 +++ src/ServiceContracts/WebhooksContract.php | 16 +- src/ServiceContracts/WebhooksRawContract.php | 78 ++++ .../Documents/AttachmentsRawService.php | 144 +++++++ src/Services/Documents/AttachmentsService.php | 92 ++-- src/Services/Documents/UblRawService.php | 76 ++++ src/Services/Documents/UblService.php | 41 +- src/Services/DocumentsRawService.php | 303 +++++++++++++ src/Services/DocumentsService.php | 400 +++++++++++------- src/Services/InboxRawService.php | 137 ++++++ src/Services/InboxService.php | 130 +++--- src/Services/LookupRawService.php | 90 ++++ src/Services/LookupService.php | 61 +-- src/Services/MeRawService.php | 42 ++ src/Services/MeService.php | 20 +- src/Services/OutboxRawService.php | 105 +++++ src/Services/OutboxService.php | 101 +++-- src/Services/ValidateRawService.php | 211 +++++++++ src/Services/ValidateService.php | 334 +++++++++------ src/Services/WebhooksRawService.php | 154 +++++++ src/Services/WebhooksService.php | 97 ++--- tests/Services/Documents/AttachmentsTest.php | 12 +- tests/Services/Documents/UblTest.php | 4 +- tests/Services/DocumentsTest.php | 16 +- tests/Services/InboxTest.php | 6 +- tests/Services/LookupTest.php | 13 +- tests/Services/OutboxTest.php | 4 +- tests/Services/ValidateTest.php | 14 +- tests/Services/WebhooksTest.php | 17 +- 44 files changed, 2917 insertions(+), 730 deletions(-) create mode 100644 src/ServiceContracts/Documents/AttachmentsRawContract.php create mode 100644 src/ServiceContracts/Documents/UblRawContract.php create mode 100644 src/ServiceContracts/DocumentsRawContract.php create mode 100644 src/ServiceContracts/InboxRawContract.php create mode 100644 src/ServiceContracts/LookupRawContract.php create mode 100644 src/ServiceContracts/MeRawContract.php create mode 100644 src/ServiceContracts/OutboxRawContract.php create mode 100644 src/ServiceContracts/ValidateRawContract.php create mode 100644 src/ServiceContracts/WebhooksRawContract.php create mode 100644 src/Services/Documents/AttachmentsRawService.php create mode 100644 src/Services/Documents/UblRawService.php create mode 100644 src/Services/DocumentsRawService.php create mode 100644 src/Services/InboxRawService.php create mode 100644 src/Services/LookupRawService.php create mode 100644 src/Services/MeRawService.php create mode 100644 src/Services/OutboxRawService.php create mode 100644 src/Services/ValidateRawService.php create mode 100644 src/Services/WebhooksRawService.php diff --git a/README.md b/README.md index f9b65996..f44ba875 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ use EInvoiceAPI\Client; $client = new Client(apiKey: getenv('E_INVOICE_API_KEY') ?: 'My API Key'); -$documentResponse = $client->documents->create([]); +$documentResponse = $client->documents->create(); var_dump($documentResponse->id); ``` @@ -67,7 +67,7 @@ use EInvoiceAPI\Client; $client = new Client(apiKey: getenv('E_INVOICE_API_KEY') ?: 'My API Key'); -$page = $client->inbox->list([]); +$page = $client->inbox->list(); var_dump($page); @@ -91,11 +91,11 @@ When the library is unable to connect to the API, or if the API returns a non-su use EInvoiceAPI\Core\Exceptions\APIConnectionException; try { - $documentResponse = $client->documents->create([]); + $documentResponse = $client->documents->create(); } catch (APIConnectionException $e) { echo "The server could not be reached", PHP_EOL; var_dump($e->getPrevious()); -} catch (RateLimitError $_) { +} catch (RateLimitError $e) { echo "A 429 status code was received; we should back off a bit.", PHP_EOL; } catch (APIStatusError $e) { echo "Another non-200-range status code was received", PHP_EOL; @@ -137,7 +137,9 @@ use EInvoiceAPI\RequestOptions; $client = new Client(maxRetries: 0); // Or, configure per-request: -$result = $client->documents->create([], RequestOptions::with(maxRetries: 5)); +$result = $client->documents->create( + requestOptions: RequestOptions::with(maxRetries: 5) +); ``` ## Advanced concepts @@ -156,8 +158,7 @@ Note: the `extra*` parameters of the same name overrides the documented paramete use EInvoiceAPI\RequestOptions; $documentResponse = $client->documents->create( - [], - RequestOptions::with( + requestOptions: RequestOptions::with( extraQueryParams: ['my_query_parameter' => 'value'], extraBodyParams: ['my_body_parameter' => 'value'], extraHeaders: ['my-header' => 'value'], diff --git a/src/ServiceContracts/Documents/AttachmentsContract.php b/src/ServiceContracts/Documents/AttachmentsContract.php index 4c447db7..6e5ba135 100644 --- a/src/ServiceContracts/Documents/AttachmentsContract.php +++ b/src/ServiceContracts/Documents/AttachmentsContract.php @@ -5,10 +5,7 @@ namespace EInvoiceAPI\ServiceContracts\Documents; use EInvoiceAPI\Core\Exceptions\APIException; -use EInvoiceAPI\Documents\Attachments\AttachmentAddParams; -use EInvoiceAPI\Documents\Attachments\AttachmentDeleteParams; use EInvoiceAPI\Documents\Attachments\AttachmentDeleteResponse; -use EInvoiceAPI\Documents\Attachments\AttachmentRetrieveParams; use EInvoiceAPI\Documents\Attachments\DocumentAttachment; use EInvoiceAPI\RequestOptions; @@ -17,13 +14,11 @@ interface AttachmentsContract /** * @api * - * @param array|AttachmentRetrieveParams $params - * * @throws APIException */ public function retrieve( string $attachmentID, - array|AttachmentRetrieveParams $params, + string $documentID, ?RequestOptions $requestOptions = null, ): DocumentAttachment; @@ -42,26 +37,22 @@ public function list( /** * @api * - * @param array|AttachmentDeleteParams $params - * * @throws APIException */ public function delete( string $attachmentID, - array|AttachmentDeleteParams $params, + string $documentID, ?RequestOptions $requestOptions = null, ): AttachmentDeleteResponse; /** * @api * - * @param array|AttachmentAddParams $params - * * @throws APIException */ public function add( string $documentID, - array|AttachmentAddParams $params, - ?RequestOptions $requestOptions = null, + string $file, + ?RequestOptions $requestOptions = null ): DocumentAttachment; } diff --git a/src/ServiceContracts/Documents/AttachmentsRawContract.php b/src/ServiceContracts/Documents/AttachmentsRawContract.php new file mode 100644 index 00000000..a5fdf96d --- /dev/null +++ b/src/ServiceContracts/Documents/AttachmentsRawContract.php @@ -0,0 +1,74 @@ +|AttachmentRetrieveParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieve( + string $attachmentID, + array|AttachmentRetrieveParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @return BaseResponse> + * + * @throws APIException + */ + public function list( + string $documentID, + ?RequestOptions $requestOptions = null + ): BaseResponse; + + /** + * @api + * + * @param array|AttachmentDeleteParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function delete( + string $attachmentID, + array|AttachmentDeleteParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|AttachmentAddParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function add( + string $documentID, + array|AttachmentAddParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse; +} diff --git a/src/ServiceContracts/Documents/UblContract.php b/src/ServiceContracts/Documents/UblContract.php index 50365102..5a00dee4 100644 --- a/src/ServiceContracts/Documents/UblContract.php +++ b/src/ServiceContracts/Documents/UblContract.php @@ -6,7 +6,6 @@ use EInvoiceAPI\Core\Exceptions\APIException; use EInvoiceAPI\Documents\DocumentResponse; -use EInvoiceAPI\Documents\Ubl\UblCreateFromUblParams; use EInvoiceAPI\Documents\Ubl\UblGetResponse; use EInvoiceAPI\RequestOptions; @@ -15,13 +14,11 @@ interface UblContract /** * @api * - * @param array|UblCreateFromUblParams $params - * * @throws APIException */ public function createFromUbl( - array|UblCreateFromUblParams $params, - ?RequestOptions $requestOptions = null, + string $file, + ?RequestOptions $requestOptions = null ): DocumentResponse; /** diff --git a/src/ServiceContracts/Documents/UblRawContract.php b/src/ServiceContracts/Documents/UblRawContract.php new file mode 100644 index 00000000..fbae019a --- /dev/null +++ b/src/ServiceContracts/Documents/UblRawContract.php @@ -0,0 +1,41 @@ +|UblCreateFromUblParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function createFromUbl( + array|UblCreateFromUblParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @return BaseResponse + * + * @throws APIException + */ + public function get( + string $documentID, + ?RequestOptions $requestOptions = null + ): BaseResponse; +} diff --git a/src/ServiceContracts/DocumentsContract.php b/src/ServiceContracts/DocumentsContract.php index b00b99d8..0f475b25 100644 --- a/src/ServiceContracts/DocumentsContract.php +++ b/src/ServiceContracts/DocumentsContract.php @@ -5,12 +5,19 @@ namespace EInvoiceAPI\ServiceContracts; use EInvoiceAPI\Core\Exceptions\APIException; -use EInvoiceAPI\Documents\DocumentCreateFromPdfParams; -use EInvoiceAPI\Documents\DocumentCreateParams; +use EInvoiceAPI\Documents\CurrencyCode; +use EInvoiceAPI\Documents\DocumentAttachmentCreate; +use EInvoiceAPI\Documents\DocumentCreateParams\Allowance\ReasonCode; +use EInvoiceAPI\Documents\DocumentCreateParams\Allowance\TaxCode; +use EInvoiceAPI\Documents\DocumentCreateParams\Vatex; use EInvoiceAPI\Documents\DocumentDeleteResponse; +use EInvoiceAPI\Documents\DocumentDirection; use EInvoiceAPI\Documents\DocumentNewFromPdfResponse; use EInvoiceAPI\Documents\DocumentResponse; -use EInvoiceAPI\Documents\DocumentSendParams; +use EInvoiceAPI\Documents\DocumentType; +use EInvoiceAPI\Documents\PaymentDetailCreate; +use EInvoiceAPI\Documents\UnitOfMeasureCode; +use EInvoiceAPI\Inbox\DocumentState; use EInvoiceAPI\RequestOptions; use EInvoiceAPI\Validate\UblDocumentValidation; @@ -19,13 +26,163 @@ interface DocumentsContract /** * @api * - * @param array|DocumentCreateParams $params + * @param list|null $allowances + * @param float|string|null $amountDue The amount due for payment. Must be positive and rounded to maximum 2 decimals + * @param list|null $attachments + * @param string|null $billingAddress The billing address (if different from customer address) + * @param string|null $billingAddressRecipient The recipient name at the billing address + * @param list|null $charges + * @param 'EUR'|'USD'|'GBP'|'JPY'|'CHF'|'CAD'|'AUD'|'NZD'|'CNY'|'INR'|'SEK'|'NOK'|'DKK'|'SGD'|'HKD'|CurrencyCode $currency Currency of the invoice (ISO 4217 currency code) + * @param string|null $customerAddress The address of the customer/buyer + * @param string|null $customerAddressRecipient The recipient name at the customer address + * @param string|null $customerCompanyID Customer company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. + * @param string|null $customerEmail The email address of the customer + * @param string|null $customerID The unique identifier for the customer in your system + * @param string|null $customerName The company name of the customer/buyer + * @param string|null $customerTaxID Customer tax ID. For Belgium this is the VAT number. Must include the country prefix + * @param 'INBOUND'|'OUTBOUND'|DocumentDirection $direction The direction of the document: INBOUND (purchases) or OUTBOUND (sales) + * @param 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType $documentType The type of document: INVOICE, CREDIT_NOTE, or DEBIT_NOTE + * @param string|\DateTimeInterface|null $dueDate The date when payment is due + * @param string|\DateTimeInterface|null $invoiceDate The date when the invoice was issued + * @param string|null $invoiceID The unique invoice identifier/number + * @param float|string|null $invoiceTotal The total amount of the invoice including tax (invoice_total = subtotal + total_tax + total_discount). Must be positive and rounded to maximum 2 decimals + * @param list|null, + * amount?: float|string|null, + * charges?: list|null, + * date?: null|null, + * description?: string|null, + * productCode?: string|null, + * quantity?: float|string|null, + * tax?: float|string|null, + * taxRate?: float|string|null, + * unit?: '10'|'11'|'13'|'14'|'15'|'20'|'21'|'22'|'23'|'24'|'25'|'27'|'28'|'33'|'34'|'35'|'37'|'38'|'40'|'41'|'56'|'57'|'58'|'59'|'60'|'61'|'74'|'77'|'80'|'81'|'85'|'87'|'89'|'91'|'1I'|'EA'|'E01'|'E07'|'E09'|'E10'|'E12'|'E14'|'E17'|'E20'|'E23'|'E25'|'E27'|'E31'|'E34'|'E35'|'E36'|'E37'|'E38'|'E39'|'E40'|'E41'|'E42'|'E43'|'E44'|'E45'|'E46'|'E47'|'E48'|'E49'|'E50'|'E51'|'E52'|'E53'|'E54'|'E55'|'E56'|'E57'|'E58'|'E60'|'E62'|'E65'|'E66'|'E67'|'E69'|'E70'|'E71'|'E73'|'E75'|'E76'|'2A'|'2B'|'2C'|'2G'|'2H'|'2I'|'2J'|'2K'|'2L'|'2M'|'2N'|'2P'|'2Q'|'2R'|'2U'|'2X'|'2Y'|'2Z'|'3B'|'3C'|'4C'|'4G'|'4H'|'4K'|'4L'|'4M'|'4N'|'4O'|'4P'|'4Q'|'4R'|'4T'|'4U'|'4W'|'4X'|'5A'|'5B'|'5E'|'5J'|'A10'|'A11'|'A12'|'A13'|'A14'|'A15'|'A16'|'A17'|'A18'|'A19'|'A2'|'A20'|'A21'|'A22'|'A23'|'A24'|'A26'|'A27'|'A28'|'A29'|'A3'|'A30'|'A31'|'A32'|'A33'|'A34'|'A35'|'A36'|'A37'|'A38'|'A39'|'A4'|'A40'|'A41'|'A42'|'A43'|'A44'|'A45'|'A46'|'A47'|'A48'|'A49'|'A5'|'A50'|'A51'|'A52'|'A53'|'A54'|'A55'|'A56'|'A57'|'A58'|'A59'|'A6'|'A60'|'A61'|'A62'|'A63'|'A64'|'A65'|'A66'|'A67'|'A68'|'A69'|'A7'|'A70'|'A71'|'A72'|'A73'|'A74'|'A75'|'A76'|'A77'|'A78'|'A79'|'A8'|'A80'|'A81'|'A82'|'A83'|'A84'|'A85'|'A86'|'A87'|'A88'|'A89'|'A9'|'A90'|'A91'|'A92'|'A93'|'A94'|'A95'|'A96'|'A97'|'A98'|'A99'|'ACR'|'AH'|'AI'|'AK'|'AMH'|'AMT'|'ANN'|'B1'|'B11'|'B12'|'B13'|'B14'|'B15'|'B16'|'B17'|'B18'|'B19'|'B20'|'B21'|'B22'|'B23'|'B24'|'B25'|'B26'|'B27'|'B28'|'B29'|'B3'|'B30'|'B31'|'B32'|'B33'|'B34'|'B35'|'B36'|'B37'|'B38'|'B39'|'B4'|'B40'|'B41'|'B42'|'B43'|'B44'|'B45'|'B46'|'B47'|'B48'|'B49'|'B5'|'B50'|'B52'|'B53'|'B54'|'B55'|'B56'|'B57'|'B58'|'B59'|'B6'|'B60'|'B61'|'B62'|'B63'|'B64'|'B65'|'B66'|'B67'|'B68'|'B69'|'B7'|'B70'|'B71'|'B72'|'B73'|'B74'|'B75'|'B76'|'B77'|'B78'|'B79'|'B8'|'B80'|'B81'|'B82'|'B83'|'B84'|'B85'|'B86'|'B87'|'B88'|'B89'|'B9'|'B90'|'B91'|'B92'|'B93'|'B94'|'B95'|'B96'|'B97'|'B98'|'B99'|'BAR'|'BB'|'BFT'|'BHP'|'BIL'|'BLD'|'BLL'|'BUA'|'BUI'|'C0'|'C10'|'C11'|'C12'|'C13'|'C14'|'C15'|'C16'|'C17'|'C18'|'C19'|'C20'|'C21'|'C22'|'C23'|'C24'|'C25'|'C26'|'C27'|'C28'|'C29'|'C30'|'C31'|'C32'|'C33'|'C34'|'C35'|'C36'|'C37'|'C38'|'C39'|'C40'|'C41'|'C42'|'C43'|'C44'|'C45'|'C46'|'C47'|'C48'|'C49'|'C50'|'C51'|'C52'|'C53'|'C54'|'C55'|'C56'|'C57'|'C58'|'C59'|'C60'|'C61'|'C63'|'C64'|'C65'|'C66'|'C67'|'C68'|'C69'|'C70'|'C71'|'C72'|'C73'|'C74'|'C75'|'C76'|'C77'|'C78'|'C79'|'C80'|'C81'|'C82'|'C83'|'C84'|'C85'|'C86'|'C87'|'C88'|'C89'|'C90'|'C91'|'C92'|'C93'|'C94'|'C95'|'C96'|'C97'|'C98'|'C99'|'CDL'|'CEL'|'CHU'|'CIU'|'CLT'|'CMK'|'CMQ'|'CMT'|'CNP'|'CNT'|'COU'|'CTG'|'CTN'|'CUR'|'CWA'|'CWI'|'DAN'|'DAY'|'DB'|'DD'|'DG'|'DI'|'DLT'|'DMK'|'DMQ'|'DMT'|'DPC'|'DPT'|'DRA'|'DZN'|'DZP'|'FOT'|'GLL'|'GLI'|'GRM'|'GRO'|'HUR'|'HTZ'|'INH'|'KGM'|'KMT'|'MTR'|'SMI'|'MIN'|'MON'|'ONZ'|'LBR'|'QT'|'SEC'|'FTK'|'INK'|'MTK'|'YDK'|'TNE'|'VLT'|'WTT'|'YRD'|'FTQ'|'INQ'|'MTQ'|'YDQ'|'HAR'|'KLT'|'MLT'|'MMT'|'KMK'|'MMK'|'XAA'|'XAB'|'XAC'|'XAD'|'XAE'|'XAF'|'XAG'|'XAH'|'XAI'|'XAJ'|'XAL'|'XAM'|'XAP'|'XAT'|'XAV'|'XB4'|'XBA'|'XBB'|'XBC'|'XBD'|'XBE'|'XBF'|'XBG'|'XBH'|'XBI'|'XBJ'|'XBK'|'XBL'|'XBM'|'XBN'|'XBO'|'XBP'|'XBQ'|'XBR'|'XBS'|'XBT'|'XBU'|'XBV'|'XBW'|'XBX'|'XBY'|'XBZ'|'XCA'|'XCB'|'XCC'|'XCD'|'XCE'|'XCF'|'XCG'|'XCH'|'XCI'|'XCJ'|'XCK'|'XCL'|'XCM'|'XCN'|'XCO'|'XCP'|'XCQ'|'XCR'|'XCS'|'XCT'|'XCU'|'XCV'|'XCW'|'XCX'|'XCY'|'XCZ'|'XDA'|'XDB'|'XDC'|'XDD'|'XDE'|'XDF'|'XDG'|'XDH'|'XDI'|'XDJ'|'XDK'|'XDL'|'XDM'|'XDN'|'XDP'|'XDQ'|'XDR'|'XDS'|'XDT'|'XDU'|'XDV'|'XDW'|'XDX'|'XDY'|'XDZ'|'XEA'|'XEB'|'XEC'|'XED'|'XEE'|'XEF'|'XEG'|'XEH'|'XEI'|'XEJ'|'XEK'|'XEL'|'XEM'|'XEN'|'XEP'|'XEQ'|'XER'|'XES'|'XET'|'XEU'|'XEV'|'XEW'|'XEX'|'XEY'|'XFB'|'XFC'|'XFD'|'XFE'|'XFF'|'XFG'|'XFH'|'XFI'|'XFJ'|'XFK'|'XFL'|'XFM'|'XFN'|'XFO'|'XFP'|'XFQ'|'XFR'|'XFS'|'XFT'|'XFU'|'XFV'|'XFW'|'XFX'|'XFY'|'XFZ'|'XGA'|'XGB'|'XGC'|'XGD'|'XGE'|'XGF'|'XGG'|'XGH'|'XGI'|'XGJ'|'XGK'|'XGL'|'XGM'|'XGN'|'XGO'|'XGP'|'XGQ'|'XGR'|'XGS'|'XGT'|'XGU'|'XGV'|'XGW'|'XGX'|'XGY'|'XGZ'|'XHA'|'XHB'|'XHC'|'XHD'|'XHE'|'XHF'|'XHG'|'XHH'|'XHI'|'XHJ'|'XHK'|'XHL'|'XHM'|'XHN'|'XHP'|'XHQ'|'XHR'|'XHS'|'XHT'|'XHU'|'XHV'|'XHW'|'XHX'|'XHY'|'XHZ'|'XIA'|'XIB'|'XIC'|'XID'|'XIE'|'XIF'|'XIG'|'XIH'|'XII'|'XIJ'|'XIK'|'XIL'|'XIM'|'XIN'|'XIO'|'XJA'|'XJB'|'XJC'|'XJD'|'XJE'|'XJF'|'XJG'|'XJH'|'XJI'|'XJJ'|'XJK'|'XJL'|'XJM'|'XJN'|'XJO'|'XJP'|'XJQ'|'XJR'|'XJS'|'XJT'|'XJU'|'XJV'|'XJW'|'XJX'|'XJY'|'XJZ'|'XLA'|'XLB'|'XLC'|'XLD'|'XLE'|'XLF'|'XLG'|'XLH'|'XLI'|'XLJ'|'XLK'|'XLL'|'XLM'|'XLN'|'XLO'|'XLP'|'XLQ'|'XLR'|'XLS'|'XLT'|'XLU'|'XLV'|'XLW'|'XLX'|'XLY'|'XLZ'|'XMA'|'XMB'|'XMC'|'XMD'|'XME'|'XMF'|'XMG'|'XMH'|'XMI'|'XMJ'|'XMK'|'XML'|'XMM'|'XMN'|'XMO'|'XMP'|'XMQ'|'XMR'|'XMS'|'XMT'|'XMU'|'XMV'|'XMW'|'XMX'|'XMY'|'XMZ'|'XNA'|'XNB'|'XNC'|'XND'|'XNE'|'XNF'|'XNG'|'XNH'|'XNI'|'XNJ'|'XNK'|'XNL'|'XNM'|'XOA'|'XOB'|'XOC'|'XOD'|'XOE'|'XOF'|'XOG'|'XOH'|'XOI'|'XOJ'|'XOK'|'XOL'|'XOM'|'XON'|'XOO'|'XOP'|'XOQ'|'XOR'|'XOS'|'XOT'|'XOU'|'XOV'|'XOW'|'XOX'|'XOY'|'XOZ'|'XP1'|'XP2'|'XP3'|'XP4'|'XPA'|'XPB'|'XPC'|'XPD'|'XPE'|'XPF'|'XPG'|'XPH'|'XPI'|'XPJ'|'XPK'|'XPL'|'XPM'|'XPN'|'XPO'|'XPP'|'XPQ'|'XPR'|'XPS'|'XPT'|'XPU'|'XPV'|'XPW'|'XPX'|'XPY'|'XPZ'|'XQA'|'XQB'|'XQC'|'XQD'|'XQE'|'XQF'|'XQG'|'XQH'|'XQI'|'XQJ'|'XQK'|'XQL'|'XQM'|'XQN'|'XQO'|'XQP'|'XQQ'|'XQR'|'XQS'|'XRD'|'XRE'|'XRF'|'XRG'|'XRH'|'XRI'|'XRJ'|'XRK'|'XRL'|'XRM'|'XRN'|'XRO'|'XRP'|'XRQ'|'XRR'|'XRS'|'XRT'|'XRU'|'XRV'|'XRW'|'XRX'|'XRY'|'XRZ'|'XSA'|'XSB'|'XSC'|'XSD'|'XSE'|'XSF'|'XSG'|'XSH'|'XSI'|'XSJ'|'XSK'|'XSL'|'XSM'|'XSN'|'XSO'|'XSP'|'XSQ'|'XSR'|'XSS'|'XST'|'XSU'|'XSV'|'XSW'|'XSX'|'XSY'|'XSZ'|'XTA'|'XTB'|'XTC'|'XTD'|'XTE'|'XTF'|'XTG'|'XTI'|'XTJ'|'XTK'|'XTL'|'XTM'|'XTN'|'XTO'|'XTR'|'XTS'|'XTT'|'XTU'|'XTV'|'XTW'|'XTX'|'XTY'|'XTZ'|'XUC'|'XUN'|'XVA'|'XVG'|'XVI'|'XVK'|'XVL'|'XVN'|'XVO'|'XVP'|'XVQ'|'XVR'|'XVS'|'XVY'|'XWA'|'XWB'|'XWC'|'XWD'|'XWF'|'XWG'|'XWH'|'XWJ'|'XWK'|'XWL'|'XWM'|'XWN'|'XWP'|'XWQ'|'XWR'|'XWS'|'XWT'|'XWU'|'XWV'|'XWW'|'XWX'|'XWY'|'XWZ'|'XXA'|'XXB'|'XXC'|'XXD'|'XXF'|'XXG'|'XXH'|'XXJ'|'XXK'|'XYA'|'XYB'|'XYC'|'XYD'|'XYF'|'XYG'|'XYH'|'XYJ'|'XYK'|'XYL'|'XYM'|'XYN'|'XYP'|'XYQ'|'XYR'|'XYS'|'XYT'|'XYV'|'XYW'|'XYX'|'XYY'|'XYZ'|'XZA'|'XZB'|'XZC'|'XZD'|'XZF'|'XZG'|'XZH'|'XZJ'|'XZK'|'XZL'|'XZM'|'XZN'|'XZP'|'XZQ'|'XZR'|'XZS'|'XZT'|'XZU'|'XZV'|'XZW'|'XZX'|'XZY'|'XZZ'|'ZZ'|'NAR'|'C62'|'LTR'|'H87'|UnitOfMeasureCode|null, + * unitPrice?: float|string|null, + * }> $items At least one line item is required + * @param string|null $note Additional notes or comments for the invoice + * @param list|null $paymentDetails + * @param string|null $paymentTerm The payment terms (e.g., 'Net 30', 'Due on receipt', '2/10 Net 30') + * @param float|string|null $previousUnpaidBalance The previous unpaid balance from prior invoices, if any. Must be positive and rounded to maximum 2 decimals + * @param string|null $purchaseOrder The purchase order reference number + * @param string|null $remittanceAddress The address where payment should be sent or remitted to + * @param string|null $remittanceAddressRecipient The recipient name at the remittance address + * @param string|null $serviceAddress The address where services were performed or goods were delivered + * @param string|null $serviceAddressRecipient The recipient name at the service address + * @param string|\DateTimeInterface|null $serviceEndDate The end date of the service period or delivery period + * @param string|\DateTimeInterface|null $serviceStartDate The start date of the service period or delivery period + * @param string|null $shippingAddress The shipping/delivery address + * @param string|null $shippingAddressRecipient The recipient name at the shipping address + * @param 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState $state The current state of the document: DRAFT, TRANSIT, FAILED, SENT, or RECEIVED + * @param float|string|null $subtotal The taxable base of the invoice. Should be the sum of all line items - allowances (for example commercial discounts) + charges with impact on VAT. Must be positive and rounded to maximum 2 decimals + * @param 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|\EInvoiceAPI\Documents\DocumentCreateParams\TaxCode $taxCode Tax category code of the invoice (e.g., S for standard rate, Z for zero rate, E for exempt) + * @param list|null $taxDetails + * @param float|string|null $totalDiscount The net financial discount/charge of the invoice (non-VAT charges minus non-VAT allowances). Can be positive (net charge), negative (net discount), or zero. Must be rounded to maximum 2 decimals + * @param float|string|null $totalTax The total tax amount of the invoice. Must be positive and rounded to maximum 2 decimals + * @param 'VATEX-EU-79-C'|'VATEX-EU-132'|'VATEX-EU-132-1A'|'VATEX-EU-132-1B'|'VATEX-EU-132-1C'|'VATEX-EU-132-1D'|'VATEX-EU-132-1E'|'VATEX-EU-132-1F'|'VATEX-EU-132-1G'|'VATEX-EU-132-1H'|'VATEX-EU-132-1I'|'VATEX-EU-132-1J'|'VATEX-EU-132-1K'|'VATEX-EU-132-1L'|'VATEX-EU-132-1M'|'VATEX-EU-132-1N'|'VATEX-EU-132-1O'|'VATEX-EU-132-1P'|'VATEX-EU-132-1Q'|'VATEX-EU-143'|'VATEX-EU-143-1A'|'VATEX-EU-143-1B'|'VATEX-EU-143-1C'|'VATEX-EU-143-1D'|'VATEX-EU-143-1E'|'VATEX-EU-143-1F'|'VATEX-EU-143-1FA'|'VATEX-EU-143-1G'|'VATEX-EU-143-1H'|'VATEX-EU-143-1I'|'VATEX-EU-143-1J'|'VATEX-EU-143-1K'|'VATEX-EU-143-1L'|'VATEX-EU-144'|'VATEX-EU-146-1E'|'VATEX-EU-148'|'VATEX-EU-148-A'|'VATEX-EU-148-B'|'VATEX-EU-148-C'|'VATEX-EU-148-D'|'VATEX-EU-148-E'|'VATEX-EU-148-F'|'VATEX-EU-148-G'|'VATEX-EU-151'|'VATEX-EU-151-1A'|'VATEX-EU-151-1AA'|'VATEX-EU-151-1B'|'VATEX-EU-151-1C'|'VATEX-EU-151-1D'|'VATEX-EU-151-1E'|'VATEX-EU-159'|'VATEX-EU-309'|'VATEX-EU-AE'|'VATEX-EU-D'|'VATEX-EU-F'|'VATEX-EU-G'|'VATEX-EU-I'|'VATEX-EU-IC'|'VATEX-EU-O'|'VATEX-EU-J'|'VATEX-FR-FRANCHISE'|'VATEX-FR-CNWVAT'|Vatex|null $vatex VATEX code list for VAT exemption reasons + * + * Agency: CEF + * Identifier: vatex + * @param string|null $vatexNote Textual explanation for VAT exemption + * @param string|null $vendorAddress The address of the vendor/seller + * @param string|null $vendorAddressRecipient The recipient name at the vendor address + * @param string|null $vendorCompanyID Vendor company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. + * @param string|null $vendorEmail The email address of the vendor + * @param string|null $vendorName The name of the vendor/seller/supplier + * @param string|null $vendorTaxID Vendor tax ID. For Belgium this is the VAT number. Must include the country prefix * * @throws APIException */ public function create( - array|DocumentCreateParams $params, - ?RequestOptions $requestOptions = null + ?array $allowances = null, + float|string|null $amountDue = null, + ?array $attachments = null, + ?string $billingAddress = null, + ?string $billingAddressRecipient = null, + ?array $charges = null, + string|CurrencyCode|null $currency = null, + ?string $customerAddress = null, + ?string $customerAddressRecipient = null, + ?string $customerCompanyID = null, + ?string $customerEmail = null, + ?string $customerID = null, + ?string $customerName = null, + ?string $customerTaxID = null, + string|DocumentDirection|null $direction = null, + string|DocumentType|null $documentType = null, + string|\DateTimeInterface|null $dueDate = null, + string|\DateTimeInterface|null $invoiceDate = null, + ?string $invoiceID = null, + float|string|null $invoiceTotal = null, + ?array $items = null, + ?string $note = null, + ?array $paymentDetails = null, + ?string $paymentTerm = null, + float|string|null $previousUnpaidBalance = null, + ?string $purchaseOrder = null, + ?string $remittanceAddress = null, + ?string $remittanceAddressRecipient = null, + ?string $serviceAddress = null, + ?string $serviceAddressRecipient = null, + string|\DateTimeInterface|null $serviceEndDate = null, + string|\DateTimeInterface|null $serviceStartDate = null, + ?string $shippingAddress = null, + ?string $shippingAddressRecipient = null, + string|DocumentState|null $state = null, + float|string|null $subtotal = null, + string|\EInvoiceAPI\Documents\DocumentCreateParams\TaxCode $taxCode = 'S', + ?array $taxDetails = null, + float|string|null $totalDiscount = null, + float|string|null $totalTax = null, + string|Vatex|null $vatex = null, + ?string $vatexNote = null, + ?string $vendorAddress = null, + ?string $vendorAddressRecipient = null, + ?string $vendorCompanyID = null, + ?string $vendorEmail = null, + ?string $vendorName = null, + ?string $vendorTaxID = null, + ?RequestOptions $requestOptions = null, ): DocumentResponse; /** @@ -51,25 +208,31 @@ public function delete( /** * @api * - * @param array|DocumentCreateFromPdfParams $params + * @param string $file Body param: + * @param string|null $customerTaxID Query param: + * @param string|null $vendorTaxID Query param: * * @throws APIException */ public function createFromPdf( - array|DocumentCreateFromPdfParams $params, + string $file, + ?string $customerTaxID = null, + ?string $vendorTaxID = null, ?RequestOptions $requestOptions = null, ): DocumentNewFromPdfResponse; /** * @api * - * @param array|DocumentSendParams $params - * * @throws APIException */ public function send( string $documentID, - array|DocumentSendParams $params, + ?string $email = null, + ?string $receiverPeppolID = null, + ?string $receiverPeppolScheme = null, + ?string $senderPeppolID = null, + ?string $senderPeppolScheme = null, ?RequestOptions $requestOptions = null, ): DocumentResponse; diff --git a/src/ServiceContracts/DocumentsRawContract.php b/src/ServiceContracts/DocumentsRawContract.php new file mode 100644 index 00000000..a4100a15 --- /dev/null +++ b/src/ServiceContracts/DocumentsRawContract.php @@ -0,0 +1,98 @@ +|DocumentCreateParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function create( + array|DocumentCreateParams $params, + ?RequestOptions $requestOptions = null + ): BaseResponse; + + /** + * @api + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieve( + string $documentID, + ?RequestOptions $requestOptions = null + ): BaseResponse; + + /** + * @api + * + * @return BaseResponse + * + * @throws APIException + */ + public function delete( + string $documentID, + ?RequestOptions $requestOptions = null + ): BaseResponse; + + /** + * @api + * + * @param array|DocumentCreateFromPdfParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function createFromPdf( + array|DocumentCreateFromPdfParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|DocumentSendParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function send( + string $documentID, + array|DocumentSendParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @return BaseResponse + * + * @throws APIException + */ + public function validate( + string $documentID, + ?RequestOptions $requestOptions = null + ): BaseResponse; +} diff --git a/src/ServiceContracts/InboxContract.php b/src/ServiceContracts/InboxContract.php index 28387e1c..e101269e 100644 --- a/src/ServiceContracts/InboxContract.php +++ b/src/ServiceContracts/InboxContract.php @@ -6,10 +6,9 @@ use EInvoiceAPI\Core\Exceptions\APIException; use EInvoiceAPI\Documents\DocumentResponse; +use EInvoiceAPI\Documents\DocumentType; use EInvoiceAPI\DocumentsNumberPage; -use EInvoiceAPI\Inbox\InboxListCreditNotesParams; -use EInvoiceAPI\Inbox\InboxListInvoicesParams; -use EInvoiceAPI\Inbox\InboxListParams; +use EInvoiceAPI\Inbox\DocumentState; use EInvoiceAPI\RequestOptions; interface InboxContract @@ -17,42 +16,60 @@ interface InboxContract /** * @api * - * @param array|InboxListParams $params + * @param string|\DateTimeInterface|null $dateFrom Filter by issue date (from) + * @param string|\DateTimeInterface|null $dateTo Filter by issue date (to) + * @param int $page Page number + * @param int $pageSize Number of items per page + * @param string|null $search Search in invoice number, seller/buyer names + * @param string|null $sender Filter by sender ID + * @param 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState|null $state Filter by document state + * @param 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType|null $type Filter by document type * * @return DocumentsNumberPage * * @throws APIException */ public function list( - array|InboxListParams $params, - ?RequestOptions $requestOptions = null + string|\DateTimeInterface|null $dateFrom = null, + string|\DateTimeInterface|null $dateTo = null, + int $page = 1, + int $pageSize = 20, + ?string $search = null, + ?string $sender = null, + string|DocumentState|null $state = null, + string|DocumentType|null $type = null, + ?RequestOptions $requestOptions = null, ): DocumentsNumberPage; /** * @api * - * @param array|InboxListCreditNotesParams $params + * @param int $page Page number + * @param int $pageSize Number of items per page * * @return DocumentsNumberPage * * @throws APIException */ public function listCreditNotes( - array|InboxListCreditNotesParams $params, - ?RequestOptions $requestOptions = null, + int $page = 1, + int $pageSize = 20, + ?RequestOptions $requestOptions = null ): DocumentsNumberPage; /** * @api * - * @param array|InboxListInvoicesParams $params + * @param int $page Page number + * @param int $pageSize Number of items per page * * @return DocumentsNumberPage * * @throws APIException */ public function listInvoices( - array|InboxListInvoicesParams $params, - ?RequestOptions $requestOptions = null, + int $page = 1, + int $pageSize = 20, + ?RequestOptions $requestOptions = null ): DocumentsNumberPage; } diff --git a/src/ServiceContracts/InboxRawContract.php b/src/ServiceContracts/InboxRawContract.php new file mode 100644 index 00000000..cd1328e4 --- /dev/null +++ b/src/ServiceContracts/InboxRawContract.php @@ -0,0 +1,59 @@ +|InboxListParams $params + * + * @return BaseResponse> + * + * @throws APIException + */ + public function list( + array|InboxListParams $params, + ?RequestOptions $requestOptions = null + ): BaseResponse; + + /** + * @api + * + * @param array|InboxListCreditNotesParams $params + * + * @return BaseResponse> + * + * @throws APIException + */ + public function listCreditNotes( + array|InboxListCreditNotesParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|InboxListInvoicesParams $params + * + * @return BaseResponse> + * + * @throws APIException + */ + public function listInvoices( + array|InboxListInvoicesParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse; +} diff --git a/src/ServiceContracts/LookupContract.php b/src/ServiceContracts/LookupContract.php index 16fbbda9..ece31c39 100644 --- a/src/ServiceContracts/LookupContract.php +++ b/src/ServiceContracts/LookupContract.php @@ -7,8 +7,6 @@ use EInvoiceAPI\Core\Exceptions\APIException; use EInvoiceAPI\Lookup\LookupGetParticipantsResponse; use EInvoiceAPI\Lookup\LookupGetResponse; -use EInvoiceAPI\Lookup\LookupRetrieveParams; -use EInvoiceAPI\Lookup\LookupRetrieveParticipantsParams; use EInvoiceAPI\RequestOptions; interface LookupContract @@ -16,24 +14,26 @@ interface LookupContract /** * @api * - * @param array|LookupRetrieveParams $params + * @param string $peppolID Peppol ID in the format `:`. Example: `0208:1018265814` for a Belgian company. * * @throws APIException */ public function retrieve( - array|LookupRetrieveParams $params, + string $peppolID, ?RequestOptions $requestOptions = null ): LookupGetResponse; /** * @api * - * @param array|LookupRetrieveParticipantsParams $params + * @param string $query Query to lookup + * @param string|null $countryCode Country code of the company to lookup. If not provided, the search will be global. * * @throws APIException */ public function retrieveParticipants( - array|LookupRetrieveParticipantsParams $params, + string $query, + ?string $countryCode = null, ?RequestOptions $requestOptions = null, ): LookupGetParticipantsResponse; } diff --git a/src/ServiceContracts/LookupRawContract.php b/src/ServiceContracts/LookupRawContract.php new file mode 100644 index 00000000..fd25beb9 --- /dev/null +++ b/src/ServiceContracts/LookupRawContract.php @@ -0,0 +1,44 @@ +|LookupRetrieveParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieve( + array|LookupRetrieveParams $params, + ?RequestOptions $requestOptions = null + ): BaseResponse; + + /** + * @api + * + * @param array|LookupRetrieveParticipantsParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveParticipants( + array|LookupRetrieveParticipantsParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse; +} diff --git a/src/ServiceContracts/MeRawContract.php b/src/ServiceContracts/MeRawContract.php new file mode 100644 index 00000000..4f60d42a --- /dev/null +++ b/src/ServiceContracts/MeRawContract.php @@ -0,0 +1,24 @@ + + * + * @throws APIException + */ + public function retrieve( + ?RequestOptions $requestOptions = null + ): BaseResponse; +} diff --git a/src/ServiceContracts/OutboxContract.php b/src/ServiceContracts/OutboxContract.php index d1465e02..c1819c8e 100644 --- a/src/ServiceContracts/OutboxContract.php +++ b/src/ServiceContracts/OutboxContract.php @@ -6,9 +6,9 @@ use EInvoiceAPI\Core\Exceptions\APIException; use EInvoiceAPI\Documents\DocumentResponse; +use EInvoiceAPI\Documents\DocumentType; use EInvoiceAPI\DocumentsNumberPage; -use EInvoiceAPI\Outbox\OutboxListDraftDocumentsParams; -use EInvoiceAPI\Outbox\OutboxListReceivedDocumentsParams; +use EInvoiceAPI\Inbox\DocumentState; use EInvoiceAPI\RequestOptions; interface OutboxContract @@ -16,28 +16,44 @@ interface OutboxContract /** * @api * - * @param array|OutboxListDraftDocumentsParams $params + * @param int $page Page number + * @param int $pageSize Number of items per page * * @return DocumentsNumberPage * * @throws APIException */ public function listDraftDocuments( - array|OutboxListDraftDocumentsParams $params, - ?RequestOptions $requestOptions = null, + int $page = 1, + int $pageSize = 20, + ?RequestOptions $requestOptions = null ): DocumentsNumberPage; /** * @api * - * @param array|OutboxListReceivedDocumentsParams $params + * @param string|\DateTimeInterface|null $dateFrom Filter by issue date (from) + * @param string|\DateTimeInterface|null $dateTo Filter by issue date (to) + * @param int $page Page number + * @param int $pageSize Number of items per page + * @param string|null $search Search in invoice number, seller/buyer names + * @param string|null $sender Filter by sender ID + * @param 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState|null $state Filter by document state + * @param 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType|null $type Filter by document type * * @return DocumentsNumberPage * * @throws APIException */ public function listReceivedDocuments( - array|OutboxListReceivedDocumentsParams $params, + string|\DateTimeInterface|null $dateFrom = null, + string|\DateTimeInterface|null $dateTo = null, + int $page = 1, + int $pageSize = 20, + ?string $search = null, + ?string $sender = null, + string|DocumentState|null $state = null, + string|DocumentType|null $type = null, ?RequestOptions $requestOptions = null, ): DocumentsNumberPage; } diff --git a/src/ServiceContracts/OutboxRawContract.php b/src/ServiceContracts/OutboxRawContract.php new file mode 100644 index 00000000..83bdcd94 --- /dev/null +++ b/src/ServiceContracts/OutboxRawContract.php @@ -0,0 +1,44 @@ +|OutboxListDraftDocumentsParams $params + * + * @return BaseResponse> + * + * @throws APIException + */ + public function listDraftDocuments( + array|OutboxListDraftDocumentsParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|OutboxListReceivedDocumentsParams $params + * + * @return BaseResponse> + * + * @throws APIException + */ + public function listReceivedDocuments( + array|OutboxListReceivedDocumentsParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse; +} diff --git a/src/ServiceContracts/ValidateContract.php b/src/ServiceContracts/ValidateContract.php index 63dcac33..eaa70a20 100644 --- a/src/ServiceContracts/ValidateContract.php +++ b/src/ServiceContracts/ValidateContract.php @@ -5,48 +5,203 @@ namespace EInvoiceAPI\ServiceContracts; use EInvoiceAPI\Core\Exceptions\APIException; +use EInvoiceAPI\Documents\CurrencyCode; +use EInvoiceAPI\Documents\DocumentAttachmentCreate; +use EInvoiceAPI\Documents\DocumentDirection; +use EInvoiceAPI\Documents\DocumentType; +use EInvoiceAPI\Documents\PaymentDetailCreate; +use EInvoiceAPI\Documents\UnitOfMeasureCode; +use EInvoiceAPI\Inbox\DocumentState; use EInvoiceAPI\RequestOptions; use EInvoiceAPI\Validate\UblDocumentValidation; -use EInvoiceAPI\Validate\ValidateValidateJsonParams; -use EInvoiceAPI\Validate\ValidateValidatePeppolIDParams; +use EInvoiceAPI\Validate\ValidateValidateJsonParams\Allowance\ReasonCode; +use EInvoiceAPI\Validate\ValidateValidateJsonParams\Allowance\TaxCode; +use EInvoiceAPI\Validate\ValidateValidateJsonParams\Vatex; use EInvoiceAPI\Validate\ValidateValidatePeppolIDResponse; -use EInvoiceAPI\Validate\ValidateValidateUblParams; interface ValidateContract { /** * @api * - * @param array|ValidateValidateJsonParams $params + * @param list|null $allowances + * @param float|string|null $amountDue The amount due for payment. Must be positive and rounded to maximum 2 decimals + * @param list|null $attachments + * @param string|null $billingAddress The billing address (if different from customer address) + * @param string|null $billingAddressRecipient The recipient name at the billing address + * @param list|null $charges + * @param 'EUR'|'USD'|'GBP'|'JPY'|'CHF'|'CAD'|'AUD'|'NZD'|'CNY'|'INR'|'SEK'|'NOK'|'DKK'|'SGD'|'HKD'|CurrencyCode $currency Currency of the invoice (ISO 4217 currency code) + * @param string|null $customerAddress The address of the customer/buyer + * @param string|null $customerAddressRecipient The recipient name at the customer address + * @param string|null $customerCompanyID Customer company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. + * @param string|null $customerEmail The email address of the customer + * @param string|null $customerID The unique identifier for the customer in your system + * @param string|null $customerName The company name of the customer/buyer + * @param string|null $customerTaxID Customer tax ID. For Belgium this is the VAT number. Must include the country prefix + * @param 'INBOUND'|'OUTBOUND'|DocumentDirection $direction The direction of the document: INBOUND (purchases) or OUTBOUND (sales) + * @param 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType $documentType The type of document: INVOICE, CREDIT_NOTE, or DEBIT_NOTE + * @param string|\DateTimeInterface|null $dueDate The date when payment is due + * @param string|\DateTimeInterface|null $invoiceDate The date when the invoice was issued + * @param string|null $invoiceID The unique invoice identifier/number + * @param float|string|null $invoiceTotal The total amount of the invoice including tax (invoice_total = subtotal + total_tax + total_discount). Must be positive and rounded to maximum 2 decimals + * @param list|null, + * amount?: float|string|null, + * charges?: list|null, + * date?: null|null, + * description?: string|null, + * productCode?: string|null, + * quantity?: float|string|null, + * tax?: float|string|null, + * taxRate?: float|string|null, + * unit?: '10'|'11'|'13'|'14'|'15'|'20'|'21'|'22'|'23'|'24'|'25'|'27'|'28'|'33'|'34'|'35'|'37'|'38'|'40'|'41'|'56'|'57'|'58'|'59'|'60'|'61'|'74'|'77'|'80'|'81'|'85'|'87'|'89'|'91'|'1I'|'EA'|'E01'|'E07'|'E09'|'E10'|'E12'|'E14'|'E17'|'E20'|'E23'|'E25'|'E27'|'E31'|'E34'|'E35'|'E36'|'E37'|'E38'|'E39'|'E40'|'E41'|'E42'|'E43'|'E44'|'E45'|'E46'|'E47'|'E48'|'E49'|'E50'|'E51'|'E52'|'E53'|'E54'|'E55'|'E56'|'E57'|'E58'|'E60'|'E62'|'E65'|'E66'|'E67'|'E69'|'E70'|'E71'|'E73'|'E75'|'E76'|'2A'|'2B'|'2C'|'2G'|'2H'|'2I'|'2J'|'2K'|'2L'|'2M'|'2N'|'2P'|'2Q'|'2R'|'2U'|'2X'|'2Y'|'2Z'|'3B'|'3C'|'4C'|'4G'|'4H'|'4K'|'4L'|'4M'|'4N'|'4O'|'4P'|'4Q'|'4R'|'4T'|'4U'|'4W'|'4X'|'5A'|'5B'|'5E'|'5J'|'A10'|'A11'|'A12'|'A13'|'A14'|'A15'|'A16'|'A17'|'A18'|'A19'|'A2'|'A20'|'A21'|'A22'|'A23'|'A24'|'A26'|'A27'|'A28'|'A29'|'A3'|'A30'|'A31'|'A32'|'A33'|'A34'|'A35'|'A36'|'A37'|'A38'|'A39'|'A4'|'A40'|'A41'|'A42'|'A43'|'A44'|'A45'|'A46'|'A47'|'A48'|'A49'|'A5'|'A50'|'A51'|'A52'|'A53'|'A54'|'A55'|'A56'|'A57'|'A58'|'A59'|'A6'|'A60'|'A61'|'A62'|'A63'|'A64'|'A65'|'A66'|'A67'|'A68'|'A69'|'A7'|'A70'|'A71'|'A72'|'A73'|'A74'|'A75'|'A76'|'A77'|'A78'|'A79'|'A8'|'A80'|'A81'|'A82'|'A83'|'A84'|'A85'|'A86'|'A87'|'A88'|'A89'|'A9'|'A90'|'A91'|'A92'|'A93'|'A94'|'A95'|'A96'|'A97'|'A98'|'A99'|'ACR'|'AH'|'AI'|'AK'|'AMH'|'AMT'|'ANN'|'B1'|'B11'|'B12'|'B13'|'B14'|'B15'|'B16'|'B17'|'B18'|'B19'|'B20'|'B21'|'B22'|'B23'|'B24'|'B25'|'B26'|'B27'|'B28'|'B29'|'B3'|'B30'|'B31'|'B32'|'B33'|'B34'|'B35'|'B36'|'B37'|'B38'|'B39'|'B4'|'B40'|'B41'|'B42'|'B43'|'B44'|'B45'|'B46'|'B47'|'B48'|'B49'|'B5'|'B50'|'B52'|'B53'|'B54'|'B55'|'B56'|'B57'|'B58'|'B59'|'B6'|'B60'|'B61'|'B62'|'B63'|'B64'|'B65'|'B66'|'B67'|'B68'|'B69'|'B7'|'B70'|'B71'|'B72'|'B73'|'B74'|'B75'|'B76'|'B77'|'B78'|'B79'|'B8'|'B80'|'B81'|'B82'|'B83'|'B84'|'B85'|'B86'|'B87'|'B88'|'B89'|'B9'|'B90'|'B91'|'B92'|'B93'|'B94'|'B95'|'B96'|'B97'|'B98'|'B99'|'BAR'|'BB'|'BFT'|'BHP'|'BIL'|'BLD'|'BLL'|'BUA'|'BUI'|'C0'|'C10'|'C11'|'C12'|'C13'|'C14'|'C15'|'C16'|'C17'|'C18'|'C19'|'C20'|'C21'|'C22'|'C23'|'C24'|'C25'|'C26'|'C27'|'C28'|'C29'|'C30'|'C31'|'C32'|'C33'|'C34'|'C35'|'C36'|'C37'|'C38'|'C39'|'C40'|'C41'|'C42'|'C43'|'C44'|'C45'|'C46'|'C47'|'C48'|'C49'|'C50'|'C51'|'C52'|'C53'|'C54'|'C55'|'C56'|'C57'|'C58'|'C59'|'C60'|'C61'|'C63'|'C64'|'C65'|'C66'|'C67'|'C68'|'C69'|'C70'|'C71'|'C72'|'C73'|'C74'|'C75'|'C76'|'C77'|'C78'|'C79'|'C80'|'C81'|'C82'|'C83'|'C84'|'C85'|'C86'|'C87'|'C88'|'C89'|'C90'|'C91'|'C92'|'C93'|'C94'|'C95'|'C96'|'C97'|'C98'|'C99'|'CDL'|'CEL'|'CHU'|'CIU'|'CLT'|'CMK'|'CMQ'|'CMT'|'CNP'|'CNT'|'COU'|'CTG'|'CTN'|'CUR'|'CWA'|'CWI'|'DAN'|'DAY'|'DB'|'DD'|'DG'|'DI'|'DLT'|'DMK'|'DMQ'|'DMT'|'DPC'|'DPT'|'DRA'|'DZN'|'DZP'|'FOT'|'GLL'|'GLI'|'GRM'|'GRO'|'HUR'|'HTZ'|'INH'|'KGM'|'KMT'|'MTR'|'SMI'|'MIN'|'MON'|'ONZ'|'LBR'|'QT'|'SEC'|'FTK'|'INK'|'MTK'|'YDK'|'TNE'|'VLT'|'WTT'|'YRD'|'FTQ'|'INQ'|'MTQ'|'YDQ'|'HAR'|'KLT'|'MLT'|'MMT'|'KMK'|'MMK'|'XAA'|'XAB'|'XAC'|'XAD'|'XAE'|'XAF'|'XAG'|'XAH'|'XAI'|'XAJ'|'XAL'|'XAM'|'XAP'|'XAT'|'XAV'|'XB4'|'XBA'|'XBB'|'XBC'|'XBD'|'XBE'|'XBF'|'XBG'|'XBH'|'XBI'|'XBJ'|'XBK'|'XBL'|'XBM'|'XBN'|'XBO'|'XBP'|'XBQ'|'XBR'|'XBS'|'XBT'|'XBU'|'XBV'|'XBW'|'XBX'|'XBY'|'XBZ'|'XCA'|'XCB'|'XCC'|'XCD'|'XCE'|'XCF'|'XCG'|'XCH'|'XCI'|'XCJ'|'XCK'|'XCL'|'XCM'|'XCN'|'XCO'|'XCP'|'XCQ'|'XCR'|'XCS'|'XCT'|'XCU'|'XCV'|'XCW'|'XCX'|'XCY'|'XCZ'|'XDA'|'XDB'|'XDC'|'XDD'|'XDE'|'XDF'|'XDG'|'XDH'|'XDI'|'XDJ'|'XDK'|'XDL'|'XDM'|'XDN'|'XDP'|'XDQ'|'XDR'|'XDS'|'XDT'|'XDU'|'XDV'|'XDW'|'XDX'|'XDY'|'XDZ'|'XEA'|'XEB'|'XEC'|'XED'|'XEE'|'XEF'|'XEG'|'XEH'|'XEI'|'XEJ'|'XEK'|'XEL'|'XEM'|'XEN'|'XEP'|'XEQ'|'XER'|'XES'|'XET'|'XEU'|'XEV'|'XEW'|'XEX'|'XEY'|'XFB'|'XFC'|'XFD'|'XFE'|'XFF'|'XFG'|'XFH'|'XFI'|'XFJ'|'XFK'|'XFL'|'XFM'|'XFN'|'XFO'|'XFP'|'XFQ'|'XFR'|'XFS'|'XFT'|'XFU'|'XFV'|'XFW'|'XFX'|'XFY'|'XFZ'|'XGA'|'XGB'|'XGC'|'XGD'|'XGE'|'XGF'|'XGG'|'XGH'|'XGI'|'XGJ'|'XGK'|'XGL'|'XGM'|'XGN'|'XGO'|'XGP'|'XGQ'|'XGR'|'XGS'|'XGT'|'XGU'|'XGV'|'XGW'|'XGX'|'XGY'|'XGZ'|'XHA'|'XHB'|'XHC'|'XHD'|'XHE'|'XHF'|'XHG'|'XHH'|'XHI'|'XHJ'|'XHK'|'XHL'|'XHM'|'XHN'|'XHP'|'XHQ'|'XHR'|'XHS'|'XHT'|'XHU'|'XHV'|'XHW'|'XHX'|'XHY'|'XHZ'|'XIA'|'XIB'|'XIC'|'XID'|'XIE'|'XIF'|'XIG'|'XIH'|'XII'|'XIJ'|'XIK'|'XIL'|'XIM'|'XIN'|'XIO'|'XJA'|'XJB'|'XJC'|'XJD'|'XJE'|'XJF'|'XJG'|'XJH'|'XJI'|'XJJ'|'XJK'|'XJL'|'XJM'|'XJN'|'XJO'|'XJP'|'XJQ'|'XJR'|'XJS'|'XJT'|'XJU'|'XJV'|'XJW'|'XJX'|'XJY'|'XJZ'|'XLA'|'XLB'|'XLC'|'XLD'|'XLE'|'XLF'|'XLG'|'XLH'|'XLI'|'XLJ'|'XLK'|'XLL'|'XLM'|'XLN'|'XLO'|'XLP'|'XLQ'|'XLR'|'XLS'|'XLT'|'XLU'|'XLV'|'XLW'|'XLX'|'XLY'|'XLZ'|'XMA'|'XMB'|'XMC'|'XMD'|'XME'|'XMF'|'XMG'|'XMH'|'XMI'|'XMJ'|'XMK'|'XML'|'XMM'|'XMN'|'XMO'|'XMP'|'XMQ'|'XMR'|'XMS'|'XMT'|'XMU'|'XMV'|'XMW'|'XMX'|'XMY'|'XMZ'|'XNA'|'XNB'|'XNC'|'XND'|'XNE'|'XNF'|'XNG'|'XNH'|'XNI'|'XNJ'|'XNK'|'XNL'|'XNM'|'XOA'|'XOB'|'XOC'|'XOD'|'XOE'|'XOF'|'XOG'|'XOH'|'XOI'|'XOJ'|'XOK'|'XOL'|'XOM'|'XON'|'XOO'|'XOP'|'XOQ'|'XOR'|'XOS'|'XOT'|'XOU'|'XOV'|'XOW'|'XOX'|'XOY'|'XOZ'|'XP1'|'XP2'|'XP3'|'XP4'|'XPA'|'XPB'|'XPC'|'XPD'|'XPE'|'XPF'|'XPG'|'XPH'|'XPI'|'XPJ'|'XPK'|'XPL'|'XPM'|'XPN'|'XPO'|'XPP'|'XPQ'|'XPR'|'XPS'|'XPT'|'XPU'|'XPV'|'XPW'|'XPX'|'XPY'|'XPZ'|'XQA'|'XQB'|'XQC'|'XQD'|'XQE'|'XQF'|'XQG'|'XQH'|'XQI'|'XQJ'|'XQK'|'XQL'|'XQM'|'XQN'|'XQO'|'XQP'|'XQQ'|'XQR'|'XQS'|'XRD'|'XRE'|'XRF'|'XRG'|'XRH'|'XRI'|'XRJ'|'XRK'|'XRL'|'XRM'|'XRN'|'XRO'|'XRP'|'XRQ'|'XRR'|'XRS'|'XRT'|'XRU'|'XRV'|'XRW'|'XRX'|'XRY'|'XRZ'|'XSA'|'XSB'|'XSC'|'XSD'|'XSE'|'XSF'|'XSG'|'XSH'|'XSI'|'XSJ'|'XSK'|'XSL'|'XSM'|'XSN'|'XSO'|'XSP'|'XSQ'|'XSR'|'XSS'|'XST'|'XSU'|'XSV'|'XSW'|'XSX'|'XSY'|'XSZ'|'XTA'|'XTB'|'XTC'|'XTD'|'XTE'|'XTF'|'XTG'|'XTI'|'XTJ'|'XTK'|'XTL'|'XTM'|'XTN'|'XTO'|'XTR'|'XTS'|'XTT'|'XTU'|'XTV'|'XTW'|'XTX'|'XTY'|'XTZ'|'XUC'|'XUN'|'XVA'|'XVG'|'XVI'|'XVK'|'XVL'|'XVN'|'XVO'|'XVP'|'XVQ'|'XVR'|'XVS'|'XVY'|'XWA'|'XWB'|'XWC'|'XWD'|'XWF'|'XWG'|'XWH'|'XWJ'|'XWK'|'XWL'|'XWM'|'XWN'|'XWP'|'XWQ'|'XWR'|'XWS'|'XWT'|'XWU'|'XWV'|'XWW'|'XWX'|'XWY'|'XWZ'|'XXA'|'XXB'|'XXC'|'XXD'|'XXF'|'XXG'|'XXH'|'XXJ'|'XXK'|'XYA'|'XYB'|'XYC'|'XYD'|'XYF'|'XYG'|'XYH'|'XYJ'|'XYK'|'XYL'|'XYM'|'XYN'|'XYP'|'XYQ'|'XYR'|'XYS'|'XYT'|'XYV'|'XYW'|'XYX'|'XYY'|'XYZ'|'XZA'|'XZB'|'XZC'|'XZD'|'XZF'|'XZG'|'XZH'|'XZJ'|'XZK'|'XZL'|'XZM'|'XZN'|'XZP'|'XZQ'|'XZR'|'XZS'|'XZT'|'XZU'|'XZV'|'XZW'|'XZX'|'XZY'|'XZZ'|'ZZ'|'NAR'|'C62'|'LTR'|'H87'|UnitOfMeasureCode|null, + * unitPrice?: float|string|null, + * }> $items At least one line item is required + * @param string|null $note Additional notes or comments for the invoice + * @param list|null $paymentDetails + * @param string|null $paymentTerm The payment terms (e.g., 'Net 30', 'Due on receipt', '2/10 Net 30') + * @param float|string|null $previousUnpaidBalance The previous unpaid balance from prior invoices, if any. Must be positive and rounded to maximum 2 decimals + * @param string|null $purchaseOrder The purchase order reference number + * @param string|null $remittanceAddress The address where payment should be sent or remitted to + * @param string|null $remittanceAddressRecipient The recipient name at the remittance address + * @param string|null $serviceAddress The address where services were performed or goods were delivered + * @param string|null $serviceAddressRecipient The recipient name at the service address + * @param string|\DateTimeInterface|null $serviceEndDate The end date of the service period or delivery period + * @param string|\DateTimeInterface|null $serviceStartDate The start date of the service period or delivery period + * @param string|null $shippingAddress The shipping/delivery address + * @param string|null $shippingAddressRecipient The recipient name at the shipping address + * @param 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState $state The current state of the document: DRAFT, TRANSIT, FAILED, SENT, or RECEIVED + * @param float|string|null $subtotal The taxable base of the invoice. Should be the sum of all line items - allowances (for example commercial discounts) + charges with impact on VAT. Must be positive and rounded to maximum 2 decimals + * @param 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|\EInvoiceAPI\Validate\ValidateValidateJsonParams\TaxCode $taxCode Tax category code of the invoice (e.g., S for standard rate, Z for zero rate, E for exempt) + * @param list|null $taxDetails + * @param float|string|null $totalDiscount The net financial discount/charge of the invoice (non-VAT charges minus non-VAT allowances). Can be positive (net charge), negative (net discount), or zero. Must be rounded to maximum 2 decimals + * @param float|string|null $totalTax The total tax amount of the invoice. Must be positive and rounded to maximum 2 decimals + * @param 'VATEX-EU-79-C'|'VATEX-EU-132'|'VATEX-EU-132-1A'|'VATEX-EU-132-1B'|'VATEX-EU-132-1C'|'VATEX-EU-132-1D'|'VATEX-EU-132-1E'|'VATEX-EU-132-1F'|'VATEX-EU-132-1G'|'VATEX-EU-132-1H'|'VATEX-EU-132-1I'|'VATEX-EU-132-1J'|'VATEX-EU-132-1K'|'VATEX-EU-132-1L'|'VATEX-EU-132-1M'|'VATEX-EU-132-1N'|'VATEX-EU-132-1O'|'VATEX-EU-132-1P'|'VATEX-EU-132-1Q'|'VATEX-EU-143'|'VATEX-EU-143-1A'|'VATEX-EU-143-1B'|'VATEX-EU-143-1C'|'VATEX-EU-143-1D'|'VATEX-EU-143-1E'|'VATEX-EU-143-1F'|'VATEX-EU-143-1FA'|'VATEX-EU-143-1G'|'VATEX-EU-143-1H'|'VATEX-EU-143-1I'|'VATEX-EU-143-1J'|'VATEX-EU-143-1K'|'VATEX-EU-143-1L'|'VATEX-EU-144'|'VATEX-EU-146-1E'|'VATEX-EU-148'|'VATEX-EU-148-A'|'VATEX-EU-148-B'|'VATEX-EU-148-C'|'VATEX-EU-148-D'|'VATEX-EU-148-E'|'VATEX-EU-148-F'|'VATEX-EU-148-G'|'VATEX-EU-151'|'VATEX-EU-151-1A'|'VATEX-EU-151-1AA'|'VATEX-EU-151-1B'|'VATEX-EU-151-1C'|'VATEX-EU-151-1D'|'VATEX-EU-151-1E'|'VATEX-EU-159'|'VATEX-EU-309'|'VATEX-EU-AE'|'VATEX-EU-D'|'VATEX-EU-F'|'VATEX-EU-G'|'VATEX-EU-I'|'VATEX-EU-IC'|'VATEX-EU-O'|'VATEX-EU-J'|'VATEX-FR-FRANCHISE'|'VATEX-FR-CNWVAT'|Vatex|null $vatex VATEX code list for VAT exemption reasons + * + * Agency: CEF + * Identifier: vatex + * @param string|null $vatexNote Textual explanation for VAT exemption + * @param string|null $vendorAddress The address of the vendor/seller + * @param string|null $vendorAddressRecipient The recipient name at the vendor address + * @param string|null $vendorCompanyID Vendor company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. + * @param string|null $vendorEmail The email address of the vendor + * @param string|null $vendorName The name of the vendor/seller/supplier + * @param string|null $vendorTaxID Vendor tax ID. For Belgium this is the VAT number. Must include the country prefix * * @throws APIException */ public function validateJson( - array|ValidateValidateJsonParams $params, + ?array $allowances = null, + float|string|null $amountDue = null, + ?array $attachments = null, + ?string $billingAddress = null, + ?string $billingAddressRecipient = null, + ?array $charges = null, + string|CurrencyCode|null $currency = null, + ?string $customerAddress = null, + ?string $customerAddressRecipient = null, + ?string $customerCompanyID = null, + ?string $customerEmail = null, + ?string $customerID = null, + ?string $customerName = null, + ?string $customerTaxID = null, + string|DocumentDirection|null $direction = null, + string|DocumentType|null $documentType = null, + string|\DateTimeInterface|null $dueDate = null, + string|\DateTimeInterface|null $invoiceDate = null, + ?string $invoiceID = null, + float|string|null $invoiceTotal = null, + ?array $items = null, + ?string $note = null, + ?array $paymentDetails = null, + ?string $paymentTerm = null, + float|string|null $previousUnpaidBalance = null, + ?string $purchaseOrder = null, + ?string $remittanceAddress = null, + ?string $remittanceAddressRecipient = null, + ?string $serviceAddress = null, + ?string $serviceAddressRecipient = null, + string|\DateTimeInterface|null $serviceEndDate = null, + string|\DateTimeInterface|null $serviceStartDate = null, + ?string $shippingAddress = null, + ?string $shippingAddressRecipient = null, + string|DocumentState|null $state = null, + float|string|null $subtotal = null, + string|\EInvoiceAPI\Validate\ValidateValidateJsonParams\TaxCode $taxCode = 'S', + ?array $taxDetails = null, + float|string|null $totalDiscount = null, + float|string|null $totalTax = null, + string|Vatex|null $vatex = null, + ?string $vatexNote = null, + ?string $vendorAddress = null, + ?string $vendorAddressRecipient = null, + ?string $vendorCompanyID = null, + ?string $vendorEmail = null, + ?string $vendorName = null, + ?string $vendorTaxID = null, ?RequestOptions $requestOptions = null, ): UblDocumentValidation; /** * @api * - * @param array|ValidateValidatePeppolIDParams $params + * @param string $peppolID Peppol ID in the format `:`. Example: `0208:1018265814` for a Belgian company. * * @throws APIException */ public function validatePeppolID( - array|ValidateValidatePeppolIDParams $params, - ?RequestOptions $requestOptions = null, + string $peppolID, + ?RequestOptions $requestOptions = null ): ValidateValidatePeppolIDResponse; /** * @api * - * @param array|ValidateValidateUblParams $params - * * @throws APIException */ public function validateUbl( - array|ValidateValidateUblParams $params, - ?RequestOptions $requestOptions = null, + string $file, + ?RequestOptions $requestOptions = null ): UblDocumentValidation; } diff --git a/src/ServiceContracts/ValidateRawContract.php b/src/ServiceContracts/ValidateRawContract.php new file mode 100644 index 00000000..1de061e6 --- /dev/null +++ b/src/ServiceContracts/ValidateRawContract.php @@ -0,0 +1,59 @@ +|ValidateValidateJsonParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function validateJson( + array|ValidateValidateJsonParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|ValidateValidatePeppolIDParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function validatePeppolID( + array|ValidateValidatePeppolIDParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|ValidateValidateUblParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function validateUbl( + array|ValidateValidateUblParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse; +} diff --git a/src/ServiceContracts/WebhooksContract.php b/src/ServiceContracts/WebhooksContract.php index 9af01e21..7e6c4db4 100644 --- a/src/ServiceContracts/WebhooksContract.php +++ b/src/ServiceContracts/WebhooksContract.php @@ -6,23 +6,23 @@ use EInvoiceAPI\Core\Exceptions\APIException; use EInvoiceAPI\RequestOptions; -use EInvoiceAPI\Webhooks\WebhookCreateParams; use EInvoiceAPI\Webhooks\WebhookDeleteResponse; use EInvoiceAPI\Webhooks\WebhookResponse; -use EInvoiceAPI\Webhooks\WebhookUpdateParams; interface WebhooksContract { /** * @api * - * @param array|WebhookCreateParams $params + * @param list $events * * @throws APIException */ public function create( - array|WebhookCreateParams $params, - ?RequestOptions $requestOptions = null + array $events, + string $url, + bool $enabled = true, + ?RequestOptions $requestOptions = null, ): WebhookResponse; /** @@ -38,13 +38,15 @@ public function retrieve( /** * @api * - * @param array|WebhookUpdateParams $params + * @param list|null $events * * @throws APIException */ public function update( string $webhookID, - array|WebhookUpdateParams $params, + ?bool $enabled = null, + ?array $events = null, + ?string $url = null, ?RequestOptions $requestOptions = null, ): WebhookResponse; diff --git a/src/ServiceContracts/WebhooksRawContract.php b/src/ServiceContracts/WebhooksRawContract.php new file mode 100644 index 00000000..cfe76fd0 --- /dev/null +++ b/src/ServiceContracts/WebhooksRawContract.php @@ -0,0 +1,78 @@ +|WebhookCreateParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function create( + array|WebhookCreateParams $params, + ?RequestOptions $requestOptions = null + ): BaseResponse; + + /** + * @api + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieve( + string $webhookID, + ?RequestOptions $requestOptions = null + ): BaseResponse; + + /** + * @api + * + * @param array|WebhookUpdateParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function update( + string $webhookID, + array|WebhookUpdateParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @return BaseResponse> + * + * @throws APIException + */ + public function list(?RequestOptions $requestOptions = null): BaseResponse; + + /** + * @api + * + * @return BaseResponse + * + * @throws APIException + */ + public function delete( + string $webhookID, + ?RequestOptions $requestOptions = null + ): BaseResponse; +} diff --git a/src/Services/Documents/AttachmentsRawService.php b/src/Services/Documents/AttachmentsRawService.php new file mode 100644 index 00000000..d018acaf --- /dev/null +++ b/src/Services/Documents/AttachmentsRawService.php @@ -0,0 +1,144 @@ + + * + * @throws APIException + */ + public function retrieve( + string $attachmentID, + array|AttachmentRetrieveParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = AttachmentRetrieveParams::parseRequest( + $params, + $requestOptions, + ); + $documentID = $parsed['documentID']; + unset($parsed['documentID']); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: ['api/documents/%1$s/attachments/%2$s', $documentID, $attachmentID], + options: $options, + convert: DocumentAttachment::class, + ); + } + + /** + * @api + * + * Get all attachments for an invoice or credit note + * + * @return BaseResponse> + * + * @throws APIException + */ + public function list( + string $documentID, + ?RequestOptions $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: ['api/documents/%1$s/attachments', $documentID], + options: $requestOptions, + convert: new ListOf(DocumentAttachment::class), + ); + } + + /** + * @api + * + * Delete an attachment from an invoice or credit note + * + * @param array{documentID: string}|AttachmentDeleteParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function delete( + string $attachmentID, + array|AttachmentDeleteParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = AttachmentDeleteParams::parseRequest( + $params, + $requestOptions, + ); + $documentID = $parsed['documentID']; + unset($parsed['documentID']); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'delete', + path: ['api/documents/%1$s/attachments/%2$s', $documentID, $attachmentID], + options: $options, + convert: AttachmentDeleteResponse::class, + ); + } + + /** + * @api + * + * Add a new attachment to an invoice or credit note + * + * @param array{file: string}|AttachmentAddParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function add( + string $documentID, + array|AttachmentAddParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = AttachmentAddParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: ['api/documents/%1$s/attachments', $documentID], + headers: ['Content-Type' => 'multipart/form-data'], + body: (object) $parsed, + options: $options, + convert: DocumentAttachment::class, + ); + } +} diff --git a/src/Services/Documents/AttachmentsService.php b/src/Services/Documents/AttachmentsService.php index b058a442..c64b9d9a 100644 --- a/src/Services/Documents/AttachmentsService.php +++ b/src/Services/Documents/AttachmentsService.php @@ -5,52 +5,43 @@ namespace EInvoiceAPI\Services\Documents; use EInvoiceAPI\Client; -use EInvoiceAPI\Core\Contracts\BaseResponse; -use EInvoiceAPI\Core\Conversion\ListOf; use EInvoiceAPI\Core\Exceptions\APIException; -use EInvoiceAPI\Documents\Attachments\AttachmentAddParams; -use EInvoiceAPI\Documents\Attachments\AttachmentDeleteParams; use EInvoiceAPI\Documents\Attachments\AttachmentDeleteResponse; -use EInvoiceAPI\Documents\Attachments\AttachmentRetrieveParams; use EInvoiceAPI\Documents\Attachments\DocumentAttachment; use EInvoiceAPI\RequestOptions; use EInvoiceAPI\ServiceContracts\Documents\AttachmentsContract; final class AttachmentsService implements AttachmentsContract { + /** + * @api + */ + public AttachmentsRawService $raw; + /** * @internal */ - public function __construct(private Client $client) {} + public function __construct(private Client $client) + { + $this->raw = new AttachmentsRawService($client); + } /** * @api * * Get attachment details with for an invoice or credit note with link to download file (signed URL, valid for 1 hour) * - * @param array{documentID: string}|AttachmentRetrieveParams $params - * * @throws APIException */ public function retrieve( string $attachmentID, - array|AttachmentRetrieveParams $params, + string $documentID, ?RequestOptions $requestOptions = null, ): DocumentAttachment { - [$parsed, $options] = AttachmentRetrieveParams::parseRequest( - $params, - $requestOptions, - ); - $documentID = $parsed['documentID']; - unset($parsed['documentID']); - - /** @var BaseResponse */ - $response = $this->client->request( - method: 'get', - path: ['api/documents/%1$s/attachments/%2$s', $documentID, $attachmentID], - options: $options, - convert: DocumentAttachment::class, - ); + $params = ['documentID' => $documentID]; + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieve($attachmentID, params: $params, requestOptions: $requestOptions); return $response->parse(); } @@ -68,13 +59,8 @@ public function list( string $documentID, ?RequestOptions $requestOptions = null ): array { - /** @var BaseResponse> */ - $response = $this->client->request( - method: 'get', - path: ['api/documents/%1$s/attachments', $documentID], - options: $requestOptions, - convert: new ListOf(DocumentAttachment::class), - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->list($documentID, requestOptions: $requestOptions); return $response->parse(); } @@ -84,29 +70,17 @@ public function list( * * Delete an attachment from an invoice or credit note * - * @param array{documentID: string}|AttachmentDeleteParams $params - * * @throws APIException */ public function delete( string $attachmentID, - array|AttachmentDeleteParams $params, + string $documentID, ?RequestOptions $requestOptions = null, ): AttachmentDeleteResponse { - [$parsed, $options] = AttachmentDeleteParams::parseRequest( - $params, - $requestOptions, - ); - $documentID = $parsed['documentID']; - unset($parsed['documentID']); - - /** @var BaseResponse */ - $response = $this->client->request( - method: 'delete', - path: ['api/documents/%1$s/attachments/%2$s', $documentID, $attachmentID], - options: $options, - convert: AttachmentDeleteResponse::class, - ); + $params = ['documentID' => $documentID]; + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->delete($attachmentID, params: $params, requestOptions: $requestOptions); return $response->parse(); } @@ -116,29 +90,17 @@ public function delete( * * Add a new attachment to an invoice or credit note * - * @param array{file: string}|AttachmentAddParams $params - * * @throws APIException */ public function add( string $documentID, - array|AttachmentAddParams $params, - ?RequestOptions $requestOptions = null, + string $file, + ?RequestOptions $requestOptions = null ): DocumentAttachment { - [$parsed, $options] = AttachmentAddParams::parseRequest( - $params, - $requestOptions, - ); - - /** @var BaseResponse */ - $response = $this->client->request( - method: 'post', - path: ['api/documents/%1$s/attachments', $documentID], - headers: ['Content-Type' => 'multipart/form-data'], - body: (object) $parsed, - options: $options, - convert: DocumentAttachment::class, - ); + $params = ['file' => $file]; + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->add($documentID, params: $params, requestOptions: $requestOptions); return $response->parse(); } diff --git a/src/Services/Documents/UblRawService.php b/src/Services/Documents/UblRawService.php new file mode 100644 index 00000000..b5a08860 --- /dev/null +++ b/src/Services/Documents/UblRawService.php @@ -0,0 +1,76 @@ + + * + * @throws APIException + */ + public function createFromUbl( + array|UblCreateFromUblParams $params, + ?RequestOptions $requestOptions = null + ): BaseResponse { + [$parsed, $options] = UblCreateFromUblParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'api/documents/ubl', + headers: ['Content-Type' => 'multipart/form-data'], + body: (object) $parsed, + options: $options, + convert: DocumentResponse::class, + ); + } + + /** + * @api + * + * Get the UBL for an invoice or credit note + * + * @return BaseResponse + * + * @throws APIException + */ + public function get( + string $documentID, + ?RequestOptions $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: ['api/documents/%1$s/ubl', $documentID], + options: $requestOptions, + convert: UblGetResponse::class, + ); + } +} diff --git a/src/Services/Documents/UblService.php b/src/Services/Documents/UblService.php index 6b6b3fa3..f5704a0e 100644 --- a/src/Services/Documents/UblService.php +++ b/src/Services/Documents/UblService.php @@ -5,48 +5,42 @@ namespace EInvoiceAPI\Services\Documents; use EInvoiceAPI\Client; -use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; use EInvoiceAPI\Documents\DocumentResponse; -use EInvoiceAPI\Documents\Ubl\UblCreateFromUblParams; use EInvoiceAPI\Documents\Ubl\UblGetResponse; use EInvoiceAPI\RequestOptions; use EInvoiceAPI\ServiceContracts\Documents\UblContract; final class UblService implements UblContract { + /** + * @api + */ + public UblRawService $raw; + /** * @internal */ - public function __construct(private Client $client) {} + public function __construct(private Client $client) + { + $this->raw = new UblRawService($client); + } /** * @api * * Create a new invoice or credit note from a UBL file * - * @param array{file: string}|UblCreateFromUblParams $params - * * @throws APIException */ public function createFromUbl( - array|UblCreateFromUblParams $params, + string $file, ?RequestOptions $requestOptions = null ): DocumentResponse { - [$parsed, $options] = UblCreateFromUblParams::parseRequest( - $params, - $requestOptions, - ); + $params = ['file' => $file]; - /** @var BaseResponse */ - $response = $this->client->request( - method: 'post', - path: 'api/documents/ubl', - headers: ['Content-Type' => 'multipart/form-data'], - body: (object) $parsed, - options: $options, - convert: DocumentResponse::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->createFromUbl(params: $params, requestOptions: $requestOptions); return $response->parse(); } @@ -62,13 +56,8 @@ public function get( string $documentID, ?RequestOptions $requestOptions = null ): UblGetResponse { - /** @var BaseResponse */ - $response = $this->client->request( - method: 'get', - path: ['api/documents/%1$s/ubl', $documentID], - options: $requestOptions, - convert: UblGetResponse::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->get($documentID, requestOptions: $requestOptions); return $response->parse(); } diff --git a/src/Services/DocumentsRawService.php b/src/Services/DocumentsRawService.php new file mode 100644 index 00000000..4bc1e845 --- /dev/null +++ b/src/Services/DocumentsRawService.php @@ -0,0 +1,303 @@ +|null, + * amountDue?: float|string|null, + * attachments?: list|null, + * billingAddress?: string|null, + * billingAddressRecipient?: string|null, + * charges?: list|null, + * currency?: value-of, + * customerAddress?: string|null, + * customerAddressRecipient?: string|null, + * customerCompanyID?: string|null, + * customerEmail?: string|null, + * customerID?: string|null, + * customerName?: string|null, + * customerTaxID?: string|null, + * direction?: 'INBOUND'|'OUTBOUND'|DocumentDirection, + * documentType?: 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType, + * dueDate?: string|\DateTimeInterface|null, + * invoiceDate?: string|\DateTimeInterface|null, + * invoiceID?: string|null, + * invoiceTotal?: float|string|null, + * items?: list>|null, + * amount?: float|string|null, + * charges?: list>|null, + * date?: null|null, + * description?: string|null, + * productCode?: string|null, + * quantity?: float|string|null, + * tax?: float|string|null, + * taxRate?: float|string|null, + * unit?: '10'|'11'|'13'|'14'|'15'|'20'|'21'|'22'|'23'|'24'|'25'|'27'|'28'|'33'|'34'|'35'|'37'|'38'|'40'|'41'|'56'|'57'|'58'|'59'|'60'|'61'|'74'|'77'|'80'|'81'|'85'|'87'|'89'|'91'|'1I'|'EA'|'E01'|'E07'|'E09'|'E10'|'E12'|'E14'|'E17'|'E20'|'E23'|'E25'|'E27'|'E31'|'E34'|'E35'|'E36'|'E37'|'E38'|'E39'|'E40'|'E41'|'E42'|'E43'|'E44'|'E45'|'E46'|'E47'|'E48'|'E49'|'E50'|'E51'|'E52'|'E53'|'E54'|'E55'|'E56'|'E57'|'E58'|'E60'|'E62'|'E65'|'E66'|'E67'|'E69'|'E70'|'E71'|'E73'|'E75'|'E76'|'2A'|'2B'|'2C'|'2G'|'2H'|'2I'|'2J'|'2K'|'2L'|'2M'|'2N'|'2P'|'2Q'|'2R'|'2U'|'2X'|'2Y'|'2Z'|'3B'|'3C'|'4C'|'4G'|'4H'|'4K'|'4L'|'4M'|'4N'|'4O'|'4P'|'4Q'|'4R'|'4T'|'4U'|'4W'|'4X'|'5A'|'5B'|'5E'|'5J'|'A10'|'A11'|'A12'|'A13'|'A14'|'A15'|'A16'|'A17'|'A18'|'A19'|'A2'|'A20'|'A21'|'A22'|'A23'|'A24'|'A26'|'A27'|'A28'|'A29'|'A3'|'A30'|'A31'|'A32'|'A33'|'A34'|'A35'|'A36'|'A37'|'A38'|'A39'|'A4'|'A40'|'A41'|'A42'|'A43'|'A44'|'A45'|'A46'|'A47'|'A48'|'A49'|'A5'|'A50'|'A51'|'A52'|'A53'|'A54'|'A55'|'A56'|'A57'|'A58'|'A59'|'A6'|'A60'|'A61'|'A62'|'A63'|'A64'|'A65'|'A66'|'A67'|'A68'|'A69'|'A7'|'A70'|'A71'|'A72'|'A73'|'A74'|'A75'|'A76'|'A77'|'A78'|'A79'|'A8'|'A80'|'A81'|'A82'|'A83'|'A84'|'A85'|'A86'|'A87'|'A88'|'A89'|'A9'|'A90'|'A91'|'A92'|'A93'|'A94'|'A95'|'A96'|'A97'|'A98'|'A99'|'ACR'|'AH'|'AI'|'AK'|'AMH'|'AMT'|'ANN'|'B1'|'B11'|'B12'|'B13'|'B14'|'B15'|'B16'|'B17'|'B18'|'B19'|'B20'|'B21'|'B22'|'B23'|'B24'|'B25'|'B26'|'B27'|'B28'|'B29'|'B3'|'B30'|'B31'|'B32'|'B33'|'B34'|'B35'|'B36'|'B37'|'B38'|'B39'|'B4'|'B40'|'B41'|'B42'|'B43'|'B44'|'B45'|'B46'|'B47'|'B48'|'B49'|'B5'|'B50'|'B52'|'B53'|'B54'|'B55'|'B56'|'B57'|'B58'|'B59'|'B6'|'B60'|'B61'|'B62'|'B63'|'B64'|'B65'|'B66'|'B67'|'B68'|'B69'|'B7'|'B70'|'B71'|'B72'|'B73'|'B74'|'B75'|'B76'|'B77'|'B78'|'B79'|'B8'|'B80'|'B81'|'B82'|'B83'|'B84'|'B85'|'B86'|'B87'|'B88'|'B89'|'B9'|'B90'|'B91'|'B92'|'B93'|'B94'|'B95'|'B96'|'B97'|'B98'|'B99'|'BAR'|'BB'|'BFT'|'BHP'|'BIL'|'BLD'|'BLL'|'BUA'|'BUI'|'C0'|'C10'|'C11'|'C12'|'C13'|'C14'|'C15'|'C16'|'C17'|'C18'|'C19'|'C20'|'C21'|'C22'|'C23'|'C24'|'C25'|'C26'|'C27'|'C28'|'C29'|'C30'|'C31'|'C32'|'C33'|'C34'|'C35'|'C36'|'C37'|'C38'|'C39'|'C40'|'C41'|'C42'|'C43'|'C44'|'C45'|'C46'|'C47'|'C48'|'C49'|'C50'|'C51'|'C52'|'C53'|'C54'|'C55'|'C56'|'C57'|'C58'|'C59'|'C60'|'C61'|'C63'|'C64'|'C65'|'C66'|'C67'|'C68'|'C69'|'C70'|'C71'|'C72'|'C73'|'C74'|'C75'|'C76'|'C77'|'C78'|'C79'|'C80'|'C81'|'C82'|'C83'|'C84'|'C85'|'C86'|'C87'|'C88'|'C89'|'C90'|'C91'|'C92'|'C93'|'C94'|'C95'|'C96'|'C97'|'C98'|'C99'|'CDL'|'CEL'|'CHU'|'CIU'|'CLT'|'CMK'|'CMQ'|'CMT'|'CNP'|'CNT'|'COU'|'CTG'|'CTN'|'CUR'|'CWA'|'CWI'|'DAN'|'DAY'|'DB'|'DD'|'DG'|'DI'|'DLT'|'DMK'|'DMQ'|'DMT'|'DPC'|'DPT'|'DRA'|'DZN'|'DZP'|'FOT'|'GLL'|'GLI'|'GRM'|'GRO'|'HUR'|'HTZ'|'INH'|'KGM'|'KMT'|'MTR'|'SMI'|'MIN'|'MON'|'ONZ'|'LBR'|'QT'|'SEC'|'FTK'|'INK'|'MTK'|'YDK'|'TNE'|'VLT'|'WTT'|'YRD'|'FTQ'|'INQ'|'MTQ'|'YDQ'|'HAR'|'KLT'|'MLT'|'MMT'|'KMK'|'MMK'|'XAA'|'XAB'|'XAC'|'XAD'|'XAE'|'XAF'|'XAG'|'XAH'|'XAI'|'XAJ'|'XAL'|'XAM'|'XAP'|'XAT'|'XAV'|'XB4'|'XBA'|'XBB'|'XBC'|'XBD'|'XBE'|'XBF'|'XBG'|'XBH'|'XBI'|'XBJ'|'XBK'|'XBL'|'XBM'|'XBN'|'XBO'|'XBP'|'XBQ'|'XBR'|'XBS'|'XBT'|'XBU'|'XBV'|'XBW'|'XBX'|'XBY'|'XBZ'|'XCA'|'XCB'|'XCC'|'XCD'|'XCE'|'XCF'|'XCG'|'XCH'|'XCI'|'XCJ'|'XCK'|'XCL'|'XCM'|'XCN'|'XCO'|'XCP'|'XCQ'|'XCR'|'XCS'|'XCT'|'XCU'|'XCV'|'XCW'|'XCX'|'XCY'|'XCZ'|'XDA'|'XDB'|'XDC'|'XDD'|'XDE'|'XDF'|'XDG'|'XDH'|'XDI'|'XDJ'|'XDK'|'XDL'|'XDM'|'XDN'|'XDP'|'XDQ'|'XDR'|'XDS'|'XDT'|'XDU'|'XDV'|'XDW'|'XDX'|'XDY'|'XDZ'|'XEA'|'XEB'|'XEC'|'XED'|'XEE'|'XEF'|'XEG'|'XEH'|'XEI'|'XEJ'|'XEK'|'XEL'|'XEM'|'XEN'|'XEP'|'XEQ'|'XER'|'XES'|'XET'|'XEU'|'XEV'|'XEW'|'XEX'|'XEY'|'XFB'|'XFC'|'XFD'|'XFE'|'XFF'|'XFG'|'XFH'|'XFI'|'XFJ'|'XFK'|'XFL'|'XFM'|'XFN'|'XFO'|'XFP'|'XFQ'|'XFR'|'XFS'|'XFT'|'XFU'|'XFV'|'XFW'|'XFX'|'XFY'|'XFZ'|'XGA'|'XGB'|'XGC'|'XGD'|'XGE'|'XGF'|'XGG'|'XGH'|'XGI'|'XGJ'|'XGK'|'XGL'|'XGM'|'XGN'|'XGO'|'XGP'|'XGQ'|'XGR'|'XGS'|'XGT'|'XGU'|'XGV'|'XGW'|'XGX'|'XGY'|'XGZ'|'XHA'|'XHB'|'XHC'|'XHD'|'XHE'|'XHF'|'XHG'|'XHH'|'XHI'|'XHJ'|'XHK'|'XHL'|'XHM'|'XHN'|'XHP'|'XHQ'|'XHR'|'XHS'|'XHT'|'XHU'|'XHV'|'XHW'|'XHX'|'XHY'|'XHZ'|'XIA'|'XIB'|'XIC'|'XID'|'XIE'|'XIF'|'XIG'|'XIH'|'XII'|'XIJ'|'XIK'|'XIL'|'XIM'|'XIN'|'XIO'|'XJA'|'XJB'|'XJC'|'XJD'|'XJE'|'XJF'|'XJG'|'XJH'|'XJI'|'XJJ'|'XJK'|'XJL'|'XJM'|'XJN'|'XJO'|'XJP'|'XJQ'|'XJR'|'XJS'|'XJT'|'XJU'|'XJV'|'XJW'|'XJX'|'XJY'|'XJZ'|'XLA'|'XLB'|'XLC'|'XLD'|'XLE'|'XLF'|'XLG'|'XLH'|'XLI'|'XLJ'|'XLK'|'XLL'|'XLM'|'XLN'|'XLO'|'XLP'|'XLQ'|'XLR'|'XLS'|'XLT'|'XLU'|'XLV'|'XLW'|'XLX'|'XLY'|'XLZ'|'XMA'|'XMB'|'XMC'|'XMD'|'XME'|'XMF'|'XMG'|'XMH'|'XMI'|'XMJ'|'XMK'|'XML'|'XMM'|'XMN'|'XMO'|'XMP'|'XMQ'|'XMR'|'XMS'|'XMT'|'XMU'|'XMV'|'XMW'|'XMX'|'XMY'|'XMZ'|'XNA'|'XNB'|'XNC'|'XND'|'XNE'|'XNF'|'XNG'|'XNH'|'XNI'|'XNJ'|'XNK'|'XNL'|'XNM'|'XOA'|'XOB'|'XOC'|'XOD'|'XOE'|'XOF'|'XOG'|'XOH'|'XOI'|'XOJ'|'XOK'|'XOL'|'XOM'|'XON'|'XOO'|'XOP'|'XOQ'|'XOR'|'XOS'|'XOT'|'XOU'|'XOV'|'XOW'|'XOX'|'XOY'|'XOZ'|'XP1'|'XP2'|'XP3'|'XP4'|'XPA'|'XPB'|'XPC'|'XPD'|'XPE'|'XPF'|'XPG'|'XPH'|'XPI'|'XPJ'|'XPK'|'XPL'|'XPM'|'XPN'|'XPO'|'XPP'|'XPQ'|'XPR'|'XPS'|'XPT'|'XPU'|'XPV'|'XPW'|'XPX'|'XPY'|'XPZ'|'XQA'|'XQB'|'XQC'|'XQD'|'XQE'|'XQF'|'XQG'|'XQH'|'XQI'|'XQJ'|'XQK'|'XQL'|'XQM'|'XQN'|'XQO'|'XQP'|'XQQ'|'XQR'|'XQS'|'XRD'|'XRE'|'XRF'|'XRG'|'XRH'|'XRI'|'XRJ'|'XRK'|'XRL'|'XRM'|'XRN'|'XRO'|'XRP'|'XRQ'|'XRR'|'XRS'|'XRT'|'XRU'|'XRV'|'XRW'|'XRX'|'XRY'|'XRZ'|'XSA'|'XSB'|'XSC'|'XSD'|'XSE'|'XSF'|'XSG'|'XSH'|'XSI'|'XSJ'|'XSK'|'XSL'|'XSM'|'XSN'|'XSO'|'XSP'|'XSQ'|'XSR'|'XSS'|'XST'|'XSU'|'XSV'|'XSW'|'XSX'|'XSY'|'XSZ'|'XTA'|'XTB'|'XTC'|'XTD'|'XTE'|'XTF'|'XTG'|'XTI'|'XTJ'|'XTK'|'XTL'|'XTM'|'XTN'|'XTO'|'XTR'|'XTS'|'XTT'|'XTU'|'XTV'|'XTW'|'XTX'|'XTY'|'XTZ'|'XUC'|'XUN'|'XVA'|'XVG'|'XVI'|'XVK'|'XVL'|'XVN'|'XVO'|'XVP'|'XVQ'|'XVR'|'XVS'|'XVY'|'XWA'|'XWB'|'XWC'|'XWD'|'XWF'|'XWG'|'XWH'|'XWJ'|'XWK'|'XWL'|'XWM'|'XWN'|'XWP'|'XWQ'|'XWR'|'XWS'|'XWT'|'XWU'|'XWV'|'XWW'|'XWX'|'XWY'|'XWZ'|'XXA'|'XXB'|'XXC'|'XXD'|'XXF'|'XXG'|'XXH'|'XXJ'|'XXK'|'XYA'|'XYB'|'XYC'|'XYD'|'XYF'|'XYG'|'XYH'|'XYJ'|'XYK'|'XYL'|'XYM'|'XYN'|'XYP'|'XYQ'|'XYR'|'XYS'|'XYT'|'XYV'|'XYW'|'XYX'|'XYY'|'XYZ'|'XZA'|'XZB'|'XZC'|'XZD'|'XZF'|'XZG'|'XZH'|'XZJ'|'XZK'|'XZL'|'XZM'|'XZN'|'XZP'|'XZQ'|'XZR'|'XZS'|'XZT'|'XZU'|'XZV'|'XZW'|'XZX'|'XZY'|'XZZ'|'ZZ'|'NAR'|'C62'|'LTR'|'H87'|UnitOfMeasureCode|null, + * unitPrice?: float|string|null, + * }>, + * note?: string|null, + * paymentDetails?: list|null, + * paymentTerm?: string|null, + * previousUnpaidBalance?: float|string|null, + * purchaseOrder?: string|null, + * remittanceAddress?: string|null, + * remittanceAddressRecipient?: string|null, + * serviceAddress?: string|null, + * serviceAddressRecipient?: string|null, + * serviceEndDate?: string|\DateTimeInterface|null, + * serviceStartDate?: string|\DateTimeInterface|null, + * shippingAddress?: string|null, + * shippingAddressRecipient?: string|null, + * state?: 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState, + * subtotal?: float|string|null, + * taxCode?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|DocumentCreateParams\TaxCode, + * taxDetails?: list|null, + * totalDiscount?: float|string|null, + * totalTax?: float|string|null, + * vatex?: value-of, + * vatexNote?: string|null, + * vendorAddress?: string|null, + * vendorAddressRecipient?: string|null, + * vendorCompanyID?: string|null, + * vendorEmail?: string|null, + * vendorName?: string|null, + * vendorTaxID?: string|null, + * }|DocumentCreateParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function create( + array|DocumentCreateParams $params, + ?RequestOptions $requestOptions = null + ): BaseResponse { + [$parsed, $options] = DocumentCreateParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'api/documents/', + body: (object) $parsed, + options: $options, + convert: DocumentResponse::class, + ); + } + + /** + * @api + * + * Get an invoice or credit note by ID + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieve( + string $documentID, + ?RequestOptions $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: ['api/documents/%1$s', $documentID], + options: $requestOptions, + convert: DocumentResponse::class, + ); + } + + /** + * @api + * + * Delete an invoice or credit note + * + * @return BaseResponse + * + * @throws APIException + */ + public function delete( + string $documentID, + ?RequestOptions $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'delete', + path: ['api/documents/%1$s', $documentID], + options: $requestOptions, + convert: DocumentDeleteResponse::class, + ); + } + + /** + * @api + * + * Create a new invoice or credit note from a PDF file. If the 'ubl_document' field is set in the response, it indicates that sufficient details were extracted from the PDF to automatically generate a valid UBL document ready for sending. If 'ubl_document' is not set, human intervention may be required to ensure compliance. + * + * @param array{ + * file: string, customerTaxID?: string|null, vendorTaxID?: string|null + * }|DocumentCreateFromPdfParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function createFromPdf( + array|DocumentCreateFromPdfParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = DocumentCreateFromPdfParams::parseRequest( + $params, + $requestOptions, + ); + $query_params = array_flip(['customer_tax_id', 'vendor_tax_id']); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'api/documents/pdf', + query: Util::array_transform_keys( + array_diff_key($parsed, $query_params), + [ + 'customerTaxID' => 'customer_tax_id', 'vendorTaxID' => 'vendor_tax_id', + ], + ), + headers: ['Content-Type' => 'multipart/form-data'], + body: (object) array_diff_key($parsed, $query_params), + options: $options, + convert: DocumentNewFromPdfResponse::class, + ); + } + + /** + * @api + * + * Send an invoice or credit note via Peppol + * + * @param array{ + * email?: string|null, + * receiverPeppolID?: string|null, + * receiverPeppolScheme?: string|null, + * senderPeppolID?: string|null, + * senderPeppolScheme?: string|null, + * }|DocumentSendParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function send( + string $documentID, + array|DocumentSendParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = DocumentSendParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: ['api/documents/%1$s/send', $documentID], + query: Util::array_transform_keys( + $parsed, + [ + 'receiverPeppolID' => 'receiver_peppol_id', + 'receiverPeppolScheme' => 'receiver_peppol_scheme', + 'senderPeppolID' => 'sender_peppol_id', + 'senderPeppolScheme' => 'sender_peppol_scheme', + ], + ), + options: $options, + convert: DocumentResponse::class, + ); + } + + /** + * @api + * + * Validate a UBL document according to Peppol BIS Billing 3.0 + * + * @return BaseResponse + * + * @throws APIException + */ + public function validate( + string $documentID, + ?RequestOptions $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: ['api/documents/%1$s/validate', $documentID], + options: $requestOptions, + convert: UblDocumentValidation::class, + ); + } +} diff --git a/src/Services/DocumentsService.php b/src/Services/DocumentsService.php index 4ec9dc87..b4379343 100644 --- a/src/Services/DocumentsService.php +++ b/src/Services/DocumentsService.php @@ -5,13 +5,9 @@ namespace EInvoiceAPI\Services; use EInvoiceAPI\Client; -use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; -use EInvoiceAPI\Core\Util; use EInvoiceAPI\Documents\CurrencyCode; use EInvoiceAPI\Documents\DocumentAttachmentCreate; -use EInvoiceAPI\Documents\DocumentCreateFromPdfParams; -use EInvoiceAPI\Documents\DocumentCreateParams; use EInvoiceAPI\Documents\DocumentCreateParams\Allowance\ReasonCode; use EInvoiceAPI\Documents\DocumentCreateParams\Allowance\TaxCode; use EInvoiceAPI\Documents\DocumentCreateParams\Vatex; @@ -19,7 +15,6 @@ use EInvoiceAPI\Documents\DocumentDirection; use EInvoiceAPI\Documents\DocumentNewFromPdfResponse; use EInvoiceAPI\Documents\DocumentResponse; -use EInvoiceAPI\Documents\DocumentSendParams; use EInvoiceAPI\Documents\DocumentType; use EInvoiceAPI\Documents\PaymentDetailCreate; use EInvoiceAPI\Documents\UnitOfMeasureCode; @@ -32,6 +27,11 @@ final class DocumentsService implements DocumentsContract { + /** + * @api + */ + public DocumentsRawService $raw; + /** * @api */ @@ -47,6 +47,7 @@ final class DocumentsService implements DocumentsContract */ public function __construct(private Client $client) { + $this->raw = new DocumentsRawService($client); $this->attachments = new AttachmentsService($client); $this->ubl = new UblService($client); } @@ -56,111 +57,219 @@ public function __construct(private Client $client) * * Create a new invoice or credit note * - * @param array{ + * @param list|null $allowances + * @param float|string|null $amountDue The amount due for payment. Must be positive and rounded to maximum 2 decimals + * @param list|null $attachments + * @param string|null $billingAddress The billing address (if different from customer address) + * @param string|null $billingAddressRecipient The recipient name at the billing address + * @param list|null $charges + * @param 'EUR'|'USD'|'GBP'|'JPY'|'CHF'|'CAD'|'AUD'|'NZD'|'CNY'|'INR'|'SEK'|'NOK'|'DKK'|'SGD'|'HKD'|CurrencyCode $currency Currency of the invoice (ISO 4217 currency code) + * @param string|null $customerAddress The address of the customer/buyer + * @param string|null $customerAddressRecipient The recipient name at the customer address + * @param string|null $customerCompanyID Customer company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. + * @param string|null $customerEmail The email address of the customer + * @param string|null $customerID The unique identifier for the customer in your system + * @param string|null $customerName The company name of the customer/buyer + * @param string|null $customerTaxID Customer tax ID. For Belgium this is the VAT number. Must include the country prefix + * @param 'INBOUND'|'OUTBOUND'|DocumentDirection $direction The direction of the document: INBOUND (purchases) or OUTBOUND (sales) + * @param 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType $documentType The type of document: INVOICE, CREDIT_NOTE, or DEBIT_NOTE + * @param string|\DateTimeInterface|null $dueDate The date when payment is due + * @param string|\DateTimeInterface|null $invoiceDate The date when the invoice was issued + * @param string|null $invoiceID The unique invoice identifier/number + * @param float|string|null $invoiceTotal The total amount of the invoice including tax (invoice_total = subtotal + total_tax + total_discount). Must be positive and rounded to maximum 2 decimals + * @param list|null, - * amountDue?: float|string|null, - * attachments?: list|null, - * billingAddress?: string|null, - * billingAddressRecipient?: string|null, + * amount?: float|string|null, * charges?: list|null, - * currency?: value-of, - * customerAddress?: string|null, - * customerAddressRecipient?: string|null, - * customerCompanyID?: string|null, - * customerEmail?: string|null, - * customerID?: string|null, - * customerName?: string|null, - * customerTaxID?: string|null, - * direction?: 'INBOUND'|'OUTBOUND'|DocumentDirection, - * documentType?: 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType, - * dueDate?: string|\DateTimeInterface|null, - * invoiceDate?: string|\DateTimeInterface|null, - * invoiceID?: string|null, - * invoiceTotal?: float|string|null, - * items?: list>|null, - * amount?: float|string|null, - * charges?: list>|null, - * date?: null|null, - * description?: string|null, - * productCode?: string|null, - * quantity?: float|string|null, - * tax?: float|string|null, - * taxRate?: float|string|null, - * unit?: '10'|'11'|'13'|'14'|'15'|'20'|'21'|'22'|'23'|'24'|'25'|'27'|'28'|'33'|'34'|'35'|'37'|'38'|'40'|'41'|'56'|'57'|'58'|'59'|'60'|'61'|'74'|'77'|'80'|'81'|'85'|'87'|'89'|'91'|'1I'|'EA'|'E01'|'E07'|'E09'|'E10'|'E12'|'E14'|'E17'|'E20'|'E23'|'E25'|'E27'|'E31'|'E34'|'E35'|'E36'|'E37'|'E38'|'E39'|'E40'|'E41'|'E42'|'E43'|'E44'|'E45'|'E46'|'E47'|'E48'|'E49'|'E50'|'E51'|'E52'|'E53'|'E54'|'E55'|'E56'|'E57'|'E58'|'E60'|'E62'|'E65'|'E66'|'E67'|'E69'|'E70'|'E71'|'E73'|'E75'|'E76'|'2A'|'2B'|'2C'|'2G'|'2H'|'2I'|'2J'|'2K'|'2L'|'2M'|'2N'|'2P'|'2Q'|'2R'|'2U'|'2X'|'2Y'|'2Z'|'3B'|'3C'|'4C'|'4G'|'4H'|'4K'|'4L'|'4M'|'4N'|'4O'|'4P'|'4Q'|'4R'|'4T'|'4U'|'4W'|'4X'|'5A'|'5B'|'5E'|'5J'|'A10'|'A11'|'A12'|'A13'|'A14'|'A15'|'A16'|'A17'|'A18'|'A19'|'A2'|'A20'|'A21'|'A22'|'A23'|'A24'|'A26'|'A27'|'A28'|'A29'|'A3'|'A30'|'A31'|'A32'|'A33'|'A34'|'A35'|'A36'|'A37'|'A38'|'A39'|'A4'|'A40'|'A41'|'A42'|'A43'|'A44'|'A45'|'A46'|'A47'|'A48'|'A49'|'A5'|'A50'|'A51'|'A52'|'A53'|'A54'|'A55'|'A56'|'A57'|'A58'|'A59'|'A6'|'A60'|'A61'|'A62'|'A63'|'A64'|'A65'|'A66'|'A67'|'A68'|'A69'|'A7'|'A70'|'A71'|'A72'|'A73'|'A74'|'A75'|'A76'|'A77'|'A78'|'A79'|'A8'|'A80'|'A81'|'A82'|'A83'|'A84'|'A85'|'A86'|'A87'|'A88'|'A89'|'A9'|'A90'|'A91'|'A92'|'A93'|'A94'|'A95'|'A96'|'A97'|'A98'|'A99'|'ACR'|'AH'|'AI'|'AK'|'AMH'|'AMT'|'ANN'|'B1'|'B11'|'B12'|'B13'|'B14'|'B15'|'B16'|'B17'|'B18'|'B19'|'B20'|'B21'|'B22'|'B23'|'B24'|'B25'|'B26'|'B27'|'B28'|'B29'|'B3'|'B30'|'B31'|'B32'|'B33'|'B34'|'B35'|'B36'|'B37'|'B38'|'B39'|'B4'|'B40'|'B41'|'B42'|'B43'|'B44'|'B45'|'B46'|'B47'|'B48'|'B49'|'B5'|'B50'|'B52'|'B53'|'B54'|'B55'|'B56'|'B57'|'B58'|'B59'|'B6'|'B60'|'B61'|'B62'|'B63'|'B64'|'B65'|'B66'|'B67'|'B68'|'B69'|'B7'|'B70'|'B71'|'B72'|'B73'|'B74'|'B75'|'B76'|'B77'|'B78'|'B79'|'B8'|'B80'|'B81'|'B82'|'B83'|'B84'|'B85'|'B86'|'B87'|'B88'|'B89'|'B9'|'B90'|'B91'|'B92'|'B93'|'B94'|'B95'|'B96'|'B97'|'B98'|'B99'|'BAR'|'BB'|'BFT'|'BHP'|'BIL'|'BLD'|'BLL'|'BUA'|'BUI'|'C0'|'C10'|'C11'|'C12'|'C13'|'C14'|'C15'|'C16'|'C17'|'C18'|'C19'|'C20'|'C21'|'C22'|'C23'|'C24'|'C25'|'C26'|'C27'|'C28'|'C29'|'C30'|'C31'|'C32'|'C33'|'C34'|'C35'|'C36'|'C37'|'C38'|'C39'|'C40'|'C41'|'C42'|'C43'|'C44'|'C45'|'C46'|'C47'|'C48'|'C49'|'C50'|'C51'|'C52'|'C53'|'C54'|'C55'|'C56'|'C57'|'C58'|'C59'|'C60'|'C61'|'C63'|'C64'|'C65'|'C66'|'C67'|'C68'|'C69'|'C70'|'C71'|'C72'|'C73'|'C74'|'C75'|'C76'|'C77'|'C78'|'C79'|'C80'|'C81'|'C82'|'C83'|'C84'|'C85'|'C86'|'C87'|'C88'|'C89'|'C90'|'C91'|'C92'|'C93'|'C94'|'C95'|'C96'|'C97'|'C98'|'C99'|'CDL'|'CEL'|'CHU'|'CIU'|'CLT'|'CMK'|'CMQ'|'CMT'|'CNP'|'CNT'|'COU'|'CTG'|'CTN'|'CUR'|'CWA'|'CWI'|'DAN'|'DAY'|'DB'|'DD'|'DG'|'DI'|'DLT'|'DMK'|'DMQ'|'DMT'|'DPC'|'DPT'|'DRA'|'DZN'|'DZP'|'FOT'|'GLL'|'GLI'|'GRM'|'GRO'|'HUR'|'HTZ'|'INH'|'KGM'|'KMT'|'MTR'|'SMI'|'MIN'|'MON'|'ONZ'|'LBR'|'QT'|'SEC'|'FTK'|'INK'|'MTK'|'YDK'|'TNE'|'VLT'|'WTT'|'YRD'|'FTQ'|'INQ'|'MTQ'|'YDQ'|'HAR'|'KLT'|'MLT'|'MMT'|'KMK'|'MMK'|'XAA'|'XAB'|'XAC'|'XAD'|'XAE'|'XAF'|'XAG'|'XAH'|'XAI'|'XAJ'|'XAL'|'XAM'|'XAP'|'XAT'|'XAV'|'XB4'|'XBA'|'XBB'|'XBC'|'XBD'|'XBE'|'XBF'|'XBG'|'XBH'|'XBI'|'XBJ'|'XBK'|'XBL'|'XBM'|'XBN'|'XBO'|'XBP'|'XBQ'|'XBR'|'XBS'|'XBT'|'XBU'|'XBV'|'XBW'|'XBX'|'XBY'|'XBZ'|'XCA'|'XCB'|'XCC'|'XCD'|'XCE'|'XCF'|'XCG'|'XCH'|'XCI'|'XCJ'|'XCK'|'XCL'|'XCM'|'XCN'|'XCO'|'XCP'|'XCQ'|'XCR'|'XCS'|'XCT'|'XCU'|'XCV'|'XCW'|'XCX'|'XCY'|'XCZ'|'XDA'|'XDB'|'XDC'|'XDD'|'XDE'|'XDF'|'XDG'|'XDH'|'XDI'|'XDJ'|'XDK'|'XDL'|'XDM'|'XDN'|'XDP'|'XDQ'|'XDR'|'XDS'|'XDT'|'XDU'|'XDV'|'XDW'|'XDX'|'XDY'|'XDZ'|'XEA'|'XEB'|'XEC'|'XED'|'XEE'|'XEF'|'XEG'|'XEH'|'XEI'|'XEJ'|'XEK'|'XEL'|'XEM'|'XEN'|'XEP'|'XEQ'|'XER'|'XES'|'XET'|'XEU'|'XEV'|'XEW'|'XEX'|'XEY'|'XFB'|'XFC'|'XFD'|'XFE'|'XFF'|'XFG'|'XFH'|'XFI'|'XFJ'|'XFK'|'XFL'|'XFM'|'XFN'|'XFO'|'XFP'|'XFQ'|'XFR'|'XFS'|'XFT'|'XFU'|'XFV'|'XFW'|'XFX'|'XFY'|'XFZ'|'XGA'|'XGB'|'XGC'|'XGD'|'XGE'|'XGF'|'XGG'|'XGH'|'XGI'|'XGJ'|'XGK'|'XGL'|'XGM'|'XGN'|'XGO'|'XGP'|'XGQ'|'XGR'|'XGS'|'XGT'|'XGU'|'XGV'|'XGW'|'XGX'|'XGY'|'XGZ'|'XHA'|'XHB'|'XHC'|'XHD'|'XHE'|'XHF'|'XHG'|'XHH'|'XHI'|'XHJ'|'XHK'|'XHL'|'XHM'|'XHN'|'XHP'|'XHQ'|'XHR'|'XHS'|'XHT'|'XHU'|'XHV'|'XHW'|'XHX'|'XHY'|'XHZ'|'XIA'|'XIB'|'XIC'|'XID'|'XIE'|'XIF'|'XIG'|'XIH'|'XII'|'XIJ'|'XIK'|'XIL'|'XIM'|'XIN'|'XIO'|'XJA'|'XJB'|'XJC'|'XJD'|'XJE'|'XJF'|'XJG'|'XJH'|'XJI'|'XJJ'|'XJK'|'XJL'|'XJM'|'XJN'|'XJO'|'XJP'|'XJQ'|'XJR'|'XJS'|'XJT'|'XJU'|'XJV'|'XJW'|'XJX'|'XJY'|'XJZ'|'XLA'|'XLB'|'XLC'|'XLD'|'XLE'|'XLF'|'XLG'|'XLH'|'XLI'|'XLJ'|'XLK'|'XLL'|'XLM'|'XLN'|'XLO'|'XLP'|'XLQ'|'XLR'|'XLS'|'XLT'|'XLU'|'XLV'|'XLW'|'XLX'|'XLY'|'XLZ'|'XMA'|'XMB'|'XMC'|'XMD'|'XME'|'XMF'|'XMG'|'XMH'|'XMI'|'XMJ'|'XMK'|'XML'|'XMM'|'XMN'|'XMO'|'XMP'|'XMQ'|'XMR'|'XMS'|'XMT'|'XMU'|'XMV'|'XMW'|'XMX'|'XMY'|'XMZ'|'XNA'|'XNB'|'XNC'|'XND'|'XNE'|'XNF'|'XNG'|'XNH'|'XNI'|'XNJ'|'XNK'|'XNL'|'XNM'|'XOA'|'XOB'|'XOC'|'XOD'|'XOE'|'XOF'|'XOG'|'XOH'|'XOI'|'XOJ'|'XOK'|'XOL'|'XOM'|'XON'|'XOO'|'XOP'|'XOQ'|'XOR'|'XOS'|'XOT'|'XOU'|'XOV'|'XOW'|'XOX'|'XOY'|'XOZ'|'XP1'|'XP2'|'XP3'|'XP4'|'XPA'|'XPB'|'XPC'|'XPD'|'XPE'|'XPF'|'XPG'|'XPH'|'XPI'|'XPJ'|'XPK'|'XPL'|'XPM'|'XPN'|'XPO'|'XPP'|'XPQ'|'XPR'|'XPS'|'XPT'|'XPU'|'XPV'|'XPW'|'XPX'|'XPY'|'XPZ'|'XQA'|'XQB'|'XQC'|'XQD'|'XQE'|'XQF'|'XQG'|'XQH'|'XQI'|'XQJ'|'XQK'|'XQL'|'XQM'|'XQN'|'XQO'|'XQP'|'XQQ'|'XQR'|'XQS'|'XRD'|'XRE'|'XRF'|'XRG'|'XRH'|'XRI'|'XRJ'|'XRK'|'XRL'|'XRM'|'XRN'|'XRO'|'XRP'|'XRQ'|'XRR'|'XRS'|'XRT'|'XRU'|'XRV'|'XRW'|'XRX'|'XRY'|'XRZ'|'XSA'|'XSB'|'XSC'|'XSD'|'XSE'|'XSF'|'XSG'|'XSH'|'XSI'|'XSJ'|'XSK'|'XSL'|'XSM'|'XSN'|'XSO'|'XSP'|'XSQ'|'XSR'|'XSS'|'XST'|'XSU'|'XSV'|'XSW'|'XSX'|'XSY'|'XSZ'|'XTA'|'XTB'|'XTC'|'XTD'|'XTE'|'XTF'|'XTG'|'XTI'|'XTJ'|'XTK'|'XTL'|'XTM'|'XTN'|'XTO'|'XTR'|'XTS'|'XTT'|'XTU'|'XTV'|'XTW'|'XTX'|'XTY'|'XTZ'|'XUC'|'XUN'|'XVA'|'XVG'|'XVI'|'XVK'|'XVL'|'XVN'|'XVO'|'XVP'|'XVQ'|'XVR'|'XVS'|'XVY'|'XWA'|'XWB'|'XWC'|'XWD'|'XWF'|'XWG'|'XWH'|'XWJ'|'XWK'|'XWL'|'XWM'|'XWN'|'XWP'|'XWQ'|'XWR'|'XWS'|'XWT'|'XWU'|'XWV'|'XWW'|'XWX'|'XWY'|'XWZ'|'XXA'|'XXB'|'XXC'|'XXD'|'XXF'|'XXG'|'XXH'|'XXJ'|'XXK'|'XYA'|'XYB'|'XYC'|'XYD'|'XYF'|'XYG'|'XYH'|'XYJ'|'XYK'|'XYL'|'XYM'|'XYN'|'XYP'|'XYQ'|'XYR'|'XYS'|'XYT'|'XYV'|'XYW'|'XYX'|'XYY'|'XYZ'|'XZA'|'XZB'|'XZC'|'XZD'|'XZF'|'XZG'|'XZH'|'XZJ'|'XZK'|'XZL'|'XZM'|'XZN'|'XZP'|'XZQ'|'XZR'|'XZS'|'XZT'|'XZU'|'XZV'|'XZW'|'XZX'|'XZY'|'XZZ'|'ZZ'|'NAR'|'C62'|'LTR'|'H87'|UnitOfMeasureCode|null, - * unitPrice?: float|string|null, - * }>, - * note?: string|null, - * paymentDetails?: list|null, - * paymentTerm?: string|null, - * previousUnpaidBalance?: float|string|null, - * purchaseOrder?: string|null, - * remittanceAddress?: string|null, - * remittanceAddressRecipient?: string|null, - * serviceAddress?: string|null, - * serviceAddressRecipient?: string|null, - * serviceEndDate?: string|\DateTimeInterface|null, - * serviceStartDate?: string|\DateTimeInterface|null, - * shippingAddress?: string|null, - * shippingAddressRecipient?: string|null, - * state?: 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState, - * subtotal?: float|string|null, - * taxCode?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|DocumentCreateParams\TaxCode, - * taxDetails?: list|null, - * totalDiscount?: float|string|null, - * totalTax?: float|string|null, - * vatex?: value-of, - * vatexNote?: string|null, - * vendorAddress?: string|null, - * vendorAddressRecipient?: string|null, - * vendorCompanyID?: string|null, - * vendorEmail?: string|null, - * vendorName?: string|null, - * vendorTaxID?: string|null, - * }|DocumentCreateParams $params + * date?: null|null, + * description?: string|null, + * productCode?: string|null, + * quantity?: float|string|null, + * tax?: float|string|null, + * taxRate?: float|string|null, + * unit?: '10'|'11'|'13'|'14'|'15'|'20'|'21'|'22'|'23'|'24'|'25'|'27'|'28'|'33'|'34'|'35'|'37'|'38'|'40'|'41'|'56'|'57'|'58'|'59'|'60'|'61'|'74'|'77'|'80'|'81'|'85'|'87'|'89'|'91'|'1I'|'EA'|'E01'|'E07'|'E09'|'E10'|'E12'|'E14'|'E17'|'E20'|'E23'|'E25'|'E27'|'E31'|'E34'|'E35'|'E36'|'E37'|'E38'|'E39'|'E40'|'E41'|'E42'|'E43'|'E44'|'E45'|'E46'|'E47'|'E48'|'E49'|'E50'|'E51'|'E52'|'E53'|'E54'|'E55'|'E56'|'E57'|'E58'|'E60'|'E62'|'E65'|'E66'|'E67'|'E69'|'E70'|'E71'|'E73'|'E75'|'E76'|'2A'|'2B'|'2C'|'2G'|'2H'|'2I'|'2J'|'2K'|'2L'|'2M'|'2N'|'2P'|'2Q'|'2R'|'2U'|'2X'|'2Y'|'2Z'|'3B'|'3C'|'4C'|'4G'|'4H'|'4K'|'4L'|'4M'|'4N'|'4O'|'4P'|'4Q'|'4R'|'4T'|'4U'|'4W'|'4X'|'5A'|'5B'|'5E'|'5J'|'A10'|'A11'|'A12'|'A13'|'A14'|'A15'|'A16'|'A17'|'A18'|'A19'|'A2'|'A20'|'A21'|'A22'|'A23'|'A24'|'A26'|'A27'|'A28'|'A29'|'A3'|'A30'|'A31'|'A32'|'A33'|'A34'|'A35'|'A36'|'A37'|'A38'|'A39'|'A4'|'A40'|'A41'|'A42'|'A43'|'A44'|'A45'|'A46'|'A47'|'A48'|'A49'|'A5'|'A50'|'A51'|'A52'|'A53'|'A54'|'A55'|'A56'|'A57'|'A58'|'A59'|'A6'|'A60'|'A61'|'A62'|'A63'|'A64'|'A65'|'A66'|'A67'|'A68'|'A69'|'A7'|'A70'|'A71'|'A72'|'A73'|'A74'|'A75'|'A76'|'A77'|'A78'|'A79'|'A8'|'A80'|'A81'|'A82'|'A83'|'A84'|'A85'|'A86'|'A87'|'A88'|'A89'|'A9'|'A90'|'A91'|'A92'|'A93'|'A94'|'A95'|'A96'|'A97'|'A98'|'A99'|'ACR'|'AH'|'AI'|'AK'|'AMH'|'AMT'|'ANN'|'B1'|'B11'|'B12'|'B13'|'B14'|'B15'|'B16'|'B17'|'B18'|'B19'|'B20'|'B21'|'B22'|'B23'|'B24'|'B25'|'B26'|'B27'|'B28'|'B29'|'B3'|'B30'|'B31'|'B32'|'B33'|'B34'|'B35'|'B36'|'B37'|'B38'|'B39'|'B4'|'B40'|'B41'|'B42'|'B43'|'B44'|'B45'|'B46'|'B47'|'B48'|'B49'|'B5'|'B50'|'B52'|'B53'|'B54'|'B55'|'B56'|'B57'|'B58'|'B59'|'B6'|'B60'|'B61'|'B62'|'B63'|'B64'|'B65'|'B66'|'B67'|'B68'|'B69'|'B7'|'B70'|'B71'|'B72'|'B73'|'B74'|'B75'|'B76'|'B77'|'B78'|'B79'|'B8'|'B80'|'B81'|'B82'|'B83'|'B84'|'B85'|'B86'|'B87'|'B88'|'B89'|'B9'|'B90'|'B91'|'B92'|'B93'|'B94'|'B95'|'B96'|'B97'|'B98'|'B99'|'BAR'|'BB'|'BFT'|'BHP'|'BIL'|'BLD'|'BLL'|'BUA'|'BUI'|'C0'|'C10'|'C11'|'C12'|'C13'|'C14'|'C15'|'C16'|'C17'|'C18'|'C19'|'C20'|'C21'|'C22'|'C23'|'C24'|'C25'|'C26'|'C27'|'C28'|'C29'|'C30'|'C31'|'C32'|'C33'|'C34'|'C35'|'C36'|'C37'|'C38'|'C39'|'C40'|'C41'|'C42'|'C43'|'C44'|'C45'|'C46'|'C47'|'C48'|'C49'|'C50'|'C51'|'C52'|'C53'|'C54'|'C55'|'C56'|'C57'|'C58'|'C59'|'C60'|'C61'|'C63'|'C64'|'C65'|'C66'|'C67'|'C68'|'C69'|'C70'|'C71'|'C72'|'C73'|'C74'|'C75'|'C76'|'C77'|'C78'|'C79'|'C80'|'C81'|'C82'|'C83'|'C84'|'C85'|'C86'|'C87'|'C88'|'C89'|'C90'|'C91'|'C92'|'C93'|'C94'|'C95'|'C96'|'C97'|'C98'|'C99'|'CDL'|'CEL'|'CHU'|'CIU'|'CLT'|'CMK'|'CMQ'|'CMT'|'CNP'|'CNT'|'COU'|'CTG'|'CTN'|'CUR'|'CWA'|'CWI'|'DAN'|'DAY'|'DB'|'DD'|'DG'|'DI'|'DLT'|'DMK'|'DMQ'|'DMT'|'DPC'|'DPT'|'DRA'|'DZN'|'DZP'|'FOT'|'GLL'|'GLI'|'GRM'|'GRO'|'HUR'|'HTZ'|'INH'|'KGM'|'KMT'|'MTR'|'SMI'|'MIN'|'MON'|'ONZ'|'LBR'|'QT'|'SEC'|'FTK'|'INK'|'MTK'|'YDK'|'TNE'|'VLT'|'WTT'|'YRD'|'FTQ'|'INQ'|'MTQ'|'YDQ'|'HAR'|'KLT'|'MLT'|'MMT'|'KMK'|'MMK'|'XAA'|'XAB'|'XAC'|'XAD'|'XAE'|'XAF'|'XAG'|'XAH'|'XAI'|'XAJ'|'XAL'|'XAM'|'XAP'|'XAT'|'XAV'|'XB4'|'XBA'|'XBB'|'XBC'|'XBD'|'XBE'|'XBF'|'XBG'|'XBH'|'XBI'|'XBJ'|'XBK'|'XBL'|'XBM'|'XBN'|'XBO'|'XBP'|'XBQ'|'XBR'|'XBS'|'XBT'|'XBU'|'XBV'|'XBW'|'XBX'|'XBY'|'XBZ'|'XCA'|'XCB'|'XCC'|'XCD'|'XCE'|'XCF'|'XCG'|'XCH'|'XCI'|'XCJ'|'XCK'|'XCL'|'XCM'|'XCN'|'XCO'|'XCP'|'XCQ'|'XCR'|'XCS'|'XCT'|'XCU'|'XCV'|'XCW'|'XCX'|'XCY'|'XCZ'|'XDA'|'XDB'|'XDC'|'XDD'|'XDE'|'XDF'|'XDG'|'XDH'|'XDI'|'XDJ'|'XDK'|'XDL'|'XDM'|'XDN'|'XDP'|'XDQ'|'XDR'|'XDS'|'XDT'|'XDU'|'XDV'|'XDW'|'XDX'|'XDY'|'XDZ'|'XEA'|'XEB'|'XEC'|'XED'|'XEE'|'XEF'|'XEG'|'XEH'|'XEI'|'XEJ'|'XEK'|'XEL'|'XEM'|'XEN'|'XEP'|'XEQ'|'XER'|'XES'|'XET'|'XEU'|'XEV'|'XEW'|'XEX'|'XEY'|'XFB'|'XFC'|'XFD'|'XFE'|'XFF'|'XFG'|'XFH'|'XFI'|'XFJ'|'XFK'|'XFL'|'XFM'|'XFN'|'XFO'|'XFP'|'XFQ'|'XFR'|'XFS'|'XFT'|'XFU'|'XFV'|'XFW'|'XFX'|'XFY'|'XFZ'|'XGA'|'XGB'|'XGC'|'XGD'|'XGE'|'XGF'|'XGG'|'XGH'|'XGI'|'XGJ'|'XGK'|'XGL'|'XGM'|'XGN'|'XGO'|'XGP'|'XGQ'|'XGR'|'XGS'|'XGT'|'XGU'|'XGV'|'XGW'|'XGX'|'XGY'|'XGZ'|'XHA'|'XHB'|'XHC'|'XHD'|'XHE'|'XHF'|'XHG'|'XHH'|'XHI'|'XHJ'|'XHK'|'XHL'|'XHM'|'XHN'|'XHP'|'XHQ'|'XHR'|'XHS'|'XHT'|'XHU'|'XHV'|'XHW'|'XHX'|'XHY'|'XHZ'|'XIA'|'XIB'|'XIC'|'XID'|'XIE'|'XIF'|'XIG'|'XIH'|'XII'|'XIJ'|'XIK'|'XIL'|'XIM'|'XIN'|'XIO'|'XJA'|'XJB'|'XJC'|'XJD'|'XJE'|'XJF'|'XJG'|'XJH'|'XJI'|'XJJ'|'XJK'|'XJL'|'XJM'|'XJN'|'XJO'|'XJP'|'XJQ'|'XJR'|'XJS'|'XJT'|'XJU'|'XJV'|'XJW'|'XJX'|'XJY'|'XJZ'|'XLA'|'XLB'|'XLC'|'XLD'|'XLE'|'XLF'|'XLG'|'XLH'|'XLI'|'XLJ'|'XLK'|'XLL'|'XLM'|'XLN'|'XLO'|'XLP'|'XLQ'|'XLR'|'XLS'|'XLT'|'XLU'|'XLV'|'XLW'|'XLX'|'XLY'|'XLZ'|'XMA'|'XMB'|'XMC'|'XMD'|'XME'|'XMF'|'XMG'|'XMH'|'XMI'|'XMJ'|'XMK'|'XML'|'XMM'|'XMN'|'XMO'|'XMP'|'XMQ'|'XMR'|'XMS'|'XMT'|'XMU'|'XMV'|'XMW'|'XMX'|'XMY'|'XMZ'|'XNA'|'XNB'|'XNC'|'XND'|'XNE'|'XNF'|'XNG'|'XNH'|'XNI'|'XNJ'|'XNK'|'XNL'|'XNM'|'XOA'|'XOB'|'XOC'|'XOD'|'XOE'|'XOF'|'XOG'|'XOH'|'XOI'|'XOJ'|'XOK'|'XOL'|'XOM'|'XON'|'XOO'|'XOP'|'XOQ'|'XOR'|'XOS'|'XOT'|'XOU'|'XOV'|'XOW'|'XOX'|'XOY'|'XOZ'|'XP1'|'XP2'|'XP3'|'XP4'|'XPA'|'XPB'|'XPC'|'XPD'|'XPE'|'XPF'|'XPG'|'XPH'|'XPI'|'XPJ'|'XPK'|'XPL'|'XPM'|'XPN'|'XPO'|'XPP'|'XPQ'|'XPR'|'XPS'|'XPT'|'XPU'|'XPV'|'XPW'|'XPX'|'XPY'|'XPZ'|'XQA'|'XQB'|'XQC'|'XQD'|'XQE'|'XQF'|'XQG'|'XQH'|'XQI'|'XQJ'|'XQK'|'XQL'|'XQM'|'XQN'|'XQO'|'XQP'|'XQQ'|'XQR'|'XQS'|'XRD'|'XRE'|'XRF'|'XRG'|'XRH'|'XRI'|'XRJ'|'XRK'|'XRL'|'XRM'|'XRN'|'XRO'|'XRP'|'XRQ'|'XRR'|'XRS'|'XRT'|'XRU'|'XRV'|'XRW'|'XRX'|'XRY'|'XRZ'|'XSA'|'XSB'|'XSC'|'XSD'|'XSE'|'XSF'|'XSG'|'XSH'|'XSI'|'XSJ'|'XSK'|'XSL'|'XSM'|'XSN'|'XSO'|'XSP'|'XSQ'|'XSR'|'XSS'|'XST'|'XSU'|'XSV'|'XSW'|'XSX'|'XSY'|'XSZ'|'XTA'|'XTB'|'XTC'|'XTD'|'XTE'|'XTF'|'XTG'|'XTI'|'XTJ'|'XTK'|'XTL'|'XTM'|'XTN'|'XTO'|'XTR'|'XTS'|'XTT'|'XTU'|'XTV'|'XTW'|'XTX'|'XTY'|'XTZ'|'XUC'|'XUN'|'XVA'|'XVG'|'XVI'|'XVK'|'XVL'|'XVN'|'XVO'|'XVP'|'XVQ'|'XVR'|'XVS'|'XVY'|'XWA'|'XWB'|'XWC'|'XWD'|'XWF'|'XWG'|'XWH'|'XWJ'|'XWK'|'XWL'|'XWM'|'XWN'|'XWP'|'XWQ'|'XWR'|'XWS'|'XWT'|'XWU'|'XWV'|'XWW'|'XWX'|'XWY'|'XWZ'|'XXA'|'XXB'|'XXC'|'XXD'|'XXF'|'XXG'|'XXH'|'XXJ'|'XXK'|'XYA'|'XYB'|'XYC'|'XYD'|'XYF'|'XYG'|'XYH'|'XYJ'|'XYK'|'XYL'|'XYM'|'XYN'|'XYP'|'XYQ'|'XYR'|'XYS'|'XYT'|'XYV'|'XYW'|'XYX'|'XYY'|'XYZ'|'XZA'|'XZB'|'XZC'|'XZD'|'XZF'|'XZG'|'XZH'|'XZJ'|'XZK'|'XZL'|'XZM'|'XZN'|'XZP'|'XZQ'|'XZR'|'XZS'|'XZT'|'XZU'|'XZV'|'XZW'|'XZX'|'XZY'|'XZZ'|'ZZ'|'NAR'|'C62'|'LTR'|'H87'|UnitOfMeasureCode|null, + * unitPrice?: float|string|null, + * }> $items At least one line item is required + * @param string|null $note Additional notes or comments for the invoice + * @param list|null $paymentDetails + * @param string|null $paymentTerm The payment terms (e.g., 'Net 30', 'Due on receipt', '2/10 Net 30') + * @param float|string|null $previousUnpaidBalance The previous unpaid balance from prior invoices, if any. Must be positive and rounded to maximum 2 decimals + * @param string|null $purchaseOrder The purchase order reference number + * @param string|null $remittanceAddress The address where payment should be sent or remitted to + * @param string|null $remittanceAddressRecipient The recipient name at the remittance address + * @param string|null $serviceAddress The address where services were performed or goods were delivered + * @param string|null $serviceAddressRecipient The recipient name at the service address + * @param string|\DateTimeInterface|null $serviceEndDate The end date of the service period or delivery period + * @param string|\DateTimeInterface|null $serviceStartDate The start date of the service period or delivery period + * @param string|null $shippingAddress The shipping/delivery address + * @param string|null $shippingAddressRecipient The recipient name at the shipping address + * @param 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState $state The current state of the document: DRAFT, TRANSIT, FAILED, SENT, or RECEIVED + * @param float|string|null $subtotal The taxable base of the invoice. Should be the sum of all line items - allowances (for example commercial discounts) + charges with impact on VAT. Must be positive and rounded to maximum 2 decimals + * @param 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|\EInvoiceAPI\Documents\DocumentCreateParams\TaxCode $taxCode Tax category code of the invoice (e.g., S for standard rate, Z for zero rate, E for exempt) + * @param list|null $taxDetails + * @param float|string|null $totalDiscount The net financial discount/charge of the invoice (non-VAT charges minus non-VAT allowances). Can be positive (net charge), negative (net discount), or zero. Must be rounded to maximum 2 decimals + * @param float|string|null $totalTax The total tax amount of the invoice. Must be positive and rounded to maximum 2 decimals + * @param 'VATEX-EU-79-C'|'VATEX-EU-132'|'VATEX-EU-132-1A'|'VATEX-EU-132-1B'|'VATEX-EU-132-1C'|'VATEX-EU-132-1D'|'VATEX-EU-132-1E'|'VATEX-EU-132-1F'|'VATEX-EU-132-1G'|'VATEX-EU-132-1H'|'VATEX-EU-132-1I'|'VATEX-EU-132-1J'|'VATEX-EU-132-1K'|'VATEX-EU-132-1L'|'VATEX-EU-132-1M'|'VATEX-EU-132-1N'|'VATEX-EU-132-1O'|'VATEX-EU-132-1P'|'VATEX-EU-132-1Q'|'VATEX-EU-143'|'VATEX-EU-143-1A'|'VATEX-EU-143-1B'|'VATEX-EU-143-1C'|'VATEX-EU-143-1D'|'VATEX-EU-143-1E'|'VATEX-EU-143-1F'|'VATEX-EU-143-1FA'|'VATEX-EU-143-1G'|'VATEX-EU-143-1H'|'VATEX-EU-143-1I'|'VATEX-EU-143-1J'|'VATEX-EU-143-1K'|'VATEX-EU-143-1L'|'VATEX-EU-144'|'VATEX-EU-146-1E'|'VATEX-EU-148'|'VATEX-EU-148-A'|'VATEX-EU-148-B'|'VATEX-EU-148-C'|'VATEX-EU-148-D'|'VATEX-EU-148-E'|'VATEX-EU-148-F'|'VATEX-EU-148-G'|'VATEX-EU-151'|'VATEX-EU-151-1A'|'VATEX-EU-151-1AA'|'VATEX-EU-151-1B'|'VATEX-EU-151-1C'|'VATEX-EU-151-1D'|'VATEX-EU-151-1E'|'VATEX-EU-159'|'VATEX-EU-309'|'VATEX-EU-AE'|'VATEX-EU-D'|'VATEX-EU-F'|'VATEX-EU-G'|'VATEX-EU-I'|'VATEX-EU-IC'|'VATEX-EU-O'|'VATEX-EU-J'|'VATEX-FR-FRANCHISE'|'VATEX-FR-CNWVAT'|Vatex|null $vatex VATEX code list for VAT exemption reasons + * + * Agency: CEF + * Identifier: vatex + * @param string|null $vatexNote Textual explanation for VAT exemption + * @param string|null $vendorAddress The address of the vendor/seller + * @param string|null $vendorAddressRecipient The recipient name at the vendor address + * @param string|null $vendorCompanyID Vendor company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. + * @param string|null $vendorEmail The email address of the vendor + * @param string|null $vendorName The name of the vendor/seller/supplier + * @param string|null $vendorTaxID Vendor tax ID. For Belgium this is the VAT number. Must include the country prefix * * @throws APIException */ public function create( - array|DocumentCreateParams $params, - ?RequestOptions $requestOptions = null + ?array $allowances = null, + float|string|null $amountDue = null, + ?array $attachments = null, + ?string $billingAddress = null, + ?string $billingAddressRecipient = null, + ?array $charges = null, + string|CurrencyCode|null $currency = null, + ?string $customerAddress = null, + ?string $customerAddressRecipient = null, + ?string $customerCompanyID = null, + ?string $customerEmail = null, + ?string $customerID = null, + ?string $customerName = null, + ?string $customerTaxID = null, + string|DocumentDirection|null $direction = null, + string|DocumentType|null $documentType = null, + string|\DateTimeInterface|null $dueDate = null, + string|\DateTimeInterface|null $invoiceDate = null, + ?string $invoiceID = null, + float|string|null $invoiceTotal = null, + ?array $items = null, + ?string $note = null, + ?array $paymentDetails = null, + ?string $paymentTerm = null, + float|string|null $previousUnpaidBalance = null, + ?string $purchaseOrder = null, + ?string $remittanceAddress = null, + ?string $remittanceAddressRecipient = null, + ?string $serviceAddress = null, + ?string $serviceAddressRecipient = null, + string|\DateTimeInterface|null $serviceEndDate = null, + string|\DateTimeInterface|null $serviceStartDate = null, + ?string $shippingAddress = null, + ?string $shippingAddressRecipient = null, + string|DocumentState|null $state = null, + float|string|null $subtotal = null, + string|\EInvoiceAPI\Documents\DocumentCreateParams\TaxCode $taxCode = 'S', + ?array $taxDetails = null, + float|string|null $totalDiscount = null, + float|string|null $totalTax = null, + string|Vatex|null $vatex = null, + ?string $vatexNote = null, + ?string $vendorAddress = null, + ?string $vendorAddressRecipient = null, + ?string $vendorCompanyID = null, + ?string $vendorEmail = null, + ?string $vendorName = null, + ?string $vendorTaxID = null, + ?RequestOptions $requestOptions = null, ): DocumentResponse { - [$parsed, $options] = DocumentCreateParams::parseRequest( - $params, - $requestOptions, - ); + $params = [ + 'allowances' => $allowances, + 'amountDue' => $amountDue, + 'attachments' => $attachments, + 'billingAddress' => $billingAddress, + 'billingAddressRecipient' => $billingAddressRecipient, + 'charges' => $charges, + 'currency' => $currency, + 'customerAddress' => $customerAddress, + 'customerAddressRecipient' => $customerAddressRecipient, + 'customerCompanyID' => $customerCompanyID, + 'customerEmail' => $customerEmail, + 'customerID' => $customerID, + 'customerName' => $customerName, + 'customerTaxID' => $customerTaxID, + 'direction' => $direction, + 'documentType' => $documentType, + 'dueDate' => $dueDate, + 'invoiceDate' => $invoiceDate, + 'invoiceID' => $invoiceID, + 'invoiceTotal' => $invoiceTotal, + 'items' => $items, + 'note' => $note, + 'paymentDetails' => $paymentDetails, + 'paymentTerm' => $paymentTerm, + 'previousUnpaidBalance' => $previousUnpaidBalance, + 'purchaseOrder' => $purchaseOrder, + 'remittanceAddress' => $remittanceAddress, + 'remittanceAddressRecipient' => $remittanceAddressRecipient, + 'serviceAddress' => $serviceAddress, + 'serviceAddressRecipient' => $serviceAddressRecipient, + 'serviceEndDate' => $serviceEndDate, + 'serviceStartDate' => $serviceStartDate, + 'shippingAddress' => $shippingAddress, + 'shippingAddressRecipient' => $shippingAddressRecipient, + 'state' => $state, + 'subtotal' => $subtotal, + 'taxCode' => $taxCode, + 'taxDetails' => $taxDetails, + 'totalDiscount' => $totalDiscount, + 'totalTax' => $totalTax, + 'vatex' => $vatex, + 'vatexNote' => $vatexNote, + 'vendorAddress' => $vendorAddress, + 'vendorAddressRecipient' => $vendorAddressRecipient, + 'vendorCompanyID' => $vendorCompanyID, + 'vendorEmail' => $vendorEmail, + 'vendorName' => $vendorName, + 'vendorTaxID' => $vendorTaxID, + ]; + // @phpstan-ignore-next-line function.impossibleType + $params = array_filter($params, callback: static fn ($v) => !is_null($v)); - /** @var BaseResponse */ - $response = $this->client->request( - method: 'post', - path: 'api/documents/', - body: (object) $parsed, - options: $options, - convert: DocumentResponse::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->create(params: $params, requestOptions: $requestOptions); return $response->parse(); } @@ -176,13 +285,8 @@ public function retrieve( string $documentID, ?RequestOptions $requestOptions = null ): DocumentResponse { - /** @var BaseResponse */ - $response = $this->client->request( - method: 'get', - path: ['api/documents/%1$s', $documentID], - options: $requestOptions, - convert: DocumentResponse::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieve($documentID, requestOptions: $requestOptions); return $response->parse(); } @@ -198,13 +302,8 @@ public function delete( string $documentID, ?RequestOptions $requestOptions = null ): DocumentDeleteResponse { - /** @var BaseResponse */ - $response = $this->client->request( - method: 'delete', - path: ['api/documents/%1$s', $documentID], - options: $requestOptions, - convert: DocumentDeleteResponse::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->delete($documentID, requestOptions: $requestOptions); return $response->parse(); } @@ -214,37 +313,28 @@ public function delete( * * Create a new invoice or credit note from a PDF file. If the 'ubl_document' field is set in the response, it indicates that sufficient details were extracted from the PDF to automatically generate a valid UBL document ready for sending. If 'ubl_document' is not set, human intervention may be required to ensure compliance. * - * @param array{ - * file: string, customerTaxID?: string|null, vendorTaxID?: string|null - * }|DocumentCreateFromPdfParams $params + * @param string $file Body param: + * @param string|null $customerTaxID Query param: + * @param string|null $vendorTaxID Query param: * * @throws APIException */ public function createFromPdf( - array|DocumentCreateFromPdfParams $params, + string $file, + ?string $customerTaxID = null, + ?string $vendorTaxID = null, ?RequestOptions $requestOptions = null, ): DocumentNewFromPdfResponse { - [$parsed, $options] = DocumentCreateFromPdfParams::parseRequest( - $params, - $requestOptions, - ); - $query_params = array_flip(['customer_tax_id', 'vendor_tax_id']); + $params = [ + 'file' => $file, + 'customerTaxID' => $customerTaxID, + 'vendorTaxID' => $vendorTaxID, + ]; + // @phpstan-ignore-next-line function.impossibleType + $params = array_filter($params, callback: static fn ($v) => !is_null($v)); - /** @var BaseResponse */ - $response = $this->client->request( - method: 'post', - path: 'api/documents/pdf', - query: Util::array_transform_keys( - array_diff_key($parsed, $query_params), - [ - 'customerTaxID' => 'customer_tax_id', 'vendorTaxID' => 'vendor_tax_id', - ], - ), - headers: ['Content-Type' => 'multipart/form-data'], - body: (object) array_diff_key($parsed, $query_params), - options: $options, - convert: DocumentNewFromPdfResponse::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->createFromPdf(params: $params, requestOptions: $requestOptions); return $response->parse(); } @@ -254,42 +344,29 @@ public function createFromPdf( * * Send an invoice or credit note via Peppol * - * @param array{ - * email?: string|null, - * receiverPeppolID?: string|null, - * receiverPeppolScheme?: string|null, - * senderPeppolID?: string|null, - * senderPeppolScheme?: string|null, - * }|DocumentSendParams $params - * * @throws APIException */ public function send( string $documentID, - array|DocumentSendParams $params, + ?string $email = null, + ?string $receiverPeppolID = null, + ?string $receiverPeppolScheme = null, + ?string $senderPeppolID = null, + ?string $senderPeppolScheme = null, ?RequestOptions $requestOptions = null, ): DocumentResponse { - [$parsed, $options] = DocumentSendParams::parseRequest( - $params, - $requestOptions, - ); + $params = [ + 'email' => $email, + 'receiverPeppolID' => $receiverPeppolID, + 'receiverPeppolScheme' => $receiverPeppolScheme, + 'senderPeppolID' => $senderPeppolID, + 'senderPeppolScheme' => $senderPeppolScheme, + ]; + // @phpstan-ignore-next-line function.impossibleType + $params = array_filter($params, callback: static fn ($v) => !is_null($v)); - /** @var BaseResponse */ - $response = $this->client->request( - method: 'post', - path: ['api/documents/%1$s/send', $documentID], - query: Util::array_transform_keys( - $parsed, - [ - 'receiverPeppolID' => 'receiver_peppol_id', - 'receiverPeppolScheme' => 'receiver_peppol_scheme', - 'senderPeppolID' => 'sender_peppol_id', - 'senderPeppolScheme' => 'sender_peppol_scheme', - ], - ), - options: $options, - convert: DocumentResponse::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->send($documentID, params: $params, requestOptions: $requestOptions); return $response->parse(); } @@ -305,13 +382,8 @@ public function validate( string $documentID, ?RequestOptions $requestOptions = null ): UblDocumentValidation { - /** @var BaseResponse */ - $response = $this->client->request( - method: 'post', - path: ['api/documents/%1$s/validate', $documentID], - options: $requestOptions, - convert: UblDocumentValidation::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->validate($documentID, requestOptions: $requestOptions); return $response->parse(); } diff --git a/src/Services/InboxRawService.php b/src/Services/InboxRawService.php new file mode 100644 index 00000000..3895f637 --- /dev/null +++ b/src/Services/InboxRawService.php @@ -0,0 +1,137 @@ +> + * + * @throws APIException + */ + public function list( + array|InboxListParams $params, + ?RequestOptions $requestOptions = null + ): BaseResponse { + [$parsed, $options] = InboxListParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'api/inbox/', + query: Util::array_transform_keys( + $parsed, + [ + 'dateFrom' => 'date_from', + 'dateTo' => 'date_to', + 'pageSize' => 'page_size', + ], + ), + options: $options, + convert: DocumentResponse::class, + page: DocumentsNumberPage::class, + ); + } + + /** + * @api + * + * Retrieve a paginated list of received credit notes with filtering options. + * + * @param array{page?: int, pageSize?: int}|InboxListCreditNotesParams $params + * + * @return BaseResponse> + * + * @throws APIException + */ + public function listCreditNotes( + array|InboxListCreditNotesParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = InboxListCreditNotesParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'api/inbox/credit-notes', + query: Util::array_transform_keys($parsed, ['pageSize' => 'page_size']), + options: $options, + convert: DocumentResponse::class, + page: DocumentsNumberPage::class, + ); + } + + /** + * @api + * + * Retrieve a paginated list of received invoices with filtering options. + * + * @param array{page?: int, pageSize?: int}|InboxListInvoicesParams $params + * + * @return BaseResponse> + * + * @throws APIException + */ + public function listInvoices( + array|InboxListInvoicesParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = InboxListInvoicesParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'api/inbox/invoices', + query: Util::array_transform_keys($parsed, ['pageSize' => 'page_size']), + options: $options, + convert: DocumentResponse::class, + page: DocumentsNumberPage::class, + ); + } +} diff --git a/src/Services/InboxService.php b/src/Services/InboxService.php index fa344dd0..6e7828c0 100644 --- a/src/Services/InboxService.php +++ b/src/Services/InboxService.php @@ -5,71 +5,73 @@ namespace EInvoiceAPI\Services; use EInvoiceAPI\Client; -use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; -use EInvoiceAPI\Core\Util; use EInvoiceAPI\Documents\DocumentResponse; use EInvoiceAPI\Documents\DocumentType; use EInvoiceAPI\DocumentsNumberPage; use EInvoiceAPI\Inbox\DocumentState; -use EInvoiceAPI\Inbox\InboxListCreditNotesParams; -use EInvoiceAPI\Inbox\InboxListInvoicesParams; -use EInvoiceAPI\Inbox\InboxListParams; use EInvoiceAPI\RequestOptions; use EInvoiceAPI\ServiceContracts\InboxContract; final class InboxService implements InboxContract { + /** + * @api + */ + public InboxRawService $raw; + /** * @internal */ - public function __construct(private Client $client) {} + public function __construct(private Client $client) + { + $this->raw = new InboxRawService($client); + } /** * @api * * Retrieve a paginated list of received documents with filtering options including state, type, sender, date range, and text search. * - * @param array{ - * dateFrom?: string|\DateTimeInterface|null, - * dateTo?: string|\DateTimeInterface|null, - * page?: int, - * pageSize?: int, - * search?: string|null, - * sender?: string|null, - * state?: 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState|null, - * type?: 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType|null, - * }|InboxListParams $params + * @param string|\DateTimeInterface|null $dateFrom Filter by issue date (from) + * @param string|\DateTimeInterface|null $dateTo Filter by issue date (to) + * @param int $page Page number + * @param int $pageSize Number of items per page + * @param string|null $search Search in invoice number, seller/buyer names + * @param string|null $sender Filter by sender ID + * @param 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState|null $state Filter by document state + * @param 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType|null $type Filter by document type * * @return DocumentsNumberPage * * @throws APIException */ public function list( - array|InboxListParams $params, - ?RequestOptions $requestOptions = null + string|\DateTimeInterface|null $dateFrom = null, + string|\DateTimeInterface|null $dateTo = null, + int $page = 1, + int $pageSize = 20, + ?string $search = null, + ?string $sender = null, + string|DocumentState|null $state = null, + string|DocumentType|null $type = null, + ?RequestOptions $requestOptions = null, ): DocumentsNumberPage { - [$parsed, $options] = InboxListParams::parseRequest( - $params, - $requestOptions, - ); + $params = [ + 'dateFrom' => $dateFrom, + 'dateTo' => $dateTo, + 'page' => $page, + 'pageSize' => $pageSize, + 'search' => $search, + 'sender' => $sender, + 'state' => $state, + 'type' => $type, + ]; + // @phpstan-ignore-next-line function.impossibleType + $params = array_filter($params, callback: static fn ($v) => !is_null($v)); - /** @var BaseResponse> */ - $response = $this->client->request( - method: 'get', - path: 'api/inbox/', - query: Util::array_transform_keys( - $parsed, - [ - 'dateFrom' => 'date_from', - 'dateTo' => 'date_to', - 'pageSize' => 'page_size', - ], - ), - options: $options, - convert: DocumentResponse::class, - page: DocumentsNumberPage::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->list(params: $params, requestOptions: $requestOptions); return $response->parse(); } @@ -79,30 +81,24 @@ public function list( * * Retrieve a paginated list of received credit notes with filtering options. * - * @param array{page?: int, pageSize?: int}|InboxListCreditNotesParams $params + * @param int $page Page number + * @param int $pageSize Number of items per page * * @return DocumentsNumberPage * * @throws APIException */ public function listCreditNotes( - array|InboxListCreditNotesParams $params, - ?RequestOptions $requestOptions = null, + int $page = 1, + int $pageSize = 20, + ?RequestOptions $requestOptions = null ): DocumentsNumberPage { - [$parsed, $options] = InboxListCreditNotesParams::parseRequest( - $params, - $requestOptions, - ); + $params = ['page' => $page, 'pageSize' => $pageSize]; + // @phpstan-ignore-next-line function.impossibleType + $params = array_filter($params, callback: static fn ($v) => !is_null($v)); - /** @var BaseResponse> */ - $response = $this->client->request( - method: 'get', - path: 'api/inbox/credit-notes', - query: Util::array_transform_keys($parsed, ['pageSize' => 'page_size']), - options: $options, - convert: DocumentResponse::class, - page: DocumentsNumberPage::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->listCreditNotes(params: $params, requestOptions: $requestOptions); return $response->parse(); } @@ -112,30 +108,24 @@ public function listCreditNotes( * * Retrieve a paginated list of received invoices with filtering options. * - * @param array{page?: int, pageSize?: int}|InboxListInvoicesParams $params + * @param int $page Page number + * @param int $pageSize Number of items per page * * @return DocumentsNumberPage * * @throws APIException */ public function listInvoices( - array|InboxListInvoicesParams $params, - ?RequestOptions $requestOptions = null, + int $page = 1, + int $pageSize = 20, + ?RequestOptions $requestOptions = null ): DocumentsNumberPage { - [$parsed, $options] = InboxListInvoicesParams::parseRequest( - $params, - $requestOptions, - ); + $params = ['page' => $page, 'pageSize' => $pageSize]; + // @phpstan-ignore-next-line function.impossibleType + $params = array_filter($params, callback: static fn ($v) => !is_null($v)); - /** @var BaseResponse> */ - $response = $this->client->request( - method: 'get', - path: 'api/inbox/invoices', - query: Util::array_transform_keys($parsed, ['pageSize' => 'page_size']), - options: $options, - convert: DocumentResponse::class, - page: DocumentsNumberPage::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->listInvoices(params: $params, requestOptions: $requestOptions); return $response->parse(); } diff --git a/src/Services/LookupRawService.php b/src/Services/LookupRawService.php new file mode 100644 index 00000000..dacf98b1 --- /dev/null +++ b/src/Services/LookupRawService.php @@ -0,0 +1,90 @@ +:`. The scheme is a 4-digit code representing the identifier scheme, and the id is the actual identifier value. For example, for a Belgian company it is `0208:0123456789` (where 0208 is the scheme for Belgian enterprises, followed by the 10 digits of the official BTW / KBO number). + * + * @param array{peppolID: string}|LookupRetrieveParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieve( + array|LookupRetrieveParams $params, + ?RequestOptions $requestOptions = null + ): BaseResponse { + [$parsed, $options] = LookupRetrieveParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'api/lookup', + query: Util::array_transform_keys($parsed, ['peppolID' => 'peppol_id']), + options: $options, + convert: LookupGetResponse::class, + ); + } + + /** + * @api + * + * Lookup Peppol participants by name or other identifiers. You can limit the search to a specific country by providing the country code. + * + * @param array{ + * query: string, countryCode?: string|null + * }|LookupRetrieveParticipantsParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveParticipants( + array|LookupRetrieveParticipantsParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = LookupRetrieveParticipantsParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'api/lookup/participants', + query: Util::array_transform_keys( + $parsed, + ['countryCode' => 'country_code'] + ), + options: $options, + convert: LookupGetParticipantsResponse::class, + ); + } +} diff --git a/src/Services/LookupService.php b/src/Services/LookupService.php index dd1bbb32..0a2c91e6 100644 --- a/src/Services/LookupService.php +++ b/src/Services/LookupService.php @@ -5,49 +5,44 @@ namespace EInvoiceAPI\Services; use EInvoiceAPI\Client; -use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; -use EInvoiceAPI\Core\Util; use EInvoiceAPI\Lookup\LookupGetParticipantsResponse; use EInvoiceAPI\Lookup\LookupGetResponse; -use EInvoiceAPI\Lookup\LookupRetrieveParams; -use EInvoiceAPI\Lookup\LookupRetrieveParticipantsParams; use EInvoiceAPI\RequestOptions; use EInvoiceAPI\ServiceContracts\LookupContract; final class LookupService implements LookupContract { + /** + * @api + */ + public LookupRawService $raw; + /** * @internal */ - public function __construct(private Client $client) {} + public function __construct(private Client $client) + { + $this->raw = new LookupRawService($client); + } /** * @api * * Lookup Peppol ID. The peppol_id must be in the form of `:`. The scheme is a 4-digit code representing the identifier scheme, and the id is the actual identifier value. For example, for a Belgian company it is `0208:0123456789` (where 0208 is the scheme for Belgian enterprises, followed by the 10 digits of the official BTW / KBO number). * - * @param array{peppolID: string}|LookupRetrieveParams $params + * @param string $peppolID Peppol ID in the format `:`. Example: `0208:1018265814` for a Belgian company. * * @throws APIException */ public function retrieve( - array|LookupRetrieveParams $params, + string $peppolID, ?RequestOptions $requestOptions = null ): LookupGetResponse { - [$parsed, $options] = LookupRetrieveParams::parseRequest( - $params, - $requestOptions, - ); + $params = ['peppolID' => $peppolID]; - /** @var BaseResponse */ - $response = $this->client->request( - method: 'get', - path: 'api/lookup', - query: Util::array_transform_keys($parsed, ['peppolID' => 'peppol_id']), - options: $options, - convert: LookupGetResponse::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieve(params: $params, requestOptions: $requestOptions); return $response->parse(); } @@ -57,32 +52,22 @@ public function retrieve( * * Lookup Peppol participants by name or other identifiers. You can limit the search to a specific country by providing the country code. * - * @param array{ - * query: string, countryCode?: string|null - * }|LookupRetrieveParticipantsParams $params + * @param string $query Query to lookup + * @param string|null $countryCode Country code of the company to lookup. If not provided, the search will be global. * * @throws APIException */ public function retrieveParticipants( - array|LookupRetrieveParticipantsParams $params, + string $query, + ?string $countryCode = null, ?RequestOptions $requestOptions = null, ): LookupGetParticipantsResponse { - [$parsed, $options] = LookupRetrieveParticipantsParams::parseRequest( - $params, - $requestOptions, - ); + $params = ['query' => $query, 'countryCode' => $countryCode]; + // @phpstan-ignore-next-line function.impossibleType + $params = array_filter($params, callback: static fn ($v) => !is_null($v)); - /** @var BaseResponse */ - $response = $this->client->request( - method: 'get', - path: 'api/lookup/participants', - query: Util::array_transform_keys( - $parsed, - ['countryCode' => 'country_code'] - ), - options: $options, - convert: LookupGetParticipantsResponse::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieveParticipants(params: $params, requestOptions: $requestOptions); return $response->parse(); } diff --git a/src/Services/MeRawService.php b/src/Services/MeRawService.php new file mode 100644 index 00000000..7a0c305f --- /dev/null +++ b/src/Services/MeRawService.php @@ -0,0 +1,42 @@ + + * + * @throws APIException + */ + public function retrieve( + ?RequestOptions $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'api/me/', + options: $requestOptions, + convert: MeGetResponse::class, + ); + } +} diff --git a/src/Services/MeService.php b/src/Services/MeService.php index 2bd28091..1225213a 100644 --- a/src/Services/MeService.php +++ b/src/Services/MeService.php @@ -5,7 +5,6 @@ namespace EInvoiceAPI\Services; use EInvoiceAPI\Client; -use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; use EInvoiceAPI\Me\MeGetResponse; use EInvoiceAPI\RequestOptions; @@ -13,10 +12,18 @@ final class MeService implements MeContract { + /** + * @api + */ + public MeRawService $raw; + /** * @internal */ - public function __construct(private Client $client) {} + public function __construct(private Client $client) + { + $this->raw = new MeRawService($client); + } /** * @api @@ -28,13 +35,8 @@ public function __construct(private Client $client) {} public function retrieve( ?RequestOptions $requestOptions = null ): MeGetResponse { - /** @var BaseResponse */ - $response = $this->client->request( - method: 'get', - path: 'api/me/', - options: $requestOptions, - convert: MeGetResponse::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieve(requestOptions: $requestOptions); return $response->parse(); } diff --git a/src/Services/OutboxRawService.php b/src/Services/OutboxRawService.php new file mode 100644 index 00000000..cf04f416 --- /dev/null +++ b/src/Services/OutboxRawService.php @@ -0,0 +1,105 @@ +> + * + * @throws APIException + */ + public function listDraftDocuments( + array|OutboxListDraftDocumentsParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = OutboxListDraftDocumentsParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'api/outbox/drafts', + query: Util::array_transform_keys($parsed, ['pageSize' => 'page_size']), + options: $options, + convert: DocumentResponse::class, + page: DocumentsNumberPage::class, + ); + } + + /** + * @api + * + * Retrieve a paginated list of sent documents with filtering options including state, type, sender, date range, and text search. + * + * @param array{ + * dateFrom?: string|\DateTimeInterface|null, + * dateTo?: string|\DateTimeInterface|null, + * page?: int, + * pageSize?: int, + * search?: string|null, + * sender?: string|null, + * state?: 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState|null, + * type?: 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType|null, + * }|OutboxListReceivedDocumentsParams $params + * + * @return BaseResponse> + * + * @throws APIException + */ + public function listReceivedDocuments( + array|OutboxListReceivedDocumentsParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = OutboxListReceivedDocumentsParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'api/outbox/', + query: Util::array_transform_keys( + $parsed, + [ + 'dateFrom' => 'date_from', + 'dateTo' => 'date_to', + 'pageSize' => 'page_size', + ], + ), + options: $options, + convert: DocumentResponse::class, + page: DocumentsNumberPage::class, + ); + } +} diff --git a/src/Services/OutboxService.php b/src/Services/OutboxService.php index ccf88053..4c8ffcde 100644 --- a/src/Services/OutboxService.php +++ b/src/Services/OutboxService.php @@ -5,54 +5,52 @@ namespace EInvoiceAPI\Services; use EInvoiceAPI\Client; -use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; -use EInvoiceAPI\Core\Util; use EInvoiceAPI\Documents\DocumentResponse; use EInvoiceAPI\Documents\DocumentType; use EInvoiceAPI\DocumentsNumberPage; use EInvoiceAPI\Inbox\DocumentState; -use EInvoiceAPI\Outbox\OutboxListDraftDocumentsParams; -use EInvoiceAPI\Outbox\OutboxListReceivedDocumentsParams; use EInvoiceAPI\RequestOptions; use EInvoiceAPI\ServiceContracts\OutboxContract; final class OutboxService implements OutboxContract { + /** + * @api + */ + public OutboxRawService $raw; + /** * @internal */ - public function __construct(private Client $client) {} + public function __construct(private Client $client) + { + $this->raw = new OutboxRawService($client); + } /** * @api * * Retrieve a paginated list of draft documents with filtering options. * - * @param array{page?: int, pageSize?: int}|OutboxListDraftDocumentsParams $params + * @param int $page Page number + * @param int $pageSize Number of items per page * * @return DocumentsNumberPage * * @throws APIException */ public function listDraftDocuments( - array|OutboxListDraftDocumentsParams $params, - ?RequestOptions $requestOptions = null, + int $page = 1, + int $pageSize = 20, + ?RequestOptions $requestOptions = null ): DocumentsNumberPage { - [$parsed, $options] = OutboxListDraftDocumentsParams::parseRequest( - $params, - $requestOptions, - ); + $params = ['page' => $page, 'pageSize' => $pageSize]; + // @phpstan-ignore-next-line function.impossibleType + $params = array_filter($params, callback: static fn ($v) => !is_null($v)); - /** @var BaseResponse> */ - $response = $this->client->request( - method: 'get', - path: 'api/outbox/drafts', - query: Util::array_transform_keys($parsed, ['pageSize' => 'page_size']), - options: $options, - convert: DocumentResponse::class, - page: DocumentsNumberPage::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->listDraftDocuments(params: $params, requestOptions: $requestOptions); return $response->parse(); } @@ -62,46 +60,45 @@ public function listDraftDocuments( * * Retrieve a paginated list of sent documents with filtering options including state, type, sender, date range, and text search. * - * @param array{ - * dateFrom?: string|\DateTimeInterface|null, - * dateTo?: string|\DateTimeInterface|null, - * page?: int, - * pageSize?: int, - * search?: string|null, - * sender?: string|null, - * state?: 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState|null, - * type?: 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType|null, - * }|OutboxListReceivedDocumentsParams $params + * @param string|\DateTimeInterface|null $dateFrom Filter by issue date (from) + * @param string|\DateTimeInterface|null $dateTo Filter by issue date (to) + * @param int $page Page number + * @param int $pageSize Number of items per page + * @param string|null $search Search in invoice number, seller/buyer names + * @param string|null $sender Filter by sender ID + * @param 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState|null $state Filter by document state + * @param 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType|null $type Filter by document type * * @return DocumentsNumberPage * * @throws APIException */ public function listReceivedDocuments( - array|OutboxListReceivedDocumentsParams $params, + string|\DateTimeInterface|null $dateFrom = null, + string|\DateTimeInterface|null $dateTo = null, + int $page = 1, + int $pageSize = 20, + ?string $search = null, + ?string $sender = null, + string|DocumentState|null $state = null, + string|DocumentType|null $type = null, ?RequestOptions $requestOptions = null, ): DocumentsNumberPage { - [$parsed, $options] = OutboxListReceivedDocumentsParams::parseRequest( - $params, - $requestOptions, - ); + $params = [ + 'dateFrom' => $dateFrom, + 'dateTo' => $dateTo, + 'page' => $page, + 'pageSize' => $pageSize, + 'search' => $search, + 'sender' => $sender, + 'state' => $state, + 'type' => $type, + ]; + // @phpstan-ignore-next-line function.impossibleType + $params = array_filter($params, callback: static fn ($v) => !is_null($v)); - /** @var BaseResponse> */ - $response = $this->client->request( - method: 'get', - path: 'api/outbox/', - query: Util::array_transform_keys( - $parsed, - [ - 'dateFrom' => 'date_from', - 'dateTo' => 'date_to', - 'pageSize' => 'page_size', - ], - ), - options: $options, - convert: DocumentResponse::class, - page: DocumentsNumberPage::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->listReceivedDocuments(params: $params, requestOptions: $requestOptions); return $response->parse(); } diff --git a/src/Services/ValidateRawService.php b/src/Services/ValidateRawService.php new file mode 100644 index 00000000..fc51988e --- /dev/null +++ b/src/Services/ValidateRawService.php @@ -0,0 +1,211 @@ +|null, + * amountDue?: float|string|null, + * attachments?: list|null, + * billingAddress?: string|null, + * billingAddressRecipient?: string|null, + * charges?: list|null, + * currency?: value-of, + * customerAddress?: string|null, + * customerAddressRecipient?: string|null, + * customerCompanyID?: string|null, + * customerEmail?: string|null, + * customerID?: string|null, + * customerName?: string|null, + * customerTaxID?: string|null, + * direction?: 'INBOUND'|'OUTBOUND'|DocumentDirection, + * documentType?: 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType, + * dueDate?: string|\DateTimeInterface|null, + * invoiceDate?: string|\DateTimeInterface|null, + * invoiceID?: string|null, + * invoiceTotal?: float|string|null, + * items?: list>|null, + * amount?: float|string|null, + * charges?: list>|null, + * date?: null|null, + * description?: string|null, + * productCode?: string|null, + * quantity?: float|string|null, + * tax?: float|string|null, + * taxRate?: float|string|null, + * unit?: '10'|'11'|'13'|'14'|'15'|'20'|'21'|'22'|'23'|'24'|'25'|'27'|'28'|'33'|'34'|'35'|'37'|'38'|'40'|'41'|'56'|'57'|'58'|'59'|'60'|'61'|'74'|'77'|'80'|'81'|'85'|'87'|'89'|'91'|'1I'|'EA'|'E01'|'E07'|'E09'|'E10'|'E12'|'E14'|'E17'|'E20'|'E23'|'E25'|'E27'|'E31'|'E34'|'E35'|'E36'|'E37'|'E38'|'E39'|'E40'|'E41'|'E42'|'E43'|'E44'|'E45'|'E46'|'E47'|'E48'|'E49'|'E50'|'E51'|'E52'|'E53'|'E54'|'E55'|'E56'|'E57'|'E58'|'E60'|'E62'|'E65'|'E66'|'E67'|'E69'|'E70'|'E71'|'E73'|'E75'|'E76'|'2A'|'2B'|'2C'|'2G'|'2H'|'2I'|'2J'|'2K'|'2L'|'2M'|'2N'|'2P'|'2Q'|'2R'|'2U'|'2X'|'2Y'|'2Z'|'3B'|'3C'|'4C'|'4G'|'4H'|'4K'|'4L'|'4M'|'4N'|'4O'|'4P'|'4Q'|'4R'|'4T'|'4U'|'4W'|'4X'|'5A'|'5B'|'5E'|'5J'|'A10'|'A11'|'A12'|'A13'|'A14'|'A15'|'A16'|'A17'|'A18'|'A19'|'A2'|'A20'|'A21'|'A22'|'A23'|'A24'|'A26'|'A27'|'A28'|'A29'|'A3'|'A30'|'A31'|'A32'|'A33'|'A34'|'A35'|'A36'|'A37'|'A38'|'A39'|'A4'|'A40'|'A41'|'A42'|'A43'|'A44'|'A45'|'A46'|'A47'|'A48'|'A49'|'A5'|'A50'|'A51'|'A52'|'A53'|'A54'|'A55'|'A56'|'A57'|'A58'|'A59'|'A6'|'A60'|'A61'|'A62'|'A63'|'A64'|'A65'|'A66'|'A67'|'A68'|'A69'|'A7'|'A70'|'A71'|'A72'|'A73'|'A74'|'A75'|'A76'|'A77'|'A78'|'A79'|'A8'|'A80'|'A81'|'A82'|'A83'|'A84'|'A85'|'A86'|'A87'|'A88'|'A89'|'A9'|'A90'|'A91'|'A92'|'A93'|'A94'|'A95'|'A96'|'A97'|'A98'|'A99'|'ACR'|'AH'|'AI'|'AK'|'AMH'|'AMT'|'ANN'|'B1'|'B11'|'B12'|'B13'|'B14'|'B15'|'B16'|'B17'|'B18'|'B19'|'B20'|'B21'|'B22'|'B23'|'B24'|'B25'|'B26'|'B27'|'B28'|'B29'|'B3'|'B30'|'B31'|'B32'|'B33'|'B34'|'B35'|'B36'|'B37'|'B38'|'B39'|'B4'|'B40'|'B41'|'B42'|'B43'|'B44'|'B45'|'B46'|'B47'|'B48'|'B49'|'B5'|'B50'|'B52'|'B53'|'B54'|'B55'|'B56'|'B57'|'B58'|'B59'|'B6'|'B60'|'B61'|'B62'|'B63'|'B64'|'B65'|'B66'|'B67'|'B68'|'B69'|'B7'|'B70'|'B71'|'B72'|'B73'|'B74'|'B75'|'B76'|'B77'|'B78'|'B79'|'B8'|'B80'|'B81'|'B82'|'B83'|'B84'|'B85'|'B86'|'B87'|'B88'|'B89'|'B9'|'B90'|'B91'|'B92'|'B93'|'B94'|'B95'|'B96'|'B97'|'B98'|'B99'|'BAR'|'BB'|'BFT'|'BHP'|'BIL'|'BLD'|'BLL'|'BUA'|'BUI'|'C0'|'C10'|'C11'|'C12'|'C13'|'C14'|'C15'|'C16'|'C17'|'C18'|'C19'|'C20'|'C21'|'C22'|'C23'|'C24'|'C25'|'C26'|'C27'|'C28'|'C29'|'C30'|'C31'|'C32'|'C33'|'C34'|'C35'|'C36'|'C37'|'C38'|'C39'|'C40'|'C41'|'C42'|'C43'|'C44'|'C45'|'C46'|'C47'|'C48'|'C49'|'C50'|'C51'|'C52'|'C53'|'C54'|'C55'|'C56'|'C57'|'C58'|'C59'|'C60'|'C61'|'C63'|'C64'|'C65'|'C66'|'C67'|'C68'|'C69'|'C70'|'C71'|'C72'|'C73'|'C74'|'C75'|'C76'|'C77'|'C78'|'C79'|'C80'|'C81'|'C82'|'C83'|'C84'|'C85'|'C86'|'C87'|'C88'|'C89'|'C90'|'C91'|'C92'|'C93'|'C94'|'C95'|'C96'|'C97'|'C98'|'C99'|'CDL'|'CEL'|'CHU'|'CIU'|'CLT'|'CMK'|'CMQ'|'CMT'|'CNP'|'CNT'|'COU'|'CTG'|'CTN'|'CUR'|'CWA'|'CWI'|'DAN'|'DAY'|'DB'|'DD'|'DG'|'DI'|'DLT'|'DMK'|'DMQ'|'DMT'|'DPC'|'DPT'|'DRA'|'DZN'|'DZP'|'FOT'|'GLL'|'GLI'|'GRM'|'GRO'|'HUR'|'HTZ'|'INH'|'KGM'|'KMT'|'MTR'|'SMI'|'MIN'|'MON'|'ONZ'|'LBR'|'QT'|'SEC'|'FTK'|'INK'|'MTK'|'YDK'|'TNE'|'VLT'|'WTT'|'YRD'|'FTQ'|'INQ'|'MTQ'|'YDQ'|'HAR'|'KLT'|'MLT'|'MMT'|'KMK'|'MMK'|'XAA'|'XAB'|'XAC'|'XAD'|'XAE'|'XAF'|'XAG'|'XAH'|'XAI'|'XAJ'|'XAL'|'XAM'|'XAP'|'XAT'|'XAV'|'XB4'|'XBA'|'XBB'|'XBC'|'XBD'|'XBE'|'XBF'|'XBG'|'XBH'|'XBI'|'XBJ'|'XBK'|'XBL'|'XBM'|'XBN'|'XBO'|'XBP'|'XBQ'|'XBR'|'XBS'|'XBT'|'XBU'|'XBV'|'XBW'|'XBX'|'XBY'|'XBZ'|'XCA'|'XCB'|'XCC'|'XCD'|'XCE'|'XCF'|'XCG'|'XCH'|'XCI'|'XCJ'|'XCK'|'XCL'|'XCM'|'XCN'|'XCO'|'XCP'|'XCQ'|'XCR'|'XCS'|'XCT'|'XCU'|'XCV'|'XCW'|'XCX'|'XCY'|'XCZ'|'XDA'|'XDB'|'XDC'|'XDD'|'XDE'|'XDF'|'XDG'|'XDH'|'XDI'|'XDJ'|'XDK'|'XDL'|'XDM'|'XDN'|'XDP'|'XDQ'|'XDR'|'XDS'|'XDT'|'XDU'|'XDV'|'XDW'|'XDX'|'XDY'|'XDZ'|'XEA'|'XEB'|'XEC'|'XED'|'XEE'|'XEF'|'XEG'|'XEH'|'XEI'|'XEJ'|'XEK'|'XEL'|'XEM'|'XEN'|'XEP'|'XEQ'|'XER'|'XES'|'XET'|'XEU'|'XEV'|'XEW'|'XEX'|'XEY'|'XFB'|'XFC'|'XFD'|'XFE'|'XFF'|'XFG'|'XFH'|'XFI'|'XFJ'|'XFK'|'XFL'|'XFM'|'XFN'|'XFO'|'XFP'|'XFQ'|'XFR'|'XFS'|'XFT'|'XFU'|'XFV'|'XFW'|'XFX'|'XFY'|'XFZ'|'XGA'|'XGB'|'XGC'|'XGD'|'XGE'|'XGF'|'XGG'|'XGH'|'XGI'|'XGJ'|'XGK'|'XGL'|'XGM'|'XGN'|'XGO'|'XGP'|'XGQ'|'XGR'|'XGS'|'XGT'|'XGU'|'XGV'|'XGW'|'XGX'|'XGY'|'XGZ'|'XHA'|'XHB'|'XHC'|'XHD'|'XHE'|'XHF'|'XHG'|'XHH'|'XHI'|'XHJ'|'XHK'|'XHL'|'XHM'|'XHN'|'XHP'|'XHQ'|'XHR'|'XHS'|'XHT'|'XHU'|'XHV'|'XHW'|'XHX'|'XHY'|'XHZ'|'XIA'|'XIB'|'XIC'|'XID'|'XIE'|'XIF'|'XIG'|'XIH'|'XII'|'XIJ'|'XIK'|'XIL'|'XIM'|'XIN'|'XIO'|'XJA'|'XJB'|'XJC'|'XJD'|'XJE'|'XJF'|'XJG'|'XJH'|'XJI'|'XJJ'|'XJK'|'XJL'|'XJM'|'XJN'|'XJO'|'XJP'|'XJQ'|'XJR'|'XJS'|'XJT'|'XJU'|'XJV'|'XJW'|'XJX'|'XJY'|'XJZ'|'XLA'|'XLB'|'XLC'|'XLD'|'XLE'|'XLF'|'XLG'|'XLH'|'XLI'|'XLJ'|'XLK'|'XLL'|'XLM'|'XLN'|'XLO'|'XLP'|'XLQ'|'XLR'|'XLS'|'XLT'|'XLU'|'XLV'|'XLW'|'XLX'|'XLY'|'XLZ'|'XMA'|'XMB'|'XMC'|'XMD'|'XME'|'XMF'|'XMG'|'XMH'|'XMI'|'XMJ'|'XMK'|'XML'|'XMM'|'XMN'|'XMO'|'XMP'|'XMQ'|'XMR'|'XMS'|'XMT'|'XMU'|'XMV'|'XMW'|'XMX'|'XMY'|'XMZ'|'XNA'|'XNB'|'XNC'|'XND'|'XNE'|'XNF'|'XNG'|'XNH'|'XNI'|'XNJ'|'XNK'|'XNL'|'XNM'|'XOA'|'XOB'|'XOC'|'XOD'|'XOE'|'XOF'|'XOG'|'XOH'|'XOI'|'XOJ'|'XOK'|'XOL'|'XOM'|'XON'|'XOO'|'XOP'|'XOQ'|'XOR'|'XOS'|'XOT'|'XOU'|'XOV'|'XOW'|'XOX'|'XOY'|'XOZ'|'XP1'|'XP2'|'XP3'|'XP4'|'XPA'|'XPB'|'XPC'|'XPD'|'XPE'|'XPF'|'XPG'|'XPH'|'XPI'|'XPJ'|'XPK'|'XPL'|'XPM'|'XPN'|'XPO'|'XPP'|'XPQ'|'XPR'|'XPS'|'XPT'|'XPU'|'XPV'|'XPW'|'XPX'|'XPY'|'XPZ'|'XQA'|'XQB'|'XQC'|'XQD'|'XQE'|'XQF'|'XQG'|'XQH'|'XQI'|'XQJ'|'XQK'|'XQL'|'XQM'|'XQN'|'XQO'|'XQP'|'XQQ'|'XQR'|'XQS'|'XRD'|'XRE'|'XRF'|'XRG'|'XRH'|'XRI'|'XRJ'|'XRK'|'XRL'|'XRM'|'XRN'|'XRO'|'XRP'|'XRQ'|'XRR'|'XRS'|'XRT'|'XRU'|'XRV'|'XRW'|'XRX'|'XRY'|'XRZ'|'XSA'|'XSB'|'XSC'|'XSD'|'XSE'|'XSF'|'XSG'|'XSH'|'XSI'|'XSJ'|'XSK'|'XSL'|'XSM'|'XSN'|'XSO'|'XSP'|'XSQ'|'XSR'|'XSS'|'XST'|'XSU'|'XSV'|'XSW'|'XSX'|'XSY'|'XSZ'|'XTA'|'XTB'|'XTC'|'XTD'|'XTE'|'XTF'|'XTG'|'XTI'|'XTJ'|'XTK'|'XTL'|'XTM'|'XTN'|'XTO'|'XTR'|'XTS'|'XTT'|'XTU'|'XTV'|'XTW'|'XTX'|'XTY'|'XTZ'|'XUC'|'XUN'|'XVA'|'XVG'|'XVI'|'XVK'|'XVL'|'XVN'|'XVO'|'XVP'|'XVQ'|'XVR'|'XVS'|'XVY'|'XWA'|'XWB'|'XWC'|'XWD'|'XWF'|'XWG'|'XWH'|'XWJ'|'XWK'|'XWL'|'XWM'|'XWN'|'XWP'|'XWQ'|'XWR'|'XWS'|'XWT'|'XWU'|'XWV'|'XWW'|'XWX'|'XWY'|'XWZ'|'XXA'|'XXB'|'XXC'|'XXD'|'XXF'|'XXG'|'XXH'|'XXJ'|'XXK'|'XYA'|'XYB'|'XYC'|'XYD'|'XYF'|'XYG'|'XYH'|'XYJ'|'XYK'|'XYL'|'XYM'|'XYN'|'XYP'|'XYQ'|'XYR'|'XYS'|'XYT'|'XYV'|'XYW'|'XYX'|'XYY'|'XYZ'|'XZA'|'XZB'|'XZC'|'XZD'|'XZF'|'XZG'|'XZH'|'XZJ'|'XZK'|'XZL'|'XZM'|'XZN'|'XZP'|'XZQ'|'XZR'|'XZS'|'XZT'|'XZU'|'XZV'|'XZW'|'XZX'|'XZY'|'XZZ'|'ZZ'|'NAR'|'C62'|'LTR'|'H87'|UnitOfMeasureCode|null, + * unitPrice?: float|string|null, + * }>, + * note?: string|null, + * paymentDetails?: list|null, + * paymentTerm?: string|null, + * previousUnpaidBalance?: float|string|null, + * purchaseOrder?: string|null, + * remittanceAddress?: string|null, + * remittanceAddressRecipient?: string|null, + * serviceAddress?: string|null, + * serviceAddressRecipient?: string|null, + * serviceEndDate?: string|\DateTimeInterface|null, + * serviceStartDate?: string|\DateTimeInterface|null, + * shippingAddress?: string|null, + * shippingAddressRecipient?: string|null, + * state?: 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState, + * subtotal?: float|string|null, + * taxCode?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|ValidateValidateJsonParams\TaxCode, + * taxDetails?: list|null, + * totalDiscount?: float|string|null, + * totalTax?: float|string|null, + * vatex?: value-of, + * vatexNote?: string|null, + * vendorAddress?: string|null, + * vendorAddressRecipient?: string|null, + * vendorCompanyID?: string|null, + * vendorEmail?: string|null, + * vendorName?: string|null, + * vendorTaxID?: string|null, + * }|ValidateValidateJsonParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function validateJson( + array|ValidateValidateJsonParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = ValidateValidateJsonParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'api/validate/json', + body: (object) $parsed, + options: $options, + convert: UblDocumentValidation::class, + ); + } + + /** + * @api + * + * Validate if a Peppol ID exists in the Peppol network and retrieve supported document types. The peppol_id must be in the form of `:`. The scheme is a 4-digit code representing the identifier scheme, and the id is the actual identifier value. For example, for a Belgian company it is `0208:0123456789` (where 0208 is the scheme for Belgian enterprises, followed by the 10 digits of the official BTW / KBO number). + * + * @param array{peppolID: string}|ValidateValidatePeppolIDParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function validatePeppolID( + array|ValidateValidatePeppolIDParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = ValidateValidatePeppolIDParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'api/validate/peppol-id', + query: Util::array_transform_keys($parsed, ['peppolID' => 'peppol_id']), + options: $options, + convert: ValidateValidatePeppolIDResponse::class, + ); + } + + /** + * @api + * + * Validate the correctness of a UBL document + * + * @param array{file: string}|ValidateValidateUblParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function validateUbl( + array|ValidateValidateUblParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = ValidateValidateUblParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'api/validate/ubl', + headers: ['Content-Type' => 'multipart/form-data'], + body: (object) $parsed, + options: $options, + convert: UblDocumentValidation::class, + ); + } +} diff --git a/src/Services/ValidateService.php b/src/Services/ValidateService.php index 0071cb0e..85608ec6 100644 --- a/src/Services/ValidateService.php +++ b/src/Services/ValidateService.php @@ -5,9 +5,7 @@ namespace EInvoiceAPI\Services; use EInvoiceAPI\Client; -use EInvoiceAPI\Core\Contracts\BaseResponse; use EInvoiceAPI\Core\Exceptions\APIException; -use EInvoiceAPI\Core\Util; use EInvoiceAPI\Documents\CurrencyCode; use EInvoiceAPI\Documents\DocumentAttachmentCreate; use EInvoiceAPI\Documents\DocumentDirection; @@ -18,131 +16,244 @@ use EInvoiceAPI\RequestOptions; use EInvoiceAPI\ServiceContracts\ValidateContract; use EInvoiceAPI\Validate\UblDocumentValidation; -use EInvoiceAPI\Validate\ValidateValidateJsonParams; use EInvoiceAPI\Validate\ValidateValidateJsonParams\Allowance\ReasonCode; use EInvoiceAPI\Validate\ValidateValidateJsonParams\Allowance\TaxCode; use EInvoiceAPI\Validate\ValidateValidateJsonParams\Vatex; -use EInvoiceAPI\Validate\ValidateValidatePeppolIDParams; use EInvoiceAPI\Validate\ValidateValidatePeppolIDResponse; -use EInvoiceAPI\Validate\ValidateValidateUblParams; final class ValidateService implements ValidateContract { + /** + * @api + */ + public ValidateRawService $raw; + /** * @internal */ - public function __construct(private Client $client) {} + public function __construct(private Client $client) + { + $this->raw = new ValidateRawService($client); + } /** * @api * * Validate if the JSON document can be converted to a valid UBL document * - * @param array{ + * @param list|null $allowances + * @param float|string|null $amountDue The amount due for payment. Must be positive and rounded to maximum 2 decimals + * @param list|null $attachments + * @param string|null $billingAddress The billing address (if different from customer address) + * @param string|null $billingAddressRecipient The recipient name at the billing address + * @param list|null $charges + * @param 'EUR'|'USD'|'GBP'|'JPY'|'CHF'|'CAD'|'AUD'|'NZD'|'CNY'|'INR'|'SEK'|'NOK'|'DKK'|'SGD'|'HKD'|CurrencyCode $currency Currency of the invoice (ISO 4217 currency code) + * @param string|null $customerAddress The address of the customer/buyer + * @param string|null $customerAddressRecipient The recipient name at the customer address + * @param string|null $customerCompanyID Customer company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. + * @param string|null $customerEmail The email address of the customer + * @param string|null $customerID The unique identifier for the customer in your system + * @param string|null $customerName The company name of the customer/buyer + * @param string|null $customerTaxID Customer tax ID. For Belgium this is the VAT number. Must include the country prefix + * @param 'INBOUND'|'OUTBOUND'|DocumentDirection $direction The direction of the document: INBOUND (purchases) or OUTBOUND (sales) + * @param 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType $documentType The type of document: INVOICE, CREDIT_NOTE, or DEBIT_NOTE + * @param string|\DateTimeInterface|null $dueDate The date when payment is due + * @param string|\DateTimeInterface|null $invoiceDate The date when the invoice was issued + * @param string|null $invoiceID The unique invoice identifier/number + * @param float|string|null $invoiceTotal The total amount of the invoice including tax (invoice_total = subtotal + total_tax + total_discount). Must be positive and rounded to maximum 2 decimals + * @param list|null, - * amountDue?: float|string|null, - * attachments?: list|null, - * billingAddress?: string|null, - * billingAddressRecipient?: string|null, + * amount?: float|string|null, * charges?: list|null, - * currency?: value-of, - * customerAddress?: string|null, - * customerAddressRecipient?: string|null, - * customerCompanyID?: string|null, - * customerEmail?: string|null, - * customerID?: string|null, - * customerName?: string|null, - * customerTaxID?: string|null, - * direction?: 'INBOUND'|'OUTBOUND'|DocumentDirection, - * documentType?: 'INVOICE'|'CREDIT_NOTE'|'DEBIT_NOTE'|DocumentType, - * dueDate?: string|\DateTimeInterface|null, - * invoiceDate?: string|\DateTimeInterface|null, - * invoiceID?: string|null, - * invoiceTotal?: float|string|null, - * items?: list>|null, - * amount?: float|string|null, - * charges?: list>|null, - * date?: null|null, - * description?: string|null, - * productCode?: string|null, - * quantity?: float|string|null, - * tax?: float|string|null, - * taxRate?: float|string|null, - * unit?: '10'|'11'|'13'|'14'|'15'|'20'|'21'|'22'|'23'|'24'|'25'|'27'|'28'|'33'|'34'|'35'|'37'|'38'|'40'|'41'|'56'|'57'|'58'|'59'|'60'|'61'|'74'|'77'|'80'|'81'|'85'|'87'|'89'|'91'|'1I'|'EA'|'E01'|'E07'|'E09'|'E10'|'E12'|'E14'|'E17'|'E20'|'E23'|'E25'|'E27'|'E31'|'E34'|'E35'|'E36'|'E37'|'E38'|'E39'|'E40'|'E41'|'E42'|'E43'|'E44'|'E45'|'E46'|'E47'|'E48'|'E49'|'E50'|'E51'|'E52'|'E53'|'E54'|'E55'|'E56'|'E57'|'E58'|'E60'|'E62'|'E65'|'E66'|'E67'|'E69'|'E70'|'E71'|'E73'|'E75'|'E76'|'2A'|'2B'|'2C'|'2G'|'2H'|'2I'|'2J'|'2K'|'2L'|'2M'|'2N'|'2P'|'2Q'|'2R'|'2U'|'2X'|'2Y'|'2Z'|'3B'|'3C'|'4C'|'4G'|'4H'|'4K'|'4L'|'4M'|'4N'|'4O'|'4P'|'4Q'|'4R'|'4T'|'4U'|'4W'|'4X'|'5A'|'5B'|'5E'|'5J'|'A10'|'A11'|'A12'|'A13'|'A14'|'A15'|'A16'|'A17'|'A18'|'A19'|'A2'|'A20'|'A21'|'A22'|'A23'|'A24'|'A26'|'A27'|'A28'|'A29'|'A3'|'A30'|'A31'|'A32'|'A33'|'A34'|'A35'|'A36'|'A37'|'A38'|'A39'|'A4'|'A40'|'A41'|'A42'|'A43'|'A44'|'A45'|'A46'|'A47'|'A48'|'A49'|'A5'|'A50'|'A51'|'A52'|'A53'|'A54'|'A55'|'A56'|'A57'|'A58'|'A59'|'A6'|'A60'|'A61'|'A62'|'A63'|'A64'|'A65'|'A66'|'A67'|'A68'|'A69'|'A7'|'A70'|'A71'|'A72'|'A73'|'A74'|'A75'|'A76'|'A77'|'A78'|'A79'|'A8'|'A80'|'A81'|'A82'|'A83'|'A84'|'A85'|'A86'|'A87'|'A88'|'A89'|'A9'|'A90'|'A91'|'A92'|'A93'|'A94'|'A95'|'A96'|'A97'|'A98'|'A99'|'ACR'|'AH'|'AI'|'AK'|'AMH'|'AMT'|'ANN'|'B1'|'B11'|'B12'|'B13'|'B14'|'B15'|'B16'|'B17'|'B18'|'B19'|'B20'|'B21'|'B22'|'B23'|'B24'|'B25'|'B26'|'B27'|'B28'|'B29'|'B3'|'B30'|'B31'|'B32'|'B33'|'B34'|'B35'|'B36'|'B37'|'B38'|'B39'|'B4'|'B40'|'B41'|'B42'|'B43'|'B44'|'B45'|'B46'|'B47'|'B48'|'B49'|'B5'|'B50'|'B52'|'B53'|'B54'|'B55'|'B56'|'B57'|'B58'|'B59'|'B6'|'B60'|'B61'|'B62'|'B63'|'B64'|'B65'|'B66'|'B67'|'B68'|'B69'|'B7'|'B70'|'B71'|'B72'|'B73'|'B74'|'B75'|'B76'|'B77'|'B78'|'B79'|'B8'|'B80'|'B81'|'B82'|'B83'|'B84'|'B85'|'B86'|'B87'|'B88'|'B89'|'B9'|'B90'|'B91'|'B92'|'B93'|'B94'|'B95'|'B96'|'B97'|'B98'|'B99'|'BAR'|'BB'|'BFT'|'BHP'|'BIL'|'BLD'|'BLL'|'BUA'|'BUI'|'C0'|'C10'|'C11'|'C12'|'C13'|'C14'|'C15'|'C16'|'C17'|'C18'|'C19'|'C20'|'C21'|'C22'|'C23'|'C24'|'C25'|'C26'|'C27'|'C28'|'C29'|'C30'|'C31'|'C32'|'C33'|'C34'|'C35'|'C36'|'C37'|'C38'|'C39'|'C40'|'C41'|'C42'|'C43'|'C44'|'C45'|'C46'|'C47'|'C48'|'C49'|'C50'|'C51'|'C52'|'C53'|'C54'|'C55'|'C56'|'C57'|'C58'|'C59'|'C60'|'C61'|'C63'|'C64'|'C65'|'C66'|'C67'|'C68'|'C69'|'C70'|'C71'|'C72'|'C73'|'C74'|'C75'|'C76'|'C77'|'C78'|'C79'|'C80'|'C81'|'C82'|'C83'|'C84'|'C85'|'C86'|'C87'|'C88'|'C89'|'C90'|'C91'|'C92'|'C93'|'C94'|'C95'|'C96'|'C97'|'C98'|'C99'|'CDL'|'CEL'|'CHU'|'CIU'|'CLT'|'CMK'|'CMQ'|'CMT'|'CNP'|'CNT'|'COU'|'CTG'|'CTN'|'CUR'|'CWA'|'CWI'|'DAN'|'DAY'|'DB'|'DD'|'DG'|'DI'|'DLT'|'DMK'|'DMQ'|'DMT'|'DPC'|'DPT'|'DRA'|'DZN'|'DZP'|'FOT'|'GLL'|'GLI'|'GRM'|'GRO'|'HUR'|'HTZ'|'INH'|'KGM'|'KMT'|'MTR'|'SMI'|'MIN'|'MON'|'ONZ'|'LBR'|'QT'|'SEC'|'FTK'|'INK'|'MTK'|'YDK'|'TNE'|'VLT'|'WTT'|'YRD'|'FTQ'|'INQ'|'MTQ'|'YDQ'|'HAR'|'KLT'|'MLT'|'MMT'|'KMK'|'MMK'|'XAA'|'XAB'|'XAC'|'XAD'|'XAE'|'XAF'|'XAG'|'XAH'|'XAI'|'XAJ'|'XAL'|'XAM'|'XAP'|'XAT'|'XAV'|'XB4'|'XBA'|'XBB'|'XBC'|'XBD'|'XBE'|'XBF'|'XBG'|'XBH'|'XBI'|'XBJ'|'XBK'|'XBL'|'XBM'|'XBN'|'XBO'|'XBP'|'XBQ'|'XBR'|'XBS'|'XBT'|'XBU'|'XBV'|'XBW'|'XBX'|'XBY'|'XBZ'|'XCA'|'XCB'|'XCC'|'XCD'|'XCE'|'XCF'|'XCG'|'XCH'|'XCI'|'XCJ'|'XCK'|'XCL'|'XCM'|'XCN'|'XCO'|'XCP'|'XCQ'|'XCR'|'XCS'|'XCT'|'XCU'|'XCV'|'XCW'|'XCX'|'XCY'|'XCZ'|'XDA'|'XDB'|'XDC'|'XDD'|'XDE'|'XDF'|'XDG'|'XDH'|'XDI'|'XDJ'|'XDK'|'XDL'|'XDM'|'XDN'|'XDP'|'XDQ'|'XDR'|'XDS'|'XDT'|'XDU'|'XDV'|'XDW'|'XDX'|'XDY'|'XDZ'|'XEA'|'XEB'|'XEC'|'XED'|'XEE'|'XEF'|'XEG'|'XEH'|'XEI'|'XEJ'|'XEK'|'XEL'|'XEM'|'XEN'|'XEP'|'XEQ'|'XER'|'XES'|'XET'|'XEU'|'XEV'|'XEW'|'XEX'|'XEY'|'XFB'|'XFC'|'XFD'|'XFE'|'XFF'|'XFG'|'XFH'|'XFI'|'XFJ'|'XFK'|'XFL'|'XFM'|'XFN'|'XFO'|'XFP'|'XFQ'|'XFR'|'XFS'|'XFT'|'XFU'|'XFV'|'XFW'|'XFX'|'XFY'|'XFZ'|'XGA'|'XGB'|'XGC'|'XGD'|'XGE'|'XGF'|'XGG'|'XGH'|'XGI'|'XGJ'|'XGK'|'XGL'|'XGM'|'XGN'|'XGO'|'XGP'|'XGQ'|'XGR'|'XGS'|'XGT'|'XGU'|'XGV'|'XGW'|'XGX'|'XGY'|'XGZ'|'XHA'|'XHB'|'XHC'|'XHD'|'XHE'|'XHF'|'XHG'|'XHH'|'XHI'|'XHJ'|'XHK'|'XHL'|'XHM'|'XHN'|'XHP'|'XHQ'|'XHR'|'XHS'|'XHT'|'XHU'|'XHV'|'XHW'|'XHX'|'XHY'|'XHZ'|'XIA'|'XIB'|'XIC'|'XID'|'XIE'|'XIF'|'XIG'|'XIH'|'XII'|'XIJ'|'XIK'|'XIL'|'XIM'|'XIN'|'XIO'|'XJA'|'XJB'|'XJC'|'XJD'|'XJE'|'XJF'|'XJG'|'XJH'|'XJI'|'XJJ'|'XJK'|'XJL'|'XJM'|'XJN'|'XJO'|'XJP'|'XJQ'|'XJR'|'XJS'|'XJT'|'XJU'|'XJV'|'XJW'|'XJX'|'XJY'|'XJZ'|'XLA'|'XLB'|'XLC'|'XLD'|'XLE'|'XLF'|'XLG'|'XLH'|'XLI'|'XLJ'|'XLK'|'XLL'|'XLM'|'XLN'|'XLO'|'XLP'|'XLQ'|'XLR'|'XLS'|'XLT'|'XLU'|'XLV'|'XLW'|'XLX'|'XLY'|'XLZ'|'XMA'|'XMB'|'XMC'|'XMD'|'XME'|'XMF'|'XMG'|'XMH'|'XMI'|'XMJ'|'XMK'|'XML'|'XMM'|'XMN'|'XMO'|'XMP'|'XMQ'|'XMR'|'XMS'|'XMT'|'XMU'|'XMV'|'XMW'|'XMX'|'XMY'|'XMZ'|'XNA'|'XNB'|'XNC'|'XND'|'XNE'|'XNF'|'XNG'|'XNH'|'XNI'|'XNJ'|'XNK'|'XNL'|'XNM'|'XOA'|'XOB'|'XOC'|'XOD'|'XOE'|'XOF'|'XOG'|'XOH'|'XOI'|'XOJ'|'XOK'|'XOL'|'XOM'|'XON'|'XOO'|'XOP'|'XOQ'|'XOR'|'XOS'|'XOT'|'XOU'|'XOV'|'XOW'|'XOX'|'XOY'|'XOZ'|'XP1'|'XP2'|'XP3'|'XP4'|'XPA'|'XPB'|'XPC'|'XPD'|'XPE'|'XPF'|'XPG'|'XPH'|'XPI'|'XPJ'|'XPK'|'XPL'|'XPM'|'XPN'|'XPO'|'XPP'|'XPQ'|'XPR'|'XPS'|'XPT'|'XPU'|'XPV'|'XPW'|'XPX'|'XPY'|'XPZ'|'XQA'|'XQB'|'XQC'|'XQD'|'XQE'|'XQF'|'XQG'|'XQH'|'XQI'|'XQJ'|'XQK'|'XQL'|'XQM'|'XQN'|'XQO'|'XQP'|'XQQ'|'XQR'|'XQS'|'XRD'|'XRE'|'XRF'|'XRG'|'XRH'|'XRI'|'XRJ'|'XRK'|'XRL'|'XRM'|'XRN'|'XRO'|'XRP'|'XRQ'|'XRR'|'XRS'|'XRT'|'XRU'|'XRV'|'XRW'|'XRX'|'XRY'|'XRZ'|'XSA'|'XSB'|'XSC'|'XSD'|'XSE'|'XSF'|'XSG'|'XSH'|'XSI'|'XSJ'|'XSK'|'XSL'|'XSM'|'XSN'|'XSO'|'XSP'|'XSQ'|'XSR'|'XSS'|'XST'|'XSU'|'XSV'|'XSW'|'XSX'|'XSY'|'XSZ'|'XTA'|'XTB'|'XTC'|'XTD'|'XTE'|'XTF'|'XTG'|'XTI'|'XTJ'|'XTK'|'XTL'|'XTM'|'XTN'|'XTO'|'XTR'|'XTS'|'XTT'|'XTU'|'XTV'|'XTW'|'XTX'|'XTY'|'XTZ'|'XUC'|'XUN'|'XVA'|'XVG'|'XVI'|'XVK'|'XVL'|'XVN'|'XVO'|'XVP'|'XVQ'|'XVR'|'XVS'|'XVY'|'XWA'|'XWB'|'XWC'|'XWD'|'XWF'|'XWG'|'XWH'|'XWJ'|'XWK'|'XWL'|'XWM'|'XWN'|'XWP'|'XWQ'|'XWR'|'XWS'|'XWT'|'XWU'|'XWV'|'XWW'|'XWX'|'XWY'|'XWZ'|'XXA'|'XXB'|'XXC'|'XXD'|'XXF'|'XXG'|'XXH'|'XXJ'|'XXK'|'XYA'|'XYB'|'XYC'|'XYD'|'XYF'|'XYG'|'XYH'|'XYJ'|'XYK'|'XYL'|'XYM'|'XYN'|'XYP'|'XYQ'|'XYR'|'XYS'|'XYT'|'XYV'|'XYW'|'XYX'|'XYY'|'XYZ'|'XZA'|'XZB'|'XZC'|'XZD'|'XZF'|'XZG'|'XZH'|'XZJ'|'XZK'|'XZL'|'XZM'|'XZN'|'XZP'|'XZQ'|'XZR'|'XZS'|'XZT'|'XZU'|'XZV'|'XZW'|'XZX'|'XZY'|'XZZ'|'ZZ'|'NAR'|'C62'|'LTR'|'H87'|UnitOfMeasureCode|null, - * unitPrice?: float|string|null, - * }>, - * note?: string|null, - * paymentDetails?: list|null, - * paymentTerm?: string|null, - * previousUnpaidBalance?: float|string|null, - * purchaseOrder?: string|null, - * remittanceAddress?: string|null, - * remittanceAddressRecipient?: string|null, - * serviceAddress?: string|null, - * serviceAddressRecipient?: string|null, - * serviceEndDate?: string|\DateTimeInterface|null, - * serviceStartDate?: string|\DateTimeInterface|null, - * shippingAddress?: string|null, - * shippingAddressRecipient?: string|null, - * state?: 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState, - * subtotal?: float|string|null, - * taxCode?: 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|ValidateValidateJsonParams\TaxCode, - * taxDetails?: list|null, - * totalDiscount?: float|string|null, - * totalTax?: float|string|null, - * vatex?: value-of, - * vatexNote?: string|null, - * vendorAddress?: string|null, - * vendorAddressRecipient?: string|null, - * vendorCompanyID?: string|null, - * vendorEmail?: string|null, - * vendorName?: string|null, - * vendorTaxID?: string|null, - * }|ValidateValidateJsonParams $params + * date?: null|null, + * description?: string|null, + * productCode?: string|null, + * quantity?: float|string|null, + * tax?: float|string|null, + * taxRate?: float|string|null, + * unit?: '10'|'11'|'13'|'14'|'15'|'20'|'21'|'22'|'23'|'24'|'25'|'27'|'28'|'33'|'34'|'35'|'37'|'38'|'40'|'41'|'56'|'57'|'58'|'59'|'60'|'61'|'74'|'77'|'80'|'81'|'85'|'87'|'89'|'91'|'1I'|'EA'|'E01'|'E07'|'E09'|'E10'|'E12'|'E14'|'E17'|'E20'|'E23'|'E25'|'E27'|'E31'|'E34'|'E35'|'E36'|'E37'|'E38'|'E39'|'E40'|'E41'|'E42'|'E43'|'E44'|'E45'|'E46'|'E47'|'E48'|'E49'|'E50'|'E51'|'E52'|'E53'|'E54'|'E55'|'E56'|'E57'|'E58'|'E60'|'E62'|'E65'|'E66'|'E67'|'E69'|'E70'|'E71'|'E73'|'E75'|'E76'|'2A'|'2B'|'2C'|'2G'|'2H'|'2I'|'2J'|'2K'|'2L'|'2M'|'2N'|'2P'|'2Q'|'2R'|'2U'|'2X'|'2Y'|'2Z'|'3B'|'3C'|'4C'|'4G'|'4H'|'4K'|'4L'|'4M'|'4N'|'4O'|'4P'|'4Q'|'4R'|'4T'|'4U'|'4W'|'4X'|'5A'|'5B'|'5E'|'5J'|'A10'|'A11'|'A12'|'A13'|'A14'|'A15'|'A16'|'A17'|'A18'|'A19'|'A2'|'A20'|'A21'|'A22'|'A23'|'A24'|'A26'|'A27'|'A28'|'A29'|'A3'|'A30'|'A31'|'A32'|'A33'|'A34'|'A35'|'A36'|'A37'|'A38'|'A39'|'A4'|'A40'|'A41'|'A42'|'A43'|'A44'|'A45'|'A46'|'A47'|'A48'|'A49'|'A5'|'A50'|'A51'|'A52'|'A53'|'A54'|'A55'|'A56'|'A57'|'A58'|'A59'|'A6'|'A60'|'A61'|'A62'|'A63'|'A64'|'A65'|'A66'|'A67'|'A68'|'A69'|'A7'|'A70'|'A71'|'A72'|'A73'|'A74'|'A75'|'A76'|'A77'|'A78'|'A79'|'A8'|'A80'|'A81'|'A82'|'A83'|'A84'|'A85'|'A86'|'A87'|'A88'|'A89'|'A9'|'A90'|'A91'|'A92'|'A93'|'A94'|'A95'|'A96'|'A97'|'A98'|'A99'|'ACR'|'AH'|'AI'|'AK'|'AMH'|'AMT'|'ANN'|'B1'|'B11'|'B12'|'B13'|'B14'|'B15'|'B16'|'B17'|'B18'|'B19'|'B20'|'B21'|'B22'|'B23'|'B24'|'B25'|'B26'|'B27'|'B28'|'B29'|'B3'|'B30'|'B31'|'B32'|'B33'|'B34'|'B35'|'B36'|'B37'|'B38'|'B39'|'B4'|'B40'|'B41'|'B42'|'B43'|'B44'|'B45'|'B46'|'B47'|'B48'|'B49'|'B5'|'B50'|'B52'|'B53'|'B54'|'B55'|'B56'|'B57'|'B58'|'B59'|'B6'|'B60'|'B61'|'B62'|'B63'|'B64'|'B65'|'B66'|'B67'|'B68'|'B69'|'B7'|'B70'|'B71'|'B72'|'B73'|'B74'|'B75'|'B76'|'B77'|'B78'|'B79'|'B8'|'B80'|'B81'|'B82'|'B83'|'B84'|'B85'|'B86'|'B87'|'B88'|'B89'|'B9'|'B90'|'B91'|'B92'|'B93'|'B94'|'B95'|'B96'|'B97'|'B98'|'B99'|'BAR'|'BB'|'BFT'|'BHP'|'BIL'|'BLD'|'BLL'|'BUA'|'BUI'|'C0'|'C10'|'C11'|'C12'|'C13'|'C14'|'C15'|'C16'|'C17'|'C18'|'C19'|'C20'|'C21'|'C22'|'C23'|'C24'|'C25'|'C26'|'C27'|'C28'|'C29'|'C30'|'C31'|'C32'|'C33'|'C34'|'C35'|'C36'|'C37'|'C38'|'C39'|'C40'|'C41'|'C42'|'C43'|'C44'|'C45'|'C46'|'C47'|'C48'|'C49'|'C50'|'C51'|'C52'|'C53'|'C54'|'C55'|'C56'|'C57'|'C58'|'C59'|'C60'|'C61'|'C63'|'C64'|'C65'|'C66'|'C67'|'C68'|'C69'|'C70'|'C71'|'C72'|'C73'|'C74'|'C75'|'C76'|'C77'|'C78'|'C79'|'C80'|'C81'|'C82'|'C83'|'C84'|'C85'|'C86'|'C87'|'C88'|'C89'|'C90'|'C91'|'C92'|'C93'|'C94'|'C95'|'C96'|'C97'|'C98'|'C99'|'CDL'|'CEL'|'CHU'|'CIU'|'CLT'|'CMK'|'CMQ'|'CMT'|'CNP'|'CNT'|'COU'|'CTG'|'CTN'|'CUR'|'CWA'|'CWI'|'DAN'|'DAY'|'DB'|'DD'|'DG'|'DI'|'DLT'|'DMK'|'DMQ'|'DMT'|'DPC'|'DPT'|'DRA'|'DZN'|'DZP'|'FOT'|'GLL'|'GLI'|'GRM'|'GRO'|'HUR'|'HTZ'|'INH'|'KGM'|'KMT'|'MTR'|'SMI'|'MIN'|'MON'|'ONZ'|'LBR'|'QT'|'SEC'|'FTK'|'INK'|'MTK'|'YDK'|'TNE'|'VLT'|'WTT'|'YRD'|'FTQ'|'INQ'|'MTQ'|'YDQ'|'HAR'|'KLT'|'MLT'|'MMT'|'KMK'|'MMK'|'XAA'|'XAB'|'XAC'|'XAD'|'XAE'|'XAF'|'XAG'|'XAH'|'XAI'|'XAJ'|'XAL'|'XAM'|'XAP'|'XAT'|'XAV'|'XB4'|'XBA'|'XBB'|'XBC'|'XBD'|'XBE'|'XBF'|'XBG'|'XBH'|'XBI'|'XBJ'|'XBK'|'XBL'|'XBM'|'XBN'|'XBO'|'XBP'|'XBQ'|'XBR'|'XBS'|'XBT'|'XBU'|'XBV'|'XBW'|'XBX'|'XBY'|'XBZ'|'XCA'|'XCB'|'XCC'|'XCD'|'XCE'|'XCF'|'XCG'|'XCH'|'XCI'|'XCJ'|'XCK'|'XCL'|'XCM'|'XCN'|'XCO'|'XCP'|'XCQ'|'XCR'|'XCS'|'XCT'|'XCU'|'XCV'|'XCW'|'XCX'|'XCY'|'XCZ'|'XDA'|'XDB'|'XDC'|'XDD'|'XDE'|'XDF'|'XDG'|'XDH'|'XDI'|'XDJ'|'XDK'|'XDL'|'XDM'|'XDN'|'XDP'|'XDQ'|'XDR'|'XDS'|'XDT'|'XDU'|'XDV'|'XDW'|'XDX'|'XDY'|'XDZ'|'XEA'|'XEB'|'XEC'|'XED'|'XEE'|'XEF'|'XEG'|'XEH'|'XEI'|'XEJ'|'XEK'|'XEL'|'XEM'|'XEN'|'XEP'|'XEQ'|'XER'|'XES'|'XET'|'XEU'|'XEV'|'XEW'|'XEX'|'XEY'|'XFB'|'XFC'|'XFD'|'XFE'|'XFF'|'XFG'|'XFH'|'XFI'|'XFJ'|'XFK'|'XFL'|'XFM'|'XFN'|'XFO'|'XFP'|'XFQ'|'XFR'|'XFS'|'XFT'|'XFU'|'XFV'|'XFW'|'XFX'|'XFY'|'XFZ'|'XGA'|'XGB'|'XGC'|'XGD'|'XGE'|'XGF'|'XGG'|'XGH'|'XGI'|'XGJ'|'XGK'|'XGL'|'XGM'|'XGN'|'XGO'|'XGP'|'XGQ'|'XGR'|'XGS'|'XGT'|'XGU'|'XGV'|'XGW'|'XGX'|'XGY'|'XGZ'|'XHA'|'XHB'|'XHC'|'XHD'|'XHE'|'XHF'|'XHG'|'XHH'|'XHI'|'XHJ'|'XHK'|'XHL'|'XHM'|'XHN'|'XHP'|'XHQ'|'XHR'|'XHS'|'XHT'|'XHU'|'XHV'|'XHW'|'XHX'|'XHY'|'XHZ'|'XIA'|'XIB'|'XIC'|'XID'|'XIE'|'XIF'|'XIG'|'XIH'|'XII'|'XIJ'|'XIK'|'XIL'|'XIM'|'XIN'|'XIO'|'XJA'|'XJB'|'XJC'|'XJD'|'XJE'|'XJF'|'XJG'|'XJH'|'XJI'|'XJJ'|'XJK'|'XJL'|'XJM'|'XJN'|'XJO'|'XJP'|'XJQ'|'XJR'|'XJS'|'XJT'|'XJU'|'XJV'|'XJW'|'XJX'|'XJY'|'XJZ'|'XLA'|'XLB'|'XLC'|'XLD'|'XLE'|'XLF'|'XLG'|'XLH'|'XLI'|'XLJ'|'XLK'|'XLL'|'XLM'|'XLN'|'XLO'|'XLP'|'XLQ'|'XLR'|'XLS'|'XLT'|'XLU'|'XLV'|'XLW'|'XLX'|'XLY'|'XLZ'|'XMA'|'XMB'|'XMC'|'XMD'|'XME'|'XMF'|'XMG'|'XMH'|'XMI'|'XMJ'|'XMK'|'XML'|'XMM'|'XMN'|'XMO'|'XMP'|'XMQ'|'XMR'|'XMS'|'XMT'|'XMU'|'XMV'|'XMW'|'XMX'|'XMY'|'XMZ'|'XNA'|'XNB'|'XNC'|'XND'|'XNE'|'XNF'|'XNG'|'XNH'|'XNI'|'XNJ'|'XNK'|'XNL'|'XNM'|'XOA'|'XOB'|'XOC'|'XOD'|'XOE'|'XOF'|'XOG'|'XOH'|'XOI'|'XOJ'|'XOK'|'XOL'|'XOM'|'XON'|'XOO'|'XOP'|'XOQ'|'XOR'|'XOS'|'XOT'|'XOU'|'XOV'|'XOW'|'XOX'|'XOY'|'XOZ'|'XP1'|'XP2'|'XP3'|'XP4'|'XPA'|'XPB'|'XPC'|'XPD'|'XPE'|'XPF'|'XPG'|'XPH'|'XPI'|'XPJ'|'XPK'|'XPL'|'XPM'|'XPN'|'XPO'|'XPP'|'XPQ'|'XPR'|'XPS'|'XPT'|'XPU'|'XPV'|'XPW'|'XPX'|'XPY'|'XPZ'|'XQA'|'XQB'|'XQC'|'XQD'|'XQE'|'XQF'|'XQG'|'XQH'|'XQI'|'XQJ'|'XQK'|'XQL'|'XQM'|'XQN'|'XQO'|'XQP'|'XQQ'|'XQR'|'XQS'|'XRD'|'XRE'|'XRF'|'XRG'|'XRH'|'XRI'|'XRJ'|'XRK'|'XRL'|'XRM'|'XRN'|'XRO'|'XRP'|'XRQ'|'XRR'|'XRS'|'XRT'|'XRU'|'XRV'|'XRW'|'XRX'|'XRY'|'XRZ'|'XSA'|'XSB'|'XSC'|'XSD'|'XSE'|'XSF'|'XSG'|'XSH'|'XSI'|'XSJ'|'XSK'|'XSL'|'XSM'|'XSN'|'XSO'|'XSP'|'XSQ'|'XSR'|'XSS'|'XST'|'XSU'|'XSV'|'XSW'|'XSX'|'XSY'|'XSZ'|'XTA'|'XTB'|'XTC'|'XTD'|'XTE'|'XTF'|'XTG'|'XTI'|'XTJ'|'XTK'|'XTL'|'XTM'|'XTN'|'XTO'|'XTR'|'XTS'|'XTT'|'XTU'|'XTV'|'XTW'|'XTX'|'XTY'|'XTZ'|'XUC'|'XUN'|'XVA'|'XVG'|'XVI'|'XVK'|'XVL'|'XVN'|'XVO'|'XVP'|'XVQ'|'XVR'|'XVS'|'XVY'|'XWA'|'XWB'|'XWC'|'XWD'|'XWF'|'XWG'|'XWH'|'XWJ'|'XWK'|'XWL'|'XWM'|'XWN'|'XWP'|'XWQ'|'XWR'|'XWS'|'XWT'|'XWU'|'XWV'|'XWW'|'XWX'|'XWY'|'XWZ'|'XXA'|'XXB'|'XXC'|'XXD'|'XXF'|'XXG'|'XXH'|'XXJ'|'XXK'|'XYA'|'XYB'|'XYC'|'XYD'|'XYF'|'XYG'|'XYH'|'XYJ'|'XYK'|'XYL'|'XYM'|'XYN'|'XYP'|'XYQ'|'XYR'|'XYS'|'XYT'|'XYV'|'XYW'|'XYX'|'XYY'|'XYZ'|'XZA'|'XZB'|'XZC'|'XZD'|'XZF'|'XZG'|'XZH'|'XZJ'|'XZK'|'XZL'|'XZM'|'XZN'|'XZP'|'XZQ'|'XZR'|'XZS'|'XZT'|'XZU'|'XZV'|'XZW'|'XZX'|'XZY'|'XZZ'|'ZZ'|'NAR'|'C62'|'LTR'|'H87'|UnitOfMeasureCode|null, + * unitPrice?: float|string|null, + * }> $items At least one line item is required + * @param string|null $note Additional notes or comments for the invoice + * @param list|null $paymentDetails + * @param string|null $paymentTerm The payment terms (e.g., 'Net 30', 'Due on receipt', '2/10 Net 30') + * @param float|string|null $previousUnpaidBalance The previous unpaid balance from prior invoices, if any. Must be positive and rounded to maximum 2 decimals + * @param string|null $purchaseOrder The purchase order reference number + * @param string|null $remittanceAddress The address where payment should be sent or remitted to + * @param string|null $remittanceAddressRecipient The recipient name at the remittance address + * @param string|null $serviceAddress The address where services were performed or goods were delivered + * @param string|null $serviceAddressRecipient The recipient name at the service address + * @param string|\DateTimeInterface|null $serviceEndDate The end date of the service period or delivery period + * @param string|\DateTimeInterface|null $serviceStartDate The start date of the service period or delivery period + * @param string|null $shippingAddress The shipping/delivery address + * @param string|null $shippingAddressRecipient The recipient name at the shipping address + * @param 'DRAFT'|'TRANSIT'|'FAILED'|'SENT'|'RECEIVED'|DocumentState $state The current state of the document: DRAFT, TRANSIT, FAILED, SENT, or RECEIVED + * @param float|string|null $subtotal The taxable base of the invoice. Should be the sum of all line items - allowances (for example commercial discounts) + charges with impact on VAT. Must be positive and rounded to maximum 2 decimals + * @param 'AE'|'E'|'S'|'Z'|'G'|'O'|'K'|'L'|'M'|'B'|\EInvoiceAPI\Validate\ValidateValidateJsonParams\TaxCode $taxCode Tax category code of the invoice (e.g., S for standard rate, Z for zero rate, E for exempt) + * @param list|null $taxDetails + * @param float|string|null $totalDiscount The net financial discount/charge of the invoice (non-VAT charges minus non-VAT allowances). Can be positive (net charge), negative (net discount), or zero. Must be rounded to maximum 2 decimals + * @param float|string|null $totalTax The total tax amount of the invoice. Must be positive and rounded to maximum 2 decimals + * @param 'VATEX-EU-79-C'|'VATEX-EU-132'|'VATEX-EU-132-1A'|'VATEX-EU-132-1B'|'VATEX-EU-132-1C'|'VATEX-EU-132-1D'|'VATEX-EU-132-1E'|'VATEX-EU-132-1F'|'VATEX-EU-132-1G'|'VATEX-EU-132-1H'|'VATEX-EU-132-1I'|'VATEX-EU-132-1J'|'VATEX-EU-132-1K'|'VATEX-EU-132-1L'|'VATEX-EU-132-1M'|'VATEX-EU-132-1N'|'VATEX-EU-132-1O'|'VATEX-EU-132-1P'|'VATEX-EU-132-1Q'|'VATEX-EU-143'|'VATEX-EU-143-1A'|'VATEX-EU-143-1B'|'VATEX-EU-143-1C'|'VATEX-EU-143-1D'|'VATEX-EU-143-1E'|'VATEX-EU-143-1F'|'VATEX-EU-143-1FA'|'VATEX-EU-143-1G'|'VATEX-EU-143-1H'|'VATEX-EU-143-1I'|'VATEX-EU-143-1J'|'VATEX-EU-143-1K'|'VATEX-EU-143-1L'|'VATEX-EU-144'|'VATEX-EU-146-1E'|'VATEX-EU-148'|'VATEX-EU-148-A'|'VATEX-EU-148-B'|'VATEX-EU-148-C'|'VATEX-EU-148-D'|'VATEX-EU-148-E'|'VATEX-EU-148-F'|'VATEX-EU-148-G'|'VATEX-EU-151'|'VATEX-EU-151-1A'|'VATEX-EU-151-1AA'|'VATEX-EU-151-1B'|'VATEX-EU-151-1C'|'VATEX-EU-151-1D'|'VATEX-EU-151-1E'|'VATEX-EU-159'|'VATEX-EU-309'|'VATEX-EU-AE'|'VATEX-EU-D'|'VATEX-EU-F'|'VATEX-EU-G'|'VATEX-EU-I'|'VATEX-EU-IC'|'VATEX-EU-O'|'VATEX-EU-J'|'VATEX-FR-FRANCHISE'|'VATEX-FR-CNWVAT'|Vatex|null $vatex VATEX code list for VAT exemption reasons + * + * Agency: CEF + * Identifier: vatex + * @param string|null $vatexNote Textual explanation for VAT exemption + * @param string|null $vendorAddress The address of the vendor/seller + * @param string|null $vendorAddressRecipient The recipient name at the vendor address + * @param string|null $vendorCompanyID Vendor company ID. For Belgium this is the CBE number or their EUID (European Unique Identifier) number. In the Netherlands this is the KVK number. + * @param string|null $vendorEmail The email address of the vendor + * @param string|null $vendorName The name of the vendor/seller/supplier + * @param string|null $vendorTaxID Vendor tax ID. For Belgium this is the VAT number. Must include the country prefix * * @throws APIException */ public function validateJson( - array|ValidateValidateJsonParams $params, + ?array $allowances = null, + float|string|null $amountDue = null, + ?array $attachments = null, + ?string $billingAddress = null, + ?string $billingAddressRecipient = null, + ?array $charges = null, + string|CurrencyCode|null $currency = null, + ?string $customerAddress = null, + ?string $customerAddressRecipient = null, + ?string $customerCompanyID = null, + ?string $customerEmail = null, + ?string $customerID = null, + ?string $customerName = null, + ?string $customerTaxID = null, + string|DocumentDirection|null $direction = null, + string|DocumentType|null $documentType = null, + string|\DateTimeInterface|null $dueDate = null, + string|\DateTimeInterface|null $invoiceDate = null, + ?string $invoiceID = null, + float|string|null $invoiceTotal = null, + ?array $items = null, + ?string $note = null, + ?array $paymentDetails = null, + ?string $paymentTerm = null, + float|string|null $previousUnpaidBalance = null, + ?string $purchaseOrder = null, + ?string $remittanceAddress = null, + ?string $remittanceAddressRecipient = null, + ?string $serviceAddress = null, + ?string $serviceAddressRecipient = null, + string|\DateTimeInterface|null $serviceEndDate = null, + string|\DateTimeInterface|null $serviceStartDate = null, + ?string $shippingAddress = null, + ?string $shippingAddressRecipient = null, + string|DocumentState|null $state = null, + float|string|null $subtotal = null, + string|\EInvoiceAPI\Validate\ValidateValidateJsonParams\TaxCode $taxCode = 'S', + ?array $taxDetails = null, + float|string|null $totalDiscount = null, + float|string|null $totalTax = null, + string|Vatex|null $vatex = null, + ?string $vatexNote = null, + ?string $vendorAddress = null, + ?string $vendorAddressRecipient = null, + ?string $vendorCompanyID = null, + ?string $vendorEmail = null, + ?string $vendorName = null, + ?string $vendorTaxID = null, ?RequestOptions $requestOptions = null, ): UblDocumentValidation { - [$parsed, $options] = ValidateValidateJsonParams::parseRequest( - $params, - $requestOptions, - ); + $params = [ + 'allowances' => $allowances, + 'amountDue' => $amountDue, + 'attachments' => $attachments, + 'billingAddress' => $billingAddress, + 'billingAddressRecipient' => $billingAddressRecipient, + 'charges' => $charges, + 'currency' => $currency, + 'customerAddress' => $customerAddress, + 'customerAddressRecipient' => $customerAddressRecipient, + 'customerCompanyID' => $customerCompanyID, + 'customerEmail' => $customerEmail, + 'customerID' => $customerID, + 'customerName' => $customerName, + 'customerTaxID' => $customerTaxID, + 'direction' => $direction, + 'documentType' => $documentType, + 'dueDate' => $dueDate, + 'invoiceDate' => $invoiceDate, + 'invoiceID' => $invoiceID, + 'invoiceTotal' => $invoiceTotal, + 'items' => $items, + 'note' => $note, + 'paymentDetails' => $paymentDetails, + 'paymentTerm' => $paymentTerm, + 'previousUnpaidBalance' => $previousUnpaidBalance, + 'purchaseOrder' => $purchaseOrder, + 'remittanceAddress' => $remittanceAddress, + 'remittanceAddressRecipient' => $remittanceAddressRecipient, + 'serviceAddress' => $serviceAddress, + 'serviceAddressRecipient' => $serviceAddressRecipient, + 'serviceEndDate' => $serviceEndDate, + 'serviceStartDate' => $serviceStartDate, + 'shippingAddress' => $shippingAddress, + 'shippingAddressRecipient' => $shippingAddressRecipient, + 'state' => $state, + 'subtotal' => $subtotal, + 'taxCode' => $taxCode, + 'taxDetails' => $taxDetails, + 'totalDiscount' => $totalDiscount, + 'totalTax' => $totalTax, + 'vatex' => $vatex, + 'vatexNote' => $vatexNote, + 'vendorAddress' => $vendorAddress, + 'vendorAddressRecipient' => $vendorAddressRecipient, + 'vendorCompanyID' => $vendorCompanyID, + 'vendorEmail' => $vendorEmail, + 'vendorName' => $vendorName, + 'vendorTaxID' => $vendorTaxID, + ]; + // @phpstan-ignore-next-line function.impossibleType + $params = array_filter($params, callback: static fn ($v) => !is_null($v)); - /** @var BaseResponse */ - $response = $this->client->request( - method: 'post', - path: 'api/validate/json', - body: (object) $parsed, - options: $options, - convert: UblDocumentValidation::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->validateJson(params: $params, requestOptions: $requestOptions); return $response->parse(); } @@ -152,27 +263,18 @@ public function validateJson( * * Validate if a Peppol ID exists in the Peppol network and retrieve supported document types. The peppol_id must be in the form of `:`. The scheme is a 4-digit code representing the identifier scheme, and the id is the actual identifier value. For example, for a Belgian company it is `0208:0123456789` (where 0208 is the scheme for Belgian enterprises, followed by the 10 digits of the official BTW / KBO number). * - * @param array{peppolID: string}|ValidateValidatePeppolIDParams $params + * @param string $peppolID Peppol ID in the format `:`. Example: `0208:1018265814` for a Belgian company. * * @throws APIException */ public function validatePeppolID( - array|ValidateValidatePeppolIDParams $params, - ?RequestOptions $requestOptions = null, + string $peppolID, + ?RequestOptions $requestOptions = null ): ValidateValidatePeppolIDResponse { - [$parsed, $options] = ValidateValidatePeppolIDParams::parseRequest( - $params, - $requestOptions, - ); + $params = ['peppolID' => $peppolID]; - /** @var BaseResponse */ - $response = $this->client->request( - method: 'get', - path: 'api/validate/peppol-id', - query: Util::array_transform_keys($parsed, ['peppolID' => 'peppol_id']), - options: $options, - convert: ValidateValidatePeppolIDResponse::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->validatePeppolID(params: $params, requestOptions: $requestOptions); return $response->parse(); } @@ -182,28 +284,16 @@ public function validatePeppolID( * * Validate the correctness of a UBL document * - * @param array{file: string}|ValidateValidateUblParams $params - * * @throws APIException */ public function validateUbl( - array|ValidateValidateUblParams $params, - ?RequestOptions $requestOptions = null, + string $file, + ?RequestOptions $requestOptions = null ): UblDocumentValidation { - [$parsed, $options] = ValidateValidateUblParams::parseRequest( - $params, - $requestOptions, - ); + $params = ['file' => $file]; - /** @var BaseResponse */ - $response = $this->client->request( - method: 'post', - path: 'api/validate/ubl', - headers: ['Content-Type' => 'multipart/form-data'], - body: (object) $parsed, - options: $options, - convert: UblDocumentValidation::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->validateUbl(params: $params, requestOptions: $requestOptions); return $response->parse(); } diff --git a/src/Services/WebhooksRawService.php b/src/Services/WebhooksRawService.php new file mode 100644 index 00000000..e723a645 --- /dev/null +++ b/src/Services/WebhooksRawService.php @@ -0,0 +1,154 @@ +, url: string, enabled?: bool + * }|WebhookCreateParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function create( + array|WebhookCreateParams $params, + ?RequestOptions $requestOptions = null + ): BaseResponse { + [$parsed, $options] = WebhookCreateParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'api/webhooks/', + body: (object) $parsed, + options: $options, + convert: WebhookResponse::class, + ); + } + + /** + * @api + * + * Get a webhook by ID + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieve( + string $webhookID, + ?RequestOptions $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: ['api/webhooks/%1$s', $webhookID], + options: $requestOptions, + convert: WebhookResponse::class, + ); + } + + /** + * @api + * + * Update a webhook by ID + * + * @param array{ + * enabled?: bool|null, events?: list|null, url?: string|null + * }|WebhookUpdateParams $params + * + * @return BaseResponse + * + * @throws APIException + */ + public function update( + string $webhookID, + array|WebhookUpdateParams $params, + ?RequestOptions $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = WebhookUpdateParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'put', + path: ['api/webhooks/%1$s', $webhookID], + body: (object) $parsed, + options: $options, + convert: WebhookResponse::class, + ); + } + + /** + * @api + * + * Get all webhooks for the current tenant + * + * @return BaseResponse> + * + * @throws APIException + */ + public function list(?RequestOptions $requestOptions = null): BaseResponse + { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'api/webhooks/', + options: $requestOptions, + convert: new ListOf(WebhookResponse::class), + ); + } + + /** + * @api + * + * Delete a webhook + * + * @return BaseResponse + * + * @throws APIException + */ + public function delete( + string $webhookID, + ?RequestOptions $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'delete', + path: ['api/webhooks/%1$s', $webhookID], + options: $requestOptions, + convert: WebhookDeleteResponse::class, + ); + } +} diff --git a/src/Services/WebhooksService.php b/src/Services/WebhooksService.php index 864d4922..bed42833 100644 --- a/src/Services/WebhooksService.php +++ b/src/Services/WebhooksService.php @@ -5,51 +5,48 @@ namespace EInvoiceAPI\Services; use EInvoiceAPI\Client; -use EInvoiceAPI\Core\Contracts\BaseResponse; -use EInvoiceAPI\Core\Conversion\ListOf; use EInvoiceAPI\Core\Exceptions\APIException; use EInvoiceAPI\RequestOptions; use EInvoiceAPI\ServiceContracts\WebhooksContract; -use EInvoiceAPI\Webhooks\WebhookCreateParams; use EInvoiceAPI\Webhooks\WebhookDeleteResponse; use EInvoiceAPI\Webhooks\WebhookResponse; -use EInvoiceAPI\Webhooks\WebhookUpdateParams; final class WebhooksService implements WebhooksContract { + /** + * @api + */ + public WebhooksRawService $raw; + /** * @internal */ - public function __construct(private Client $client) {} + public function __construct(private Client $client) + { + $this->raw = new WebhooksRawService($client); + } /** * @api * * Create a new webhook * - * @param array{ - * events: list, url: string, enabled?: bool - * }|WebhookCreateParams $params + * @param list $events * * @throws APIException */ public function create( - array|WebhookCreateParams $params, - ?RequestOptions $requestOptions = null + array $events, + string $url, + bool $enabled = true, + ?RequestOptions $requestOptions = null, ): WebhookResponse { - [$parsed, $options] = WebhookCreateParams::parseRequest( - $params, - $requestOptions, - ); - - /** @var BaseResponse */ - $response = $this->client->request( - method: 'post', - path: 'api/webhooks/', - body: (object) $parsed, - options: $options, - convert: WebhookResponse::class, - ); + $params = ['events' => $events, 'url' => $url, 'enabled' => $enabled]; + // @phpstan-ignore-next-line function.impossibleType + $params = array_filter($params, callback: static fn ($v) => !is_null($v)); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->create(params: $params, requestOptions: $requestOptions); return $response->parse(); } @@ -65,13 +62,8 @@ public function retrieve( string $webhookID, ?RequestOptions $requestOptions = null ): WebhookResponse { - /** @var BaseResponse */ - $response = $this->client->request( - method: 'get', - path: ['api/webhooks/%1$s', $webhookID], - options: $requestOptions, - convert: WebhookResponse::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieve($webhookID, requestOptions: $requestOptions); return $response->parse(); } @@ -81,30 +73,23 @@ public function retrieve( * * Update a webhook by ID * - * @param array{ - * enabled?: bool|null, events?: list|null, url?: string|null - * }|WebhookUpdateParams $params + * @param list|null $events * * @throws APIException */ public function update( string $webhookID, - array|WebhookUpdateParams $params, + ?bool $enabled = null, + ?array $events = null, + ?string $url = null, ?RequestOptions $requestOptions = null, ): WebhookResponse { - [$parsed, $options] = WebhookUpdateParams::parseRequest( - $params, - $requestOptions, - ); - - /** @var BaseResponse */ - $response = $this->client->request( - method: 'put', - path: ['api/webhooks/%1$s', $webhookID], - body: (object) $parsed, - options: $options, - convert: WebhookResponse::class, - ); + $params = ['enabled' => $enabled, 'events' => $events, 'url' => $url]; + // @phpstan-ignore-next-line function.impossibleType + $params = array_filter($params, callback: static fn ($v) => !is_null($v)); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->update($webhookID, params: $params, requestOptions: $requestOptions); return $response->parse(); } @@ -120,13 +105,8 @@ public function update( */ public function list(?RequestOptions $requestOptions = null): array { - /** @var BaseResponse> */ - $response = $this->client->request( - method: 'get', - path: 'api/webhooks/', - options: $requestOptions, - convert: new ListOf(WebhookResponse::class), - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->list(requestOptions: $requestOptions); return $response->parse(); } @@ -142,13 +122,8 @@ public function delete( string $webhookID, ?RequestOptions $requestOptions = null ): WebhookDeleteResponse { - /** @var BaseResponse */ - $response = $this->client->request( - method: 'delete', - path: ['api/webhooks/%1$s', $webhookID], - options: $requestOptions, - convert: WebhookDeleteResponse::class, - ); + // @phpstan-ignore-next-line argument.type + $response = $this->raw->delete($webhookID, requestOptions: $requestOptions); return $response->parse(); } diff --git a/tests/Services/Documents/AttachmentsTest.php b/tests/Services/Documents/AttachmentsTest.php index a6a0491b..68473222 100644 --- a/tests/Services/Documents/AttachmentsTest.php +++ b/tests/Services/Documents/AttachmentsTest.php @@ -37,7 +37,7 @@ public function testRetrieve(): void $result = $this->client->documents->attachments->retrieve( 'attachment_id', - ['documentID' => 'document_id'] + documentID: 'document_id' ); // @phpstan-ignore-next-line method.alreadyNarrowedType @@ -53,7 +53,7 @@ public function testRetrieveWithOptionalParams(): void $result = $this->client->documents->attachments->retrieve( 'attachment_id', - ['documentID' => 'document_id'] + documentID: 'document_id' ); // @phpstan-ignore-next-line method.alreadyNarrowedType @@ -82,7 +82,7 @@ public function testDelete(): void $result = $this->client->documents->attachments->delete( 'attachment_id', - ['documentID' => 'document_id'] + documentID: 'document_id' ); // @phpstan-ignore-next-line method.alreadyNarrowedType @@ -98,7 +98,7 @@ public function testDeleteWithOptionalParams(): void $result = $this->client->documents->attachments->delete( 'attachment_id', - ['documentID' => 'document_id'] + documentID: 'document_id' ); // @phpstan-ignore-next-line method.alreadyNarrowedType @@ -114,7 +114,7 @@ public function testAdd(): void $result = $this->client->documents->attachments->add( 'document_id', - ['file' => 'file'] + file: 'file' ); // @phpstan-ignore-next-line method.alreadyNarrowedType @@ -130,7 +130,7 @@ public function testAddWithOptionalParams(): void $result = $this->client->documents->attachments->add( 'document_id', - ['file' => 'file'] + file: 'file' ); // @phpstan-ignore-next-line method.alreadyNarrowedType diff --git a/tests/Services/Documents/UblTest.php b/tests/Services/Documents/UblTest.php index 1966cc8a..9b511679 100644 --- a/tests/Services/Documents/UblTest.php +++ b/tests/Services/Documents/UblTest.php @@ -35,7 +35,7 @@ public function testCreateFromUbl(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->documents->ubl->createFromUbl(['file' => 'file']); + $result = $this->client->documents->ubl->createFromUbl(file: 'file'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(DocumentResponse::class, $result); @@ -48,7 +48,7 @@ public function testCreateFromUblWithOptionalParams(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->documents->ubl->createFromUbl(['file' => 'file']); + $result = $this->client->documents->ubl->createFromUbl(file: 'file'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(DocumentResponse::class, $result); diff --git a/tests/Services/DocumentsTest.php b/tests/Services/DocumentsTest.php index e7bee5a6..a3cae784 100644 --- a/tests/Services/DocumentsTest.php +++ b/tests/Services/DocumentsTest.php @@ -37,7 +37,7 @@ public function testCreate(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->documents->create([]); + $result = $this->client->documents->create(); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(DocumentResponse::class, $result); @@ -76,7 +76,7 @@ public function testCreateFromPdf(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->documents->createFromPdf(['file' => 'file']); + $result = $this->client->documents->createFromPdf(file: 'file'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(DocumentNewFromPdfResponse::class, $result); @@ -89,11 +89,11 @@ public function testCreateFromPdfWithOptionalParams(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->documents->createFromPdf([ - 'file' => 'file', - 'customerTaxID' => 'customer_tax_id', - 'vendorTaxID' => 'vendor_tax_id', - ]); + $result = $this->client->documents->createFromPdf( + file: 'file', + customerTaxID: 'customer_tax_id', + vendorTaxID: 'vendor_tax_id', + ); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(DocumentNewFromPdfResponse::class, $result); @@ -106,7 +106,7 @@ public function testSend(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->documents->send('document_id', []); + $result = $this->client->documents->send('document_id'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(DocumentResponse::class, $result); diff --git a/tests/Services/InboxTest.php b/tests/Services/InboxTest.php index a4078ac6..c30bf78a 100644 --- a/tests/Services/InboxTest.php +++ b/tests/Services/InboxTest.php @@ -34,7 +34,7 @@ public function testList(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->inbox->list([]); + $result = $this->client->inbox->list(); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(DocumentsNumberPage::class, $result); @@ -47,7 +47,7 @@ public function testListCreditNotes(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->inbox->listCreditNotes([]); + $result = $this->client->inbox->listCreditNotes(); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(DocumentsNumberPage::class, $result); @@ -60,7 +60,7 @@ public function testListInvoices(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->inbox->listInvoices([]); + $result = $this->client->inbox->listInvoices(); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(DocumentsNumberPage::class, $result); diff --git a/tests/Services/LookupTest.php b/tests/Services/LookupTest.php index 60b47ebd..12403afb 100644 --- a/tests/Services/LookupTest.php +++ b/tests/Services/LookupTest.php @@ -35,7 +35,7 @@ public function testRetrieve(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->lookup->retrieve(['peppolID' => 'peppol_id']); + $result = $this->client->lookup->retrieve(peppolID: 'peppol_id'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(LookupGetResponse::class, $result); @@ -48,7 +48,7 @@ public function testRetrieveWithOptionalParams(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->lookup->retrieve(['peppolID' => 'peppol_id']); + $result = $this->client->lookup->retrieve(peppolID: 'peppol_id'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(LookupGetResponse::class, $result); @@ -61,7 +61,7 @@ public function testRetrieveParticipants(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->lookup->retrieveParticipants(['query' => 'query']); + $result = $this->client->lookup->retrieveParticipants(query: 'query'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(LookupGetParticipantsResponse::class, $result); @@ -74,9 +74,10 @@ public function testRetrieveParticipantsWithOptionalParams(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->lookup->retrieveParticipants([ - 'query' => 'query', 'countryCode' => 'country_code', - ]); + $result = $this->client->lookup->retrieveParticipants( + query: 'query', + countryCode: 'country_code' + ); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(LookupGetParticipantsResponse::class, $result); diff --git a/tests/Services/OutboxTest.php b/tests/Services/OutboxTest.php index ee7a52ce..db8140b4 100644 --- a/tests/Services/OutboxTest.php +++ b/tests/Services/OutboxTest.php @@ -34,7 +34,7 @@ public function testListDraftDocuments(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->outbox->listDraftDocuments([]); + $result = $this->client->outbox->listDraftDocuments(); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(DocumentsNumberPage::class, $result); @@ -47,7 +47,7 @@ public function testListReceivedDocuments(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->outbox->listReceivedDocuments([]); + $result = $this->client->outbox->listReceivedDocuments(); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(DocumentsNumberPage::class, $result); diff --git a/tests/Services/ValidateTest.php b/tests/Services/ValidateTest.php index 2835ddb5..d84835dd 100644 --- a/tests/Services/ValidateTest.php +++ b/tests/Services/ValidateTest.php @@ -35,7 +35,7 @@ public function testValidateJson(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->validate->validateJson([]); + $result = $this->client->validate->validateJson(); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(UblDocumentValidation::class, $result); @@ -48,9 +48,7 @@ public function testValidatePeppolID(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->validate->validatePeppolID([ - 'peppolID' => 'peppol_id', - ]); + $result = $this->client->validate->validatePeppolID(peppolID: 'peppol_id'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(ValidateValidatePeppolIDResponse::class, $result); @@ -63,9 +61,7 @@ public function testValidatePeppolIDWithOptionalParams(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->validate->validatePeppolID([ - 'peppolID' => 'peppol_id', - ]); + $result = $this->client->validate->validatePeppolID(peppolID: 'peppol_id'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(ValidateValidatePeppolIDResponse::class, $result); @@ -78,7 +74,7 @@ public function testValidateUbl(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->validate->validateUbl(['file' => 'file']); + $result = $this->client->validate->validateUbl(file: 'file'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(UblDocumentValidation::class, $result); @@ -91,7 +87,7 @@ public function testValidateUblWithOptionalParams(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->validate->validateUbl(['file' => 'file']); + $result = $this->client->validate->validateUbl(file: 'file'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(UblDocumentValidation::class, $result); diff --git a/tests/Services/WebhooksTest.php b/tests/Services/WebhooksTest.php index 23f8283e..c2f4b9a0 100644 --- a/tests/Services/WebhooksTest.php +++ b/tests/Services/WebhooksTest.php @@ -35,9 +35,10 @@ public function testCreate(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->webhooks->create([ - 'events' => ['string'], 'url' => 'https://example.com', - ]); + $result = $this->client->webhooks->create( + events: ['string'], + url: 'https://example.com' + ); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(WebhookResponse::class, $result); @@ -50,9 +51,11 @@ public function testCreateWithOptionalParams(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->webhooks->create([ - 'events' => ['string'], 'url' => 'https://example.com', 'enabled' => true, - ]); + $result = $this->client->webhooks->create( + events: ['string'], + url: 'https://example.com', + enabled: true + ); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(WebhookResponse::class, $result); @@ -78,7 +81,7 @@ public function testUpdate(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->webhooks->update('webhook_id', []); + $result = $this->client->webhooks->update('webhook_id'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(WebhookResponse::class, $result); From e2a20ee5fa4bc6830ecfb9484082042ddfc61694 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Dec 2025 03:23:33 +0000 Subject: [PATCH 8/9] chore(internal): improve pagination tests --- tests/Services/InboxTest.php | 28 ++++++++++++++++++++++------ tests/Services/OutboxTest.php | 19 +++++++++++++++---- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/tests/Services/InboxTest.php b/tests/Services/InboxTest.php index c30bf78a..874b2de5 100644 --- a/tests/Services/InboxTest.php +++ b/tests/Services/InboxTest.php @@ -3,6 +3,7 @@ namespace Tests\Services; use EInvoiceAPI\Client; +use EInvoiceAPI\Documents\DocumentResponse; use EInvoiceAPI\DocumentsNumberPage; use PHPUnit\Framework\Attributes\CoversNothing; use PHPUnit\Framework\Attributes\Test; @@ -34,10 +35,15 @@ public function testList(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->inbox->list(); + $page = $this->client->inbox->list(); // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(DocumentsNumberPage::class, $result); + $this->assertInstanceOf(DocumentsNumberPage::class, $page); + + if ($item = $page->getItems()[0] ?? null) { + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(DocumentResponse::class, $item); + } } #[Test] @@ -47,10 +53,15 @@ public function testListCreditNotes(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->inbox->listCreditNotes(); + $page = $this->client->inbox->listCreditNotes(); // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(DocumentsNumberPage::class, $result); + $this->assertInstanceOf(DocumentsNumberPage::class, $page); + + if ($item = $page->getItems()[0] ?? null) { + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(DocumentResponse::class, $item); + } } #[Test] @@ -60,9 +71,14 @@ public function testListInvoices(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->inbox->listInvoices(); + $page = $this->client->inbox->listInvoices(); // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(DocumentsNumberPage::class, $result); + $this->assertInstanceOf(DocumentsNumberPage::class, $page); + + if ($item = $page->getItems()[0] ?? null) { + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(DocumentResponse::class, $item); + } } } diff --git a/tests/Services/OutboxTest.php b/tests/Services/OutboxTest.php index db8140b4..6c3a593c 100644 --- a/tests/Services/OutboxTest.php +++ b/tests/Services/OutboxTest.php @@ -3,6 +3,7 @@ namespace Tests\Services; use EInvoiceAPI\Client; +use EInvoiceAPI\Documents\DocumentResponse; use EInvoiceAPI\DocumentsNumberPage; use PHPUnit\Framework\Attributes\CoversNothing; use PHPUnit\Framework\Attributes\Test; @@ -34,10 +35,15 @@ public function testListDraftDocuments(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->outbox->listDraftDocuments(); + $page = $this->client->outbox->listDraftDocuments(); // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(DocumentsNumberPage::class, $result); + $this->assertInstanceOf(DocumentsNumberPage::class, $page); + + if ($item = $page->getItems()[0] ?? null) { + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(DocumentResponse::class, $item); + } } #[Test] @@ -47,9 +53,14 @@ public function testListReceivedDocuments(): void $this->markTestSkipped('Prism tests are disabled'); } - $result = $this->client->outbox->listReceivedDocuments(); + $page = $this->client->outbox->listReceivedDocuments(); // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(DocumentsNumberPage::class, $result); + $this->assertInstanceOf(DocumentsNumberPage::class, $page); + + if ($item = $page->getItems()[0] ?? null) { + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(DocumentResponse::class, $item); + } } } From c2ab9f8f0189593b95a517ccb54d27f330b83aa5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Dec 2025 03:23:51 +0000 Subject: [PATCH 9/9] release: 0.6.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 23 +++++++++++++++++++++++ src/Client.php | 4 ++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2aca35ae..4208b5cb 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.5.0" + ".": "0.6.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 14c8aab1..4a342386 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## 0.6.0 (2025-12-10) + +Full Changelog: [v0.5.0...v0.6.0](https://github.com/e-invoice-be/e-invoice-php/compare/v0.5.0...v0.6.0) + +### ⚠ BREAKING CHANGES + +* use camel casing for all class properties + +### Features + +* add `BaseResponse` class for accessing raw responses ([ebca89e](https://github.com/e-invoice-be/e-invoice-php/commit/ebca89eaa03eff90dd4ee4435910fb2c0658703e)) +* allow both model class instances and arrays in setters ([f22de1a](https://github.com/e-invoice-be/e-invoice-php/commit/f22de1aa99924f6721be1ab4a593f76e935661b9)) +* split out services into normal & raw types ([e290c64](https://github.com/e-invoice-be/e-invoice-php/commit/e290c6404f5c8db7ebea93902d3e69e54d9d9bf4)) +* use camel casing for all class properties ([9a81036](https://github.com/e-invoice-be/e-invoice-php/commit/9a81036ee96d23c0ab1cc22f68fde1555cb51f56)) + + +### Chores + +* ensure constant values are marked as optional in array types ([9cf1177](https://github.com/e-invoice-be/e-invoice-php/commit/9cf11779ff1e150b328100531e3e52d3f5f4d2ba)) +* **internal:** improve pagination tests ([e2a20ee](https://github.com/e-invoice-be/e-invoice-php/commit/e2a20ee5fa4bc6830ecfb9484082042ddfc61694)) +* switch from `#[Api(optional: true|false)]` to `#[Required]|#[Optional]` for annotations ([e2085d4](https://github.com/e-invoice-be/e-invoice-php/commit/e2085d469c3dac597e44ffc38f3cabef6401e8d3)) +* use `$self = clone $this;` instead of `$obj = clone $this;` ([3d841fa](https://github.com/e-invoice-be/e-invoice-php/commit/3d841fa738d64708d78b6b321b66bf13651c774f)) + ## 0.5.0 (2025-12-05) Full Changelog: [v0.4.1...v0.5.0](https://github.com/e-invoice-be/e-invoice-php/compare/v0.4.1...v0.5.0) diff --git a/src/Client.php b/src/Client.php index d3a8b80b..4037854f 100644 --- a/src/Client.php +++ b/src/Client.php @@ -72,9 +72,9 @@ public function __construct(?string $apiKey = null, ?string $baseUrl = null) headers: [ 'Content-Type' => 'application/json', 'Accept' => 'application/json', - 'User-Agent' => sprintf('e-invoice/PHP %s', '0.5.0'), + 'User-Agent' => sprintf('e-invoice/PHP %s', '0.6.0'), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '0.5.0', + 'X-Stainless-Package-Version' => '0.6.0', 'X-Stainless-OS' => $this->getNormalizedOS(), 'X-Stainless-Arch' => $this->getNormalizedArchitecture(), 'X-Stainless-Runtime' => 'php',