Skip to content

Commit

Permalink
Add in disbursement reversal date for CSO (bcgov#1680)
Browse files Browse the repository at this point in the history
  • Loading branch information
seeker25 authored Aug 13, 2024
1 parent 954efee commit 0d1c9b3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
5 changes: 4 additions & 1 deletion docs/docs/api_contract/pay-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ info:
<p>BC Registries Pay system is used by the BC Registries account services and integrated systems to create payment transactions to pay for the products purchased. This abstracts the integrated systems from the underlying payment integrations and payment methods. <br/>
With this API you can submit the following transactions:<ul><li>Create payment transactions</li><li>Get payment status</li><li>Delete unpaid payment transactions</li><li>Generate PDF receipt</li><li>Retrieve account statements</li><li>Generate account transactions reports</li></ul>
<p>All requests must include an Account ID.</p>
version: 1.0.6
version: 1.0.7
contact:
name: BC Registries
paths:
Expand Down Expand Up @@ -1617,6 +1617,9 @@ components:
disbursementDate:
type: string
description: date when disbursement status code was set
disbursementReversalDate:
type: string
description: date when disbursement reversal status code was set
overdueDate:
type: string
description: date when payment is overdue (EFT / ONLINE_BANKING)
Expand Down
2 changes: 2 additions & 0 deletions pay-api/src/pay_api/models/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ class InvoiceSearchModel: # pylint: disable=too-few-public-methods, too-many-in
payment_date: datetime
refund_date: datetime
disbursement_date: datetime
disbursement_reversal_date: datetime
# Add disbursement_reversal_date when CSO is prepared.

@classmethod
Expand Down Expand Up @@ -321,4 +322,5 @@ def from_row(cls, row):
payment_date=row.payment_date,
refund_date=row.refund_date,
disbursement_date=row.disbursement_date,
disbursement_reversal_date=row.disbursement_reversal_date,
invoice_number=invoice_number)
1 change: 1 addition & 0 deletions pay-api/src/pay_api/models/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ def search_purchase_history(cls, # noqa:E501; pylint:disable=too-many-arguments
Invoice.filing_id,
Invoice.bcol_account,
Invoice.disbursement_date,
Invoice.disbursement_reversal_date,
Invoice.overdue_date
),
contains_eager(Invoice.payment_line_items)
Expand Down
2 changes: 1 addition & 1 deletion pay-api/src/pay_api/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
Development release segment: .devN
"""

__version__ = '1.21.7' # pylint: disable=invalid-name
__version__ = '1.21.8' # pylint: disable=invalid-name
7 changes: 6 additions & 1 deletion pay-api/tests/unit/api/test_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
Test-Suite to ensure that the /accounts endpoint is working as expected.
"""

from datetime import datetime, timezone
import json
from unittest.mock import patch

Expand Down Expand Up @@ -54,6 +55,10 @@ def test_account_purchase_history(session, client, jwt, app):
invoice: Invoice = Invoice.find_by_id(rv.json.get('id'))
pay_account: PaymentAccount = PaymentAccount.find_by_id(invoice.payment_account_id)

invoice.disbursement_date = datetime.now(tz=timezone.utc)
invoice.disbursement_reversal_date = datetime.now(tz=timezone.utc)
invoice.save()

rv = client.post(f'/api/v1/accounts/{pay_account.auth_account_id}/payments/queries', data=json.dumps({}),
headers=headers)

Expand All @@ -64,7 +69,7 @@ def test_account_purchase_history(session, client, jwt, app):
assert invoice
required_fields = ['id', 'corpTypeCode', 'createdOn', 'statusCode', 'total', 'serviceFees',
'paid', 'refund', 'folioNumber', 'createdName', 'paymentMethod', 'details',
'businessIdentifier', 'createdBy', 'filingId']
'businessIdentifier', 'createdBy', 'filingId', 'disbursementReversalDate', 'disbursementDate']

for field in required_fields:
assert field in invoice
Expand Down

0 comments on commit 0d1c9b3

Please sign in to comment.