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

Move API Keys to Admin from settings file. #1993

Open
wants to merge 92 commits into
base: master
Choose a base branch
from

Conversation

arnav13081994
Copy link
Collaborator

@arnav13081994 arnav13081994 commented Sep 29, 2023

This PR makes the following changes:

  • Removed deprecated LIVE_API_KEY setting
  • Removed deprecated TEST_API_KEY setting
  • Removed deprecated STRIPE_SECRET_KEY setting
  • Removed deprecated STRIPE_LIVE_SECRET_KEY setting
  • Removed deprecated STRIPE_TEST_SECRET_KEY setting
  • Added setting GET_DEFAULT_STRIPE_SECRET_KEY to get the default Secret API Key for the given livemode and djstripe_owner_account
  • Updated System Checks to warn the user if they have set stripe.api_key in addition to adding API Keys to the db.
  • Added djstripe_is_account_default so that it can be deduced in an unambguous way the default api_key for a given key type, livemode, djstripe_owner_account when djstripe_is_account_default is True.
  • Allowed the user to set a default Secret API key as from Django Admin.

Please note there are no migrations and tests as all that would be taken together. I have verified manually that all existing flows work as expected.

Screenshot 2023-10-03 at 8 29 13 PM Screenshot 2023-10-03 at 8 28 56 PM

jleclanche and others added 30 commits August 8, 2023 13:59
sqlite3.IntegrityError: NOT NULL constraint failed: djstripe_webhookendpoint.tolerance

Fixes #1955
Instead djstripe_settings.WEBHOOK_TOLERANCE, since it was removed (#1967)
* Updated BaseInvoice.retry to accept kwargs

This was done so that kwargs can be passed down to
Invoice.pay()

* Updated Customer.send_invoice method

This was done so that kwargs could be passed down to
Invoice.pay().

* Formatting fix

* Updated docs
…ue_account_api_key_default_per_key_type constraint
…ripe_apikey_secret_key constraint

This constraint is created to handle violations of duplicate secret keys. This happens in case of
adding an api key for non existent Platform accounts.
In case the key was added before the account was created, we end
up creating the key before the Admin form gets created due to how
the sync algorithm works. This commit will not correctly handle
creation of APIKeys.
…ault

In case the key was added before the account was created, we end
up creating the key before the Admin form gets created due to how
the sync algorithm works. This commit will not correctly handle
creation of APIKeys.
@arnav13081994 arnav13081994 marked this pull request as ready for review October 3, 2023 12:00
@arnav13081994 arnav13081994 changed the title [WIP] Move API Keys to Admin from settings file. Move API Keys to Admin from settings file. Oct 3, 2023
@arnav13081994
Copy link
Collaborator Author

@jleclanche This PR is ready for review.

fields = ["name", "djstripe_is_account_default"]

@property
def construct_custom_error_message(self):
Copy link
Member

Choose a reason for hiding this comment

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

Make this a separate helper function that takes the type and the account as arguments, instead of a class member.

@jleclanche
Copy link
Member

Could you include screenshots here of what the changes look like in the admin?

@arnav13081994
Copy link
Collaborator Author

@jleclanche Changes made. Description updated with screenshots of add and edit admin views.

@jleclanche jleclanche force-pushed the master branch 2 times, most recently from bf4515d to d89e50e Compare April 25, 2024 08:47
@crunchy234
Copy link

Would like to have this merged so that I can switch everything to being managed through the database rather than having both settings and database.

@jleclanche jleclanche force-pushed the master branch 3 times, most recently from 15e04c3 to 8727894 Compare April 25, 2024 14:48
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

7 participants