dhaspden / nestjs-stripe Goto Github PK
View Code? Open in Web Editor NEWProvides an injectable Stripe client to nestjs modules
License: MIT License
Provides an injectable Stripe client to nestjs modules
License: MIT License
The following should be accomplished related to code coverage reports:
With merging #82 we have some new deprecation warnings to fix. Once those are fixed we can get ready for a version bump. Instead of calling setAppInfo
we should just pass those values to the Stripe configuration like it is suggesting. The warning is shown below:
(node:17938) Stripe: `setAppInfo` is deprecated. Use the `appInfo` config option instead.
I am the founder of a VC-backed app called Iris, that allows you to connect your brokerage to enable you to share your trades with your friends and family.
Here is a quick product video: https://www.youtube.com/watch?v=kHtE-LMYxcg
We only hire super active engineers that have a history of contributing/creating prominent open source packages as these are some of the most talented people out there.
We have the creator of the GetX package for flutter(most like and used flutter package)
We just hired the lead AI/ML engineer from TikTok
We love what you have done to make it easier to integrate nestjs and stripe.
Our app currently has 50k users and we can see $5 billion of orders on our platform, we are growing fast and are looking to slowly add talented engineers.
You are probably not looking for a job right now however do you have 15 min to chat this week or next? if so here is a calendar link I would love to speak with you!
https://calendly.com/brian-iris
Thanks,
Brian Schardt
As the title says. Had some requests for an example so we need to add one.
The stripe-node
library supports a configuration object now. We can rewrite a bit of our logic to support that configuration object and support some values that we don't support currently (such as host and port.)
I am working with a client that takes payments for several different Stripe accounts and need to be able to direct the payment to different API keys based on the company the booking is being made for.
I am new to Nest so am not sure about overriding the API that is applied when my module loads.
I'm trying to unit-test a service which is using the Stripe class. The setup is similarly as described in the README
@Injectable()
export class MyService {
constructor(@InjectStripe() private readonly stripe: Stripe) {}
createCheckout() {
this.stripe.checkout.sessions.create({/** **/});
}
}
In the unit test I provide a mock as known from other services.
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [MyService, { provide: Stripe, useClass: StripeMock }],
}).compile();
});
The mock looks like this:
class Sessions {
create(): void {
return null;
}
}
class Checkout {
sessions: Sessions;
constructor() {
this.sessions = new Sessions();
}
}
export class StripeMock {
checkout: Checkout;
constructor() {
this.checkout = new Checkout();
}
}
The problem is that NestJs dose not recognize the mock completely. It throws the given error:
Nest can't resolve dependencies of the CheckoutService (?). Please make sure that the argument StripeToken at index [0] is available in the RootTestModule context.
Potential solutions:
- If StripeToken is a provider, is it part of the current RootTestModule?
- If StripeToken is exported from a separate @Module, is that module imported within RootTestModule?
Are there some recommendations how to mock the Stripe instance in tests? It could be useful to add a short section to the documentation about testing/mocking, because it seems not straight forward as known from other NestJs services. Maybe it make sense to provide sth. like a StripeTestingModule
within this package? If someone explains the problem to me I can get my hands dirty adding a related "Unit Testing/Mock" section to the docs.
When compiling, I receive the error mentioned in the subject.
Stripe version: "stripe": "^8.53.0"
interface StripeOptions extends Stripe.StripeConfig
apiVersion is the only mandatory parameter.
Like other official Nest modules, it would be nice to propose the useExisting
syntax for configuring the module.
NestJS v8 upgrade throws several warnings.
warning " > [email protected]" has incorrect peer dependency "@nestjs/common@^6.0.0 || ^7.0.0".
warning " > [email protected]" has incorrect peer dependency "@nestjs/core@^6.0.0 || ^7.0.0".
warning " > [email protected]" has incorrect peer dependency "rxjs@^6.0.0".
peer @nestjs/common@"^6.0.0 || ^7.0.0 || ^8.0.0" from [email protected]
Facing issue while adding the module in Async mode
import { StripeModule } from 'nestjs-stripe';
import { ConfigModule, ConfigService } from '@nestjs/config';
imports:[
StripeModule.forRootAsync({
useFactory: (configService: ConfigService) => ({
apiKey: configService.get('stripe_key'),
}),
}),]
Error coming
Type '(configService: ConfigService) => { apiKey: string; }' is not assignable to type '(...args: any[]) => StripeOptions | Promise<StripeOptions>'. Type '{ apiKey: string; }' is not assignable to type 'StripeOptions | Promise<StripeOptions>'. Property 'apiVersion' is missing in type '{ apiKey: string; }' but required in type 'StripeOptions'.
NEST JS v7
apiVersion can only be set to the latest api version? Can this be set to be latestVersion or string?
I am facing this error
Getting error Argument of type '{ apiKey: string; apiVersion: string; }' is not assignable to parameter of type 'StripeOptions'. Object literal may only specify known properties, and 'apiVersion' does not exist in type 'StripeOptions'. apiVersion: '2020-08-27',
and this is my auth module
`
import { StripeModule } from 'nestjs-stripe';
@module({
imports: [
StripeModule.forRoot({
apiKey: 'my_secret_key',
apiVersion: '2020-08-27',
}),
ThrottlerModule.forRoot({
ttl: 60 * 60 * 1000, // 1 minute
limit: 100,
}),
// LoggerModule.forRoot(),
ConfigModule.forRoot({
isGlobal: true,
envFilePath: ['config.env'],
}),
MongooseModule.forRootAsync({
imports: [ConfigModule],
useFactory: (configService: ConfigService) => ({
uri: configService.get('DB_URI'),
}),
inject: [ConfigService],
}),
AuthModule,
UserModule,
TodoModule,
],
controllers: [],
providers: [
NotificationsGateway,
{
provide: APP_GUARD,
useClass: ThrottlerGuard,
},
],
})
`
Package.json file
"dependencies": {
"@golevelup/nestjs-stripe": "^0.2.2",
"@nestjs-modules/mailer": "^1.6.0",
"@nestjs/common": "^7.0.0",
"@nestjs/config": "^0.6.1",
"@nestjs/core": "^7.0.0",
"@nestjs/event-emitter": "^1.0.0",
"@nestjs/jwt": "^7.2.0",
"@nestjs/mapped-types": "^1.0.0",
"@nestjs/mongoose": "^7.1.0",
"@nestjs/passport": "^7.1.6",
"@nestjs/platform-express": "^7.0.0",
"@nestjs/platform-socket.io": "^8.2.0",
"@nestjs/swagger": "^4.1.0",
"@nestjs/websockets": "^8.2.0",
"@types/bcrypt": "^3.0.0",
"@types/mongoose-paginate-v2": "^1.3.8",
"@types/passport-facebook": "^2.1.11",
"aws-sdk": "^2.797.0",
"bcrypt": "^5.0.0",
"class-transformer": "^0.3.1",
"class-validator": "^0.12.2",
"googleapis": "^89.0.0",
"handlebars": "^4.7.7",
"hbs": "^4.1.2",
"lodash": "^4.17.20",
"messagebird": "^3.7.1",
"moment": "^2.29.1",
"mongoose": "^5.10.15",
"mongoose-paginate-v2": "^1.3.11",
"nodemailer": "^6.7.0",
"passport": "^0.4.1",
"passport-facebook": "^3.0.0",
"passport-facebook-token": "^4.0.0",
"passport-google-oauth20": "^2.0.0",
"passport-jwt": "^4.0.0",
"passport-local": "^1.0.0",
"reflect-metadata": "^0.1.13",
"request-context": "^2.0.0",
"rimraf": "^3.0.2",
"rxjs": "^6.5.4",
"string-format": "^2.0.0",
"string-format-ts": "^1.0.4",
"stripe": "^8.194.0",
"swagger-ui-express": "^4.1.6",
"uniqid": "^5.4.0",
"uuid": "^8.3.2"
},
Looking for help, thank you.
We should add some extra options for users that want more control over their Stripe client without having to modify it manually.
There is an issue with the httpProxy
option for the getStripeClient
function. I'm going to have to make the appropriate changes when the dependencies are updated. That is the reason the Greenkeeper pull request builds are failing.
Support the httpProxy
option properly by pulling in the required dependency (maybe as an optional dependency?) and hooking it up with stripe
properly.
Not sure it's 100% a bug but I think it would be best if we just left the API version default as null
because the Stripe library handles that by just choosing the default for you (latest version I think.) If someone wants to pin an API version they can do that themselves.
Once this is done we should pin a new version.
Hi anybody who is reading this! Now that a few people have started to use this library I wanted to take the chance to reach out to you all. This library fulfills what it set out to do but I'd like to extend the question anyway โ is there something that this library does not currently do that would be nice to have?
I toyed with the idea of webhook listeners but not sure it's worth the time investment if nobody would actually use it.
Alternatively just thumbs up this message if you think that this library is good as-is and only needs maintenance. I'll leave this up for a little bit to see if I get any responses ๐.
Thanks for using this library, it means a lot!
Stripe requests that we add plugin documentation to the client when we create it. We should add some basic information about our library to it.
{
"name": "nestjs-stripe",
"version": "0.1.0",
"url": "http://github.com/dhaspden/nestjs-stripe"
}
Please replace this line with a brief summary of your issue.
Please note by far the quickest way to get a new feature is to file a Pull
Request.
We will consider your request but it may be closed if it's something we're not
actively planning to work on.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.