Skip to content

feat(billing): add billing endpoints#121

Open
Sourav-kashyap wants to merge 5 commits into
masterfrom
GH-120
Open

feat(billing): add billing endpoints#121
Sourav-kashyap wants to merge 5 commits into
masterfrom
GH-120

Conversation

@Sourav-kashyap
Copy link
Copy Markdown

Description

This PR adds three new billing endpoints to retrieve detailed payment and invoice information, along with TypeScript type improvements for webhook handling. The new endpoints provide essential functionality for invoice management and payment tracking in SaaS subscription workflows.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • Performed a self-review of my own code
  • npm test passes on your machine

@Sourav-kashyap Sourav-kashyap self-assigned this May 19, 2026
@Sourav-kashyap Sourav-kashyap linked an issue May 19, 2026 that may be closed by this pull request
@Sourav-kashyap Sourav-kashyap force-pushed the GH-120 branch 3 times, most recently from 0d1d5b3 to 2fe29d0 Compare May 20, 2026 10:19
Comment on lines +76 to +85
process.env.FEATURE_DB_HOST = 'localhost';
process.env.FEATURE_DB_PORT = '5432';
process.env.FEATURE_DB_USER = 'test';
process.env.FEATURE_DB_PASSWORD = 'test';
process.env.FEATURE_DB_DATABASE = 'test';
process.env.FEATURE_DB_SCHEMA = 'public';
// Billing config
process.env.SITE = 'test';
process.env.API_KEY = 'test';
process.env.STRIPE_SECRET = 'test';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why a database setup, cant we use memory store here ?

Copy link
Copy Markdown
Author

@Sourav-kashyap Sourav-kashyap May 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

@post(`${BASE}/customers`, {
summary: 'Create a new customer',
responses: {
'200': {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic number

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines +70 to +86
schema: {
type: 'object',
required: ['firstName', 'lastName', 'email'],
properties: {
firstName: {type: 'string', example: 'John'},
lastName: {type: 'string', example: 'Doe'},
email: {type: 'string', example: 'john.doe@example.com'},
company: {type: 'string', example: 'Acme Inc.'},
phone: {type: 'string', example: '+1234567890'},
billingAddress: {
type: 'object',
properties: {
line1: {type: 'string'},
city: {type: 'string'},
state: {type: 'string'},
zip: {type: 'string'},
country: {type: 'string', example: 'US'},
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use types

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines +140 to +162
'application/json': {
schema: {
type: 'object',
properties: {
firstName: {type: 'string'},
lastName: {type: 'string'},
email: {type: 'string'},
company: {type: 'string'},
phone: {type: 'string'},
billingAddress: {
type: 'object',
properties: {
line1: {type: 'string'},
city: {type: 'string'},
state: {type: 'string'},
zip: {type: 'string'},
country: {type: 'string'},
},
},
},
},
},
},
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

define type

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines +113 to +119
this.application.bind(StripeBindings.config).to({
secretKey: process.env.STRIPE_SECRET ?? '',
});
this.application
.bind(BillingComponentBindings.SDKProvider)
.toProvider(StripeServiceProvider);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be in sandbox

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

// Mount authorization component for default sequence
this.application.bind(AuthorizationBindings.CONFIG).to({
allowAlwaysPaths: ['/explorer'],
allowAlwaysPaths: ['/explorer', '/billing', '/webhooks'],
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was a webhook component right ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes ma'am

Comment on lines +26 to +30
SITE=
API_KEY=
STRIPE_SECRET=
CHARGEBEE_ITEM_FAMILY_ID=
BILLING_PROVIDER=
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no all this will b ein sandbox

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

},
})
async createCustomer(
@requestBody({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this create the customer on stripe? if yes, then we alreayd has the apis to create the customer. what is the difference between them

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

},
})
async getCustomer(
@param.path.string('customerId') customerId: string,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these endpoints already exist exist , review pls

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

},
})
paymentDto: BillingPaymentSourceBody,
): Promise<TPaymentSource> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have the api , then why need to create new

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

},
},
},
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep them seprate , for product , price, keep them separate

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

* interceptor to BILLING_WEBHOOK_VERIFIER in application.ts.
*/
export class BillingWebhookController {
constructor(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already had a controller for ir

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

@sonarqubecloud
Copy link
Copy Markdown

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

Successfully merging this pull request may close these issues.

add billing subscription features

3 participants