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

[db][payment][server] Implement TeamSubscription2.excludeFromMoreResources #10370

Merged
merged 1 commit into from
Jun 1, 2022

Conversation

jankeromnes
Copy link
Contributor

Description

Align the new TeamSubscription2 shape with legacy TeamSubscription by adding an equivalent excludeFromMoreResources DB flag.

Related Issue(s)

Fixes https://github.com/gitpod-io/ops/issues/2346

How to test

  1. Create a Team
  2. Go to Team Billing
  3. Purchase a new Team Plan (either Professional or Unleashed) and wait for the plan to materialize successfully
  4. Connect to the DB (e.g. by doing ./dev/preview/install-k3s-kubeconfig.sh followed by kubectl port-forward mysql-0 3306 & and mysql -h 127.0.0.1 -pjBzVMe2w4Yi7GagadsyB gitpod)
  5. Verify that d_b_team_subscription2 has a excludeFromMoreResources column

Release Notes

NONE

Documentation

  • /werft with-payment

@jankeromnes jankeromnes requested a review from a team May 31, 2022 08:00
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label May 31, 2022
public async up(queryRunner: QueryRunner): Promise<void> {
if (!(await columnExists(queryRunner, TABLE_NAME, COLUMN_NAME))) {
await queryRunner.query(
`ALTER TABLE ${TABLE_NAME} ADD COLUMN ${COLUMN_NAME} tinyint(4) NOT NULL DEFAULT '1', ALGORITHM=INPLACE, LOCK=NONE `,
Copy link
Member

Choose a reason for hiding this comment

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

👍

@geropl geropl self-assigned this Jun 1, 2022
@geropl
Copy link
Member

geropl commented Jun 1, 2022

@jankeromnes I started testing, but never saw any update Chargebee -> back into our system:
image
Not sure why that is; the event was sent successfully (after setting up the webhook in CB):
image

I wanted to see an entry for that subscription in the table, to make sure writing/default values are working.
Could you have a look what I did wrong? 🤔

@jankeromnes
Copy link
Contributor Author

jankeromnes commented Jun 1, 2022

@geropl Thanks for looking into this, and for setting up a Chargebee webhook! (Forgot to do that when requesting review.)

However, I believe that, even though Test Webhook reported a "success", the webhook URL was actually incorrect -- it appeared to be missing a payment. hostname prefix:

Screenshot 2022-06-01 at 12 59 40

I've fixed the webhook URL, and now Team Plan creation seems to work fine:

Screenshot 2022-06-01 at 13 02 14

Could you please take another look? 🙏

@jankeromnes
Copy link
Contributor Author

FYI, the column seems to be there in the DB (scroll to right):

mysql> select * from d_b_team_subscription2;
+--------------------------------------+--------------------------------------+-------------------+--------------------------+---------+-----------------------+----------+------------------+---------+----------------------------+--------------------------+
| id                                   | teamId                               | paymentReference  | startDate                | endDate | planId                | quantity | cancellationDate | deleted | _lastModified              | excludeFromMoreResources |
+--------------------------------------+--------------------------------------+-------------------+--------------------------+---------+-----------------------+----------+------------------+---------+----------------------------+--------------------------+
| 923258dd-6c87-4114-8aa3-002e32a73ac1 | b7ff50fd-953d-4cdc-b861-9432ece6b40c | Azyzb1T7VEWhV2SwW | 2022-06-01T11:01:53.000Z |         | team-professional-eur |        1 |                  |       0 | 2022-06-01 11:02:08.281794 |                        1 |
| c745d644-1225-495d-a17a-8a83a4d4b1cf | 674f2515-8d5b-4807-bfd0-557b0ebed77a | Azyzb1T7Ug0w9288L | 2022-06-01T08:44:59.000Z |         | team-professional-usd |        1 |                  |       0 | 2022-06-01 11:04:13.097876 |                        1 |
+--------------------------------------+--------------------------------------+-------------------+--------------------------+---------+-----------------------+----------+------------------+---------+----------------------------+--------------------------+
2 rows in set (0.01 sec)

Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

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

Code looks good, and when configuring everything correctly, it works as expected! 🧘 🚀

@roboquat roboquat merged commit 7c0ecdb into main Jun 1, 2022
@roboquat roboquat deleted the jx/ts2-xl branch June 1, 2022 11:07
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/M team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants