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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(FRM): add shipping details for signifyd (#4500)
chikke srujanbda749d097ee
diff --git a/crates/router/src/connector/riskified/transformers/api.rs b/crates/router/src/connector/riskified/transformers/api.rsindex 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<Self, Self::Error> {+ 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.rsindex 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<String>,}#[derive(Debug, Serialize, Eq, PartialEq)]@@ -256,6 +257,7 @@ impl TryFrom<&frm_types::FrmTransactionRouterData> for SignifydPaymentsTransactigateway_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<Vec<Product>>,pub destination: Destination,+ pub fulfillment_method: Option<String>,+ pub carrier: Option<String>,+ pub shipment_status: Option<String>,+ pub tracking_urls: Option<Vec<String>>,+ pub tracking_numbers: Option<Vec<String>>,+ pub shipped_at: Option<String>,}#[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::<Fulfillments>::from(&item.request.fulfillment_req),})}}@@ -421,15 +423,26 @@ impl From<&core_types::FulfillmentStatus> for FulfillmentStatus {}}-impl From<core_types::Fulfillments> 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<Fulfillments> {+ 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.rsindex 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 @@ implerror_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_detailsresponse: 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.rsindex 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<F: Send + Clone> Domain<F> 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.rsindex 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<String>,//tracking ID of the product- #[schema(max_length = 255, example = "track_8327446667")]- pub tracking_number: Option<String>,+ #[schema(example = r#"["track_8327446667", "track_8327446668"]"#)]+ pub tracking_numbers: Option<Vec<String>>,//tracking_url for tracking the product- pub tracking_url: Option<String>,+ pub tracking_urls: Option<Vec<String>>,+ // The name of the Shipper.+ pub carrier: Option<String>,+ // Fulfillment method for the shipment.+ pub fulfillment_method: Option<String>,+ // Statuses to indicate shipment state.+ pub shipment_status: Option<String>,+ // The date and time items are ready to be shipped.+ pub shipped_at: Option<String>,}#[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.rsindex 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<String>,pub error_message: Option<String>,pub connector_transaction_id: Option<String>,+ //The name of the payment gateway or financial institution that processed the transaction.+ pub connector: Option<String>,}pub type FrmFulfillmentRouterData =