mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 21:07:58 +08:00
feat(router): add disputes block in payments retrieve response (#1038)
This commit is contained in:
committed by
GitHub
parent
7c7185bc1a
commit
1304d912e5
@ -22,8 +22,8 @@ pub struct DisputeNew {
|
||||
pub connector_reason: Option<String>,
|
||||
pub connector_reason_code: Option<String>,
|
||||
pub challenge_required_by: Option<PrimitiveDateTime>,
|
||||
pub dispute_created_at: Option<PrimitiveDateTime>,
|
||||
pub updated_at: Option<PrimitiveDateTime>,
|
||||
pub connector_created_at: Option<PrimitiveDateTime>,
|
||||
pub connector_updated_at: Option<PrimitiveDateTime>,
|
||||
pub connector: String,
|
||||
}
|
||||
|
||||
@ -45,8 +45,8 @@ pub struct Dispute {
|
||||
pub connector_reason: Option<String>,
|
||||
pub connector_reason_code: Option<String>,
|
||||
pub challenge_required_by: Option<PrimitiveDateTime>,
|
||||
pub dispute_created_at: Option<PrimitiveDateTime>,
|
||||
pub updated_at: Option<PrimitiveDateTime>,
|
||||
pub connector_created_at: Option<PrimitiveDateTime>,
|
||||
pub connector_updated_at: Option<PrimitiveDateTime>,
|
||||
#[serde(with = "custom_serde::iso8601")]
|
||||
pub created_at: PrimitiveDateTime,
|
||||
#[serde(with = "custom_serde::iso8601")]
|
||||
@ -63,7 +63,7 @@ pub enum DisputeUpdate {
|
||||
connector_reason: Option<String>,
|
||||
connector_reason_code: Option<String>,
|
||||
challenge_required_by: Option<PrimitiveDateTime>,
|
||||
updated_at: Option<PrimitiveDateTime>,
|
||||
connector_updated_at: Option<PrimitiveDateTime>,
|
||||
},
|
||||
StatusUpdate {
|
||||
dispute_status: storage_enums::DisputeStatus,
|
||||
@ -80,7 +80,7 @@ pub struct DisputeUpdateInternal {
|
||||
connector_reason: Option<String>,
|
||||
connector_reason_code: Option<String>,
|
||||
challenge_required_by: Option<PrimitiveDateTime>,
|
||||
updated_at: Option<PrimitiveDateTime>,
|
||||
connector_updated_at: Option<PrimitiveDateTime>,
|
||||
modified_at: Option<PrimitiveDateTime>,
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ impl From<DisputeUpdate> for DisputeUpdateInternal {
|
||||
connector_reason,
|
||||
connector_reason_code,
|
||||
challenge_required_by,
|
||||
updated_at,
|
||||
connector_updated_at,
|
||||
} => Self {
|
||||
dispute_stage: Some(dispute_stage),
|
||||
dispute_status,
|
||||
@ -102,7 +102,7 @@ impl From<DisputeUpdate> for DisputeUpdateInternal {
|
||||
connector_reason,
|
||||
connector_reason_code,
|
||||
challenge_required_by,
|
||||
updated_at,
|
||||
connector_updated_at,
|
||||
modified_at: Some(common_utils::date_time::now()),
|
||||
},
|
||||
DisputeUpdate::StatusUpdate {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods};
|
||||
use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods, Table};
|
||||
use router_env::{instrument, tracing};
|
||||
|
||||
use super::generics;
|
||||
@ -48,6 +48,28 @@ impl Dispute {
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn find_by_merchant_id_payment_id(
|
||||
conn: &PgPooledConn,
|
||||
merchant_id: &str,
|
||||
payment_id: &str,
|
||||
) -> StorageResult<Vec<Self>> {
|
||||
generics::generic_filter::<
|
||||
<Self as HasTable>::Table,
|
||||
_,
|
||||
<<Self as HasTable>::Table as Table>::PrimaryKey,
|
||||
_,
|
||||
>(
|
||||
conn,
|
||||
dsl::merchant_id
|
||||
.eq(merchant_id.to_owned())
|
||||
.and(dsl::payment_id.eq(payment_id.to_owned())),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
#[instrument(skip(conn))]
|
||||
pub async fn update(self, conn: &PgPooledConn, dispute: DisputeUpdate) -> StorageResult<Self> {
|
||||
match generics::generic_update_with_unique_predicate_get_result::<
|
||||
|
||||
@ -130,8 +130,8 @@ diesel::table! {
|
||||
connector_reason -> Nullable<Varchar>,
|
||||
connector_reason_code -> Nullable<Varchar>,
|
||||
challenge_required_by -> Nullable<Timestamp>,
|
||||
dispute_created_at -> Nullable<Timestamp>,
|
||||
updated_at -> Nullable<Timestamp>,
|
||||
connector_created_at -> Nullable<Timestamp>,
|
||||
connector_updated_at -> Nullable<Timestamp>,
|
||||
created_at -> Timestamp,
|
||||
modified_at -> Timestamp,
|
||||
connector -> Varchar,
|
||||
|
||||
Reference in New Issue
Block a user