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

refactor(core): add error handling wrapper to wehbook #6686

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

Sakilmostak
Copy link
Contributor

Type of Change

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

Description

In webhook, for specific connectors, we want to consume every webhook that arrives even if a error occurs while processing. This is done to keep the webhook channel open with the connector.
In this pr, a error wrapper is introduced to handle this logic where based on connector, we choose whether to send error or not.

Note: Hotfix pr against #6636

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?

Tested through Postman:

  • Create a MCA (Adyenplatform):
  • Setup webhook endpoint in dashboard (Adyenplatform):
  • Create a payout:
{
    "amount": 100,
    "currency": "EUR",
    "customer_id": "sakilcust",
    "email": "[email protected]",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payout request",
    "payout_type": "bank",
    "priority": "instant",
    "payout_method_data": {
        "bank": {
            "iban": "DE89370400440532013000"
        }
    },
    "billing": {
        "address": {
            "line1": "Raadhuisplein",
            "line2": "92",
            "city": "Hoogeveen",
            "state": "FL",
            "zip": "7901 BW",
            "country": "NL",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "0650242319",
            "country_code": "+31"
        }
    },
    "entity_type": "Individual",
    "recurring": true,
    "confirm": true,
    "auto_fulfill": true
}
  • You should receive webhook for the following payout to the endpoint mentioned during merchant creation

Case 2:

  • Setup ngrok to intercept webhook
  • Create a payout (same body as above)
  • delete the payout_attempt from the payout_attempt table against the generated payout_id
  • See the log in ngrok for response sent to the adyenplatform
  • The status should be 200 with x-http-code present in headers

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

@Sakilmostak Sakilmostak requested review from a team as code owners November 27, 2024 16:00
@Sakilmostak Sakilmostak self-assigned this Nov 27, 2024
@Sakilmostak Sakilmostak added A-core Area: Core flows C-refactor Category: Refactor A-webhooks Area: Webhook flows labels Nov 27, 2024
@Sakilmostak Sakilmostak added this to the November 2024 Release milestone Nov 27, 2024
@likhinbopanna likhinbopanna merged commit 326f857 into hotfix-2024.11.25.0 Nov 27, 2024
15 of 18 checks passed
@likhinbopanna likhinbopanna deleted the webhook_error_handler_hotfix branch November 27, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows A-webhooks Area: Webhook flows C-refactor Category: Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants