Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(payments): support for card_network filter in payments list #5994

Merged
merged 5 commits into from
Oct 14, 2024

Conversation

Riddhiagrawal001
Copy link
Contributor

@Riddhiagrawal001 Riddhiagrawal001 commented Sep 23, 2024

Type of Change

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

Description

  • Support for card_network as filters in payments list
  • Card network values in payments filter values

Additional Changes

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

Motivation and Context

Closes #5995

How did you test it?

  1. Payments filter list
    Request
curl --location 'http://localhost:8080/payments/v2/filter' \
--header 'Authorization: Bearer JWT' \
--data ''

Response

{
    "connector": {
        "connector_name": [
            {
                "connector_label": "connector_label",
                "merchant_connector_id": "connector_id"
            }
        ]
    },
    "currency": [Array of currency values],
    "status": [Array of status],
    "payment_method": { [Array of payment methods]},
    "authentication_type": [Array of authentication types],
    "card_network": [
        "Visa",
        "Mastercard",
        "AmericanExpress",
        "JCB",
        "DinersClub",
        "Discover",
        "CartesBancaires",
        "UnionPay",
        "Interac",
        "RuPay",
        "Maestro"
    ]
}
  1. Payments list with filter
    Request
curl --location 'http://localhost:8080/payments/list' \
--header 'authorization: Bearer JWT "
--data '{"offset":0,"limit":50,"start_time":"2024-08-23T18:30:00Z","card_network":["Visa"]}'

Response

{
    "count": 2,
    "total_count": 2,
    "data": [
        {
            "payment_id": "pay_TTYRZZpn4GZgyZkvfpLz",
            "merchant_id": "merchant_1726749985",
            "status": "succeeded",
            "amount": 10000,
            "net_amount": 10000,
            "amount_capturable": 0,
            "amount_received": null,
            "connector": "stripe_test",
            "client_secret": "pay_TTYRZZpn4GZgyZkvfpLz_secret_BNl87WI1lhH3h92QwwRi",
            "created": "2024-09-23T06:52:14.730Z",
            "currency": "USD",
            "customer_id": "hyperswitch_sdk_demo_id",
            "customer": {
                "id": "hyperswitch_sdk_demo_id",
                "name": "John Doe",
                "email": "[email protected]",
                "phone": "999999999",
                "phone_country_code": "+65"
            },
            "description": "Default value",
            "refunds": null,
            "disputes": null,
            "mandate_id": null,
            "mandate_data": null,
            "setup_future_usage": null,
            "off_session": null,
            "capture_on": null,
            "capture_method": "automatic",
            "payment_method": "card",
            "payment_method_data": {
                "card": {
                    "last4": null,
                    "card_type": null,
                    "card_network": "Visa",
                    "card_issuer": "",
                    "card_issuing_country": null,
                    "card_isin": null,
                    "card_extended_bin": null,
                    "card_exp_month": null,
                    "card_exp_year": null,
                    "card_holder_name": null,
                    "payment_checks": null,
                    "authentication_data": null
                },
                "billing": null
            },
            "payment_token": null,
            "shipping": {
                "address": {
                    "city": "San Fransico",
                    "country": "US",
                    "line1": "1467",
                    "line2": "Harrison Street",
                    "line3": "Harrison Street",
                    "zip": "94122",
                    "state": "California",
                    "first_name": "John",
                    "last_name": "Doe"
                },
                "phone": {
                    "number": "1234567890",
                    "country_code": "+1"
                },
                "email": null
            },
            "billing": {
                "address": {
                    "city": "San Fransico",
                    "country": "US",
                    "line1": "1467",
                    "line2": "Harrison Street",
                    "line3": "Harrison Street",
                    "zip": "94122",
                    "state": "California",
                    "first_name": "John",
                    "last_name": "Doe"
                },
                "phone": {
                    "number": "1234567890",
                    "country_code": "+1"
                },
                "email": "[email protected]"
            },
            "order_details": null,
            "email": null,
            "name": null,
            "phone": null,
            "return_url": null,
            "authentication_type": "no_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": null,
            "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": "pay_2dJSM6oUYFoKtxtD45jm",
            "frm_message": null,
            "metadata": {
                "order_details": {
                    "amount": 10000,
                    "quantity": 1,
                    "product_name": "Apple iphone 15"
                }
            },
            "connector_metadata": null,
            "feature_metadata": null,
            "reference_id": null,
            "payment_link": null,
            "profile_id": "pro_ClRdOxbia1VPXGEvFHe3",
            "surcharge_details": null,
            "attempt_count": 1,
            "merchant_decision": null,
            "merchant_connector_id": "mca_fBms1u3jKBroyqKUax5S",
            "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": null,
            "order_tax_amount": null
        },
        {
            "payment_id": "pay_8rF6jCw4J0W4e2eV7WqC",
            "merchant_id": "merchant_1726749985",
            "status": "requires_payment_method",
            "amount": 10000,
            "net_amount": 10000,
            "amount_capturable": 10000,
            "amount_received": null,
            "connector": null,
            "client_secret": "pay_8rF6jCw4J0W4e2eV7WqC_secret_LuwsymB20YhQ1MaujKgK",
            "created": "2024-09-23T06:50:09.337Z",
            "currency": "USD",
            "customer_id": "hyperswitch_sdk_demo_id",
            "customer": {
                "id": "hyperswitch_sdk_demo_id",
                "name": "John Doe",
                "email": "[email protected]",
                "phone": "999999999",
                "phone_country_code": "+65"
            },
            "description": "Default value",
            "refunds": null,
            "disputes": null,
            "mandate_id": null,
            "mandate_data": null,
            "setup_future_usage": null,
            "off_session": null,
            "capture_on": null,
            "capture_method": "automatic",
            "payment_method": null,
            "payment_method_data": {
                "card": {
                    "last4": null,
                    "card_type": null,
                    "card_network": "Visa",
                    "card_issuer": "",
                    "card_issuing_country": null,
                    "card_isin": null,
                    "card_extended_bin": null,
                    "card_exp_month": null,
                    "card_exp_year": null,
                    "card_holder_name": null,
                    "payment_checks": null,
                    "authentication_data": null
                },
                "billing": null
            },
            "payment_token": null,
            "shipping": {
                "address": {
                    "city": "San Fransico",
                    "country": "US",
                    "line1": "1467",
                    "line2": "Harrison Street",
                    "line3": "Harrison Street",
                    "zip": "94122",
                    "state": "California",
                    "first_name": "John",
                    "last_name": "Doe"
                },
                "phone": {
                    "number": "1234567890",
                    "country_code": "+1"
                },
                "email": null
            },
            "billing": {
                "address": {
                    "city": "San Fransico",
                    "country": "US",
                    "line1": "1467",
                    "line2": "Harrison Street",
                    "line3": "Harrison Street",
                    "zip": "94122",
                    "state": "California",
                    "first_name": "John",
                    "last_name": "Doe"
                },
                "phone": {
                    "number": "1234567890",
                    "country_code": "+1"
                },
                "email": "[email protected]"
            },
            "order_details": null,
            "email": null,
            "name": null,
            "phone": null,
            "return_url": null,
            "authentication_type": "no_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": null,
            "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": null,
            "frm_message": null,
            "metadata": {
                "order_details": {
                    "amount": 10000,
                    "quantity": 1,
                    "product_name": "Apple iphone 15"
                }
            },
            "connector_metadata": null,
            "feature_metadata": null,
            "reference_id": null,
            "payment_link": null,
            "profile_id": "pro_ClRdOxbia1VPXGEvFHe3",
            "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": null,
            "order_tax_amount": null
        }
    ]
}

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

@Riddhiagrawal001 Riddhiagrawal001 requested review from a team as code owners September 23, 2024 09:15
Copy link

semanticdiff-com bot commented Sep 23, 2024

Review changes with SemanticDiff.

Analyzed 4 of 4 files.

Filename Status
✔️ crates/storage_impl/src/payments/payment_intent.rs Analyzed
✔️ crates/router/src/core/payments.rs Analyzed
✔️ crates/hyperswitch_domain_models/src/payments/payment_intent.rs Analyzed
✔️ crates/api_models/src/payments.rs Analyzed

@Riddhiagrawal001 Riddhiagrawal001 self-assigned this Sep 23, 2024
@Riddhiagrawal001 Riddhiagrawal001 added C-feature Category: Feature request or enhancement S-waiting-on-review Status: This PR has been implemented and needs to be reviewed A-payments Area: payments labels Sep 23, 2024
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Oct 14, 2024
Merged via the queue into main with commit 1ac8c92 Oct 14, 2024
26 of 29 checks passed
@Gnanasundari24 Gnanasundari24 deleted the card-network-as-filters-in-payments branch October 14, 2024 10:37
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-payments Area: payments C-feature Category: Feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(payments): support for card_network filter in payments list
5 participants