Syntax errors occur when Tesouro is not able to parse your request into a form it can operate on. There are a few common syntax errors you might encounter when you are starting your integration:
Invalid request structure
If the request does not match the structure of a valid GraphQL request.
scenario When Ben was checking out at CoolTechGear.com, a missing closing brace in
the code caused an error.
Request with Syntax Error
mutation AuthorizeAndCaptureCard ( $input : CardPaymentInput ! ) {
authorizeAndCaptureCard ( input : $input ) {
transactionInformation {
paymentId
}
}
Response: Invalid Request
{
"errors" : [
{
"message" : "parsing error: ERROR@722:723 \" expected } \" )" ,
"extensions" : {
"code" : "PARSING_ERROR"
}
}
]
}
Invalid mutation/query identifier
If the mutation/query identifier doesn’t exist.
Scenario When processing Ben’s payment at CoolTechGear.com, sending authorizeAndCaptureCards instead of authorizeAndCaptureCard caused an error.
Request with Syntax Error
mutation AuthorizeAndCaptureCard ( $input : CardPaymentInput ! ) {
authorizeAndCaptureCards ( input : $input ) {
transactionInformation {
paymentId
}
}
}
Response: Invalid Request
{
"errors" : [
{
"message" : "parsing error: ERROR@722:723 \" expected } \" )" ,
"extensions" : {
"code" : "PARSING_ERROR"
}
}
]
}
If the mutation/query identifier is correct, but one of the input fields does not match the schema
Scenario When processing Ben’s keyboard purchase at CoolTechGear.com, sending transactionCurrencys instead of transactionCurrency caused an error.
Request Variables with Syntax Error
{
"input" : {
"amountInformation" : {
"transactionAmount" : 150 ,
"transactionCurrencys" : "USD"
}
}
}
Response: Invalid Request
{
"errors" : [
{
"message" : "Field \" transactionCurrencyss \" is not defined by type \" AmountInformationInput \" . Did you mean \" transactionCurrency \" or \" transactionAmount \" ?" ,
"extensions" : {
"code" : "GRAPHQL_VALIDATION_FAILED"
}
}
]
}
If an input variable field type is incorrect
Scenario When charging Ben’s card for his $150.10 mechanical keyboard at CoolTechGear.com, sending "150.10" instead of 150.10 for a DecimalAmount field caused an error.
Request Variables with Syntax Error
{
"input" : {
"amountInformation" : {
"transactionAmount" : "150.10" ,
"transactionCurrencys" : "USD"
}
}
}
Response: Invalid Request
{
"data" : null ,
"errors" : [
{
"message" : "HTTP fetch failed from 'paymentprocessing': 400: Bad Request" ,
"extensions" : {
"code" : "SUBREQUEST_HTTP_ERROR" ,
"service" : "paymentprocessing" ,
"reason" : "400: Bad Request" ,
"http" : {
"status" : 400
}
}
},
{
"message" : "The specified value type of field `transactionAmount` does not match the field type." ,
"locations" : [
{
"line" : 1 ,
"column" : 287
}
],
"path" : [ "authorizeAndCaptureCard" ],
"extensions" : {
"fieldName" : "transactionAmount" ,
"fieldType" : "DecimalAmount!" ,
"locationType" : "DecimalAmount!" ,
"specifiedBy" : "http://spec.graphql.org/October2021/#sec-Values-of-Correct-Type"
}
}
]
}
See all 32 lines