Skip to content

Commit

Permalink
Merge pull request #841 from bcgov/cfs_rcpt_adjust
Browse files Browse the repository at this point in the history
Adding refund_amount column and update its value on routing_slips model
  • Loading branch information
sumesh-aot authored Dec 15, 2021
2 parents 781c0ea + 4c33afa commit df60b7f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions jobs/payment-jobs/tasks/routing_slip_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def adjust_routing_slips(cls):
# Adjust the receipt to zero in CFS
CFSService.adjust_receipt_to_zero(cfs_account, receipt_number, is_refund)

routing_slip.refund_amount = routing_slip.remaining_amount
routing_slip.remaining_amount = 0
routing_slip.save()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""routing_slip_refund_amount
Revision ID: 0d885750ded9
Revises: aa9207187d6b
Create Date: 2021-12-14 10:19:33.738170
"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = '0d885750ded9'
down_revision = 'aa9207187d6b'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('routing_slips', sa.Column('refund_amount', sa.Numeric(), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('routing_slips', 'refund_amount')
# ### end Alembic commands ###
1 change: 1 addition & 0 deletions pay-api/src/pay_api/models/routing_slip.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class RoutingSlip(Audit): # pylint: disable=too-many-instance-attributes
remaining_amount = db.Column(db.Numeric(), nullable=True, default=0)
routing_slip_date = db.Column(db.Date, nullable=False)
parent_number = db.Column(db.String(), ForeignKey('routing_slips.number'), nullable=True)
refund_amount = db.Column(db.Numeric(), nullable=True, default=0)

payment_account = relationship(PaymentAccount, foreign_keys=[payment_account_id], lazy='select', innerjoin=True)
payments = relationship(Payment,
Expand Down

0 comments on commit df60b7f

Please sign in to comment.