Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
feat: add PaymentIntentId attribute for Basket for use with Stripe (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
christopappas authored Sep 19, 2022
1 parent bec2e2b commit 481f310
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions ecommerce/extensions/basket/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
TEMPORARY_BASKET_CACHE_KEY = "ecommerce.is_calculate_temporary_basket"
EMAIL_OPT_IN_ATTRIBUTE = "email_opt_in"
PURCHASER_BEHALF_ATTRIBUTE = "purchased_for_organization"
PAYMENT_INTENT_ID_ATTRIBUTE = "payment_intent_id"
27 changes: 27 additions & 0 deletions ecommerce/extensions/basket/migrations/0015_add_paymentintentid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals

from django.db import migrations

from ecommerce.extensions.basket.constants import PAYMENT_INTENT_ID_ATTRIBUTE


def create_attribute(apps, schema_editor):
BasketAttributeType = apps.get_model('basket', 'BasketAttributeType')
BasketAttributeType.objects.create(name=PAYMENT_INTENT_ID_ATTRIBUTE)


def delete_attribute(apps, schema_editor):
BasketAttributeType = apps.get_model('basket', 'BasketAttributeType')
BasketAttributeType.objects.get(name=PAYMENT_INTENT_ID_ATTRIBUTE).delete()


class Migration(migrations.Migration):

dependencies = [
('basket', '0014_line_date_updated'),
]

operations = [
migrations.RunPython(create_attribute, delete_attribute),
]

0 comments on commit 481f310

Please sign in to comment.