feat: add relevant ids for payment calls & make json logs (#908)

This commit is contained in:
Nishant Joshi
2023-04-21 02:51:47 +05:30
committed by GitHub
parent 1f151ba15a
commit 93b69e74b4
5 changed files with 34 additions and 10 deletions

View File

@ -9,7 +9,7 @@ use std::{fmt::Debug, marker::PhantomData, time::Instant};
use api_models::payments::Metadata;
use error_stack::{IntoReport, ResultExt};
use futures::future::join_all;
use router_env::tracing;
use router_env::{instrument, tracing};
use time;
pub use self::operations::{
@ -38,6 +38,7 @@ use crate::{
utils::{Encode, OptionExt, ValueExt},
};
#[instrument(skip_all, fields(payment_id, merchant_id))]
pub async fn payments_operation_core<F, Req, Op, FData>(
state: &AppState,
merchant_account: storage::MerchantAccount,
@ -63,11 +64,13 @@ where
{
let operation: BoxedOperation<'_, F, Req> = Box::new(operation);
tracing::Span::current().record("merchant_id", merchant_account.merchant_id.as_str());
let (operation, validate_result) = operation
.to_validate_request()?
.validate_request(&req, &merchant_account)?;
tracing::Span::current().record("payment_id", &format!("{:?}", validate_result.payment_id));
tracing::Span::current().record("payment_id", &format!("{}", validate_result.payment_id));
let (operation, mut payment_data, customer_details) = operation
.to_get_tracker()?