Skip to content

Conversation

deepanshu-iiitu
Copy link
Contributor

Type of Change

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

Description

Error reason is now being populated for failure transactions for connector authorizedotnet.

Additional Changes

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

Motivation and Context

#5318

How did you test it?

Zip code should be passed as 46282 to generate failure scenario for connector authorizedotnet.
Request:

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Rjm1odUMbdX57oOLZNQzZtoYOEAo8ZAi1QHZzV79JIkJPnM8ffypLayUJW9rGX7a' \
--data '{
    "amount": 1232,
    "currency": "USD",
    "confirm": true,
    "customer_id": "Strustomewwr",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4111111111111111",
            "card_exp_month": "02",
            "card_exp_year": "35",
            "card_holder_name": "John Doe",
            "card_cvc": "123"
        }
    },
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Doe",
            "line1": "Harrison Street",
            "city": "San Francisco",
            "state": "California",
            "zip": "46282",
            "country": "US"
        }
    }
}'

Response:

{
    "payment_id": "pay_xQm2HqZbnK99JszUaE3A",
    "merchant_id": "merchant_1717672514",
    "status": "failed",
    "amount": 1232,
    "net_amount": 1232,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "authorizedotnet",
    "client_secret": "pay_xQm2HqZbnK99JszUaE3A_secret_wgPiZJagTyGg9F4I9Oae",
    "created": "2024-07-15T07:34:53.450Z",
    "currency": "USD",
    "customer_id": "Strustomewwr",
    "customer": {
        "id": "Strustomewwr",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "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": {
        "card": {
            "last4": "1111",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "411111",
            "card_extended_bin": null,
            "card_exp_month": "02",
            "card_exp_year": "35",
            "card_holder_name": "John Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Francisco",
            "country": "US",
            "line1": "Harrison Street",
            "line2": null,
            "line3": null,
            "zip": "46282",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": null,
        "email": null
    },
    "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": "2",
    "error_message": "This transaction has been declined.",
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "Strustomewwr",
        "created_at": 1721028893,
        "expires": 1721032493,
        "secret": "epk_cd28e31ba4eb48c6b01595b2d007b8b0"
    },
    "manual_retry_allowed": true,
    "connector_transaction_id": "80022007717",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_ND2WwoC6VijcO2bwzCNZ",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_UvqVahz5mptFO2F5hXP4",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-07-15T07:49:53.449Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-07-15T07:34:55.849Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}

The error reason should be populated for the failed payment in the payment_attempt table.
Screenshot 2024-07-15 at 1 10 26 PM

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

@deepanshu-iiitu deepanshu-iiitu added A-connector-integration Area: Connector integration C-bug Category: Bug labels Jul 15, 2024
@deepanshu-iiitu deepanshu-iiitu self-assigned this Jul 15, 2024
@deepanshu-iiitu deepanshu-iiitu requested a review from a team as a code owner July 15, 2024 07:41
@deepanshu-iiitu deepanshu-iiitu linked an issue Jul 15, 2024 that may be closed by this pull request
2 tasks
@deepanshu-iiitu deepanshu-iiitu requested review from AkshayaFoiger and swangi-kumari and removed request for AkshayaFoiger July 15, 2024 07:42
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 15, 2024
Merged via the queue into main with commit d8d222a Jul 15, 2024
@likhinbopanna likhinbopanna deleted the adn-error-reason branch July 15, 2024 10:15
pixincreate added a commit that referenced this pull request Jul 16, 2024
* 'main' of github.com:juspay/hyperswitch: (25 commits)
  fix(logs): ignore request headers while logging (#5273)
  feat(webhooks): add support for custom outgoing webhook http headers (#5275)
  fix(payment_methods): set `requires_cvv` to false when either `connector_mandate_details` or `network_transaction_id` is present during MITs (#5331)
  chore: create justfile for running commands for v1 and v2 migrations (#5325)
  fix(routing): do not update `perform_session_flow_routing` output if the `SessionRoutingChoice` is none (#5336)
  fix(database): modified_at updated for every state change for Payment Attempts (#5312)
  feat(mca): Added recipient connector call for open banking connectors (#3758)
  chore(version): 2024.07.16.0
  refactor(connector): [Mifinity] add a field language_preference in payment request for mifinity payment method data (#5326)
  fix(router): store `customer_acceptance` in payment_attempt, use it in confirm flow for delayed authorizations like external 3ds flow (#5308)
  feat(proxy): add support to pass proxy bypass urls from configs (#5322)
  Docs: Updating Error codes in API-ref (#5296)
  feat(core): [Payouts] Add retrieve flow for payouts (#4936)
  fix(connector): [AUTHORIZEDOTNET] Populate error reason for failure transactions (#5319)
  chore(version): 2024.07.15.0
  feat(logging): Emit a setup error when a restricted keys are used for logging default keys (#5185)
  feat(payment_methods): add support to migrate existing customer PMs from processor to hyperswitch (#5306)
  feat(connector): [DATATRANS] Implement card payments (#5028)
  chore: making of function create_encrypted_data (#5251)
  fix(payments): populate merchant order ref id in list (#5310)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-connector-integration Area: Connector integration C-bug Category: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] [AUTHORIZEDOTNET] Error reason not getting populated
4 participants