Skip to content

Commit

Permalink
19875 - Add Disbursement to refunds_partial (#1433)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jxio authored Feb 28, 2024
1 parent 3d2c7b0 commit cea8285
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""19875 - Disbursement Date and Status for Partial Refunds.
Revision ID: bacb2b859d78
Revises: 1ec047cf4308
Create Date: 2024-02-28 10:59:05.732786
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'bacb2b859d78'
down_revision = '1ec047cf4308'
branch_labels = None
depends_on = None


def upgrade():
op.add_column('refunds_partial', sa.Column('disbursement_status_code', sa.String(length=20), nullable=True))
op.add_column('refunds_partial', sa.Column('disbursement_date', sa.Date(), nullable=True))
op.create_foreign_key(None, 'refunds_partial', 'disbursement_status_codes', ['disbursement_status_code'], ['code'])

op.add_column('refunds_partial_version', sa.Column('disbursement_status_code', sa.String(length=20), autoincrement=False, nullable=True))
op.add_column('refunds_partial_version', sa.Column('disbursement_date', sa.Date(), autoincrement=False, nullable=True))

def downgrade():
op.drop_constraint(None, 'refunds_partial', type_='foreignkey')
op.drop_column('refunds_partial', 'disbursement_status_code')
op.drop_column('refunds_partial', 'disbursement_date')

op.drop_column('refunds_partial_version', 'disbursement_status_code')
op.drop_column('refunds_partial_version', 'disbursement_date')
6 changes: 5 additions & 1 deletion pay-api/src/pay_api/models/refunds_partial.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,18 @@ class RefundsPartial(Audit, VersionedModel): # pylint: disable=too-many-instanc
'id',
'payment_line_item_id',
'refund_amount',
'refund_type'
'refund_type',
'disbursement_status_code',
'disbursement_date'
]
}

id = db.Column(db.Integer, primary_key=True, autoincrement=True)
payment_line_item_id = db.Column(db.Integer, ForeignKey('payment_line_items.id'), nullable=False, index=True)
refund_amount = db.Column(db.Numeric(19, 2), nullable=False)
refund_type = db.Column(db.String(50), nullable=True)
disbursement_status_code = db.Column(db.String(20), ForeignKey('disbursement_status_codes.code'), nullable=True)
disbursement_date = db.Column(db.DateTime, nullable=True)


@define
Expand Down

0 comments on commit cea8285

Please sign in to comment.