Skip to content

Commit

Permalink
Update project namespace and optimize code
Browse files Browse the repository at this point in the history
This commit updates the project namespace from 'Necenzurat' to 'Ag84ark' in various files. At the same time, it introduces some code optimization in several files like 'SmartBillCloudRestClient.php'. Also, beneficial configurations are added to 'smartbill.php' and new classes like 'InvoiceClient' and 'Invoice' under the 'Resources' directory are introduced.
  • Loading branch information
ag84ark committed Jan 23, 2024
1 parent 57e1b77 commit 315ecd2
Show file tree
Hide file tree
Showing 17 changed files with 1,543 additions and 54 deletions.
2 changes: 2 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.

This is a modified version of the original by ag84ark
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Simple SmartBill API integration for Laravel.
You can install the package via composer:

```bash
composer require necenzurat/smartbill
composer require ag84ark/smartbill
```

## Usage
Expand Down Expand Up @@ -61,7 +61,7 @@ $invoice = [
echo 'Emitere factura simpla: ';
try {
$smartbill = new SmartBill();
$output = $smartbill->createInvoice($invoice); //see docs for response
$output = $smartbill->createInvoiceFromArray($invoice); //see docs for response
$invoiceNumber = $output['number'];
$invoiceSeries = $output['series'];
echo $invoiceSeries . $invoiceNumber;
Expand Down
26 changes: 16 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "ahsanshabbir/smartbill",
"name": "ag84ark/smartbill",
"description": "SmartBill API wrapper compatible for Laravel",
"keywords": [
"smartbill",
"invoice"
],
"homepage": "https://github.com/necezurat/smartbill",
"homepage": "https://github.com/ag84ark/smartbill",
"license": "MIT",
"type": "library",
"authors": [
Expand All @@ -18,25 +18,31 @@
"name": "Ahsan Shabbir",
"email": "[email protected]",
"role": "Developer"
},
{
"name": "Cojocaru George",
"email": "[email protected]",
"role": "Developer"
}
],
"require": {
"php" : "^7.2.5|^8.0|^8.1",
"illuminate/support": "~5.8.0|^6.0|^7.0|^8.0|^9.0|^10.0"

"php" : "^7.4|^8.0|^8.1",
"illuminate/support": "~5.8.0|^6.0|^7.0|^8.0|^9.0|^10.0",
"ext-curl": "*",
"ext-json": "*"
},
"require-dev": {
"orchestra/testbench": "3.8.*",
"phpunit/phpunit": "^7.0|^8.1"
"phpunit/phpunit": "^7.0|^8.1|^9.0|^10.0"
},
"autoload": {
"psr-4": {
"Necenzurat\\SmartBill\\": "src"
"Ag84ark\\SmartBill\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Necenzurat\\SmartBill\\Tests\\": "tests"
"Ag84ark\\SmartBill\\Tests\\": "tests"
}
},
"scripts": {
Expand All @@ -50,10 +56,10 @@
"extra": {
"laravel": {
"providers": [
"Necenzurat\\SmartBill\\SmartBillServiceProvider"
"Ag84ark\\SmartBill\\SmartBillServiceProvider"
],
"aliases": {
"SmartBill": "Necenzurat\\SmartBill\\SmartBillFacade"
"SmartBill": "Ag84ark\\SmartBill\\SmartBillFacade"
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions config/smartbill.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,19 @@
'proformaSeries' => 'TEST-PRO',
'receiptSeries' => 'TEST-REC',

'defaultTaxName' => 'Normala',
'defaultTaxPercentage' => 19,
'defaultDueDays' => 30,
'firmaPlatitoareTVA' => true,
'taxNames' => [
'Normala', // 19%
'Redusa', // 9%
'SFDD', // 0%
'SDD', // 0%
'TVA Inclus', // 0%
'Taxare inversa', // 0%
'Redusa locuinte', // 5%
'Veche', // 24%
],

];
11 changes: 11 additions & 0 deletions src/Exceptions/InvalidDateException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Ag84ark\SmartBill\Exceptions;

class InvalidDateException extends \Exception
{
public function __construct(string $date)
{
parent::__construct("Invalid date: {$date}");
}
}
11 changes: 11 additions & 0 deletions src/Exceptions/InvalidPaymentTypeException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Ag84ark\SmartBill\Exceptions;

class InvalidPaymentTypeException extends \Exception
{
public function __construct(string $paymentType)
{
parent::__construct("Invalid payment type: {$paymentType}");
}
}
11 changes: 11 additions & 0 deletions src/Exceptions/InvalidTaxNameException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Ag84ark\SmartBill\Exceptions;

class InvalidTaxNameException extends \Exception
{
public function __construct(string $taxName)
{
parent::__construct("Invalid tax name: {$taxName}");
}
}
24 changes: 24 additions & 0 deletions src/Helpers/DateHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Ag84ark\SmartBill\Helpers;

use Ag84ark\SmartBill\Exceptions\InvalidDateException;

class DateHelper
{
public static function isValidDate(string $date): bool
{
return (bool)strtotime($date);
}

/**
* @throws InvalidDateException
*/
public static function getYMD(string $date): string
{
if (!self::isValidDate($date)) {
throw new InvalidDateException($date);
}
return date('Y-m-d', strtotime($date));
}
}
Loading

0 comments on commit 315ecd2

Please sign in to comment.