diff --git a/config/config.example.toml b/config/config.example.toml index b69519b6ac4a..c7644cabbf7b 100644 --- a/config/config.example.toml +++ b/config/config.example.toml @@ -200,6 +200,7 @@ paypal.base_url = "https://api-m.sandbox.paypal.com/" payu.base_url = "https://secure.snd.payu.com/" powertranz.base_url = "https://staging.ptranz.com/api/" rapyd.base_url = "https://sandboxapi.rapyd.net" +riskified.base_url = "https://sandbox.riskified.com/api" shift4.base_url = "https://api.shift4.com/" square.base_url = "https://connect.squareupsandbox.com/" square.secondary_base_url = "https://pci-connect.squareupsandbox.com/" diff --git a/config/development.toml b/config/development.toml index 75a5a89ca9dc..bcfe5a5fbb9b 100644 --- a/config/development.toml +++ b/config/development.toml @@ -171,6 +171,7 @@ paypal.base_url = "https://api-m.sandbox.paypal.com/" payu.base_url = "https://secure.snd.payu.com/" powertranz.base_url = "https://staging.ptranz.com/api/" rapyd.base_url = "https://sandboxapi.rapyd.net" +riskified.base_url = "https://sandbox.riskified.com/api" shift4.base_url = "https://api.shift4.com/" square.base_url = "https://connect.squareupsandbox.com/" square.secondary_base_url = "https://pci-connect.squareupsandbox.com/" diff --git a/config/docker_compose.toml b/config/docker_compose.toml index b1483327ee0c..acc30a88e0fd 100644 --- a/config/docker_compose.toml +++ b/config/docker_compose.toml @@ -115,6 +115,7 @@ paypal.base_url = "https://api-m.sandbox.paypal.com/" payu.base_url = "https://secure.snd.payu.com/" powertranz.base_url = "https://staging.ptranz.com/api/" rapyd.base_url = "https://sandboxapi.rapyd.net" +riskified.base_url = "https://sandbox.riskified.com/api" shift4.base_url = "https://api.shift4.com/" square.base_url = "https://connect.squareupsandbox.com/" square.secondary_base_url = "https://pci-connect.squareupsandbox.com/" diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index 01edef87a67a..9c64153f5113 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -302,6 +302,10 @@ pub struct PaymentsRequest { /// The type of the payment that differentiates between normal and various types of mandate payments #[schema(value_type = Option)] pub payment_type: Option, + + /// additional data related to some frm connectors + pub frm_metadata: Option, + } #[derive(Default, Debug, Clone, Copy)] @@ -2243,6 +2247,8 @@ pub struct OrderDetailsWithAmount { pub quantity: u16, /// the amount per quantity of product pub amount: i64, + // Does the order includes shipping + pub requires_shipping: bool, } #[derive(Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize, Clone, ToSchema)] @@ -2253,6 +2259,9 @@ pub struct OrderDetails { /// The quantity of the product to be purchased #[schema(example = 1)] pub quantity: u16, + // Does the order include shipping + pub requires_shipping: bool, + } #[derive(Default, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, Clone, ToSchema)] diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs index d65e53c95ba9..817c76c7e474 100644 --- a/crates/router/src/core/payments.rs +++ b/crates/router/src/core/payments.rs @@ -1461,6 +1461,7 @@ where pub ephemeral_key: Option, pub redirect_response: Option, pub frm_message: Option, + pub frm_metadata: Option, } #[derive(Debug, Default, Clone)] diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs index a6e3b2f12785..92f8b594ab16 100644 --- a/crates/router/src/core/payments/helpers.rs +++ b/crates/router/src/core/payments/helpers.rs @@ -2659,6 +2659,7 @@ pub fn router_data_type_conversion( connector_http_status_code: router_data.connector_http_status_code, external_latency: router_data.external_latency, apple_pay_flow: router_data.apple_pay_flow, + frm_metadata: router_data.frm_metadata, } } diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs index d7b3d743b959..876df511e692 100644 --- a/crates/router/src/core/payments/operations/payment_approve.rs +++ b/crates/router/src/core/payments/operations/payment_approve.rs @@ -252,6 +252,7 @@ impl multiple_capture_data: None, redirect_response, frm_message: frm_response.ok(), + frm_metadata: request.frm_metadata.clone(), }, Some(CustomerDetails { customer_id: request.customer_id.clone(), diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs index 72006946c207..5a96bb34b1df 100644 --- a/crates/router/src/core/payments/operations/payment_cancel.rs +++ b/crates/router/src/core/payments/operations/payment_cancel.rs @@ -172,6 +172,7 @@ impl multiple_capture_data: None, redirect_response: None, frm_message: None, + frm_metadata: None, }, None, )) diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs index bd64ebac6322..4cb5dea80944 100644 --- a/crates/router/src/core/payments/operations/payment_capture.rs +++ b/crates/router/src/core/payments/operations/payment_capture.rs @@ -230,6 +230,8 @@ impl multiple_capture_data, redirect_response: None, frm_message: None, + frm_metadata: None, + }, None, )) diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs index db2c9e27c9b9..361c90be9b36 100644 --- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs +++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs @@ -247,6 +247,7 @@ impl multiple_capture_data: None, redirect_response, frm_message: None, + frm_metadata: request.frm_metadata.clone(), }, Some(CustomerDetails { customer_id: request.customer_id.clone(), diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs index 761264e4798e..08a8d3dda97d 100644 --- a/crates/router/src/core/payments/operations/payment_confirm.rs +++ b/crates/router/src/core/payments/operations/payment_confirm.rs @@ -360,6 +360,7 @@ impl multiple_capture_data: None, redirect_response: None, frm_message: None, + frm_metadata: request.frm_metadata.clone(), }, Some(customer_details), )) diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs index 479b0e2cceea..51890001009a 100644 --- a/crates/router/src/core/payments/operations/payment_create.rs +++ b/crates/router/src/core/payments/operations/payment_create.rs @@ -295,6 +295,7 @@ impl multiple_capture_data: None, redirect_response: None, frm_message: None, + frm_metadata: request.frm_metadata.clone(), }, Some(customer_details), )) diff --git a/crates/router/src/core/payments/operations/payment_method_validate.rs b/crates/router/src/core/payments/operations/payment_method_validate.rs index 0ff49279f3c8..c30efcf8a119 100644 --- a/crates/router/src/core/payments/operations/payment_method_validate.rs +++ b/crates/router/src/core/payments/operations/payment_method_validate.rs @@ -196,6 +196,7 @@ impl multiple_capture_data: None, redirect_response: None, frm_message: None, + frm_metadata: None, }, Some(payments::CustomerDetails { customer_id: request.customer_id.clone(), diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs index c9a24b8fb840..22d0224d3519 100644 --- a/crates/router/src/core/payments/operations/payment_reject.rs +++ b/crates/router/src/core/payments/operations/payment_reject.rs @@ -158,6 +158,7 @@ impl multiple_capture_data: None, redirect_response: None, frm_message: frm_response.ok(), + frm_metadata: None }, None, )) diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs index 261275296f14..31a1a91f0150 100644 --- a/crates/router/src/core/payments/operations/payment_session.rs +++ b/crates/router/src/core/payments/operations/payment_session.rs @@ -192,6 +192,7 @@ impl multiple_capture_data: None, redirect_response: None, frm_message: None, + frm_metadata: None, }, Some(customer_details), )) diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs index 07015810039d..ad99ae1b0831 100644 --- a/crates/router/src/core/payments/operations/payment_start.rs +++ b/crates/router/src/core/payments/operations/payment_start.rs @@ -167,6 +167,7 @@ impl multiple_capture_data: None, redirect_response: None, frm_message: None, + frm_metadata: None, }, Some(customer_details), )) diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs index 6e0ef2f4bac7..133f4084c7b1 100644 --- a/crates/router/src/core/payments/operations/payment_status.rs +++ b/crates/router/src/core/payments/operations/payment_status.rs @@ -403,6 +403,7 @@ async fn get_tracker_for_sync< multiple_capture_data, redirect_response: None, frm_message: frm_response.ok(), + frm_metadata: None, }, None, )) diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs index 9e0ef76d3e7f..2a8429c825f6 100644 --- a/crates/router/src/core/payments/operations/payment_update.rs +++ b/crates/router/src/core/payments/operations/payment_update.rs @@ -346,6 +346,7 @@ impl multiple_capture_data: None, redirect_response: None, frm_message: None, + frm_metadata: request.frm_metadata.clone(), }, Some(customer_details), )) diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs index e1ea8a063592..b212cb8055b1 100644 --- a/crates/router/src/core/payments/transformers.rs +++ b/crates/router/src/core/payments/transformers.rs @@ -163,6 +163,7 @@ where connector_http_status_code: None, external_latency: None, apple_pay_flow, + frm_metadata: None, }; Ok(router_data) @@ -912,6 +913,7 @@ pub fn change_order_details_to_new_type( product_name: order_details.product_name, quantity: order_details.quantity, amount: order_amount, + requires_shipping: order_details.requires_shipping, }]) } diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs index 908bd1438762..2f901771c5fe 100644 --- a/crates/router/src/core/utils.rs +++ b/crates/router/src/core/utils.rs @@ -189,6 +189,7 @@ pub async fn construct_payout_router_data<'a, F>( connector_http_status_code: None, external_latency: None, apple_pay_flow: None, + frm_metadata: None, }; Ok(router_data) @@ -329,6 +330,7 @@ pub async fn construct_refund_router_data<'a, F>( connector_http_status_code: None, external_latency: None, apple_pay_flow: None, + frm_metadata: None }; Ok(router_data) @@ -557,6 +559,7 @@ pub async fn construct_accept_dispute_router_data<'a>( connector_http_status_code: None, external_latency: None, apple_pay_flow: None, + frm_metadata: None, }; Ok(router_data) } @@ -643,6 +646,7 @@ pub async fn construct_submit_evidence_router_data<'a>( connector_http_status_code: None, external_latency: None, apple_pay_flow: None, + frm_metadata: None, }; Ok(router_data) } @@ -734,6 +738,7 @@ pub async fn construct_upload_file_router_data<'a>( connector_http_status_code: None, external_latency: None, apple_pay_flow: None, + frm_metadata: None }; Ok(router_data) } @@ -823,6 +828,7 @@ pub async fn construct_defend_dispute_router_data<'a>( connector_http_status_code: None, external_latency: None, apple_pay_flow: None, + frm_metadata: None }; Ok(router_data) } @@ -905,6 +911,7 @@ pub async fn construct_retrieve_file_router_data<'a>( connector_http_status_code: None, external_latency: None, apple_pay_flow: None, + frm_metadata: None }; Ok(router_data) } diff --git a/crates/router/src/core/webhooks/utils.rs b/crates/router/src/core/webhooks/utils.rs index ac7e5081c823..320f6baf9057 100644 --- a/crates/router/src/core/webhooks/utils.rs +++ b/crates/router/src/core/webhooks/utils.rs @@ -120,6 +120,7 @@ pub async fn construct_webhook_router_data<'a>( connector_http_status_code: None, external_latency: None, apple_pay_flow: None, + frm_metadata: None, }; Ok(router_data) } diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs index 560d706a8403..8fbcdc0f01b3 100644 --- a/crates/router/src/types.rs +++ b/crates/router/src/types.rs @@ -292,6 +292,8 @@ pub struct RouterData { pub external_latency: Option, /// Contains apple pay flow type simplified or manual pub apple_pay_flow: Option, + + pub frm_metadata: Option, } #[derive(Debug, Clone, serde::Deserialize)] @@ -1119,6 +1121,7 @@ impl From<(&RouterData, T2)> connector_http_status_code: data.connector_http_status_code, external_latency: data.external_latency, apple_pay_flow: data.apple_pay_flow.clone(), + frm_metadata: data.frm_metadata.clone(), } } } @@ -1174,6 +1177,7 @@ impl connector_http_status_code: data.connector_http_status_code, external_latency: data.external_latency, apple_pay_flow: None, + frm_metadata: None, } } } diff --git a/crates/router/tests/connectors/payme.rs b/crates/router/tests/connectors/payme.rs index 67e7919caf75..880de1c44c79 100644 --- a/crates/router/tests/connectors/payme.rs +++ b/crates/router/tests/connectors/payme.rs @@ -76,6 +76,7 @@ fn payment_method_details() -> Option { product_name: "iphone 13".to_string(), quantity: 1, amount: 1000, + requires_shipping: false, }]), router_return_url: Some("https://hyperswitch.io".to_string()), webhook_url: Some("https://hyperswitch.io".to_string()), @@ -370,6 +371,7 @@ async fn should_fail_payment_for_incorrect_cvc() { product_name: "iphone 13".to_string(), quantity: 1, amount: 100, + requires_shipping: false, }]), router_return_url: Some("https://hyperswitch.io".to_string()), webhook_url: Some("https://hyperswitch.io".to_string()), @@ -402,6 +404,7 @@ async fn should_fail_payment_for_invalid_exp_month() { product_name: "iphone 13".to_string(), quantity: 1, amount: 100, + requires_shipping: false }]), router_return_url: Some("https://hyperswitch.io".to_string()), webhook_url: Some("https://hyperswitch.io".to_string()), @@ -434,6 +437,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { product_name: "iphone 13".to_string(), quantity: 1, amount: 100, + requires_shipping: false, }]), router_return_url: Some("https://hyperswitch.io".to_string()), webhook_url: Some("https://hyperswitch.io".to_string()), diff --git a/crates/router/tests/connectors/zen.rs b/crates/router/tests/connectors/zen.rs index ca71fd0c6221..bd65520ac346 100644 --- a/crates/router/tests/connectors/zen.rs +++ b/crates/router/tests/connectors/zen.rs @@ -313,6 +313,7 @@ async fn should_fail_payment_for_incorrect_card_number() { product_name: "test".to_string(), quantity: 1, amount: 1000, + requires_shipping: false, }]), email: Some(Email::from_str("test@gmail.com").unwrap()), webhook_url: Some("https://1635-116-74-253-164.ngrok-free.app".to_string()), @@ -348,6 +349,7 @@ async fn should_fail_payment_for_incorrect_cvc() { product_name: "test".to_string(), quantity: 1, amount: 1000, + requires_shipping: false, }]), email: Some(Email::from_str("test@gmail.com").unwrap()), webhook_url: Some("https://1635-116-74-253-164.ngrok-free.app".to_string()), @@ -383,6 +385,7 @@ async fn should_fail_payment_for_invalid_exp_month() { product_name: "test".to_string(), quantity: 1, amount: 1000, + requires_shipping: false }]), email: Some(Email::from_str("test@gmail.com").unwrap()), webhook_url: Some("https://1635-116-74-253-164.ngrok-free.app".to_string()), @@ -418,6 +421,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { product_name: "test".to_string(), quantity: 1, amount: 1000, + requires_shipping: false, }]), email: Some(Email::from_str("test@gmail.com").unwrap()), webhook_url: Some("https://1635-116-74-253-164.ngrok-free.app".to_string()),