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

Registrar: adding deposit returns "Failed to create record" error #774

Open
vohmar opened this issue Mar 14, 2018 · 8 comments
Open

Registrar: adding deposit returns "Failed to create record" error #774

vohmar opened this issue Mar 14, 2018 · 8 comments
Labels

Comments

@vohmar
Copy link
Contributor

vohmar commented Mar 14, 2018

Registrars' portal (/registrar/deposits) returns "Failed to create record" error on trying to add deposit

tested on branch #642
in billing view

  1. insert amount
  2. press add
  3. error is returned - no invoice is created

Log for failing invoice creation : https://gist.github.com/ratM1n/885a1dfa3a585da19fa0669c074e30c7
Invoice number is taken from interval between 131050 - 149999 and last one successfully creatid is 131062

blocks #642, #772 and #759

@artur-intech
Copy link
Contributor

artur-intech commented Mar 14, 2018

Do we experience this problem in prod as well?

@vohmar
Copy link
Contributor Author

vohmar commented Mar 14, 2018

no such problem in production

@artur-intech
Copy link
Contributor

artur-intech commented Mar 15, 2018

I can't reproduce it neither using master nor registry-642 branch.

What I did:

  • Set "Invoice number min" and "Invoice number max" in admin to 131050 and 149999 respectively
  • Manually created one and only invoice with number 131062 in the database
  • Topped up the balance with 2 EUR in registrar area

As a result, brand new invoice has been successfully created.

There must be some special conditions missing.

Perhaps you can reproduce it on staging? This way I can study database state.

@ratM1n
Copy link

ratM1n commented Mar 21, 2018

Artur: invoice number is taken from wrong range:

select` value from settings where thing_type is NULL and thing_id is NULL and var = 'invoice_number_max'
   value    
------------
 --- 149999+

select value from settings where thing_type is NULL and thing_id is NULL and var = 'directo_monthly_number_max'
    value     
--------------
 --- '309999'+
SELECT  "invoices"."number" FROM "invoices" WHERE (number IS NOT NULL)  ORDER BY "invoices"."number" DESC LIMIT 1
 number  
---------
 3008343

next invoice number query doesn't take account the invoice type.

@vohmar
Copy link
Contributor Author

vohmar commented Mar 21, 2018

there are two separate ranges for two separate type of invoices - one for adding credit and the other for monthly summary invoices. Currently it seems that the type is disregarded on assigning the invoice nr to credit invoice and the number is taken from monthly range.

@ratM1n
Copy link

ratM1n commented Mar 22, 2018

so, we sorted problem out - invoice number range is wrong. someone has changed range in setup to smaller numbers and invoice number is taken as biggest existing + 1 from invoices table (no separate counter for it).

@artur-intech artur-intech assigned vohmar and unassigned artur-intech Mar 22, 2018
@vohmar
Copy link
Contributor Author

vohmar commented Mar 27, 2018

this is still a bug then if setting the invoice number range (especially start from) does not apply when there is at least one invoice already generated (always biggest one existing +1). System should always check the configured range and try to use the lowest number available.

@vohmar
Copy link
Contributor Author

vohmar commented Mar 27, 2018

  • Steps to removed references to blocked domains
  • Added steps to reproduce and comment on the problem and expected solution in the description
  • moved the ticket to todo list for future resolution

@vohmar vohmar removed their assignment Mar 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

3 participants