Skip to content

Commit

Permalink
Merge branch 'stage' into landing-page
Browse files Browse the repository at this point in the history
  • Loading branch information
RabeeAbuBaker authored Nov 17, 2023
2 parents 388e3a5 + edd743f commit dd81d3c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
16 changes: 1 addition & 15 deletions app/routes/api.admin.update-plan/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export type UpdatePlanArgs = {
type: PayPlanType | null
limit?: number | null
subscription?: string | null
subscription_delete?: string | null
}

export const action: ActionFunction = async ({ request }) => {
Expand All @@ -24,26 +23,16 @@ export const action: ActionFunction = async ({ request }) => {
const type = formData.get("type") as UpdatePlanArgs["type"]
const limit = formData.get("limit") as UpdatePlanArgs["limit"]
const subscription = formData.get("subscription") as UpdatePlanArgs["subscription"]
const subscription_delete = formData.get(
"subscription_delete",
) as UpdatePlanArgs["subscription_delete"]

return await updatePlan({
id,
type,
limit,
subscription,
subscription_delete,
})
}

export const updatePlan = async ({
id,
type,
limit,
subscription,
subscription_delete,
}: UpdatePlanArgs) => {
export const updatePlan = async ({ id, type, limit, subscription }: UpdatePlanArgs) => {
const portal = initPortalClient()

try {
Expand All @@ -62,9 +51,6 @@ export const updatePlan = async ({
if (subscription) {
options.input.stripeSubscriptionID = subscription
}
if (subscription_delete) {
options.input.stripeSubscriptionID = ""
}

await portalAdmin.adminUpdateAccount(options)

Expand Down
3 changes: 1 addition & 2 deletions app/routes/api.stripe.subscription-delete/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ export const action: ActionFunction = async ({ request }) => {
if (updatedSubscription) {
await updatePlan({
id: accountId as string,
type: PayPlanType.FreetierV0 as unknown as PayPlanType.FreetierV0,
subscription_delete: "true",
type: PayPlanType.FreetierV0,
})

return json({
Expand Down

0 comments on commit dd81d3c

Please sign in to comment.