-
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.
Add Smartbill API exception handling and invoice functionality
Expanded Smartbill API exception to include status code handling and introduced creation of new API responses for invoices. Changes were also made in Invoice, InvoiceEndpoint, ProformaEndpoint and SmartBillCloudRestClient classes to improve exception handling and data return types. A new file, ProformaInvoice, was also introduced. These enhancements improve code reliability and functionality.
- Loading branch information
Showing
8 changed files
with
479 additions
and
31 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 |
---|---|---|
|
@@ -9,4 +9,4 @@ coverage | |
.php_cs.cache | ||
.phpunit.result.cache | ||
.php-cs-fixer.cache | ||
|
||
/.phpactor.json |
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 CreateInvoiceResponse implements Arrayable | ||
{ | ||
private string $errorText = ''; | ||
private string $message = ''; | ||
|
||
private string $number = ''; | ||
|
||
private string $series = ''; | ||
|
||
private string $url = ''; | ||
|
||
public static function fromArray(array $data): CreateInvoiceResponse | ||
{ | ||
$invoiceResponse = new CreateInvoiceResponse(); | ||
$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
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
Oops, something went wrong.