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

payments service: implementation of apis and db repos for one-time-payment workflow ⚠️ #4743

Merged
merged 97 commits into from
Oct 17, 2023

Conversation

pcrespov
Copy link
Member

@pcrespov pcrespov commented Sep 12, 2023

What do these changes do?

payments

This PR takes the logic for the one-time-payment workflow presently in web-server's payments plugin and adapts it into the payments service. The modules affected are highlighted with arrows in the drawing above. Some details follow:

  • db: Implements db repository to annotate transactions for the one-time-payment workflow
    • services/postgres used to setup engine to postgres service
    • models/db are pydantic models to handle database data
  • api/rpc: implements init_payment by annotating initiated transaction using the repository above
  • api/rest: implements acknowledge_payment annotated ack transaction using the repository above
  • ♻️ ✨ Misc
    • Drafted some error handling (will be completed in subsequent PRs)
    • updated scripts/fake_payments_gateway to match openapi specs provided by our partners
    • new fixtures and new tests (coverage right now at 94%)

Note that after this PR, the payments service will still not be full operational to perform a complete the one-time-payment. For that still needs:

  • the rpc client on web-server's payments plugin side (next PR)
  • the socketio to trigger events from the payments service to the front-end (not relevant for the moment)

Related issue/s

How to test

  • driving tests services/payments/tests/unit/test_services_resource_usage_tracker.py

DevOps

  • ⚠️ New env-vars consumed in the payments service
     - POSTGRES_DB=${POSTGRES_DB}
     - POSTGRES_HOST=${POSTGRES_HOST}
     - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
     - POSTGRES_PORT=${POSTGRES_PORT}
     - POSTGRES_USER=${POSTGRES_USER}

@pcrespov pcrespov added the a:payments payments service label Sep 12, 2023
@pcrespov pcrespov added this to the the nameless milestone Sep 12, 2023
@pcrespov pcrespov self-assigned this Sep 12, 2023
@codecov
Copy link

codecov bot commented Sep 12, 2023

Codecov Report

Merging #4743 (50b2c45) into master (b43b2d4) will increase coverage by 1.8%.
The diff coverage is 88.6%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #4743     +/-   ##
========================================
+ Coverage    85.0%   86.8%   +1.8%     
========================================
  Files        1166    1183     +17     
  Lines       48670   49178    +508     
  Branches     1065    1065             
========================================
+ Hits        41384   42721   +1337     
+ Misses       7050    6221    -829     
  Partials      236     236             
Flag Coverage Δ
integrationtests 65.1% <ø> (-0.1%) ⬇️
unittests 84.5% <88.6%> (+0.1%) ⬆️

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

Files Coverage Δ
...ayments/src/simcore_service_payments/_constants.py 100.0% <100.0%> (ø)
...simcore_service_payments/api/rest/_dependencies.py 100.0% <100.0%> (ø)
...ts/src/simcore_service_payments/api/rest/routes.py 100.0% <100.0%> (ø)
.../src/simcore_service_payments/api/rpc/_payments.py 100.0% <100.0%> (ø)
...vices/payments/src/simcore_service_payments/cli.py 100.0% <100.0%> (ø)
...s/src/simcore_service_payments/core/application.py 100.0% <100.0%> (ø)
...ents/src/simcore_service_payments/core/settings.py 100.0% <100.0%> (ø)
...payments/src/simcore_service_payments/models/db.py 100.0% <100.0%> (ø)
...ervice_payments/models/schemas/acknowledgements.py 100.0% <100.0%> (ø)
.../simcore_service_payments/models/schemas/errors.py 100.0% <100.0%> (ø)
... and 4 more

... and 75 files with indirect coverage changes

@pcrespov pcrespov force-pushed the is4657/payments-service-part2 branch 2 times, most recently from 5f8c290 to 020799b Compare September 26, 2023 12:18
@pcrespov pcrespov force-pushed the is4657/payments-service-part2 branch 2 times, most recently from aecc7c0 to a64ee60 Compare September 27, 2023 18:37
@pcrespov pcrespov force-pushed the is4657/payments-service-part2 branch 3 times, most recently from 56a3de5 to 67f2b8b Compare October 2, 2023 16:22
@pcrespov pcrespov enabled auto-merge (squash) October 16, 2023 23:03
Copy link
Contributor

@matusdrobuliak66 matusdrobuliak66 left a comment

Choose a reason for hiding this comment

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

🥇

Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

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

This looks very good. Just some comments.

@pcrespov pcrespov requested review from GitHK and sanderegg October 17, 2023 09:35
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codeclimate
Copy link

codeclimate bot commented Oct 17, 2023

Code Climate has analyzed commit 50b2c45 and detected 0 issues on this pull request.

View more on Code Climate.

Copy link
Member

@odeimaiz odeimaiz left a comment

Choose a reason for hiding this comment

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

👍

@pcrespov pcrespov modified the milestones: the nameless, Microhistory Oct 17, 2023
@pcrespov pcrespov merged commit f2c5bb0 into ITISFoundation:master Oct 17, 2023
@pcrespov pcrespov deleted the is4657/payments-service-part2 branch October 17, 2023 13:17
@matusdrobuliak66 matusdrobuliak66 mentioned this pull request Oct 20, 2023
36 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:payments payments service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants