From c99e038a4813aa68b7a0a6ad3458c93a0e3c27ba Mon Sep 17 00:00:00 2001 From: soumilbaldota <71919921+soumilbaldota@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:07:41 +0530 Subject: [PATCH] refactor(router): add `updated` field to `PaymentsResponse` (#4292) Co-authored-by: soumil.sudhir --- crates/api_models/src/payments.rs | 5 +++++ crates/router/src/core/payments/transformers.rs | 1 + openapi/openapi_spec.json | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index 549b5d7b04..73200dbe1e 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -3253,6 +3253,11 @@ pub struct PaymentsResponse { /// Payment Method Status #[schema(value_type = Option)] pub payment_method_status: Option, + + /// Date time at which payment was updated + #[schema(example = "2022-09-10T10:11:12Z")] + #[serde(default, with = "common_utils::custom_serde::iso8601::option")] + pub updated: Option, } #[derive(Setter, Clone, Default, Debug, PartialEq, serde::Serialize, ToSchema)] diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs index cc319e3912..23b3f1f693 100644 --- a/crates/router/src/core/payments/transformers.rs +++ b/crates/router/src/core/payments/transformers.rs @@ -773,6 +773,7 @@ where .set_payment_method_status(payment_data.payment_method_info.map(|info| info.status)) .set_customer(customer_details_response.clone()) .set_browser_info(payment_attempt.browser_info) + .set_updated(Some(payment_intent.modified_at)) .to_owned(), headers, )) diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json index 1af82da7f5..c295a54e80 100644 --- a/openapi/openapi_spec.json +++ b/openapi/openapi_spec.json @@ -14850,6 +14850,13 @@ } ], "nullable": true + }, + "updated": { + "type": "string", + "format": "date-time", + "description": "Date time at which payment was updated", + "example": "2022-09-10T10:11:12Z", + "nullable": true } } },