Skip to content

Commit

Permalink
add vault operation in payment_data
Browse files Browse the repository at this point in the history
  • Loading branch information
prasunna09 authored and ImSagnik007 committed Dec 22, 2024
1 parent 977cb70 commit c99b100
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 2 deletions.
12 changes: 12 additions & 0 deletions crates/router/src/core/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4399,6 +4399,18 @@ where
pub tax_data: Option<TaxData>,
pub session_id: Option<String>,
pub service_details: Option<api_models::payments::CtpServiceDetails>,
pub vault_operation: Option<PaymentMethodDataAction>,
}

#[derive(Clone, serde::Serialize, Debug)]
pub enum PaymentMethodDataAction{
VaultData(VaultData)
}

#[derive(Clone, serde::Serialize, Debug)]
pub struct VaultData {
pub card_data: hyperswitch_domain_models::payment_method_data::Card,
pub network_token_data: hyperswitch_domain_models::payment_method_data::NetworkTokenData,
}

#[derive(Clone, serde::Serialize, Debug)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureR
tax_data: None,
session_id: None,
service_details: None,
vault_operation:None
};

let get_trackers_response = operations::GetTrackerResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelRe
tax_data: None,
session_id: None,
service_details: None,
vault_operation:None,
};

let get_trackers_response = operations::GetTrackerResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
tax_data: None,
session_id: None,
service_details: None,
vault_operation: None,
};

let get_trackers_response = operations::GetTrackerResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
tax_data: None,
session_id: None,
service_details: None,
vault_operation: None,
};

let customer_details = Some(CustomerDetails {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
tax_data: None,
session_id: None,
service_details: request.ctp_service_details.clone(),
vault_operation: None,
};

let get_trackers_response = operations::GetTrackerResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
tax_data: None,
session_id: None,
service_details: None,
vault_operation: None,
};

let get_trackers_response = operations::GetTrackerResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsPostSess
tax_data: None,
session_id: None,
service_details: None,
vault_operation: None,
};
let get_trackers_response = operations::GetTrackerResponse {
operation: Box::new(self),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsCancelRequest
tax_data: None,
session_id: None,
service_details: None,
vault_operation: None,
};

let get_trackers_response = operations::GetTrackerResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsSessionR
tax_data: None,
session_id: None,
service_details: None,
vault_operation: None,
};

let get_trackers_response = operations::GetTrackerResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartReq
tax_data: None,
session_id: None,
service_details: None,
vault_operation: None,
};

let get_trackers_response = operations::GetTrackerResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ async fn get_tracker_for_sync<
tax_data: None,
session_id: None,
service_details: None,
vault_operation:None,
};

let get_trackers_response = operations::GetTrackerResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
tax_data: None,
session_id: None,
service_details: None,
vault_operation: None,
};

let get_trackers_response = operations::GetTrackerResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ impl<F: Send + Clone + Sync>
tax_data: None,
session_id: None,
service_details: None,
vault_operation: None,
};

let get_trackers_response = operations::GetTrackerResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ impl<F: Send + Clone + Sync>
tax_data: Some(tax_data),
session_id: request.session_id.clone(),
service_details: None,
vault_operation: None,
};
let get_trackers_response = operations::GetTrackerResponse {
operation: Box::new(self),
Expand Down
4 changes: 2 additions & 2 deletions crates/router/src/core/payments/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2803,7 +2803,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsAuthoriz
} else {
None
};
let payment_method_data = payment_data.payment_method_data.or_else(|| {
let payment_method_data = payment_data.payment_method_data.or_else(|| { //
if payment_data.mandate_id.is_some() {
Some(domain::PaymentMethodData::MandatePayment)
} else {
Expand Down Expand Up @@ -2837,7 +2837,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsAuthoriz
let shipping_cost = payment_data.payment_intent.shipping_cost;

Ok(Self {
payment_method_data: (payment_method_data.get_required_value("payment_method_data")?),
payment_method_data: (payment_method_data.get_required_value("payment_method_data")?), //
setup_future_usage: payment_data.payment_intent.setup_future_usage,
mandate_id: payment_data.mandate_id.clone(),
off_session: payment_data.mandate_id.as_ref().map(|_| true),
Expand Down

0 comments on commit c99b100

Please sign in to comment.