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

GetPaymentResponseData is defined as never #63

Closed
vcarl opened this issue Mar 1, 2023 · 2 comments
Closed

GetPaymentResponseData is defined as never #63

vcarl opened this issue Mar 1, 2023 · 2 comments

Comments

@vcarl
Copy link

vcarl commented Mar 1, 2023

I was talking with a developer in the Build on Circle community, and we found a bug in the API type definitions.

GetPaymentResponseData is defined as never because of conflicting type attributes in a type intersection. Since these types are autogenerated by OpenAPI, it looks like it's probably an error in definitions.

CryptoPayment is defined as:

export interface CryptoPayment {
// …
    type: CryptoPaymentTypeEnum; // "payment" | "refund"
// …

And GetPaymentReponseData is defined as an intersection with a specific type that conflicts with that union:

export type GetPaymentResponseData =
  | ({ type: "Crypto Payment" } & CryptoPayment)
  | ({ type: "Fiat Payment" } & FiatPaymentPolymorphic);

This resolves to never because "Crypto Payment" & ("payment" | "refund") cannot be reconciled, which (downstream) results in GetPaymentResponse resolving to { data: undefined } in all cases.

@deepakgummi
Copy link
Contributor

I was talking with a developer in the Build on Circle community, and we found a bug in the API type definitions.

GetPaymentResponseData is defined as never because of conflicting type attributes in a type intersection. Since these types are autogenerated by OpenAPI, it looks like it's probably an error in definitions.

CryptoPayment is defined as:

export interface CryptoPayment {
// …
    type: CryptoPaymentTypeEnum; // "payment" | "refund"
// …

And GetPaymentReponseData is defined as an intersection with a specific type that conflicts with that union:

export type GetPaymentResponseData =
  | ({ type: "Crypto Payment" } & CryptoPayment)
  | ({ type: "Fiat Payment" } & FiatPaymentPolymorphic);

This resolves to never because "Crypto Payment" & ("payment" | "refund") cannot be reconciled, which (downstream) results in GetPaymentResponse resolving to { data: undefined } in all cases.

Thanks for bringing this to our notice. Will be looking into this.

@ashutosh-ukey
Copy link
Contributor

Thank you very much for bringing this up @vcarl! The latest published version of the Node SDK should have this bug fixed

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

3 participants