Skip to content

Commit

Permalink
17828 - EFT - A start on some of the database model changes. (#1255)
Browse files Browse the repository at this point in the history
* A start on some of the database model changes.

* Change code owners

* revert __init__.py

* add in insert for invoice_status_codes.

* Update version.py.
  • Loading branch information
seeker25 authored Sep 25, 2023
1 parent d676b3a commit c977ab5
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @seeker25 @jxio @kialj876
* @seeker25 @jxio @ochiu
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.4
version: 1.0.5
contact:
name: BC Registries
paths:
Expand Down Expand Up @@ -1610,13 +1610,16 @@ components:
description: username of the account
createdBy:
type: string
description: invoice creation date
description: user who created the invoice
createdOn:
type: string
description: date made payment
description: date made invoice
disbursementDate:
type: string
description: date when disbursement status code was set
overdueDate:
type: string
description: date when payment is overdue (EFT / ONLINE_BANKING)
paid:
type: number
description: amount paid
Expand Down Expand Up @@ -1644,6 +1647,7 @@ components:
- SETTLEMENT_SCHED
- CANCELLED
- CREDITED
- OVERDUE
references:
type: array
items:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Add overdue date to invoices.
Revision ID: 3a21a14b4137
Revises: 33bbd4d9a85c
Create Date: 2023-09-25 13:20:03.578472
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '3a21a14b4137'
down_revision = '33bbd4d9a85c'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('invoices', sa.Column('overdue_date', sa.DateTime(), nullable=True))
op.execute('insert into invoice_status_codes (code, description) values (\'OVERDUE\', \'Overdue\')')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('invoices', 'overdue_date')
op.execute('delete from invoice_status_codes where code = \'OVERDUE\'')
# ### end Alembic commands ###
4 changes: 3 additions & 1 deletion pay-api/src/pay_api/models/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,13 @@ class Invoice(Audit): # pylint: disable=too-many-instance-attributes
'payment_account_id',
'payment_date',
'payment_method_code',
'total',
'paid',
'overdue_date',
'refund',
'refund_date',
'routing_slip',
'service_fees',
'total',
'updated_by',
'updated_name',
'updated_on'
Expand All @@ -97,6 +98,7 @@ class Invoice(Audit): # pylint: disable=too-many-instance-attributes
total = db.Column(db.Numeric(19, 2), nullable=False)
paid = db.Column(db.Numeric(19, 2), nullable=True)
payment_date = db.Column(db.DateTime, nullable=True)
overdue_date = db.Column(db.DateTime, nullable=True)
refund_date = db.Column(db.DateTime, nullable=True)
refund = db.Column(db.Numeric(19, 2), nullable=True)
routing_slip = db.Column(db.String(50), nullable=True, index=True)
Expand Down
1 change: 1 addition & 0 deletions pay-api/src/pay_api/utils/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class InvoiceStatus(Enum):
REFUNDED = 'REFUNDED'
CANCELLED = 'CANCELLED'
CREDITED = 'CREDITED'
OVERDUE = 'OVERDUE'


class TransactionStatus(Enum):
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.19.0' # pylint: disable=invalid-name
__version__ = '1.20.0' # pylint: disable=invalid-name
2 changes: 1 addition & 1 deletion pay-api/tests/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ services:
image: stoplight/prism:3.3.0
command: >
mock -p 4010 --host 0.0.0.0
https://raw.githubusercontent.com/bcgov/sbc-pay/main/docs/docs/api_contract/pay-api-1.0.4.yaml
https://raw.githubusercontent.com/bcgov/sbc-pay/main/docs/docs/api_contract/pay-api-1.0.5.yaml
reports:
image: stoplight/prism:3.3.0
command: >
Expand Down

0 comments on commit c977ab5

Please sign in to comment.