-
php artisan migrate
for creating new tables of package -
php artisan vendor:publish
and choose optionEmizorIpx\ClientFel\ClientFelServiceProvider
on the list
- 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();
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'
// ];
// }
- 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
-
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]
-
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 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 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; } ... }
-
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); } }
-
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); } }
-
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); } }
-
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'); }); ... });
-
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