id stringlengths 20 153 | type stringclasses 1
value | granularity stringclasses 14
values | content stringlengths 16 84.3k | metadata dict |
|---|---|---|---|---|
hyperswitch_method_scheduler_DrainerSettings_validate | clm | method | // hyperswitch/crates/scheduler/src/settings.rs
// impl for DrainerSettings
pub fn validate(&self) -> Result<(), ApplicationError> {
common_utils::fp_utils::when(self.stream_name.is_default_or_empty(), || {
Err(ApplicationError::InvalidConfigurationValueError(
"drainer stream name must not be empty".into(),
))
})
}
| {
"chunk": null,
"crate": "scheduler",
"enum_name": null,
"file_size": null,
"for_type": "DrainerSettings",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "validate",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_scheduler_super::settings::Server_validate | clm | method | // hyperswitch/crates/scheduler/src/configs/validations.rs
// impl for super::settings::Server
pub fn validate(&self) -> Result<(), ApplicationError> {
common_utils::fp_utils::when(self.host.is_default_or_empty(), || {
Err(ApplicationError::InvalidConfigurationValueError(
"server host must not be empty".into(),
))
})
}
| {
"chunk": null,
"crate": "scheduler",
"enum_name": null,
"file_size": null,
"for_type": "super::settings::Server",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "validate",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_scheduler_ProcessTrackerBatch_to_redis_field_value_pairs | clm | method | // hyperswitch/crates/scheduler/src/consumer/types/batch.rs
// impl for ProcessTrackerBatch
pub fn to_redis_field_value_pairs(
&self,
) -> CustomResult<Vec<(&str, String)>, errors::ProcessTrackerError> {
Ok(vec![
("id", self.id.to_string()),
("group_name", self.group_name.to_string()),
("stream_name", self.stream_name.to_string()),
("connection_name", self.connection_name.to_string()),
(
"created_time",
self.created_time.assume_utc().unix_timestamp().to_string(),
),
("rule", self.rule.to_string()),
(
"trackers",
serde_json::to_string(&self.trackers)
.change_context(errors::ProcessTrackerError::SerializationFailed)
.attach_printable_lazy(|| {
format!("Unable to stringify trackers: {:?}", self.trackers)
})?,
),
])
}
| {
"chunk": null,
"crate": "scheduler",
"enum_name": null,
"file_size": null,
"for_type": "ProcessTrackerBatch",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "to_redis_field_value_pairs",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_scheduler_ProcessTrackerBatch_from_redis_stream_entry | clm | method | // hyperswitch/crates/scheduler/src/consumer/types/batch.rs
// impl for ProcessTrackerBatch
pub fn from_redis_stream_entry(
entry: HashMap<String, Option<String>>,
) -> CustomResult<Self, errors::ProcessTrackerError> {
let mut entry = entry;
let id = entry
.remove("id")
.flatten()
.get_required_value("id")
.change_context(errors::ProcessTrackerError::MissingRequiredField)?;
let group_name = entry
.remove("group_name")
.flatten()
.get_required_value("group_name")
.change_context(errors::ProcessTrackerError::MissingRequiredField)?;
let stream_name = entry
.remove("stream_name")
.flatten()
.get_required_value("stream_name")
.change_context(errors::ProcessTrackerError::MissingRequiredField)?;
let connection_name = entry
.remove("connection_name")
.flatten()
.get_required_value("connection_name")
.change_context(errors::ProcessTrackerError::MissingRequiredField)?;
let created_time = entry
.remove("created_time")
.flatten()
.get_required_value("created_time")
.change_context(errors::ProcessTrackerError::MissingRequiredField)?;
//make it parser error
let created_time = {
let offset_date_time = time::OffsetDateTime::from_unix_timestamp(
created_time
.as_str()
.parse::<i64>()
.change_context(errors::ParsingError::UnknownError)
.change_context(errors::ProcessTrackerError::DeserializationFailed)?,
)
.attach_printable_lazy(|| format!("Unable to parse time {}", &created_time))
.change_context(errors::ProcessTrackerError::MissingRequiredField)?;
PrimitiveDateTime::new(offset_date_time.date(), offset_date_time.time())
};
let rule = entry
.remove("rule")
.flatten()
.get_required_value("rule")
.change_context(errors::ProcessTrackerError::MissingRequiredField)?;
let trackers = entry
.remove("trackers")
.flatten()
.get_required_value("trackers")
.change_context(errors::ProcessTrackerError::MissingRequiredField)?;
let trackers = serde_json::from_str::<Vec<ProcessTracker>>(trackers.as_str())
.change_context(errors::ParsingError::UnknownError)
.attach_printable_lazy(|| {
format!("Unable to parse trackers from JSON string: {trackers:?}")
})
.change_context(errors::ProcessTrackerError::DeserializationFailed)
.attach_printable("Error parsing ProcessTracker from redis stream entry")?;
Ok(Self {
id,
group_name,
stream_name,
connection_name,
created_time,
rule,
trackers,
})
}
| {
"chunk": null,
"crate": "scheduler",
"enum_name": null,
"file_size": null,
"for_type": "ProcessTrackerBatch",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "from_redis_stream_entry",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Store_drainer_stream | clm | method | // hyperswitch/crates/drainer/src/stream.rs
// impl for Store
pub fn drainer_stream(&self, shard_key: &str) -> String {
// Example: {shard_5}_drainer_stream
format!("{{{}}}_{}", shard_key, self.config.drainer_stream_name,)
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Store",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "drainer_stream",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Store_get_stream_key_flag | clm | method | // hyperswitch/crates/drainer/src/stream.rs
// impl for Store
pub(crate) fn get_stream_key_flag(&self, stream_index: u8) -> String {
format!("{}_in_use", self.get_drainer_stream_name(stream_index))
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Store",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_stream_key_flag",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Store_get_drainer_stream_name | clm | method | // hyperswitch/crates/drainer/src/stream.rs
// impl for Store
pub(crate) fn get_drainer_stream_name(&self, stream_index: u8) -> String {
self.drainer_stream(format!("shard_{stream_index}").as_str())
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Store",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_drainer_stream_name",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Store_is_stream_available | clm | method | // hyperswitch/crates/drainer/src/stream.rs
// impl for Store
pub async fn is_stream_available(&self, stream_index: u8) -> bool {
let stream_key_flag = self.get_stream_key_flag(stream_index);
match self
.redis_conn
.set_key_if_not_exists_with_expiry(&stream_key_flag.as_str().into(), true, None)
.await
{
Ok(resp) => resp == redis::types::SetnxReply::KeySet,
Err(error) => {
logger::error!(operation="lock_stream",err=?error);
false
}
}
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Store",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "is_stream_available",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Store_make_stream_available | clm | method | // hyperswitch/crates/drainer/src/stream.rs
// impl for Store
pub async fn make_stream_available(&self, stream_name_flag: &str) -> errors::DrainerResult<()> {
match self.redis_conn.delete_key(&stream_name_flag.into()).await {
Ok(redis::DelReply::KeyDeleted) => Ok(()),
Ok(redis::DelReply::KeyNotDeleted) => {
logger::error!("Tried to unlock a stream which is already unlocked");
Ok(())
}
Err(error) => Err(errors::DrainerError::from(error).into()),
}
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Store",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "make_stream_available",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Store_read_from_stream | clm | method | // hyperswitch/crates/drainer/src/stream.rs
// impl for Store
pub async fn read_from_stream(
&self,
stream_name: &str,
max_read_count: u64,
) -> errors::DrainerResult<StreamReadResult> {
// "0-0" id gives first entry
let stream_id = "0-0";
let (output, execution_time) = common_utils::date_time::time_it(|| async {
self.redis_conn
.stream_read_entries(stream_name, stream_id, Some(max_read_count))
.await
.map_err(errors::DrainerError::from)
})
.await;
metrics::REDIS_STREAM_READ_TIME.record(
execution_time,
router_env::metric_attributes!(("stream", stream_name.to_owned())),
);
Ok(output?)
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Store",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "read_from_stream",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Store_trim_from_stream | clm | method | // hyperswitch/crates/drainer/src/stream.rs
// impl for Store
pub async fn trim_from_stream(
&self,
stream_name: &str,
minimum_entry_id: &str,
) -> errors::DrainerResult<usize> {
let trim_kind = redis::StreamCapKind::MinID;
let trim_type = redis::StreamCapTrim::Exact;
let trim_id = minimum_entry_id;
let (trim_result, execution_time) =
common_utils::date_time::time_it::<errors::DrainerResult<_>, _, _>(|| async {
let trim_result = self
.redis_conn
.stream_trim_entries(&stream_name.into(), (trim_kind, trim_type, trim_id))
.await
.map_err(errors::DrainerError::from)?;
// Since xtrim deletes entries below given id excluding the given id.
// Hence, deleting the minimum entry id
self.redis_conn
.stream_delete_entries(&stream_name.into(), minimum_entry_id)
.await
.map_err(errors::DrainerError::from)?;
Ok(trim_result)
})
.await;
metrics::REDIS_STREAM_TRIM_TIME.record(
execution_time,
router_env::metric_attributes!(("stream", stream_name.to_owned())),
);
// adding 1 because we are deleting the given id too
Ok(trim_result? + 1)
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Store",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "trim_from_stream",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Store_delete_from_stream | clm | method | // hyperswitch/crates/drainer/src/stream.rs
// impl for Store
pub async fn delete_from_stream(
&self,
stream_name: &str,
entry_id: &str,
) -> errors::DrainerResult<()> {
let (_trim_result, execution_time) =
common_utils::date_time::time_it::<errors::DrainerResult<_>, _, _>(|| async {
self.redis_conn
.stream_delete_entries(&stream_name.into(), entry_id)
.await
.map_err(errors::DrainerError::from)?;
Ok(())
})
.await;
metrics::REDIS_STREAM_DEL_TIME.record(
execution_time,
router_env::metric_attributes!(("stream", stream_name.to_owned())),
);
Ok(())
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Store",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "delete_from_stream",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_StreamData_from_hashmap | clm | method | // hyperswitch/crates/drainer/src/types.rs
// impl for StreamData
pub fn from_hashmap(
hashmap: HashMap<String, String>,
) -> errors::CustomResult<Self, errors::ParsingError> {
let iter = MapDeserializer::<
'_,
std::collections::hash_map::IntoIter<String, String>,
serde_json::error::Error,
>::new(hashmap.into_iter());
Self::deserialize(iter)
.change_context(errors::ParsingError::StructParseFailure("StreamData"))
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "StreamData",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "from_hashmap",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Store_new | clm | method | // hyperswitch/crates/drainer/src/services.rs
// impl for Store
pub async fn new(config: &crate::Settings, test_transaction: bool, tenant: &Tenant) -> Self {
let redis_conn = crate::connection::redis_connection(config).await;
Self {
master_pool: diesel_make_pg_pool(
config.master_database.get_inner(),
test_transaction,
&tenant.schema,
)
.await,
redis_conn: Arc::new(RedisConnectionPool::clone(
&redis_conn,
&tenant.redis_key_prefix,
)),
config: StoreConfig {
drainer_stream_name: config.drainer.stream_name.clone(),
drainer_num_partitions: config.drainer.num_partitions,
use_legacy_version: config.redis.use_legacy_version,
},
request_id: None,
}
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Store",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "new",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Store_use_legacy_version | clm | method | // hyperswitch/crates/drainer/src/services.rs
// impl for Store
pub fn use_legacy_version(&self) -> bool {
self.config.use_legacy_version
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Store",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "use_legacy_version",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Health_server | clm | method | // hyperswitch/crates/drainer/src/health_check.rs
// impl for Health
pub fn server(conf: Settings, stores: HashMap<id_type::TenantId, Arc<Store>>) -> Scope {
web::scope("health")
.app_data(web::Data::new(conf))
.app_data(web::Data::new(stores))
.service(web::resource("").route(web::get().to(health)))
.service(web::resource("/ready").route(web::get().to(deep_health_check)))
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Health",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "server",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Health_server | clm | method | // hyperswitch/crates/router/src/bin/scheduler.rs
// impl for Health
pub fn server(state: routes::AppState, service: String) -> Scope {
web::scope("health")
.app_data(web::Data::new(state))
.app_data(web::Data::new(service))
.service(web::resource("").route(web::get().to(health)))
.service(web::resource("/ready").route(web::get().to(deep_health_check)))
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Health",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "server",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_AppState_new | clm | method | // hyperswitch/crates/router/src/routes/app.rs
// impl for AppState
pub async fn new(
conf: settings::Settings<SecuredSecret>,
shut_down_signal: oneshot::Sender<()>,
api_client: Box<dyn crate::services::ApiClient>,
) -> Self {
Box::pin(Self::with_storage(
conf,
StorageImpl::Postgresql,
shut_down_signal,
api_client,
))
.await
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "AppState",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "new",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Multitenancy_get_tenants | clm | method | // hyperswitch/crates/drainer/src/settings.rs
// impl for Multitenancy
pub fn get_tenants(&self) -> &HashMap<id_type::TenantId, Tenant> {
&self.tenants.0
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Multitenancy",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_tenants",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Multitenancy_get_tenant_ids | clm | method | // hyperswitch/crates/drainer/src/settings.rs
// impl for Multitenancy
pub fn get_tenant_ids(&self) -> Vec<id_type::TenantId> {
self.tenants
.0
.values()
.map(|tenant| tenant.tenant_id.clone())
.collect()
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Multitenancy",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_tenant_ids",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Multitenancy_get_tenant | clm | method | // hyperswitch/crates/drainer/src/settings.rs
// impl for Multitenancy
pub fn get_tenant(&self, tenant_id: &id_type::TenantId) -> Option<&Tenant> {
self.tenants.0.get(tenant_id)
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Multitenancy",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_tenant",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Multitenancy_get_tenants | clm | method | // hyperswitch/crates/router/src/configs/settings.rs
// impl for Multitenancy
pub fn get_tenants(&self) -> &HashMap<id_type::TenantId, Tenant> {
&self.tenants.0
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Multitenancy",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_tenants",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Multitenancy_get_tenant_ids | clm | method | // hyperswitch/crates/router/src/configs/settings.rs
// impl for Multitenancy
pub fn get_tenant_ids(&self) -> Vec<id_type::TenantId> {
self.tenants
.0
.values()
.map(|tenant| tenant.tenant_id.clone())
.collect()
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Multitenancy",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_tenant_ids",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_Multitenancy_get_tenant | clm | method | // hyperswitch/crates/router/src/configs/settings.rs
// impl for Multitenancy
pub fn get_tenant(&self, tenant_id: &id_type::TenantId) -> Option<&Tenant> {
self.tenants.0.get(tenant_id)
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "Multitenancy",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_tenant",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_drainer_DrainerSettings_validate | clm | method | // hyperswitch/crates/scheduler/src/settings.rs
// impl for DrainerSettings
pub fn validate(&self) -> Result<(), ApplicationError> {
common_utils::fp_utils::when(self.stream_name.is_default_or_empty(), || {
Err(ApplicationError::InvalidConfigurationValueError(
"drainer stream name must not be empty".into(),
))
})
}
| {
"chunk": null,
"crate": "drainer",
"enum_name": null,
"file_size": null,
"for_type": "DrainerSettings",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "validate",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_router_derive_Conversion_get_req_type | clm | method | // hyperswitch/crates/router_derive/src/macros/operation.rs
// impl for Conversion
fn get_req_type(ident: Derives) -> syn::Ident {
match ident {
Derives::Authorize => syn::Ident::new("PaymentsRequest", Span::call_site()),
Derives::AuthorizeData => syn::Ident::new("PaymentsAuthorizeData", Span::call_site()),
Derives::Sync => syn::Ident::new("PaymentsRetrieveRequest", Span::call_site()),
Derives::SyncData => syn::Ident::new("PaymentsSyncData", Span::call_site()),
Derives::Cancel => syn::Ident::new("PaymentsCancelRequest", Span::call_site()),
Derives::CancelData => syn::Ident::new("PaymentsCancelData", Span::call_site()),
Derives::ApproveData => syn::Ident::new("PaymentsApproveData", Span::call_site()),
Derives::Reject => syn::Ident::new("PaymentsRejectRequest", Span::call_site()),
Derives::RejectData => syn::Ident::new("PaymentsRejectData", Span::call_site()),
Derives::Capture => syn::Ident::new("PaymentsCaptureRequest", Span::call_site()),
Derives::CaptureData => syn::Ident::new("PaymentsCaptureData", Span::call_site()),
Derives::CompleteAuthorizeData => {
syn::Ident::new("CompleteAuthorizeData", Span::call_site())
}
Derives::Start => syn::Ident::new("PaymentsStartRequest", Span::call_site()),
Derives::Verify => syn::Ident::new("VerifyRequest", Span::call_site()),
Derives::SetupMandateData => {
syn::Ident::new("SetupMandateRequestData", Span::call_site())
}
Derives::Session => syn::Ident::new("PaymentsSessionRequest", Span::call_site()),
Derives::SessionData => syn::Ident::new("PaymentsSessionData", Span::call_site()),
Derives::IncrementalAuthorization => {
syn::Ident::new("PaymentsIncrementalAuthorizationRequest", Span::call_site())
}
Derives::IncrementalAuthorizationData => {
syn::Ident::new("PaymentsIncrementalAuthorizationData", Span::call_site())
}
Derives::SdkSessionUpdate => {
syn::Ident::new("PaymentsDynamicTaxCalculationRequest", Span::call_site())
}
Derives::SdkSessionUpdateData => {
syn::Ident::new("SdkPaymentsSessionUpdateData", Span::call_site())
}
Derives::PostSessionTokens => {
syn::Ident::new("PaymentsPostSessionTokensRequest", Span::call_site())
}
Derives::PostSessionTokensData => {
syn::Ident::new("PaymentsPostSessionTokensData", Span::call_site())
}
Derives::UpdateMetadata => {
syn::Ident::new("PaymentsUpdateMetadataRequest", Span::call_site())
}
Derives::UpdateMetadataData => {
syn::Ident::new("PaymentsUpdateMetadataData", Span::call_site())
}
Derives::CancelPostCapture => {
syn::Ident::new("PaymentsCancelPostCaptureRequest", Span::call_site())
}
Derives::CancelPostCaptureData => {
syn::Ident::new("PaymentsCancelPostCaptureData", Span::call_site())
}
Derives::ExtendAuthorization => {
syn::Ident::new("PaymentsExtendAuthorizationRequest", Span::call_site())
}
Derives::ExtendAuthorizationData => {
syn::Ident::new("PaymentsExtendAuthorizationData", Span::call_site())
}
}
}
| {
"chunk": null,
"crate": "router_derive",
"enum_name": null,
"file_size": null,
"for_type": "Conversion",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_req_type",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_router_derive_Conversion_to_function | clm | method | // hyperswitch/crates/router_derive/src/macros/operation.rs
// impl for Conversion
fn to_function(&self, ident: Derives) -> TokenStream {
let req_type = Self::get_req_type(ident);
match self {
Self::ValidateRequest => quote! {
fn to_validate_request(&self) -> RouterResult<&(dyn ValidateRequest<F,#req_type, Self::Data> + Send + Sync)> {
Ok(self)
}
},
Self::GetTracker => quote! {
fn to_get_tracker(&self) -> RouterResult<&(dyn GetTracker<F, Self::Data, #req_type> + Send + Sync)> {
Ok(self)
}
},
Self::Domain => quote! {
fn to_domain(&self) -> RouterResult<&dyn Domain<F,#req_type, Self::Data>> {
Ok(self)
}
},
Self::UpdateTracker => quote! {
fn to_update_tracker(&self) -> RouterResult<&(dyn UpdateTracker<F, Self::Data, #req_type> + Send + Sync)> {
Ok(self)
}
},
Self::PostUpdateTracker => quote! {
fn to_post_update_tracker(&self) -> RouterResult<&(dyn PostUpdateTracker<F, Self::Data, #req_type> + Send + Sync)> {
Ok(self)
}
},
Self::Invalid(s) => {
helpers::syn_error(Span::call_site(), &format!("Invalid identifier {s}"))
.to_compile_error()
}
Self::All => {
let validate_request = Self::ValidateRequest.to_function(ident);
let get_tracker = Self::GetTracker.to_function(ident);
let domain = Self::Domain.to_function(ident);
let update_tracker = Self::UpdateTracker.to_function(ident);
quote! {
#validate_request
#get_tracker
#domain
#update_tracker
}
}
}
}
| {
"chunk": null,
"crate": "router_derive",
"enum_name": null,
"file_size": null,
"for_type": "Conversion",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "to_function",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_router_derive_Conversion_to_ref_function | clm | method | // hyperswitch/crates/router_derive/src/macros/operation.rs
// impl for Conversion
fn to_ref_function(&self, ident: Derives) -> TokenStream {
let req_type = Self::get_req_type(ident);
match self {
Self::ValidateRequest => quote! {
fn to_validate_request(&self) -> RouterResult<&(dyn ValidateRequest<F, #req_type, Self::Data> + Send + Sync)> {
Ok(*self)
}
},
Self::GetTracker => quote! {
fn to_get_tracker(&self) -> RouterResult<&(dyn GetTracker<F, Self::Data,#req_type> + Send + Sync)> {
Ok(*self)
}
},
Self::Domain => quote! {
fn to_domain(&self) -> RouterResult<&(dyn Domain<F,#req_type, Self::Data>)> {
Ok(*self)
}
},
Self::UpdateTracker => quote! {
fn to_update_tracker(&self) -> RouterResult<&(dyn UpdateTracker<F, Self::Data,#req_type> + Send + Sync)> {
Ok(*self)
}
},
Self::PostUpdateTracker => quote! {
fn to_post_update_tracker(&self) -> RouterResult<&(dyn PostUpdateTracker<F, Self::Data, #req_type> + Send + Sync)> {
Ok(*self)
}
},
Self::Invalid(s) => {
helpers::syn_error(Span::call_site(), &format!("Invalid identifier {s}"))
.to_compile_error()
}
Self::All => {
let validate_request = Self::ValidateRequest.to_ref_function(ident);
let get_tracker = Self::GetTracker.to_ref_function(ident);
let domain = Self::Domain.to_ref_function(ident);
let update_tracker = Self::UpdateTracker.to_ref_function(ident);
quote! {
#validate_request
#get_tracker
#domain
#update_tracker
}
}
}
}
| {
"chunk": null,
"crate": "router_derive",
"enum_name": null,
"file_size": null,
"for_type": "Conversion",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "to_ref_function",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_router_derive_DieselEnumMeta_get_storage_type | clm | method | // hyperswitch/crates/router_derive/src/macros/diesel.rs
// impl for DieselEnumMeta
pub fn get_storage_type(&self) -> &StorageType {
match self {
Self::StorageTypeEnum { value, .. } => value,
}
}
| {
"chunk": null,
"crate": "router_derive",
"enum_name": null,
"file_size": null,
"for_type": "DieselEnumMeta",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_storage_type",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_InvoiceSyncTrackingData_new | clm | method | // hyperswitch/crates/subscriptions/src/types/storage/invoice_sync.rs
// impl for InvoiceSyncTrackingData
pub fn new(
subscription_id: id_type::SubscriptionId,
invoice_id: id_type::InvoiceId,
merchant_id: id_type::MerchantId,
profile_id: id_type::ProfileId,
customer_id: id_type::CustomerId,
connector_invoice_id: Option<id_type::InvoiceId>,
connector_name: api_enums::Connector,
) -> Self {
Self {
subscription_id,
invoice_id,
merchant_id,
profile_id,
customer_id,
connector_invoice_id,
connector_name,
}
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "InvoiceSyncTrackingData",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "new",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_SubscriptionWithHandler<'_>_generate_response | clm | method | // hyperswitch/crates/subscriptions/src/core/subscription_handler.rs
// impl for SubscriptionWithHandler<'_>
pub fn generate_response(
&self,
invoice: &hyperswitch_domain_models::invoice::Invoice,
payment_response: &subscription_types::PaymentResponseData,
status: subscription_response_types::SubscriptionStatus,
) -> errors::SubscriptionResult<subscription_types::ConfirmSubscriptionResponse> {
Ok(subscription_types::ConfirmSubscriptionResponse {
id: self.subscription.id.clone(),
merchant_reference_id: self.subscription.merchant_reference_id.clone(),
status: subscription_types::SubscriptionStatus::from(status),
plan_id: self.subscription.plan_id.clone(),
profile_id: self.subscription.profile_id.to_owned(),
payment: Some(payment_response.clone()),
customer_id: Some(self.subscription.customer_id.clone()),
item_price_id: self.subscription.item_price_id.clone(),
coupon: None,
billing_processor_subscription_id: self.subscription.connector_subscription_id.clone(),
invoice: Some(subscription_types::Invoice::foreign_try_from(invoice)?),
})
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "SubscriptionWithHandler<'_>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "generate_response",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_SubscriptionWithHandler<'_>_to_subscription_response | clm | method | // hyperswitch/crates/subscriptions/src/core/subscription_handler.rs
// impl for SubscriptionWithHandler<'_>
pub fn to_subscription_response(
&self,
payment: Option<subscription_types::PaymentResponseData>,
invoice: Option<&hyperswitch_domain_models::invoice::Invoice>,
) -> errors::SubscriptionResult<SubscriptionResponse> {
Ok(SubscriptionResponse::new(
self.subscription.id.clone(),
self.subscription.merchant_reference_id.clone(),
subscription_types::SubscriptionStatus::from_str(&self.subscription.status)
.unwrap_or(subscription_types::SubscriptionStatus::Created),
self.subscription.plan_id.clone(),
self.subscription.item_price_id.clone(),
self.subscription.profile_id.to_owned(),
self.subscription.merchant_id.to_owned(),
self.subscription.client_secret.clone().map(Secret::new),
self.subscription.customer_id.clone(),
payment,
invoice
.map(
|invoice| -> errors::SubscriptionResult<subscription_types::Invoice> {
subscription_types::Invoice::foreign_try_from(invoice)
},
)
.transpose()?,
))
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "SubscriptionWithHandler<'_>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "to_subscription_response",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_SubscriptionWithHandler<'_>_update_subscription | clm | method | // hyperswitch/crates/subscriptions/src/core/subscription_handler.rs
// impl for SubscriptionWithHandler<'_>
pub async fn update_subscription(
&mut self,
subscription_update: hyperswitch_domain_models::subscription::SubscriptionUpdate,
) -> errors::SubscriptionResult<()> {
let db = self.handler.state.store.as_ref();
let updated_subscription = db
.update_subscription_entry(
&(self.handler.state).into(),
self.handler.merchant_context.get_merchant_key_store(),
self.handler
.merchant_context
.get_merchant_account()
.get_id(),
self.subscription.id.get_string_repr().to_string(),
subscription_update,
)
.await
.change_context(errors::ApiErrorResponse::SubscriptionError {
operation: "Subscription Update".to_string(),
})
.attach_printable("subscriptions: unable to update subscription entry in database")?;
self.subscription = updated_subscription;
Ok(())
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "SubscriptionWithHandler<'_>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update_subscription",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_SubscriptionWithHandler<'_>_get_invoice_handler | clm | method | // hyperswitch/crates/subscriptions/src/core/subscription_handler.rs
// impl for SubscriptionWithHandler<'_>
pub fn get_invoice_handler(
&self,
profile: hyperswitch_domain_models::business_profile::Profile,
) -> InvoiceHandler {
InvoiceHandler {
subscription: self.subscription.clone(),
merchant_account: self.merchant_account.clone(),
profile,
merchant_key_store: self
.handler
.merchant_context
.get_merchant_key_store()
.clone(),
}
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "SubscriptionWithHandler<'_>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_invoice_handler",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_SubscriptionWithHandler<'_>_get_mca | clm | method | // hyperswitch/crates/subscriptions/src/core/subscription_handler.rs
// impl for SubscriptionWithHandler<'_>
pub async fn get_mca(
&mut self,
connector_name: &str,
) -> CustomResult<merchant_connector_account::MerchantConnectorAccount, errors::ApiErrorResponse>
{
let db = self.handler.state.store.as_ref();
let key_manager_state = &(self.handler.state).into();
match &self.subscription.merchant_connector_id {
Some(merchant_connector_id) => {
#[cfg(feature = "v1")]
{
db.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
key_manager_state,
self.handler
.merchant_context
.get_merchant_account()
.get_id(),
merchant_connector_id,
self.handler.merchant_context.get_merchant_key_store(),
)
.await
.to_not_found_response(
errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
id: merchant_connector_id.get_string_repr().to_string(),
},
)
}
}
None => {
// Fallback to profile-based lookup when merchant_connector_id is not set
#[cfg(feature = "v1")]
{
db.find_merchant_connector_account_by_profile_id_connector_name(
key_manager_state,
&self.subscription.profile_id,
connector_name,
self.handler.merchant_context.get_merchant_key_store(),
)
.await
.to_not_found_response(
errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
id: format!(
"profile_id {} and connector_name {connector_name}",
self.subscription.profile_id.get_string_repr()
),
},
)
}
}
}
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "SubscriptionWithHandler<'_>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_mca",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_PaymentsApiClient_get_internal_auth_headers | clm | method | // hyperswitch/crates/subscriptions/src/core/payments_api_client.rs
// impl for PaymentsApiClient
fn get_internal_auth_headers(
state: &SessionState,
merchant_id: &str,
profile_id: &str,
) -> Vec<(String, masking::Maskable<String>)> {
vec![
(
helpers::X_INTERNAL_API_KEY.to_string(),
masking::Maskable::Masked(
state
.conf
.internal_merchant_id_profile_id_auth
.internal_api_key
.clone(),
),
),
(
helpers::X_TENANT_ID.to_string(),
masking::Maskable::Normal(state.tenant.tenant_id.get_string_repr().to_string()),
),
(
helpers::X_MERCHANT_ID.to_string(),
masking::Maskable::Normal(merchant_id.to_string()),
),
(
helpers::X_PROFILE_ID.to_string(),
masking::Maskable::Normal(profile_id.to_string()),
),
]
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "PaymentsApiClient",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_internal_auth_headers",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_PaymentsApiClient_make_payment_api_call | clm | method | // hyperswitch/crates/subscriptions/src/core/payments_api_client.rs
// impl for PaymentsApiClient
async fn make_payment_api_call(
state: &SessionState,
method: services::Method,
url: String,
request_body: Option<common_utils::request::RequestContent>,
operation_name: &str,
merchant_id: &str,
profile_id: &str,
) -> errors::SubscriptionResult<subscription_types::PaymentResponseData> {
let subscription_error = errors::ApiErrorResponse::SubscriptionError {
operation: operation_name.to_string(),
};
let headers = Self::get_internal_auth_headers(state, merchant_id, profile_id);
let mut request_builder = services::RequestBuilder::new()
.method(method)
.url(&url)
.headers(headers);
// Add request body only if provided (for POST requests)
if let Some(body) = request_body {
request_builder = request_builder.set_body(body);
}
let request = request_builder.build();
let response = api::call_connector_api(state, request, "Subscription Payments")
.await
.change_context(subscription_error.clone())?;
match response {
Ok(res) => {
let api_response: subscription_types::PaymentResponseData = res
.response
.parse_struct(std::any::type_name::<subscription_types::PaymentResponseData>())
.change_context(subscription_error)?;
Ok(api_response)
}
Err(err) => {
let error_response: ErrorResponse = err
.response
.parse_struct(std::any::type_name::<ErrorResponse>())
.change_context(subscription_error)?;
Err(errors::ApiErrorResponse::ExternalConnectorError {
code: error_response.error.code,
message: error_response.error.message,
connector: "payments_microservice".to_string(),
status_code: err.status_code,
reason: error_response.error.error_type,
}
.into())
}
}
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "PaymentsApiClient",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "make_payment_api_call",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_PaymentsApiClient_create_cit_payment | clm | method | // hyperswitch/crates/subscriptions/src/core/payments_api_client.rs
// impl for PaymentsApiClient
pub async fn create_cit_payment(
state: &SessionState,
request: subscription_types::CreatePaymentsRequestData,
merchant_id: &str,
profile_id: &str,
) -> errors::SubscriptionResult<subscription_types::PaymentResponseData> {
let base_url = &state.conf.internal_services.payments_base_url;
let url = format!("{}/payments", base_url);
Self::make_payment_api_call(
state,
services::Method::Post,
url,
Some(common_utils::request::RequestContent::Json(Box::new(
request,
))),
"Create Payment",
merchant_id,
profile_id,
)
.await
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "PaymentsApiClient",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "create_cit_payment",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_PaymentsApiClient_create_and_confirm_payment | clm | method | // hyperswitch/crates/subscriptions/src/core/payments_api_client.rs
// impl for PaymentsApiClient
pub async fn create_and_confirm_payment(
state: &SessionState,
request: subscription_types::CreateAndConfirmPaymentsRequestData,
merchant_id: &str,
profile_id: &str,
) -> errors::SubscriptionResult<subscription_types::PaymentResponseData> {
let base_url = &state.conf.internal_services.payments_base_url;
let url = format!("{}/payments", base_url);
Self::make_payment_api_call(
state,
services::Method::Post,
url,
Some(common_utils::request::RequestContent::Json(Box::new(
request,
))),
"Create And Confirm Payment",
merchant_id,
profile_id,
)
.await
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "PaymentsApiClient",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "create_and_confirm_payment",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_PaymentsApiClient_confirm_payment | clm | method | // hyperswitch/crates/subscriptions/src/core/payments_api_client.rs
// impl for PaymentsApiClient
pub async fn confirm_payment(
state: &SessionState,
request: subscription_types::ConfirmPaymentsRequestData,
payment_id: String,
merchant_id: &str,
profile_id: &str,
) -> errors::SubscriptionResult<subscription_types::PaymentResponseData> {
let base_url = &state.conf.internal_services.payments_base_url;
let url = format!("{}/payments/{}/confirm", base_url, payment_id);
Self::make_payment_api_call(
state,
services::Method::Post,
url,
Some(common_utils::request::RequestContent::Json(Box::new(
request,
))),
"Confirm Payment",
merchant_id,
profile_id,
)
.await
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "PaymentsApiClient",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "confirm_payment",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_PaymentsApiClient_sync_payment | clm | method | // hyperswitch/crates/subscriptions/src/core/payments_api_client.rs
// impl for PaymentsApiClient
pub async fn sync_payment(
state: &SessionState,
payment_id: String,
merchant_id: &str,
profile_id: &str,
) -> errors::SubscriptionResult<subscription_types::PaymentResponseData> {
let base_url = &state.conf.internal_services.payments_base_url;
let url = format!("{}/payments/{}", base_url, payment_id);
Self::make_payment_api_call(
state,
services::Method::Get,
url,
None,
"Sync Payment",
merchant_id,
profile_id,
)
.await
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "PaymentsApiClient",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "sync_payment",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_PaymentsApiClient_create_mit_payment | clm | method | // hyperswitch/crates/subscriptions/src/core/payments_api_client.rs
// impl for PaymentsApiClient
pub async fn create_mit_payment(
state: &SessionState,
request: subscription_types::CreateMitPaymentRequestData,
merchant_id: &str,
profile_id: &str,
) -> errors::SubscriptionResult<subscription_types::PaymentResponseData> {
let base_url = &state.conf.internal_services.payments_base_url;
let url = format!("{}/payments", base_url);
Self::make_payment_api_call(
state,
services::Method::Post,
url,
Some(common_utils::request::RequestContent::Json(Box::new(
request,
))),
"Create MIT Payment",
merchant_id,
profile_id,
)
.await
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "PaymentsApiClient",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "create_mit_payment",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_PaymentsApiClient_update_payment | clm | method | // hyperswitch/crates/subscriptions/src/core/payments_api_client.rs
// impl for PaymentsApiClient
pub async fn update_payment(
state: &SessionState,
request: subscription_types::CreatePaymentsRequestData,
payment_id: String,
merchant_id: &str,
profile_id: &str,
) -> errors::SubscriptionResult<subscription_types::PaymentResponseData> {
let base_url = &state.conf.internal_services.payments_base_url;
let url = format!("{}/payments/{}", base_url, payment_id);
Self::make_payment_api_call(
state,
services::Method::Post,
url,
Some(common_utils::request::RequestContent::Json(Box::new(
request,
))),
"Update Payment",
merchant_id,
profile_id,
)
.await
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "PaymentsApiClient",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update_payment",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_InvoiceHandler_new | clm | method | // hyperswitch/crates/subscriptions/src/core/invoice_handler.rs
// impl for InvoiceHandler
pub fn new(
subscription: hyperswitch_domain_models::subscription::Subscription,
merchant_account: hyperswitch_domain_models::merchant_account::MerchantAccount,
profile: hyperswitch_domain_models::business_profile::Profile,
merchant_key_store: hyperswitch_domain_models::merchant_key_store::MerchantKeyStore,
) -> Self {
Self {
subscription,
merchant_account,
profile,
merchant_key_store,
}
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "InvoiceHandler",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "new",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_InvoiceHandler_create_invoice_entry | clm | method | // hyperswitch/crates/subscriptions/src/core/invoice_handler.rs
// impl for InvoiceHandler
pub async fn create_invoice_entry(
&self,
state: &SessionState,
merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,
payment_intent_id: Option<common_utils::id_type::PaymentId>,
amount: MinorUnit,
currency: common_enums::Currency,
status: connector_enums::InvoiceStatus,
provider_name: connector_enums::Connector,
metadata: Option<pii::SecretSerdeValue>,
connector_invoice_id: Option<common_utils::id_type::InvoiceId>,
) -> errors::SubscriptionResult<hyperswitch_domain_models::invoice::Invoice> {
let invoice_new = hyperswitch_domain_models::invoice::Invoice::to_invoice(
self.subscription.id.to_owned(),
self.subscription.merchant_id.to_owned(),
self.subscription.profile_id.to_owned(),
merchant_connector_id,
payment_intent_id,
self.subscription.payment_method_id.clone(),
self.subscription.customer_id.to_owned(),
amount,
currency.to_string(),
status,
provider_name,
metadata,
connector_invoice_id,
);
let key_manager_state = &(state).into();
let invoice = state
.store
.insert_invoice_entry(key_manager_state, &self.merchant_key_store, invoice_new)
.await
.change_context(errors::ApiErrorResponse::SubscriptionError {
operation: "Create Invoice".to_string(),
})
.attach_printable("invoices: unable to insert invoice entry to database")?;
Ok(invoice)
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "InvoiceHandler",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "create_invoice_entry",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_InvoiceHandler_update_invoice | clm | method | // hyperswitch/crates/subscriptions/src/core/invoice_handler.rs
// impl for InvoiceHandler
pub async fn update_invoice(
&self,
state: &SessionState,
invoice_id: common_utils::id_type::InvoiceId,
update_request: hyperswitch_domain_models::invoice::InvoiceUpdateRequest,
) -> errors::SubscriptionResult<hyperswitch_domain_models::invoice::Invoice> {
let update_invoice: hyperswitch_domain_models::invoice::InvoiceUpdate =
update_request.into();
let key_manager_state = &(state).into();
state
.store
.update_invoice_entry(
key_manager_state,
&self.merchant_key_store,
invoice_id.get_string_repr().to_string(),
update_invoice,
)
.await
.change_context(errors::ApiErrorResponse::SubscriptionError {
operation: "Invoice Update".to_string(),
})
.attach_printable("invoices: unable to update invoice entry in database")
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "InvoiceHandler",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update_invoice",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_InvoiceHandler_get_amount_and_currency | clm | method | // hyperswitch/crates/subscriptions/src/core/invoice_handler.rs
// impl for InvoiceHandler
pub fn get_amount_and_currency(
request: (Option<MinorUnit>, Option<api_enums::Currency>),
invoice_details: Option<subscription_response_types::SubscriptionInvoiceData>,
) -> (MinorUnit, api_enums::Currency) {
// Use request amount and currency if provided, else fallback to invoice details from connector response
request.0.zip(request.1).unwrap_or(
invoice_details
.clone()
.map(|invoice| (invoice.total, invoice.currency_code))
.unwrap_or((MinorUnit::new(0), api_enums::Currency::default())),
) // Default to 0 and a default currency if not provided
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "InvoiceHandler",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_amount_and_currency",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_InvoiceHandler_create_payment_with_confirm_false | clm | method | // hyperswitch/crates/subscriptions/src/core/invoice_handler.rs
// impl for InvoiceHandler
pub async fn create_payment_with_confirm_false(
&self,
state: &SessionState,
request: &subscription_types::CreateSubscriptionRequest,
amount: MinorUnit,
currency: api_enums::Currency,
) -> errors::SubscriptionResult<subscription_types::PaymentResponseData> {
let payment_details = &request.payment_details;
let payment_request = subscription_types::CreatePaymentsRequestData {
amount,
currency,
customer_id: Some(self.subscription.customer_id.clone()),
billing: request.billing.clone(),
shipping: request.shipping.clone(),
profile_id: Some(self.profile.get_id().clone()),
setup_future_usage: payment_details.setup_future_usage,
return_url: Some(payment_details.return_url.clone()),
capture_method: payment_details.capture_method,
authentication_type: payment_details.authentication_type,
};
payments_api_client::PaymentsApiClient::create_cit_payment(
state,
payment_request,
self.merchant_account.get_id().get_string_repr(),
self.profile.get_id().get_string_repr(),
)
.await
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "InvoiceHandler",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "create_payment_with_confirm_false",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_InvoiceHandler_get_payment_details | clm | method | // hyperswitch/crates/subscriptions/src/core/invoice_handler.rs
// impl for InvoiceHandler
pub async fn get_payment_details(
&self,
state: &SessionState,
payment_id: common_utils::id_type::PaymentId,
) -> errors::SubscriptionResult<subscription_types::PaymentResponseData> {
payments_api_client::PaymentsApiClient::sync_payment(
state,
payment_id.get_string_repr().to_string(),
self.merchant_account.get_id().get_string_repr(),
self.profile.get_id().get_string_repr(),
)
.await
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "InvoiceHandler",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_payment_details",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_InvoiceHandler_create_and_confirm_payment | clm | method | // hyperswitch/crates/subscriptions/src/core/invoice_handler.rs
// impl for InvoiceHandler
pub async fn create_and_confirm_payment(
&self,
state: &SessionState,
request: &subscription_types::CreateAndConfirmSubscriptionRequest,
amount: MinorUnit,
currency: common_enums::Currency,
) -> errors::SubscriptionResult<subscription_types::PaymentResponseData> {
let payment_details = &request.payment_details;
let payment_request = subscription_types::CreateAndConfirmPaymentsRequestData {
amount,
currency,
confirm: true,
customer_id: Some(self.subscription.customer_id.clone()),
billing: request.get_billing_address(),
shipping: request.shipping.clone(),
profile_id: Some(self.profile.get_id().clone()),
setup_future_usage: payment_details.setup_future_usage,
return_url: payment_details.return_url.clone(),
capture_method: payment_details.capture_method,
authentication_type: payment_details.authentication_type,
payment_method: payment_details.payment_method,
payment_method_type: payment_details.payment_method_type,
payment_method_data: payment_details.payment_method_data.clone(),
customer_acceptance: payment_details.customer_acceptance.clone(),
payment_type: payment_details.payment_type,
};
payments_api_client::PaymentsApiClient::create_and_confirm_payment(
state,
payment_request,
self.merchant_account.get_id().get_string_repr(),
self.profile.get_id().get_string_repr(),
)
.await
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "InvoiceHandler",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "create_and_confirm_payment",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_InvoiceHandler_confirm_payment | clm | method | // hyperswitch/crates/subscriptions/src/core/invoice_handler.rs
// impl for InvoiceHandler
pub async fn confirm_payment(
&self,
state: &SessionState,
payment_id: common_utils::id_type::PaymentId,
request: &subscription_types::ConfirmSubscriptionRequest,
) -> errors::SubscriptionResult<subscription_types::PaymentResponseData> {
let payment_details = &request.payment_details;
let cit_payment_request = subscription_types::ConfirmPaymentsRequestData {
billing: request.get_billing_address(),
shipping: request.payment_details.shipping.clone(),
profile_id: Some(self.profile.get_id().clone()),
payment_method: payment_details.payment_method,
payment_method_type: payment_details.payment_method_type,
payment_method_data: payment_details.payment_method_data.clone(),
customer_acceptance: payment_details.customer_acceptance.clone(),
payment_type: payment_details.payment_type,
};
payments_api_client::PaymentsApiClient::confirm_payment(
state,
cit_payment_request,
payment_id.get_string_repr().to_string(),
self.merchant_account.get_id().get_string_repr(),
self.profile.get_id().get_string_repr(),
)
.await
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "InvoiceHandler",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "confirm_payment",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_InvoiceHandler_get_latest_invoice | clm | method | // hyperswitch/crates/subscriptions/src/core/invoice_handler.rs
// impl for InvoiceHandler
pub async fn get_latest_invoice(
&self,
state: &SessionState,
) -> errors::SubscriptionResult<hyperswitch_domain_models::invoice::Invoice> {
let key_manager_state = &(state).into();
state
.store
.get_latest_invoice_for_subscription(
key_manager_state,
&self.merchant_key_store,
self.subscription.id.get_string_repr().to_string(),
)
.await
.change_context(errors::ApiErrorResponse::SubscriptionError {
operation: "Get Latest Invoice".to_string(),
})
.attach_printable("invoices: unable to get latest invoice from database")
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "InvoiceHandler",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_latest_invoice",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_InvoiceHandler_get_invoice_by_id | clm | method | // hyperswitch/crates/subscriptions/src/core/invoice_handler.rs
// impl for InvoiceHandler
pub async fn get_invoice_by_id(
&self,
state: &SessionState,
invoice_id: common_utils::id_type::InvoiceId,
) -> errors::SubscriptionResult<hyperswitch_domain_models::invoice::Invoice> {
let key_manager_state = &(state).into();
state
.store
.find_invoice_by_invoice_id(
key_manager_state,
&self.merchant_key_store,
invoice_id.get_string_repr().to_string(),
)
.await
.change_context(errors::ApiErrorResponse::SubscriptionError {
operation: "Get Invoice by ID".to_string(),
})
.attach_printable("invoices: unable to get invoice by id from database")
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "InvoiceHandler",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_invoice_by_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_InvoiceHandler_find_invoice_by_subscription_id_connector_invoice_id | clm | method | // hyperswitch/crates/subscriptions/src/core/invoice_handler.rs
// impl for InvoiceHandler
pub async fn find_invoice_by_subscription_id_connector_invoice_id(
&self,
state: &SessionState,
subscription_id: common_utils::id_type::SubscriptionId,
connector_invoice_id: common_utils::id_type::InvoiceId,
) -> errors::SubscriptionResult<Option<hyperswitch_domain_models::invoice::Invoice>> {
let key_manager_state = &(state).into();
state
.store
.find_invoice_by_subscription_id_connector_invoice_id(
key_manager_state,
&self.merchant_key_store,
subscription_id.get_string_repr().to_string(),
connector_invoice_id,
)
.await
.change_context(errors::ApiErrorResponse::SubscriptionError {
operation: "Get Invoice by Subscription ID and Connector Invoice ID".to_string(),
})
.attach_printable("invoices: unable to get invoice by subscription id and connector invoice id from database")
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "InvoiceHandler",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_invoice_by_subscription_id_connector_invoice_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_InvoiceHandler_create_invoice_sync_job | clm | method | // hyperswitch/crates/subscriptions/src/core/invoice_handler.rs
// impl for InvoiceHandler
pub async fn create_invoice_sync_job(
&self,
state: &SessionState,
invoice: &hyperswitch_domain_models::invoice::Invoice,
connector_invoice_id: Option<common_utils::id_type::InvoiceId>,
connector_name: connector_enums::Connector,
) -> errors::SubscriptionResult<()> {
let request = storage_types::invoice_sync::InvoiceSyncRequest::new(
self.subscription.id.to_owned(),
invoice.id.to_owned(),
self.subscription.merchant_id.to_owned(),
self.subscription.profile_id.to_owned(),
self.subscription.customer_id.to_owned(),
connector_invoice_id,
connector_name,
);
invoice_sync_workflow::create_invoice_sync_job(state, request)
.await
.attach_printable("invoices: unable to create invoice sync job in database")?;
Ok(())
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "InvoiceHandler",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "create_invoice_sync_job",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_InvoiceHandler_create_mit_payment | clm | method | // hyperswitch/crates/subscriptions/src/core/invoice_handler.rs
// impl for InvoiceHandler
pub async fn create_mit_payment(
&self,
state: &SessionState,
amount: MinorUnit,
currency: common_enums::Currency,
payment_method_id: &str,
) -> errors::SubscriptionResult<subscription_types::PaymentResponseData> {
let mit_payment_request = subscription_types::CreateMitPaymentRequestData {
amount,
currency,
confirm: true,
customer_id: Some(self.subscription.customer_id.clone()),
recurring_details: Some(api_models::mandates::RecurringDetails::PaymentMethodId(
payment_method_id.to_owned(),
)),
off_session: Some(true),
profile_id: Some(self.profile.get_id().clone()),
};
payments_api_client::PaymentsApiClient::create_mit_payment(
state,
mit_payment_request,
self.merchant_account.get_id().get_string_repr(),
self.profile.get_id().get_string_repr(),
)
.await
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "InvoiceHandler",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "create_mit_payment",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_subscriptions_InvoiceHandler_update_payment | clm | method | // hyperswitch/crates/subscriptions/src/core/invoice_handler.rs
// impl for InvoiceHandler
pub async fn update_payment(
&self,
state: &SessionState,
amount: MinorUnit,
currency: common_enums::Currency,
payment_id: common_utils::id_type::PaymentId,
) -> errors::SubscriptionResult<subscription_types::PaymentResponseData> {
let payment_update_request = subscription_types::CreatePaymentsRequestData {
amount,
currency,
customer_id: None,
billing: None,
shipping: None,
profile_id: None,
setup_future_usage: None,
return_url: None,
capture_method: None,
authentication_type: None,
};
payments_api_client::PaymentsApiClient::update_payment(
state,
payment_update_request,
payment_id.get_string_repr().to_string(),
self.merchant_account.get_id().get_string_repr(),
self.profile.get_id().get_string_repr(),
)
.await
}
| {
"chunk": null,
"crate": "subscriptions",
"enum_name": null,
"file_size": null,
"for_type": "InvoiceHandler",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update_payment",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_hsdev_InputData_read | clm | method | // hyperswitch/crates/hsdev/src/input_file.rs
// impl for InputData
pub fn read(db_table: &Value) -> Result<Self, toml::de::Error> {
db_table.clone().try_into()
}
| {
"chunk": null,
"crate": "hsdev",
"enum_name": null,
"file_size": null,
"for_type": "InputData",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "read",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_hsdev_InputData_postgres_url | clm | method | // hyperswitch/crates/hsdev/src/input_file.rs
// impl for InputData
pub fn postgres_url(&self) -> String {
format!(
"postgres://{}:{}@{}:{}/{}",
self.username, self.password, self.host, self.port, self.dbname
)
}
| {
"chunk": null,
"crate": "hsdev",
"enum_name": null,
"file_size": null,
"for_type": "InputData",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "postgres_url",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_EuclidKey_key_type | clm | method | // hyperswitch/crates/euclid/src/types.rs
// impl for EuclidKey
pub fn key_type(&self) -> DataType {
match self {
Self::PaymentMethod => DataType::EnumVariant,
Self::CardBin => DataType::StrValue,
Self::Metadata => DataType::MetadataValue,
Self::PaymentMethodType => DataType::EnumVariant,
Self::CardNetwork => DataType::EnumVariant,
Self::AuthenticationType => DataType::EnumVariant,
Self::CaptureMethod => DataType::EnumVariant,
Self::PaymentAmount => DataType::Number,
Self::PaymentCurrency => DataType::EnumVariant,
#[cfg(feature = "payouts")]
Self::PayoutCurrency => DataType::EnumVariant,
Self::BusinessCountry => DataType::EnumVariant,
Self::BillingCountry => DataType::EnumVariant,
Self::MandateType => DataType::EnumVariant,
Self::MandateAcceptanceType => DataType::EnumVariant,
Self::PaymentType => DataType::EnumVariant,
Self::BusinessLabel => DataType::StrValue,
Self::SetupFutureUsage => DataType::EnumVariant,
Self::IssuerName => DataType::StrValue,
Self::IssuerCountry => DataType::EnumVariant,
Self::AcquirerCountry => DataType::EnumVariant,
Self::AcquirerFraudRate => DataType::Number,
Self::CustomerDeviceType => DataType::EnumVariant,
Self::CustomerDeviceDisplaySize => DataType::EnumVariant,
Self::CustomerDevicePlatform => DataType::EnumVariant,
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "EuclidKey",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "key_type",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_NumValue_fits | clm | method | // hyperswitch/crates/euclid/src/types.rs
// impl for NumValue
pub fn fits(&self, other: &Self) -> bool {
let this_num = self.number;
let other_num = other.number;
match (&self.refinement, &other.refinement) {
(None, None) => this_num == other_num,
(Some(NumValueRefinement::GreaterThan), None) => other_num > this_num,
(Some(NumValueRefinement::LessThan), None) => other_num < this_num,
(Some(NumValueRefinement::NotEqual), Some(NumValueRefinement::NotEqual)) => {
other_num == this_num
}
(Some(NumValueRefinement::GreaterThan), Some(NumValueRefinement::GreaterThan)) => {
other_num > this_num
}
(Some(NumValueRefinement::LessThan), Some(NumValueRefinement::LessThan)) => {
other_num < this_num
}
(Some(NumValueRefinement::GreaterThanEqual), None) => other_num >= this_num,
(Some(NumValueRefinement::LessThanEqual), None) => other_num <= this_num,
(
Some(NumValueRefinement::GreaterThanEqual),
Some(NumValueRefinement::GreaterThanEqual),
) => other_num >= this_num,
(Some(NumValueRefinement::LessThanEqual), Some(NumValueRefinement::LessThanEqual)) => {
other_num <= this_num
}
_ => false,
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "NumValue",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "fits",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_EuclidValue_get_num_value | clm | method | // hyperswitch/crates/euclid/src/types.rs
// impl for EuclidValue
pub fn get_num_value(&self) -> Option<NumValue> {
match self {
Self::PaymentAmount(val) => Some(val.clone()),
_ => None,
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "EuclidValue",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_num_value",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_EuclidValue_get_key | clm | method | // hyperswitch/crates/euclid/src/types.rs
// impl for EuclidValue
pub fn get_key(&self) -> EuclidKey {
match self {
Self::PaymentMethod(_) => EuclidKey::PaymentMethod,
Self::CardBin(_) => EuclidKey::CardBin,
Self::Metadata(_) => EuclidKey::Metadata,
Self::PaymentMethodType(_) => EuclidKey::PaymentMethodType,
Self::MandateType(_) => EuclidKey::MandateType,
Self::PaymentType(_) => EuclidKey::PaymentType,
Self::MandateAcceptanceType(_) => EuclidKey::MandateAcceptanceType,
Self::CardNetwork(_) => EuclidKey::CardNetwork,
Self::AuthenticationType(_) => EuclidKey::AuthenticationType,
Self::CaptureMethod(_) => EuclidKey::CaptureMethod,
Self::PaymentAmount(_) => EuclidKey::PaymentAmount,
Self::PaymentCurrency(_) => EuclidKey::PaymentCurrency,
#[cfg(feature = "payouts")]
Self::PayoutCurrency(_) => EuclidKey::PayoutCurrency,
Self::BusinessCountry(_) => EuclidKey::BusinessCountry,
Self::BillingCountry(_) => EuclidKey::BillingCountry,
Self::BusinessLabel(_) => EuclidKey::BusinessLabel,
Self::SetupFutureUsage(_) => EuclidKey::SetupFutureUsage,
Self::IssuerName(_) => EuclidKey::IssuerName,
Self::IssuerCountry(_) => EuclidKey::IssuerCountry,
Self::AcquirerCountry(_) => EuclidKey::AcquirerCountry,
Self::AcquirerFraudRate(_) => EuclidKey::AcquirerFraudRate,
Self::CustomerDeviceType(_) => EuclidKey::CustomerDeviceType,
Self::CustomerDeviceDisplaySize(_) => EuclidKey::CustomerDeviceDisplaySize,
Self::CustomerDevicePlatform(_) => EuclidKey::CustomerDevicePlatform,
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "EuclidValue",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_key",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_BackendOutput<O>_get_output | clm | method | // hyperswitch/crates/euclid/src/backend.rs
// impl for BackendOutput<O>
pub fn get_output(&self) -> &O {
&self.connector_selection
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "BackendOutput<O>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_output",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_DirKey_new | clm | method | // hyperswitch/crates/euclid/src/frontend/dir.rs
// impl for DirKey
pub fn new(kind: DirKeyKind, value: Option<String>) -> Self {
Self { kind, value }
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "DirKey",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "new",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_DirKeyKind_get_type | clm | method | // hyperswitch/crates/euclid/src/frontend/dir.rs
// impl for DirKeyKind
pub fn get_type(&self) -> types::DataType {
match self {
Self::PaymentMethod => types::DataType::EnumVariant,
Self::CardBin => types::DataType::StrValue,
Self::CardType => types::DataType::EnumVariant,
Self::CardNetwork => types::DataType::EnumVariant,
Self::MetaData => types::DataType::MetadataValue,
Self::MandateType => types::DataType::EnumVariant,
Self::PaymentType => types::DataType::EnumVariant,
Self::MandateAcceptanceType => types::DataType::EnumVariant,
Self::PayLaterType => types::DataType::EnumVariant,
Self::WalletType => types::DataType::EnumVariant,
Self::UpiType => types::DataType::EnumVariant,
Self::VoucherType => types::DataType::EnumVariant,
Self::BankTransferType => types::DataType::EnumVariant,
Self::GiftCardType => types::DataType::EnumVariant,
Self::BankRedirectType => types::DataType::EnumVariant,
Self::CryptoType => types::DataType::EnumVariant,
Self::RewardType => types::DataType::EnumVariant,
Self::PaymentAmount => types::DataType::Number,
Self::PaymentCurrency => types::DataType::EnumVariant,
Self::AuthenticationType => types::DataType::EnumVariant,
Self::CaptureMethod => types::DataType::EnumVariant,
Self::BusinessCountry => types::DataType::EnumVariant,
Self::BillingCountry => types::DataType::EnumVariant,
Self::Connector => types::DataType::EnumVariant,
Self::BankDebitType => types::DataType::EnumVariant,
Self::BusinessLabel => types::DataType::StrValue,
Self::SetupFutureUsage => types::DataType::EnumVariant,
Self::CardRedirectType => types::DataType::EnumVariant,
Self::RealTimePaymentType => types::DataType::EnumVariant,
Self::OpenBankingType => types::DataType::EnumVariant,
Self::MobilePaymentType => types::DataType::EnumVariant,
Self::IssuerName => types::DataType::StrValue,
Self::IssuerCountry => types::DataType::EnumVariant,
Self::CustomerDevicePlatform => types::DataType::EnumVariant,
Self::CustomerDeviceType => types::DataType::EnumVariant,
Self::CustomerDeviceDisplaySize => types::DataType::EnumVariant,
Self::AcquirerCountry => types::DataType::EnumVariant,
Self::AcquirerFraudRate => types::DataType::Number,
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "DirKeyKind",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_type",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_DirKeyKind_get_value_set | clm | method | // hyperswitch/crates/euclid/src/frontend/dir.rs
// impl for DirKeyKind
pub fn get_value_set(&self) -> Option<Vec<DirValue>> {
match self {
Self::PaymentMethod => Some(
enums::PaymentMethod::iter()
.map(DirValue::PaymentMethod)
.collect(),
),
Self::CardBin => None,
Self::CardType => Some(enums::CardType::iter().map(DirValue::CardType).collect()),
Self::MandateAcceptanceType => Some(
euclid_enums::MandateAcceptanceType::iter()
.map(DirValue::MandateAcceptanceType)
.collect(),
),
Self::PaymentType => Some(
euclid_enums::PaymentType::iter()
.map(DirValue::PaymentType)
.collect(),
),
Self::MandateType => Some(
euclid_enums::MandateType::iter()
.map(DirValue::MandateType)
.collect(),
),
Self::CardNetwork => Some(
enums::CardNetwork::iter()
.map(DirValue::CardNetwork)
.collect(),
),
Self::PayLaterType => Some(
enums::PayLaterType::iter()
.map(DirValue::PayLaterType)
.collect(),
),
Self::MetaData => None,
Self::WalletType => Some(
enums::WalletType::iter()
.map(DirValue::WalletType)
.collect(),
),
Self::UpiType => Some(enums::UpiType::iter().map(DirValue::UpiType).collect()),
Self::VoucherType => Some(
enums::VoucherType::iter()
.map(DirValue::VoucherType)
.collect(),
),
Self::BankTransferType => Some(
enums::BankTransferType::iter()
.map(DirValue::BankTransferType)
.collect(),
),
Self::GiftCardType => Some(
enums::GiftCardType::iter()
.map(DirValue::GiftCardType)
.collect(),
),
Self::BankRedirectType => Some(
enums::BankRedirectType::iter()
.map(DirValue::BankRedirectType)
.collect(),
),
Self::CryptoType => Some(
enums::CryptoType::iter()
.map(DirValue::CryptoType)
.collect(),
),
Self::RewardType => Some(
enums::RewardType::iter()
.map(DirValue::RewardType)
.collect(),
),
Self::PaymentAmount => None,
Self::PaymentCurrency => Some(
enums::PaymentCurrency::iter()
.map(DirValue::PaymentCurrency)
.collect(),
),
Self::AuthenticationType => Some(
enums::AuthenticationType::iter()
.map(DirValue::AuthenticationType)
.collect(),
),
Self::CaptureMethod => Some(
enums::CaptureMethod::iter()
.map(DirValue::CaptureMethod)
.collect(),
),
Self::BankDebitType => Some(
enums::BankDebitType::iter()
.map(DirValue::BankDebitType)
.collect(),
),
Self::BusinessCountry => Some(
enums::Country::iter()
.map(DirValue::BusinessCountry)
.collect(),
),
Self::BillingCountry => Some(
enums::Country::iter()
.map(DirValue::BillingCountry)
.collect(),
),
Self::Connector => Some(
common_enums::RoutableConnectors::iter()
.map(|connector| {
DirValue::Connector(Box::new(ast::ConnectorChoice { connector }))
})
.collect(),
),
Self::BusinessLabel => None,
Self::SetupFutureUsage => Some(
enums::SetupFutureUsage::iter()
.map(DirValue::SetupFutureUsage)
.collect(),
),
Self::CardRedirectType => Some(
enums::CardRedirectType::iter()
.map(DirValue::CardRedirectType)
.collect(),
),
Self::RealTimePaymentType => Some(
enums::RealTimePaymentType::iter()
.map(DirValue::RealTimePaymentType)
.collect(),
),
Self::OpenBankingType => Some(
enums::OpenBankingType::iter()
.map(DirValue::OpenBankingType)
.collect(),
),
Self::MobilePaymentType => Some(
enums::MobilePaymentType::iter()
.map(DirValue::MobilePaymentType)
.collect(),
),
Self::IssuerName => None,
Self::IssuerCountry => Some(
enums::Country::iter()
.map(DirValue::IssuerCountry)
.collect(),
),
Self::CustomerDevicePlatform => Some(
enums::CustomerDevicePlatform::iter()
.map(DirValue::CustomerDevicePlatform)
.collect(),
),
Self::CustomerDeviceType => Some(
enums::CustomerDeviceType::iter()
.map(DirValue::CustomerDeviceType)
.collect(),
),
Self::CustomerDeviceDisplaySize => Some(
enums::CustomerDeviceDisplaySize::iter()
.map(DirValue::CustomerDeviceDisplaySize)
.collect(),
),
Self::AcquirerCountry => Some(
enums::Country::iter()
.map(DirValue::AcquirerCountry)
.collect(),
),
Self::AcquirerFraudRate => None,
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "DirKeyKind",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_value_set",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_DirValue_get_key | clm | method | // hyperswitch/crates/euclid/src/frontend/dir.rs
// impl for DirValue
pub fn get_key(&self) -> DirKey {
let (kind, data) = match self {
Self::PaymentMethod(_) => (DirKeyKind::PaymentMethod, None),
Self::CardBin(_) => (DirKeyKind::CardBin, None),
Self::RewardType(_) => (DirKeyKind::RewardType, None),
Self::BusinessCountry(_) => (DirKeyKind::BusinessCountry, None),
Self::BillingCountry(_) => (DirKeyKind::BillingCountry, None),
Self::BankTransferType(_) => (DirKeyKind::BankTransferType, None),
Self::UpiType(_) => (DirKeyKind::UpiType, None),
Self::CardType(_) => (DirKeyKind::CardType, None),
Self::CardNetwork(_) => (DirKeyKind::CardNetwork, None),
Self::MetaData(met) => (DirKeyKind::MetaData, Some(met.key.clone())),
Self::PayLaterType(_) => (DirKeyKind::PayLaterType, None),
Self::WalletType(_) => (DirKeyKind::WalletType, None),
Self::BankRedirectType(_) => (DirKeyKind::BankRedirectType, None),
Self::CryptoType(_) => (DirKeyKind::CryptoType, None),
Self::AuthenticationType(_) => (DirKeyKind::AuthenticationType, None),
Self::CaptureMethod(_) => (DirKeyKind::CaptureMethod, None),
Self::PaymentAmount(_) => (DirKeyKind::PaymentAmount, None),
Self::PaymentCurrency(_) => (DirKeyKind::PaymentCurrency, None),
Self::Connector(_) => (DirKeyKind::Connector, None),
Self::BankDebitType(_) => (DirKeyKind::BankDebitType, None),
Self::MandateAcceptanceType(_) => (DirKeyKind::MandateAcceptanceType, None),
Self::MandateType(_) => (DirKeyKind::MandateType, None),
Self::PaymentType(_) => (DirKeyKind::PaymentType, None),
Self::BusinessLabel(_) => (DirKeyKind::BusinessLabel, None),
Self::SetupFutureUsage(_) => (DirKeyKind::SetupFutureUsage, None),
Self::CardRedirectType(_) => (DirKeyKind::CardRedirectType, None),
Self::VoucherType(_) => (DirKeyKind::VoucherType, None),
Self::GiftCardType(_) => (DirKeyKind::GiftCardType, None),
Self::RealTimePaymentType(_) => (DirKeyKind::RealTimePaymentType, None),
Self::OpenBankingType(_) => (DirKeyKind::OpenBankingType, None),
Self::MobilePaymentType(_) => (DirKeyKind::MobilePaymentType, None),
Self::IssuerName(_) => (DirKeyKind::IssuerName, None),
Self::IssuerCountry(_) => (DirKeyKind::IssuerCountry, None),
Self::CustomerDevicePlatform(_) => (DirKeyKind::CustomerDevicePlatform, None),
Self::CustomerDeviceType(_) => (DirKeyKind::CustomerDeviceType, None),
Self::CustomerDeviceDisplaySize(_) => (DirKeyKind::CustomerDeviceDisplaySize, None),
Self::AcquirerCountry(_) => (DirKeyKind::AcquirerCountry, None),
Self::AcquirerFraudRate(_) => (DirKeyKind::AcquirerFraudRate, None),
};
DirKey::new(kind, data)
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "DirValue",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_key",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_DirValue_get_metadata_val | clm | method | // hyperswitch/crates/euclid/src/frontend/dir.rs
// impl for DirValue
pub fn get_metadata_val(&self) -> Option<types::MetadataValue> {
match self {
Self::MetaData(val) => Some(val.clone()),
Self::PaymentMethod(_) => None,
Self::CardBin(_) => None,
Self::CardType(_) => None,
Self::CardNetwork(_) => None,
Self::PayLaterType(_) => None,
Self::WalletType(_) => None,
Self::BankRedirectType(_) => None,
Self::CryptoType(_) => None,
Self::AuthenticationType(_) => None,
Self::CaptureMethod(_) => None,
Self::GiftCardType(_) => None,
Self::PaymentAmount(_) => None,
Self::PaymentCurrency(_) => None,
Self::BusinessCountry(_) => None,
Self::BillingCountry(_) => None,
Self::Connector(_) => None,
Self::BankTransferType(_) => None,
Self::UpiType(_) => None,
Self::BankDebitType(_) => None,
Self::RewardType(_) => None,
Self::VoucherType(_) => None,
Self::MandateAcceptanceType(_) => None,
Self::MandateType(_) => None,
Self::PaymentType(_) => None,
Self::BusinessLabel(_) => None,
Self::SetupFutureUsage(_) => None,
Self::CardRedirectType(_) => None,
Self::RealTimePaymentType(_) => None,
Self::OpenBankingType(_) => None,
Self::MobilePaymentType(_) => None,
Self::IssuerName(_) => None,
Self::IssuerCountry(_) => None,
Self::CustomerDevicePlatform(_) => None,
Self::CustomerDeviceType(_) => None,
Self::CustomerDeviceDisplaySize(_) => None,
Self::AcquirerCountry(_) => None,
Self::AcquirerFraudRate(_) => None,
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "DirValue",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_metadata_val",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_DirValue_get_str_val | clm | method | // hyperswitch/crates/euclid/src/frontend/dir.rs
// impl for DirValue
pub fn get_str_val(&self) -> Option<types::StrValue> {
match self {
Self::CardBin(val) => Some(val.clone()),
Self::IssuerName(val) => Some(val.clone()),
_ => None,
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "DirValue",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_str_val",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_DirValue_get_num_value | clm | method | // hyperswitch/crates/euclid/src/frontend/dir.rs
// impl for DirValue
pub fn get_num_value(&self) -> Option<types::NumValue> {
match self {
Self::PaymentAmount(val) => Some(val.clone()),
Self::AcquirerFraudRate(val) => Some(val.clone()),
_ => None,
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "DirValue",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_num_value",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_DirValue_check_equality | clm | method | // hyperswitch/crates/euclid/src/frontend/dir.rs
// impl for DirValue
pub fn check_equality(v1: &Self, v2: &Self) -> bool {
match (v1, v2) {
(Self::PaymentMethod(pm1), Self::PaymentMethod(pm2)) => pm1 == pm2,
(Self::CardType(ct1), Self::CardType(ct2)) => ct1 == ct2,
(Self::CardNetwork(cn1), Self::CardNetwork(cn2)) => cn1 == cn2,
(Self::MetaData(md1), Self::MetaData(md2)) => md1 == md2,
(Self::PayLaterType(plt1), Self::PayLaterType(plt2)) => plt1 == plt2,
(Self::WalletType(wt1), Self::WalletType(wt2)) => wt1 == wt2,
(Self::BankDebitType(bdt1), Self::BankDebitType(bdt2)) => bdt1 == bdt2,
(Self::BankRedirectType(brt1), Self::BankRedirectType(brt2)) => brt1 == brt2,
(Self::BankTransferType(btt1), Self::BankTransferType(btt2)) => btt1 == btt2,
(Self::GiftCardType(gct1), Self::GiftCardType(gct2)) => gct1 == gct2,
(Self::CryptoType(ct1), Self::CryptoType(ct2)) => ct1 == ct2,
(Self::AuthenticationType(at1), Self::AuthenticationType(at2)) => at1 == at2,
(Self::CaptureMethod(cm1), Self::CaptureMethod(cm2)) => cm1 == cm2,
(Self::PaymentCurrency(pc1), Self::PaymentCurrency(pc2)) => pc1 == pc2,
(Self::BusinessCountry(c1), Self::BusinessCountry(c2)) => c1 == c2,
(Self::BillingCountry(c1), Self::BillingCountry(c2)) => c1 == c2,
(Self::PaymentType(pt1), Self::PaymentType(pt2)) => pt1 == pt2,
(Self::MandateType(mt1), Self::MandateType(mt2)) => mt1 == mt2,
(Self::MandateAcceptanceType(mat1), Self::MandateAcceptanceType(mat2)) => mat1 == mat2,
(Self::RewardType(rt1), Self::RewardType(rt2)) => rt1 == rt2,
(Self::RealTimePaymentType(rtp1), Self::RealTimePaymentType(rtp2)) => rtp1 == rtp2,
(Self::Connector(c1), Self::Connector(c2)) => c1 == c2,
(Self::BusinessLabel(bl1), Self::BusinessLabel(bl2)) => bl1 == bl2,
(Self::SetupFutureUsage(sfu1), Self::SetupFutureUsage(sfu2)) => sfu1 == sfu2,
(Self::UpiType(ut1), Self::UpiType(ut2)) => ut1 == ut2,
(Self::VoucherType(vt1), Self::VoucherType(vt2)) => vt1 == vt2,
(Self::CardRedirectType(crt1), Self::CardRedirectType(crt2)) => crt1 == crt2,
(Self::IssuerName(n1), Self::IssuerName(n2)) => n1 == n2,
(Self::IssuerCountry(c1), Self::IssuerCountry(c2)) => c1 == c2,
(Self::CustomerDevicePlatform(p1), Self::CustomerDevicePlatform(p2)) => p1 == p2,
(Self::CustomerDeviceType(t1), Self::CustomerDeviceType(t2)) => t1 == t2,
(Self::CustomerDeviceDisplaySize(s1), Self::CustomerDeviceDisplaySize(s2)) => s1 == s2,
(Self::AcquirerCountry(c1), Self::AcquirerCountry(c2)) => c1 == c2,
(Self::AcquirerFraudRate(r1), Self::AcquirerFraudRate(r2)) => r1 == r2,
_ => false,
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "DirValue",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "check_equality",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_ValueType_get_type | clm | method | // hyperswitch/crates/euclid/src/frontend/ast.rs
// impl for ValueType
pub fn get_type(&self) -> DataType {
match self {
Self::Number(_) => DataType::Number,
Self::StrValue(_) => DataType::StrValue,
Self::MetadataVariant(_) => DataType::MetadataValue,
Self::EnumVariant(_) => DataType::EnumVariant,
Self::NumberComparisonArray(_) => DataType::Number,
Self::NumberArray(_) => DataType::Number,
Self::EnumVariantArray(_) => DataType::EnumVariant,
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "ValueType",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_type",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_VirInterpreterBackend<O>_eval_comparison | clm | method | // hyperswitch/crates/euclid/src/backend/vir_interpreter.rs
// impl for VirInterpreterBackend<O>
fn eval_comparison(comp: &vir::ValuedComparison, ctx: &types::Context) -> bool {
match &comp.logic {
vir::ValuedComparisonLogic::PositiveDisjunction => {
comp.values.iter().any(|v| ctx.check_presence(v))
}
vir::ValuedComparisonLogic::NegativeConjunction => {
comp.values.iter().all(|v| !ctx.check_presence(v))
}
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "VirInterpreterBackend<O>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "eval_comparison",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_VirInterpreterBackend<O>_eval_condition | clm | method | // hyperswitch/crates/euclid/src/backend/vir_interpreter.rs
// impl for VirInterpreterBackend<O>
fn eval_condition(cond: &vir::ValuedIfCondition, ctx: &types::Context) -> bool {
cond.iter().all(|comp| Self::eval_comparison(comp, ctx))
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "VirInterpreterBackend<O>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "eval_condition",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_VirInterpreterBackend<O>_eval_statement | clm | method | // hyperswitch/crates/euclid/src/backend/vir_interpreter.rs
// impl for VirInterpreterBackend<O>
fn eval_statement(stmt: &vir::ValuedIfStatement, ctx: &types::Context) -> bool {
if Self::eval_condition(&stmt.condition, ctx) {
{
stmt.nested.as_ref().is_none_or(|nested_stmts| {
nested_stmts.iter().any(|s| Self::eval_statement(s, ctx))
})
}
} else {
false
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "VirInterpreterBackend<O>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "eval_statement",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_VirInterpreterBackend<O>_eval_rule | clm | method | // hyperswitch/crates/euclid/src/backend/vir_interpreter.rs
// impl for VirInterpreterBackend<O>
fn eval_rule(rule: &vir::ValuedRule<O>, ctx: &types::Context) -> bool {
rule.statements
.iter()
.any(|stmt| Self::eval_statement(stmt, ctx))
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "VirInterpreterBackend<O>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "eval_rule",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_VirInterpreterBackend<O>_eval_program | clm | method | // hyperswitch/crates/euclid/src/backend/vir_interpreter.rs
// impl for VirInterpreterBackend<O>
fn eval_program(
program: &vir::ValuedProgram<O>,
ctx: &types::Context,
) -> backend::BackendOutput<O> {
program
.rules
.iter()
.find(|rule| Self::eval_rule(rule, ctx))
.map_or_else(
|| backend::BackendOutput {
connector_selection: program.default_selection.clone(),
rule_name: None,
},
|rule| backend::BackendOutput {
connector_selection: rule.connector_selection.clone(),
rule_name: Some(rule.name.clone()),
},
)
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "VirInterpreterBackend<O>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "eval_program",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_ComparisonStateMachine<'a>_reset | clm | method | // hyperswitch/crates/euclid/src/dssa/state_machine.rs
// impl for ComparisonStateMachine<'a>
fn reset(&mut self) {
self.count = 0;
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "ComparisonStateMachine<'a>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "reset",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_ComparisonStateMachine<'a>_put | clm | method | // hyperswitch/crates/euclid/src/dssa/state_machine.rs
// impl for ComparisonStateMachine<'a>
fn put(&self, context: &mut types::ConjunctiveContext<'a>) -> Result<(), StateMachineError> {
if let dir::DirComparisonLogic::PositiveDisjunction = self.logic {
*context
.get_mut(self.ctx_idx)
.ok_or(StateMachineError::IndexOutOfBounds(
"in ComparisonStateMachine while indexing into context",
))? = types::ContextValue::assertion(
self.values
.get(self.count)
.ok_or(StateMachineError::IndexOutOfBounds(
"in ComparisonStateMachine while indexing into values",
))?,
self.metadata,
);
}
Ok(())
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "ComparisonStateMachine<'a>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "put",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_ComparisonStateMachine<'a>_push | clm | method | // hyperswitch/crates/euclid/src/dssa/state_machine.rs
// impl for ComparisonStateMachine<'a>
fn push(&self, context: &mut types::ConjunctiveContext<'a>) -> Result<(), StateMachineError> {
match self.logic {
dir::DirComparisonLogic::PositiveDisjunction => {
context.push(types::ContextValue::assertion(
self.values
.get(self.count)
.ok_or(StateMachineError::IndexOutOfBounds(
"in ComparisonStateMachine while pushing",
))?,
self.metadata,
));
}
dir::DirComparisonLogic::NegativeConjunction => {
context.push(types::ContextValue::negation(self.values, self.metadata));
}
}
Ok(())
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "ComparisonStateMachine<'a>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "push",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_IfStmtStateMachine<'a>_destroy | clm | method | // hyperswitch/crates/euclid/src/dssa/state_machine.rs
// impl for IfStmtStateMachine<'a>
fn destroy(&self, context: &mut types::ConjunctiveContext<'a>) {
self.condition_machine.destroy(context);
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "IfStmtStateMachine<'a>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "destroy",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_IfStmtStateMachine<'a>_is_condition_machine_finished | clm | method | // hyperswitch/crates/euclid/src/dssa/state_machine.rs
// impl for IfStmtStateMachine<'a>
fn is_condition_machine_finished(&self) -> bool {
self.condition_machine.is_finished()
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "IfStmtStateMachine<'a>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "is_condition_machine_finished",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_IfStmtStateMachine<'a>_advance_condition_machine | clm | method | // hyperswitch/crates/euclid/src/dssa/state_machine.rs
// impl for IfStmtStateMachine<'a>
fn advance_condition_machine(
&mut self,
context: &mut types::ConjunctiveContext<'a>,
) -> Result<(), StateMachineError> {
self.condition_machine.advance(context)?;
Ok(())
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "IfStmtStateMachine<'a>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "advance_condition_machine",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_RuleContextManager<'a>_advance_mut | clm | method | // hyperswitch/crates/euclid/src/dssa/state_machine.rs
// impl for RuleContextManager<'a>
pub fn advance_mut(
&mut self,
) -> Result<Option<&mut types::ConjunctiveContext<'a>>, StateMachineError> {
if !self.init {
self.init = true;
self.machine.init_next(&mut self.context)?;
Ok(Some(&mut self.context))
} else if self.machine.is_finished() {
Ok(None)
} else {
self.machine.advance(&mut self.context)?;
if self.machine.is_finished() {
Ok(None)
} else {
Ok(Some(&mut self.context))
}
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "RuleContextManager<'a>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "advance_mut",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_ProgramStateMachine<'a>_is_finished | clm | method | // hyperswitch/crates/euclid/src/dssa/state_machine.rs
// impl for ProgramStateMachine<'a>
pub fn is_finished(&self) -> bool {
self.current_rule_machine
.as_ref()
.is_none_or(|rsm| rsm.is_finished())
&& self.rule_machines.is_empty()
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "ProgramStateMachine<'a>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "is_finished",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_ProgramStateMachine<'a>_init | clm | method | // hyperswitch/crates/euclid/src/dssa/state_machine.rs
// impl for ProgramStateMachine<'a>
pub fn init(
&mut self,
context: &mut types::ConjunctiveContext<'a>,
) -> Result<(), StateMachineError> {
if !self.is_init {
if let Some(rsm) = self.current_rule_machine.as_mut() {
rsm.init_next(context)?;
}
self.is_init = true;
}
Ok(())
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "ProgramStateMachine<'a>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "init",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_AnalysisContextManager<'a>_advance | clm | method | // hyperswitch/crates/euclid/src/dssa/state_machine.rs
// impl for AnalysisContextManager<'a>
pub fn advance(&mut self) -> Result<Option<&types::ConjunctiveContext<'a>>, StateMachineError> {
if !self.init {
self.init = true;
self.machine.init(&mut self.context)?;
Ok(Some(&self.context))
} else if self.machine.is_finished() {
Ok(None)
} else {
self.machine.advance(&mut self.context)?;
if self.machine.is_finished() {
Ok(None)
} else {
Ok(Some(&self.context))
}
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "AnalysisContextManager<'a>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "advance",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_AnalysisContextManager<'a>_new | clm | method | // hyperswitch/crates/euclid/src/dssa/state_machine.rs
// impl for AnalysisContextManager<'a>
pub fn new<O>(
program: &'a dir::DirProgram<O>,
connector_selection_data: &'a [Vec<(dir::DirValue, Metadata)>],
) -> Self {
let machine = ProgramStateMachine::new(program, connector_selection_data);
let context: types::ConjunctiveContext<'a> = Vec::new();
Self {
context,
machine,
init: false,
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "AnalysisContextManager<'a>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "new",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_CtxValueKind<'_>_get_assertion | clm | method | // hyperswitch/crates/euclid/src/dssa/types.rs
// impl for CtxValueKind<'_>
pub fn get_assertion(&self) -> Option<&dir::DirValue> {
if let Self::Assertion(val) = self {
Some(val)
} else {
None
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "CtxValueKind<'_>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_assertion",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_CtxValueKind<'_>_get_negation | clm | method | // hyperswitch/crates/euclid/src/dssa/types.rs
// impl for CtxValueKind<'_>
pub fn get_negation(&self) -> Option<&[dir::DirValue]> {
if let Self::Negation(vals) = self {
Some(vals)
} else {
None
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "CtxValueKind<'_>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_negation",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_CtxValueKind<'_>_get_key | clm | method | // hyperswitch/crates/euclid/src/dssa/types.rs
// impl for CtxValueKind<'_>
pub fn get_key(&self) -> Option<dir::DirKey> {
match self {
Self::Assertion(val) => Some(val.get_key()),
Self::Negation(vals) => vals.first().map(|v| (*v).get_key()),
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "CtxValueKind<'_>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_key",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_ContextValue<'a>_assertion | clm | method | // hyperswitch/crates/euclid/src/dssa/types.rs
// impl for ContextValue<'a>
pub fn assertion(value: &'a dir::DirValue, metadata: &'a Metadata) -> Self {
Self {
value: CtxValueKind::Assertion(value),
metadata,
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "ContextValue<'a>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "assertion",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_ContextValue<'a>_negation | clm | method | // hyperswitch/crates/euclid/src/dssa/types.rs
// impl for ContextValue<'a>
pub fn negation(values: &'a [dir::DirValue], metadata: &'a Metadata) -> Self {
Self {
value: CtxValueKind::Negation(values),
metadata,
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "ContextValue<'a>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "negation",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_AnalysisError<V>_assertion_from_graph_error | clm | method | // hyperswitch/crates/euclid/src/dssa/graph.rs
// impl for AnalysisError<V>
fn assertion_from_graph_error(metadata: &Metadata, graph_error: cgraph::GraphError<V>) -> Self {
match graph_error {
cgraph::GraphError::AnalysisError(trace) => Self::AssertionTrace {
trace,
metadata: metadata.clone(),
},
other => Self::Graph(other),
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "AnalysisError<V>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "assertion_from_graph_error",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_euclid_AnalysisError<V>_negation_from_graph_error | clm | method | // hyperswitch/crates/euclid/src/dssa/graph.rs
// impl for AnalysisError<V>
fn negation_from_graph_error(
metadata: Vec<&Metadata>,
graph_error: cgraph::GraphError<V>,
) -> Self {
match graph_error {
cgraph::GraphError::AnalysisError(trace) => Self::NegationTrace {
trace,
metadata: metadata.iter().map(|m| (*m).clone()).collect(),
},
other => Self::Graph(other),
}
}
| {
"chunk": null,
"crate": "euclid",
"enum_name": null,
"file_size": null,
"for_type": "AnalysisError<V>",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "negation_from_graph_error",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_api_models_PaymentMethodCreate_get_payment_method_create_from_payment_method_migrate | clm | method | // hyperswitch/crates/api_models/src/payment_methods.rs
// impl for PaymentMethodCreate
pub fn get_payment_method_create_from_payment_method_migrate(
card_number: CardNumber,
payment_method_migrate: &PaymentMethodMigrate,
) -> Self {
let card_details =
payment_method_migrate
.card
.as_ref()
.map(|payment_method_migrate_card| CardDetail {
card_number,
card_exp_month: payment_method_migrate_card.card_exp_month.clone(),
card_exp_year: payment_method_migrate_card.card_exp_year.clone(),
card_holder_name: payment_method_migrate_card.card_holder_name.clone(),
nick_name: payment_method_migrate_card.nick_name.clone(),
card_issuing_country: payment_method_migrate_card.card_issuing_country.clone(),
card_network: payment_method_migrate_card.card_network.clone(),
card_issuer: payment_method_migrate_card.card_issuer.clone(),
card_type: payment_method_migrate_card.card_type.clone(),
});
Self {
customer_id: payment_method_migrate.customer_id.clone(),
payment_method: payment_method_migrate.payment_method,
payment_method_type: payment_method_migrate.payment_method_type,
payment_method_issuer: payment_method_migrate.payment_method_issuer.clone(),
payment_method_issuer_code: payment_method_migrate.payment_method_issuer_code,
metadata: payment_method_migrate.metadata.clone(),
payment_method_data: payment_method_migrate.payment_method_data.clone(),
connector_mandate_details: payment_method_migrate
.connector_mandate_details
.clone()
.map(|common_mandate_reference| {
PaymentsMandateReference::from(common_mandate_reference)
}),
client_secret: None,
billing: payment_method_migrate.billing.clone(),
card: card_details,
card_network: payment_method_migrate.card_network.clone(),
#[cfg(feature = "payouts")]
bank_transfer: payment_method_migrate.bank_transfer.clone(),
#[cfg(feature = "payouts")]
wallet: payment_method_migrate.wallet.clone(),
network_transaction_id: payment_method_migrate.network_transaction_id.clone(),
}
}
| {
"chunk": null,
"crate": "api_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethodCreate",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_payment_method_create_from_payment_method_migrate",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_api_models_PaymentMethodCreate_validate_payment_method_data_against_payment_method | clm | method | // hyperswitch/crates/api_models/src/payment_methods.rs
// impl for PaymentMethodCreate
pub fn validate_payment_method_data_against_payment_method(
payment_method_type: api_enums::PaymentMethod,
payment_method_data: PaymentMethodCreateData,
) -> bool {
match payment_method_type {
api_enums::PaymentMethod::Card => {
matches!(
payment_method_data,
PaymentMethodCreateData::Card(_) | PaymentMethodCreateData::ProxyCard(_)
)
}
_ => false,
}
}
| {
"chunk": null,
"crate": "api_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethodCreate",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "validate_payment_method_data_against_payment_method",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_api_models_PaymentMethodCreate_get_tokenize_connector_id | clm | method | // hyperswitch/crates/api_models/src/payment_methods.rs
// impl for PaymentMethodCreate
pub fn get_tokenize_connector_id(
&self,
) -> Result<id_type::MerchantConnectorAccountId, error_stack::Report<errors::ValidationError>>
{
self.psp_tokenization
.clone()
.get_required_value("psp_tokenization")
.map(|psp| psp.connector_id)
}
| {
"chunk": null,
"crate": "api_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethodCreate",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_tokenize_connector_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_api_models_CardDetailUpdate_apply | clm | method | // hyperswitch/crates/api_models/src/payment_methods.rs
// impl for CardDetailUpdate
pub fn apply(&self, card_data_from_locker: Card) -> CardDetail {
CardDetail {
card_number: card_data_from_locker.card_number,
card_exp_month: card_data_from_locker.card_exp_month,
card_exp_year: card_data_from_locker.card_exp_year,
card_holder_name: self
.card_holder_name
.clone()
.or(card_data_from_locker.name_on_card),
nick_name: self
.nick_name
.clone()
.or(card_data_from_locker.nick_name.map(masking::Secret::new)),
card_issuing_country: None,
card_network: None,
card_issuer: None,
card_type: None,
card_cvc: None,
}
}
| {
"chunk": null,
"crate": "api_models",
"enum_name": null,
"file_size": null,
"for_type": "CardDetailUpdate",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "apply",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.