Skip to content

Conversation

sumanmaji4
Copy link
Contributor

@sumanmaji4 sumanmaji4 commented May 22, 2025

Type of Change

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

Description

Retrieving payout_method_id across various cases and updating it in the payouts table accordingly

Additional Changes

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

Motivation and Context

How did you test it?

Tested locally by connecting to the local Hyperswitch Card Vault
Screenshot 2025-05-26 at 2 11 24 PM

Payout Create Request

curl --location 'http://localhost:8080/payouts/create' \
--header 'Content-Type: application/json' \
--header 'api-key: hidden' \
--data-raw '{
    "amount": 21,
    "currency": "EUR",
    "profile_id": "pro_oG*****inD",
    "customer": {
        "id": "new_id",
        "email": "[email protected]",
        "name": "John Doe",
        "phone": "99*****99",
        "phone_country_code": "+65"
    },
    "connector": [
        "adyen"
    ],
    "description": "Its my first payout request",
    "payout_type": "card",
    "payout_method_data": {
        "card": {
            "card_number": "4111 1111 1111 1111",
            "expiry_month": "03",
            "expiry_year": "2030",
            "card_holder_name": "John Doe"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            
            "city": "San Fransico",
            "state": "CA",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "80*****27",
            "country_code": "+91"
        }
    },
    "entity_type": "Individual",
    "recurring": true,
    "metadata": {
        "ref": "123"
    },
    "confirm": true,
    "auto_fulfill": true
}'

Payout Create Response

{
    "payout_id": "3c479b29-*****-ca06536a0f67",
    "merchant_id": "merchant_1748*****8",
    "amount": 21,
    "currency": "EUR",
    "connector": "adyen",
    "payout_type": "card",
    "payout_method_data": {
        "card": {
            "card_issuer": null,
            "card_network": null,
            "card_type": null,
            "card_issuing_country": null,
            "bank_code": null,
            "last4": "1111",
            "card_isin": "411111",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "John Doe"
        }
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": null,
            "zip": "94122",
            "state": "CA",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "805*****27",
            "country_code": "+91"
        },
        "email": null
    },
    "auto_fulfill": true,
    "customer_id": "new_id",
    "customer": {
        "id": "new_id",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "99*****99",
        "phone_country_code": "+65"
    },
    "client_secret": "payout_3c479b29-8a*****f67_secret_Swtw*****BfBb6j",
    "return_url": null,
    "business_country": null,
    "business_label": null,
    "description": "Its my first payout request",
    "entity_type": "Individual",
    "recurring": true,
    "metadata": {
        "ref": "123"
    },
    "merchant_connector_id": "mca_jmmK*****jm",
    "status": "success",
    "error_message": null,
    "error_code": null,
    "profile_id": "pro_oG*****inD",
    "created": "2025-05-26T08:46:58.731Z",
    "connector_transaction_id": "ZK*****75",
    "priority": null,
    "payout_link": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "99*****9",
    "phone_country_code": "+65",
    "unified_code": null,
    "unified_message": null,
    "payout_method_id": "pm_qvu*****EN"
}

Payout Sync Request

curl --location 'http://localhost:8080/payouts/3c479b29-*****-ca06536a0f67?force_sync=true' \
--header 'api-key: hidden'

Payout Sync Response

{
    "payout_id": "3c479b29-*****-ca06536a0f67",
    "merchant_id": "merchant_174*****8",
    "amount": 21,
    "currency": "EUR",
    "connector": "adyen",
    "payout_type": "card",
    "payout_method_data": {
        "card": {
            "card_issuer": null,
            "card_network": null,
            "card_type": null,
            "card_issuing_country": null,
            "bank_code": null,
            "last4": "1111",
            "card_isin": "411111",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "John Doe"
        }
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": null,
            "zip": "94122",
            "state": "CA",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "805*****27",
            "country_code": "+91"
        },
        "email": null
    },
    "auto_fulfill": true,
    "customer_id": "new_id",
    "customer": {
        "id": "new_id",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "99*****99",
        "phone_country_code": "+65"
    },
    "client_secret": "payout_3c479b29-*****-ca06536a0f67_secret_Sw*****b6j",
    "return_url": null,
    "business_country": null,
    "business_label": null,
    "description": "Its my first payout request",
    "entity_type": "Individual",
    "recurring": true,
    "metadata": {
        "ref": "123"
    },
    "merchant_connector_id": "mca_jmmK*****m",
    "status": "success",
    "error_message": null,
    "error_code": null,
    "profile_id": "pro_oGi*****nD",
    "created": "2025-05-26T08:46:58.731Z",
    "connector_transaction_id": "ZK*****75",
    "priority": null,
    "payout_link": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "unified_code": null,
    "unified_message": null,
    "payout_method_id": "pm_qvue0o*****eEN"
}

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@sumanmaji4 sumanmaji4 requested a review from a team as a code owner May 22, 2025 06:50
Copy link

semanticdiff-com bot commented May 22, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/payouts/helpers.rs  71% smaller

@sumanmaji4 sumanmaji4 changed the title fix: incorrect pm_id in payouts table fix: incorrect payout_method_id in payouts table May 22, 2025
Comment on lines 674 to 675
} else {
stored_resp.card_reference.to_owned()
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 remove the else condition, this is not needed anymore, since we store everything in payment_methods table

Copy link
Contributor

@kashif-m kashif-m left a comment

Choose a reason for hiding this comment

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

We can remove the else condition, everything else is good.

Copy link
Contributor

@Chethan-rao Chethan-rao left a comment

Choose a reason for hiding this comment

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

Please add test cases

@likhinbopanna likhinbopanna added this pull request to the merge queue May 27, 2025
Merged via the queue into main with commit e637b21 May 27, 2025
26 of 32 checks passed
@likhinbopanna likhinbopanna deleted the fix_incorrect_pm_id branch May 27, 2025 11:00
pixincreate added a commit that referenced this pull request May 30, 2025
…ordea-sepa

* 'main' of github.com:juspay/hyperswitch: (30 commits)
  chore(version): 2025.05.30.0
  chore(ci): update postman ci credentials (#8172)
  chore(docs): remove old add_connector.md file (#8143)
  refactor: Payment Attempt as mandatory field in PaymentStatusData (#8126)
  fix(payment_link): sanitize embedded payment link data (#7736)
  chore(version): 2025.05.29.0
  feat(analytics): Add ckh columns for 3ds intelligence analytics (#8136)
  refactor(debit_routing): Handle missing merchant_business_country by defaulting to US (#8141)
  chore(version): 2025.05.28.0
  refactor(success_based): add support for exploration (#8158)
  feat(dynamic_routing): add get api for dynamic routing volume split (#8114)
  fix: incorrect payout_method_id in payouts table (#8107)
  feat(router): Enable client_secret auth for payments_get_intent [v2] (#8119)
  chore: address Rust 1.87.0 clippy lints (#8130)
  feat: list for dynamic routing (#8111)
  ci(cypress): fix mandates unsupported connectors (#8086)
  feat(connector): [Barclaycard] Implement Cards - Non 3DS flow (#8068)
  fix(authentication): add Organization context validation in `Merchant Create` and `Merchant List` APIs (#8103)
  feat(connector): [Worldpayxml] add card payment (#8076)
  feat(connector): Stripe revolut pay wallet integration (#8066)
  ...
@sumanmaji4 sumanmaji4 self-assigned this Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants