diff --git a/app/Http/Resources/AddressEInvoiceResource.php b/app/Http/Resources/AddressEInvoiceResource.php new file mode 100644 index 00000000..cbdabe17 --- /dev/null +++ b/app/Http/Resources/AddressEInvoiceResource.php @@ -0,0 +1,28 @@ + $this->id, + 'street_one' => $this->street_one, + 'street_two' => $this->street_two, + 'district' => $this->district, + 'state' => $this->state, + 'post_code' => (int) $this->postcode, + 'country' => $this->country, + 'billing' => (int) $this->billing + ]; + } +} diff --git a/app/Http/Resources/CompanyModuleResource.php b/app/Http/Resources/CompanyModuleResource.php index 1e54674e..f48cbc43 100644 --- a/app/Http/Resources/CompanyModuleResource.php +++ b/app/Http/Resources/CompanyModuleResource.php @@ -54,8 +54,7 @@ class CompanyModuleResource extends JsonResource 'e_invoice' => $this->company->e_invoice, 'tin' => $this->company->tin, 'msic_code' => $this->company->msic_code, - 'address_einvoice' => $this->company->e_invoice ? new AddressResource($this->when($this->has('addresses'), $this->addresses->where('type', AddressType::E_INVOICE)->sortByDesc('created_at')->first())) : null, - + 'address_einvoice' => $this->company->e_invoice ? new AddressEInvoiceResource($this->when($this->has('addresses'), $this->addresses->where('type', AddressType::E_INVOICE)->sortByDesc('created_at')->first())) : null, ]; } diff --git a/app/Http/Resources/EInvoiceInfoResource.php b/app/Http/Resources/EInvoiceInfoResource.php index 565e86a7..0037edff 100644 --- a/app/Http/Resources/EInvoiceInfoResource.php +++ b/app/Http/Resources/EInvoiceInfoResource.php @@ -20,7 +20,7 @@ class EInvoiceInfoResource extends JsonResource 'street_two' => $this->street_two, 'district' => $this->district, 'state' => $this->state, - 'post_code' => $this->postcode, + 'post_code' => (int) $this->postcode, 'country' => $this->country, 'billing' => (int) $this->billing, 'msic_code' => (int) $this->msic_code,