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

stripe.resources.Checkout.prototype seems to be broken? #2060

Open
jeffplays2005 opened this issue Apr 7, 2024 · 3 comments
Open

stripe.resources.Checkout.prototype seems to be broken? #2060

jeffplays2005 opened this issue Apr 7, 2024 · 3 comments
Labels

Comments

@jeffplays2005
Copy link

Describe the bug

Seems to be empty compared to other prototypes.
Screenshot 2024-04-07 at 9 52 25 PM

Screenshot 2024-04-07 at 9 52 41 PM

To Reproduce

node
const stripe = require('stripe')
stripe.resources.Checkout.prototype

Expected behavior

{
create: [Function (anonymous)],
retrieve: [Function (anonymous)],
list: [Function (anonymous)],
expire: [Function (anonymous)],
listLineItems: [Function (anonymous)]
}

Code snippets

No response

OS

macOS

Node version

Node v20.0.0

Library version

14.23.0

API version

2022-08-01

Additional context

No response

@richardm-stripe
Copy link
Contributor

richardm-stripe commented Apr 7, 2024

@jeffplays2005 stripe.resources.Checkout isn't like stripe.resources.Product because checkout isn't a resource itself, it is a "namespace" that contains other resources like "checkout session".

Can you say a little bit about what you are hoping to accomplish? Using require('stripe') directly isn't really part of the public interface of the library -- we usually expect users to stripe = require('stripe')("<API_KEY>") and access things on the constructed stripe client, rather than interacting directly with the "building blocks" as you seem to be doing.

@jeffplays2005
Copy link
Author

jeffplays2005 commented Apr 10, 2024

I'm trying to use this in jest for route testing for a route that has the method, stripe.checkout.sessions.list.
I'm trying to change the function so that it can change the output of the data list.
E.g.

jest.mock("stripe", () => {
    const stripe = jest.requireActual("stripe")
  jest
    .spyOn(stripe.resources.Checkout.sessions, "list")
    .mockImplementation((props) => {
      const { limit = 10 } = props as {
        limit?: number
      }
      const items = Array(limit).fill(mock)
      return Promise.resolve({ data: items })
    })
})

@ramya-stripe
Copy link
Contributor

@jeffplays2005 That still does not tell us why you were looking for any of the create/list/del etc. methods on stripe.resources.Checkout...

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

No branches or pull requests

3 participants