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(payments): implemented support for sorting payment lists by the modified_at field (#11333)

Venu Madhav Bandarupallifa27f44cb4a1
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index c794975ae0..f5211cf011 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -28725,7 +28725,8 @@
"type": "string",
"enum": [
"amount",
- "created"
+ "created",
+ "modified"
]
},
"SplitPaymentMethodDataRequest": {
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 42eff0efbf..f76b3d9a20 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -9054,6 +9054,8 @@ pub enum SortOn {
/// Sort by the created_at field
#[default]
Created,
+ /// Sort by the modified_at field
+ Modified,
}
#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs
index 80af3d6047..6e628be0b1 100644
--- a/crates/storage_impl/src/payments/payment_intent.rs
+++ b/crates/storage_impl/src/payments/payment_intent.rs
@@ -1143,6 +1143,14 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
on: SortOn::Created,
by: SortBy::Desc,
} => query.order(pi_dsl::created_at.desc()),
+ Order {
+ on: SortOn::Modified,
+ by: SortBy::Asc,
+ } => query.order(pi_dsl::modified_at.asc()),
+ Order {
+ on: SortOn::Modified,
+ by: SortBy::Desc,
+ } => query.order(pi_dsl::modified_at.desc()),
};
if let Some(limit) = params.limit {
@@ -1360,6 +1368,14 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
on: SortOn::Created,
by: SortBy::Desc,
} => query.order(pi_dsl::created_at.desc()),
+ Order {
+ on: SortOn::Modified,
+ by: SortBy::Asc,
+ } => query.order(pi_dsl::modified_at.asc()),
+ Order {
+ on: SortOn::Modified,
+ by: SortBy::Desc,
+ } => query.order(pi_dsl::modified_at.desc()),
};
if let Some(limit) = params.limit {