Page MenuHomePhabricator

Parse AstroPay error codes / description and display appropriate messages to donor
Closed, ResolvedPublic2 Estimated Story Points

Description

AstroPay gateway currently shows one generic error message no matter what went wrong with the NewInvoice call (except duplicate invoice, which also needs investigating). We should recognize the rest of the errors and give the donor some information that can help them successfully donate.

We saw these during our test:

  • User unauthorized
  • Empty param x_cpf (This should be mandatory - how did we let this through?)
  • Invalid control
  • Could not register user
  • The user limit has been exceeded
  • User unauthorized due to cadastral situation

Event Timeline

Ejegg raised the priority of this task from to Needs Triage.
Ejegg updated the task description. (Show Details)
Ejegg subscribed.

Here's the full dump of possible responses provided by AstroPay:

{"status":"1","desc":"Empty param x_login"}
{"status":"1","desc":"The user must be adult"}
{"status":"1","desc":"User unauthorized due to cadastral situation"}
{"status":"1","desc":"Invoice already used"}
{"status":"1","desc":"Payment method not found"}
{"status":"1","desc":"Empty param x_cpf"}
{"status":"1","desc":"Invalid param x_cpf","error_code":"300"}
{"status":"1","desc":"User blacklisted","error_code":"503"}
{"status":"1","desc":"Invalid credentials"}
{"status":"1","desc":"Currency not allowed for this country"}
{"status":"1","desc":"The user limit has been exceeded"}
{"status":"1","desc":"User unauthorized"}
{"status":"1","desc":"Invalid param x_bdate"}
{"status":"1","desc":"User unauthorized","error_code":"502"}
{"status":"1","desc":"Empty param x_bank"}
{"status":"1","desc":"Payment method not found","error_code":"506"}
{"status":"1","desc":"Empty param x_cpf","error_code":"301"}
{"status":"1","desc":"User blacklisted"}
{"status":"1","desc":"Unregistered IP address"}
{"status":"1","desc":"User unauthorized due to cadastral situation","error_code":"504"}
{"status":"1","desc":"Empty param x_trans_key"}
{"status":"1","desc":"Empty param x_invoice"}
{"status":"1","desc":"Unregistered IP address","error_code":"402"}
{"status":"1","desc":"Invalid param x_email"}
{"status":"1","desc":"Empty param x_amount"}
{"status":"1","desc":"Invalid control"}
{"status":"1","desc":"Could not register user"}
{"status":"1","desc":"The user limit has been exceeded."}
{"status":"1","desc":"Empty param x_iduser"}
{"status":"1","desc":"Empty param control"}
{"status":"1","desc":"Empty param x_iduser","error_code":"301"}
{"status":"1","desc":"Empty param x_login","error_code":"301"}
{"status":"1","desc":"Currency not allowed for this country","error_code":"601"}
{"status":"1","desc":"Invalid param x_amount"}
{"status":"1","desc":"The user limit has been exceeded","error_code":""}
{"status":"1","desc":"Invalid param x_amount","error_code":"300"}
{"status":"1","desc":"The user must be adult","error_code":"501"}
{"status":"1","desc":"Invalid param x_bdate","error_code":"300"}
{"status":"1","desc":"Could not register user","error_code":"700"}
{"status":"1","desc":"Invoice already used","error_code":"500"}
{"status":"1","desc":"Empty param x_bank","error_code":"301"}
{"status":"1","desc":"Empty param x_trans_key","error_code":"301"}
{"status":"1","desc":"Invalid control","error_code":"302"}
{"status":"1","desc":"Invalid credentials","error_code":"401"}
{"status":"1","desc":"Empty param x_amount","error_code":"301"}
Ejegg set Security to None.
Ejegg edited a custom field.
Ejegg moved this task from Backlog to Doing on the Fundraising Sprint The Pogues board.
Ejegg updated the task description. (Show Details)

Change 224546 had a related patch set uploaded (by Ejegg):
WIP Parse more of AstroPay's error descriptions

https://gerrit.wikimedia.org/r/224546

Change 226917 had a related patch set uploaded (by Ejegg):
Use old error forms for AstroPay fail page

https://gerrit.wikimedia.org/r/226917

Change 226920 had a related patch set uploaded (by Ejegg):
Check error['context'] to place error messages

https://gerrit.wikimedia.org/r/226920

We only saw 'invalid control' errors for users who put spaces in their fiscal number. Maybe those spaces were stripped on AstroPay's side before calculating the signature? Our new fiscal number validation should stop that. If we continue to get 'invalid control' I will investigate our signing process.

This patch should deal with the rest of the errors we actually saw in our test, though there are plenty more in the provided list.

Additionally , I updated the price ceiling in AstroPay settings to reflect our agreed transaction limit, which should stop some of the 'limit exceeded' errors at validation.

Change 226917 merged by jenkins-bot:
Use old error forms for AstroPay fail page

https://gerrit.wikimedia.org/r/226917

Change 226920 merged by jenkins-bot:
Check error['context'] to place error messages

https://gerrit.wikimedia.org/r/226920

Change 224546 merged by jenkins-bot:
Parse more of AstroPay's error descriptions

https://gerrit.wikimedia.org/r/224546

Change 227571 had a related patch set uploaded (by Ejegg):
Log unrecognized AstroPay errors at 'error' level

https://gerrit.wikimedia.org/r/227571

Change 227571 merged by jenkins-bot:
Log unrecognized AstroPay errors at 'error' level

https://gerrit.wikimedia.org/r/227571