Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat(router): Add modified_at field to Payments List Response (#10492)

Anurag Thakure367fc0b5cb9
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index aa0ca16888..fd853c8c24 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -27641,6 +27641,13 @@
"example": "2022-09-10T10:11:12Z",
"nullable": true
},
+ "modified_at": {
+ "type": "string",
+ "format": "date-time",
+ "description": "Timestamp indicating when this payment intent was last modified, in ISO 8601 format.",
+ "example": "2022-09-10T10:11:12Z",
+ "nullable": true
+ },
"currency": {
"$ref": "#/components/schemas/Currency"
},
@@ -29202,6 +29209,13 @@
"example": "2022-09-10T10:11:12Z",
"nullable": true
},
+ "modified_at": {
+ "type": "string",
+ "format": "date-time",
+ "description": "Timestamp indicating when this payment intent was last modified, in ISO 8601 format.",
+ "example": "2022-09-10T10:11:12Z",
+ "nullable": true
+ },
"currency": {
"$ref": "#/components/schemas/Currency"
},
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index ef63219d90..fdd9b7251d 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -6905,6 +6905,12 @@ pub struct PaymentsResponse {
#[smithy(value_type = "Option<String>")]
pub created: Option<PrimitiveDateTime>,
+ /// Timestamp indicating when this payment intent was last modified, in ISO 8601 format.
+ #[schema(example = "2022-09-10T10:11:12Z")]
+ #[serde(with = "common_utils::custom_serde::iso8601::option")]
+ #[smithy(value_type = "Option<String>")]
+ pub modified_at: Option<PrimitiveDateTime>,
+
/// Three-letter ISO currency code (e.g., USD, EUR) for the payment amount.
#[schema(value_type = Currency, example = "USD")]
#[smithy(value_type = "Currency")]
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index f084c53a2b..38f8b4433e 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -3886,6 +3886,7 @@ where
connector: routed_through,
client_secret: payment_intent.client_secret.map(Secret::new),
created: Some(payment_intent.created_at),
+ modified_at: Some(payment_intent.modified_at),
currency: currency.to_string(),
customer_id: customer.as_ref().map(|cus| cus.clone().customer_id),
customer: customer_details_response,
@@ -4178,6 +4179,7 @@ impl ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)> for api::Pay
amount_capturable: pa.amount_capturable,
client_secret: pi.client_secret.map(|s| s.into()),
created: Some(pi.created_at),
+ modified_at: Some(pi.modified_at),
currency: pi.currency.map(|c| c.to_string()).unwrap_or_default(),
description: pi.description,
metadata: pi.metadata,
diff --git a/crates/router/src/db/events.rs b/crates/router/src/db/events.rs
index 98616f1da2..4e9b715487 100644
--- a/crates/router/src/db/events.rs
+++ b/crates/router/src/db/events.rs
@@ -1309,6 +1309,7 @@ mod tests {
amount_received: None,
client_secret: None,
created: None,
+ modified_at: None,
currency: "USD".to_string(),
customer_id: None,
description: Some("Its my first payment request".to_string()),
diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rs
index acc5e1d2fe..049de18982 100644
--- a/crates/router/tests/payments.rs
+++ b/crates/router/tests/payments.rs
@@ -377,6 +377,7 @@ async fn payments_create_core() {
amount_received: None,
client_secret: None,
created: None,
+ modified_at: None,
currency: "USD".to_string(),
customer_id: None,
description: Some("Its my first payment request".to_string()),
@@ -669,6 +670,7 @@ async fn payments_create_core_adyen_no_redirect() {
amount_received: None,
client_secret: None,
created: None,
+ modified_at: None,
currency: "USD".to_string(),
customer_id: None,
description: Some("Its my first payment request".to_string()),
diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rs
index 5cf28a6ef7..36fa5a3e75 100644
--- a/crates/router/tests/payments2.rs
+++ b/crates/router/tests/payments2.rs
@@ -137,6 +137,7 @@ async fn payments_create_core() {
amount_received: None,
client_secret: None,
created: None,
+ modified_at: None,
currency: "USD".to_string(),
customer_id: None,
description: Some("Its my first payment request".to_string()),
@@ -438,6 +439,7 @@ async fn payments_create_core_adyen_no_redirect() {
amount_received: None,
client_secret: None,
created: None,
+ modified_at: None,
currency: "USD".to_string(),
customer_id: None,
description: Some("Its my first payment request".to_string()),