Skip to content

Conversation

@oana-lolea
Copy link
Contributor

@oana-lolea oana-lolea commented Oct 22, 2025

Changes proposed in this pull request

  • Allow filtering incoming payments by initiatedBy

Context

Fixes #3648 | RAF-1165

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 type: tests Testing related pkg: backend Changes in the backend package. pkg: frontend Changes in the frontend package. type: source Changes business logic pkg: mock-ase pkg: mock-account-service-lib labels Oct 22, 2025
@github-actions
Copy link

github-actions bot commented Oct 22, 2025

🚀 Performance Test Results

Test Configuration:

  • VUs: 4
  • Duration: 1m0s

Test Metrics:

  • Requests/s: 41.21
  • Iterations/s: 13.75
  • Failed Requests: 0.00% (0 of 2478)
📜 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..................: 895 kB 15 kB/s
     data_sent......................: 1.9 MB 32 kB/s
     http_req_blocked...............: avg=7.44µs   min=1.92µs   med=5.38µs   max=1.77ms   p(90)=6.43µs   p(95)=6.93µs  
     http_req_connecting............: avg=302ns    min=0s       med=0s       max=319.49µs p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=96.43ms  min=8.12ms   med=79.23ms  max=597.02ms p(90)=167.2ms  p(95)=183.71ms
       { expected_response:true }...: avg=96.43ms  min=8.12ms   med=79.23ms  max=597.02ms p(90)=167.2ms  p(95)=183.71ms
     http_req_failed................: 0.00%  ✓ 0         ✗ 2478
     http_req_receiving.............: avg=88.07µs  min=28.89µs  med=76.9µs   max=1.68ms   p(90)=114.14µs p(95)=145.49µs
     http_req_sending...............: avg=36.76µs  min=9.6µs    med=27.41µs  max=2.64ms   p(90)=39.03µs  p(95)=54.11µs 
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=96.3ms   min=7.98ms   med=79.11ms  max=596.95ms p(90)=167.09ms p(95)=183.59ms
     http_reqs......................: 2478   41.209217/s
     iteration_duration.............: avg=290.56ms min=183.82ms med=275.79ms max=1.1s     p(90)=344.24ms p(95)=382.15ms
     iterations.....................: 827    13.753036/s
     vus............................: 4      min=4       max=4 
     vus_max........................: 4      min=4       max=4 

@oana-lolea oana-lolea requested a review from mkurapov October 22, 2025 08:04
@oana-lolea oana-lolea marked this pull request as ready for review October 22, 2025 08:04
Comment on lines 630 to 636
if (
[IncomingPaymentState.Pending, IncomingPaymentState.Expired].includes(
payment.state
)
) {
return BigInt(0)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We should include the received amount regardless of the incoming payment state

return payment
}

async function getPage(
Copy link
Contributor

Choose a reason for hiding this comment

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

We can have the getWalletAddressPage use this function also, just need to add in the wallet address filter in the options

"Specify the sort order of incoming payments based on their creation date, either ascending or descending."
sortOrder: SortOrder
"Filter incoming payments based on specific criteria such as initiation reason."
filter: IncomingPaymentFilter
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add this filter to the walletAddress.incomingPayments resolver (since that is the resolver we will be using for the POS service API)

function validateReceiveAmount(
deps: ServiceDependencies,
payment: IncomingPayment,
sentAmount: bigint | undefined
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
sentAmount: bigint | undefined
receivedAmount: bigint | undefined

const { sortOrder, filter, ...pagination } = args
const order = sortOrder === 'ASC' ? SortOrder.Asc : SortOrder.Desc
const incomingPayments = await incomingPaymentService.getWalletAddressPage({
const incomingPayments = await incomingPaymentService.getPage({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Used getPage to be able to use the filter

if (walletAddressId) {
query.where('walletAddressId', walletAddressId)
}

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 client and walletAddressId so that getWalletAddressPage can use getPage

@oana-lolea oana-lolea requested a review from mkurapov October 24, 2025 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: backend Changes in the backend package. pkg: frontend Changes in the frontend package. pkg: mock-account-service-lib pkg: mock-ase type: source Changes business logic type: tests Testing related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants