Skip to content

Commit

Permalink
bug fix - Queue missing update for RoutingSlipRefundStatus to PROCESS…
Browse files Browse the repository at this point in the history
…ED (#1874)
  • Loading branch information
Jxio authored Jan 16, 2025
1 parent e0de79e commit 19d12bf
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""Update: Queue Missing update for RoutingSlipRefundStatus to PROCESSED when status is REFUND_PROCESSED
Revision ID: 88d31807423b
Revises: 2bf752a59955
Create Date: 2025-01-15 15:33:56.268441
"""
from alembic import op
import sqlalchemy as sa

from pay_api.utils.enums import RoutingSlipRefundStatus, RoutingSlipStatus


# 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 = '88d31807423b'
down_revision = '2bf752a59955'
branch_labels = None
depends_on = None


def upgrade():
op.execute(f"""
UPDATE routing_slips
SET refund_status = '{RoutingSlipRefundStatus.PROCESSED.value}'
WHERE status = '{RoutingSlipStatus.REFUND_PROCESSED.value}';
""")


def downgrade():
pass
46 changes: 25 additions & 21 deletions pay-queue/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pay-queue/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ itsdangerous = "^2.1.2"
protobuf = "4.25.3"
launchdarkly-server-sdk = "^8.2.1"
cachecontrol = "^0.14.0"
pay-api = {git = "https://github.com/bcgov/sbc-pay.git", branch = "main", subdirectory = "pay-api"}
pay-api = {git = "https://github.com/Jxio/sbc-pay.git", branch = "25193", subdirectory = "pay-api"}
pg8000 = "^1.30.5"


Expand Down
2 changes: 2 additions & 0 deletions pay-queue/src/pay_queue/services/cgi_reconciliations.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
PaymentStatus,
PaymentSystem,
QueueSources,
RoutingSlipRefundStatus,
RoutingSlipStatus,
)
from sbc_common_components.utils.enums import QueueMessageTypes
Expand Down Expand Up @@ -463,6 +464,7 @@ def _process_ap_header_routing_slips(line) -> bool:
)
else:
routing_slip.status = RoutingSlipStatus.REFUND_PROCESSED.value
routing_slip.refund_status = RoutingSlipRefundStatus.PROCESSED.value
refund = RefundModel.find_by_routing_slip_id(routing_slip.id)
refund.gl_posted = datetime.now()
refund.save()
Expand Down
3 changes: 3 additions & 0 deletions pay-queue/tests/integration/test_cgi_reconciliations.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
InvoiceStatus,
PaymentMethod,
PaymentStatus,
RoutingSlipRefundStatus,
RoutingSlipStatus,
)
from sbc_common_components.utils.enums import QueueMessageTypes
Expand Down Expand Up @@ -1089,6 +1090,7 @@ def test_successful_refund_reconciliations(session, app, client):
for rs_number in rs_numbers:
routing_slip = RoutingSlipModel.find_by_number(rs_number)
assert routing_slip.status == RoutingSlipStatus.REFUND_PROCESSED.value
assert routing_slip.refund_status == RoutingSlipRefundStatus.PROCESSED.value


def test_failed_refund_reconciliations(session, app, client):
Expand Down Expand Up @@ -1226,6 +1228,7 @@ def test_failed_refund_reconciliations(session, app, client):
assert ejv_file.disbursement_status_code == DisbursementStatus.COMPLETED.value
routing_slip_1 = RoutingSlipModel.find_by_number(rs_numbers[0])
assert routing_slip_1.status == RoutingSlipStatus.REFUND_PROCESSED.value
assert routing_slip_1.refund_status == RoutingSlipRefundStatus.PROCESSED.value

routing_slip_2 = RoutingSlipModel.find_by_number(rs_numbers[1])
assert routing_slip_2.status == RoutingSlipStatus.REFUND_REJECTED.value
Expand Down

0 comments on commit 19d12bf

Please sign in to comment.