hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

fix(payouts): persist status updates in payouts table

Open kashif-m opened this issue 10 months ago • 0 comments

refactor(payouts): populate customer fields in list response

Type of Change

  • [x] Bugfix
  • [ ] New feature
  • [x] Enhancement
  • [ ] Refactoring
  • [ ] Dependency updates
  • [ ] Documentation
  • [ ] CI/CD

Description

This PR fixes below payout related BUGS

  • Customer related fields are not populated
  • Status is not persisted in payouts table

Additional Changes

  • [x] This PR modifies the API contract
  • [ ] This PR modifies the database schema
  • [ ] This PR modifies application configuration/environment variables

Motivation and Context

This is to be used for listing payouts, and it needs to work as expected!

How did you test it?

Tested locally using postman.

List payouts

View request curl --location 'http://localhost:8080/payouts/list?limit=4' \ --header 'api-key: dev_wmZ4BwC6pXMpBZs3kHlEHAbAxQevfCfJvEESnNmpm7eGlRlNH3yqWCjH58Q87Vfm'
View response { "size": 4, "data": [ { "payout_id": "c353a893-a0a6-4be4-849e-a328264b8509", "merchant_id": "merchant_1712111780", "amount": 1000, "currency": "EUR", "connector": "wise", "payout_type": "bank", "billing": null, "customer_id": "cus_NOWPAviaOF3z7Ynbi5MQ", "auto_fulfill": true, "email": "[email protected]", "name": "John Doe", "phone": "999999999", "phone_country_code": "+65", "client_secret": null, "return_url": null, "business_country": null, "business_label": null, "description": "Its my first payout request", "entity_type": "Individual", "recurring": true, "metadata": {}, "status": "success", "error_message": null, "error_code": null, "profile_id": "pro_sxXGxtmZC38hYU6MB624", "created": "2024-04-03T05:05:24.754Z", "attempts": [ { "attempt_id": "c353a893-a0a6-4be4-849e-a328264b8509_1", "status": "success", "amount": 1000, "currency": "EUR", "connector": "wise", "error_code": null, "error_message": null, "payment_method": "bank", "payout_method_type": null, "connector_transaction_id": "53200690", "cancellation_reason": null, "unified_code": null, "unified_message": null } ] }, { "payout_id": "c79a5213-7cd7-4d0f-bcfd-d934b69cdf47", "merchant_id": "merchant_1712111780", "amount": 1000, "currency": "EUR", "connector": "adyen", "payout_type": "bank", "billing": null, "customer_id": "cus_NOWPAviaOF3z7Ynbi5MQ", "auto_fulfill": true, "email": "[email protected]", "name": "John Doe", "phone": "999999999", "phone_country_code": "+65", "client_secret": null, "return_url": null, "business_country": null, "business_label": null, "description": "Its my first payout request", "entity_type": "Individual", "recurring": true, "metadata": {}, "status": "success", "error_message": null, "error_code": null, "profile_id": "pro_sxXGxtmZC38hYU6MB624", "created": "2024-04-03T05:05:13.365Z", "attempts": [ { "attempt_id": "c79a5213-7cd7-4d0f-bcfd-d934b69cdf47_1", "status": "success", "amount": 1000, "currency": "EUR", "connector": "adyen", "error_code": null, "error_message": null, "payment_method": "bank", "payout_method_type": null, "connector_transaction_id": "NBL39F85X5252VT5", "cancellation_reason": null, "unified_code": null, "unified_message": null } ] }, { "payout_id": "70590cab-c8d5-4109-9a1e-395b59b82ec0", "merchant_id": "merchant_1712111780", "amount": 1000, "currency": "EUR", "connector": "adyen", "payout_type": "bank", "billing": null, "customer_id": "cus_NOWPAviaOF3z7Ynbi5MQ", "auto_fulfill": true, "email": "[email protected]", "name": "John Doe", "phone": "999999999", "phone_country_code": "+65", "client_secret": null, "return_url": null, "business_country": null, "business_label": null, "description": "Its my first payout request", "entity_type": "Individual", "recurring": true, "metadata": {}, "status": "success", "error_message": null, "error_code": null, "profile_id": "pro_sxXGxtmZC38hYU6MB624", "created": "2024-04-03T05:05:04.726Z", "attempts": [ { "attempt_id": "70590cab-c8d5-4109-9a1e-395b59b82ec0_1", "status": "success", "amount": 1000, "currency": "EUR", "connector": "adyen", "error_code": null, "error_message": null, "payment_method": "bank", "payout_method_type": null, "connector_transaction_id": "R3JCD5MCHK74STT5", "cancellation_reason": null, "unified_code": null, "unified_message": null } ] }, { "payout_id": "bd158643-6de0-4822-b5bc-4e528c5d2712", "merchant_id": "merchant_1712111780", "amount": 1, "currency": "EUR", "connector": "adyen", "payout_type": "card", "billing": null, "customer_id": "cus_NOWPAviaOF3z7Ynbi5MQ", "auto_fulfill": true, "email": "[email protected]", "name": "John Doe", "phone": "999999999", "phone_country_code": "+65", "client_secret": null, "return_url": null, "business_country": null, "business_label": null, "description": "Its my first payout request", "entity_type": "Individual", "recurring": true, "metadata": {}, "status": "success", "error_message": null, "error_code": null, "profile_id": "pro_sxXGxtmZC38hYU6MB624", "created": "2024-04-03T02:36:41.448Z", "attempts": [ { "attempt_id": "bd158643-6de0-4822-b5bc-4e528c5d2712_1", "status": "success", "amount": 1, "currency": "EUR", "connector": "adyen", "error_code": null, "error_message": null, "payment_method": "card", "payout_method_type": null, "connector_transaction_id": "HX3B6P6QC8PQ7RT5", "cancellation_reason": null, "unified_code": null, "unified_message": null } ] } ] }
  • Returned response contains limited entries as specified using limit.
  • status returned in the outer entity is valid
  • email, name and phone are populated using customer's info

Checklist

  • [x] I formatted the code cargo +nightly fmt --all
  • [x] I addressed lints thrown by cargo clippy
  • [x] I reviewed the submitted code
  • [ ] I added unit tests for my changes where possible
  • [ ] I added a CHANGELOG entry if applicable

kashif-m avatar Apr 03 '24 05:04 kashif-m