-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
Description
Issue:
When validating user input errors, the type of "error" returned by recurly.token in this example, recurly.token(formRef.current, (error, token) => {} does not match the RecurlyError type defined by Recurly.js
.
recurly.token errors have this structure:
{
"name": "validation",
"code": "validation",
"message": "There was an error validating your request.",
"fields": [
"number",
"month",
"year"
],
"details": [
{
"field": "number",
"messages": [
"is invalid"
]
},
{
"field": "month",
"messages": [
"is invalid"
]
},
{
"field": "year",
"messages": [
"is invalid"
]
}
]
}RecurlyError is defined by Recurly.js as:
export interface RecurlyError extends Error {
code: string;
message: string;
classification: string;
help?: string;
}When using TypeScript, this causes compilation errors if you try to handle the actual response from Recurly.js.
To Reproduce
The bug can be reproduced by inputting an invalid credit card expiry date in the React Recurly demo page and checking the console output.
Expected behavior
The returned error matches the type defined by Recurly.js
Your Environment
- Using ReactReculry 1.2.3
chrissrogers and javimbk