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

Directo: invoices are not sent to directo #844

Closed
vohmar opened this issue May 7, 2018 · 15 comments
Closed

Directo: invoices are not sent to directo #844

vohmar opened this issue May 7, 2018 · 15 comments
Assignees
Labels

Comments

@vohmar
Copy link
Contributor

vohmar commented May 7, 2018

There are currently 8 paied and waiting to be sent to Directo in production, but for some unknown reason it is not happening.

The directo XMLs are unfortunetely not logged (#344) and there are no errors in any other logs.

We see 8 invoices in db with sent to directo parameter false. Running the cron job returns 8 of 8 invoices sent but in reality nothing gets to directo and all the invoices are still marked as not sent.

@vohmar vohmar added the bug label May 7, 2018
@maciej-szlosarczyk maciej-szlosarczyk self-assigned this May 14, 2018
@maciej-szlosarczyk
Copy link
Contributor

#848 Does not fix the issue, but logs both Request and response we get from Directo. It should allow us to debug the actual issue.

@vohmar
Copy link
Contributor Author

vohmar commented May 15, 2018

unfortunately we are still unable to figure out what is the issue. In test the invoice it self reaches Directo but the invoice content is missing.

To get a better idea what is going on we need

  • XML sent to Direocto and the reply to it - there is a table called directos for this kind of data
  • it would be also helpful if there was a debug option with the cron script Directo.send_receipts to force it to log everything that is going on for situations like this.

@maciej-szlosarczyk
Copy link
Contributor

Hey @vohmar, if you used the latest master, then since #848 is merged, all of that information should be in the logs, prefixed with [Directo], both the XML request and the response Directo gives, including the HTTP code. I just added it. I'd need to see the logs to have an idea what is happening.

Before we'd add storing that info into database, I'd need to spend some time refactoring the cron jobs for sending invoices, as in it's current for it's unmaintainable and untested.

@vohmar
Copy link
Contributor Author

vohmar commented May 17, 2018

Apparently the invoices got stuck in Directo queue for some reason. Directo cleared the queue, we tried to resend everything and it seem the invoices are stuck again for some reason. They still have not sent me schema files although Artur should have these from the time he added send vatcode functionality. Currently trying to work out the problem with Directo.

@vohmar
Copy link
Contributor Author

vohmar commented May 17, 2018

here is the log from test env - the result of this was invoice in directo without records (body missing):

May 15 14:17:40 test-reg ADMIN[17004]: [DIRECTO] Will try to send 1 invoices
May 15 14:17:41 test-reg ADMIN[17004]: [Directo] XML request: <?xml version="1.0" encoding="UTF-8"?><invoices>  <invoice
 SalesAgent="JAANA" Number="3008355" InvoiceDate="2018-05-15T13:45:44" PaymentTerm="R" Currency="EUR" CustomerCode="EIS"
 TotalVAT="0.00">    <line ProductID="ETTEM06" Quantity="1" UnitPriceWoVAT="24.00" VATCode="EU87654321" ProductName="Ord
er nr. 3008355"/>  </invoice></invoices>
May 15 14:17:41 test-reg ADMIN[17004]: [Directo] Directo responded with code: 200, body:

@vohmar
Copy link
Contributor Author

vohmar commented May 24, 2018

it apperas that what we handled as vat registry code is actually Directos internal vat rate code. There are currently these values in Directo

MOSS Läti 21% kood 21
20% Eestis 20% kood 10
EU käive 0% kood 4
Teenuse eksport 0% kood 6

So we should replace vatcode value with one of these

  • Latvian registrar with no vat registry code gets value 21
  • All Estonian registrars get value 10
  • EU registrs that have vat registry code get value 4
  • Registrars outside of EU get value 6

@artur-intech
Copy link
Contributor

How can we distinguish, say, Latvian registrar? Currently we only have contact address, as far as I remember. Good that the country part is required.

@artur-intech artur-intech assigned vohmar and unassigned artur-intech Jun 4, 2018
@vohmar
Copy link
Contributor Author

vohmar commented Jun 5, 2018

Use the mandatory address country to determine the tax residency. So any registrar with address country set to Latvia and no VAT number set get VAT code 21 for invoice data for sending to Directo.

@artur-intech
Copy link
Contributor

How often those values get changed?

@vohmar
Copy link
Contributor Author

vohmar commented Jun 11, 2018

rarely, usually only once on the first entry.

@vohmar vohmar assigned artur-intech and unassigned vohmar Jun 11, 2018
@vohmar
Copy link
Contributor Author

vohmar commented Jun 11, 2018

most of our registrars are Estonian, so if default value is necessary then that would be 10

@teadur
Copy link
Contributor

teadur commented Jun 11, 2018

Where is this directo internal vat rate code stored in our system ?

@artur-intech
Copy link
Contributor

@teadur Currently nowhere.

@artur-intech
Copy link
Contributor

This ticket removes VATCode, TotalVAT as a quick fix. #880 is for long-term solution.

@artur-intech artur-intech assigned vohmar and unassigned artur-intech Jun 15, 2018
@vohmar
Copy link
Contributor Author

vohmar commented Jun 27, 2018

in production

@vohmar vohmar closed this as completed Jun 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants