diff --git a/pay-api/migrations/versions/2024_02_28_bacb2b859d78_partial_refund_disbursement.py b/pay-api/migrations/versions/2024_02_28_bacb2b859d78_partial_refund_disbursement.py new file mode 100644 index 000000000..ab276fb81 --- /dev/null +++ b/pay-api/migrations/versions/2024_02_28_bacb2b859d78_partial_refund_disbursement.py @@ -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') diff --git a/pay-api/src/pay_api/models/refunds_partial.py b/pay-api/src/pay_api/models/refunds_partial.py index 11b0af1ff..9fda23d51 100644 --- a/pay-api/src/pay_api/models/refunds_partial.py +++ b/pay-api/src/pay_api/models/refunds_partial.py @@ -42,7 +42,9 @@ 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' ] } @@ -50,6 +52,8 @@ class RefundsPartial(Audit, VersionedModel): # pylint: disable=too-many-instanc 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