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

feat(webhook): add frm webhook support #4662

Merged
merged 20 commits into from
May 22, 2024
Merged

feat(webhook): add frm webhook support #4662

merged 20 commits into from
May 22, 2024

Conversation

srujanchikke
Copy link
Contributor

@srujanchikke srujanchikke commented May 16, 2024

Type of Change

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

Description

This PR introduces FRM webhooks . Frm webhooks are consumed when payments are held due to manual review pending from FRM processors. When merchant/ Frm provides decision , webhook is triggered . Based on decision we take action whether to approve or decline the payment.

Additional Changes

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

Motivation and Context

Upon merchant decision on manual review, FRM send us webhooks. Based on FRM webhooks decision we should approve/decline the transaction.

How did you test it?

Test cases
1 . Test signifyd webhooks.(process both incoming and outgoing webhooks)
2. Test any payment processor webhook.

Screenshot 2024-05-22 at 12 00 32 PM Screenshot 2024-05-22 at 12 00 47 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

@srujanchikke srujanchikke added A-core Area: Core flows C-feature Category: Feature request or enhancement A-webhooks Area: Webhook flows labels May 16, 2024
@srujanchikke srujanchikke self-assigned this May 16, 2024
@srujanchikke srujanchikke changed the title add webhook support for frm feature(webhook): Add webhook support for FRM May 16, 2024
@srujanchikke srujanchikke changed the title feature(webhook): Add webhook support for FRM feature(webhook): add frm webhook support May 16, 2024
@srujanchikke srujanchikke changed the title feature(webhook): add frm webhook support feat(webhook): add frm webhook support May 16, 2024
@srujanchikke srujanchikke marked this pull request as ready for review May 21, 2024 07:27
@srujanchikke srujanchikke requested review from a team as code owners May 21, 2024 07:27
payments::PaymentApprove,
api::PaymentsCaptureRequest {
payment_id: payment_attempt.payment_id,
amount_to_capture: Some(payment_attempt.amount),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please send payment_attempt.amount_to_capture here

HeaderPayload::default(),
))
.await?;
match payments_response {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove this redundant logic and get the payments_response using the event type

.change_context(errors::ApiErrorResponse::WebhookProcessingFailure)
.attach_printable("payment id not received from payments core")?;
let status = payments_response.status;
let _event_type: Option<enums::EventType> =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please trigger an outgoing webhook here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

key_store: domain::MerchantKeyStore,
source_verified: bool,
event_type: webhooks::IncomingWebhookEvent,
_request_details: &api::IncomingWebhookRequestDetails<'_>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove unused fields here

business_profile,
))
.await
.attach_printable("Incoming webhook flow for external authentication failed")?,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.attach_printable("Incoming webhook flow for external authentication failed")?,
.attach_printable("Incoming webhook flow for fraud check failed")?,

@likhinbopanna likhinbopanna added this pull request to the merge queue May 22, 2024
Merged via the queue into main with commit ae601e8 May 22, 2024
10 checks passed
@likhinbopanna likhinbopanna deleted the frm_webhooks branch May 22, 2024 08:28
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-feature Category: Feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants