Skip to content

feat(card-service): add endpoints to initiate payment and receive payment result #3547

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

Open
wants to merge 4 commits into
base: pos-card-services
Choose a base branch
from

Conversation

dragosp1011
Copy link
Contributor

@dragosp1011 dragosp1011 commented Jul 10, 2025

Changes proposed in this pull request

  • Adds endpoint to initiate payment
  • Adds endpoint for payment-event to be called by backend serice with payment result
  • Adds open api specs for payment and payment-event endpoints
  • Adds in-memory map for requestId with a promise to be resolved on payment-event call

Context

fixes #3515
partially implements #3518

Checklist

  • Related issues linked using fixes #number
  • Tests added/updated
  • Make sure that all checks pass
  • Bruno collection updated (if necessary)
  • Documentation issue created with user-docs label (if necessary)
  • OpenAPI specs updated (if necessary)

@github-actions github-actions bot added the type: tests Testing related label Jul 10, 2025
@dragosp1011 dragosp1011 force-pushed the card-service-payment branch from fe6d1fb to 5f42304 Compare July 10, 2025 09:11
@dragosp1011 dragosp1011 marked this pull request as ready for review July 10, 2025 09:14
Copy link

github-actions bot commented Jul 10, 2025

🚀 Performance Test Results

Test Configuration:

  • VUs: 4
  • Duration: 1m0s

Test Metrics:

  • Requests/s: 42.77
  • Iterations/s: 14.29
  • Failed Requests: 0.00% (0 of 2572)
📜 Logs

> [email protected] run-tests:testenv /home/runner/work/rafiki/rafiki/test/performance
> ./scripts/run-tests.sh -e test "-k" "-q" "--vus" "4" "--duration" "1m"

Cloud Nine GraphQL API is up: http://localhost:3101/graphql
Cloud Nine Wallet Address is up: http://localhost:3100/
Happy Life Bank Address is up: http://localhost:4100/
cloud-nine-wallet-test-backend already set
cloud-nine-wallet-test-auth already set
happy-life-bank-test-backend already set
happy-life-bank-test-auth already set
     data_received..................: 929 kB 15 kB/s
     data_sent......................: 2.0 MB 33 kB/s
     http_req_blocked...............: avg=7.48µs   min=2.2µs    med=5.31µs   max=1.98ms   p(90)=6.32µs   p(95)=6.79µs  
     http_req_connecting............: avg=281ns    min=0s       med=0s       max=234.4µs  p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=92.86ms  min=8.08ms   med=79.37ms  max=530.72ms p(90)=159.32ms p(95)=182.88ms
       { expected_response:true }...: avg=92.86ms  min=8.08ms   med=79.37ms  max=530.72ms p(90)=159.32ms p(95)=182.88ms
     http_req_failed................: 0.00%  ✓ 0         ✗ 2572
     http_req_receiving.............: avg=94.09µs  min=27.66µs  med=81.27µs  max=1.59ms   p(90)=119.73µs p(95)=158.96µs
     http_req_sending...............: avg=34.4µs   min=9.71µs   med=28.16µs  max=1.26ms   p(90)=39.85µs  p(95)=54.65µs 
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=92.73ms  min=7.95ms   med=79.27ms  max=530.61ms p(90)=159.19ms p(95)=182.77ms
     http_reqs......................: 2572   42.774882/s
     iteration_duration.............: avg=279.71ms min=168.45ms med=261.67ms max=1.11s    p(90)=347.45ms p(95)=376.12ms
     iterations.....................: 859    14.286012/s
     vus............................: 4      min=4       max=4 
     vus_max........................: 4      min=4       max=4 

}
}

async function handlePayment(
Copy link
Member

Choose a reason for hiding this comment

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

consider handleCreatePayment

Copy link
Member

@beniaminmunteanu beniaminmunteanu left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -31,6 +31,7 @@ export const Config = {
trustProxy: envBool('TRUST_PROXY', false),
env: envString('NODE_ENV', 'development'),
cardServicePort: envInt('CARD_SERVICE_PORT', 3007),
cardPaymentTimeout: envInt('CARD_PAYMENT_TIMEOUT', 30000),
Copy link
Contributor

Choose a reason for hiding this comment

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

One more thing, let's also include the unit of measurement in the env var name as well

incomingPaymentUrl: uri,
date: dateTime,
signature: 'sig',
terminalCert: 'cert',
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: type error here from removing terminalCert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: tests Testing related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants