Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

17534 - New NSF resource implementation #1341

Closed
wants to merge 41 commits into from
Closed

Conversation

rodrigo-barraza
Copy link
Collaborator

Issue #:
https://github.com/bcgov/entity/issues/

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the sbc-pay license (Apache 2.0).

Copy link

codecov bot commented Dec 4, 2023

Codecov Report

Attention: 111 lines in your changes are missing coverage. Please review.

Comparison is base (79924ce) 91.45% compared to head (91785fa) 91.90%.
Report is 76 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1341      +/-   ##
==========================================
+ Coverage   91.45%   91.90%   +0.44%     
==========================================
  Files         186      206      +20     
  Lines       11319    12607    +1288     
==========================================
+ Hits        10352    11586    +1234     
- Misses        967     1021      +54     
Flag Coverage Δ
bcolapi ?
eventlistenerqueue 82.00% <100.00%> (+0.18%) ⬆️
payadmin ∅ <ø> (?)
payapi 93.57% <90.55%> (-0.16%) ⬇️
paymentjobs 83.35% <94.64%> (+3.13%) ⬆️
paymentreconciliationsqueue 92.30% <93.84%> (+0.86%) ⬆️
reportapi 91.09% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
jobs/payment-jobs/tasks/common/dataclasses.py 100.00% <100.00%> (ø)
jobs/payment-jobs/tasks/common/enums.py 100.00% <ø> (ø)
jobs/payment-jobs/tasks/distribution_task.py 97.70% <100.00%> (-0.06%) ⬇️
...ayment-jobs/tasks/ejv_partner_distribution_task.py 99.17% <100.00%> (+0.03%) ⬆️
jobs/payment-jobs/tasks/ejv_payment_task.py 96.61% <100.00%> (+0.14%) ⬆️
.../payment-jobs/tasks/statement_notification_task.py 79.74% <100.00%> (+47.92%) ⬆️
jobs/payment-jobs/tasks/statement_task.py 91.39% <100.00%> (+10.96%) ⬆️
pay-api/src/pay_api/config.py 99.35% <100.00%> (+<0.01%) ⬆️
pay-api/src/pay_api/models/__init__.py 100.00% <100.00%> (ø)
pay-api/src/pay_api/models/base_model.py 100.00% <100.00%> (ø)
... and 62 more

... and 3 files with indirect coverage changes

Copy link
Collaborator

@seeker25 seeker25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above
also:
Missing migration
Unit tests not passing
Code quality issue sonar cloud
Title of the PR isn't clear what you're doing

@rodrigo-barraza rodrigo-barraza changed the title Feature/17534 17534 - New NSF resource implementation Dec 4, 2023

def asdict(self):
"""Return the Non-Sufficient Funds as a python dict."""
non_sufficient_funds_schema = NonSufficientFundsSchema()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CATTRS

@rodrigo-barraza rodrigo-barraza marked this pull request as ready for review December 13, 2023 22:12
assert 'total_amount' in find_non_sufficient_funds
assert 'total_amount_remaining' in find_non_sufficient_funds
assert 'nsf_amount' in find_non_sufficient_funds
assert 'total' in find_non_sufficient_funds
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for the expected values as well. Might be useful to do multiple line items since there is totaling logic.

"""Return all Non-Sufficient Funds invoices."""
results, total, aggregate_totals = NonSufficientFundsService.query_all_non_sufficient_funds_invoices(
account_id=account_id)
invoice_schema = InvoiceSchema(exclude=('receipts', 'references', '_links'))
Copy link
Collaborator

@seeker25 seeker25 Dec 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason why we can't use InvoiceSearchModel or a variation of it instead?

"""Create Non-Sufficient Funds statement pdf."""
current_app.logger.debug('<generate_non_sufficient_funds_statement_pdf')
invoice = NonSufficientFundsService.find_all_non_sufficient_funds_invoices(account_id=account_id)
cfs_account: CfsAccountModel = CfsAccountModel.find_by_account_id(account_id)
Copy link
Collaborator

@seeker25 seeker25 Dec 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this returns a list of cfs_accounts, not just one - should probably be looking for the one with the highest ID / newest perhaps?


template_vars = {
'suspendedOn': datetime.strptime(account['suspendedOn'], '%Y-%m-%dT%H:%M:%S%z').strftime('%B %-d, %Y'),
'accountNumber': cfs_account[0].cfs_account,
Copy link
Collaborator

@seeker25 seeker25 Dec 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not ideal, you need to choose the correct one

'templateVars': template_vars,
'populatePageNumber': True
}
current_app.logger.info('Invoice PDF Dict %s', invoice_pdf_dict)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be debug? not info?

@bcgov bcgov deleted a comment from sonarqubecloud bot Dec 15, 2023
@@ -121,5 +123,5 @@ def from_row(cls, row: PaymentLineItem):

https://www.attrs.org/en/stable/init.html
"""
return cls(gst=row.gst, pst=row.pst, description=row.description,
filing_type_code=row.fee_schedule.filing_type_code)
return cls(total=row.total, gst=row.gst, pst=row.pst, service_fees=row.service_fees,
Copy link
Collaborator

@seeker25 seeker25 Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this change the CSO endpoint? if it does, we'll have to warn them

" # NOTE CSO uses this model for reconciliation, so it needs to follow the spec fairly closely.
#


"

Ahhh good they're already in the spec - probably should have them test their apps in TEST when this is pushed to TEST

Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@seeker25
Copy link
Collaborator

Covered by #1377

@seeker25 seeker25 closed this Jan 22, 2024
@rodrigo-barraza rodrigo-barraza deleted the feature/17534 branch September 4, 2024 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants