Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
c247711
add api changes
prasunna09 Nov 18, 2025
5fac302
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Nov 18, 2025
735626a
code refactoring
prasunna09 Nov 19, 2025
bcf7f9c
Merge branch 'add-guest-checkout-api-changes' of github.com:juspay/hy…
prasunna09 Nov 19, 2025
a9281ce
chore: run formatter
hyperswitch-bot[bot] Nov 19, 2025
165aa8b
resolve pr comments
prasunna09 Nov 20, 2025
9ac717a
Merge branch 'add-guest-checkout-api-changes' of github.com:juspay/hy…
prasunna09 Nov 20, 2025
e48db50
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Nov 20, 2025
c06dc3d
Merge branch 'main' into add-guest-checkout-api-changes
prasunna09 Nov 20, 2025
f43c934
chore: run formatter
hyperswitch-bot[bot] Nov 20, 2025
3128a3a
fix clippy v2
prasunna09 Nov 20, 2025
2ecbdc8
Merge branch 'add-guest-checkout-api-changes' of github.com:juspay/hy…
prasunna09 Nov 20, 2025
4ad6b86
Merge branch 'main' into add-guest-checkout-api-changes
prasunna09 Nov 20, 2025
e334729
chore: run formatter
hyperswitch-bot[bot] Nov 20, 2025
0a579e5
fix clippy v2
prasunna09 Nov 20, 2025
efd5832
Merge branch 'add-guest-checkout-api-changes' of github.com:juspay/hy…
prasunna09 Nov 20, 2025
a58f3ab
empty commit
prasunna09 Nov 20, 2025
ffcd307
chore: run formatter
hyperswitch-bot[bot] Nov 20, 2025
646f912
Merge branch 'main' into add-guest-checkout-api-changes
prasunna09 Nov 27, 2025
7a74e16
add guest checkout core flow
prasunna09 Nov 30, 2025
5fb6557
chore: run formatter
hyperswitch-bot[bot] Nov 30, 2025
7477bce
code refactoring
prasunna09 Dec 1, 2025
dea6a98
Merge branch 'guest-checkout-core-changes' of github.com:juspay/hyper…
prasunna09 Dec 1, 2025
6dc430f
chore: run formatter
hyperswitch-bot[bot] Dec 1, 2025
9519c3e
code refactoring
prasunna09 Dec 2, 2025
4063cc9
Merge branch 'guest-checkout-core-changes' of github.com:juspay/hyper…
prasunna09 Dec 2, 2025
21d7653
fix code
prasunna09 Dec 3, 2025
6ddac76
fix code
prasunna09 Dec 3, 2025
e401640
Merge branch 'main' into guest-checkout-core-changes
prasunna09 Dec 4, 2025
31faffd
chore: run formatter
hyperswitch-bot[bot] Dec 4, 2025
26941cd
fix clippy v1
prasunna09 Dec 4, 2025
b24e69a
Merge branch 'guest-checkout-core-changes' of github.com:juspay/hyper…
prasunna09 Dec 4, 2025
fef11a8
fix clippy
prasunna09 Dec 4, 2025
0067704
add volatile pm id in proxy flow
prasunna09 Dec 9, 2025
f6e608e
add volataile pm id support in proxy
prasunna09 Dec 10, 2025
d9c7fd9
fix clippy
prasunna09 Dec 10, 2025
108eebf
chore: run formatter
hyperswitch-bot[bot] Dec 10, 2025
c2aa16f
fix clippy
prasunna09 Dec 10, 2025
2bc6a77
Merge branch 'temp-pm-id-support-in-proxy' of github.com:juspay/hyper…
prasunna09 Dec 10, 2025
afb4bd0
chore: run formatter
hyperswitch-bot[bot] Dec 10, 2025
64aa19c
resolve pr comments
prasunna09 Dec 15, 2025
f67d1ed
Merge branch 'main' into temp-pm-id-support-in-proxy
prasunna09 Dec 18, 2025
d9593fc
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Dec 18, 2025
b7ae83f
fix code
prasunna09 Dec 23, 2025
16db9a2
update encryption logic in pm core
prasunna09 Dec 28, 2025
84eee04
chore: run formatter
hyperswitch-bot[bot] Dec 28, 2025
b48ff51
fix clippy
prasunna09 Dec 28, 2025
abaebbd
Merge branch 'temp-pm-id-support-in-proxy' of github.com:juspay/hyper…
prasunna09 Dec 28, 2025
73c9501
chore: run formatter
hyperswitch-bot[bot] Dec 28, 2025
b667caf
fix toolchain check
prasunna09 Dec 28, 2025
32b46eb
Merge branch 'temp-pm-id-support-in-proxy' of github.com:juspay/hyper…
prasunna09 Dec 28, 2025
f9c96b2
Merge branch 'main' into temp-pm-id-support-in-proxy
prasunna09 Dec 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion api-reference/v2/openapi_spec_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -27411,7 +27411,8 @@
"type": "string",
"enum": [
"tokenization_id",
"payment_method_id"
"payment_method_id",
"volatile_payment_method_id"
]
},
"Tokenization": {
Expand Down
2 changes: 1 addition & 1 deletion crates/api_models/src/payment_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub struct PaymentMethodCreate {
pub payment_method_type: api_enums::PaymentMethod,

/// This is a sub-category of payment method.
#[schema(value_type = PaymentMethodType,example = "google_pay")]
#[schema(value_type = PaymentMethodType,example = "credit")]
pub payment_method_subtype: api_enums::PaymentMethodType,

/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
Expand Down
1 change: 1 addition & 0 deletions crates/api_models/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ pub struct ProxyRequest {
pub enum TokenType {
TokenizationId,
PaymentMethodId,
VolatilePaymentMethodId,
}

#[derive(Debug, ToSchema, Clone, Deserialize, Serialize)]
Expand Down
71 changes: 53 additions & 18 deletions crates/router/src/core/payment_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use common_utils::{consts::DEFAULT_LOCALE, ext_traits::OptionExt};
#[cfg(feature = "v2")]
use common_utils::{
crypto::{EncodeMessage, Encryptable, GcmAes256},
encryption::Encryption,
errors::CustomResult,
ext_traits::{AsyncExt, ValueExt},
fp_utils::when,
Expand All @@ -42,6 +43,8 @@ use error_stack::{report, ResultExt};
use futures::TryStreamExt;
#[cfg(feature = "v1")]
use hyperswitch_domain_models::api::{GenericLinks, GenericLinksData};
#[cfg(feature = "v2")]
use hyperswitch_domain_models::behaviour::Conversion;
use hyperswitch_domain_models::{
payments::{payment_attempt::PaymentAttempt, PaymentIntent, VaultData},
router_data_v2::flow_common_types::VaultConnectorFlowData,
Expand Down Expand Up @@ -1175,6 +1178,7 @@ pub async fn create_payment_method_card_core(
&payment_method,
&None,
req.storage_type,
req.customer_id,
)?;

Ok((resp, payment_method))
Expand Down Expand Up @@ -1218,6 +1222,8 @@ pub async fn create_volatile_payment_method_card_core(
>,
) -> RouterResult<(api::PaymentMethodResponse, domain::PaymentMethod)> {
let db = &*state.store;
let keymanager_state = &(state).into();
let merchant_key_store = platform.get_provider().get_key_store();

let payment_method_data = domain::PaymentMethodVaultingData::try_from(req.payment_method_data)?
.populate_bin_details_for_payment_method(state)
Expand Down Expand Up @@ -1259,7 +1265,12 @@ pub async fn create_volatile_payment_method_card_core(
external_vault_source,
)
.await
.attach_printable("failed to construct payment method")?;
.attach_printable("failed to construct payment method")?
.convert()
.await
.change_context(errors::StorageError::EncryptionError)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to convert payment method")?; //Convert to storage model payment method to store in redis

let redis_connection = state
.store
Expand All @@ -1281,13 +1292,25 @@ pub async fn create_volatile_payment_method_card_core(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to insert payment method id in redis")?;

let domain_payment_method = domain::PaymentMethod::convert_back(
keymanager_state,
payment_method,
merchant_key_store.key.get_inner(),
merchant_key_store.merchant_id.clone().into(),
)
.await
.change_context(errors::StorageError::DecryptionError)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("failed to convert payment method")?;

let resp = pm_transforms::generate_payment_method_response(
&payment_method,
&domain_payment_method,
&None,
req.storage_type,
req.customer_id,
)?;

Ok((resp, payment_method))
Ok((resp, domain_payment_method))
}
Err(e) => Err(e),
}?;
Expand Down Expand Up @@ -1389,8 +1412,12 @@ pub async fn create_payment_method_proxy_card_core(
)
.await?;

let payment_method_response =
pm_transforms::generate_payment_method_response(&payment_method, &None, req.storage_type)?;
let payment_method_response = pm_transforms::generate_payment_method_response(
&payment_method,
&None,
req.storage_type,
req.customer_id,
)?;

Ok((payment_method_response, payment_method))
}
Expand Down Expand Up @@ -1775,7 +1802,12 @@ pub async fn payment_method_intent_create(
.await
.attach_printable("Failed to add Payment method to DB")?;

let resp = pm_transforms::generate_payment_method_response(&payment_method, &None, None)?;
let resp = pm_transforms::generate_payment_method_response(
&payment_method,
&None,
None,
Some(customer_id),
)?;

Ok(services::ApplicationResponse::Json(resp))
}
Expand Down Expand Up @@ -2204,7 +2236,13 @@ pub async fn construct_payment_method_object(
.attach_printable("Unable to parse Payment method data")?;

Ok(domain::PaymentMethod {
customer_id: customer_id.clone(),
customer_id: Some(
customer_id
.clone()
.unwrap_or(id_type::GlobalCustomerId::generate(
&state.conf.cell_information.id,
)),
), //for guest checkout flow where customer id is not present, generated a temporary customer id to handle to conversion to diesel model.
merchant_id: merchant_id.to_owned(),
id: payment_method_id,
locker_id,
Expand Down Expand Up @@ -2903,17 +2941,12 @@ pub async fn vault_payment_method_in_volatile_storage(
let vault_id = domain::VaultId::generate(generate_id(consts::ID_LENGTH, "vault"));
let merchant_key_store = platform.get_provider().get_key_store();

let payload = pmd
.encode_to_string_of_json()
.change_context(errors::ApiErrorResponse::InternalServerError)?;

let encrypted_payload = GcmAes256
.encode_message(
merchant_key_store.key.get_inner().peek().as_ref(),
payload.as_bytes(),
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to encode redis temp locker data")?;
let encrypted_payload: Encryption =
cards::create_encrypted_data(&(state).into(), merchant_key_store, pmd.clone())
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to encrypt Payment method vaulting data")?
.into();

let redis_connection = state
.store
Expand Down Expand Up @@ -3201,6 +3234,7 @@ pub async fn retrieve_payment_method(
&payment_method,
&single_use_token_in_cache,
Some(common_enums::StorageType::Persistent),
payment_method.customer_id.clone(),
)
.map(services::ApplicationResponse::Json)
}
Expand Down Expand Up @@ -3364,6 +3398,7 @@ pub async fn update_payment_method_core(
&payment_method,
&None,
Some(common_enums::StorageType::Persistent),
payment_method.customer_id.clone(),
)?;

// Add a PT task to handle payment_method delete from vault
Expand Down
3 changes: 2 additions & 1 deletion crates/router/src/core/payment_methods/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ pub fn generate_payment_method_response(
payment_method: &domain::PaymentMethod,
single_use_token: &Option<payment_method_data::SingleUsePaymentMethodToken>,
storage_type: Option<common_enums::StorageType>,
customer_id: Option<id_type::GlobalCustomerId>,
) -> errors::RouterResult<api::PaymentMethodResponse> {
let pmd = payment_method
.payment_method_data
Expand Down Expand Up @@ -591,7 +592,7 @@ pub fn generate_payment_method_response(

let resp = api::PaymentMethodResponse {
merchant_id: payment_method.merchant_id.to_owned(),
customer_id: payment_method.customer_id.to_owned(),
customer_id,
id: payment_method.id.to_owned(),
payment_method_type: payment_method.get_payment_method_type(),
payment_method_subtype: payment_method.get_payment_method_subtype(),
Expand Down
4 changes: 2 additions & 2 deletions crates/router/src/core/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ pub async fn proxy_core(
let proxy_record = req_wrapper
.get_proxy_record(
&state,
platform.get_processor().get_key_store(),
platform.get_processor().get_account().storage_scheme,
platform.get_provider().get_key_store(),
platform.get_provider().get_account().storage_scheme,
)
.await?;

Expand Down
Loading
Loading