feat(router): add disputes block in payments retrieve response (#1038)

This commit is contained in:
Sai Harsha Vardhan
2023-05-09 23:57:07 +05:30
committed by GitHub
parent 7c7185bc1a
commit 1304d912e5
22 changed files with 168 additions and 22 deletions

View File

@ -4,7 +4,7 @@ use utoipa::ToSchema;
use super::enums::{DisputeStage, DisputeStatus};
#[derive(Default, Clone, Debug, Serialize, ToSchema)]
#[derive(Clone, Debug, Serialize, ToSchema, Eq, PartialEq)]
pub struct DisputeResponse {
/// The identifier for dispute
pub dispute_id: String,
@ -35,12 +35,43 @@ pub struct DisputeResponse {
pub challenge_required_by: Option<PrimitiveDateTime>,
/// Dispute created time sent by connector
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub created_at: Option<PrimitiveDateTime>,
pub connector_created_at: Option<PrimitiveDateTime>,
/// Dispute updated time sent by connector
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub updated_at: Option<PrimitiveDateTime>,
pub connector_updated_at: Option<PrimitiveDateTime>,
/// Time at which dispute is received
pub received_at: String,
#[serde(with = "common_utils::custom_serde::iso8601")]
pub created_at: PrimitiveDateTime,
}
#[derive(Clone, Debug, Serialize, ToSchema, Eq, PartialEq)]
pub struct DisputeResponsePaymentsRetrieve {
/// The identifier for dispute
pub dispute_id: String,
/// Stage of the dispute
pub dispute_stage: DisputeStage,
/// Status of the dispute
pub dispute_status: DisputeStatus,
/// Status of the dispute sent by connector
pub connector_status: String,
/// Dispute id sent by connector
pub connector_dispute_id: String,
/// Reason of dispute sent by connector
pub connector_reason: Option<String>,
/// Reason code of dispute sent by connector
pub connector_reason_code: Option<String>,
/// Evidence deadline of dispute sent by connector
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub challenge_required_by: Option<PrimitiveDateTime>,
/// Dispute created time sent by connector
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub connector_created_at: Option<PrimitiveDateTime>,
/// Dispute updated time sent by connector
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub connector_updated_at: Option<PrimitiveDateTime>,
/// Time at which dispute is received
#[serde(with = "common_utils::custom_serde::iso8601")]
pub created_at: PrimitiveDateTime,
}
#[derive(Clone, Debug, Deserialize, ToSchema)]

View File

@ -7,7 +7,7 @@ use router_derive::Setter;
use time::PrimitiveDateTime;
use utoipa::ToSchema;
use crate::{admin, enums as api_enums, refunds};
use crate::{admin, disputes, enums as api_enums, refunds};
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum PaymentOp {
@ -1035,6 +1035,10 @@ pub struct PaymentsResponse {
#[schema(value_type = Option<Vec<RefundResponse>>)]
pub refunds: Option<Vec<refunds::RefundResponse>>,
/// List of dispute that happened on this intent
#[schema(value_type = Option<Vec<DisputeResponsePaymentsRetrieve>>)]
pub disputes: Option<Vec<disputes::DisputeResponsePaymentsRetrieve>>,
/// A unique identifier to link the payment to a mandate, can be use instead of payment_method_data
#[schema(max_length = 255, example = "mandate_iwer89rnjef349dni3")]
pub mandate_id: Option<String>,