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: interface with payments-gateway (part 1) (devops ⚠️) #4715

Merged
merged 92 commits into from
Sep 12, 2023

Conversation

pcrespov
Copy link
Member

@pcrespov pcrespov commented Sep 5, 2023

What do these changes do?

This PR creates the interfaces and starts implementing the payments service. This service interact with four other services, namely the webserver, the payment-gateway, the resource-usage-tracker (RUT) and the postgres database. For each it uses different interfaces:

This PR introduces part of this design, specifically:

  • api/rest to complete payment
    • Implements OAuth2 with Password and Bearer (w/ JWT tokens)
  • services/payments_gateway interface to communicate with payments gateway
    • fake payment gateway to define details of API (see scripts/fake_payment_gateway.py)
    • defines client calls for gateway in services/payment_gateway.py
  • ✨ drafts api/rpc
    • setup rabbitmq

The OAS of the api/rest (in detail here ):
image

Next PR will continue with

  • db repository to handle transaction
  • socketio to notify payments to webserver
  • httpx connection to RUT

Related issue/s

How to test

cd services/payments
make install-dev
make tests-dev-unit

DevOps ⚠️

  • New env vars in payments service (see docker-compose.yml for more details)
PAYMENTS_ACCESS_TOKEN_EXPIRE_MINUTES=30
PAYMENTS_ACCESS_TOKEN_SECRET_KEY=2c0411810565e063309be1457009fb39ce023946f6a354e6935107b57676
PAYMENTS_GATEWAY_API_KEY=replace-with-api-key
PAYMENTS_GATEWAY_API_SECRET=replace-with-api-secret
  • IMPORTANT: this service will be deployed but it is still NOT integrated with the rest of the stack. The functionality is temporarily implemented in the webserver/payments plugin until this service is fully functional.

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

codecov bot commented Sep 5, 2023

Codecov Report

Merging #4715 (eac5977) into master (a399647) will decrease coverage by 1.7%.
The diff coverage is 93.5%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #4715     +/-   ##
========================================
- Coverage    86.9%   85.3%   -1.7%     
========================================
  Files        1113    1125     +12     
  Lines       46615   46902    +287     
  Branches     1013    1013             
========================================
- Hits        40555   40031    -524     
- Misses       5833    6644    +811     
  Partials      227     227             
Flag Coverage Δ
integrationtests 65.2% <50.0%> (-0.1%) ⬇️
unittests 84.6% <93.5%> (-0.1%) ⬇️

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

Files Changed Coverage Δ
...s/src/simcore_service_payments/api/rest/_health.py 100.0% <ø> (ø)
...re_service_webserver/wallets/_payments_handlers.py 98.3% <50.0%> (+1.6%) ⬆️
...ore_service_payments/api/rest/_acknowledgements.py 78.2% <78.2%> (ø)
...core_service_payments/services/payments_gateway.py 86.8% <86.8%> (ø)
...ents/src/simcore_service_payments/services/auth.py 89.2% <89.2%> (ø)
.../src/simcore_service_payments/services/rabbitmq.py 90.6% <90.6%> (ø)
...c/models_library/utils/pydantic_tools_extension.py 100.0% <100.0%> (ø)
...ervice-library/src/servicelib/rabbitmq/__init__.py 100.0% <100.0%> (ø)
...service-library/src/servicelib/rabbitmq/_errors.py 100.0% <100.0%> (ø)
...es/service-library/src/servicelib/utils_secrets.py 100.0% <100.0%> (ø)
... and 16 more

... and 33 files with indirect coverage changes

@pcrespov pcrespov force-pushed the is4657/payments-service branch 3 times, most recently from c1364d5 to 71f34ba Compare September 8, 2023 17:09
@pcrespov pcrespov changed the title WIP: ✨ Is4657/payments service ✨ Payments service: api/rest, rpc (devops ⚠️) Sep 11, 2023
@pcrespov pcrespov changed the title ✨ Payments service: api/rest, rpc (devops ⚠️) ✨ Payments service: interface with payments-gateway (part 1) (devops ⚠️) Sep 11, 2023
@pcrespov pcrespov force-pushed the is4657/payments-service branch from 39ed7e8 to f7cf34e Compare September 11, 2023 14:27
@pcrespov pcrespov marked this pull request as ready for review September 11, 2023 14:28
Copy link
Contributor

@GitHK GitHK left a comment

Choose a reason for hiding this comment

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

Looking good. Please find some remarks below.

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.

some minor comments. thanks!

@pcrespov pcrespov requested a review from GitHK September 12, 2023 08:47
@pcrespov pcrespov force-pushed the is4657/payments-service branch from 4b13845 to 31be479 Compare September 12, 2023 08:59
Copy link
Contributor

@GitHK GitHK left a comment

Choose a reason for hiding this comment

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

All good, just had one more question

@pcrespov pcrespov enabled auto-merge (squash) September 12, 2023 13:30
@pcrespov pcrespov force-pushed the is4657/payments-service branch from 5e86db3 to 1814ba7 Compare September 12, 2023 16:23
@pcrespov pcrespov requested a review from odeimaiz September 12, 2023 16:24
@codeclimate
Copy link

codeclimate bot commented Sep 12, 2023

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

View more on Code Climate.

@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.8% 0.8% Duplication

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.

4 participants