Skip to content

Commit

Permalink
Model and service changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigo-barraza committed Dec 11, 2023
1 parent e08b591 commit 5d24d0d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
17 changes: 1 addition & 16 deletions pay-api/src/pay_api/models/non_sufficient_funds.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
from __future__ import annotations

from attrs import define
from marshmallow import fields
from sqlalchemy import ForeignKey

from .base_model import BaseModel
from .base_schema import BaseSchema
from .db import db


Expand Down Expand Up @@ -49,21 +47,8 @@ class NonSufficientFundsModel(BaseModel): # pylint: disable=too-many-instance-a
description = db.Column(db.String(50), nullable=True)
invoice_id = db.Column(db.Integer, ForeignKey('invoices.id'), nullable=False)


class NonSufficientFundsSchema(BaseSchema): # pylint: disable=too-many-ancestors
"""Main schema used to serialize the Non-Sufficient Funds."""

class Meta(BaseSchema.Meta): # pylint: disable=too-few-public-methods
"""Returns all the fields from the SQLAlchemy class."""

model = NonSufficientFundsModel

description = fields.String(data_key='description')
invoice_id = fields.Integer(data_key='invoice_id')


@define
class NonSufficientFundsSearchModel: # pylint: disable=too-few-public-methods
class NonSufficientFundsSchema: # pylint: disable=too-few-public-methods
"""Used to search for NSF records."""

id: int
Expand Down
1 change: 1 addition & 0 deletions pay-api/src/pay_api/services/non_sufficient_funds.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def query_all_non_sufficient_funds_invoices(account_id: str):
.outerjoin(NonSufficientFundsModel, NonSufficientFundsModel.invoice_id == InvoiceModel.id) \
.filter(PaymentAccountModel.auth_account_id == account_id) \
.filter(PaymentModel.payment_status_code == 'FAILED') \
.filter(PaymentModel.payment_method_code == 'PAD') \
.order_by(PaymentModel.id.asc())

non_sufficient_funds_invoices = query.all()
Expand Down

0 comments on commit 5d24d0d

Please sign in to comment.