Skip to content

Commit

Permalink
add new payment_type legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
asadali145 committed Feb 9, 2023
1 parent f528d19 commit 23f0b3d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
2 changes: 2 additions & 0 deletions ecommerce/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@
PAYMENT_TYPE_FINANCIAL_ASSISTANCE = "financial-assistance"
PAYMENT_TYPE_CUSTOMER_SUPPORT = "customer-support"
PAYMENT_TYPE_STAFF = "staff"
PAYMENT_TYPE_LEGACY = "legacy"

ALL_PAYMENT_TYPES = [
PAYMENT_TYPE_MARKETING,
PAYMENT_TYPE_SALES,
PAYMENT_TYPE_FINANCIAL_ASSISTANCE,
PAYMENT_TYPE_CUSTOMER_SUPPORT,
PAYMENT_TYPE_STAFF,
PAYMENT_TYPE_LEGACY,
]

PAYMENT_TYPES = list(zip(ALL_PAYMENT_TYPES, ALL_PAYMENT_TYPES))
Expand Down
3 changes: 2 additions & 1 deletion ecommerce/migrations/0031_discount_payment_type.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.2.15 on 2023-02-02 09:12
# Generated by Django 3.2.15 on 2023-02-09 08:49

from django.db import migrations, models

Expand All @@ -20,6 +20,7 @@ class Migration(migrations.Migration):
("financial-assistance", "financial-assistance"),
("customer-support", "customer-support"),
("staff", "staff"),
("legacy", "legacy"),
],
max_length=30,
null=True,
Expand Down
8 changes: 7 additions & 1 deletion ecommerce/migrations/0032_backfill_payment_types.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Generated by Django 3.2.15 on 2023-02-02 09:12
# Generated by Django 3.2.15 on 2023-02-09 08:49

from django.db import migrations
from django.db.models import Q

from ecommerce.constants import (
PAYMENT_TYPE_CUSTOMER_SUPPORT,
PAYMENT_TYPE_FINANCIAL_ASSISTANCE,
PAYMENT_TYPE_LEGACY,
PAYMENT_TYPE_MARKETING,
PAYMENT_TYPE_STAFF,
)
Expand All @@ -29,6 +30,11 @@ def backfill_payment_types(apps, schema_editor):
payment_type=PAYMENT_TYPE_STAFF
)

# legacy discounts start with `MM-prepaid-`
discount.objects.filter(discount_code__startswith="MM-prepaid-").update(
payment_type=PAYMENT_TYPE_LEGACY
)

# marketing discount codes have multiple start codes
discount.objects.filter(
Q(discount_code__startswith="MITALUM15-")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.2.15 on 2023-02-03 13:43
# Generated by Django 3.2.15 on 2023-02-09 08:52

from django.db import migrations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export const DiscountForm = (props: IDiscountFormProps) => {
{ label: 'sales', value: 'sales' },
{ label: 'financial-assistance', value: 'financial-assistance' },
{ label: 'customer-support', value: 'customer-support' },
{ label: 'staff', value: 'staff' }
{ label: 'staff', value: 'staff' },
{ label: 'legacy', value: 'legacy' }
]}></Select>
</Form.Item>
<Form.Item label="Activation Date" name="activation_date">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import {
import {Discount_Redemption_Types} from "../../constants";

export const DiscountFilterForm: React.FC<{ formProps: FormProps }> = ({ formProps }) => {
const flexPriceOpts = [
{ label: '', value: '' }, { label: 'For Financial Assistance', value: 'yes' }, { label: 'Regular Discount', value: 'no' }
]
const DiscountPaymentTypesOpts = [
{
label: '',
Expand All @@ -38,6 +35,10 @@ export const DiscountFilterForm: React.FC<{ formProps: FormProps }> = ({ formPro
label: 'staff',
value: 'staff',
},
{
label: 'legacy',
value: 'legacy',
},
]
const redemptionOpts = [
{ label: '', value: '' }, { label: 'Redeemed', value: 'yes' }, { label: 'Not Redeemed', value: 'no' }
Expand Down

0 comments on commit 23f0b3d

Please sign in to comment.