Adyen / adyen-node-api-library

Adyen API Library for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Missing property response value "Refused" for synchronous authorisation adjustment

momentiris opened this issue · comments

Describe the bug
We're using synchronous authorisation adjustment and I think there are missing types for the response.

To Reproduce

  • Pre-authorise 1 EUR
  • Final bill turns out to be 2 EUR
  • Try to make a synchronous authorisation adjustment to 2 EUR
  • Payment method only has coverage for 1.1 EUR
  • Get refused response that looks like this:
{
   "additionalData" : {
      "refusalReasonRaw" : "51 : Insufficient funds\/over credit limit"
   },
   "pspReference" : "TRDRHKTCM825Q4C2",
   "response" : "Refused"
}

Expected behavior
I expect types that cover the above scenario.

Desktop (please complete the following information):

  • OS: Mac
  • Node Version: 18.15.0
  • NPM Version: 9.6.3

Additional context
"@adyen/api-library": "14.4.0",

HI @momentiris ,

Thanks for raising this issue.
Could you please elaborate on which part of the library you are using, and which models are missing fields, according to the scenario you sketched?

Kind Regards,
Wouter
Adyen

Hey again and sorry for the late reply.

I'm using new PaymentAPI(...).adjustAuthorisation(...) from @adyen/api-library

Then I'm using Types.payment.ModificationResult, also from @adyen/api-library as expected response type (given OK response scenario)

This is the structure of the response I get and how its conveyed in my code.
Copy-pasted since I think the comment adds some context.

// TODO: This type corresponds to the response we get if our synchronous
// authorisation adjustment gets refused. Either it is uncovered by Adyens
// types or I can't find it.
// https://github.com/Adyen/adyen-node-api-library/issues/1313
type SynchronousAdjustmentRefused = {
  response?: 'Refused'
  refusalReasonRaw?: string
  pspReference: string
  amount: number
}