-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Proforma invoice creation return types and series config
The commit introduces a new use statement for CreateProformaInvoiceResponse process and changes return types in ProformaEndpoint class. It also updates the seriesName config reference in the ProformaInvoice constructor and adds a new file for handling API responses. These changes ensure a clearly defined response type when creating a Proforma invoice and proper configuration for its series name.
- Loading branch information
Showing
3 changed files
with
70 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
namespace Ag84ark\SmartBill\ApiResponse; | ||
|
||
use Illuminate\Contracts\Support\Arrayable; | ||
|
||
class CreateProformaInvoiceResponse implements Arrayable | ||
{ | ||
private string $errorText = ''; | ||
private string $message = ''; | ||
|
||
private string $number = ''; | ||
|
||
private string $series = ''; | ||
|
||
private string $url = ''; | ||
|
||
public static function fromArray(array $data): CreateProformaInvoiceResponse | ||
{ | ||
$invoiceResponse = new CreateProformaInvoiceResponse(); | ||
$invoiceResponse->errorText = $data['errorText']; | ||
$invoiceResponse->message = $data['message']; | ||
$invoiceResponse->number = $data['number']; | ||
$invoiceResponse->series = $data['series']; | ||
$invoiceResponse->url = $data['url']; | ||
|
||
return $invoiceResponse; | ||
} | ||
|
||
public function getErrorText(): string | ||
{ | ||
return $this->errorText; | ||
} | ||
|
||
public function getMessage(): string | ||
{ | ||
return $this->message; | ||
} | ||
|
||
public function getNumber(): string | ||
{ | ||
return $this->number; | ||
} | ||
|
||
public function getSeries(): string | ||
{ | ||
return $this->series; | ||
} | ||
|
||
public function getUrl(): string | ||
{ | ||
return $this->url; | ||
} | ||
|
||
public function toArray(): array | ||
{ | ||
return [ | ||
'errorText' => $this->errorText, | ||
'message' => $this->message, | ||
'number' => $this->number, | ||
'series' => $this->series, | ||
'url' => $this->url, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters