refactor(webhook): add a function to retrieve payment_id (#2447)

Co-authored-by: Abhishek Marrivagu <68317979+Abhicodes-crypto@users.noreply.github.com>
This commit is contained in:
Narayan Bhat
2023-10-04 18:49:34 +05:30
committed by GitHub
parent 591c9b70d9
commit 409913fd75

View File

@ -59,6 +59,17 @@ pub enum WebhookResponseTracker {
NoEffect,
}
impl WebhookResponseTracker {
pub fn get_payment_id(&self) -> Option<String> {
match self {
Self::Payment { payment_id, .. }
| Self::Refund { payment_id, .. }
| Self::Dispute { payment_id, .. } => Some(payment_id.to_string()),
Self::NoEffect => None,
}
}
}
impl From<IncomingWebhookEvent> for WebhookFlow {
fn from(evt: IncomingWebhookEvent) -> Self {
match evt {