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

PB-22e: stripe database functionality #57

Draft
wants to merge 9 commits into
base: PB-22-add-payment-info-stripe
Choose a base branch
from

Conversation

stianjsu
Copy link

@stianjsu stianjsu commented Oct 16, 2023

Adds stripe customer table in a 1:1 relationship with a slack_organization.

Contains fields:

  • customer_id (from stripe)
  • team_id (slack_org/workspace)
  • created_at
  • is_premium (boolean)
  • premium_from
  • premium_to

Run the backend docker container and in its terminal run flask db upgrade to run the migration

image

@stianjsu stianjsu marked this pull request as draft October 16, 2023 21:32
@stianjsu
Copy link
Author

possible name conflict, backend gets stacktrace. Draft until fixed

@stianjsu stianjsu marked this pull request as ready for review October 19, 2023 09:46
@stianjsu stianjsu requested a review from JacobTheisen October 19, 2023 09:47
Copy link
Collaborator

@JacobTheisen JacobTheisen left a comment

Choose a reason for hiding this comment

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

Lgtm🚀🚀

update: trekker det midlertidig tilbake

Copy link
Collaborator

@JacobTheisen JacobTheisen left a comment

Choose a reason for hiding this comment

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

Får en bug i StripeCustomerRepository.get_by_id(customer_id) i get_by_customer_id() i update i stripe_customer_service. Hverken jeg eller gjengen i chatgpt har helt skjønt hva den kommer fra enda.

Eksempelet:

                stripe_customer:StripeCustomer = stripe_service.get_by_customer_id(stripe_customer_id)

                stripe_customer.is_premium = True

                stripe_customer_dict = stripe_customer.__dict__
                print(type(stripe_customer_dict))
                print(stripe_customer_dict)

                stripe_customer_dict.pop("_sa_instance_state", None)
                stripe_customer_dict['created_at'] = stripe_customer_dict['created_at'].isoformat()

                try:
                    t = stripe_service.update(data=stripe_customer_dict, customer_id=stripe_customer.customer_id)
                except Exception as e:
                    print(e)

gir:
StripeCustomerRepository' object has no attribute '_sa_instance_state'

Mulig å se i pb-22d-stripe-webhook-functionality for mer logs og mer fullstendig eksempel.

Kan det komme av noe feil med migrations? (var jo noe knot der)

@stianjsu
Copy link
Author

Får en bug i StripeCustomerRepository.get_by_id(customer_id) i get_by_customer_id() i update i stripe_customer_service. Hverken jeg eller gjengen i chatgpt har helt skjønt hva den kommer fra enda.

Eksempelet:

                stripe_customer:StripeCustomer = stripe_service.get_by_customer_id(stripe_customer_id)

                stripe_customer.is_premium = True

                stripe_customer_dict = stripe_customer.__dict__
                print(type(stripe_customer_dict))
                print(stripe_customer_dict)

                stripe_customer_dict.pop("_sa_instance_state", None)
                stripe_customer_dict['created_at'] = stripe_customer_dict['created_at'].isoformat()

                try:
                    t = stripe_service.update(data=stripe_customer_dict, customer_id=stripe_customer.customer_id)
                except Exception as e:
                    print(e)

gir: StripeCustomerRepository' object has no attribute '_sa_instance_state'

Mulig å se i pb-22d-stripe-webhook-functionality for mer logs og mer fullstendig eksempel.

Kan det komme av noe feil med migrations? (var jo noe knot der)

hmm, ja kk. Håper dette ikke er en case av "dette funker på min maskin". Jeg skal sjekke det ut, men får nok ikke tid til det før onsdag

@stianjsu stianjsu requested a review from JacobTheisen November 4, 2023 17:29
Copy link

@annabjorgo annabjorgo left a comment

Choose a reason for hiding this comment

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

👏👏👏 bra jobba!

Copy link
Collaborator

@sergiosja sergiosja left a comment

Choose a reason for hiding this comment

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

LGTM sjef 🚀 bare en liten ting jeg undret på👇🏼



class StripeCustomerRepository(StripeCustomer, CrudMixin):
pass
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hvorfor trenger vi klassen om den ikke gjør noe? Fungerer den som et slags tomt mellomlag?

@stianjsu
Copy link
Author

Error with foreign key constraint on delete. Moving to draft for now
image

@stianjsu stianjsu marked this pull request as draft November 16, 2023 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants