-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
21537 - Shortname Refunds - PATCH / GET methods & Notification (#1758)
- Loading branch information
Showing
47 changed files
with
912 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
"""Fix audit columns for eft_refunds. | ||
Revision ID: 75a39e02c746 | ||
Revises: 29f59e6f147b | ||
Create Date: 2024-09-20 13:45:35.132557 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
# 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 = '75a39e02c746' | ||
down_revision = '29f59e6f147b' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table('eft_refunds', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('created_name', sa.String(length=100), nullable=True)) | ||
batch_op.add_column(sa.Column('updated_name', sa.String(length=50), nullable=True)) | ||
batch_op.alter_column('updated_by', | ||
existing_type=sa.VARCHAR(length=100), | ||
type_=sa.String(length=50), | ||
existing_nullable=True) | ||
batch_op.drop_column('updated_by_name') | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table('eft_refunds', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('updated_by_name', sa.VARCHAR(length=100), autoincrement=False, nullable=True)) | ||
batch_op.alter_column('updated_by', | ||
existing_type=sa.String(length=50), | ||
type_=sa.VARCHAR(length=100), | ||
existing_nullable=True) | ||
batch_op.drop_column('updated_name') | ||
batch_op.drop_column('created_name') | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"""Drop refund email list, use keycloak instead. | ||
Revision ID: 87a09ba91c0d | ||
Revises: 75a39e02c746 | ||
Create Date: 2024-09-24 14:01:25.238895 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# 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 = '87a09ba91c0d' | ||
down_revision = '75a39e02c746' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.execute('DROP SEQUENCE IF EXISTS eft_refund_email_list_id_seq CASCADE') | ||
op.execute('DROP TABLE IF EXISTS eft_refund_email_list') | ||
|
||
def downgrade(): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Init.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
"""Rationale behind creating these DTOS below. | ||
1. To ensure that the request and response payloads are validated before they are passed to the service layer. | ||
2. To ensure that the request and response payloads are consistent across the application. | ||
3. To ensure that the request and response payloads are consistent with the API documentation. | ||
In the near future, will find a library that generates our API spec based off of these DTOs. | ||
""" | ||
from decimal import Decimal | ||
from typing import List | ||
from attrs import define | ||
|
||
from pay_api.utils.serializable import Serializable | ||
|
||
|
||
@define | ||
class EFTShortNameGetRequest(Serializable): | ||
"""EFT Short name search.""" | ||
|
||
short_name: str = None | ||
short_name_id: int = None | ||
short_name_type: str = None | ||
amount_owing: Decimal = None | ||
statement_id: int = None | ||
state: str = None | ||
page: int = 1 | ||
limit: int = 10 | ||
account_id: int = None | ||
account_name: str = None | ||
account_branch: str = None | ||
account_id_list: str = None | ||
|
||
@classmethod | ||
def from_dict(cls, data: dict): | ||
"""Convert from request args to EFTShortNameSearchDTO.""" | ||
dto = super().from_dict(data) | ||
# In the future, we'll need a cleaner way to handle this. | ||
dto.state = dto.state.split(',') if dto.state else None | ||
dto.account_id_list = dto.account_id_list.split(',') if dto.account_id_list else None | ||
return dto | ||
|
||
|
||
@define | ||
class EFTShortNameSummaryGetRequest(Serializable): | ||
"""EFT Short name summary search.""" | ||
|
||
short_name: str = None | ||
short_name_id: int = None | ||
short_name_type: str = None | ||
credits_remaining: Decimal = None | ||
linked_accounts_count: int = None | ||
payment_received_start_date: str = None | ||
payment_received_end_date: str = None | ||
page: int = 1 | ||
limit: int = 10 | ||
|
||
|
||
@define | ||
class EFTShortNameRefundPatchRequest(Serializable): | ||
"""EFT Short name refund DTO.""" | ||
|
||
comment: str | ||
status: str | ||
decline_reason: str = None | ||
|
||
|
||
@define | ||
class EFTShortNameRefundGetRequest: | ||
"""EFT Short name refund DTO.""" | ||
|
||
statuses: List[str] | ||
|
||
@classmethod | ||
def from_dict(cls, data: dict): | ||
"""Convert from request json to EFTShortNameRefundDTO.""" | ||
input_string = data.get('status', '') | ||
statuses = input_string.split(',') if input_string else [] | ||
return EFTShortNameRefundGetRequest(statuses=statuses) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.