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

feat(console): Service Plan - Application entitlement assignment #2451

Merged

Conversation

Cosmin-Parvulescu
Copy link
Contributor

@Cosmin-Parvulescu Cosmin-Parvulescu commented Jun 29, 2023

Description

  • Implemented Figma designs
  • Added appPlan to appDetails so that we can access the app's current plan throughout console
  • Added returnURL to updatePaymentMethod in stripe client so that we can return to multiple places
  • Added FREE plan to ServiceTypes as well as plans.ts
  • Added handled metadata when creating / updating subscriptions. This can be set to whatever value and if it's present in the webhook event, it A - clears it from the subscription and B - returns without updating entitlements. This allows for sychronous payments.
  • Added status pill component
  • Added new edge type (pays/app)

Related Issues

Testing

  • Adding these two lines to the nodes/account.ts file allows one to reset their clientID as well as paymentInformation and existing service plans:
  async getServicePlans(): Promise<ServicePlans | undefined> {
    await this.state.storage.delete('stripePaymentData') // This 
    await this.state.storage.delete('servicePlans') // and this

    return this.state.storage.get<ServicePlans>('servicePlans')
  }

After that, it's a matter of going through the flows.

Checklist

  • I have read the CONTRIBUTING guidelines
  • I have tested my code (manually and/or automated if applicable)
  • I have updated the documentation (if necessary)

@Cosmin-Parvulescu Cosmin-Parvulescu self-assigned this Jun 29, 2023
@Cosmin-Parvulescu Cosmin-Parvulescu added the enhancement Indicates new feature requests label Jun 29, 2023
@Cosmin-Parvulescu Cosmin-Parvulescu marked this pull request as ready for review June 29, 2023 14:42
Copy link
Contributor

@szkl szkl left a comment

Choose a reason for hiding this comment

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

It'd be nice to avoid the long switch statement in apps/console/app/routes/apps/$clientId/gnillib.tsx.

Comment on lines +75 to +76
published?: boolean
createdTimestamp?: number
Copy link
Contributor

Choose a reason for hiding this comment

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

Why these are optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I couldn't say; just extracted a type from the initial LoaderData that can be used somewhere else.

}
}

export const loader: LoaderFunction = getRollupReqFunctionErrorWrapper(
async ({ request, context }) => {
const jwt = await requireJWT(request)
const traceHeader = generateTraceContextHeaders(context.traceSpan)
const parsedJwt = parseJwt(jwt)
const parsedJwt = parseJwt(jwt!)
Copy link
Contributor

Choose a reason for hiding this comment

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

await requireJWT(request) should be throwing or returning a jwt. The non-null assertion shouldn't be needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a check

@@ -27,6 +27,12 @@ export const loader: LoaderFunction = getRollupReqFunctionErrorWrapper(
accountURN,
})

return updatePaymentMethod({ customerID })
const headers = request.headers
const returnURL = headers.get('Referer') as string
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be a good idea to check if there is a referer in case of an abnormal request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Checked

@Cosmin-Parvulescu
Copy link
Contributor Author

It'd be nice to avoid the long switch statement in apps/console/app/routes/apps/$clientId/gnillib.tsx.

I extracted the two methods to make it a bit more readable I guess.

@szkl
Copy link
Contributor

szkl commented Jun 30, 2023

image

@szkl szkl merged commit 06b099c into main Jun 30, 2023
@szkl szkl deleted the feat/console/service-plan-application-entitlement-assignment branch June 30, 2023 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates new feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(console): Service Plan - Application entitlement assignment
2 participants