feat(payment_method_session): implement payment methods session confirm (#7248)

Co-authored-by: Sanchith Hegde <sanchith.hegde@juspay.in>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Anurag Thakur <anurag.thakur@juspay.in>
Co-authored-by: Pa1NarK <69745008+pixincreate@users.noreply.github.com>
Co-authored-by: Shankar Singh C <83439957+ShankarSinghC@users.noreply.github.com>
Co-authored-by: Sai Harsha Vardhan <56996463+sai-harsha-vardhan@users.noreply.github.com>
Co-authored-by: hrithikesh026 <hrithikesh.vm@juspay.in>
Co-authored-by: Debarati Ghatak <88573135+cookieg13@users.noreply.github.com>
Co-authored-by: awasthi21 <107559116+awasthi21@users.noreply.github.com>
Co-authored-by: Gnanasundari24 <118818938+Gnanasundari24@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Arindam Sahoo <88739246+arindam-sahoo@users.noreply.github.com>
Co-authored-by: Arindam Sahoo <arindam.sahoo@Arindam-Sahoo-F565040VFJ.local>
Co-authored-by: Sakil Mostak <73734619+Sakilmostak@users.noreply.github.com>
Co-authored-by: AkshayaFoiger <131388445+AkshayaFoiger@users.noreply.github.com>
Co-authored-by: Riddhiagrawal001 <50551695+Riddhiagrawal001@users.noreply.github.com>
Co-authored-by: Suman Maji <77887221+sumanmaji4@users.noreply.github.com>
Co-authored-by: Sandeep Kumar <83278309+tsdk02@users.noreply.github.com>
Co-authored-by: Debarshi Gupta <debarshigupta47@gmail.com>
Co-authored-by: Debarshi Gupta <debarshi.gupta@Debarshi-Gupta-CM92YWDXFD.local>
Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com>
Co-authored-by: Swangi Kumari <85639103+swangi-kumari@users.noreply.github.com>
Co-authored-by: pranav-arjunan <pranav.arjunan@juspay.in>
Co-authored-by: Kashif <kashif.dev@protonmail.com>
Co-authored-by: Sagnik Mitra <83326850+ImSagnik007@users.noreply.github.com>
Co-authored-by: sweta-kumari-sharma <77436883+Sweta-Kumari-Sharma@users.noreply.github.com>
Co-authored-by: shivansh.mathur <shivansh.mathur@juspay.in>
This commit is contained in:
Narayan Bhat
2025-02-26 22:54:53 +05:30
committed by GitHub
parent 25197226e9
commit 0fb0191784
45 changed files with 2142 additions and 938 deletions

View File

@ -1,11 +1,50 @@
#[cfg(feature = "v2")]
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct PaymentMethodsSession {
pub struct PaymentMethodSession {
pub id: common_utils::id_type::GlobalPaymentMethodSessionId,
pub customer_id: common_utils::id_type::GlobalCustomerId,
pub billing: Option<common_utils::encryption::Encryption>,
pub psp_tokenization: Option<common_types::payment_methods::PspTokenization>,
pub network_tokeinzation: Option<common_types::payment_methods::NetworkTokenization>,
pub network_tokenization: Option<common_types::payment_methods::NetworkTokenization>,
pub return_url: Option<common_utils::types::Url>,
#[serde(with = "common_utils::custom_serde::iso8601")]
pub expires_at: time::PrimitiveDateTime,
pub associated_payment_methods: Option<Vec<common_utils::id_type::GlobalPaymentMethodId>>,
pub associated_payment: Option<common_utils::id_type::GlobalPaymentId>,
}
#[cfg(feature = "v2")]
impl PaymentMethodSession {
pub fn apply_changeset(self, update_session: PaymentMethodsSessionUpdateInternal) -> Self {
let Self {
id,
customer_id,
billing,
psp_tokenization,
network_tokenization,
expires_at,
return_url,
associated_payment_methods,
associated_payment,
} = self;
Self {
id,
customer_id,
billing: update_session.billing.or(billing),
psp_tokenization: update_session.psp_tokenization.or(psp_tokenization),
network_tokenization: update_session.network_tokenization.or(network_tokenization),
expires_at,
return_url,
associated_payment_methods,
associated_payment,
}
}
}
#[cfg(feature = "v2")]
pub struct PaymentMethodsSessionUpdateInternal {
pub billing: Option<common_utils::encryption::Encryption>,
pub psp_tokenization: Option<common_types::payment_methods::PspTokenization>,
pub network_tokenization: Option<common_types::payment_methods::NetworkTokenization>,
}