Skip to content

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

feat(router): add proxy-confirm-intent api for payments in v2 flow (#7215)

Aditya Chaurasia30f321bc2001
diff --git a/.typos.toml b/.typos.toml
index 612aa3be8b..0316374cd6 100644
--- a/.typos.toml
+++ b/.typos.toml
@@ -74,6 +74,7 @@ Corse-du-Sud = "Corse-du-Sud" # Is a state in France
Haute-Corse = "Haute-Corse" # Is a state in France
Fram = "Fram" # Is a state in Slovenia
+
[default.extend-words]
aci = "aci" # Name of a connector
afe = "afe" # Commit id
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index cd8b845836..bef1bcdeb5 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -15301,13 +15301,29 @@
"description": "The return url to which the user should be redirected to",
"nullable": true
},
- "associated_payment": {
+ "next_action": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentsResponse"
+ "$ref": "#/components/schemas/NextActionData"
+ }
+ ],
+ "nullable": true
+ },
+ "authentication_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/AuthenticationDetails"
}
],
"nullable": true
+ },
+ "associated_payment_methods": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/id_type.GlobalPaymentMethodId"
+ },
+ "description": "The payment method that was created using this payment method session",
+ "nullable": true
}
}
},
@@ -15542,60 +15558,6 @@
},
"additionalProperties": false
},
- "PaymentMethodsSessionResponse": {
- "type": "object",
- "required": [
- "id",
- "customer_id",
- "expires_at",
- "client_secret"
- ],
- "properties": {
- "id": {
- "type": "string",
- "example": "12345_pms_01926c58bc6e77c09e809964e72af8c8"
- },
- "customer_id": {
- "type": "string",
- "description": "The customer id for which the payment methods session is to be created",
- "example": "12345_cus_01926c58bc6e77c09e809964e72af8c8"
- },
- "billing": {
- "allOf": [
- {
- "$ref": "#/components/schemas/Address"
- }
- ],
- "nullable": true
- },
- "psp_tokenization": {
- "allOf": [
- {
- "$ref": "#/components/schemas/PspTokenization"
- }
- ],
- "nullable": true
- },
- "network_tokenization": {
- "allOf": [
- {
- "$ref": "#/components/schemas/NetworkTokenization"
- }
- ],
- "nullable": true
- },
- "expires_at": {
- "type": "string",
- "format": "date-time",
- "description": "The iso timestamp when the session will expire\nTrying to retrieve the session or any operations on the session after this time will result in an error",
- "example": "2023-01-18T11:04:09.922Z"
- },
- "client_secret": {
- "type": "string",
- "description": "Client Secret"
- }
- }
- },
"PaymentMethodsSessionUpdateRequest": {
"type": "object",
"properties": {
@@ -16836,7 +16798,7 @@
},
"PaymentsResponse": {
"type": "object",
- "description": "Response for Payment Intent Confirm\nFew fields should be expandable, we need not return these in the normal response\nBut when explictly requested for expanded objects, these can be returned\nFor example\nshipping, billing, customer, payment_method",
+ "description": "Response for Payment Intent Confirm\nFew fields should be expandable, we need not return these in the normal response\nBut when explicitly requested for expanded objects, these can be returned\nFor example\nshipping, billing, customer, payment_method",
"required": [
"id",
"status",
@@ -17217,6 +17179,14 @@
}
],
"nullable": true
+ },
+ "set_active_attempt_id": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/UpdateActiveAttempt"
+ }
+ ],
+ "nullable": true
}
},
"additionalProperties": false
@@ -21796,6 +21766,31 @@
"journey"
]
},
+ "UpdateActiveAttempt": {
+ "oneOf": [
+ {
+ "type": "object",
+ "required": [
+ "Set"
+ ],
+ "properties": {
+ "Set": {
+ "type": "string",
+ "description": "Request to set the active attempt id",
+ "nullable": true
+ }
+ }
+ },
+ {
+ "type": "string",
+ "description": "To unset the active attempt id",
+ "enum": [
+ "Unset"
+ ]
+ }
+ ],
+ "description": "Whether active attempt is to be set/unset"
+ },
"UpdateApiKeyRequest": {
"type": "object",
"description": "The request body for updating an API Key.",
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index 639d25ea76..6ae46a5ede 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -55,6 +55,17 @@ pub enum PayoutConnectors {
Wise,
}
+#[cfg(feature = "v2")]
+/// Whether active attempt is to be set/unset
+#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
+pub enum UpdateActiveAttempt {
+ /// Request to set the active attempt id
+ #[schema(value_type = Option<String>)]
+ Set(common_utils::id_type::GlobalAttemptId),
+ /// To unset the active attempt id
+ Unset,
+}
+
#[cfg(feature = "payouts")]
impl From<PayoutConnectors> for RoutableConnectors {
fn from(value: PayoutConnectors) -> Self {
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index ccc055a793..e3a45db4c8 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -2661,7 +2661,7 @@ pub struct PaymentMethodSessionResponse {
#[schema(value_type = Option<NextActionData>)]
pub next_action: Option<payments::NextActionData>,
- /// The customer authenticaion details for the payment method
+ /// The customer authentication details for the payment method
/// This refers to either the payment / external authentication details
pub authentication_details: Option<AuthenticationDetails>,
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 12da310ac6..15d6e68f14 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -34,6 +34,8 @@ use utoipa::ToSchema;
#[cfg(feature = "v1")]
use crate::ephemeral_key::EphemeralKeyCreateResponse;
#[cfg(feature = "v2")]
+use crate::mandates::ProcessorPaymentToken;
+#[cfg(feature = "v2")]
use crate::payment_methods;
use crate::{
admin::{self, MerchantConnectorInfo},
@@ -422,6 +424,10 @@ pub struct PaymentsUpdateIntentRequest {
#[schema(value_type = Option<External3dsAuthenticationRequest>)]
pub request_external_three_ds_authentication:
Option<common_enums::External3dsAuthenticationRequest>,
+
+ #[schema(value_type = Option<UpdateActiveAttempt>)]
+ /// Whether to set / unset the active attempt id
+ pub set_active_attempt_id: Option<api_enums::UpdateActiveAttempt>,
}
#[derive(Debug, serde::Serialize, Clone, ToSchema)]
@@ -5164,6 +5170,32 @@ pub struct PaymentsConfirmIntentRequest {
pub payment_method_id: Option<id_type::GlobalPaymentMethodId>,
}
+#[cfg(feature = "v2")]
+#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
+#[serde(deny_unknown_fields)]
+pub struct ProxyPaymentsRequest {
+ /// The URL to which you want the user to be redirected after the completion of the payment operation
+ /// If this url is not passed, the url configured in the business profile will be used
+ #[schema(value_type = Option<String>, example = "https://hyperswitch.io")]
+ pub return_url: Option<common_utils::types::Url>,
+
+ pub amount: AmountDetails,
+
+ pub recurring_details: ProcessorPaymentToken,
+
+ pub shipping: Option<Address>,
+
+ /// Additional details required by 3DS 2.0
+ #[schema(value_type = Option<BrowserInformation>)]
+ pub browser_info: Option<common_utils::types::BrowserInformation>,
+
+ #[schema(example = "stripe")]
+ pub connector: String,
+
+ #[schema(value_type = String)]
+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,
+}
+
// This struct contains the union of fields in `PaymentsCreateIntentRequest` and
// `PaymentsConfirmIntentRequest`
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, ToSchema)]
@@ -5405,7 +5437,7 @@ pub struct ConnectorTokenDetails {
/// Response for Payment Intent Confirm
/// Few fields should be expandable, we need not return these in the normal response
-/// But when explictly requested for expanded objects, these can be returned
+/// But when explicitly requested for expanded objects, these can be returned
/// For example
/// shipping, billing, customer, payment_method
#[cfg(feature = "v2")]
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 7b6e4651fb..26b56be1f0 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -429,8 +429,8 @@ pub enum ConnectorType {
AuthenticationProcessor,
/// Tax Calculation Processor
TaxProcessor,
- /// Represents billing processors that handle subscription management, invoicing,
- /// and recurring payments. Examples include Chargebee, Recurly, and Stripe Billing.
+ /// Represents billing processors that handle subscription management, invoicing,
+ /// and recurring payments. Examples include Chargebee, Recurly, and Stripe Billing.
BillingProcessor,
}
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index acba3e8dfa..1630ae2d3e 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -318,6 +318,7 @@ pub struct PaymentAttemptNew {
pub request_extended_authorization: Option<RequestExtendedAuthorizationBool>,
pub extended_authorization_applied: Option<ExtendedAuthorizationAppliedBool>,
pub capture_before: Option<PrimitiveDateTime>,
+ pub connector: Option<String>,
}
#[cfg(feature = "v1")]
@@ -3545,7 +3546,6 @@ pub struct PaymentAttemptFeatureMetadata {
pub struct PaymentAttemptRecoveryData {
pub attempt_triggered_by: common_enums::TriggeredBy,
}
-
#[cfg(feature = "v2")]
common_utils::impl_to_sql_from_sql_json!(PaymentAttemptFeatureMetadata);
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index a2b3c406a2..543b7e9e47 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -231,11 +231,14 @@ impl TaxDetails {
/// Get the tax amount
/// If default tax is present, return the default tax amount
/// If default tax is not present, return the tax amount based on the payment method if it matches the provided payment method type
- pub fn get_tax_amount(&self, payment_method: PaymentMethodType) -> Option<MinorUnit> {
+ pub fn get_tax_amount(&self, payment_method: Option<PaymentMethodType>) -> Option<MinorUnit> {
self.payment_method_type
.as_ref()
- .filter(|payment_method_type_tax| payment_method_type_tax.pmt == payment_method)
- .map(|payment_method_type_tax| payment_method_type_tax.order_tax_amount)
+ .zip(payment_method)
+ .filter(|(payment_method_type_tax, payment_method)| {
+ payment_method_type_tax.pmt == *payment_method
+ })
+ .map(|(payment_method_type_tax, _)| payment_method_type_tax.order_tax_amount)
.or_else(|| self.get_default_tax_amount())
}
@@ -553,7 +556,7 @@ pub struct PaymentIntentUpdateInternal {
pub status: Option<storage_enums::IntentStatus>,
pub amount_captured: Option<MinorUnit>,
pub modified_at: PrimitiveDateTime,
- pub active_attempt_id: Option<common_utils::id_type::GlobalAttemptId>,
+ pub active_attempt_id: Option<Option<common_utils::id_type::GlobalAttemptId>>,
pub amount: Option<MinorUnit>,
pub currency: Option<storage_enums::Currency>,
pub shipping_cost: Option<MinorUnit>,
diff --git a/crates/diesel_models/src/types.rs b/crates/diesel_models/src/types.rs
index 6bc8aee289..b79974c33f 100644
--- a/crates/diesel_models/src/types.rs
+++ b/crates/diesel_models/src/types.rs
@@ -1,5 +1,5 @@
#[cfg(feature = "v2")]
-use common_enums::{enums::PaymentConnectorTransmission, PaymentMethod, PaymentMethodType};
+use common_enums::enums::PaymentConnectorTransmission;
use common_utils::{hashing::HashedString, pii, types::MinorUnit};
use diesel::{
sql_types::{Json, Jsonb},
@@ -56,6 +56,25 @@ pub struct FeatureMetadata {
pub payment_revenue_recovery_metadata: Option<PaymentRevenueRecoveryMetadata>,
}
+#[cfg(feature = "v2")]
+impl FeatureMetadata {
+ pub fn get_payment_method_sub_type(&self) -> Option<common_enums::PaymentMethodType> {
+ self.payment_revenue_recovery_metadata
+ .as_ref()
+ .map(|rrm| rrm.payment_method_subtype)
+ }
+
+ pub fn get_payment_method_type(&self) -> Option<common_enums::PaymentMethod> {
+ self.payment_revenue_recovery_metadata
+ .as_ref()
+ .map(|rrm| rrm.payment_method_type)
+ }
+
+ // TODO: Check search_tags for relevant payment method type
+ // TODO: Check redirect_response metadata if applicable
+ // TODO: Check apple_pay_recurring_details metadata if applicable
+}
+
#[cfg(feature = "v1")]
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
#[diesel(sql_type = Json)]
@@ -137,9 +156,9 @@ pub struct PaymentRevenueRecoveryMetadata {
/// Billing Connector Payment Details
pub billing_connector_payment_details: BillingConnectorPaymentDetails,
///Payment Method Type
- pub payment_method_type: PaymentMethod,
+ pub payment_method_type: common_enums::enums::PaymentMethod,
/// PaymentMethod Subtype
- pub payment_method_subtype: PaymentMethodType,
+ pub payment_method_subtype: common_enums::enums::PaymentMethodType,
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index d7816915ba..d0a4551d01 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -37,8 +37,9 @@ use diesel_models::{
use self::payment_attempt::PaymentAttempt;
#[cfg(feature = "v2")]
use crate::{
- address::Address, business_profile, errors, merchant_account, payment_address,
- payment_method_data, ApiModelToDieselModelConvertor,
+ address::Address, business_profile, customer, errors, merchant_account,
+ merchant_connector_account, payment_address, payment_method_data,
+ ApiModelToDieselModelConvertor,
};
#[cfg(feature = "v1")]
use crate::{payment_method_data, RemoteStorageObject};
@@ -225,7 +226,7 @@ impl AmountDetails {
let order_tax_amount = match self.skip_external_tax_calculation {
common_enums::TaxCalculationOverride::Skip => {
self.tax_details.as_ref().and_then(|tax_details| {
- tax_details.get_tax_amount(confirm_intent_request.payment_method_subtype)
+ tax_details.get_tax_amount(Some(confirm_intent_request.payment_method_subtype))
})
}
common_enums::TaxCalculationOverride::Calculate => None,
@@ -243,6 +244,42 @@ impl AmountDetails {
})
}
+ pub fn proxy_create_attempt_amount_details(
+ &self,
+ _confirm_intent_request: &api_models::payments::ProxyPaymentsRequest,
+ ) -> payment_attempt::AttemptAmountDetails {
+ let net_amount = self.calculate_net_amount();
+
+ let surcharge_amount = match self.skip_surcharge_calculation {
+ common_enums::SurchargeCalculationOverride::Skip => self.surcharge_amount,
+ common_enums::SurchargeCalculationOverride::Calculate => None,
+ };
+
+ let tax_on_surcharge = match self.skip_surcharge_calculation {
+ common_enums::SurchargeCalculationOverride::Skip => self.tax_on_surcharge,
+ common_enums::SurchargeCalculationOverride::Calculate => None,
+ };
+
+ let order_tax_amount = match self.skip_external_tax_calculation {
+ common_enums::TaxCalculationOverride::Skip => self
+ .tax_details
+ .as_ref()
+ .and_then(|tax_details| tax_details.get_tax_amount(None)),
+ common_enums::TaxCalculationOverride::Calculate => None,
+ };
+
+ payment_attempt::AttemptAmountDetails::from(payment_attempt::AttemptAmountDetailsSetter {
+ net_amount,
+ amount_to_capture: None,
+ surcharge_amount,
+ tax_on_surcharge,
+ // This will be updated when we receive response from the connector
+ amount_capturable: MinorUnit::zero(),
+ shipping_cost: self.shipping_cost,
+ order_tax_amount,
+ })
+ }
+
pub fn update_from_request(self, req: &api_models::payments::AmountDetailsUpdate) -> Self {
Self {
order_amount: req
@@ -375,6 +412,47 @@ pub struct PaymentIntent {
#[cfg(feature = "v2")]
impl PaymentIntent {
+ fn get_payment_method_sub_type(&self) -> Option<common_enums::PaymentMethodType> {
+ self.feature_metadata
+ .as_ref()
+ .and_then(|metadata| metadata.get_payment_method_sub_type())
+ }
+
+ fn get_payment_method_type(&self) -> Option<common_enums::PaymentMethod> {
+ self.feature_metadata
+ .as_ref()
+ .and_then(|metadata| metadata.get_payment_method_type())
+ }
+
+ pub fn set_payment_connector_transmission(
+ &self,
+ feature_metadata: Option<FeatureMetadata>,
+ status: bool,
+ ) -> Option<Box<FeatureMetadata>> {
+ feature_metadata.map(|fm| {
+ let mut updated_metadata = fm;
+ if let Some(ref mut rrm) = updated_metadata.payment_revenue_recovery_metadata {
+ rrm.payment_connector_transmission = if status {
+ common_enums::PaymentConnectorTransmission::ConnectorCallFailed
+ } else {
+ common_enums::PaymentConnectorTransmission::ConnectorCallSucceeded
+ };
+ }
+ Box::new(updated_metadata)
+ })
+ }
+
+ pub fn get_connector_customer_id_from_feature_metadata(&self) -> Option<String> {
+ self.feature_metadata
+ .as_ref()
+ .and_then(|fm| fm.payment_revenue_recovery_metadata.as_ref())
+ .map(|rrm| {
+ rrm.billing_connector_payment_details
+ .connector_customer_id
+ .clone()
+ })
+ }
+
fn get_request_incremental_authorization_value(
request: &api_models::payments::PaymentsCreateIntentRequest,
) -> CustomResult<
@@ -585,7 +663,7 @@ where
// TODO: Check if this can be merged with existing payment data
#[cfg(feature = "v2")]
-#[derive(Clone)]
+#[derive(Clone, Debug)]
pub struct PaymentConfirmData<F>
where
F: Clone,
@@ -595,6 +673,25 @@ where
pub payment_attempt: PaymentAttempt,
pub payment_method_data: Option<payment_method_data::PaymentMethodData>,
pub payment_address: payment_address::PaymentAddress,
+ pub mandate_data: Option<api_models::payments::MandateIds>,
+}
+
+#[cfg(feature = "v2")]
+impl<F: Clone> PaymentConfirmData<F> {
+ pub fn get_connector_customer_id(
+ &self,
+ customer: Option<&customer::Customer>,
+ merchant_connector_account: &merchant_connector_account::MerchantConnectorAccount,
+ ) -> Option<String> {
+ match customer
+ .and_then(|cust| cust.get_connector_customer_id(&merchant_connector_account.get_id()))
+ {
+ Some(id) => Some(id.to_string()),
+ None => self
+ .payment_intent
+ .get_connector_customer_id_from_feature_metadata(),
+ }
+ }
}
#[cfg(feature = "v2")]
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index bce9868270..765798229a 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -513,6 +513,14 @@ impl PaymentAttempt {
.transpose()
.change_context(errors::api_error_response::ApiErrorResponse::InternalServerError)
.attach_printable("Unable to decode billing address")?;
+
+ let connector_token = Some(diesel_models::ConnectorTokenDetails {
+ connector_mandate_id: None,
+ connector_token_request_reference_id: Some(common_utils::generate_id_with_len(
+ consts::CONNECTOR_MANDATE_REQUEST_REFERENCE_ID_LENGTH,
+ )),
+ });
+
let authentication_type = payment_intent.authentication_type.unwrap_or_default();
Ok(Self {
@@ -559,12 +567,94 @@ impl PaymentAttempt {
external_reference_id: None,
payment_method_billing_address,
error: None,
- connector_token_details: Some(diesel_models::ConnectorTokenDetails {
- connector_mandate_id: None,
- connector_token_request_reference_id: Some(common_utils::generate_id_with_len(
- consts::CONNECTOR_MANDATE_REQUEST_REFERENCE_ID_LENGTH,
- )),
- }),
+ connector_token_details: connector_token,
+ id,
+ card_discovery: None,
+ feature_metadata: None,
+ })
+ }
+
+ #[cfg(feature = "v2")]
+ pub async fn proxy_create_domain_model(
+ payment_intent: &super::PaymentIntent,
+ cell_id: id_type::CellId,
+ storage_scheme: storage_enums::MerchantStorageScheme,
+ request: &api_models::payments::ProxyPaymentsRequest,
+ encrypted_data: DecryptedPaymentAttempt,
+ ) -> CustomResult<Self, errors::api_error_response::ApiErrorResponse> {
+ let id = id_type::GlobalAttemptId::generate(&cell_id);
+ let intent_amount_details = payment_intent.amount_details.clone();
+
+ let attempt_amount_details =
+ intent_amount_details.proxy_create_attempt_amount_details(request);
+
+ let now = common_utils::date_time::now();
+ let payment_method_billing_address = encrypted_data
+ .payment_method_billing_address
+ .as_ref()
+ .map(|data| {
+ data.clone()
+ .deserialize_inner_value(|value| value.parse_value("Address"))
+ })
+ .transpose()
+ .change_context(errors::api_error_response::ApiErrorResponse::InternalServerError)
+ .attach_printable("Unable to decode billing address")?;
+ let connector_token = Some(diesel_models::ConnectorTokenDetails {
+ connector_mandate_id: None,
+ connector_token_request_reference_id: Some(common_utils::generate_id_with_len(
+ consts::CONNECTOR_MANDATE_REQUEST_REFERENCE_ID_LENGTH,
+ )),
+ });
+ let payment_method_type_data = payment_intent.get_payment_method_type();
+
+ let payment_method_subtype_data = payment_intent.get_payment_method_sub_type();
+
+ let authentication_type = payment_intent.authentication_type.unwrap_or_default();
+ Ok(Self {
+ payment_id: payment_intent.id.clone(),
+ merchant_id: payment_intent.merchant_id.clone(),
+ amount_details: attempt_amount_details,
+ status: common_enums::AttemptStatus::Started,
+ connector: Some(request.connector.clone()),
+ authentication_type,
+ created_at: now,
+ modified_at: now,
+ last_synced: None,
+ cancellation_reason: None,
+ browser_info: request.browser_info.clone(),
+ payment_token: None,
+ connector_metadata: None,
+ payment_experience: None,
+ payment_method_data: None,
+ routing_result: None,
+ preprocessing_step_id: None,
+ multiple_capture_count: None,
+ connector_response_reference_id: None,
+ updated_by: storage_scheme.to_string(),
+ redirection_data: None,
+ encoded_data: None,
+ merchant_connector_id: Some(request.merchant_connector_id.clone()),
+ external_three_ds_authentication_attempted: None,
+ authentication_connector: None,
+ authentication_id: None,
+ fingerprint_id: None,
+ charges: None,
+ client_source: None,
+ client_version: None,
+ customer_acceptance: None,
+ profile_id: payment_intent.profile_id.clone(),
+ organization_id: payment_intent.organization_id.clone(),
+ payment_method_type: payment_method_type_data
+ .unwrap_or(common_enums::PaymentMethod::Card),
+ payment_method_id: None,
+ connector_payment_id: None,
+ payment_method_subtype: payment_method_subtype_data
+ .unwrap_or(common_enums::PaymentMethodType::Credit),
+ authentication_applied: None,
+ external_reference_id: None,
+ payment_method_billing_address,
+ error: None,
+ connector_token_details: connector_token,
feature_metadata: None,
id,
card_discovery: None,
@@ -2191,6 +2281,7 @@ impl behaviour::Conversion for PaymentAttempt {
request_extended_authorization: None,
capture_before: None,
feature_metadata: feature_metadata.as_ref().map(From::from),
+ connector,
})
}
}
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index fb08d7a719..628be8c1d8 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -194,7 +194,7 @@ pub struct PaymentIntentUpdateFields {
pub frm_metadata: Option<pii::SecretSerdeValue>,
pub request_external_three_ds_authentication:
Option<common_enums::External3dsAuthenticationRequest>,
-
+ pub active_attempt_id: Option<Option<id_type::GlobalAttemptId>>,
// updated_by is set internally, field not present in request
pub updated_by: String,
}
@@ -326,6 +326,7 @@ pub enum PaymentIntentUpdate {
status: common_enums::IntentStatus,
amount_captured: Option<MinorUnit>,
updated_by: String,
+ feature_metadata: Option<Box<diesel_models::types::FeatureMetadata>>,
},
/// SyncUpdate of ConfirmIntent in PostUpdateTrackers
SyncUpdate {
@@ -397,7 +398,7 @@ impl From<PaymentIntentUpdate> for diesel_models::PaymentIntentUpdateInternal {
updated_by,
} => Self {
status: Some(status),
- active_attempt_id,
+ active_attempt_id: Some(active_attempt_id),
modified_at: common_utils::date_time::now(),
amount: None,
amount_captured: None,
@@ -436,6 +437,7 @@ impl From<PaymentIntentUpdate> for diesel_models::PaymentIntentUpdateInternal {
status,
updated_by,
amount_captured,
+ feature_metadata,
} => Self {
status: Some(status),
active_attempt_id: None,
@@ -464,7 +466,7 @@ impl From<PaymentIntentUpdate> for diesel_models::PaymentIntentUpdateInternal {
allowed_payment_method_types: None,
metadata: None,
connector_metadata: None,
- feature_metadata: None,
+ feature_metadata: feature_metadata.map(|val| *val),
payment_link_config: None,
request_incremental_authorization: None,
session_expiry: None,
@@ -583,11 +585,12 @@ impl From<PaymentIntentUpdate> for diesel_models::PaymentIntentUpdateInternal {
session_expiry,
frm_metadata,
request_external_three_ds_authentication,
+ active_attempt_id,
updated_by,
} = *boxed_intent;
Self {
status: None,
- active_attempt_id: None,
+ active_attempt_id,
modified_at: common_utils::date_time::now(),
amount_captured: None,
amount,
diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rs
index 5c41541dee..ae17e69710 100644
--- a/crates/hyperswitch_domain_models/src/router_data.rs
+++ b/crates/hyperswitch_domain_models/src/router_data.rs
@@ -474,6 +474,14 @@ impl
storage_scheme: common_enums::MerchantStorageScheme,
) -> PaymentIntentUpdate {
let amount_captured = self.get_captured_amount(payment_data);
+ let status = payment_data.payment_attempt.status.is_terminal_status();
+ let updated_feature_metadata = payment_data
+ .payment_intent
+ .set_payment_connector_transmission(
+ payment_data.payment_intent.feature_metadata.clone(),
+ status,
+ );
+
match self.response {
Ok(ref _response) => PaymentIntentUpdate::ConfirmIntentPostUpdate {
status: common_enums::IntentStatus::from(
@@ -481,6 +489,7 @@ impl
),
amount_captured,
updated_by: storage_scheme.to_string(),
+ feature_metadata: updated_feature_metadata,
},
Err(ref error) => PaymentIntentUpdate::ConfirmIntentPostUpdate {
status: error
@@ -489,6 +498,7 @@ impl
.unwrap_or(common_enums::IntentStatus::Failed),
amount_captured,
updated_by: storage_scheme.to_string(),
+ feature_metadata: updated_feature_metadata,
},
}
}
@@ -1133,6 +1143,7 @@ impl
),
amount_captured,
updated_by: storage_scheme.to_string(),
+ feature_metadata: None,
},
Err(ref error) => PaymentIntentUpdate::ConfirmIntentPostUpdate {
status: error
@@ -1141,6 +1152,7 @@ impl
.unwrap_or(common_enums::IntentStatus::Failed),
amount_captured,
updated_by: storage_scheme.to_string(),
+ feature_metadata: None,
},
}
}
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index 071a77aa7b..d4dcd337f8 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -72,7 +72,6 @@ pub struct PaymentsAuthorizeData {
pub shipping_cost: Option<MinorUnit>,
pub additional_payment_method_data: Option<AdditionalPaymentData>,
}
-
#[derive(Debug, Clone)]
pub struct PaymentsPostSessionTokensData {
// amount here would include amount, surcharge_amount and shipping_cost
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index 0c84f67cb4..9ad15cfe0d 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -580,6 +580,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::enums::EventType,
api_models::enums::DecoupledAuthenticationType,
api_models::enums::AuthenticationStatus,
+ api_models::enums::UpdateActiveAttempt,
api_models::admin::MerchantAccountResponse,
api_models::admin::MerchantConnectorId,
api_models::admin::MerchantDetails,
diff --git a/crates/router/src/core/passive_churn_recovery/types.rs b/crates/router/src/core/passive_churn_recovery/types.rs
index c47248a882..2bcb7a728b 100644
--- a/crates/router/src/core/passive_churn_recovery/types.rs
+++ b/crates/router/src/core/passive_churn_recovery/types.rs
@@ -254,6 +254,7 @@ where
payment_attempt: todo!(),
payment_method_data: None,
payment_address,
+ mandate_data: None,
};
Ok(response)
}
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index f29bcb98ee..9573830708 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -1092,6 +1092,95 @@ where
))
}
+#[cfg(feature = "v2")]
+#[allow(clippy::too_many_arguments, clippy::type_complexity)]
+#[instrument(skip_all, fields(payment_id, merchant_id))]
+pub async fn proxy_for_payments_operation_core<F, Req, Op, FData, D>(
+ state: &SessionState,
+ req_state: ReqState,
+ merchant_account: domain::MerchantAccount,
+ key_store: domain::MerchantKeyStore,
+ profile: domain::Profile,
+ operation: Op,
+ req: Req,
+ get_tracker_response: operations::GetTrackerResponse<D>,
+ call_connector_action: CallConnectorAction,
+ header_payload: HeaderPayload,
+) -> RouterResult<(D, Req, Option<u16>, Option<u128>)>
+where
+ F: Send + Clone + Sync,
+ Req: Send + Sync,
+ Op: Operation<F, Req, Data = D> + Send + Sync,
+ D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
+
+ // To create connector flow specific interface data
+ D: ConstructFlowSpecificData<F, FData, router_types::PaymentsResponseData>,
+ RouterData<F, FData, router_types::PaymentsResponseData>: Feature<F, FData>,
+
+ // To construct connector flow specific api
+ dyn api::Connector:
+ services::api::ConnectorIntegration<F, FData, router_types::PaymentsResponseData>,
+
+ RouterData<F, FData, router_types::PaymentsResponseData>:
+ hyperswitch_domain_models::router_data::TrackerPostUpdateObjects<F, FData, D>,
+
+ // To perform router related operation for PaymentResponse
+ PaymentResponse: Operation<F, FData, Data = D>,
+ FData: Send + Sync + Clone,
+{
+ let operation: BoxedOperation<'_, F, Req, D> = Box::new(operation);
+
+ // Get the trackers related to track the state of the payment
+ let operations::GetTrackerResponse { mut payment_data } = get_tracker_response;
+ // consume the req merchant_connector_id and set it in the payment_data
+ let connector = operation
+ .to_domain()?
+ .perform_routing(
+ &merchant_account,
+ &profile,
+ state,
+ &mut payment_data,
+ &key_store,
+ )
+ .await?;
+
+ let payment_data = match connector {
+ ConnectorCallType::PreDetermined(connector_data) => {
+ let router_data = proxy_for_call_connector_service(
+ state,
+ req_state.clone(),
+ &merchant_account,
+ &key_store,
+ connector_data.clone(),
+ &operation,
+ &mut payment_data,
+ call_connector_action.clone(),
+ header_payload.clone(),
+ &profile,
+ )
+ .await?;
+
+ let payments_response_operation = Box::new(PaymentResponse);
+
+ payments_response_operation
+ .to_post_update_tracker()?
+ .update_tracker(
+ state,
+ payment_data,
+ router_data,
+ &key_store,
+ merchant_account.storage_scheme,
+ )
+ .await?
+ }
+ ConnectorCallType::Retryable(vec) => todo!(),
+ ConnectorCallType::SessionMultiple(vec) => todo!(),
+ ConnectorCallType::Skip => payment_data,
+ };
+
+ Ok((payment_data, req, None, None))
+}
+
#[cfg(feature = "v2")]
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
#[instrument(skip_all, fields(payment_id, merchant_id))]
@@ -1556,6 +1645,86 @@ where
)
}
+#[cfg(feature = "v2")]
+#[allow(clippy::too_many_arguments)]
+pub async fn proxy_for_payments_core<F, Res, Req, Op, FData, D>(
+ state: SessionState,
+ req_state: ReqState,
+ merchant_account: domain::MerchantAccount,
+ profile: domain::Profile,
+ key_store: domain::MerchantKeyStore,
+ operation: Op,
+ req: Req,
+ payment_id: id_type::GlobalPaymentId,
+ call_connector_action: CallConnectorAction,
+ header_payload: HeaderPayload,
+) -> RouterResponse<Res>
+where
+ F: Send + Clone + Sync,
+ Req: Send + Sync,
+ FData: Send + Sync + Clone,
+ Op: Operation<F, Req, Data = D> + ValidateStatusForOperation + Send + Sync + Clone,
+ Req: Debug,
+ D: OperationSessionGetters<F>
+ + OperationSessionSetters<F>
+ + transformers::GenerateResponse<Res>
+ + Send
+ + Sync
+ + Clone,
+ D: ConstructFlowSpecificData<F, FData, router_types::PaymentsResponseData>,
+ RouterData<F, FData, router_types::PaymentsResponseData>: Feature<F, FData>,
+
+ dyn api::Connector:
+ services::api::ConnectorIntegration<F, FData, router_types::PaymentsResponseData>,
+
+ PaymentResponse: Operation<F, FData, Data = D>,
+
+ RouterData<F, FData, router_types::PaymentsResponseData>:
+ hyperswitch_domain_models::router_data::TrackerPostUpdateObjects<F, FData, D>,
+{
+ operation
+ .to_validate_request()?
+ .validate_request(&req, &merchant_account)?;
+
+ let get_tracker_response = operation
+ .to_get_tracker()?
+ .get_trackers(
+ &state,
+ &payment_id,
+ &req,
+ &merchant_account,
+ &profile,
+ &key_store,
+ &header_payload,
+ None,
+ )
+ .await?;
+
+ let (payment_data, _req, connector_http_status_code, external_latency) =
+ proxy_for_payments_operation_core::<_, _, _, _, _>(
+ &state,
+ req_state,
+ merchant_account.clone(),
+ key_store,
+ profile.clone(),
+ operation.clone(),
+ req,
+ get_tracker_response,
+ call_connector_action,
+ header_payload.clone(),
+ )
+ .await?;
+
+ payment_data.generate_response(
+ &state,
+ connector_http_status_code,
+ external_latency,
+ header_payload.x_hs_latency,
+ &merchant_account,
+ &profile,
+ )
+}
+
#[cfg(feature = "v2")]
#[allow(clippy::too_many_arguments)]
pub async fn payments_intent_core<F, Res, Req, Op, D>(
@@ -3297,6 +3466,135 @@ where
Ok((router_data, merchant_connector_account))
}
+#[cfg(feature = "v2")]
+#[allow(clippy::too_many_arguments)]
+#[instrument(skip_all)]
+pub async fn proxy_for_call_connector_service<F, RouterDReq, ApiRequest, D>(
+ state: &SessionState,
+ req_state: ReqState,
+ merchant_account: &domain::MerchantAccount,
+ key_store: &domain::MerchantKeyStore,
+ connector: api::ConnectorData,
+ operation: &BoxedOperation<'_, F, ApiRequest, D>,
+ payment_data: &mut D,
+ call_connector_action: CallConnectorAction,
+ header_payload: HeaderPayload,
+ business_profile: &domain::Profile,
+) -> RouterResult<RouterData<F, RouterDReq, router_types::PaymentsResponseData>>
+where
+ F: Send + Clone + Sync,
+ RouterDReq: Send + Sync,
+
+ // To create connector flow specific interface data
+ D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
+ D: ConstructFlowSpecificData<F, RouterDReq, router_types::PaymentsResponseData>,
+ RouterData<F, RouterDReq, router_types::PaymentsResponseData>: Feature<F, RouterDReq> + Send,
+ // To construct connector flow specific api
+ dyn api::Connector:
+ services::api::ConnectorIntegration<F, RouterDReq, router_types::PaymentsResponseData>,
+{
+ let stime_connector = Instant::now();
+
+ let merchant_connector_id = connector
+ .merchant_connector_id
+ .as_ref()
+ .get_required_value("merchant_connector_id")
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("connector id is not set")?;
+
+ let merchant_connector_account = state
+ .store
+ .find_merchant_connector_account_by_id(&state.into(), merchant_connector_id, key_store)
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
+ id: merchant_connector_id.get_string_repr().to_owned(),
+ })?;
+
+ let mut router_data = payment_data
+ .construct_router_data(
+ state,
+ connector.connector.id(),
+ merchant_account,
+ key_store,
+ &None,
+ &merchant_connector_account,
+ None,
+ None,
+ )
+ .await?;
+
+ let add_access_token_result = router_data
+ .add_access_token(
+ state,
+ &connector,
+ merchant_account,
+ payment_data.get_creds_identifier(),
+ )
+ .await?;
+
+ router_data = router_data.add_session_token(state, &connector).await?;
+
+ let mut should_continue_further = access_token::update_router_data_with_access_token_result(
+ &add_access_token_result,
+ &mut router_data,
+ &call_connector_action,
+ );
+
+ (router_data, should_continue_further) = complete_preprocessing_steps_if_required(
+ state,
+ &connector,
+ payment_data,
+ router_data,
+ operation,
+ should_continue_further,
+ )
+ .await?;
+
+ let (connector_request, should_continue_further) = if should_continue_further {
+ router_data
+ .build_flow_specific_connector_request(state, &connector, call_connector_action.clone())
+ .await?
+ } else {
+ (None, false)
+ };
+
+ (_, *payment_data) = operation
+ .to_update_tracker()?
+ .update_trackers(
+ state,
+ req_state,
+ payment_data.clone(),
+ None,
+ merchant_account.storage_scheme,
+ None,
+ key_store,
+ None,
+ header_payload.clone(),
+ )
+ .await?;
+
+ let router_data = if should_continue_further {
+ router_data
+ .decide_flows(
+ state,
+ &connector,
+ call_connector_action,
+ connector_request,
+ business_profile,
+ header_payload.clone(),
+ )
+ .await
+ } else {
+ Ok(router_data)
+ }?;
+
+ let etime_connector = Instant::now();
+ let duration_connector = etime_connector.saturating_duration_since(stime_connector);
+ tracing::info!(duration = format!("Duration taken: {}", duration_connector.as_millis()));
+
+ Ok(router_data)
+}
+
pub async fn add_decrypted_payment_method_token<F, D>(
tokenization_action: TokenizationAction,
payment_data: &D,
@@ -7612,6 +7910,7 @@ pub trait OperationSessionGetters<F> {
fn get_mandate_connector(&self) -> Option<&MandateConnectorDetails>;
fn get_force_sync(&self) -> Option<bool>;
fn get_capture_method(&self) -> Option<enums::CaptureMethod>;
+ fn get_merchant_connector_id_in_attempt(&self) -> Option<id_type::MerchantConnectorAccountId>;
#[cfg(feature = "v1")]
fn get_vault_operation(&self) -> Option<&domain_payments::VaultOperation>;
@@ -7687,7 +7986,9 @@ impl<F: Clone> OperationSessionGetters<F> for PaymentData<F> {
fn get_address(&self) -> &PaymentAddress {
&self.address
}
-
+ fn get_merchant_connector_id_in_attempt(&self) -> Option<id_type::MerchantConnectorAccountId> {
+ self.payment_attempt.merchant_connector_id.clone()
+ }
fn get_creds_identifier(&self) -> Option<&str> {
self.creds_identifier.as_deref()
}
@@ -8017,6 +8318,10 @@ impl<F: Clone> OperationSessionGetters<F> for PaymentIntentData<F> {
todo!()
}
+ fn get_merchant_connector_id_in_attempt(&self) -> Option<id_type::MerchantConnectorAccountId> {
+ todo!()
+ }
+
fn get_billing_address(&self) -> Option<hyperswitch_domain_models::address::Address> {
todo!()
}
@@ -8226,7 +8531,11 @@ impl<F: Clone> OperationSessionGetters<F> for PaymentConfirmData<F> {
}
fn get_payment_attempt_connector(&self) -> Option<&str> {
- todo!()
+ self.payment_attempt.connector.as_deref()
+ }
+
+ fn get_merchant_connector_id_in_attempt(&self) -> Option<id_type::MerchantConnectorAccountId> {
+ self.payment_attempt.merchant_connector_id.clone()
}
fn get_billing_address(&self) -> Option<hyperswitch_domain_models::address::Address> {
@@ -8443,6 +8752,10 @@ impl<F: Clone> OperationSessionGetters<F> for PaymentStatusData<F> {
todo!()
}
+ fn get_merchant_connector_id_in_attempt(&self) -> Option<id_type::MerchantConnectorAccountId> {
+ todo!()
+ }
+
fn get_billing_address(&self) -> Option<hyperswitch_domain_models::address::Address> {
todo!()
}
@@ -8657,6 +8970,10 @@ impl<F: Clone> OperationSessionGetters<F> for PaymentCaptureData<F> {
todo!()
}
+ fn get_merchant_connector_id_in_attempt(&self) -> Option<id_type::MerchantConnectorAccountId> {
+ todo!()
+ }
+
fn get_billing_address(&self) -> Option<hyperswitch_domain_models::address::Address> {
todo!()
}
diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs
index fde773de8a..47b020554c 100644
--- a/crates/router/src/core/payments/operations.rs
+++ b/crates/router/src/core/payments/operations.rs
@@ -32,6 +32,9 @@ pub mod tax_calculation;
#[cfg(feature = "v2")]
pub mod payment_confirm_intent;
+#[cfg(feature = "v2")]
+pub mod proxy_payments_intent;
+
#[cfg(feature = "v2")]
pub mod payment_create_intent;
#[cfg(feature = "v2")]
diff --git a/crates/router/src/core/payments/operations/payment_confirm_intent.rs b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
index a5b0e6eb65..11e5093cf0 100644
--- a/crates/router/src/core/payments/operations/payment_confirm_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
@@ -249,6 +249,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentConfirmData<F>, PaymentsConfir
payment_attempt,
payment_method_data,
payment_address,
+ mandate_data: None,
};
let get_trackers_response = operations::GetTrackerResponse { payment_data };
diff --git a/crates/router/src/core/payments/operations/payment_update_intent.rs b/crates/router/src/core/payments/operations/payment_update_intent.rs
index 7662c07eee..aff169ed91 100644
--- a/crates/router/src/core/payments/operations/payment_update_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_update_intent.rs
@@ -1,6 +1,9 @@
use std::marker::PhantomData;
-use api_models::{enums::FrmSuggestion, payments::PaymentsUpdateIntentRequest};
+use api_models::{
+ enums::{FrmSuggestion, UpdateActiveAttempt},
+ payments::PaymentsUpdateIntentRequest,
+};
use async_trait::async_trait;
use common_utils::{
errors::CustomResult,
@@ -45,9 +48,10 @@ impl ValidateStatusForOperation for PaymentUpdateIntent {
intent_status: common_enums::IntentStatus,
) -> Result<(), errors::ApiErrorResponse> {
match intent_status {
- common_enums::IntentStatus::RequiresPaymentMethod => Ok(()),
+ // if the status is `Failed`` we would want to Update few intent fields to perform a Revenue Recovery retry
+ common_enums::IntentStatus::RequiresPaymentMethod
+ | common_enums::IntentStatus::Failed => Ok(()),
common_enums::IntentStatus::Succeeded
- | common_enums::IntentStatus::Failed
| common_enums::IntentStatus::Cancelled
| common_enums::IntentStatus::Processing
| common_enums::IntentStatus::RequiresCustomerAction
@@ -174,6 +178,7 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsUpda
session_expiry,
frm_metadata,
request_external_three_ds_authentication,
+ set_active_attempt_id,
} = request.clone();
let batch_encrypted_data = domain_types::crypto_operation(
@@ -223,6 +228,13 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsUpda
None => payment_intent.amount_details,
};
+ let active_attempt_id = set_active_attempt_id
+ .and_then(|active_attempt_req| match active_attempt_req {
+ UpdateActiveAttempt::Set(global_attempt_id) => Some(global_attempt_id),
+ UpdateActiveAttempt::Unset => None,
+ })
+ .or(payment_intent.active_attempt_id);
+
let payment_intent = hyperswitch_domain_models::payments::PaymentIntent {
amount_details: updated_amount_details,
description: description.or(payment_intent.description),
@@ -272,6 +284,7 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsUpda
routing_algorithm_id: routing_algorithm_id.or(payment_intent.routing_algorithm_id),
allowed_payment_method_types: allowed_payment_method_types
.or(payment_intent.allowed_payment_method_types),
+ active_attempt_id,
..payment_intent
};
@@ -351,6 +364,7 @@ impl<F: Clone> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsUpdateIn
),
updated_by: intent.updated_by,
tax_details: intent.amount_details.tax_details,
+ active_attempt_id: Some(intent.active_attempt_id),
}));
let new_payment_intent = db
diff --git a/crates/router/src/core/payments/operations/proxy_payments_intent.rs b/crates/router/src/core/payments/operations/proxy_payments_intent.rs
new file mode 100644
index 0000000000..c029f1439e
--- /dev/null
+++ b/crates/router/src/core/payments/operations/proxy_payments_intent.rs
@@ -0,0 +1,476 @@
+use api_models::payments::ProxyPaymentsRequest;
+use async_trait::async_trait;
+use common_enums::enums;
+use common_utils::types::keymanager::ToEncryptable;
+use error_stack::ResultExt;
+use hyperswitch_domain_models::{
+ payment_method_data::PaymentMethodData, payments::PaymentConfirmData,
+};
+use masking::PeekInterface;
+use router_env::{instrument, tracing};
+
+use super::{Domain, GetTracker, Operation, PostUpdateTracker, UpdateTracker, ValidateRequest};
+use crate::{
+ core::{
+ errors::{self, CustomResult, RouterResult, StorageErrorExt},
+ payments::{
+ operations::{self, ValidateStatusForOperation},
+ OperationSessionGetters,
+ },
+ },
+ routes::{app::ReqState, SessionState},
+ types::{
+ self,
+ api::{self, ConnectorCallType},
+ domain::{self, types as domain_types},
+ storage::{self, enums as storage_enums},
+ },
+ utils::OptionExt,
+};
+
+#[derive(Debug, Clone, Copy)]
+pub struct PaymentProxyIntent;
+
+impl ValidateStatusForOperation for PaymentProxyIntent {
+ /// Validate if the current operation can be performed on the current status of the payment intent
+ fn validate_status_for_operation(
+ &self,
+ intent_status: common_enums::IntentStatus,
+ ) -> Result<(), errors::ApiErrorResponse> {
+ match intent_status {
+ //Failed state is included here so that in PCR, retries can be done for failed payments, otherwise for a failed attempt it was asking for new payment_intent
+ common_enums::IntentStatus::RequiresPaymentMethod
+ | common_enums::IntentStatus::Failed => Ok(()),
+ //Failed state is included here so that in PCR, retries can be done for failed payments, otherwise for a failed attempt it was asking for new payment_intent
+ common_enums::IntentStatus::RequiresPaymentMethod
+ | common_enums::IntentStatus::Failed => Ok(()),
+ common_enums::IntentStatus::Succeeded
+ | common_enums::IntentStatus::Cancelled
+ | common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::RequiresCustomerAction
+ | common_enums::IntentStatus::RequiresMerchantAction
+ | common_enums::IntentStatus::RequiresCapture
+ | common_enums::IntentStatus::PartiallyCaptured
+ | common_enums::IntentStatus::RequiresConfirmation
+ | common_enums::IntentStatus::PartiallyCapturedAndCapturable => {
+ Err(errors::ApiErrorResponse::PaymentUnexpectedState {
+ current_flow: format!("{self:?}"),
+ field_name: "status".to_string(),
+ current_value: intent_status.to_string(),
+ states: ["requires_payment_method".to_string()].join(", "),
+ })
+ }
+ }
+ }
+}
+type BoxedConfirmOperation<'b, F> =
+ super::BoxedOperation<'b, F, ProxyPaymentsRequest, PaymentConfirmData<F>>;
+
+impl<F: Send + Clone + Sync> Operation<F, ProxyPaymentsRequest> for &PaymentProxyIntent {
+ type Data = PaymentConfirmData<F>;
+ fn to_validate_request(
+ &self,
+ ) -> RouterResult<&(dyn ValidateRequest<F, ProxyPaymentsRequest, Self::Data> + Send + Sync)>
+ {
+ Ok(*self)
+ }
+ fn to_get_tracker(
+ &self,
+ ) -> RouterResult<&(dyn GetTracker<F, Self::Data, ProxyPaymentsRequest> + Send + Sync)> {
+ Ok(*self)
+ }
+ fn to_domain(&self) -> RouterResult<&(dyn Domain<F, ProxyPaymentsRequest, Self::Data>)> {
+ Ok(*self)
+ }
+ fn to_update_tracker(
+ &self,
+ ) -> RouterResult<&(dyn UpdateTracker<F, Self::Data, ProxyPaymentsRequest> + Send + Sync)> {
+ Ok(*self)
+ }
+}
+
+#[automatically_derived]
+impl<F: Send + Clone + Sync> Operation<F, ProxyPaymentsRequest> for PaymentProxyIntent {
+ type Data = PaymentConfirmData<F>;
+ fn to_validate_request(
+ &self,
+ ) -> RouterResult<&(dyn ValidateRequest<F, ProxyPaymentsRequest, Self::Data> + Send + Sync)>
+ {
+ Ok(self)
+ }
+ fn to_get_tracker(
+ &self,
+ ) -> RouterResult<&(dyn GetTracker<F, Self::Data, ProxyPaymentsRequest> + Send + Sync)> {
+ Ok(self)
+ }
+ fn to_domain(&self) -> RouterResult<&dyn Domain<F, ProxyPaymentsRequest, Self::Data>> {
+ Ok(self)
+ }
+ fn to_update_tracker(
+ &self,
+ ) -> RouterResult<&(dyn UpdateTracker<F, Self::Data, ProxyPaymentsRequest> + Send + Sync)> {
+ Ok(self)
+ }
+}
+
+impl<F: Send + Clone + Sync> ValidateRequest<F, ProxyPaymentsRequest, PaymentConfirmData<F>>
+ for PaymentProxyIntent
+{
+ #[instrument(skip_all)]
+ fn validate_request<'a, 'b>(
+ &'b self,
+ _request: &ProxyPaymentsRequest,
+ merchant_account: &'a domain::MerchantAccount,
+ ) -> RouterResult<operations::ValidateResult> {
+ let validate_result = operations::ValidateResult {
+ merchant_id: merchant_account.get_id().to_owned(),
+ storage_scheme: merchant_account.storage_scheme,
+ requeue: false,
+ };
+
+ Ok(validate_result)
+ }
+}
+
+#[async_trait]
+impl<F: Send + Clone + Sync> GetTracker<F, PaymentConfirmData<F>, ProxyPaymentsRequest>
+ for PaymentProxyIntent
+{
+ #[instrument(skip_all)]
+ async fn get_trackers<'a>(
+ &'a self,
+ state: &'a SessionState,
+ payment_id: &common_utils::id_type::GlobalPaymentId,
+ request: &ProxyPaymentsRequest,
+ merchant_account: &domain::MerchantAccount,
+ _profile: &domain::Profile,
+ key_store: &domain::MerchantKeyStore,
+ header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
+ _platform_merchant_account: Option<&domain::MerchantAccount>,
+ ) -> RouterResult<operations::GetTrackerResponse<PaymentConfirmData<F>>> {
+ let db = &*state.store;
+ let key_manager_state = &state.into();
+
+ let storage_scheme = merchant_account.storage_scheme;
+
+ let payment_intent = db
+ .find_payment_intent_by_id(key_manager_state, payment_id, key_store, storage_scheme)
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+
+ self.validate_status_for_operation(payment_intent.status)?;
+
+ let client_secret = header_payload
+ .client_secret
+ .as_ref()
+ .get_required_value("client_secret header")?;
+ payment_intent.validate_client_secret(client_secret)?;
+
+ let cell_id = state.conf.cell_information.id.clone();
+
+ let batch_encrypted_data = domain_types::crypto_operation(
+ key_manager_state,
+ common_utils::type_name!(hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt),
+ domain_types::CryptoOperation::BatchEncrypt(
+ hyperswitch_domain_models::payments::payment_attempt::FromRequestEncryptablePaymentAttempt::to_encryptable(
+ hyperswitch_domain_models::payments::payment_attempt::FromRequestEncryptablePaymentAttempt {
+ payment_method_billing_address: None,
+ },
+ ),
+ ),
+ common_utils::types::keymanager::Identifier::Merchant(merchant_account.get_id().to_owned()),
+ key_store.key.peek(),
+ )
+ .await
+ .and_then(|val| val.try_into_batchoperation())
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed while encrypting payment intent details".to_string())?;
+
+ let encrypted_data =
+ hyperswitch_domain_models::payments::payment_attempt::FromRequestEncryptablePaymentAttempt::from_encryptable(batch_encrypted_data)
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed while encrypting payment intent details")?;
+
+ let payment_attempt_domain_model: hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt =
+ hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt::proxy_create_domain_model(
+ &payment_intent,
+ cell_id,
+ storage_scheme,
+ request,
+ encrypted_data
+ )
+ .await?;
+
+ let payment_attempt = db
+ .insert_payment_attempt(
+ key_manager_state,
+ key_store,
+ payment_attempt_domain_model,
+ storage_scheme,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Could not insert payment attempt")?;
+ let processor_payment_token = request.recurring_details.processor_payment_token.clone();
+
+ let payment_address = hyperswitch_domain_models::payment_address::PaymentAddress::new(
+ payment_intent
+ .shipping_address
+ .clone()
+ .map(|address| address.into_inner()),
+ payment_intent
+ .billing_address
+ .clone()
+ .map(|address| address.into_inner()),
+ payment_attempt
+ .payment_method_billing_address
+ .clone()
+ .map(|address| address.into_inner()),
+ Some(true),
+ );
+ let mandate_data_input = api_models::payments::MandateIds {
+ mandate_id: None,
+ mandate_reference_id: Some(
+ api_models::payments::MandateReferenceId::ConnectorMandateId(
+ api_models::payments::ConnectorMandateReferenceId::new(
+ Some(processor_payment_token),
+ None,
+ None,
+ None,
+ None,
+ ),
+ ),
+ ),
+ };
+ let payment_data = PaymentConfirmData {
+ flow: std::marker::PhantomData,
+ payment_intent,
+ payment_attempt,
+ payment_method_data: Some(PaymentMethodData::MandatePayment),
+ payment_address,
+ mandate_data: Some(mandate_data_input),
+ };
+
+ let get_trackers_response = operations::GetTrackerResponse { payment_data };
+
+ Ok(get_trackers_response)
+ }
+}
+
+#[async_trait]
+impl<F: Clone + Send + Sync> Domain<F, ProxyPaymentsRequest, PaymentConfirmData<F>>
+ for PaymentProxyIntent
+{
+ async fn get_customer_details<'a>(
+ &'a self,
+ _state: &SessionState,
+ _payment_data: &mut PaymentConfirmData<F>,
+ _merchant_key_store: &domain::MerchantKeyStore,
+ _storage_scheme: storage_enums::MerchantStorageScheme,
+ ) -> CustomResult<(BoxedConfirmOperation<'a, F>, Option<domain::Customer>), errors::StorageError>
+ {
+ Ok((Box::new(self), None))
+ }
+
+ #[instrument(skip_all)]
+ async fn make_pm_data<'a>(
+ &'a self,
+ _state: &'a SessionState,
+ _payment_data: &mut PaymentConfirmData<F>,
+ _storage_scheme: storage_enums::MerchantStorageScheme,
+ _key_store: &domain::MerchantKeyStore,
+ _customer: &Option<domain::Customer>,
+ _business_profile: &domain::Profile,
+ _should_retry_with_pan: bool,
+ ) -> RouterResult<(
+ BoxedConfirmOperation<'a, F>,
+ Option<PaymentMethodData>,
+ Option<String>,
+ )> {
+ Ok((Box::new(self), None, None))
+ }
+
+ async fn perform_routing<'a>(
+ &'a self,
+ _merchant_account: &domain::MerchantAccount,
+ _business_profile: &domain::Profile,
+ state: &SessionState,
+ payment_data: &mut PaymentConfirmData<F>,
+ _mechant_key_store: &domain::MerchantKeyStore,
+ ) -> CustomResult<ConnectorCallType, errors::ApiErrorResponse> {
+ let connector_name = payment_data.get_payment_attempt_connector();
+ if let Some(connector_name) = connector_name {
+ let merchant_connector_id = payment_data.get_merchant_connector_id_in_attempt();
+ let connector_data = api::ConnectorData::get_connector_by_name(
+ &state.conf.connectors,
+ connector_name,
+ api::GetToken::Connector,
+ merchant_connector_id,
+ )?;
+
+ Ok(ConnectorCallType::PreDetermined(connector_data))
+ } else {
+ Err(error_stack::Report::new(
+ errors::ApiErrorResponse::InternalServerError,
+ ))
+ }
+ }
+}
+#[async_trait]
+impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, ProxyPaymentsRequest>
+ for PaymentProxyIntent
+{
+ #[instrument(skip_all)]
+ async fn update_trackers<'b>(
+ &'b self,
+ state: &'b SessionState,
+ _req_state: ReqState,
+ mut payment_data: PaymentConfirmData<F>,
+ _customer: Option<domain::Customer>,
+ storage_scheme: storage_enums::MerchantStorageScheme,
+ _updated_customer: Option<storage::CustomerUpdate>,
+ key_store: &domain::MerchantKeyStore,
+ _frm_suggestion: Option<api_models::enums::FrmSuggestion>,
+ _header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ ) -> RouterResult<(BoxedConfirmOperation<'b, F>, PaymentConfirmData<F>)>
+ where
+ F: 'b + Send,
+ {
+ let db = &*state.store;
+ let key_manager_state = &state.into();
+
+ let intent_status = common_enums::IntentStatus::Processing;
+ let attempt_status = common_enums::AttemptStatus::Pending;
+
+ let connector = payment_data
+ .payment_attempt
+ .connector
+ .clone()
+ .get_required_value("connector")
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Connector is none when constructing response")?;
+
+ let merchant_connector_id = payment_data
+ .payment_attempt
+ .merchant_connector_id
+ .clone()
+ .get_required_value("merchant_connector_id")
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Merchant connector id is none when constructing response")?;
+
+ let payment_intent_update =
+ hyperswitch_domain_models::payments::payment_intent::PaymentIntentUpdate::ConfirmIntent {
+ status: intent_status,
+ updated_by: storage_scheme.to_string(),
+ active_attempt_id: Some(payment_data.payment_attempt.id.clone()),
+ };
+
+ let authentication_type = payment_data
+ .payment_intent
+ .authentication_type
+ .unwrap_or_default();
+
+ let payment_attempt_update = hyperswitch_domain_models::payments::payment_attempt::PaymentAttemptUpdate::ConfirmIntent {
+ status: attempt_status,
+ updated_by: storage_scheme.to_string(),
+ connector,
+ merchant_connector_id,
+ authentication_type,
+ };
+
+ let updated_payment_intent = db
+ .update_payment_intent(
+ key_manager_state,
+ payment_data.payment_intent.clone(),
+ payment_intent_update,
+ key_store,
+ storage_scheme,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Unable to update payment intent")?;
+
+ payment_data.payment_intent = updated_payment_intent;
+
+ let updated_payment_attempt = db
+ .update_payment_attempt(
+ key_manager_state,
+ key_store,
+ payment_data.payment_attempt.clone(),
+ payment_attempt_update,
+ storage_scheme,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Unable to update payment attempt")?;
+
+ payment_data.payment_attempt = updated_payment_attempt;
+
+ Ok((Box::new(self), payment_data))
+ }
+}
+
+#[cfg(feature = "v2")]
+#[async_trait]
+impl<F: Clone> PostUpdateTracker<F, PaymentConfirmData<F>, types::PaymentsAuthorizeData>
+ for PaymentProxyIntent
+{
+ async fn update_tracker<'b>(
+ &'b self,
+ state: &'b SessionState,
+ mut payment_data: PaymentConfirmData<F>,
+ response: types::RouterData<F, types::PaymentsAuthorizeData, types::PaymentsResponseData>,
+ key_store: &domain::MerchantKeyStore,
+ storage_scheme: enums::MerchantStorageScheme,
+ ) -> RouterResult<PaymentConfirmData<F>>
+ where
+ F: 'b + Send + Sync,
+ types::RouterData<F, types::PaymentsAuthorizeData, types::PaymentsResponseData>:
+ hyperswitch_domain_models::router_data::TrackerPostUpdateObjects<
+ F,
+ types::PaymentsAuthorizeData,
+ PaymentConfirmData<F>,
+ >,
+ {
+ use hyperswitch_domain_models::router_data::TrackerPostUpdateObjects;
+
+ let db = &*state.store;
+ let key_manager_state = &state.into();
+
+ let response_router_data = response;
+
+ let payment_intent_update =
+ response_router_data.get_payment_intent_update(&payment_data, storage_scheme);
+ let payment_attempt_update =
+ response_router_data.get_payment_attempt_update(&payment_data, storage_scheme);
+
+ let updated_payment_intent = db
+ .update_payment_intent(
+ key_manager_state,
+ payment_data.payment_intent,
+ payment_intent_update,
+ key_store,
+ storage_scheme,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Unable to update payment intent")?;
+
+ let updated_payment_attempt = db
+ .update_payment_attempt(
+ key_manager_state,
+ key_store,
+ payment_data.payment_attempt,
+ payment_attempt_update,
+ storage_scheme,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Unable to update payment attempt")?;
+
+ payment_data.payment_intent = updated_payment_intent;
+ payment_data.payment_attempt = updated_payment_attempt;
+
+ Ok(payment_data)
+ }
+}
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 12483aac8e..34c4c76c2e 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -211,11 +211,8 @@ pub async fn construct_payment_router_data_for_authorize<'a>(
"Invalid global customer generated, not able to convert to reference id",
)?;
- let connector_customer_id = customer.as_ref().and_then(|customer| {
- customer
- .get_connector_customer_id(&merchant_connector_account.get_id())
- .map(String::from)
- });
+ let connector_customer_id =
+ payment_data.get_connector_customer_id(customer.as_ref(), merchant_connector_account);
let payment_method = payment_data.payment_attempt.payment_method_type;
@@ -257,14 +254,13 @@ pub async fn construct_payment_router_data_for_authorize<'a>(
.browser_info
.clone()
.map(types::BrowserInformation::from);
-
// TODO: few fields are repeated in both routerdata and request
let request = types::PaymentsAuthorizeData {
payment_method_data: payment_data
.payment_method_data
.get_required_value("payment_method_data")?,
setup_future_usage: Some(payment_data.payment_intent.setup_future_usage),
- mandate_id: None,
+ mandate_id: payment_data.mandate_data.clone(),
off_session: None,
setup_mandate_details: None,
confirm: true,
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 4d6ceec021..17f570dfe5 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -603,6 +603,10 @@ impl Payments {
web::resource("/confirm-intent")
.route(web::post().to(payments::payment_confirm_intent)),
)
+ .service(
+ web::resource("/proxy-confirm-intent")
+ .route(web::post().to(payments::proxy_confirm_intent)),
+ )
.service(
web::resource("/get-intent")
.route(web::get().to(payments::payments_get_intent)),
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index 5d33037f6b..e458dd1951 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -150,6 +150,7 @@ impl From<Flow> for ApiIdentifier {
| Flow::PaymentsUpdateIntent
| Flow::PaymentsCreateAndConfirmIntent
| Flow::PaymentStartRedirection
+ | Flow::ProxyConfirmIntent
| Flow::PaymentsRetrieveUsingMerchantReferenceId => Self::Payments,
Flow::PayoutsCreate
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index e4ced3ac0b..9708f34c53 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -3,7 +3,6 @@ use crate::{
services::authorization::permissions::Permission,
};
pub mod helpers;
-
use actix_web::{web, Responder};
use error_stack::report;
use hyperswitch_domain_models::payments::HeaderPayload;
@@ -2475,6 +2474,78 @@ pub async fn payment_confirm_intent(
.await
}
+#[cfg(feature = "v2")]
+#[instrument(skip_all, fields(flow = ?Flow::ProxyConfirmIntent, payment_id))]
+pub async fn proxy_confirm_intent(
+ state: web::Data<app::AppState>,
+ req: actix_web::HttpRequest,
+ json_payload: web::Json<api_models::payments::ProxyPaymentsRequest>,
+ path: web::Path<common_utils::id_type::GlobalPaymentId>,
+) -> impl Responder {
+ use hyperswitch_domain_models::payments::PaymentConfirmData;
+
+ let flow = Flow::ProxyConfirmIntent;
+
+ // Extract the payment ID from the path
+ let global_payment_id = path.into_inner();
+ tracing::Span::current().record("payment_id", global_payment_id.get_string_repr());
+
+ // Parse and validate headers
+ let header_payload = match HeaderPayload::foreign_try_from(req.headers()) {
+ Ok(headers) => headers,
+ Err(err) => {
+ return api::log_and_return_error_response(err);
+ }
+ };
+
+ // Prepare the internal payload
+ let internal_payload = internal_payload_types::PaymentsGenericRequestWithResourceId {
+ global_payment_id,
+ payload: json_payload.into_inner(),
+ };
+
+ // Determine the locking action, if required
+ let locking_action = internal_payload.get_locking_input(flow.clone());
+
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ internal_payload,
+ |state, auth: auth::AuthenticationData, req, req_state| {
+ let payment_id = req.global_payment_id;
+ let request = req.payload;
+
+ // Define the operation for proxy payments intent
+ let operation = payments::operations::proxy_payments_intent::PaymentProxyIntent;
+
+ // Call the core proxy logic
+ Box::pin(payments::proxy_for_payments_core::<
+ api_types::Authorize,
+ api_models::payments::PaymentsResponse,
+ _,
+ _,
+ _,
+ PaymentConfirmData<api_types::Authorize>,
+ >(
+ state,
+ req_state,
+ auth.merchant_account,
+ auth.profile,
+ auth.key_store,
+ operation,
+ request,
+ payment_id,
+ payments::CallConnectorAction::Trigger,
+ header_payload.clone(),
+ ))
+ },
+ &auth::HeaderAuth(auth::ApiKeyAuth),
+ locking_action,
+ ))
+ .await
+}
+
#[cfg(feature = "v2")]
#[instrument(skip(state, req), fields(flow, payment_id))]
pub async fn payment_status(
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index 61e24d8156..4e42a0642a 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -533,6 +533,7 @@ pub enum Flow {
PaymentsManualUpdate,
/// Dynamic Tax Calcultion
SessionUpdateTaxCalculation,
+ ProxyConfirmIntent,
/// Payments post session tokens flow
PaymentsPostSessionTokens,
/// Payments start redirection flow