-
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 payment incoming webhooks support for v2 #6551
base: main
Are you sure you want to change the base?
Conversation
@@ -188,6 +188,33 @@ impl PaymentAttempt { | |||
.await | |||
} | |||
|
|||
#[cfg(feature = "v2")] | |||
pub async fn find_by_merchant_id_connector_txn_id( |
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.
pub async fn find_by_merchant_id_connector_txn_id( | |
pub async fn find_by_merchant_id_connector_transaction_id( |
#[cfg(feature = "v2")] | ||
pub async fn find_by_merchant_id_connector_txn_id( | ||
conn: &PgPooledConn, | ||
merchant_id: &common_utils::id_type::MerchantId, |
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.
this should be a profile based
@@ -102,6 +102,16 @@ pub trait PaymentAttemptInterface { | |||
storage_scheme: storage_enums::MerchantStorageScheme, | |||
) -> error_stack::Result<PaymentAttempt, errors::StorageError>; | |||
|
|||
#[cfg(feature = "v2")] | |||
async fn find_payment_attempt_by_merchant_id_connector_txn_id( |
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.
async fn find_payment_attempt_by_merchant_id_connector_txn_id( | |
async fn find_payment_attempt_by_merchant_id_connector_transaction_id( |
} | ||
} | ||
|
||
async fn get_payment_id( |
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.
return objects from the function, just to get a id we shouldn't do database call, if we do so also, return the object so that, the objects can be used later. change the function name too.
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.
We are not fetching the object in all the cases, in case of PaymentIdType::PaymentIntentId
we are directly returning the id
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 make this consistent, we should avoid reading same object twice in the flow. Like in redirection, we eliminated double reads
} else if connector.is_webhook_source_verification_mandatory() { | ||
// if webhook consumption is mandatory for connector, fail webhook | ||
// so that merchant can retrigger it after updating merchant_secret | ||
return Err(errors::ApiErrorResponse::WebhookAuthenticationFailed.into()); |
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.
Avoid return from middle of the flow
Type of Change
Description
add payment incoming webhooks support for v2
Additional Changes
Motivation and Context
How did you test it?
Tested Manually
Sanity payment webhooks in v1
Incoming payment webhooks (source_verified = true)
Incoming payment webhooks (source_verified = false)
Checklist
cargo +nightly fmt --all
cargo clippy