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

fix(connector): [Volt] handle 5xx error for Volt payments webhooks #6576

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

swangi-kumari
Copy link
Contributor

@swangi-kumari swangi-kumari commented Nov 14, 2024

Type of Change

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

Description

handle 5xx error for Volt payments webhooks

In the Volt connector for payment webhooks in production, a field is occasionally changing. The payment field sometimes comes as id instead, with the same expected value as payment. Since it’s coming as id rather than payment, the webhook body deserialization is failing, causing a 5xx error. To prevent this, I have added an alias for payment as id.

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?

Configure webhooks in volt dashboard.

  1. Create a open_banking_uk Payment via Volt
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: {}' \
--data-raw '{
    "amount": 8000,
    "currency": "EUR",
    "confirm": true,
      "capture_method": "automatic",
      "capture_on": "2022-09-10T10:11:12Z",
      "amount_to_capture": 8000,
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
      "authentication_type": "no_three_ds",
    "return_url": "https://www.google.com/",
    "payment_method": "bank_redirect",
    "payment_method_type": "open_banking_uk",
    "payment_method_data": {
        "bank_redirect": {
            "open_banking_uk": {
            }
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "DE",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "DE",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    
    
    "profile_id": "pro_dHxsLE73VVQwBZfzx9Il"
}

'

Complete payment using redirection link.

  1. Create a Refund
curl --location 'http://localhost:8080/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: {}' \
--data '{
  "payment_id": "pay_KvWJlcOapPbt7YzEY08t",
  "amount": 577,
  "reason": "Customer returned product",
  "refund_type": "instant",
  "metadata": {
    "udf1": "value1",
    "new_customer": "true",
    "login_date": "2019-09-10T10:11:12Z"
  }
}'

Check for webhooks in Volt dashboard under transactions.
Then for Notifications check for all webhooks, In All the 4 notifications PENDING , COMPLETED, RECEIVED and REFUND_CONFIRMED should have status Delivered and http code 200 OK.

Screenshot 2024-11-14 at 7 17 34 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

@swangi-kumari swangi-kumari added A-connector-integration Area: Connector integration C-bug Category: Bug labels Nov 14, 2024
@swangi-kumari swangi-kumari self-assigned this Nov 14, 2024
@swangi-kumari swangi-kumari requested a review from a team as a code owner November 14, 2024 13:45
Copy link

semanticdiff-com bot commented Nov 14, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/volt/transformers.rs  0% smaller

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.

3 participants