Skip to content

Commit

Permalink
fix: subscription update request body schema (#547)
Browse files Browse the repository at this point in the history
* fix: SubscriptionUpdateRequestBody

* Bump Docker build push action

* npm update

---------

Co-authored-by: Ankur Banerjee <[email protected]>
  • Loading branch information
benyam7 and ankurdotb committed Jun 24, 2024
1 parent 7453081 commit c0a8879
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
type=sha,format=long
- name: Build image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
org.opencontainers.image.documentation="https://docs.cheqd.io/identity"
- name: Build image with labels
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
Expand Down
63 changes: 33 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"@types/helmet": "^4.0.0",
"@types/json-stringify-safe": "^5.0.3",
"@types/jsonwebtoken": "^9.0.6",
"@types/node": "^20.14.7",
"@types/node": "^20.14.8",
"@types/secp256k1": "^4.0.6",
"@types/swagger-jsdoc": "^6.0.4",
"@types/swagger-ui-express": "^4.1.6",
Expand Down
6 changes: 3 additions & 3 deletions src/controllers/admin/subscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export class SubscriptionController {
@syncOne
async update(request: Request, response: Response) {
const stripe = response.locals.stripe as Stripe;
const { returnUrl, isManagePlan, priceId } = request.body satisfies SubscriptionUpdateRequestBody;
const { returnURL, isManagePlan, priceId } = request.body satisfies SubscriptionUpdateRequestBody;
try {
// Get the subscription object from the DB
const subscription = await SubscriptionService.instance.findOne({ customer: response.locals.customer });
Expand All @@ -277,7 +277,7 @@ export class SubscriptionController {
// Create portal link
const session = await stripe.billingPortal.sessions.create({
customer: response.locals.customer.paymentProviderId,
return_url: returnUrl,
return_url: returnURL,
// based on request body, trigger a manage or confirm update flow.
flow_data: isManagePlan
? undefined
Expand All @@ -295,7 +295,7 @@ export class SubscriptionController {
after_completion: {
type: 'redirect',
redirect: {
return_url: returnUrl,
return_url: returnURL,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/types/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export type SubscriptionUpdateResponseBody = {

// Update
export type SubscriptionUpdateRequestBody = {
returnUrl: string;
returnURL: string;
isManagePlan: boolean;
priceId?: string;
};
Expand Down

0 comments on commit c0a8879

Please sign in to comment.