juspay / hyperswitch

An open source payments switch written in Rust to make payments fast, reliable and affordable
https://hyperswitch.io/
Apache License 2.0
12.64k stars 1.36k forks source link

feat(payments): add merchant order ref id filter #6630

Closed apoorvdixit88 closed 14 hours ago

apoorvdixit88 commented 4 days ago

Type of Change

Description

The PR

Additional Changes

Motivation and Context

Closes #6629

How did you test it?

Merchant Order filter is working as expected Request

curl --location 'http://localhost:8080/payments/list' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer JWT' \
--data '{
    "merchant_order_reference_id": "test"
}'

Response:

{
    "count": 1,
    "total_count": 1,
    "data": [
        {
            "payment_id": "test_rkAjUPAeyOVH0V1JPBcg",
            "merchant_id": "merchant_1732182386",
            "status": "succeeded",
            "amount": 19900,
            "net_amount": 19900,
            "shipping_cost": null,
            "amount_capturable": 0,
            "amount_received": null,
            "connector": "stripe_test",
            "client_secret": "test_rkAjUPAeyOVH0V1JPBcg_secret_s8xZQVITYn3CT5RKTiUj",
            "created": "2024-11-20T22:30:10.000Z",
            "currency": "USD",
            "customer_id": "hs-dashboard-user",
            "customer": null,
            "description": "This is a sample payment",
            "refunds": null,
            "disputes": null,
            "mandate_id": null,
            "mandate_data": null,
            "setup_future_usage": null,
            "off_session": null,
            "capture_on": null,
            "capture_method": null,
            "payment_method": "card",
            "payment_method_data": null,
            "payment_token": null,
            "shipping": null,
            "billing": null,
            "order_details": null,
            "email": null,
            "name": null,
            "phone": null,
            "return_url": null,
            "authentication_type": "three_ds",
            "statement_descriptor_name": null,
            "statement_descriptor_suffix": null,
            "next_action": null,
            "cancellation_reason": null,
            "error_code": null,
            "error_message": null,
            "unified_code": null,
            "unified_message": null,
            "payment_experience": null,
            "payment_method_type": "debit",
            "connector_label": null,
            "business_country": null,
            "business_label": "default",
            "business_sub_label": null,
            "allowed_payment_method_types": null,
            "ephemeral_key": null,
            "manual_retry_allowed": null,
            "connector_transaction_id": "test_rkAjUPAeyOVH0V1JPBcg_1",
            "frm_message": null,
            "metadata": null,
            "connector_metadata": null,
            "feature_metadata": null,
            "reference_id": null,
            "payment_link": null,
            "profile_id": "pro_7J9fiPceBUM7IMdb045X",
            "surcharge_details": null,
            "attempt_count": 1,
            "merchant_decision": null,
            "merchant_connector_id": null,
            "incremental_authorization_allowed": null,
            "authorization_count": null,
            "incremental_authorizations": null,
            "external_authentication_details": null,
            "external_3ds_authentication_attempted": null,
            "expires_on": null,
            "fingerprint": null,
            "browser_info": null,
            "payment_method_id": null,
            "payment_method_status": null,
            "updated": null,
            "charges": null,
            "frm_metadata": null,
            "merchant_order_reference_id": "test",
            "order_tax_amount": null,
            "connector_mandate_id": null
        }
    ]
}

In refunds list when dynamically searching for both payment_id and refund_id, we are getting correct result now

curl --location 'http://localhost:8080/refunds/list' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer JWT' \
--data '{
    "refund_id": "test_LlBBfgQbHHJfQxsoLiyT",
    "payment_id": "test_LlBBfgQbHHJfQxsoLiyT"

}'

Response:

{
    "count": 0,
    "total_count": 0,
    "data": []
}

Checklist

semanticdiff-com[bot] commented 4 days ago

Review changes with  SemanticDiff

Changed Files
| File | Status | | :--- | :--- | | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/6630/changes#crates/router/src/types/storage/dispute.rs)  [crates/router/src/types/storage/dispute\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/6630/changes#crates/router/src/types/storage/dispute.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/6630/changes#crates/router/src/types/storage/dispute.rs)  94% smaller | | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/6630/changes#crates/router/src/types/storage/refund.rs)  [crates/router/src/types/storage/refund\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/6630/changes#crates/router/src/types/storage/refund.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/6630/changes#crates/router/src/types/storage/refund.rs)  89% smaller | | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/6630/changes#crates/api_models/src/payments.rs)  [crates/api\_models/src/payments\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/6630/changes#crates/api_models/src/payments.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/6630/changes#crates/api_models/src/payments.rs)  0% smaller | | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/6630/changes#crates/hyperswitch_domain_models/src/payments/payment_intent.rs)  [crates/hyperswitch\_domain\_models/src/payments/payment\_intent\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/6630/changes#crates/hyperswitch_domain_models/src/payments/payment_intent.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/6630/changes#crates/hyperswitch_domain_models/src/payments/payment_intent.rs)  0% smaller | | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/6630/changes#crates/storage_impl/src/payments/payment_intent.rs)  [crates/storage\_impl/src/payments/payment\_intent\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/6630/changes#crates/storage_impl/src/payments/payment_intent.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/6630/changes#crates/storage_impl/src/payments/payment_intent.rs)  0% smaller |