Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoice number / reference does not comply with some countries #13

Open
rabol opened this issue Mar 9, 2019 · 2 comments
Open

Invoice number / reference does not comply with some countries #13

rabol opened this issue Mar 9, 2019 · 2 comments
Labels
next major release Fixed in the next major release

Comments

@rabol
Copy link

rabol commented Mar 9, 2019

Hi

Package seems to work as described, but the reference or invoice number does not comply with may countries as the number should be a continuous number sequence

It would be nice if one was able to provide a 'InvoiceReferenceGenerator' instead of modifying the code directly.

@sandervanhooft
Copy link
Owner

Thanks for opening this issue.

I agree, we should set the InvoiceReferenceGenerator class in the config and bind it into the container. Can you submit a PR for this?

@rabol
Copy link
Author

rabol commented Mar 18, 2019

Hi

I'm really bad in PR... I don't know how to do it :(

I solved the problem like this:

in the config/invoicable.php i added a new key:

'invoice_reference_generator' => \SanderVanHooft\Invoicable\InvoiceReferenceGenerator::class

in the service provider:

$config = $this->app->config['invoicable'];
$this->app->bind(InvoiceReferenceGenerator::class, $config['invoice_reference_generator']);

and then in the boot of the Invoice class

$model->reference = app()->make(InvoiceReferenceGenerator::class)->generate();

I also increased the table field: reference to 20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next major release Fixed in the next major release
Projects
None yet
Development

No branches or pull requests

2 participants