diff --git a/crates/router/src/connector/riskified/transformers/api.rs b/crates/router/src/connector/riskified/transformers/api.rs index 51802c8f96..f20b6103cc 100644 --- a/crates/router/src/connector/riskified/transformers/api.rs +++ b/crates/router/src/connector/riskified/transformers/api.rs @@ -484,6 +484,21 @@ pub struct FulfilmentData { impl TryFrom<&frm_types::FrmFulfillmentRouterData> for RiskifiedFulfillmentRequest { type Error = Error; fn try_from(item: &frm_types::FrmFulfillmentRouterData) -> Result { + let tracking_number = item + .request + .fulfillment_req + .tracking_numbers + .as_ref() + .and_then(|numbers| numbers.first().cloned()) + .ok_or(errors::ConnectorError::MissingRequiredField { + field_name: "tracking_number", + })?; + let tracking_url = item + .request + .fulfillment_req + .tracking_urls + .as_ref() + .and_then(|urls| urls.first().cloned().map(|url| url.to_string())); Ok(Self { order: OrderFulfillment { id: item.attempt_id.clone(), @@ -504,12 +519,8 @@ impl TryFrom<&frm_types::FrmFulfillmentRouterData> for RiskifiedFulfillmentReque .ok_or(errors::ConnectorError::MissingRequiredField { field_name: "tracking_company", })?, - tracking_number: item.request.fulfillment_req.tracking_number.clone().ok_or( - errors::ConnectorError::MissingRequiredField { - field_name: "tracking_number", - }, - )?, - tracking_url: item.request.fulfillment_req.tracking_url.clone(), + tracking_number, + tracking_url, }, }, }) diff --git a/crates/router/src/connector/signifyd/transformers/api.rs b/crates/router/src/connector/signifyd/transformers/api.rs index da1670ea1b..684c789be6 100644 --- a/crates/router/src/connector/signifyd/transformers/api.rs +++ b/crates/router/src/connector/signifyd/transformers/api.rs @@ -225,6 +225,7 @@ pub struct Transactions { payment_method: storage_enums::PaymentMethod, amount: i64, currency: storage_enums::Currency, + gateway: Option, } #[derive(Debug, Serialize, Eq, PartialEq)] @@ -256,6 +257,7 @@ impl TryFrom<&frm_types::FrmTransactionRouterData> for SignifydPaymentsTransacti gateway_status_code: GatewayStatusCode::from(item.status).to_string(), payment_method: item.payment_method, currency, + gateway: item.request.connector.clone(), }; Ok(Self { order_id: item.attempt_id.clone(), @@ -377,6 +379,12 @@ pub struct Fulfillments { pub shipment_id: String, pub products: Option>, pub destination: Destination, + pub fulfillment_method: Option, + pub carrier: Option, + pub shipment_status: Option, + pub tracking_urls: Option>, + pub tracking_numbers: Option>, + pub shipped_at: Option, } #[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)] @@ -397,15 +405,9 @@ impl TryFrom<&frm_types::FrmFulfillmentRouterData> for FrmFulfillmentSignifydReq .request .fulfillment_req .fulfillment_status - .clone() - .map(|fulfillment_status| FulfillmentStatus::from(&fulfillment_status)), - fulfillments: item - .request - .fulfillment_req - .fulfillments - .iter() - .map(|f| Fulfillments::from(f.clone())) - .collect(), + .as_ref() + .map(|fulfillment_status| FulfillmentStatus::from(&fulfillment_status.clone())), + fulfillments: Vec::::from(&item.request.fulfillment_req), }) } } @@ -421,15 +423,26 @@ impl From<&core_types::FulfillmentStatus> for FulfillmentStatus { } } -impl From for Fulfillments { - fn from(fulfillment: core_types::Fulfillments) -> Self { - Self { - shipment_id: fulfillment.shipment_id, - products: fulfillment - .products - .map(|products| products.iter().map(|p| Product::from(p.clone())).collect()), - destination: Destination::from(fulfillment.destination), - } +impl From<&core_types::FrmFulfillmentRequest> for Vec { + fn from(fulfillment_req: &core_types::FrmFulfillmentRequest) -> Self { + fulfillment_req + .fulfillments + .iter() + .map(|fulfillment| Fulfillments { + shipment_id: fulfillment.shipment_id.clone(), + products: fulfillment + .products + .as_ref() + .map(|products| products.iter().map(|p| Product::from(p.clone())).collect()), + destination: Destination::from(fulfillment.destination.clone()), + tracking_urls: fulfillment_req.tracking_urls.clone(), + tracking_numbers: fulfillment_req.tracking_numbers.clone(), + fulfillment_method: fulfillment_req.fulfillment_method.clone(), + carrier: fulfillment_req.carrier.clone(), + shipment_status: fulfillment_req.shipment_status.clone(), + shipped_at: fulfillment_req.shipped_at.clone(), + }) + .collect() } } diff --git a/crates/router/src/core/fraud_check/flows/transaction_flow.rs b/crates/router/src/core/fraud_check/flows/transaction_flow.rs index 5634916b21..a24f196245 100644 --- a/crates/router/src/core/fraud_check/flows/transaction_flow.rs +++ b/crates/router/src/core/fraud_check/flows/transaction_flow.rs @@ -81,6 +81,7 @@ impl error_code: self.payment_attempt.error_code.clone(), error_message: self.payment_attempt.error_message.clone(), connector_transaction_id: self.payment_attempt.connector_transaction_id.clone(), + connector: self.payment_attempt.connector.clone(), }, // self.order_details response: Ok(FraudCheckResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId("".to_string()), diff --git a/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs b/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs index eac8dc84da..ae316e7a11 100644 --- a/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs +++ b/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs @@ -170,6 +170,7 @@ impl Domain for FraudCheckPre { error_code: router_data.request.error_code, error_message: router_data.request.error_message, connector_transaction_id: router_data.request.connector_transaction_id, + connector: router_data.request.connector, }), response: FrmResponse::Transaction(router_data.response), })) diff --git a/crates/router/src/core/fraud_check/types.rs b/crates/router/src/core/fraud_check/types.rs index 46a341142f..082210a2e4 100644 --- a/crates/router/src/core/fraud_check/types.rs +++ b/crates/router/src/core/fraud_check/types.rs @@ -129,10 +129,18 @@ pub struct FrmFulfillmentRequest { #[schema(max_length = 255, example = "fedex")] pub tracking_company: Option, //tracking ID of the product - #[schema(max_length = 255, example = "track_8327446667")] - pub tracking_number: Option, + #[schema(example = r#"["track_8327446667", "track_8327446668"]"#)] + pub tracking_numbers: Option>, //tracking_url for tracking the product - pub tracking_url: Option, + pub tracking_urls: Option>, + // The name of the Shipper. + pub carrier: Option, + // Fulfillment method for the shipment. + pub fulfillment_method: Option, + // Statuses to indicate shipment state. + pub shipment_status: Option, + // The date and time items are ready to be shipped. + pub shipped_at: Option, } #[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)] diff --git a/crates/router/src/types/fraud_check.rs b/crates/router/src/types/fraud_check.rs index 191e74422f..b6f1d10888 100644 --- a/crates/router/src/types/fraud_check.rs +++ b/crates/router/src/types/fraud_check.rs @@ -103,6 +103,8 @@ pub struct FraudCheckTransactionData { pub error_code: Option, pub error_message: Option, pub connector_transaction_id: Option, + //The name of the payment gateway or financial institution that processed the transaction. + pub connector: Option, } pub type FrmFulfillmentRouterData =