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

19759 - Partial refunds PAYBC implementation #1414

Merged
merged 15 commits into from
Feb 16, 2024
Merged

Conversation

seeker25
Copy link
Collaborator

Issue #:
bcgov/entity#19759

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 Feb 15, 2024

Codecov Report

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

Comparison is base (79924ce) 91.45% compared to head (9c19048) 91.96%.
Report is 109 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1414      +/-   ##
==========================================
+ Coverage   91.45%   91.96%   +0.51%     
==========================================
  Files         186      193       +7     
  Lines       11319    12936    +1617     
==========================================
+ Hits        10352    11897    +1545     
- Misses        967     1039      +72     
Flag Coverage Δ
bcolapi ?
eventlistenerqueue 82.00% <ø> (+0.18%) ⬆️
payadmin ∅ <ø> (?)
payapi 93.45% <96.26%> (-0.28%) ⬇️
paymentjobs 84.45% <ø> (+4.23%) ⬆️
paymentreconciliationsqueue 92.39% <ø> (+0.95%) ⬆️
reportapi ?

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

Files Coverage Δ
pay-api/src/pay_api/models/__init__.py 100.00% <100.00%> (ø)
...ay-api/src/pay_api/services/base_payment_system.py 95.97% <100.00%> (+0.02%) ⬆️
pay-api/src/pay_api/services/bcol_service.py 86.27% <100.00%> (+0.13%) ⬆️
pay-api/src/pay_api/services/ejv_pay_service.py 79.48% <100.00%> (-3.37%) ⬇️
...y-api/src/pay_api/services/internal_pay_service.py 90.21% <100.00%> (+0.21%) ⬆️
...api/src/pay_api/services/online_banking_service.py 93.54% <100.00%> (+0.21%) ⬆️
pay-api/src/pay_api/services/pad_service.py 95.77% <100.00%> (-2.69%) ⬇️
pay-api/src/pay_api/services/paybc_service.py 94.56% <100.00%> (+0.05%) ⬆️
pay-api/src/pay_api/services/refund.py 93.92% <100.00%> (+0.06%) ⬆️
pay-api/src/pay_api/utils/converter.py 100.00% <100.00%> (ø)
... and 3 more

... and 27 files with indirect coverage changes

@@ -71,7 +71,7 @@ notes=FIXME,XXX,TODO
ignored-modules=flask_sqlalchemy,sqlalchemy,SQLAlchemy,alembic,scoped_session
ignored-classes=scoped_session
min-similarity-lines=15
disable=C0301,W0511
disable=C0301,W0511,R0903
Copy link
Collaborator Author

@seeker25 seeker25 Feb 15, 2024

Choose a reason for hiding this comment

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

Too few public methods warning, it's fairly useless for dataclasses etc ATTRS and CATTRS don't use pylint anymore they use Flake8 I believe

@seeker25 seeker25 changed the title 19759 - Draft work for partial refunds 19759 - Draft work for partial refunds PAYBC implementation Feb 15, 2024
@seeker25
Copy link
Collaborator Author

Creating another ticket to do refactoring of PAYBC job


refund_lines, total_refund = DirectPayService._build_refund_revenue_lines(refund_partial)
paybc_invoice = DirectPayService._query_order_status(invoice)
refund_payload.update({
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I probably could have used a dataclass for this, but I think i'll leave it for now

@seeker25 seeker25 changed the title 19759 - Draft work for partial refunds PAYBC implementation 19759 - Partial refunds PAYBC implementation Feb 15, 2024
@seeker25 seeker25 marked this pull request as ready for review February 15, 2024 22:53
@seeker25 seeker25 requested review from Jxio and ochiu as code owners February 15, 2024 22:53
@seeker25
Copy link
Collaborator Author

Haven't tested with PAYBC yet, standby

direct_pay_service = DirectPayService()
with pytest.raises(BusinessException) as excinfo:
direct_pay_service.build_automated_refund_payload(invoice, refund_partial)
assert excinfo.value.code == Error.INVALID_REQUEST.name
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wanted to return real errors, not sure your thoughts about returning INVALID REQUEST, on the plus side at least I wrote some logging to handle the cases

Copy link
Collaborator

Choose a reason for hiding this comment

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

This works for me

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues

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

See analysis details on SonarCloud

@seeker25 seeker25 merged commit 4b3dcf8 into bcgov:main Feb 16, 2024
22 checks passed
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.

2 participants