-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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(router): add support for relay refund incoming webhooks #6974
Conversation
Changed Files
|
) -> impl Responder { | ||
let flow = Flow::IncomingWebhookReceive; | ||
let (merchant_id, connector_id_or_name) = path.into_inner(); | ||
let is_relay_webhook = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to a const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we consider using an enum instead of a bool
maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I take this up in my next pr ?
I have a relay refactor pr, will address this in the same pr.
#6954
…perswitch into relay/incoming-webhook
…perswitch into relay/incoming-webhook
impl RelayWebhooks { | ||
pub fn server(state: AppState) -> Scope { | ||
use api_models::webhooks as webhook_type; | ||
web::scope("/webhooks/relay") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we confirmed that this doesn't affect the existing incoming webhooks flows, due to the possibly conflicting routes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I have added the test cases for it
) -> impl Responder { | ||
let flow = Flow::IncomingWebhookReceive; | ||
let (merchant_id, connector_id_or_name) = path.into_inner(); | ||
let is_relay_webhook = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we consider using an enum instead of a bool
maybe?
Type of Change
Description
Some connectors, like Adyen, do not support a refund sync API, so we need to rely on refund webhooks for the status. To address this, support for relay refund webhooks is being added.
To support this use case, a new webhook endpoint needs to be introduced for relay webhooks:
/webhooks/relay/{merchant_id}/{connector_id_or_name}
Once the webhook is identified as a relay webhook, it should be handled based on the flow type, such as refunds, payments, etc. For now, only support for relay refund webhooks has been added.
Additional Changes
Motivation and Context
This change is to update the relay status when we have to rely on the connector webhooks for the refund status.
How did you test it?
-> Create a merchant connector account for stripe
-> Setup the webhook url in the stripe dashboard
-> Relay webhook testing
-> Make payment through stripe connector. As this relay webhooks can only handle relay refunds webhooks, we need to return 200 OK for the payments webhooks that we received.
-> Create a relay refund
-> Manually setting the db recording the pending to test relay status update by webhook
-> Re trigger the relay webhook and when retrieved the status is expected to be succeeded
-> Test stripe normal payments webhooks to ensure that the webhook behaviour is not affected for all other events
-> Create a payment
-> Manually set the status to pending in the db to test webhooks flow
-> resend the webhook and when retrieved the payment status is expected to be succeeded
Checklist
cargo +nightly fmt --all
cargo clippy