emizoripx / clientfel
Connection to FEL to make invoices for Bolivia
Installs: 1 933
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
- dev-master
- v2.18.5
- v2.18.4
- v2.18.3
- v2.18.2
- v2.18.1
- v2.18.0
- v2.17.0
- v2.16.1
- v2.16.0
- v2.15.6
- v2.15.5
- v2.15.4
- v2.15.3
- v2.15.2
- v2.15.1
- v2.15.0
- v2.14.2
- v2.14.1
- v2.14.0
- v2.13.7
- v2.13.6
- v2.13.5.9
- v2.13.5.8
- v2.13.5.7
- v2.13.5.6
- v2.13.5.5
- v2.13.5.4
- v2.13.5.3
- v2.13.5.2
- v2.13.5.1
- v2.13.5
- v2.13.4.1
- v2.13.4
- v2.13.3.2
- v2.13.3.1
- v2.13.3
- v2.13.2
- v2.13.1
- v2.13.0
- v2.12.6.0
- v2.12.5.0
- v2.12.4.0
- v2.12.3.0
- v2.12.2.1
- v2.12.2.0
- v2.12.1.2
- v2.12.1.1
- v2.12.1.0
- v2.12.0.5
- v2.12.0.4
- v2.12.0.3
- v2.12.0.2
- v2.12.0.1
- v2.12.0
- v2.11.9
- v2.11.8
- v2.11.7
- v2.11.6
- v2.11.5
- v2.11.4
- v2.11.3
- v2.11.2
- v2.11.1
- v2.11.0
- v2.10.0
- v2.9.21
- v2.9.20
- v2.9.19
- v2.9.18
- v2.9.17
- v2.9.16
- v2.9.15
- v2.9.14
- v2.9.13
- v2.9.12
- v2.9.11
- v2.9.10
- v2.9.9
- v2.9.8
- v2.9.7
- v2.9.6
- v2.9.5
- v2.9.4
- v2.9.3
- v2.9.2
- v2.9.1
- v2.9.0
- v2.8.8
- v2.8.7
- v2.8.6
- v2.8.5
- v2.8.4
- v2.8.3
- v2.8.2
- v2.8.1
- v2.8.0
- v2.7.23
- v2.7.22
- v2.7.21
- v2.7.20
- v2.7.19
- v2.7.18
- v2.7.17
- v2.7.16
- v2.7.15
- v2.7.14
- v2.7.13
- v2.7.12
- v2.7.11
- v2.7.10
- v2.7.9
- v2.7.8
- v2.7.7
- v2.7.6
- v2.7.5
- v2.7.4
- v2.7.3
- v2.7.2
- v2.7.1
- v2.7.0
- v2.6.0
- v2.5.30
- v2.5.29
- v2.5.28
- v2.5.27
- v2.5.26
- v2.5.25
- v2.5.24
- v2.5.23
- v2.5.22
- v2.5.21
- v2.5.20
- v2.5.19
- v2.5.18
- v2.5.17
- v2.5.16
- v2.5.15
- v2.5.14
- v2.5.13
- v2.5.12
- v2.5.11
- v2.5.10
- v2.5.9
- v2.5.8
- v2.5.7
- v2.5.6
- v2.5.5
- v2.5.4
- v2.5.3
- v2.5.2
- v2.5.1
- v2.5.0
- v2.4.3
- v2.4.2
- v2.4.1
- v2.4.0
- v2.3.14
- v2.3.12
- v2.3.11
- v2.3.10
- v2.3.9
- v2.3.8
- v2.3.7
- v2.3.6
- v2.3.5
- v2.3.4
- v2.3.3
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.35
- v2.2.34
- v2.2.33
- v2.2.32
- v2.2.31
- v2.2.30
- v2.2.29
- v2.2.28
- v2.2.27
- v2.2.26
- v2.2.25
- v2.2.24
- v2.2.23
- v2.2.22
- v2.2.21
- v2.2.20
- 2.2.19
- v2.2.18
- 2.2.17
- v2.2.16
- v2.2.15
- v2.2.14
- v2.2.13
- v2.2.12
- v2.2.11
- v2.2.10
- v2.2.9
- v2.2.8
- v2.2.7
- v2.2.6
- v2.2.5
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2
- v2.1.14
- v2.1.13
- v2.1.12
- v2.1.11
- v2.1.10
- v2.1.9
- v2.1.8
- v2.1.7
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v1.9.30
- v1.9.29
- v1.9.28
- v1.9.27
- v1.9.26.1-dev
- v1.9.26
- v1.9.25
- v1.9.24
- v1.9.23
- v1.9.22
- v1.9.21
- v1.9.20
- v1.9.19
- v1.9.18
- v1.9.17
- v1.9.16
- v1.9.15
- v1.9.14
- v1.9.13
- v1.9.12
- v1.9.11
- v1.9.10
- v1.9.9
- v1.9.8
- v1.9.7
- v1.9.6
- v1.9.5
- v1.9.4
- v1.9.3
- v1.9.2
- v1.9.1
- v1.9
- v1.8.67
- v1.8.66
- v1.8.65
- v1.8.64
- v1.8.63
- v1.8.62
- v1.8.61
- v1.8.60
- v1.8.59
- v1.8.58
- v1.8.57
- v1.8.56
- v1.8.55
- v1.8.54
- v1.8.53
- v1.8.52
- v1.8.51
- v1.8.50
- v1.8.49
- v1.8.48
- v1.8.47
- v1.8.46
- v1.8.45
- v1.8.44
- v1.8.41
- v1.8.40
- v1.8.39
- v1.8.38
- v1.8.37
- v1.8.36
- v1.8.35
- v1.8.34
- v1.8.33
- v1.8.32
- v1.8.31
- v1.8.30
- v1.8.29
- v1.8.28
- v1.8.27
- v1.8.26
- v1.8.25
- v1.8.24
- v1.8.23
- v1.8.22
- v1.8.21
- v1.8.20
- v1.8.19
- v1.8.18
- v1.8.17
- v1.8.16
- v1.8.15
- v1.8.14
- v1.8.13
- v1.8.12
- v1.8.11
- v1.8.10
- v1.8.9
- v1.8.8
- v1.8.6
- v1.8.5
- v1.8.4
- v1.8.3
- v1.8.2
- v1.8.1
- v1.8.0
- v1.7.17
- v1.7.16
- v1.7.15
- v1.7.14
- v1.7.13
- v1.7.12.1
- v1.7.12
- v1.7.11
- v1.7.10
- v1.7.9
- v1.7.8
- v1.7.7
- v1.7.6
- v1.7.5
- v1.7.4
- v1.7.3
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.5
- v1.6.4
- v1.6.3
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.0
- v1.4.6
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.1
- v1.3.0
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.0
- v1.1.4
- v1.1.3.1
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-develop
- dev-minor-fixes-term
- dev-test-queues
- dev-REFACTOR-BUILDER
- dev-recurring-invoice-number
- dev-fixes-terminal-notas
- dev-fixes-cancellation
- dev-reports-fix-timezone
- dev-develop-changes
- dev-minor-fixes-terminal
- dev-minor-fixes-tecmet
- dev-bio-reports
- dev-document-36
- dev-offline-dev
- dev-certificacion-v43
- dev-excel-reports
- dev-fix-reports-unsdlp
- dev-unsdlp-reports
- dev-reports-biocenter
- dev-document-14
- dev-documento-51
- dev-biocenter-fix
- dev-add-template-pos
- dev-fix-custom-reports
- dev-fix-doc-sector-3
- dev-fixes-reports-emaverde
- dev-upgrade-service
- dev-recurring-educativo
- dev-biocenter-orders
- dev-fix-template
- dev-fixes-pdf
- dev-fixes-terminal
- dev-terminal-tickets
- dev-emaverde-report-pdf
- dev-changes-terminal
- dev-cosin-report
- dev-educativo-zona-franca
- dev-talonarios
- dev-fixes-minexa
- dev-custom-reports
- dev-fix-dashboard
- dev-reduce-resources
- dev-asr-fixes
- dev-changes-user-assigned
- dev-fixes-resources-templates
- dev-document-37
- dev-resource-imsur
- dev-template-imsur
- dev-templates-update
- dev-resource-seguros
- dev-clinicas
- dev-rejected-cancellation
- dev-total-energies-template
- dev-fixes-invoice-resources
- dev-servicios-basicos-template
- dev-hidrocarburos-fixes
- dev-fact-hidrocarburos
- dev-webhook-doc-sector
- dev-change-template
- dev-NOTAS-CONCILIACION
- dev-fixes-servicios-basicos
- dev-FE5-42
- dev-FE5-20
- dev-fixes-emission-invoices
- dev-fixes-whatsapp
- dev-fixes-NCD-template
- dev-fixes-v3.9
- dev-E5-1132
- dev-exportacion-servicios
- dev-telecomunicaciones
- dev-E5-1131
- dev-E5-1129
- dev-fixed-NCD-template
- dev-unipersonal_company
- dev-fixes-develop
- dev-E5-1124
- dev-fixed-type-document
- dev-hotfix
- dev-E5-1119
- dev-E5-1106
- dev-prefactura-implementation
- dev-certificacion_dos
- dev-fixed-v3.1
- dev-pdf-v3.1
- dev-sync-pos
- dev-sin-v2
- dev-minor-fixed-msc
- dev-fixed-package-update
- dev-obs-msc
- dev-E5-1083
- dev-E5-1082
- dev-improvements-creation
- dev-master-v1
- dev-invoice-notification
- dev-fixed-webhook-branch
- dev-fixed-activity-pdf
- dev-e5-1078
- dev-webhook-branch
- dev-fix-codigo-pais
- dev-fixed-webhook
- dev-E5-1020
- dev-E5-952
- dev-E5-927
- dev-e5-877
- dev-E5-906
- dev-e5-879
- dev-E5-831
- dev-E5-833
- dev-E5-821
- dev-patch
- dev-E5-797
- dev-E5-792
- dev-E5-756
This package is auto-updated.
Last update: 2024-09-06 14:23:56 UTC
README
Client for consuming services in FEL, for invoicing
Fresh installation
STEP 1
php artisan migrate
for creating new tables of packagephp artisan vendor:publish
and choose optionEmizorIpx\ClientFel\ClientFelServiceProvider
on the list
STEP 2
- go to
app/config/clientfel.php
and change value of api_url of FEL and routes of class INVOICE , ACCOUNT and PRODUCT - got to
routes/api.php
and insert inside group prefix'api/v1'
use EmizorIpx\ClientFel\routes\Credentials; ... Credentials::routes();
- got to
app/Models/Invoices.php
and adduse InvoiceFelTrait;
- got to
app/Repositories/BaseRepository.php
<?php namespace App\Repositories; //class BaseRepository{ ... # insert here the method that send to fel $model->createInvoiceFel(); # before return // return $model->fresh();
STEP 3
go to App\Http\Requests\Account\CreateAccountRequest
and add the following code:
// public function rules() // { // return [ // //'email' => 'required|string|email|max:100', // 'first_name' => 'string|max:100', // 'last_name' => 'string:max:100', // 'password' => 'required|string|min:6', // 'email' => 'bail|required|email:rfc,dns', // 'email' => new NewUniqueUserRule(), // 'privacy_policy' => 'required', // 'terms_of_service' => 'required', 'client_id' => 'nullable|string|max:100', 'client_secret' => 'nullable|string|max:100' // ]; // }
Update library
- run
composer update emizoripx/clientfel
- if there is some problem remove library
composer remove emizorip/clientfel
- and install it
composer require emizoripx/clientfel
- check if existe methods and routes inserted as above in step 2
API's
-
GET TOKENS
/api/v1/clientfel/getToken/
by default gets ID from company logged in by user{ "token_type": "", "expires_in": "", "settings": "", "access_token": "" }
-
REGISTER CREDENTIALS
/api/v1/clientfel/registerCredentials
additionally it updates the register if account_id is already registered- json :
{ "client_id" : "300001", "client_secret" : "PDAYQ59drtn4wSOxIz9gYfbBNrXx4ibkneKCtk5A"}
after register is executed getToken
- json :
-
REGISTER SETTINGS
/api/v1/clientfel/settings
- json :
{ "setting": { "activity_id": 474000, "caption_id": 45, "payment_method_id": 1 } }
- json :
// This is not available for now, homologate endpoint now is done inside creation of product
-
HOMOLOGATE PRODUCTS
- [POST]
/api/v1/clientfel/homologateProduct
- json :
{ "codigo_producto" : 12, "codigo_producto_sin": 83141, "codigo_unidad" : 1, "nombre_unidad" : "unidad" }
codigo_product_sin must exists in SIN list products
- json :
- [POST]
-
GET PARAMETRICS
- [GET]
/api/v1/clientfel/parametricas/motivo-anulacion
- [GET]
/api/v1/clientfel/parametricas/paises
- [GET]
/api/v1/clientfel/parametricas/tipos-documento-de-identidad
- [GET]
/api/v1/clientfel/parametricas/metodos_de_pago
- [GET]
/api/v1/clientfel/parametricas/monedas
- [GET]
/api/v1/clientfel/parametricas/unidades
- [GET]
/api/v1/clientfel/parametricas/actividades
- [GET]
/api/v1/clientfel/parametricas/leyendas
- [GET]
/api/v1/clientfel/parametricas/productos-sin
- [GET]
-
EMIT INVOICE
- [POST]
/api/v1/clientfel/invoices
json_body : {"id_origin": "xYRdG7dDzO"} , este campo es el id de la tabla invoice respuesta : {"success": true}
- [POST]
-
CHECK FOR ERRORES DESDE LA WEB
- [HOST]
/bitacora
- [HOST]
FEL data appended
-
Data will be appeneded in data response from file
App\Http\Controllers\BaseController;
it is necessary to include as an query argumentinclude_fel_data
with value=true<?php namespace App\Http\Controllers; use EmizorIpx\ClientFel\Utils\Presenter; protected function response($response) { $index = request()->input('index') ?: $this->forced_index; if ($index == 'none') { ... } else { ... $response = Presenter::appendFelData($response, auth()->user()->getCompany()->id); ... } ... return ... }
-
This Appended contains this structure:
{ "data": [], "fel_data": { "invoices": [], "products":[], "clients":[], "parametrics": { "motivo-anulacion": [], "paises": [], "tipos-documento-de-identidad": [], "metodos_de_pago": [], "monedas": [], "unidades":[], "actividades":[], "leyendas":[], } }, "meta": {} }
Added rule to check Product and Client Data
-
Added a rule to validate if the product exists in the validation file
App\Http\Requests\Shop\StoreShopInvoiceRequest;
<?php namespace App\Http\Requests\Shop; ... use EmizorIpx\ClientFel\Http\ValidationRules\Invoice\InvoiceRules; ... class StoreShopInvoiceRequest extends Request{ public function rules() { ... $rules = array_merge($rules, InvoiceRules::additionalInvoiceRules()); return $rules; } ... }
Added rule to validate Client Data
-
Added a rule to validate client data in the validation file
App\Http\Requests\Shop\StoreShopClientRequest;
<?php namespace App\Http\Requests\Shop; ... use EmizorIpx\ClientFel\Http\ValidationRules\Invoice\ClientRules; ... class StoreShopClientRequest extends Request{ public function rules() { ... $rules = array_merge($rules, ClientRules::additionalClientRules()); return $rules; } ... }
Insert additional data in request Shop Invoices
-
Added method to insert required data in shop invoice request in
App\Http\Controllers\Shop\InvoiceController
<?php namespace App\Http\Controllers\Shop; ... use EmizorIpx\ClientFel\Repository\FelInvoiceRequestRepository; ... class InvoiceController extends BaseController{ ... public function store(StoreShopInvoiceRequest $request) { ... $client = Client::find($request->input('client_id')); ... #Add $inputData = FelInvoiceRequestRepository::completeDataRequest($request->all(), $company->id); $request->replace($inputData); $invoice = $this->invoice_repo->save($request->all(), InvoiceFactory::create($company->id, $company->owner()->id)); ... return $this->itemResponse($invoice); } }
Insert additional data in request Shop Client
-
Added method to insert required data in shop client request in
App\Http\Controllers\Shop\ClientController
<?php namespace App\Http\Controllers\Shop; ... use EmizorIpx\ClientFel\Repository\FelClientRepository; ... class ClientController extends BaseController{ ... public function store(StoreShopClientRequest $request) { ... #Add $inputData = FelClientRepository::completeDataRequest($request->all()); $request->replace($inputData); $invoice = $this->invoice_repo->save($request->all(), ClientFactory::create($company->id, $company->owner()->id)); ... return $this->itemResponse($invoice); } }
Trait to emit invoice
-
Added trait to emit invoice in
App\Models\Invoice
<?php namespace App\Models; ... use EmizorIpx\ClientFel\Traits\InvoiceFelEmitTrait; ... class Invoice extends BaseModel { ... use InvoiceFelEmitTrait; ... }
-
Added function to emit invoice in
App\Http\Controllers\Shop\InvoiceController
<?php namespace App\Http\Controllers\Shop; class InvoiceController extends BaseController { public function store(StoreShopInvoiceRequest $request) { ... $invoice = $invoice->service()->triggeredActions($request)->save(); $invoice->emit(); ... return $this->itemResponse($invoice); } }
Added middleware CheckSettings
-
A middleware was added to verify the parametric settings in route shop
<?php use Illuminate\Support\Facades\Route; Route::group(['middleware' => ['company_key_db', 'locale'], 'prefix' => 'api/v1'], function () { ... Route::middleware(['check_settings'])->group(function () { Route::post('shop/invoices', 'Shop\InvoiceController@store'); }); ... });
Usage of commands in artisan
-
php artisan emizor:make-patch [name of file patch]
this command will generate a file that will be executed as migrations. This files will be stored in src\PatchesExample: php artisan emizor:make-patch update_new_columns_fel_database
-
php artisan emizor:patch
this command will executed all files in patches folder, and it will be executed once for file, because every time this command is executed it will be saved in database