The primary key is usually a bigint column, but the foreign key columns
are usually of integer type. This can lead to issues when joining these
columns due to mismatched types and different value ranges.
If the pricing table is enabled the `/s` route should redirect to the
pricing table route and vice versa.
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
When using the Stripe Pricing Table for one-off purchases
(non-subscription) stripe doesn't automatically create a customer
record. This was causing the pricing table webhook
endpoint to end prematurely and not add users to their appropriate
group after purchase. Now if we detect that there is no customer record
we will make an api call to Stripe to create one.
To aid in debugging I'm adding a verbose logging site setting. I'm
adding this because I'm currently getting some errors in production that
I'm unable to replicate locally.
See: https://meta.discourse.org/t/323450/4
When using the Stripe Pricing table for one-off purchases
(non-subscriptions) the webhook was encountering an error because it was
expecting subscription information which does not exist for one-off
purchases. This fix addresses that issue ensuring that no errors occur,
that users are added to the appropriate group, and that uses can see
their purchase on the billing page.
Depending on the invoices in stripe there could be some nil values for
things so we need to account for those in this job or an exception will
be thrown causing the job to fail.
FEATURE: Site Setting to enable automatic tax
There is now a new site setting called
`discourse_subscriptions_enable_automatic_tax` that can be enabled if
you would like to automatically compute tax rates on all new
subscriptions.
Instead of deleting customers on cancel we will now update the
subscription status to canceled. This way we can have some visibility on
which users have canceled.
The Auto-Create Support Campaign button was just showing an infinite "is
loading" spinner so you couldn't even click on it.
This fix allows the button to work again and only show the loading
spinner when it is actually loading.
See: https://meta.discourse.org/t/discourse-subscriptions/140818/653?u=blake
Likely there was an API change at some point now that we are using the
latest version of the stripe API. When the
`customer.subscription.updated` webhook is called we should also accept
the status of "active".
This commit adds an optional new stripe based pricing table.
If the user is logged in, the email field will be prepopulated with the users email.
The pricing table can be configured in the stripe dashboard.
Once the discourse_subscriptions_pricing_table setting is filled with the pricing table embed code from the stripe dashboard,
the pricing table will be displayed on /s/subscriptions
For more details see https://stripe.com/docs/payments/checkout/pricing-table
---------
Co-authored-by: spirobel <spirobel@protonmail.com>