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

[BUG] Incorrect mapping of attempt status in NMI connector #7198

Open
2 tasks done
Anurag-05-prog opened this issue Feb 5, 2025 · 0 comments · May be fixed by #7200
Open
2 tasks done

[BUG] Incorrect mapping of attempt status in NMI connector #7198

Anurag-05-prog opened this issue Feb 5, 2025 · 0 comments · May be fixed by #7200
Assignees
Labels
C-bug Category: Bug S-awaiting-triage Status: New issues that have not been assessed yet

Comments

@Anurag-05-prog
Copy link
Contributor

Anurag-05-prog commented Feb 5, 2025

Bug Description

When the payment status is processing, the backend was returning an incorrect error message. The message incorrectly stated that the issue was with the capture method, whereas it should indicate that the payment status
is processing and the expected states are requires_capture or partially_captured_and_capturable. It is due to the incorrect mapping of one of the attempt status in NMI connector.
This fix ensures the correct error message is displayed.

Payments - Create:

Image

Payments - Capture:

Image

Expected Behavior

it should return an error indicating that the payment status is processing and the expected states are requires_capture or partially_captured_and_capturable.

Payments - Create:

Image

Payments - Capture:

Image

Actual Behavior

It actually returned an incorrect error message stating that the issue was with the capture method.

Payments - Create:

Image

Payments - Capture:

Image

Steps To Reproduce

  1. Payment Connector - Create

Request -

curl --location 'http://localhost:8080/account/:merchant_id/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: {{api-key}}' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "nmi",
    "connector_account_details": {
        "auth_type": "BodyKey",
        "api_key": "API KEY",
        "key1": "KEY1"
    },
    "test_mode": true,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true,
                    "accepted_countries": {
                        "type": "disable_only",
                        "list": [
                            "HK"
                        ]
                    },
                    "accepted_currencies": {
                        "type": "enable_only",
                        "list": [
                            "USD",
                            "GBP",
                            "INR"
                        ]
                    }
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true,
                    "accepted_countries": {
                        "type": "disable_only",
                        "list": [
                            "HK"
                        ]
                    },
                    "accepted_currencies": {
                        "type": "enable_only",
                        "list": [
                            "USD",
                            "GBP",
                            "INR"
                        ]
                    }
                }
            ]
        }
    ],
    "metadata": {
        "city": "NY",
        "unit": "245"
    },
    "connector_webhook_details": {
        "merchant_secret": "MyWebhookSecret"
    },
    "business_country": "US",
    "business_label": "default"
}'
  1. Payments - Create

Request -

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: {{api-key}}' \
--data-raw '{
    "amount": 6540,
    "currency": "USD",
    "confirm": true,
    "capture_method": "manual",
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_number": "4012000033330026",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        }
    },
    "shipping": {
        "address": {
            "line1": "123",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country":"US",
            "first_name": "PiX"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
  1. Payments - Capture

Request -

curl --location 'http://localhost:8080/payments/pay_nbmtZ5WEPRqu5YrSFf1c/capture' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: {{api-key}}' \
--data '{
  "amount_to_capture": 6540
}'

Context For The Bug

No response

Environment

Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the x-request-id response header to help us debug your issue.

If not (or if building/running locally), please provide the following details:

  1. Operating System or Linux distribution: Mac
  2. Rust version (output of rustc --version): 1.83.0
  3. App version (output of cargo r --features vergen -- --version): router 2025.01.27.0-30-ge0ec27d-dirty-e0ec27d-2025-02-05T09:54:57.000000000Z

Have you spent some time checking if this bug has been raised before?

  • I checked and didn't find a similar issue

Have you read the Contributing Guidelines?

Are you willing to submit a PR?

Yes, I am willing to submit a PR!

@Anurag-05-prog Anurag-05-prog added C-bug Category: Bug S-awaiting-triage Status: New issues that have not been assessed yet labels Feb 5, 2025
@Anurag-05-prog Anurag-05-prog self-assigned this Feb 5, 2025
@Anurag-05-prog Anurag-05-prog changed the title [BUG] Incorrect error message during status validation check in capture call [BUG] Incorrect mapping of attempt status in NMI connector Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Bug S-awaiting-triage Status: New issues that have not been assessed yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant