fattureincloud / fattureincloud-php-sdk Goto Github PK
View Code? Open in Web Editor NEWFatture in Cloud SDK (Software Development Kit) for PHP
Home Page: https://www.fattureincloud.it
License: MIT License
Fatture in Cloud SDK (Software Development Kit) for PHP
Home Page: https://www.fattureincloud.it
License: MIT License
Describe the bug
When calling InfoApi::listPaymentMethods()
the expected payload should carry a filled details
key (when such object is populated).
It returns a details => null
instead:
$infoApi->listPaymentMethods($companyId)->getData(); // Returns FattureInCloud\Model\PaymentMethod[]
When plucking out a PaymentMethod
which has details
set in company settings (on the web interface):
[
"id" => 2047125,
"name" => "Test",
"is_default" => false,
"default_payment_account" => null,
"details" => null, // <-------------- This should not be `null` as it's filled correctly in the web interface
"bank_iban" => null,
"bank_name" => null,
"bank_beneficiary" => null,
"ei_payment_method" => null,
]
Env info
Please, provide us with the following details:
To Reproduce
Please, share with us (if applicable):
Follow what's in Describe the bug
section.
Since this morning i get following error posting to endpoint:
Exception when calling ClientsApi->getClient: [0] cURL error 77: (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
I tried to use method: ReceivedDocumentsApi->listReceivedDocuments to retrieve all expenses (in "detailed" mode) but fields "created_at" and "updated_at" are not returned.
If I use API REFERENCE web tools from: https://developers.fattureincloud.it/api-reference, both fields are returned correctly
Describe the bug
I install the package via composer and not work!
How i can add in my code the library (to replace require_once(DIR . '/vendor/autoload.php'); )?
Must be have this line use FattureIncloud/xxxxxx
Is there an API Call which we can get informations about user active subscription?
Describe the bug
Documentation for the PHP-SDK has a typo in the array given as the argument for EmailSchedule
class:
Ref: https://developers.fattureincloud.it/docs/guides/invoice-creation/#-send-the-document (make sure to pick PHP as the SDK).
$email = new EmailSchedule(
[
"senderId" => 0,
"recipient_email" => "[email protected]",
"subject" => "Nostra fattura nr. 54321",
"body" => "Gentile xxxxx,<br>per visualizzare la nostra <b>fattura nr. 54321 </b>o per scaricarne una copia in versione PDF prema sul bottone sottostante.<br><br>{{allegati}}<br><br>Cordiali saluti,<br><b>Ino S.p.A</b>",
"include" =>
[
"document" => true,
"delivery_note" => false,
"attachment" => false,
"accompanying_invoice" => false
],
"attach_pdf" => false,
"send_copy" => false
]
);
"senderId" => 0,
should in fact be sender_id
instead.
If you try to run the code that's given in docs, the API will return a 422
error:
[422] Client error: `POST https://api-v2.fattureincloud.it/c/REDACTED/issued_documents/REDACTED/email` resulted in a `422 Unprocessable Entity` response:
{"error":{"message":"Invalid request.","validation_result":{"data.sender_id":["The data.sender id field is required when (truncated...)
Describe the bug
With the command $fattureInCloud->info()->listTemplates() we can't see our custom template we created on Fatture in cloud web gui.
Env info
Please, provide us with the following details:
To Reproduce
$fattureInCloud->info()->listTemplates()
Expected behavior
Show our custom templates
Describe the bug
A call to $documentsApi->modifyIssuedDocument
with malformed parameters fails silently without emitting warnings, errors, or throwing exceptions
Env info
To Reproduce
$result = $documentsApi->modifyIssuedDocument($this->company_id, $document_id, $request)->getData();
, where the request is created with some invalid parameters (eg: adding/deleting/updating items without also updating the payment amount)Expected behavior
An ApiException
is thrown with, for instance,"Il totale dei pagamenti non corrisponde al totale da pagare."
as a message.
Additional context
Also, it would be very convenient to have the fix_payments
options also in the modifying requests.
Salve, ho una domanda: come è possibile che ci siano alcune entity (associate a fatture) senza l'id. Qual è la chiave primaria su cui fare affidamento? Posso usare il name?
Grazie.
Describe the bug
Getting error when use OAuth2 fetchToken method.
Env info
To Reproduce
Example code
$code = request()->code;
$redirectUri = "http://localhost:8000/api/grant";
$oauth = new OAuth2AuthorizationCodeManager("CLIENT_ID", "CLIENT_SECRET", $redirectUri);
$tokenObj = $oauth->fetchToken($code);
$accessToken = $tokenObj->getAccessToken();
$refreshToken = $tokenObj->getRefreshToken();
POST https://api-v2.fattureincloud.it/oauth/token
resulted in a 400 Bad Request
response:POST https://api-v2.fattureincloud.it/oauth/token
resulted in a 400 Bad Request
response:Expected behavior
Working fetchToken.
Additional context
I think the problem is in the method fetchToken at line 176 of OAuth2AuthorizationCodeManager.php, where the $body
not includes key 'json', like it is described on Vanilla documentation (https://developers.fattureincloud.it/docs/authentication/code-flow/vanilla-code#3%EF%B8%8F%E2%83%A3-obtain-the-access-token)
Buongiorno
Purtroppo non trovo alcun riferimento su come creare una fattura con dati di un cliente esistente.
La vostra SDK prevede solo il setEntity per la creazione di nuovi clienti (se non sbaglio)
Nella vecchia versione c'era la funzione "autocompila_anagrafica" che non ritrovo qui
\FattureInCloud\Model\IssuedDocument::setType
si aspetta \FattureInCloud\Model\IssuedDocumentType|null
:
/**
* Sets type
*
* @param \FattureInCloud\Model\IssuedDocumentType|null $type type
*
* @return self
*/
public function setType($type)
{
$this->container['type'] = $type;
return $this;
}
Ma gli viene passata una string
(vedi documentazione)
$invoice = new IssuedDocument;
$invoice->setType(IssuedDocumentType::INVOICE);
In quanto le costanti sono stringhe:
class IssuedDocumentType
{
/**
* Possible values of this enum
*/
const INVOICE = 'invoice';
const QUOTE = 'quote';
const PROFORMA = 'proforma';
const RECEIPT = 'receipt';
Describe the bug
The permanent_token
field is present in the responses examples for creation, retrieval and modification of issued documents, but it is not present in the related docs schemes and SDK.
Previously (API v1), the id of the issued documents changes at each modification of the data requiring the use of the permanent token.
Now (API v2) the permanent token is no longer accessible, and even if the id
remains the same, it makes it impossible to transition from API v1 to v2 without creating disruption to our customers.
Env info
Please, provide us with the following details:
To Reproduce
Not applicable.
Expected behavior
The documentation should be aligned and the permanent_token
should be accessible from the SDK, otherwise it becomes impossible to transition to v2 for non-finalized documents, or for documents for which a subsequent modification is made through the API.
I understand it's a major version transition, but I don't think you've overlooked that, so let me know if I've missed anything.
Describe the bug
Dal 9 di gennaio quando provo ad accedere alla lista clienti ottengo un errore "401 non autorizzato"
Env info
To Reproduce
Eseguo una chiamata per avere la lista dei clienti ma ottengo un errore 401
$companies = $userInstance->listUserCompanies();
if (empty($companies->getData()->getCompanies())){
return;
}
$companyId = $companies->getData()->getCompanies()[0]->getId();
$cont_pagina = 1;
$listaClienti = [];
do {
try {
$resClienti = $clientInstance->listClients($companyId, null, null, null, $cont_pagina, 100);
} catch (Exception $e) {
return;
}
[401] Client error: GET https://api-v2.fattureincloud.it/c/944984/entities/clients?page=1&per_page=100
resulted in a 401 Unauthorized
response:
{"error":"unauthorized","error_description":"The given user is not authorized to use this application."}
How i can send client data (as name, cf, phone) with CreateClientRequest ?
$apiInstance = new FattureInCloud\Api\ClientsApi(
// If you want use custom http client, pass your client which implements GuzzleHttp\ClientInterface
.
// This is optional, GuzzleHttp\Client
will be used as default.
new GuzzleHttp\Client(),
$config
);
$create_client_request = new \FattureInCloud\Model\CreateClientRequest; // \FattureInCloud\Model\CreateClientRequest | The client to create
try {
$result = $apiInstance->createClient($company_id, $create_client_request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ClientsApi->createClient: ', $e->getMessage(), PHP_EOL;
}
Describe the bug
I valori di stato documento manual_accepted
e (suppongo) manual_rejected
non sono visti come validi
Env info
Php 7.4
sdk v2.0.13
To Reproduce
Nel recuperare l'elenco delle ultime fatture emesse:
$apiInstance = new IssuedDocumentsApi(new Client(), $this->config);
$all = $apiInstance->listIssuedDocuments($this->companyId, IssuedDocumentType::INVOICE, "id,ei_status,date", null, "-date", null, 10)->getData();
Hi,
on "issued_documents" with type = invoice,
"entity.email" is it not inserted on document.
This is the only one field of entity block with this problem.
Someone fixed this problem?
Describe the bug
Invoice creation issue
To Reproduce
Get the vatType "GET /c/{company_id}/info/vat_types" with id 0 (for italy), then use the VatType object as it is to create an invoice.
Client error: POST https://api-v2.fattureincloud.it/c/9999999/issued_documents
resulted in a 422 Unprocessable Entity
response:
{"error":{"message":"Invalid request.","validation_result":{"data.items_list.0.vat.notes":["The data.items list.0.vat.no (truncated...)
{"exception":"[object] (FattureInCloud\ApiException(code: 422): [422] Client error: POST https://api-v2.fattureincloud.it/c/99999999/issued_documents
resulted in a 422 Unprocessable Entity
response:
{"error":{"message":"Invalid request.","validation_result":{"data.items_list.0.vat.notes":["The data.items list.0.vat.no (truncated...)
at /var/www/html/vendor/fattureincloud/fattureincloud-php-sdk/lib/Api/IssuedDocumentsApi.php:206)
Expected behavior
Invoice creation or an error message not truncated.
Describe the bug
return a 500 on entities/clients
{"error":{"message":"An unexpected error occurred. Contact support for more information."}}
Env info
Please, provide us with the following details:
Expected behavior
Create a client on FIC or return an error not a 500
Describe the bug
A clear and concise description of what the bug is.
POST https://api-v2.fattureincloud.it/c/company_id/issued_documents resulted in a 422 Unprocessable Entity response:
{"error":{"message":"Invalid request.","validation_result":{"data.items_list.0.discount":["The data.items list.0.discoun
From API Reference
discount: number┃null Discount percentual value.
But when is set to null we receive a 422
Env info
To Reproduce
Create an invoice with discount null
Expected behavior
Creation of an invoice
Buongiorno a tutti,
all'interno di un'integrazione custom tra uno dei nostri SW e Fatture in Cloud abbiamo la necessità di specificare, nella chiamata di creazione di una fattura (POST /c/{company_id}/issued_documents), il campo 2.1.1.1 - TipoDocumento.
Tale campo è modificabile da interfaccia FiC nella sezione "Attributi avanzati" del blocco Fatturazione elettronica mentre all'interno del SDK o della documentazione API non riesco a trovare riferimenti al campo in questione.
Mi aspettavo di trovarlo nella classe FattureInCloud\Model\IssuedDocumentEiData ma vedo che non è presente.
Potreste indicarmi se tale campo è esposto nella rotta API oppure se ne è prevista la futura implementazione?
Grazie
Buongiorno a tutti,
nella rappresentazione tabellare del tracciato Fattura PA, è indicato che, all'interno degli N elementi della sezione "2.2 DatiBeniServizi" per il blocco 2.2.1.10 ScontoMaggiorazione, è necessario specificare almeno uno tra gli elementi "2.2.1.10.2 Percentuale" o "2.2.1.10.3 Importo", fornendo quindi la possibilità di inserire uno sconto percentuale oppure uno sconto con importo fisso:
Se valorizzato, viene controllato che esista almeno uno dei due elementi 2.2.1.10.2 Percentuale e 2.2.1.10.3 Importo
All'interno dell'SDK, nella classe IssuedDocumentItemsListItem, il campo "discount" è unico e di fatto corrisponde al campo di sconto percentuale, non permettendo quindi di inserire uno sconto con importo fisso.
L'introduzione dello sconto con importo fisso sulla singola riga di dettaglio è prevista come futura implementazione?
Grazie
Currently Api v2 does not support the salva_anagrafica
and autocompleta_anagrafica
options on IssuedDocument
endpoints to automatically save and fetch entity information, it would be very useful to implement it, as it makes transition from v1 to v2 much easier
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.