id stringlengths 20 153 | type stringclasses 1 value | granularity stringclasses 14 values | content stringlengths 16 84.3k | metadata dict |
|---|---|---|---|---|
connector-service_snippet_-7010937598925635194_400_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub txn_token: Secret<String>, // From CreateSessionToken
}
#[derive(Debug, Serialize)]
pub struct PaytmNativeProcessRequestBody {
#[serde(rename = "requestType")]
pub request_type: String, // "NATIVE"
pub mid: Secret<String>,
#[serde(rename = "orderId")]
pub order_id: String,
#[serde(rename = "paymentMode")]
pub payment_mode: String, // "UPI"
#[serde(rename = "payerAccount")]
pub payer_account: Option<String>, // UPI VPA for collect
#[serde(rename = "channelCode")]
pub channel_code: Option<String>, // Gateway code
#[serde(rename = "channelId")]
pub channel_id: String, // "WEB"
#[serde(rename = "txnToken")]
pub txn_token: Secret<String>, // From CreateSessionToken
#[serde(rename = "authMode")]
pub auth_mode: Option<String>, // "DEBIT_PIN"
}
// Authorize flow response structures
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmProcessTxnResponse {
pub head: PaytmProcessHead,
pub body: PaytmProcessRespBodyTypes,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 400,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_400_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub txn_token: Secret<String>, // From CreateSessionToken
}
#[derive(Debug, Serialize)]
pub struct PaytmNativeProcessRequestBody {
#[serde(rename = "requestType")]
pub request_type: String, // "NATIVE"
pub mid: Secret<String>,
#[serde(rename = "orderId")]
pub order_id: String,
#[serde(rename = "paymentMode")]
pub payment_mode: String, // "UPI"
#[serde(rename = "payerAccount")]
pub payer_account: Option<String>, // UPI VPA for collect
#[serde(rename = "channelCode")]
pub channel_code: Option<String>, // Gateway code
#[serde(rename = "channelId")]
pub channel_id: String, // "WEB"
#[serde(rename = "txnToken")]
pub txn_token: Secret<String>, // From CreateSessionToken
#[serde(rename = "authMode")]
pub auth_mode: Option<String>, // "DEBIT_PIN"
}
// Authorize flow response structures
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmProcessTxnResponse {
pub head: PaytmProcessHead,
pub body: PaytmProcessRespBodyTypes,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmProcessHead {
pub version: Option<String>,
#[serde(rename = "responseTimestamp")]
pub response_timestamp: String,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum PaytmProcessRespBodyTypes {
SuccessBody(Box<PaytmProcessSuccessResp>),
FailureBody(PaytmProcessFailureResp),
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmProcessSuccessResp {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 400,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_425_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmProcessTxnResponse {
pub head: PaytmProcessHead,
pub body: PaytmProcessRespBodyTypes,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmProcessHead {
pub version: Option<String>,
#[serde(rename = "responseTimestamp")]
pub response_timestamp: String,
}
#[derive(Debug, Deserialize, Serialize)]
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 425,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_425_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmProcessTxnResponse {
pub head: PaytmProcessHead,
pub body: PaytmProcessRespBodyTypes,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmProcessHead {
pub version: Option<String>,
#[serde(rename = "responseTimestamp")]
pub response_timestamp: String,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum PaytmProcessRespBodyTypes {
SuccessBody(Box<PaytmProcessSuccessResp>),
FailureBody(PaytmProcessFailureResp),
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmProcessSuccessResp {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
#[serde(rename = "deepLinkInfo", skip_serializing_if = "Option::is_none")]
pub deep_link_info: Option<PaytmDeepLinkInfo>,
#[serde(rename = "bankForm", skip_serializing_if = "Option::is_none")]
pub bank_form: Option<serde_json::Value>,
#[serde(rename = "upiDirectForm", skip_serializing_if = "Option::is_none")]
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 425,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_425_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmProcessTxnResponse {
pub head: PaytmProcessHead,
pub body: PaytmProcessRespBodyTypes,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmProcessHead {
pub version: Option<String>,
#[serde(rename = "responseTimestamp")]
pub response_timestamp: String,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum PaytmProcessRespBodyTypes {
SuccessBody(Box<PaytmProcessSuccessResp>),
FailureBody(PaytmProcessFailureResp),
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmProcessSuccessResp {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
#[serde(rename = "deepLinkInfo", skip_serializing_if = "Option::is_none")]
pub deep_link_info: Option<PaytmDeepLinkInfo>,
#[serde(rename = "bankForm", skip_serializing_if = "Option::is_none")]
pub bank_form: Option<serde_json::Value>,
#[serde(rename = "upiDirectForm", skip_serializing_if = "Option::is_none")]
pub upi_direct_form: Option<serde_json::Value>,
#[serde(rename = "displayField", skip_serializing_if = "Option::is_none")]
pub display_field: Option<serde_json::Value>,
#[serde(rename = "riskContent", skip_serializing_if = "Option::is_none")]
pub risk_content: Option<serde_json::Value>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmDeepLinkInfo {
#[serde(rename = "deepLink")]
pub deep_link: String, // UPI intent URL
#[serde(rename = "orderId")]
pub order_id: String,
#[serde(rename = "cashierRequestId")]
pub cashier_request_id: String,
#[serde(rename = "transId")]
pub trans_id: String,
}
#[derive(Debug, Deserialize, Serialize)]
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 425,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_450_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
#[serde(rename = "deepLinkInfo", skip_serializing_if = "Option::is_none")]
pub deep_link_info: Option<PaytmDeepLinkInfo>,
#[serde(rename = "bankForm", skip_serializing_if = "Option::is_none")]
pub bank_form: Option<serde_json::Value>,
#[serde(rename = "upiDirectForm", skip_serializing_if = "Option::is_none")]
pub upi_direct_form: Option<serde_json::Value>,
#[serde(rename = "displayField", skip_serializing_if = "Option::is_none")]
pub display_field: Option<serde_json::Value>,
#[serde(rename = "riskContent", skip_serializing_if = "Option::is_none")]
pub risk_content: Option<serde_json::Value>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmDeepLinkInfo {
#[serde(rename = "deepLink")]
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 450,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_450_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
#[serde(rename = "deepLinkInfo", skip_serializing_if = "Option::is_none")]
pub deep_link_info: Option<PaytmDeepLinkInfo>,
#[serde(rename = "bankForm", skip_serializing_if = "Option::is_none")]
pub bank_form: Option<serde_json::Value>,
#[serde(rename = "upiDirectForm", skip_serializing_if = "Option::is_none")]
pub upi_direct_form: Option<serde_json::Value>,
#[serde(rename = "displayField", skip_serializing_if = "Option::is_none")]
pub display_field: Option<serde_json::Value>,
#[serde(rename = "riskContent", skip_serializing_if = "Option::is_none")]
pub risk_content: Option<serde_json::Value>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmDeepLinkInfo {
#[serde(rename = "deepLink")]
pub deep_link: String, // UPI intent URL
#[serde(rename = "orderId")]
pub order_id: String,
#[serde(rename = "cashierRequestId")]
pub cashier_request_id: String,
#[serde(rename = "transId")]
pub trans_id: String,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmProcessFailureResp {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 450,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_450_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
#[serde(rename = "deepLinkInfo", skip_serializing_if = "Option::is_none")]
pub deep_link_info: Option<PaytmDeepLinkInfo>,
#[serde(rename = "bankForm", skip_serializing_if = "Option::is_none")]
pub bank_form: Option<serde_json::Value>,
#[serde(rename = "upiDirectForm", skip_serializing_if = "Option::is_none")]
pub upi_direct_form: Option<serde_json::Value>,
#[serde(rename = "displayField", skip_serializing_if = "Option::is_none")]
pub display_field: Option<serde_json::Value>,
#[serde(rename = "riskContent", skip_serializing_if = "Option::is_none")]
pub risk_content: Option<serde_json::Value>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmDeepLinkInfo {
#[serde(rename = "deepLink")]
pub deep_link: String, // UPI intent URL
#[serde(rename = "orderId")]
pub order_id: String,
#[serde(rename = "cashierRequestId")]
pub cashier_request_id: String,
#[serde(rename = "transId")]
pub trans_id: String,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmProcessFailureResp {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
}
// UPI Collect Native Process Response
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmNativeProcessTxnResponse {
pub head: PaytmProcessHead,
pub body: PaytmNativeProcessRespBodyTypes,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum PaytmNativeProcessRespBodyTypes {
SuccessBody(PaytmNativeProcessSuccessResp),
FailureBody(PaytmNativeProcessFailureResp),
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmNativeProcessSuccessResp {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
#[serde(rename = "transId")]
pub trans_id: String,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 450,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_475_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub struct PaytmProcessFailureResp {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
}
// UPI Collect Native Process Response
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmNativeProcessTxnResponse {
pub head: PaytmProcessHead,
pub body: PaytmNativeProcessRespBodyTypes,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum PaytmNativeProcessRespBodyTypes {
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 475,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_475_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub struct PaytmProcessFailureResp {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
}
// UPI Collect Native Process Response
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmNativeProcessTxnResponse {
pub head: PaytmProcessHead,
pub body: PaytmNativeProcessRespBodyTypes,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum PaytmNativeProcessRespBodyTypes {
SuccessBody(PaytmNativeProcessSuccessResp),
FailureBody(PaytmNativeProcessFailureResp),
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmNativeProcessSuccessResp {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
#[serde(rename = "transId")]
pub trans_id: String,
#[serde(rename = "orderId")]
pub order_id: String,
}
#[derive(Debug, Deserialize, Serialize)]
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 475,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_475_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub struct PaytmProcessFailureResp {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
}
// UPI Collect Native Process Response
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmNativeProcessTxnResponse {
pub head: PaytmProcessHead,
pub body: PaytmNativeProcessRespBodyTypes,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum PaytmNativeProcessRespBodyTypes {
SuccessBody(PaytmNativeProcessSuccessResp),
FailureBody(PaytmNativeProcessFailureResp),
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmNativeProcessSuccessResp {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
#[serde(rename = "transId")]
pub trans_id: String,
#[serde(rename = "orderId")]
pub order_id: String,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmNativeProcessFailureResp {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
}
// Helper function for UPI VPA extraction
pub fn extract_upi_vpa<T: domain_types::payment_method_data::PaymentMethodDataTypes>(
payment_method_data: &PaymentMethodData<T>,
) -> CustomResult<Option<String>, errors::ConnectorError> {
match payment_method_data {
PaymentMethodData::Upi(UpiData::UpiCollect(collect_data)) => {
if let Some(vpa_id) = &collect_data.vpa_id {
let vpa = vpa_id.peek().to_string();
if vpa.contains('@') && vpa.len() > 3 {
Ok(Some(vpa))
} else {
Err(errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_INVALID_VPA.to_string(),
)
.into())
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 475,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_500_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
#[serde(rename = "orderId")]
pub order_id: String,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmNativeProcessFailureResp {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
}
// Helper function for UPI VPA extraction
pub fn extract_upi_vpa<T: domain_types::payment_method_data::PaymentMethodDataTypes>(
payment_method_data: &PaymentMethodData<T>,
) -> CustomResult<Option<String>, errors::ConnectorError> {
match payment_method_data {
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 500,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_500_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
#[serde(rename = "orderId")]
pub order_id: String,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmNativeProcessFailureResp {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
}
// Helper function for UPI VPA extraction
pub fn extract_upi_vpa<T: domain_types::payment_method_data::PaymentMethodDataTypes>(
payment_method_data: &PaymentMethodData<T>,
) -> CustomResult<Option<String>, errors::ConnectorError> {
match payment_method_data {
PaymentMethodData::Upi(UpiData::UpiCollect(collect_data)) => {
if let Some(vpa_id) = &collect_data.vpa_id {
let vpa = vpa_id.peek().to_string();
if vpa.contains('@') && vpa.len() > 3 {
Ok(Some(vpa))
} else {
Err(errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_INVALID_VPA.to_string(),
)
.into())
}
} else {
Err(errors::ConnectorError::MissingRequiredField {
field_name: "vpa_id",
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 500,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_500_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
#[serde(rename = "orderId")]
pub order_id: String,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmNativeProcessFailureResp {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
}
// Helper function for UPI VPA extraction
pub fn extract_upi_vpa<T: domain_types::payment_method_data::PaymentMethodDataTypes>(
payment_method_data: &PaymentMethodData<T>,
) -> CustomResult<Option<String>, errors::ConnectorError> {
match payment_method_data {
PaymentMethodData::Upi(UpiData::UpiCollect(collect_data)) => {
if let Some(vpa_id) = &collect_data.vpa_id {
let vpa = vpa_id.peek().to_string();
if vpa.contains('@') && vpa.len() > 3 {
Ok(Some(vpa))
} else {
Err(errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_INVALID_VPA.to_string(),
)
.into())
}
} else {
Err(errors::ConnectorError::MissingRequiredField {
field_name: "vpa_id",
}
.into())
}
}
_ => Ok(None),
}
}
// Paytm signature generation algorithm implementation
// Following exact PayTM v2 algorithm from Haskell codebase
pub fn generate_paytm_signature(
payload: &str,
merchant_key: &str,
) -> CustomResult<String, errors::ConnectorError> {
// Step 1: Generate random salt bytes using ring (same logic, different implementation)
let rng = SystemRandom::new();
let mut salt_bytes = [0u8; constants::SALT_LENGTH];
rng.fill(&mut salt_bytes).map_err(|_| {
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_SALT_GENERATION.to_string(),
)
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 500,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_525_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
}
} else {
Err(errors::ConnectorError::MissingRequiredField {
field_name: "vpa_id",
}
.into())
}
}
_ => Ok(None),
}
}
// Paytm signature generation algorithm implementation
// Following exact PayTM v2 algorithm from Haskell codebase
pub fn generate_paytm_signature(
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 525,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_525_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
}
} else {
Err(errors::ConnectorError::MissingRequiredField {
field_name: "vpa_id",
}
.into())
}
}
_ => Ok(None),
}
}
// Paytm signature generation algorithm implementation
// Following exact PayTM v2 algorithm from Haskell codebase
pub fn generate_paytm_signature(
payload: &str,
merchant_key: &str,
) -> CustomResult<String, errors::ConnectorError> {
// Step 1: Generate random salt bytes using ring (same logic, different implementation)
let rng = SystemRandom::new();
let mut salt_bytes = [0u8; constants::SALT_LENGTH];
rng.fill(&mut salt_bytes).map_err(|_| {
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_SALT_GENERATION.to_string(),
)
})?;
// Step 2: Convert salt to Base64 (same logic)
let salt_b64 = general_purpose::STANDARD.encode(salt_bytes);
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 525,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_525_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
}
} else {
Err(errors::ConnectorError::MissingRequiredField {
field_name: "vpa_id",
}
.into())
}
}
_ => Ok(None),
}
}
// Paytm signature generation algorithm implementation
// Following exact PayTM v2 algorithm from Haskell codebase
pub fn generate_paytm_signature(
payload: &str,
merchant_key: &str,
) -> CustomResult<String, errors::ConnectorError> {
// Step 1: Generate random salt bytes using ring (same logic, different implementation)
let rng = SystemRandom::new();
let mut salt_bytes = [0u8; constants::SALT_LENGTH];
rng.fill(&mut salt_bytes).map_err(|_| {
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_SALT_GENERATION.to_string(),
)
})?;
// Step 2: Convert salt to Base64 (same logic)
let salt_b64 = general_purpose::STANDARD.encode(salt_bytes);
// Step 3: Create hash input: payload + "|" + base64_salt (same logic)
let hash_input = format!("{payload}|{salt_b64}");
// Step 4: SHA-256 hash using ring (same logic, different implementation)
let hash_digest = digest::digest(&digest::SHA256, hash_input.as_bytes());
let sha256_hash = hex::encode(hash_digest.as_ref());
// Step 5: Create checksum: sha256_hash + base64_salt (same logic)
let checksum = format!("{sha256_hash}{salt_b64}");
// Step 6: AES encrypt checksum with merchant key (same logic)
let signature = aes_encrypt(&checksum, merchant_key)?;
Ok(signature)
}
// AES-CBC encryption implementation for PayTM v2
// This follows the exact PayTMv1 encrypt function used by PayTMv2:
// - Fixed IV: "@@@@&&&&####$$$$" (16 bytes) - exact value from Haskell code
// - Key length determines AES variant: 16→AES-128, 24→AES-192, other→AES-256
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 525,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_550_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
})?;
// Step 2: Convert salt to Base64 (same logic)
let salt_b64 = general_purpose::STANDARD.encode(salt_bytes);
// Step 3: Create hash input: payload + "|" + base64_salt (same logic)
let hash_input = format!("{payload}|{salt_b64}");
// Step 4: SHA-256 hash using ring (same logic, different implementation)
let hash_digest = digest::digest(&digest::SHA256, hash_input.as_bytes());
let sha256_hash = hex::encode(hash_digest.as_ref());
// Step 5: Create checksum: sha256_hash + base64_salt (same logic)
let checksum = format!("{sha256_hash}{salt_b64}");
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 550,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_550_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
})?;
// Step 2: Convert salt to Base64 (same logic)
let salt_b64 = general_purpose::STANDARD.encode(salt_bytes);
// Step 3: Create hash input: payload + "|" + base64_salt (same logic)
let hash_input = format!("{payload}|{salt_b64}");
// Step 4: SHA-256 hash using ring (same logic, different implementation)
let hash_digest = digest::digest(&digest::SHA256, hash_input.as_bytes());
let sha256_hash = hex::encode(hash_digest.as_ref());
// Step 5: Create checksum: sha256_hash + base64_salt (same logic)
let checksum = format!("{sha256_hash}{salt_b64}");
// Step 6: AES encrypt checksum with merchant key (same logic)
let signature = aes_encrypt(&checksum, merchant_key)?;
Ok(signature)
}
// AES-CBC encryption implementation for PayTM v2
// This follows the exact PayTMv1 encrypt function used by PayTMv2:
// - Fixed IV: "@@@@&&&&####$$$$" (16 bytes) - exact value from Haskell code
// - Key length determines AES variant: 16→AES-128, 24→AES-192, other→AES-256
// - Mode: CBC with PKCS7 padding (16-byte blocks)
// - Output: Base64 encoded encrypted data
fn aes_encrypt(data: &str, key: &str) -> CustomResult<String, errors::ConnectorError> {
// PayTM uses fixed IV as specified in PayTMv1 implementation
let iv = get_paytm_iv();
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 550,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_550_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
})?;
// Step 2: Convert salt to Base64 (same logic)
let salt_b64 = general_purpose::STANDARD.encode(salt_bytes);
// Step 3: Create hash input: payload + "|" + base64_salt (same logic)
let hash_input = format!("{payload}|{salt_b64}");
// Step 4: SHA-256 hash using ring (same logic, different implementation)
let hash_digest = digest::digest(&digest::SHA256, hash_input.as_bytes());
let sha256_hash = hex::encode(hash_digest.as_ref());
// Step 5: Create checksum: sha256_hash + base64_salt (same logic)
let checksum = format!("{sha256_hash}{salt_b64}");
// Step 6: AES encrypt checksum with merchant key (same logic)
let signature = aes_encrypt(&checksum, merchant_key)?;
Ok(signature)
}
// AES-CBC encryption implementation for PayTM v2
// This follows the exact PayTMv1 encrypt function used by PayTMv2:
// - Fixed IV: "@@@@&&&&####$$$$" (16 bytes) - exact value from Haskell code
// - Key length determines AES variant: 16→AES-128, 24→AES-192, other→AES-256
// - Mode: CBC with PKCS7 padding (16-byte blocks)
// - Output: Base64 encoded encrypted data
fn aes_encrypt(data: &str, key: &str) -> CustomResult<String, errors::ConnectorError> {
// PayTM uses fixed IV as specified in PayTMv1 implementation
let iv = get_paytm_iv();
let key_bytes = key.as_bytes();
let data_bytes = data.as_bytes();
// Determine AES variant based on key length (following PayTMv1 Haskell implementation)
match key_bytes.len() {
constants::AES_128_KEY_LENGTH => {
// AES-128-CBC with PKCS7 padding
type Aes128CbcEnc = Encryptor<Aes128>;
let mut key_array = [0u8; constants::AES_128_KEY_LENGTH];
key_array.copy_from_slice(key_bytes);
let encryptor = Aes128CbcEnc::new(&key_array.into(), &iv.into());
// Encrypt with proper buffer management
let mut buffer = Vec::with_capacity(data_bytes.len() + constants::AES_BUFFER_PADDING);
buffer.extend_from_slice(data_bytes);
buffer.resize(buffer.len() + constants::AES_BUFFER_PADDING, 0);
let encrypted_len = encryptor
.encrypt_padded_mut::<Pkcs7>(&mut buffer, data_bytes.len())
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 550,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_575_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
// - Mode: CBC with PKCS7 padding (16-byte blocks)
// - Output: Base64 encoded encrypted data
fn aes_encrypt(data: &str, key: &str) -> CustomResult<String, errors::ConnectorError> {
// PayTM uses fixed IV as specified in PayTMv1 implementation
let iv = get_paytm_iv();
let key_bytes = key.as_bytes();
let data_bytes = data.as_bytes();
// Determine AES variant based on key length (following PayTMv1 Haskell implementation)
match key_bytes.len() {
constants::AES_128_KEY_LENGTH => {
// AES-128-CBC with PKCS7 padding
type Aes128CbcEnc = Encryptor<Aes128>;
let mut key_array = [0u8; constants::AES_128_KEY_LENGTH];
key_array.copy_from_slice(key_bytes);
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 575,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_575_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
// - Mode: CBC with PKCS7 padding (16-byte blocks)
// - Output: Base64 encoded encrypted data
fn aes_encrypt(data: &str, key: &str) -> CustomResult<String, errors::ConnectorError> {
// PayTM uses fixed IV as specified in PayTMv1 implementation
let iv = get_paytm_iv();
let key_bytes = key.as_bytes();
let data_bytes = data.as_bytes();
// Determine AES variant based on key length (following PayTMv1 Haskell implementation)
match key_bytes.len() {
constants::AES_128_KEY_LENGTH => {
// AES-128-CBC with PKCS7 padding
type Aes128CbcEnc = Encryptor<Aes128>;
let mut key_array = [0u8; constants::AES_128_KEY_LENGTH];
key_array.copy_from_slice(key_bytes);
let encryptor = Aes128CbcEnc::new(&key_array.into(), &iv.into());
// Encrypt with proper buffer management
let mut buffer = Vec::with_capacity(data_bytes.len() + constants::AES_BUFFER_PADDING);
buffer.extend_from_slice(data_bytes);
buffer.resize(buffer.len() + constants::AES_BUFFER_PADDING, 0);
let encrypted_len = encryptor
.encrypt_padded_mut::<Pkcs7>(&mut buffer, data_bytes.len())
.map_err(|_| {
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_AES_128_ENCRYPTION.to_string(),
)
})?
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 575,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_575_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
// - Mode: CBC with PKCS7 padding (16-byte blocks)
// - Output: Base64 encoded encrypted data
fn aes_encrypt(data: &str, key: &str) -> CustomResult<String, errors::ConnectorError> {
// PayTM uses fixed IV as specified in PayTMv1 implementation
let iv = get_paytm_iv();
let key_bytes = key.as_bytes();
let data_bytes = data.as_bytes();
// Determine AES variant based on key length (following PayTMv1 Haskell implementation)
match key_bytes.len() {
constants::AES_128_KEY_LENGTH => {
// AES-128-CBC with PKCS7 padding
type Aes128CbcEnc = Encryptor<Aes128>;
let mut key_array = [0u8; constants::AES_128_KEY_LENGTH];
key_array.copy_from_slice(key_bytes);
let encryptor = Aes128CbcEnc::new(&key_array.into(), &iv.into());
// Encrypt with proper buffer management
let mut buffer = Vec::with_capacity(data_bytes.len() + constants::AES_BUFFER_PADDING);
buffer.extend_from_slice(data_bytes);
buffer.resize(buffer.len() + constants::AES_BUFFER_PADDING, 0);
let encrypted_len = encryptor
.encrypt_padded_mut::<Pkcs7>(&mut buffer, data_bytes.len())
.map_err(|_| {
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_AES_128_ENCRYPTION.to_string(),
)
})?
.len();
buffer.truncate(encrypted_len);
Ok(general_purpose::STANDARD.encode(&buffer))
}
constants::AES_192_KEY_LENGTH => {
// AES-192-CBC with PKCS7 padding
type Aes192CbcEnc = Encryptor<Aes192>;
let mut key_array = [0u8; constants::AES_192_KEY_LENGTH];
key_array.copy_from_slice(key_bytes);
let encryptor = Aes192CbcEnc::new(&key_array.into(), &iv.into());
let mut buffer = Vec::with_capacity(data_bytes.len() + constants::AES_BUFFER_PADDING);
buffer.extend_from_slice(data_bytes);
buffer.resize(buffer.len() + constants::AES_BUFFER_PADDING, 0);
let encrypted_len = encryptor
.encrypt_padded_mut::<Pkcs7>(&mut buffer, data_bytes.len())
.map_err(|_| {
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 575,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_600_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
.map_err(|_| {
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_AES_128_ENCRYPTION.to_string(),
)
})?
.len();
buffer.truncate(encrypted_len);
Ok(general_purpose::STANDARD.encode(&buffer))
}
constants::AES_192_KEY_LENGTH => {
// AES-192-CBC with PKCS7 padding
type Aes192CbcEnc = Encryptor<Aes192>;
let mut key_array = [0u8; constants::AES_192_KEY_LENGTH];
key_array.copy_from_slice(key_bytes);
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 600,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_600_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
.map_err(|_| {
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_AES_128_ENCRYPTION.to_string(),
)
})?
.len();
buffer.truncate(encrypted_len);
Ok(general_purpose::STANDARD.encode(&buffer))
}
constants::AES_192_KEY_LENGTH => {
// AES-192-CBC with PKCS7 padding
type Aes192CbcEnc = Encryptor<Aes192>;
let mut key_array = [0u8; constants::AES_192_KEY_LENGTH];
key_array.copy_from_slice(key_bytes);
let encryptor = Aes192CbcEnc::new(&key_array.into(), &iv.into());
let mut buffer = Vec::with_capacity(data_bytes.len() + constants::AES_BUFFER_PADDING);
buffer.extend_from_slice(data_bytes);
buffer.resize(buffer.len() + constants::AES_BUFFER_PADDING, 0);
let encrypted_len = encryptor
.encrypt_padded_mut::<Pkcs7>(&mut buffer, data_bytes.len())
.map_err(|_| {
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_AES_192_ENCRYPTION.to_string(),
)
})?
.len();
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 600,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_600_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
.map_err(|_| {
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_AES_128_ENCRYPTION.to_string(),
)
})?
.len();
buffer.truncate(encrypted_len);
Ok(general_purpose::STANDARD.encode(&buffer))
}
constants::AES_192_KEY_LENGTH => {
// AES-192-CBC with PKCS7 padding
type Aes192CbcEnc = Encryptor<Aes192>;
let mut key_array = [0u8; constants::AES_192_KEY_LENGTH];
key_array.copy_from_slice(key_bytes);
let encryptor = Aes192CbcEnc::new(&key_array.into(), &iv.into());
let mut buffer = Vec::with_capacity(data_bytes.len() + constants::AES_BUFFER_PADDING);
buffer.extend_from_slice(data_bytes);
buffer.resize(buffer.len() + constants::AES_BUFFER_PADDING, 0);
let encrypted_len = encryptor
.encrypt_padded_mut::<Pkcs7>(&mut buffer, data_bytes.len())
.map_err(|_| {
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_AES_192_ENCRYPTION.to_string(),
)
})?
.len();
buffer.truncate(encrypted_len);
Ok(general_purpose::STANDARD.encode(&buffer))
}
_ => {
// Default to AES-256-CBC with PKCS7 padding (for any other key length)
type Aes256CbcEnc = Encryptor<Aes256>;
// For AES-256, we need exactly 32 bytes, so pad or truncate the key
let mut aes256_key = [0u8; constants::AES_256_KEY_LENGTH];
let copy_len = cmp::min(key_bytes.len(), constants::AES_256_KEY_LENGTH);
aes256_key[..copy_len].copy_from_slice(&key_bytes[..copy_len]);
let encryptor = Aes256CbcEnc::new(&aes256_key.into(), &iv.into());
let mut buffer = Vec::with_capacity(data_bytes.len() + constants::AES_BUFFER_PADDING);
buffer.extend_from_slice(data_bytes);
buffer.resize(buffer.len() + constants::AES_BUFFER_PADDING, 0);
let encrypted_len = encryptor
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 600,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_625_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_AES_192_ENCRYPTION.to_string(),
)
})?
.len();
buffer.truncate(encrypted_len);
Ok(general_purpose::STANDARD.encode(&buffer))
}
_ => {
// Default to AES-256-CBC with PKCS7 padding (for any other key length)
type Aes256CbcEnc = Encryptor<Aes256>;
// For AES-256, we need exactly 32 bytes, so pad or truncate the key
let mut aes256_key = [0u8; constants::AES_256_KEY_LENGTH];
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 625,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_625_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_AES_192_ENCRYPTION.to_string(),
)
})?
.len();
buffer.truncate(encrypted_len);
Ok(general_purpose::STANDARD.encode(&buffer))
}
_ => {
// Default to AES-256-CBC with PKCS7 padding (for any other key length)
type Aes256CbcEnc = Encryptor<Aes256>;
// For AES-256, we need exactly 32 bytes, so pad or truncate the key
let mut aes256_key = [0u8; constants::AES_256_KEY_LENGTH];
let copy_len = cmp::min(key_bytes.len(), constants::AES_256_KEY_LENGTH);
aes256_key[..copy_len].copy_from_slice(&key_bytes[..copy_len]);
let encryptor = Aes256CbcEnc::new(&aes256_key.into(), &iv.into());
let mut buffer = Vec::with_capacity(data_bytes.len() + constants::AES_BUFFER_PADDING);
buffer.extend_from_slice(data_bytes);
buffer.resize(buffer.len() + constants::AES_BUFFER_PADDING, 0);
let encrypted_len = encryptor
.encrypt_padded_mut::<Pkcs7>(&mut buffer, data_bytes.len())
.map_err(|_| {
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_AES_256_ENCRYPTION.to_string(),
)
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 625,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_625_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_AES_192_ENCRYPTION.to_string(),
)
})?
.len();
buffer.truncate(encrypted_len);
Ok(general_purpose::STANDARD.encode(&buffer))
}
_ => {
// Default to AES-256-CBC with PKCS7 padding (for any other key length)
type Aes256CbcEnc = Encryptor<Aes256>;
// For AES-256, we need exactly 32 bytes, so pad or truncate the key
let mut aes256_key = [0u8; constants::AES_256_KEY_LENGTH];
let copy_len = cmp::min(key_bytes.len(), constants::AES_256_KEY_LENGTH);
aes256_key[..copy_len].copy_from_slice(&key_bytes[..copy_len]);
let encryptor = Aes256CbcEnc::new(&aes256_key.into(), &iv.into());
let mut buffer = Vec::with_capacity(data_bytes.len() + constants::AES_BUFFER_PADDING);
buffer.extend_from_slice(data_bytes);
buffer.resize(buffer.len() + constants::AES_BUFFER_PADDING, 0);
let encrypted_len = encryptor
.encrypt_padded_mut::<Pkcs7>(&mut buffer, data_bytes.len())
.map_err(|_| {
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_AES_256_ENCRYPTION.to_string(),
)
})?
.len();
buffer.truncate(encrypted_len);
Ok(general_purpose::STANDARD.encode(&buffer))
}
}
}
// Fixed IV for Paytm AES encryption (from PayTM v2 Haskell implementation)
// IV value: "@@@@&&&&####$$$$" (16 characters) - exact value from Haskell codebase
fn get_paytm_iv() -> [u8; 16] {
// This is the exact IV used by PayTM v2 as found in the Haskell codebase
*constants::PAYTM_IV
}
pub fn create_paytm_header(
request_body: &impl serde::Serialize,
auth: &PaytmAuthType,
) -> CustomResult<PaytmRequestHeader, errors::ConnectorError> {
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 625,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_650_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
.encrypt_padded_mut::<Pkcs7>(&mut buffer, data_bytes.len())
.map_err(|_| {
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_AES_256_ENCRYPTION.to_string(),
)
})?
.len();
buffer.truncate(encrypted_len);
Ok(general_purpose::STANDARD.encode(&buffer))
}
}
}
// Fixed IV for Paytm AES encryption (from PayTM v2 Haskell implementation)
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 650,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_650_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
.encrypt_padded_mut::<Pkcs7>(&mut buffer, data_bytes.len())
.map_err(|_| {
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_AES_256_ENCRYPTION.to_string(),
)
})?
.len();
buffer.truncate(encrypted_len);
Ok(general_purpose::STANDARD.encode(&buffer))
}
}
}
// Fixed IV for Paytm AES encryption (from PayTM v2 Haskell implementation)
// IV value: "@@@@&&&&####$$$$" (16 characters) - exact value from Haskell codebase
fn get_paytm_iv() -> [u8; 16] {
// This is the exact IV used by PayTM v2 as found in the Haskell codebase
*constants::PAYTM_IV
}
pub fn create_paytm_header(
request_body: &impl serde::Serialize,
auth: &PaytmAuthType,
) -> CustomResult<PaytmRequestHeader, errors::ConnectorError> {
let _payload = serde_json::to_string(request_body)
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
let signature = generate_paytm_signature(&_payload, auth.merchant_key.peek())?;
let timestamp = SystemTime::now()
.duration_since(UNIX_EPOCH)
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 650,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_650_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
.encrypt_padded_mut::<Pkcs7>(&mut buffer, data_bytes.len())
.map_err(|_| {
errors::ConnectorError::RequestEncodingFailedWithReason(
constants::ERROR_AES_256_ENCRYPTION.to_string(),
)
})?
.len();
buffer.truncate(encrypted_len);
Ok(general_purpose::STANDARD.encode(&buffer))
}
}
}
// Fixed IV for Paytm AES encryption (from PayTM v2 Haskell implementation)
// IV value: "@@@@&&&&####$$$$" (16 characters) - exact value from Haskell codebase
fn get_paytm_iv() -> [u8; 16] {
// This is the exact IV used by PayTM v2 as found in the Haskell codebase
*constants::PAYTM_IV
}
pub fn create_paytm_header(
request_body: &impl serde::Serialize,
auth: &PaytmAuthType,
) -> CustomResult<PaytmRequestHeader, errors::ConnectorError> {
let _payload = serde_json::to_string(request_body)
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
let signature = generate_paytm_signature(&_payload, auth.merchant_key.peek())?;
let timestamp = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs()
.to_string();
Ok(PaytmRequestHeader {
client_id: auth.client_id.clone(), // None
version: constants::API_VERSION.to_string(),
request_timestamp: timestamp,
channel_id: auth.channel_id.clone(), // "WEB"
signature: Secret::new(signature),
})
}
// Helper struct for RouterData transformation
#[derive(Debug, Clone)]
pub struct PaytmRouterData {
pub amount: StringMajorUnit,
pub currency: Currency,
pub payment_id: String,
pub customer_id: Option<String>,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 650,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_675_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
let _payload = serde_json::to_string(request_body)
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
let signature = generate_paytm_signature(&_payload, auth.merchant_key.peek())?;
let timestamp = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs()
.to_string();
Ok(PaytmRequestHeader {
client_id: auth.client_id.clone(), // None
version: constants::API_VERSION.to_string(),
request_timestamp: timestamp,
channel_id: auth.channel_id.clone(), // "WEB"
signature: Secret::new(signature),
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 675,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_675_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
let _payload = serde_json::to_string(request_body)
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
let signature = generate_paytm_signature(&_payload, auth.merchant_key.peek())?;
let timestamp = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs()
.to_string();
Ok(PaytmRequestHeader {
client_id: auth.client_id.clone(), // None
version: constants::API_VERSION.to_string(),
request_timestamp: timestamp,
channel_id: auth.channel_id.clone(), // "WEB"
signature: Secret::new(signature),
})
}
// Helper struct for RouterData transformation
#[derive(Debug, Clone)]
pub struct PaytmRouterData {
pub amount: StringMajorUnit,
pub currency: Currency,
pub payment_id: String,
pub customer_id: Option<String>,
pub email: Option<Email>,
pub phone: Option<Secret<String>>,
pub first_name: Option<Secret<String>>,
pub last_name: Option<Secret<String>>,
pub return_url: Option<String>,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 675,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_675_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
let _payload = serde_json::to_string(request_body)
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
let signature = generate_paytm_signature(&_payload, auth.merchant_key.peek())?;
let timestamp = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs()
.to_string();
Ok(PaytmRequestHeader {
client_id: auth.client_id.clone(), // None
version: constants::API_VERSION.to_string(),
request_timestamp: timestamp,
channel_id: auth.channel_id.clone(), // "WEB"
signature: Secret::new(signature),
})
}
// Helper struct for RouterData transformation
#[derive(Debug, Clone)]
pub struct PaytmRouterData {
pub amount: StringMajorUnit,
pub currency: Currency,
pub payment_id: String,
pub customer_id: Option<String>,
pub email: Option<Email>,
pub phone: Option<Secret<String>>,
pub first_name: Option<Secret<String>>,
pub last_name: Option<Secret<String>>,
pub return_url: Option<String>,
}
// Helper struct for Authorize flow RouterData transformation
#[derive(Debug, Clone)]
pub struct PaytmAuthorizeRouterData<T: domain_types::payment_method_data::PaymentMethodDataTypes> {
pub amount: StringMajorUnit,
pub currency: Currency,
pub payment_id: String,
pub session_token: Secret<String>,
pub payment_method_data: PaymentMethodData<T>,
pub customer_id: Option<String>,
pub email: Option<Email>,
pub phone: Option<Secret<String>>,
pub first_name: Option<Secret<String>>,
pub last_name: Option<Secret<String>>,
pub return_url: Option<String>,
}
// Request transformation for CreateSessionToken flow
impl PaytmRouterData {
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 675,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_700_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub email: Option<Email>,
pub phone: Option<Secret<String>>,
pub first_name: Option<Secret<String>>,
pub last_name: Option<Secret<String>>,
pub return_url: Option<String>,
}
// Helper struct for Authorize flow RouterData transformation
#[derive(Debug, Clone)]
pub struct PaytmAuthorizeRouterData<T: domain_types::payment_method_data::PaymentMethodDataTypes> {
pub amount: StringMajorUnit,
pub currency: Currency,
pub payment_id: String,
pub session_token: Secret<String>,
pub payment_method_data: PaymentMethodData<T>,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 700,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_700_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub email: Option<Email>,
pub phone: Option<Secret<String>>,
pub first_name: Option<Secret<String>>,
pub last_name: Option<Secret<String>>,
pub return_url: Option<String>,
}
// Helper struct for Authorize flow RouterData transformation
#[derive(Debug, Clone)]
pub struct PaytmAuthorizeRouterData<T: domain_types::payment_method_data::PaymentMethodDataTypes> {
pub amount: StringMajorUnit,
pub currency: Currency,
pub payment_id: String,
pub session_token: Secret<String>,
pub payment_method_data: PaymentMethodData<T>,
pub customer_id: Option<String>,
pub email: Option<Email>,
pub phone: Option<Secret<String>>,
pub first_name: Option<Secret<String>>,
pub last_name: Option<Secret<String>>,
pub return_url: Option<String>,
}
// Request transformation for CreateSessionToken flow
impl PaytmRouterData {
pub fn try_from_with_converter(
item: &RouterDataV2<
CreateSessionToken,
PaymentFlowData,
SessionTokenRequestData,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 700,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_700_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub email: Option<Email>,
pub phone: Option<Secret<String>>,
pub first_name: Option<Secret<String>>,
pub last_name: Option<Secret<String>>,
pub return_url: Option<String>,
}
// Helper struct for Authorize flow RouterData transformation
#[derive(Debug, Clone)]
pub struct PaytmAuthorizeRouterData<T: domain_types::payment_method_data::PaymentMethodDataTypes> {
pub amount: StringMajorUnit,
pub currency: Currency,
pub payment_id: String,
pub session_token: Secret<String>,
pub payment_method_data: PaymentMethodData<T>,
pub customer_id: Option<String>,
pub email: Option<Email>,
pub phone: Option<Secret<String>>,
pub first_name: Option<Secret<String>>,
pub last_name: Option<Secret<String>>,
pub return_url: Option<String>,
}
// Request transformation for CreateSessionToken flow
impl PaytmRouterData {
pub fn try_from_with_converter(
item: &RouterDataV2<
CreateSessionToken,
PaymentFlowData,
SessionTokenRequestData,
SessionTokenResponseData,
>,
amount_converter: &dyn AmountConvertor<Output = StringMajorUnit>,
) -> Result<Self, error_stack::Report<errors::ConnectorError>> {
let amount = amount_converter
.convert(item.request.amount, item.request.currency)
.change_context(errors::ConnectorError::AmountConversionFailed)?;
let customer_id = item
.resource_common_data
.get_customer_id()
.ok()
.map(|id| id.get_string_repr().to_string());
let email = item.resource_common_data.get_optional_billing_email();
let phone = item
.resource_common_data
.get_optional_billing_phone_number();
let first_name = item.resource_common_data.get_optional_billing_first_name();
let last_name = item.resource_common_data.get_optional_billing_last_name();
Ok(Self {
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 700,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_725_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub fn try_from_with_converter(
item: &RouterDataV2<
CreateSessionToken,
PaymentFlowData,
SessionTokenRequestData,
SessionTokenResponseData,
>,
amount_converter: &dyn AmountConvertor<Output = StringMajorUnit>,
) -> Result<Self, error_stack::Report<errors::ConnectorError>> {
let amount = amount_converter
.convert(item.request.amount, item.request.currency)
.change_context(errors::ConnectorError::AmountConversionFailed)?;
let customer_id = item
.resource_common_data
.get_customer_id()
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 725,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_725_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub fn try_from_with_converter(
item: &RouterDataV2<
CreateSessionToken,
PaymentFlowData,
SessionTokenRequestData,
SessionTokenResponseData,
>,
amount_converter: &dyn AmountConvertor<Output = StringMajorUnit>,
) -> Result<Self, error_stack::Report<errors::ConnectorError>> {
let amount = amount_converter
.convert(item.request.amount, item.request.currency)
.change_context(errors::ConnectorError::AmountConversionFailed)?;
let customer_id = item
.resource_common_data
.get_customer_id()
.ok()
.map(|id| id.get_string_repr().to_string());
let email = item.resource_common_data.get_optional_billing_email();
let phone = item
.resource_common_data
.get_optional_billing_phone_number();
let first_name = item.resource_common_data.get_optional_billing_first_name();
let last_name = item.resource_common_data.get_optional_billing_last_name();
Ok(Self {
amount,
currency: item.request.currency,
payment_id: item
.resource_common_data
.connector_request_reference_id
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 725,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_725_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub fn try_from_with_converter(
item: &RouterDataV2<
CreateSessionToken,
PaymentFlowData,
SessionTokenRequestData,
SessionTokenResponseData,
>,
amount_converter: &dyn AmountConvertor<Output = StringMajorUnit>,
) -> Result<Self, error_stack::Report<errors::ConnectorError>> {
let amount = amount_converter
.convert(item.request.amount, item.request.currency)
.change_context(errors::ConnectorError::AmountConversionFailed)?;
let customer_id = item
.resource_common_data
.get_customer_id()
.ok()
.map(|id| id.get_string_repr().to_string());
let email = item.resource_common_data.get_optional_billing_email();
let phone = item
.resource_common_data
.get_optional_billing_phone_number();
let first_name = item.resource_common_data.get_optional_billing_first_name();
let last_name = item.resource_common_data.get_optional_billing_last_name();
Ok(Self {
amount,
currency: item.request.currency,
payment_id: item
.resource_common_data
.connector_request_reference_id
.clone(),
customer_id,
email,
phone,
first_name,
last_name,
return_url: item.resource_common_data.get_return_url(),
})
}
}
// Request body transformation for PayTM initiate transaction
impl PaytmInitiateTxnRequest {
pub fn try_from_with_auth(
item: &PaytmRouterData,
auth: &PaytmAuthType,
) -> CustomResult<Self, errors::ConnectorError> {
let body = PaytmInitiateReqBody {
request_type: constants::REQUEST_TYPE_PAYMENT.to_string(),
mid: Secret::new(auth.merchant_id.peek().to_string()),
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 725,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_750_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
amount,
currency: item.request.currency,
payment_id: item
.resource_common_data
.connector_request_reference_id
.clone(),
customer_id,
email,
phone,
first_name,
last_name,
return_url: item.resource_common_data.get_return_url(),
})
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 750,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_750_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
amount,
currency: item.request.currency,
payment_id: item
.resource_common_data
.connector_request_reference_id
.clone(),
customer_id,
email,
phone,
first_name,
last_name,
return_url: item.resource_common_data.get_return_url(),
})
}
}
// Request body transformation for PayTM initiate transaction
impl PaytmInitiateTxnRequest {
pub fn try_from_with_auth(
item: &PaytmRouterData,
auth: &PaytmAuthType,
) -> CustomResult<Self, errors::ConnectorError> {
let body = PaytmInitiateReqBody {
request_type: constants::REQUEST_TYPE_PAYMENT.to_string(),
mid: Secret::new(auth.merchant_id.peek().to_string()),
order_id: item.payment_id.clone(),
website_name: Secret::new(auth.website.peek().to_string()),
txn_amount: PaytmAmount {
value: item.amount.clone(),
currency: item.currency,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 750,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_750_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
amount,
currency: item.request.currency,
payment_id: item
.resource_common_data
.connector_request_reference_id
.clone(),
customer_id,
email,
phone,
first_name,
last_name,
return_url: item.resource_common_data.get_return_url(),
})
}
}
// Request body transformation for PayTM initiate transaction
impl PaytmInitiateTxnRequest {
pub fn try_from_with_auth(
item: &PaytmRouterData,
auth: &PaytmAuthType,
) -> CustomResult<Self, errors::ConnectorError> {
let body = PaytmInitiateReqBody {
request_type: constants::REQUEST_TYPE_PAYMENT.to_string(),
mid: Secret::new(auth.merchant_id.peek().to_string()),
order_id: item.payment_id.clone(),
website_name: Secret::new(auth.website.peek().to_string()),
txn_amount: PaytmAmount {
value: item.amount.clone(),
currency: item.currency,
},
user_info: PaytmUserInfo {
cust_id: item
.customer_id
.clone()
.unwrap_or_else(|| constants::DEFAULT_CUSTOMER_ID.to_string()),
mobile: item.phone.clone(),
email: item.email.clone(),
first_name: item.first_name.clone(),
last_name: item.last_name.clone(),
},
enable_payment_mode: vec![PaytmEnableMethod {
mode: constants::PAYMENT_MODE_UPI.to_string(),
channels: Some(vec![
constants::UPI_CHANNEL_UPIPUSH.to_string(),
constants::PAYMENT_MODE_UPI.to_string(),
]),
}],
callback_url: item
.return_url
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 750,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_775_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
order_id: item.payment_id.clone(),
website_name: Secret::new(auth.website.peek().to_string()),
txn_amount: PaytmAmount {
value: item.amount.clone(),
currency: item.currency,
},
user_info: PaytmUserInfo {
cust_id: item
.customer_id
.clone()
.unwrap_or_else(|| constants::DEFAULT_CUSTOMER_ID.to_string()),
mobile: item.phone.clone(),
email: item.email.clone(),
first_name: item.first_name.clone(),
last_name: item.last_name.clone(),
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 775,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_775_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
order_id: item.payment_id.clone(),
website_name: Secret::new(auth.website.peek().to_string()),
txn_amount: PaytmAmount {
value: item.amount.clone(),
currency: item.currency,
},
user_info: PaytmUserInfo {
cust_id: item
.customer_id
.clone()
.unwrap_or_else(|| constants::DEFAULT_CUSTOMER_ID.to_string()),
mobile: item.phone.clone(),
email: item.email.clone(),
first_name: item.first_name.clone(),
last_name: item.last_name.clone(),
},
enable_payment_mode: vec![PaytmEnableMethod {
mode: constants::PAYMENT_MODE_UPI.to_string(),
channels: Some(vec![
constants::UPI_CHANNEL_UPIPUSH.to_string(),
constants::PAYMENT_MODE_UPI.to_string(),
]),
}],
callback_url: item
.return_url
.clone()
.unwrap_or_else(|| constants::DEFAULT_CALLBACK_URL.to_string()),
};
// Create header with actual signature
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 775,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_775_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
order_id: item.payment_id.clone(),
website_name: Secret::new(auth.website.peek().to_string()),
txn_amount: PaytmAmount {
value: item.amount.clone(),
currency: item.currency,
},
user_info: PaytmUserInfo {
cust_id: item
.customer_id
.clone()
.unwrap_or_else(|| constants::DEFAULT_CUSTOMER_ID.to_string()),
mobile: item.phone.clone(),
email: item.email.clone(),
first_name: item.first_name.clone(),
last_name: item.last_name.clone(),
},
enable_payment_mode: vec![PaytmEnableMethod {
mode: constants::PAYMENT_MODE_UPI.to_string(),
channels: Some(vec![
constants::UPI_CHANNEL_UPIPUSH.to_string(),
constants::PAYMENT_MODE_UPI.to_string(),
]),
}],
callback_url: item
.return_url
.clone()
.unwrap_or_else(|| constants::DEFAULT_CALLBACK_URL.to_string()),
};
// Create header with actual signature
let head = create_paytm_header(&body, auth)?;
Ok(Self { head, body })
}
}
// Request transformation for Authorize flow
impl<T: domain_types::payment_method_data::PaymentMethodDataTypes> PaytmAuthorizeRouterData<T> {
pub fn try_from_with_converter(
item: &RouterDataV2<
Authorize,
PaymentFlowData,
PaymentsAuthorizeData<T>,
PaymentsResponseData,
>,
amount_converter: &dyn AmountConvertor<Output = StringMajorUnit>,
) -> Result<Self, error_stack::Report<errors::ConnectorError>> {
let amount = amount_converter
.convert(item.request.minor_amount, item.request.currency)
.change_context(errors::ConnectorError::AmountConversionFailed)?;
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 775,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_800_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
.clone()
.unwrap_or_else(|| constants::DEFAULT_CALLBACK_URL.to_string()),
};
// Create header with actual signature
let head = create_paytm_header(&body, auth)?;
Ok(Self { head, body })
}
}
// Request transformation for Authorize flow
impl<T: domain_types::payment_method_data::PaymentMethodDataTypes> PaytmAuthorizeRouterData<T> {
pub fn try_from_with_converter(
item: &RouterDataV2<
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 800,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_800_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
.clone()
.unwrap_or_else(|| constants::DEFAULT_CALLBACK_URL.to_string()),
};
// Create header with actual signature
let head = create_paytm_header(&body, auth)?;
Ok(Self { head, body })
}
}
// Request transformation for Authorize flow
impl<T: domain_types::payment_method_data::PaymentMethodDataTypes> PaytmAuthorizeRouterData<T> {
pub fn try_from_with_converter(
item: &RouterDataV2<
Authorize,
PaymentFlowData,
PaymentsAuthorizeData<T>,
PaymentsResponseData,
>,
amount_converter: &dyn AmountConvertor<Output = StringMajorUnit>,
) -> Result<Self, error_stack::Report<errors::ConnectorError>> {
let amount = amount_converter
.convert(item.request.minor_amount, item.request.currency)
.change_context(errors::ConnectorError::AmountConversionFailed)?;
let customer_id = item
.resource_common_data
.get_customer_id()
.ok()
.map(|id| id.get_string_repr().to_string());
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 800,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_800_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
.clone()
.unwrap_or_else(|| constants::DEFAULT_CALLBACK_URL.to_string()),
};
// Create header with actual signature
let head = create_paytm_header(&body, auth)?;
Ok(Self { head, body })
}
}
// Request transformation for Authorize flow
impl<T: domain_types::payment_method_data::PaymentMethodDataTypes> PaytmAuthorizeRouterData<T> {
pub fn try_from_with_converter(
item: &RouterDataV2<
Authorize,
PaymentFlowData,
PaymentsAuthorizeData<T>,
PaymentsResponseData,
>,
amount_converter: &dyn AmountConvertor<Output = StringMajorUnit>,
) -> Result<Self, error_stack::Report<errors::ConnectorError>> {
let amount = amount_converter
.convert(item.request.minor_amount, item.request.currency)
.change_context(errors::ConnectorError::AmountConversionFailed)?;
let customer_id = item
.resource_common_data
.get_customer_id()
.ok()
.map(|id| id.get_string_repr().to_string());
let email = item.resource_common_data.get_optional_billing_email();
let phone = item
.resource_common_data
.get_optional_billing_phone_number();
let first_name = item.resource_common_data.get_optional_billing_first_name();
let last_name = item.resource_common_data.get_optional_billing_last_name();
// Extract session token from previous session token response
let session_token = item.resource_common_data.get_session_token()?;
Ok(Self {
amount,
currency: item.request.currency,
payment_id: item
.resource_common_data
.connector_request_reference_id
.clone(),
session_token: Secret::new(session_token),
payment_method_data: item.request.payment_method_data.clone(),
customer_id,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 800,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_825_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
let customer_id = item
.resource_common_data
.get_customer_id()
.ok()
.map(|id| id.get_string_repr().to_string());
let email = item.resource_common_data.get_optional_billing_email();
let phone = item
.resource_common_data
.get_optional_billing_phone_number();
let first_name = item.resource_common_data.get_optional_billing_first_name();
let last_name = item.resource_common_data.get_optional_billing_last_name();
// Extract session token from previous session token response
let session_token = item.resource_common_data.get_session_token()?;
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 825,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_825_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
let customer_id = item
.resource_common_data
.get_customer_id()
.ok()
.map(|id| id.get_string_repr().to_string());
let email = item.resource_common_data.get_optional_billing_email();
let phone = item
.resource_common_data
.get_optional_billing_phone_number();
let first_name = item.resource_common_data.get_optional_billing_first_name();
let last_name = item.resource_common_data.get_optional_billing_last_name();
// Extract session token from previous session token response
let session_token = item.resource_common_data.get_session_token()?;
Ok(Self {
amount,
currency: item.request.currency,
payment_id: item
.resource_common_data
.connector_request_reference_id
.clone(),
session_token: Secret::new(session_token),
payment_method_data: item.request.payment_method_data.clone(),
customer_id,
email,
phone,
first_name,
last_name,
return_url: item.resource_common_data.get_return_url(),
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 825,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_825_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
let customer_id = item
.resource_common_data
.get_customer_id()
.ok()
.map(|id| id.get_string_repr().to_string());
let email = item.resource_common_data.get_optional_billing_email();
let phone = item
.resource_common_data
.get_optional_billing_phone_number();
let first_name = item.resource_common_data.get_optional_billing_first_name();
let last_name = item.resource_common_data.get_optional_billing_last_name();
// Extract session token from previous session token response
let session_token = item.resource_common_data.get_session_token()?;
Ok(Self {
amount,
currency: item.request.currency,
payment_id: item
.resource_common_data
.connector_request_reference_id
.clone(),
session_token: Secret::new(session_token),
payment_method_data: item.request.payment_method_data.clone(),
customer_id,
email,
phone,
first_name,
last_name,
return_url: item.resource_common_data.get_return_url(),
})
}
}
// Request transformation for PayTM UPI Intent flow (ProcessTxnRequest)
impl PaytmProcessTxnRequest {
pub fn try_from_with_auth<T: domain_types::payment_method_data::PaymentMethodDataTypes>(
item: &PaytmAuthorizeRouterData<T>,
auth: &PaytmAuthType,
) -> CustomResult<Self, errors::ConnectorError> {
let timestamp = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs()
.to_string();
let head = PaytmProcessHeadTypes {
version: constants::API_VERSION.to_string(),
request_timestamp: timestamp,
channel_id: auth.channel_id.clone(),
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 825,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_850_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
email,
phone,
first_name,
last_name,
return_url: item.resource_common_data.get_return_url(),
})
}
}
// Request transformation for PayTM UPI Intent flow (ProcessTxnRequest)
impl PaytmProcessTxnRequest {
pub fn try_from_with_auth<T: domain_types::payment_method_data::PaymentMethodDataTypes>(
item: &PaytmAuthorizeRouterData<T>,
auth: &PaytmAuthType,
) -> CustomResult<Self, errors::ConnectorError> {
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 850,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_850_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
email,
phone,
first_name,
last_name,
return_url: item.resource_common_data.get_return_url(),
})
}
}
// Request transformation for PayTM UPI Intent flow (ProcessTxnRequest)
impl PaytmProcessTxnRequest {
pub fn try_from_with_auth<T: domain_types::payment_method_data::PaymentMethodDataTypes>(
item: &PaytmAuthorizeRouterData<T>,
auth: &PaytmAuthType,
) -> CustomResult<Self, errors::ConnectorError> {
let timestamp = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs()
.to_string();
let head = PaytmProcessHeadTypes {
version: constants::API_VERSION.to_string(),
request_timestamp: timestamp,
channel_id: auth.channel_id.clone(),
txn_token: item.session_token.clone(),
};
let body = PaytmProcessBodyTypes {
mid: Secret::new(auth.merchant_id.peek().to_string()),
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 850,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_850_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
email,
phone,
first_name,
last_name,
return_url: item.resource_common_data.get_return_url(),
})
}
}
// Request transformation for PayTM UPI Intent flow (ProcessTxnRequest)
impl PaytmProcessTxnRequest {
pub fn try_from_with_auth<T: domain_types::payment_method_data::PaymentMethodDataTypes>(
item: &PaytmAuthorizeRouterData<T>,
auth: &PaytmAuthType,
) -> CustomResult<Self, errors::ConnectorError> {
let timestamp = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs()
.to_string();
let head = PaytmProcessHeadTypes {
version: constants::API_VERSION.to_string(),
request_timestamp: timestamp,
channel_id: auth.channel_id.clone(),
txn_token: item.session_token.clone(),
};
let body = PaytmProcessBodyTypes {
mid: Secret::new(auth.merchant_id.peek().to_string()),
order_id: item.payment_id.clone(),
request_type: constants::REQUEST_TYPE_PAYMENT.to_string(),
payment_mode: format!("{}_{}", constants::PAYMENT_MODE_UPI, "INTENT"), // "UPI_INTENT" for intent
payment_flow: Some(constants::PAYMENT_FLOW_NONE.to_string()),
};
Ok(Self { head, body })
}
}
// Request transformation for PayTM UPI Collect flow (NativeProcessTxnRequest)
impl PaytmNativeProcessTxnRequest {
pub fn try_from_with_auth<T: domain_types::payment_method_data::PaymentMethodDataTypes>(
item: &PaytmAuthorizeRouterData<T>,
auth: &PaytmAuthType,
) -> CustomResult<Self, errors::ConnectorError> {
// Extract UPI VPA for collect flow
let vpa = extract_upi_vpa(&item.payment_method_data)?.ok_or(
errors::ConnectorError::MissingRequiredField {
field_name: "vpa_id",
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 850,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_875_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
txn_token: item.session_token.clone(),
};
let body = PaytmProcessBodyTypes {
mid: Secret::new(auth.merchant_id.peek().to_string()),
order_id: item.payment_id.clone(),
request_type: constants::REQUEST_TYPE_PAYMENT.to_string(),
payment_mode: format!("{}_{}", constants::PAYMENT_MODE_UPI, "INTENT"), // "UPI_INTENT" for intent
payment_flow: Some(constants::PAYMENT_FLOW_NONE.to_string()),
};
Ok(Self { head, body })
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 875,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_875_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
txn_token: item.session_token.clone(),
};
let body = PaytmProcessBodyTypes {
mid: Secret::new(auth.merchant_id.peek().to_string()),
order_id: item.payment_id.clone(),
request_type: constants::REQUEST_TYPE_PAYMENT.to_string(),
payment_mode: format!("{}_{}", constants::PAYMENT_MODE_UPI, "INTENT"), // "UPI_INTENT" for intent
payment_flow: Some(constants::PAYMENT_FLOW_NONE.to_string()),
};
Ok(Self { head, body })
}
}
// Request transformation for PayTM UPI Collect flow (NativeProcessTxnRequest)
impl PaytmNativeProcessTxnRequest {
pub fn try_from_with_auth<T: domain_types::payment_method_data::PaymentMethodDataTypes>(
item: &PaytmAuthorizeRouterData<T>,
auth: &PaytmAuthType,
) -> CustomResult<Self, errors::ConnectorError> {
// Extract UPI VPA for collect flow
let vpa = extract_upi_vpa(&item.payment_method_data)?.ok_or(
errors::ConnectorError::MissingRequiredField {
field_name: "vpa_id",
},
)?;
let head = PaytmTxnTokenType {
txn_token: item.session_token.clone(),
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 875,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_875_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
txn_token: item.session_token.clone(),
};
let body = PaytmProcessBodyTypes {
mid: Secret::new(auth.merchant_id.peek().to_string()),
order_id: item.payment_id.clone(),
request_type: constants::REQUEST_TYPE_PAYMENT.to_string(),
payment_mode: format!("{}_{}", constants::PAYMENT_MODE_UPI, "INTENT"), // "UPI_INTENT" for intent
payment_flow: Some(constants::PAYMENT_FLOW_NONE.to_string()),
};
Ok(Self { head, body })
}
}
// Request transformation for PayTM UPI Collect flow (NativeProcessTxnRequest)
impl PaytmNativeProcessTxnRequest {
pub fn try_from_with_auth<T: domain_types::payment_method_data::PaymentMethodDataTypes>(
item: &PaytmAuthorizeRouterData<T>,
auth: &PaytmAuthType,
) -> CustomResult<Self, errors::ConnectorError> {
// Extract UPI VPA for collect flow
let vpa = extract_upi_vpa(&item.payment_method_data)?.ok_or(
errors::ConnectorError::MissingRequiredField {
field_name: "vpa_id",
},
)?;
let head = PaytmTxnTokenType {
txn_token: item.session_token.clone(),
};
let body = PaytmNativeProcessRequestBody {
request_type: constants::REQUEST_TYPE_NATIVE.to_string(),
mid: Secret::new(auth.merchant_id.peek().to_string()),
order_id: item.payment_id.clone(),
payment_mode: constants::PAYMENT_MODE_UPI.to_string(),
payer_account: Some(vpa),
channel_code: Some("collect".to_string()), // Gateway code if needed
channel_id: auth.channel_id.clone(),
txn_token: item.session_token.clone(),
auth_mode: None,
};
Ok(Self { head, body })
}
}
// PSync (Payment Sync) flow request structures
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 875,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_900_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
},
)?;
let head = PaytmTxnTokenType {
txn_token: item.session_token.clone(),
};
let body = PaytmNativeProcessRequestBody {
request_type: constants::REQUEST_TYPE_NATIVE.to_string(),
mid: Secret::new(auth.merchant_id.peek().to_string()),
order_id: item.payment_id.clone(),
payment_mode: constants::PAYMENT_MODE_UPI.to_string(),
payer_account: Some(vpa),
channel_code: Some("collect".to_string()), // Gateway code if needed
channel_id: auth.channel_id.clone(),
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 900,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_900_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
},
)?;
let head = PaytmTxnTokenType {
txn_token: item.session_token.clone(),
};
let body = PaytmNativeProcessRequestBody {
request_type: constants::REQUEST_TYPE_NATIVE.to_string(),
mid: Secret::new(auth.merchant_id.peek().to_string()),
order_id: item.payment_id.clone(),
payment_mode: constants::PAYMENT_MODE_UPI.to_string(),
payer_account: Some(vpa),
channel_code: Some("collect".to_string()), // Gateway code if needed
channel_id: auth.channel_id.clone(),
txn_token: item.session_token.clone(),
auth_mode: None,
};
Ok(Self { head, body })
}
}
// PSync (Payment Sync) flow request structures
#[derive(Debug, Serialize)]
pub struct PaytmTransactionStatusRequest {
pub head: PaytmRequestHeader,
pub body: PaytmTransactionStatusReqBody,
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 900,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_900_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
},
)?;
let head = PaytmTxnTokenType {
txn_token: item.session_token.clone(),
};
let body = PaytmNativeProcessRequestBody {
request_type: constants::REQUEST_TYPE_NATIVE.to_string(),
mid: Secret::new(auth.merchant_id.peek().to_string()),
order_id: item.payment_id.clone(),
payment_mode: constants::PAYMENT_MODE_UPI.to_string(),
payer_account: Some(vpa),
channel_code: Some("collect".to_string()), // Gateway code if needed
channel_id: auth.channel_id.clone(),
txn_token: item.session_token.clone(),
auth_mode: None,
};
Ok(Self { head, body })
}
}
// PSync (Payment Sync) flow request structures
#[derive(Debug, Serialize)]
pub struct PaytmTransactionStatusRequest {
pub head: PaytmRequestHeader,
pub body: PaytmTransactionStatusReqBody,
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PaytmTransactionStatusReqBody {
pub mid: Secret<String>, // Merchant ID
pub order_id: String, // Order ID
#[serde(skip_serializing_if = "Option::is_none")]
pub txn_type: Option<String>, // PREAUTH, CAPTURE, RELEASE, WITHDRAW
}
// PSync (Payment Sync) flow response structures
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmTransactionStatusResponse {
pub head: PaytmRespHead,
pub body: PaytmTransactionStatusRespBodyTypes,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(untagged)]
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 900,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_925_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
#[derive(Debug, Serialize)]
pub struct PaytmTransactionStatusRequest {
pub head: PaytmRequestHeader,
pub body: PaytmTransactionStatusReqBody,
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PaytmTransactionStatusReqBody {
pub mid: Secret<String>, // Merchant ID
pub order_id: String, // Order ID
#[serde(skip_serializing_if = "Option::is_none")]
pub txn_type: Option<String>, // PREAUTH, CAPTURE, RELEASE, WITHDRAW
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 925,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_925_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
#[derive(Debug, Serialize)]
pub struct PaytmTransactionStatusRequest {
pub head: PaytmRequestHeader,
pub body: PaytmTransactionStatusReqBody,
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PaytmTransactionStatusReqBody {
pub mid: Secret<String>, // Merchant ID
pub order_id: String, // Order ID
#[serde(skip_serializing_if = "Option::is_none")]
pub txn_type: Option<String>, // PREAUTH, CAPTURE, RELEASE, WITHDRAW
}
// PSync (Payment Sync) flow response structures
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmTransactionStatusResponse {
pub head: PaytmRespHead,
pub body: PaytmTransactionStatusRespBodyTypes,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum PaytmTransactionStatusRespBodyTypes {
SuccessBody(Box<PaytmTransactionStatusRespBody>),
FailureBody(PaytmErrorBody),
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 925,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_925_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
#[derive(Debug, Serialize)]
pub struct PaytmTransactionStatusRequest {
pub head: PaytmRequestHeader,
pub body: PaytmTransactionStatusReqBody,
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PaytmTransactionStatusReqBody {
pub mid: Secret<String>, // Merchant ID
pub order_id: String, // Order ID
#[serde(skip_serializing_if = "Option::is_none")]
pub txn_type: Option<String>, // PREAUTH, CAPTURE, RELEASE, WITHDRAW
}
// PSync (Payment Sync) flow response structures
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmTransactionStatusResponse {
pub head: PaytmRespHead,
pub body: PaytmTransactionStatusRespBodyTypes,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum PaytmTransactionStatusRespBodyTypes {
SuccessBody(Box<PaytmTransactionStatusRespBody>),
FailureBody(PaytmErrorBody),
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PaytmTransactionStatusRespBody {
pub result_info: PaytmResultInfo,
pub txn_id: Option<String>,
pub bank_txn_id: Option<String>,
pub order_id: Option<String>,
pub txn_amount: Option<StringMajorUnit>,
pub txn_type: Option<String>,
pub gateway_name: Option<String>,
pub mid: Option<String>,
pub payment_mode: Option<String>,
pub refund_amt: Option<String>,
pub txn_date: Option<String>,
}
// Helper struct for PSync RouterData transformation
#[derive(Debug, Clone)]
pub struct PaytmSyncRouterData {
pub payment_id: String,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 925,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_950_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub enum PaytmTransactionStatusRespBodyTypes {
SuccessBody(Box<PaytmTransactionStatusRespBody>),
FailureBody(PaytmErrorBody),
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PaytmTransactionStatusRespBody {
pub result_info: PaytmResultInfo,
pub txn_id: Option<String>,
pub bank_txn_id: Option<String>,
pub order_id: Option<String>,
pub txn_amount: Option<StringMajorUnit>,
pub txn_type: Option<String>,
pub gateway_name: Option<String>,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 950,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_950_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub enum PaytmTransactionStatusRespBodyTypes {
SuccessBody(Box<PaytmTransactionStatusRespBody>),
FailureBody(PaytmErrorBody),
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PaytmTransactionStatusRespBody {
pub result_info: PaytmResultInfo,
pub txn_id: Option<String>,
pub bank_txn_id: Option<String>,
pub order_id: Option<String>,
pub txn_amount: Option<StringMajorUnit>,
pub txn_type: Option<String>,
pub gateway_name: Option<String>,
pub mid: Option<String>,
pub payment_mode: Option<String>,
pub refund_amt: Option<String>,
pub txn_date: Option<String>,
}
// Helper struct for PSync RouterData transformation
#[derive(Debug, Clone)]
pub struct PaytmSyncRouterData {
pub payment_id: String,
pub connector_transaction_id: Option<String>,
pub txn_type: Option<String>,
}
// Request transformation for PSync flow
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 950,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_950_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub enum PaytmTransactionStatusRespBodyTypes {
SuccessBody(Box<PaytmTransactionStatusRespBody>),
FailureBody(PaytmErrorBody),
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PaytmTransactionStatusRespBody {
pub result_info: PaytmResultInfo,
pub txn_id: Option<String>,
pub bank_txn_id: Option<String>,
pub order_id: Option<String>,
pub txn_amount: Option<StringMajorUnit>,
pub txn_type: Option<String>,
pub gateway_name: Option<String>,
pub mid: Option<String>,
pub payment_mode: Option<String>,
pub refund_amt: Option<String>,
pub txn_date: Option<String>,
}
// Helper struct for PSync RouterData transformation
#[derive(Debug, Clone)]
pub struct PaytmSyncRouterData {
pub payment_id: String,
pub connector_transaction_id: Option<String>,
pub txn_type: Option<String>,
}
// Request transformation for PSync flow
impl TryFrom<&RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>>
for PaytmSyncRouterData
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
// Use connector transaction ID if available, otherwise fall back to payment ID
let transaction_id = item
.request
.connector_transaction_id
.get_connector_transaction_id()
.unwrap_or_else(|_| {
item.resource_common_data
.connector_request_reference_id
.clone()
});
let connector_transaction_id = item
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 950,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_975_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub connector_transaction_id: Option<String>,
pub txn_type: Option<String>,
}
// Request transformation for PSync flow
impl TryFrom<&RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>>
for PaytmSyncRouterData
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
// Use connector transaction ID if available, otherwise fall back to payment ID
let transaction_id = item
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 975,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_975_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub connector_transaction_id: Option<String>,
pub txn_type: Option<String>,
}
// Request transformation for PSync flow
impl TryFrom<&RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>>
for PaytmSyncRouterData
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
// Use connector transaction ID if available, otherwise fall back to payment ID
let transaction_id = item
.request
.connector_transaction_id
.get_connector_transaction_id()
.unwrap_or_else(|_| {
item.resource_common_data
.connector_request_reference_id
.clone()
});
let connector_transaction_id = item
.request
.connector_transaction_id
.get_connector_transaction_id()
.map_err(|_| {
error_stack::Report::new(errors::ConnectorError::MissingConnectorTransactionID)
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 975,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_975_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub connector_transaction_id: Option<String>,
pub txn_type: Option<String>,
}
// Request transformation for PSync flow
impl TryFrom<&RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>>
for PaytmSyncRouterData
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
// Use connector transaction ID if available, otherwise fall back to payment ID
let transaction_id = item
.request
.connector_transaction_id
.get_connector_transaction_id()
.unwrap_or_else(|_| {
item.resource_common_data
.connector_request_reference_id
.clone()
});
let connector_transaction_id = item
.request
.connector_transaction_id
.get_connector_transaction_id()
.map_err(|_| {
error_stack::Report::new(errors::ConnectorError::MissingConnectorTransactionID)
})?;
Ok(Self {
payment_id: transaction_id,
connector_transaction_id: Some(connector_transaction_id),
txn_type: None,
})
}
}
// Request body transformation for PayTM transaction status
impl PaytmTransactionStatusRequest {
pub fn try_from_with_auth(
item: &PaytmSyncRouterData,
auth: &PaytmAuthType,
) -> CustomResult<Self, errors::ConnectorError> {
let body = PaytmTransactionStatusReqBody {
mid: Secret::new(auth.merchant_id.peek().to_string()),
order_id: item.payment_id.clone(),
txn_type: item.txn_type.clone(),
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 975,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1000_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
.request
.connector_transaction_id
.get_connector_transaction_id()
.map_err(|_| {
error_stack::Report::new(errors::ConnectorError::MissingConnectorTransactionID)
})?;
Ok(Self {
payment_id: transaction_id,
connector_transaction_id: Some(connector_transaction_id),
txn_type: None,
})
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1000,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1000_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
.request
.connector_transaction_id
.get_connector_transaction_id()
.map_err(|_| {
error_stack::Report::new(errors::ConnectorError::MissingConnectorTransactionID)
})?;
Ok(Self {
payment_id: transaction_id,
connector_transaction_id: Some(connector_transaction_id),
txn_type: None,
})
}
}
// Request body transformation for PayTM transaction status
impl PaytmTransactionStatusRequest {
pub fn try_from_with_auth(
item: &PaytmSyncRouterData,
auth: &PaytmAuthType,
) -> CustomResult<Self, errors::ConnectorError> {
let body = PaytmTransactionStatusReqBody {
mid: Secret::new(auth.merchant_id.peek().to_string()),
order_id: item.payment_id.clone(),
txn_type: item.txn_type.clone(),
};
// Create header with actual signature
let head = create_paytm_header(&body, auth)?;
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1000,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1000_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
.request
.connector_transaction_id
.get_connector_transaction_id()
.map_err(|_| {
error_stack::Report::new(errors::ConnectorError::MissingConnectorTransactionID)
})?;
Ok(Self {
payment_id: transaction_id,
connector_transaction_id: Some(connector_transaction_id),
txn_type: None,
})
}
}
// Request body transformation for PayTM transaction status
impl PaytmTransactionStatusRequest {
pub fn try_from_with_auth(
item: &PaytmSyncRouterData,
auth: &PaytmAuthType,
) -> CustomResult<Self, errors::ConnectorError> {
let body = PaytmTransactionStatusReqBody {
mid: Secret::new(auth.merchant_id.peek().to_string()),
order_id: item.payment_id.clone(),
txn_type: item.txn_type.clone(),
};
// Create header with actual signature
let head = create_paytm_header(&body, auth)?;
Ok(Self { head, body })
}
}
// Status mapping function for Paytm result codes
pub fn map_paytm_status_to_attempt_status(result_code: &str) -> AttemptStatus {
match result_code {
// Success
"01" => AttemptStatus::Charged, // TXN_SUCCESS
"0000" => AttemptStatus::AuthenticationPending, // Success - waiting for authentication
// Pending cases
"400" | "402" => AttemptStatus::Pending, // PENDING, PENDING_BANK_CONFIRM
"331" => AttemptStatus::Pending, // NO_RECORD_FOUND
// Failure cases
"227" | "235" | "295" | "334" | "335" | "401" | "501" | "810" | "843" | "820" | "267" => {
AttemptStatus::Failure
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1000,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1025_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
};
// Create header with actual signature
let head = create_paytm_header(&body, auth)?;
Ok(Self { head, body })
}
}
// Status mapping function for Paytm result codes
pub fn map_paytm_status_to_attempt_status(result_code: &str) -> AttemptStatus {
match result_code {
// Success
"01" => AttemptStatus::Charged, // TXN_SUCCESS
"0000" => AttemptStatus::AuthenticationPending, // Success - waiting for authentication
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1025,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1025_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
};
// Create header with actual signature
let head = create_paytm_header(&body, auth)?;
Ok(Self { head, body })
}
}
// Status mapping function for Paytm result codes
pub fn map_paytm_status_to_attempt_status(result_code: &str) -> AttemptStatus {
match result_code {
// Success
"01" => AttemptStatus::Charged, // TXN_SUCCESS
"0000" => AttemptStatus::AuthenticationPending, // Success - waiting for authentication
// Pending cases
"400" | "402" => AttemptStatus::Pending, // PENDING, PENDING_BANK_CONFIRM
"331" => AttemptStatus::Pending, // NO_RECORD_FOUND
// Failure cases
"227" | "235" | "295" | "334" | "335" | "401" | "501" | "810" | "843" | "820" | "267" => {
AttemptStatus::Failure
}
// Default to failure for unknown codes (WILL NEVER HAPPEN)
_ => AttemptStatus::Pending,
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1025,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1025_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
};
// Create header with actual signature
let head = create_paytm_header(&body, auth)?;
Ok(Self { head, body })
}
}
// Status mapping function for Paytm result codes
pub fn map_paytm_status_to_attempt_status(result_code: &str) -> AttemptStatus {
match result_code {
// Success
"01" => AttemptStatus::Charged, // TXN_SUCCESS
"0000" => AttemptStatus::AuthenticationPending, // Success - waiting for authentication
// Pending cases
"400" | "402" => AttemptStatus::Pending, // PENDING, PENDING_BANK_CONFIRM
"331" => AttemptStatus::Pending, // NO_RECORD_FOUND
// Failure cases
"227" | "235" | "295" | "334" | "335" | "401" | "501" | "810" | "843" | "820" | "267" => {
AttemptStatus::Failure
}
// Default to failure for unknown codes (WILL NEVER HAPPEN)
_ => AttemptStatus::Pending,
}
}
// Additional response structures needed for compilation
// Session token error response structure
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmSessionTokenErrorResponse {
pub head: PaytmRespHead,
pub body: PaytmSessionTokenErrorBody,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmSessionTokenErrorBody {
#[serde(rename = "extraParamsMap")]
pub extra_params_map: Option<serde_json::Value>, // This field must be present (even if null) to distinguish from other types
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
}
// Success transaction response structure (handles both callback and standard formats)
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmSuccessTransactionResponse {
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1025,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1050_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
// Default to failure for unknown codes (WILL NEVER HAPPEN)
_ => AttemptStatus::Pending,
}
}
// Additional response structures needed for compilation
// Session token error response structure
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmSessionTokenErrorResponse {
pub head: PaytmRespHead,
pub body: PaytmSessionTokenErrorBody,
}
#[derive(Debug, Deserialize, Serialize)]
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1050,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1050_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
// Default to failure for unknown codes (WILL NEVER HAPPEN)
_ => AttemptStatus::Pending,
}
}
// Additional response structures needed for compilation
// Session token error response structure
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmSessionTokenErrorResponse {
pub head: PaytmRespHead,
pub body: PaytmSessionTokenErrorBody,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmSessionTokenErrorBody {
#[serde(rename = "extraParamsMap")]
pub extra_params_map: Option<serde_json::Value>, // This field must be present (even if null) to distinguish from other types
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
}
// Success transaction response structure (handles both callback and standard formats)
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmSuccessTransactionResponse {
pub head: PaytmRespHead,
pub body: PaytmSuccessTransactionBody,
}
#[derive(Debug, Deserialize, Serialize)]
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1050,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1050_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
// Default to failure for unknown codes (WILL NEVER HAPPEN)
_ => AttemptStatus::Pending,
}
}
// Additional response structures needed for compilation
// Session token error response structure
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmSessionTokenErrorResponse {
pub head: PaytmRespHead,
pub body: PaytmSessionTokenErrorBody,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmSessionTokenErrorBody {
#[serde(rename = "extraParamsMap")]
pub extra_params_map: Option<serde_json::Value>, // This field must be present (even if null) to distinguish from other types
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
}
// Success transaction response structure (handles both callback and standard formats)
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmSuccessTransactionResponse {
pub head: PaytmRespHead,
pub body: PaytmSuccessTransactionBody,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmSuccessTransactionBody {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
#[serde(rename = "txnInfo")]
pub txn_info: PaytmTxnInfo,
#[serde(rename = "callBackUrl")]
pub callback_url: Option<String>,
}
// Bank form response structure
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmBankFormResponse {
pub head: PaytmRespHead,
pub body: PaytmBankFormBody,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmBankFormBody {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1050,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1075_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub head: PaytmRespHead,
pub body: PaytmSuccessTransactionBody,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmSuccessTransactionBody {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
#[serde(rename = "txnInfo")]
pub txn_info: PaytmTxnInfo,
#[serde(rename = "callBackUrl")]
pub callback_url: Option<String>,
}
// Bank form response structure
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1075,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1075_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub head: PaytmRespHead,
pub body: PaytmSuccessTransactionBody,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmSuccessTransactionBody {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
#[serde(rename = "txnInfo")]
pub txn_info: PaytmTxnInfo,
#[serde(rename = "callBackUrl")]
pub callback_url: Option<String>,
}
// Bank form response structure
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmBankFormResponse {
pub head: PaytmRespHead,
pub body: PaytmBankFormBody,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmBankFormBody {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
#[serde(rename = "bankForm")]
pub bank_form: PaytmBankForm,
}
#[derive(Debug, Deserialize, Serialize)]
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1075,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1075_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
pub head: PaytmRespHead,
pub body: PaytmSuccessTransactionBody,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmSuccessTransactionBody {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
#[serde(rename = "txnInfo")]
pub txn_info: PaytmTxnInfo,
#[serde(rename = "callBackUrl")]
pub callback_url: Option<String>,
}
// Bank form response structure
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmBankFormResponse {
pub head: PaytmRespHead,
pub body: PaytmBankFormBody,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmBankFormBody {
#[serde(rename = "resultInfo")]
pub result_info: PaytmResultInfo,
#[serde(rename = "bankForm")]
pub bank_form: PaytmBankForm,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmBankForm {
#[serde(rename = "redirectForm")]
pub redirect_form: PaytmRedirectForm,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmRedirectForm {
#[serde(rename = "actionUrl")]
pub action_url: String,
pub method: String,
pub content: HashMap<String, String>,
}
// TryFrom implementations required by the macro framework
// The macro expects TryFrom implementations that work with its generated PaytmRouterData<RouterDataV2<...>>
// Since the macro generates PaytmRouterData<T> but our existing PaytmRouterData is not generic,
// we need to implement TryFrom for the exact RouterDataV2 types the macro expects
// PaytmInitiateTxnRequest TryFrom CreateSessionToken RouterData
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1075,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1100_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
#[serde(rename = "bankForm")]
pub bank_form: PaytmBankForm,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmBankForm {
#[serde(rename = "redirectForm")]
pub redirect_form: PaytmRedirectForm,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmRedirectForm {
#[serde(rename = "actionUrl")]
pub action_url: String,
pub method: String,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1100,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1100_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
#[serde(rename = "bankForm")]
pub bank_form: PaytmBankForm,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmBankForm {
#[serde(rename = "redirectForm")]
pub redirect_form: PaytmRedirectForm,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmRedirectForm {
#[serde(rename = "actionUrl")]
pub action_url: String,
pub method: String,
pub content: HashMap<String, String>,
}
// TryFrom implementations required by the macro framework
// The macro expects TryFrom implementations that work with its generated PaytmRouterData<RouterDataV2<...>>
// Since the macro generates PaytmRouterData<T> but our existing PaytmRouterData is not generic,
// we need to implement TryFrom for the exact RouterDataV2 types the macro expects
// PaytmInitiateTxnRequest TryFrom CreateSessionToken RouterData
// Using the macro-generated PaytmRouterData type from the paytm module
impl<
T: domain_types::payment_method_data::PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1100,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1100_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
#[serde(rename = "bankForm")]
pub bank_form: PaytmBankForm,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmBankForm {
#[serde(rename = "redirectForm")]
pub redirect_form: PaytmRedirectForm,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PaytmRedirectForm {
#[serde(rename = "actionUrl")]
pub action_url: String,
pub method: String,
pub content: HashMap<String, String>,
}
// TryFrom implementations required by the macro framework
// The macro expects TryFrom implementations that work with its generated PaytmRouterData<RouterDataV2<...>>
// Since the macro generates PaytmRouterData<T> but our existing PaytmRouterData is not generic,
// we need to implement TryFrom for the exact RouterDataV2 types the macro expects
// PaytmInitiateTxnRequest TryFrom CreateSessionToken RouterData
// Using the macro-generated PaytmRouterData type from the paytm module
impl<
T: domain_types::payment_method_data::PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ serde::Serialize,
>
TryFrom<
MacroPaytmRouterData<
RouterDataV2<
CreateSessionToken,
PaymentFlowData,
SessionTokenRequestData,
SessionTokenResponseData,
>,
T,
>,
> for PaytmInitiateTxnRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: MacroPaytmRouterData<
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1100,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1125_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
// Using the macro-generated PaytmRouterData type from the paytm module
impl<
T: domain_types::payment_method_data::PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ serde::Serialize,
>
TryFrom<
MacroPaytmRouterData<
RouterDataV2<
CreateSessionToken,
PaymentFlowData,
SessionTokenRequestData,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1125,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1125_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
// Using the macro-generated PaytmRouterData type from the paytm module
impl<
T: domain_types::payment_method_data::PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ serde::Serialize,
>
TryFrom<
MacroPaytmRouterData<
RouterDataV2<
CreateSessionToken,
PaymentFlowData,
SessionTokenRequestData,
SessionTokenResponseData,
>,
T,
>,
> for PaytmInitiateTxnRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: MacroPaytmRouterData<
RouterDataV2<
CreateSessionToken,
PaymentFlowData,
SessionTokenRequestData,
SessionTokenResponseData,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1125,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1125_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
// Using the macro-generated PaytmRouterData type from the paytm module
impl<
T: domain_types::payment_method_data::PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ serde::Serialize,
>
TryFrom<
MacroPaytmRouterData<
RouterDataV2<
CreateSessionToken,
PaymentFlowData,
SessionTokenRequestData,
SessionTokenResponseData,
>,
T,
>,
> for PaytmInitiateTxnRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: MacroPaytmRouterData<
RouterDataV2<
CreateSessionToken,
PaymentFlowData,
SessionTokenRequestData,
SessionTokenResponseData,
>,
T,
>,
) -> Result<Self, Self::Error> {
let auth = PaytmAuthType::try_from(&item.router_data.connector_auth_type)?;
let intermediate_router_data = PaytmRouterData::try_from_with_converter(
&item.router_data,
item.connector.amount_converter,
)?;
PaytmInitiateTxnRequest::try_from_with_auth(&intermediate_router_data, &auth)
}
}
// PaytmAuthorizeRequest TryFrom Authorize RouterData
impl<
T: domain_types::payment_method_data::PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1125,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1150_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
RouterDataV2<
CreateSessionToken,
PaymentFlowData,
SessionTokenRequestData,
SessionTokenResponseData,
>,
T,
>,
) -> Result<Self, Self::Error> {
let auth = PaytmAuthType::try_from(&item.router_data.connector_auth_type)?;
let intermediate_router_data = PaytmRouterData::try_from_with_converter(
&item.router_data,
item.connector.amount_converter,
)?;
PaytmInitiateTxnRequest::try_from_with_auth(&intermediate_router_data, &auth)
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1150,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1150_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
RouterDataV2<
CreateSessionToken,
PaymentFlowData,
SessionTokenRequestData,
SessionTokenResponseData,
>,
T,
>,
) -> Result<Self, Self::Error> {
let auth = PaytmAuthType::try_from(&item.router_data.connector_auth_type)?;
let intermediate_router_data = PaytmRouterData::try_from_with_converter(
&item.router_data,
item.connector.amount_converter,
)?;
PaytmInitiateTxnRequest::try_from_with_auth(&intermediate_router_data, &auth)
}
}
// PaytmAuthorizeRequest TryFrom Authorize RouterData
impl<
T: domain_types::payment_method_data::PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ serde::Serialize,
>
TryFrom<
MacroPaytmRouterData<
RouterDataV2<
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1150,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1150_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
RouterDataV2<
CreateSessionToken,
PaymentFlowData,
SessionTokenRequestData,
SessionTokenResponseData,
>,
T,
>,
) -> Result<Self, Self::Error> {
let auth = PaytmAuthType::try_from(&item.router_data.connector_auth_type)?;
let intermediate_router_data = PaytmRouterData::try_from_with_converter(
&item.router_data,
item.connector.amount_converter,
)?;
PaytmInitiateTxnRequest::try_from_with_auth(&intermediate_router_data, &auth)
}
}
// PaytmAuthorizeRequest TryFrom Authorize RouterData
impl<
T: domain_types::payment_method_data::PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ serde::Serialize,
>
TryFrom<
MacroPaytmRouterData<
RouterDataV2<
Authorize,
PaymentFlowData,
PaymentsAuthorizeData<T>,
PaymentsResponseData,
>,
T,
>,
> for PaytmAuthorizeRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: MacroPaytmRouterData<
RouterDataV2<
Authorize,
PaymentFlowData,
PaymentsAuthorizeData<T>,
PaymentsResponseData,
>,
T,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1150,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1175_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
+ serde::Serialize,
>
TryFrom<
MacroPaytmRouterData<
RouterDataV2<
Authorize,
PaymentFlowData,
PaymentsAuthorizeData<T>,
PaymentsResponseData,
>,
T,
>,
> for PaytmAuthorizeRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1175,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1175_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
+ serde::Serialize,
>
TryFrom<
MacroPaytmRouterData<
RouterDataV2<
Authorize,
PaymentFlowData,
PaymentsAuthorizeData<T>,
PaymentsResponseData,
>,
T,
>,
> for PaytmAuthorizeRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: MacroPaytmRouterData<
RouterDataV2<
Authorize,
PaymentFlowData,
PaymentsAuthorizeData<T>,
PaymentsResponseData,
>,
T,
>,
) -> Result<Self, Self::Error> {
let auth = PaytmAuthType::try_from(&item.router_data.connector_auth_type)?;
let intermediate_authorize_router_data = PaytmAuthorizeRouterData::try_from_with_converter(
&item.router_data,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1175,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1175_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
+ serde::Serialize,
>
TryFrom<
MacroPaytmRouterData<
RouterDataV2<
Authorize,
PaymentFlowData,
PaymentsAuthorizeData<T>,
PaymentsResponseData,
>,
T,
>,
> for PaytmAuthorizeRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: MacroPaytmRouterData<
RouterDataV2<
Authorize,
PaymentFlowData,
PaymentsAuthorizeData<T>,
PaymentsResponseData,
>,
T,
>,
) -> Result<Self, Self::Error> {
let auth = PaytmAuthType::try_from(&item.router_data.connector_auth_type)?;
let intermediate_authorize_router_data = PaytmAuthorizeRouterData::try_from_with_converter(
&item.router_data,
item.connector.amount_converter,
)?;
// Determine the UPI flow type based on payment method data
let upi_flow = determine_upi_flow(&item.router_data.request.payment_method_data)?;
match upi_flow {
UpiFlowType::Intent => {
// UPI Intent flow - use PaytmProcessTxnRequest
let intent_request = PaytmProcessTxnRequest::try_from_with_auth(
&intermediate_authorize_router_data,
&auth,
)?;
Ok(PaytmAuthorizeRequest::Intent(intent_request))
}
UpiFlowType::Collect => {
// UPI Collect flow - use PaytmNativeProcessTxnRequest
let collect_request = PaytmNativeProcessTxnRequest::try_from_with_auth(
&intermediate_authorize_router_data,
&auth,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1175,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1200_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
>,
) -> Result<Self, Self::Error> {
let auth = PaytmAuthType::try_from(&item.router_data.connector_auth_type)?;
let intermediate_authorize_router_data = PaytmAuthorizeRouterData::try_from_with_converter(
&item.router_data,
item.connector.amount_converter,
)?;
// Determine the UPI flow type based on payment method data
let upi_flow = determine_upi_flow(&item.router_data.request.payment_method_data)?;
match upi_flow {
UpiFlowType::Intent => {
// UPI Intent flow - use PaytmProcessTxnRequest
let intent_request = PaytmProcessTxnRequest::try_from_with_auth(
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1200,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1200_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
>,
) -> Result<Self, Self::Error> {
let auth = PaytmAuthType::try_from(&item.router_data.connector_auth_type)?;
let intermediate_authorize_router_data = PaytmAuthorizeRouterData::try_from_with_converter(
&item.router_data,
item.connector.amount_converter,
)?;
// Determine the UPI flow type based on payment method data
let upi_flow = determine_upi_flow(&item.router_data.request.payment_method_data)?;
match upi_flow {
UpiFlowType::Intent => {
// UPI Intent flow - use PaytmProcessTxnRequest
let intent_request = PaytmProcessTxnRequest::try_from_with_auth(
&intermediate_authorize_router_data,
&auth,
)?;
Ok(PaytmAuthorizeRequest::Intent(intent_request))
}
UpiFlowType::Collect => {
// UPI Collect flow - use PaytmNativeProcessTxnRequest
let collect_request = PaytmNativeProcessTxnRequest::try_from_with_auth(
&intermediate_authorize_router_data,
&auth,
)?;
Ok(PaytmAuthorizeRequest::Collect(collect_request))
}
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1200,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1200_50 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
>,
) -> Result<Self, Self::Error> {
let auth = PaytmAuthType::try_from(&item.router_data.connector_auth_type)?;
let intermediate_authorize_router_data = PaytmAuthorizeRouterData::try_from_with_converter(
&item.router_data,
item.connector.amount_converter,
)?;
// Determine the UPI flow type based on payment method data
let upi_flow = determine_upi_flow(&item.router_data.request.payment_method_data)?;
match upi_flow {
UpiFlowType::Intent => {
// UPI Intent flow - use PaytmProcessTxnRequest
let intent_request = PaytmProcessTxnRequest::try_from_with_auth(
&intermediate_authorize_router_data,
&auth,
)?;
Ok(PaytmAuthorizeRequest::Intent(intent_request))
}
UpiFlowType::Collect => {
// UPI Collect flow - use PaytmNativeProcessTxnRequest
let collect_request = PaytmNativeProcessTxnRequest::try_from_with_auth(
&intermediate_authorize_router_data,
&auth,
)?;
Ok(PaytmAuthorizeRequest::Collect(collect_request))
}
}
}
}
// PaytmTransactionStatusRequest TryFrom PSync RouterData
impl<
T: domain_types::payment_method_data::PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ serde::Serialize,
>
TryFrom<
MacroPaytmRouterData<
RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>,
T,
>,
> for PaytmTransactionStatusRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1200,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1225_15 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
)?;
Ok(PaytmAuthorizeRequest::Collect(collect_request))
}
}
}
}
// PaytmTransactionStatusRequest TryFrom PSync RouterData
impl<
T: domain_types::payment_method_data::PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ serde::Serialize,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1225,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_snippet_-7010937598925635194_1225_30 | clm | snippet | // connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs
)?;
Ok(PaytmAuthorizeRequest::Collect(collect_request))
}
}
}
}
// PaytmTransactionStatusRequest TryFrom PSync RouterData
impl<
T: domain_types::payment_method_data::PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ serde::Serialize,
>
TryFrom<
MacroPaytmRouterData<
RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>,
T,
>,
> for PaytmTransactionStatusRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: MacroPaytmRouterData<
RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>,
T,
>,
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1225,
"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.