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

201 Respones Code, but Error in response parsing #13

Open
markus-gx opened this issue Nov 21, 2024 · 1 comment
Open

201 Respones Code, but Error in response parsing #13

markus-gx opened this issue Nov 21, 2024 · 1 comment

Comments

@markus-gx
Copy link

Environment: Sandbox
Payment Type: EPS Payment (Austria)

Error:

The response did not match the response schema.

Some properties are missing in the object: "country_code".

Given value: {"national_number":"43158850"}
Type: 'object'
Expected type: 'Optional<Lazy<Object<{countryCode,nationalNumber}>>>'
Path: purchase_units › 0 › shipping › phone_number

  
  Some properties are missing in the object: "country_code".
  
  Given value: {"national_number":"43158850"}
  Type: 'object'
  Expected type: 'Optional<Lazy<Object<{countryCode,nationalNumber}>>>'
  Path: purchase_units › 0 › shipping › phone_number
  at new ResponseValidationError (node_modules/@apimatic/core/lib/errors/responseValidationError.js:22:24)
  at resInvalidErr (node_modules/@apimatic/core/lib/http/requestBuilder.js:508:16)
  at node_modules/@apimatic/core/lib/http/requestBuilder.js:510:68
  at validateJson (node_modules/@apimatic/core/lib/http/requestBuilder.js:515:15)
  at parseJsonResult (node_modules/@apimatic/core/lib/http/requestBuilder.js:510:12)
  at DefaultRequestBuilder.<anonymous> (node_modules/@apimatic/core/lib/http/requestBuilder.js:292:104)
  at step (node_modules/tslib/tslib.js:196:27)
  at Object.next (node_modules/tslib/tslib.js:177:57)
  at fulfilled (node_modules/tslib/tslib.js:167:62)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

The error occurs only with EPS payment method. Payment via PayPal works.
The response is a 201 Status Code and based on the Paypal Debug Logs in the Web-Panel the response is correct.
Seems like the parser has a bug :)

Code which is failing:

 const collect = {
    id: orderId,
    prefer: 'return=minimal',
  }

  try {
    const { body } = await PaypalOrdersController.ordersCapture(collect) //Fail here. 
@LeonarthusMectus
Copy link

Hey @markus-gx

Thanks for the report! I don't think this is a bug in the parser, but instead an issue in the API spec we used. The API defines both the country_code & national_number values as required in the response, so the SDK requires them in the constructor, but the API appears to be dropping the country_code, creating the issue.

Turns out there are quite a few Phone number definitions in the APIs, and I think the Orders team may have used the wrong one given what we're seeing ;) I'm going to reach out to them to see if we can get this sorted out and get a patch pulled into the SDKs once they confirm the proper values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants