Skip to content

Conversation

oana-lolea
Copy link
Contributor

@oana-lolea oana-lolea commented Sep 4, 2025

Added bruno script to initiate a payment.
Fixes #3542
Linear #1120

Also fixed the flow in the payment route.
Linear #1151

Also added environment variables for POS and Cards services in local playground.
Fixes #3619
Linear #1150

Copy link

github-actions bot commented Sep 4, 2025

🚀 Performance Test Results

Test Configuration:

  • VUs: 4
  • Duration: 1m0s

Test Metrics:

  • Requests/s: 45.10
  • Iterations/s: 15.04
  • Failed Requests: 0.00% (0 of 2714)
📜 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..................: 980 kB 16 kB/s
     data_sent......................: 2.1 MB 35 kB/s
     http_req_blocked...............: avg=6.04µs   min=2.33µs   med=5.05µs   max=348.51µs p(90)=6.22µs   p(95)=6.73µs  
     http_req_connecting............: avg=223ns    min=0s       med=0s       max=148µs    p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=88.06ms  min=7.64ms   med=72.24ms  max=486.15ms p(90)=151.37ms p(95)=176.03ms
       { expected_response:true }...: avg=88.06ms  min=7.64ms   med=72.24ms  max=486.15ms p(90)=151.37ms p(95)=176.03ms
     http_req_failed................: 0.00%  ✓ 0         ✗ 2714
     http_req_receiving.............: avg=85.8µs   min=26.98µs  med=72.18µs  max=2.57ms   p(90)=109.63µs p(95)=138.67µs
     http_req_sending...............: avg=35.44µs  min=10.02µs  med=26.19µs  max=2.76ms   p(90)=39.22µs  p(95)=54.51µs 
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=87.94ms  min=7.46ms   med=72.14ms  max=486.09ms p(90)=151.3ms  p(95)=175.92ms
     http_reqs......................: 2714   45.101235/s
     iteration_duration.............: avg=265.69ms min=174.91ms med=251.17ms max=1.02s    p(90)=328.18ms p(95)=366.06ms
     iterations.....................: 905    15.039284/s
     vus............................: 4      min=4       max=4 
     vus_max........................: 4      min=4       max=4 

@oana-lolea oana-lolea requested a review from mkurapov September 4, 2025 09:46
@oana-lolea oana-lolea marked this pull request as ready for review September 4, 2025 09:47
body:json {
{
"card": {
"walletAddress": "http://localhost:3000/accounts/gfranklin",
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we should be passing in https://cloud-nine-wallet/... here, since the POS service will get it in the request and should find the wallet address using the shared rafiki network set up in the docker compose

@github-actions github-actions bot added pkg: backend Changes in the backend package. type: source Changes business logic labels Sep 8, 2025
// we don't need to verify the signature nor prevent replay attacks
koa.use(
this.config.env !== 'test'
this.config.env !== 'test' && this.config.env !== 'development'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this so that I can bypass the tenant signature check for now while testing

Copy link
Contributor

Choose a reason for hiding this comment

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

I think if the TENANT_SECRET matches the API_SECRET from above, then this validation should work without having to bypass it

value: body.value
}
const incomingPayment = await deps.paymentService.createIncomingPayment(
walletAddress.id,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This needs to be the UUID of the wallet address, not the actual address. Will add a request to fetch that.

@github-actions github-actions bot added the type: tests Testing related label Sep 8, 2025
}

post {
url: http://localhost:3008/payment
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
url: http://localhost:3008/payment
url: http://localhost:4008/payment

Let's do this, such that the incoming payment will be on the happy-life side of things, and cloud nine will pay into it.

Comment on lines 89 to 95
...(tenantId && {
context: {
headers: {
'tenant-id': tenantId
}
}
})
Copy link
Contributor

Choose a reason for hiding this comment

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

We are already passing in the tenantId when we are setting up the apolloClient (index.ts), so I think we can leave this out

GRAPHQL_URL: http://cloud-nine-wallet-backend:3001/graphql
TENANT_ID: 438fa74a-fa7d-4317-9ced-dde32ece1787
TENANT_SECRET: tenant_secret
TENANT_SIGNATURE_VERSION: tenant_signature_version
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
TENANT_SIGNATURE_VERSION: tenant_signature_version
TENANT_SIGNATURE_VERSION: 1

@oana-lolea oana-lolea requested a review from mkurapov September 10, 2025 11:36
requestId: uuid()
}
const cardServiceUrl = options.card.walletAddress.cardService
const response = await deps.axios.post<PaymentResponse>(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will get BAD_REQUEST because we are missing some data that cardService is expecting.

- rafiki
ports:
- '3007:3007'
- '9234:9229'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added for debugging

- rafiki
ports:
- '4008:4008'
- '9233:9229'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added for debugging

DATABASE_URL: postgresql://cloud_nine_wallet_card_service:cloud_nine_wallet_card_service@shared-database/cloud_nine_wallet_card_service
GRAPHQL_URL: http://cloud-nine-wallet-backend:3001/graphql
TENANT_ID: 438fa74a-fa7d-4317-9ced-dde32ece1787
TENANT_SECRET: tenant_secret
Copy link
Contributor

Choose a reason for hiding this comment

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

TENANT_SECRET should match the API_SECRET from backend container

// we don't need to verify the signature nor prevent replay attacks
koa.use(
this.config.env !== 'test'
this.config.env !== 'test' && this.config.env !== 'development'
Copy link
Contributor

Choose a reason for hiding this comment

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

I think if the TENANT_SECRET matches the API_SECRET from above, then this validation should work without having to bypass it

const { data } = await client.mutate<
Mutation['createIncomingPayment'],
CreateIncomingPaymentInput
Mutation,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Mutation,
CreateIncomingPayment,

Importing this from '../graphql/generated/graphql' should give you the correct type for the Mutation

@github-actions github-actions bot removed pkg: backend Changes in the backend package. type: source Changes business logic labels Sep 17, 2025
@oana-lolea oana-lolea requested a review from mkurapov September 17, 2025 06:22
@oana-lolea oana-lolea merged commit 50efa05 into pos-card-services Sep 17, 2025
28 of 40 checks passed
@oana-lolea oana-lolea deleted the oana/raf-1120 branch September 17, 2025 13:27
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.

2 participants