-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
24871 - Add route return valid payment method for product (#1866)
- Loading branch information
Showing
7 changed files
with
132 additions
and
2 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
pay-api/migrations/versions/2024_12_18_695a899f8a25_add_payment_methods_to_corp_types.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
"""add payment_methods column to corp_types table, and insert payment methods based on product | ||
Revision ID: 695a899f8a25 | ||
Revises: 4f3a44eeade8 | ||
Create Date: 2024-12-18 11:32:07.538729 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
# Note you may see foreign keys with distribution_codes_history | ||
# For disbursement_distribution_code_id, service_fee_distribution_code_id | ||
# Please ignore those lines and don't include in migration. | ||
|
||
revision = '695a899f8a25' | ||
down_revision = '4f3a44eeade8' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.add_column( | ||
'corp_types', | ||
sa.Column('payment_methods', sa.ARRAY(sa.String()), nullable=True) | ||
) | ||
|
||
op.execute(""" | ||
UPDATE corp_types | ||
SET payment_methods = | ||
CASE product | ||
WHEN 'BUSINESS' THEN ARRAY['PAD', 'DIRECT_PAY', 'EFT', 'EJV', 'ONLINE_BANKING', 'DRAWDOWN', 'INTERNAL'] | ||
WHEN 'NRO' THEN ARRAY['DIRECT_PAY','PAD', 'DRAWDOWN', 'INTERNAL'] | ||
WHEN 'RPPR' THEN ARRAY['PAD', 'DRAWDOWN', 'INTERNAL'] | ||
WHEN 'VS' THEN ARRAY['DIRECT_PAY','PAD', 'DRAWDOWN', 'EFT', 'EJV', 'INTERNAL'] | ||
WHEN 'RPT' THEN ARRAY['PAD', 'DRAWDOWN', 'EFT', 'EJV', 'INTERNAL'] | ||
WHEN 'BUSINESS_SEARCH' THEN ARRAY['PAD', 'DIRECT_PAY', 'DRAWDOWN', 'EJV', 'EFT', 'INTERNAL'] | ||
WHEN 'CSO' THEN ARRAY['PAD', 'DRAWDOWN', 'EJV', 'INTERNAL'] | ||
WHEN 'ESRA' THEN ARRAY['PAD', 'DRAWDOWN', 'EJV', 'INTERNAL'] | ||
WHEN 'PPR' THEN ARRAY['PAD', 'DIRECT_PAY', 'DRAWDOWN', 'EFT', 'EJV', 'INTERNAL'] | ||
WHEN 'MHR' THEN ARRAY['PAD', 'DIRECT_PAY', 'DRAWDOWN', 'EFT', 'EJV', 'INTERNAL'] | ||
ELSE ARRAY['INTERNAL'] | ||
END | ||
WHERE product IS NOT NULL | ||
""") | ||
|
||
|
||
def downgrade(): | ||
op.drop_column('corp_types', 'payment_methods') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters