id
stringlengths
20
153
type
stringclasses
1 value
granularity
stringclasses
14 values
content
stringlengths
16
84.3k
metadata
dict
connector-service_mini_connector-integration_-2288493413238451084_5
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/nexinets.rs > for Nexinets<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Nexinets<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Nexinets<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Nexinets<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Refund, RefundFlowData, RefundsData, RefundsResponseData, > for Nexinets<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< RSync, RefundFlowData, RefundSyncData, RefundsResponseData, > for Nexinets<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData, > for Nexinets<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData, > for Nexinets<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Nexinets<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Nexinets<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData, > for Nexinets<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData, > for Nexinets<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Nexinets<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData, > for Nexinets<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData> for Nexinets<T> { } // ConnectorIntegrationV2 implementations for authentication flows impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Nexinets<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Nexinets<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize>
{ "chunk": 5, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-2288493413238451084_6
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/nexinets.rs ConnectorIntegrationV2< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Nexinets<T> { } // SourceVerification implementations for authentication flows impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Nexinets<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Nexinets<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Nexinets<T> { }
{ "chunk": 6, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-3985605181421955236_0
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/braintree.rs pub mod transformers; use std::fmt::Debug; use base64::Engine; use common_enums::CurrencyUnit; use common_utils::{ consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE}, errors::CustomResult, events, ext_traits::ByteSliceExt, types::StringMajorUnit, ParsingError, }; use domain_types::{ connector_flow::{ Accept, Authenticate, Authorize, Capture, CreateAccessToken, CreateConnectorCustomer, CreateOrder, CreateSessionToken, DefendDispute, PSync, PaymentMethodToken, PostAuthenticate, PreAuthenticate, RSync, Refund, RepeatPayment, SetupMandate, SubmitEvidence, Void, }, connector_types::{ AcceptDisputeData, AccessTokenRequestData, AccessTokenResponseData, ConnectorCustomerData, ConnectorCustomerResponse, DisputeDefendData, DisputeFlowData, DisputeResponseData, PaymentCreateOrderData, PaymentCreateOrderResponse, PaymentFlowData, PaymentMethodTokenResponse, PaymentMethodTokenizationData, PaymentVoidData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCaptureData, PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsResponseData, PaymentsSyncData, RefundFlowData, RefundSyncData, RefundsData, RefundsResponseData, RepeatPaymentData, SessionTokenRequestData, SessionTokenResponseData, SetupMandateRequestData, SubmitEvidenceData, }, errors, payment_method_data::PaymentMethodDataTypes, router_data::{ConnectorAuthType, ErrorResponse}, router_data_v2::RouterDataV2, router_response_types::Response, types::Connectors, }; use error_stack::Report; use hyperswitch_masking::{Mask, Maskable, PeekInterface}; use interfaces::{ api::ConnectorCommon, connector_integration_v2::ConnectorIntegrationV2, connector_types, }; use serde::Serialize; use transformers::{ self as braintree, BraintreeCancelRequest, BraintreeCancelResponse, BraintreeCaptureRequest, BraintreeCaptureResponse, BraintreePSyncRequest, BraintreePSyncResponse, BraintreePaymentsRequest, BraintreePaymentsResponse, BraintreeRSyncRequest, BraintreeRSyncResponse, BraintreeRefundRequest, BraintreeRefundResponse, BraintreeTokenRequest, BraintreeTokenResponse, }; use super::macros; use crate::{types::ResponseRouterData, with_error_response_body}; pub const BASE64_ENGINE: base64::engine::GeneralPurpose = base64::engine::general_purpose::STANDARD; use error_stack::ResultExt; pub(crate) mod headers { pub(crate) const CONTENT_TYPE: &str = "Content-Type"; pub(crate) const AUTHORIZATION: &str = "Authorization"; } pub const BRAINTREE_VERSION: &str = "Braintree-Version"; pub const BRAINTREE_VERSION_VALUE: &str = "2019-01-01"; impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorCommon for Braintree<T> { fn id(&self) -> &'static str { "braintree" } fn get_currency_unit(&self) -> CurrencyUnit { CurrencyUnit::Base } fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.braintree.base_url.as_ref() } fn get_auth_header( &self, auth_type: &ConnectorAuthType, ) -> CustomResult<Vec<(String, hyperswitch_masking::Maskable<String>)>, errors::ConnectorError> { let auth = braintree::BraintreeAuthType::try_from(auth_type) .change_context(errors::ConnectorError::FailedToObtainAuthType)?; let auth_key = format!("{}:{}", auth.public_key.peek(), auth.private_key.peek()); let auth_header = format!("Basic {}", BASE64_ENGINE.encode(auth_key)); Ok(vec![( headers::AUTHORIZATION.to_string(), auth_header.into_masked(), )]) } fn build_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: Result<braintree::ErrorResponses, Report<ParsingError>> = res.response.parse_struct("Braintree Error Response"); match response { Ok(braintree::ErrorResponses::BraintreeApiErrorResponse(response)) => { with_error_response_body!(event_builder, response); let error_object = response.api_error_response.errors; let error = error_object.errors.first().or(error_object
{ "chunk": 0, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-3985605181421955236_1
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/braintree.rs .transaction .as_ref() .and_then(|transaction_error| { transaction_error.errors.first().or(transaction_error .credit_card .as_ref() .and_then(|credit_card_error| credit_card_error.errors.first())) })); let (code, message) = error.map_or( (NO_ERROR_CODE.to_string(), NO_ERROR_MESSAGE.to_string()), |error| (error.code.clone(), error.message.clone()), ); Ok(ErrorResponse { status_code: res.status_code, code, message, reason: Some(response.api_error_response.message), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, }) } Ok(braintree::ErrorResponses::BraintreeErrorResponse(response)) => { with_error_response_body!(event_builder, response); Ok(ErrorResponse { status_code: res.status_code, code: NO_ERROR_CODE.to_string(), message: NO_ERROR_MESSAGE.to_string(), reason: Some(response.errors), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, }) } Err(_) => { if let Some(event) = event_builder { event.set_connector_response(&serde_json::json!({"error": "Error response parsing failed", "status_code": res.status_code})); } domain_types::utils::handle_json_response_deserialization_failure(res, "braintree") } } } } //marker traits impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::ConnectorServiceTrait<T> for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAuthorizeV2<T> for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentSyncV2 for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentSessionToken for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAccessToken for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::CreateConnectorCustomer for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentVoidV2 for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentVoidPostCaptureV2 for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< domain_types::connector_flow::VoidPC, PaymentFlowData, domain_types::connector_types::PaymentsCancelPostCaptureData, PaymentsResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RefundSyncV2 for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RefundV2 for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentCapture for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::ValidationTrait for Braintree<T> { fn should_do_payment_method_token(&self) -> bool { true } } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentOrderCreate for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize>
{ "chunk": 1, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-3985605181421955236_2
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/braintree.rs connector_types::SetupMandateV2<T> for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RepeatPaymentV2 for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::AcceptDispute for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::SubmitEvidenceV2 for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::DisputeDefend for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::IncomingWebhook for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentTokenV2<T> for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentPreAuthenticateV2<T> for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAuthenticateV2<T> for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentPostAuthenticateV2<T> for Braintree<T> { } macros::create_all_prerequisites!( connector_name: Braintree, generic_type: T, api: [ ( flow: PaymentMethodToken, request_body: BraintreeTokenRequest<T>, response_body: BraintreeTokenResponse, router_data: RouterDataV2<PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse>, ), ( flow: Authorize, request_body: BraintreePaymentsRequest, response_body: BraintreePaymentsResponse, router_data: RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ), ( flow: PSync, request_body: BraintreePSyncRequest, response_body: BraintreePSyncResponse, router_data: RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ), ( flow: Capture, request_body: BraintreeCaptureRequest, response_body: BraintreeCaptureResponse, router_data: RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ), ( flow: Void, request_body: BraintreeCancelRequest, response_body: BraintreeCancelResponse, router_data: RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ), ( flow: Refund, request_body: BraintreeRefundRequest, response_body: BraintreeRefundResponse, router_data: RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ), ( flow: RSync, request_body: BraintreeRSyncRequest, response_body: BraintreeRSyncResponse, router_data: RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) ], amount_converters: [ amount_converter: StringMajorUnit ], member_functions: { pub fn build_headers<F, FCD, Req, Res>( &self, req: &RouterDataV2<F, FCD, Req, Res>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> where Self: ConnectorIntegrationV2<F, FCD, Req, Res>, { let mut header = vec![ ( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), ), ( BRAINTREE_VERSION.to_string(), BRAINTREE_VERSION_VALUE.to_string().into(), ), ]; let mut api_key = self.get_auth_header(&req.connector_auth_type)?; header.append(&mut api_key); Ok(header) } pub fn connector_base_url_payments<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, PaymentFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.braintree.base_url } pub fn connector_base_url_refunds<'a, F, Req, Res>( &self,
{ "chunk": 2, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-3985605181421955236_3
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/braintree.rs req: &'a RouterDataV2<F, RefundFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.braintree.base_url } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Braintree, curl_request: Json(BraintreePaymentsRequest), curl_response: BraintreePaymentsResponse, flow_name: Authorize, resource_common_data: PaymentFlowData, flow_request: PaymentsAuthorizeData<T>, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(self.connector_base_url_payments(req).to_string()) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Braintree, curl_request: Json(BraintreePSyncRequest), curl_response: BraintreePSyncResponse, flow_name: PSync, resource_common_data: PaymentFlowData, flow_request: PaymentsSyncData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(self.connector_base_url_payments(req).to_string()) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Braintree, curl_request: Json(BraintreeCaptureRequest), curl_response: BraintreeCaptureResponse, flow_name: Capture, resource_common_data: PaymentFlowData, flow_request: PaymentsCaptureData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(self.connector_base_url_payments(req).to_string()) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Braintree, curl_request: Json(BraintreeCancelRequest), curl_response: BraintreeCancelResponse, flow_name: Void, resource_common_data: PaymentFlowData, flow_request: PaymentVoidData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>,
{ "chunk": 3, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-3985605181421955236_4
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/braintree.rs ) -> CustomResult<String, errors::ConnectorError> { Ok(self.connector_base_url_payments(req).to_string()) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Braintree, curl_request: Json(BraintreeTokenRequest), curl_response: BraintreeTokenResponse, flow_name: PaymentMethodToken, resource_common_data: PaymentFlowData, flow_request: PaymentMethodTokenizationData<T>, flow_response: PaymentMethodTokenResponse, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse>, ) -> CustomResult<String, errors::ConnectorError> { Ok(self.connector_base_url_payments(req).to_string()) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Braintree, curl_request: Json(BraintreeRefundRequest), curl_response: BraintreeRefundResponse, flow_name: Refund, resource_common_data: RefundFlowData, flow_request: RefundsData, flow_response: RefundsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(self.connector_base_url_refunds(req).to_string()) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Braintree, curl_request: Json(BraintreeRSyncRequest), curl_response: BraintreeRSyncResponse, flow_name: RSync, resource_common_data: RefundFlowData, flow_request: RefundSyncData, flow_response: RefundsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(self.connector_base_url_refunds(req).to_string()) } } ); impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse,
{ "chunk": 4, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-3985605181421955236_5
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/braintree.rs > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData> for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData> for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData> for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData, > for Braintree<T> { } // SourceVerification implementations for all flows impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Refund, RefundFlowData, RefundsData, RefundsResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< RSync, RefundFlowData, RefundSyncData, RefundsResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData, > for Braintree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData, > for Braintree<T> { }
{ "chunk": 5, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-3985605181421955236_6
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/braintree.rs impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< domain_types::connector_flow::VoidPC, PaymentFlowData, domain_types::connector_types::PaymentsCancelPostCaptureData, PaymentsResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData> for Braintree<T> { } // ConnectorIntegrationV2 implementations for authentication flows impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Braintree<T> { } // SourceVerification implementations for authentication flows impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Braintree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Braintree<T> { }
{ "chunk": 6, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_2904792466304541049_0
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/noon.rs use std::fmt::Debug; use base64::Engine; use common_enums::AttemptStatus; use common_utils::{ crypto::{self, VerifySignature}, errors::CustomResult, events, ext_traits::ByteSliceExt, types::StringMajorUnit, }; use domain_types::{ connector_flow::{ Accept, Authenticate, Authorize, Capture, CreateAccessToken, CreateConnectorCustomer, CreateOrder, CreateSessionToken, DefendDispute, PSync, PaymentMethodToken, PostAuthenticate, PreAuthenticate, RSync, Refund, RepeatPayment, SetupMandate, SubmitEvidence, Void, VoidPC, }, connector_types::{ AcceptDisputeData, AccessTokenRequestData, AccessTokenResponseData, ConnectorCustomerData, ConnectorCustomerResponse, ConnectorSpecifications, ConnectorWebhookSecrets, DisputeDefendData, DisputeFlowData, DisputeResponseData, EventType, PaymentCreateOrderData, PaymentCreateOrderResponse, PaymentFlowData, PaymentMethodTokenResponse, PaymentMethodTokenizationData, PaymentVoidData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsResponseData, PaymentsSyncData, RefundFlowData, RefundSyncData, RefundsData, RefundsResponseData, RepeatPaymentData, RequestDetails, SessionTokenRequestData, SessionTokenResponseData, SetupMandateRequestData, SubmitEvidenceData, }, errors, payment_method_data::PaymentMethodDataTypes, router_data::{ConnectorAuthType, ErrorResponse}, router_data_v2::RouterDataV2, router_response_types::Response, types::Connectors, }; use hyperswitch_masking::{Mask, Maskable, PeekInterface}; use interfaces::{ api::ConnectorCommon, connector_integration_v2::ConnectorIntegrationV2, connector_types, }; use serde::Serialize; pub mod transformers; use error_stack::ResultExt; pub const BASE64_ENGINE: base64::engine::GeneralPurpose = base64::engine::general_purpose::STANDARD; use transformers::{ self as noon, NoonAuthType, NoonErrorResponse, NoonPaymentsActionRequest, NoonPaymentsActionRequest as NoonPaymentsRefundActionRequest, NoonPaymentsCancelRequest, NoonPaymentsRequest, NoonPaymentsResponse, NoonPaymentsResponse as NoonPaymentsSyncResponse, NoonPaymentsResponse as NoonPaymentsCaptureResponse, NoonPaymentsResponse as NoonPaymentsVoidResponse, RefundResponse, RefundSyncResponse, SetupMandateRequest, SetupMandateResponse, }; use super::macros; use crate::{types::ResponseRouterData, with_error_response_body}; // Local headers module mod headers { pub const CONTENT_TYPE: &str = "Content-Type"; pub const AUTHORIZATION: &str = "Authorization"; } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::ConnectorServiceTrait<T> for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAuthorizeV2<T> for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentSyncV2 for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentVoidV2 for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RefundSyncV2 for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RefundV2 for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentCapture for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::ValidationTrait for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentOrderCreate for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::SetupMandateV2<T> for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RepeatPaymentV2 for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentVoidPostCaptureV2 for Noon<T> { }
{ "chunk": 0, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_2904792466304541049_1
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/noon.rs impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::AcceptDispute for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::SubmitEvidenceV2 for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::DisputeDefend for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::IncomingWebhook for Noon<T> { fn get_webhook_source_verification_signature( &self, request: &RequestDetails, _connector_webhook_secret: &ConnectorWebhookSecrets, ) -> CustomResult<Vec<u8>, errors::ConnectorError> { let webhook_body: noon::NoonWebhookSignature = request .body .parse_struct("NoonWebhookSignature") .change_context(errors::ConnectorError::WebhookSignatureNotFound) .attach_printable("Missing incoming webhook signature for noon")?; let signature = webhook_body.signature; BASE64_ENGINE .decode(signature) .change_context(errors::ConnectorError::WebhookSignatureNotFound) .attach_printable("Missing incoming webhook signature for noon") } fn get_webhook_source_verification_message( &self, request: &RequestDetails, _connector_webhook_secrets: &ConnectorWebhookSecrets, ) -> CustomResult<Vec<u8>, errors::ConnectorError> { let webhook_body: noon::NoonWebhookBody = request .body .parse_struct("NoonWebhookBody") .change_context(errors::ConnectorError::WebhookSignatureNotFound) .attach_printable("Missing incoming webhook signature for noon")?; let message = format!( "{},{},{},{},{}", webhook_body.order_id, webhook_body.order_status, webhook_body.event_id, webhook_body.event_type, webhook_body.time_stamp, ); Ok(message.into_bytes()) } fn get_event_type( &self, request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<EventType, error_stack::Report<domain_types::errors::ConnectorError>> { let details: noon::NoonWebhookEvent = request .body .parse_struct("NoonWebhookEvent") .change_context(errors::ConnectorError::WebhookEventTypeNotFound) .attach_printable("Failed to parse webhook event type from Noon webhook body")?; Ok(match &details.event_type { noon::NoonWebhookEventTypes::Sale | noon::NoonWebhookEventTypes::Capture => { match &details.order_status { noon::NoonPaymentStatus::Captured => EventType::PaymentIntentSuccess, _ => Err(errors::ConnectorError::WebhookEventTypeNotFound)?, } } noon::NoonWebhookEventTypes::Fail => EventType::PaymentIntentFailure, noon::NoonWebhookEventTypes::Authorize | noon::NoonWebhookEventTypes::Authenticate | noon::NoonWebhookEventTypes::Refund | noon::NoonWebhookEventTypes::Unknown => EventType::IncomingWebhookEventUnspecified, }) } fn verify_webhook_source( &self, request: RequestDetails, connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<bool, error_stack::Report<domain_types::errors::ConnectorError>> { let algorithm = crypto::HmacSha512; let connector_webhook_secrets = match connector_webhook_secret { Some(secrets) => secrets, None => Err(domain_types::errors::ConnectorError::WebhookSourceVerificationFailed)?, }; let signature = self.get_webhook_source_verification_signature(&request, &connector_webhook_secrets)?; let message =
{ "chunk": 1, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_2904792466304541049_2
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/noon.rs self.get_webhook_source_verification_message(&request, &connector_webhook_secrets)?; algorithm .verify_signature(&connector_webhook_secrets.secret, &signature, &message) .change_context(errors::ConnectorError::WebhookSourceVerificationFailed) .attach_printable("Noon webhook signature verification failed") } fn process_payment_webhook( &self, _request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result< domain_types::connector_types::WebhookDetailsResponse, error_stack::Report<domain_types::errors::ConnectorError>, > { Ok(domain_types::connector_types::WebhookDetailsResponse { resource_id: None, status: common_enums::AttemptStatus::Unknown, connector_response_reference_id: None, error_code: None, error_message: None, raw_connector_response: None, status_code: 200, response_headers: None, mandate_reference: None, amount_captured: None, minor_amount_captured: None, error_reason: None, network_txn_id: None, transformation_status: common_enums::WebhookTransformationStatus::Incomplete, }) } fn get_webhook_resource_object( &self, request: RequestDetails, ) -> CustomResult<Box<dyn hyperswitch_masking::ErasedMaskSerialize>, errors::ConnectorError> { let resource: noon::NoonWebhookObject = request .body .parse_struct("NoonWebhookObject") .change_context(errors::ConnectorError::WebhookResourceObjectNotFound) .attach_printable("Failed to parse webhook resource object from Noon webhook body")?; Ok(Box::new(noon::NoonPaymentsResponse::from(resource))) } } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentSessionToken for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAccessToken for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::CreateConnectorCustomer for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentTokenV2<T> for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentPreAuthenticateV2<T> for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAuthenticateV2<T> for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentPostAuthenticateV2<T> for Noon<T> { } macros::create_all_prerequisites!( connector_name: Noon, generic_type: T, api: [ ( flow: Authorize, request_body: NoonPaymentsRequest<T>, response_body: NoonPaymentsResponse, router_data: RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ), ( flow: PSync, response_body: NoonPaymentsSyncResponse, router_data: RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ), ( flow: Capture, request_body: NoonPaymentsActionRequest, response_body: NoonPaymentsCaptureResponse, router_data: RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ), ( flow: Void, request_body: NoonPaymentsCancelRequest, response_body: NoonPaymentsVoidResponse, router_data: RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ), ( flow: Refund, request_body: NoonPaymentsRefundActionRequest, response_body: RefundResponse, router_data: RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ), ( flow: SetupMandate, request_body: SetupMandateRequest<T>,
{ "chunk": 2, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_2904792466304541049_3
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/noon.rs response_body: SetupMandateResponse, router_data: RouterDataV2<SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData>, ), ( flow: RSync, response_body: RefundSyncResponse, router_data: RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) ], amount_converters: [ amount_converter: StringMajorUnit ], member_functions: { pub fn build_headers<F, FCD, Req, Res>( &self, req: &RouterDataV2<F, FCD, Req, Res>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> where Self: ConnectorIntegrationV2<F, FCD, Req, Res>, { let mut header = vec![( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), )]; let mut auth_header = self.get_auth_header(&req.connector_auth_type)?; header.append(&mut auth_header); Ok(header) } pub fn connector_base_url_payments<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, PaymentFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.noon.base_url } pub fn connector_base_url_refunds<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, RefundFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.noon.base_url } pub fn get_auth_header( &self, auth_type: &ConnectorAuthType, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { let auth = NoonAuthType::try_from(auth_type)?; let encoded_api_key = auth .business_identifier .zip(auth.application_identifier) .zip(auth.api_key) .map(|((business_identifier, application_identifier), api_key)| { BASE64_ENGINE.encode(format!( "{business_identifier}.{application_identifier}:{api_key}", )) }); Ok(vec![( headers::AUTHORIZATION.to_string(), format!("Key {}", encoded_api_key.peek()).into_masked(), )]) } } ); impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorCommon for Noon<T> { fn id(&self) -> &'static str { "noon" } fn common_get_content_type(&self) -> &'static str { "application/json" } fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.noon.base_url.as_ref() } fn build_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: NoonErrorResponse = res .response .parse_struct("NoonErrorResponse") .map_err(|_| errors::ConnectorError::ResponseDeserializationFailed)?; with_error_response_body!(event_builder, response); // Adding in case of timeouts, if psync gives 4xx with this code, fail the payment let attempt_status = if response.result_code == 19001 { Some(AttemptStatus::Failure) } else { None }; Ok(ErrorResponse { status_code: res.status_code, code: response.result_code.to_string(), message: response.class_description.clone(), reason: Some(response.message.clone()), attempt_status, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, }) } } macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Noon, curl_request: Json(NoonPaymentsRequest), curl_response: NoonPaymentsResponse, flow_name: Authorize, resource_common_data: PaymentFlowData, flow_request: PaymentsAuthorizeData<T>, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: {
{ "chunk": 3, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_2904792466304541049_4
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/noon.rs fn get_headers( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}payment/v1/order", self.connector_base_url_payments(req))) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Noon, curl_request: Json(SetupMandateRequest<T>), curl_response: SetupMandateResponse, flow_name: SetupMandate, resource_common_data: PaymentFlowData, flow_request: SetupMandateRequestData<T>, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}payment/v1/order", self.connector_base_url_payments(req))) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Noon, curl_response: NoonPaymentsSyncResponse, flow_name: PSync, resource_common_data: PaymentFlowData, flow_request: PaymentsSyncData, flow_response: PaymentsResponseData, http_method: Get, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!( "{}payment/v1/order/getbyreference/{}", self.connector_base_url_payments(req), req.resource_common_data.connector_request_reference_id )) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Noon, curl_request: Json(NoonPaymentsActionRequest), curl_response: NoonPaymentsCaptureResponse, flow_name: Capture, resource_common_data: PaymentFlowData, flow_request: PaymentsCaptureData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}payment/v1/order", self.connector_base_url_payments(req))) } } ); // Add implementation for Void macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Noon, curl_request: Json(NoonPaymentsCancelRequest), curl_response: NoonPaymentsVoidResponse, flow_name: Void, resource_common_data: PaymentFlowData,
{ "chunk": 4, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_2904792466304541049_5
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/noon.rs flow_request: PaymentVoidData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}payment/v1/order", self.connector_base_url_payments(req),)) } } ); // Add implementation for Refund macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Noon, curl_request: Json(NoonPaymentsRefundActionRequest), curl_response: RefundResponse, flow_name: Refund, resource_common_data: RefundFlowData, flow_request: RefundsData, flow_response: RefundsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}payment/v1/order", self.connector_base_url_refunds(req))) } } ); // Implement RSync to fix the RefundSyncV2 trait requirement macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Noon, curl_response: RefundSyncResponse, flow_name: RSync, resource_common_data: RefundFlowData, flow_request: RefundSyncData, flow_response: RefundsResponseData, http_method: Get, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<domain_types::connector_flow::RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let request_ref_id = req.request.connector_refund_id.clone(); // Validate the refund ID to prevent injection attacks if request_ref_id.is_empty() { return Err(errors::ConnectorError::MissingRequiredField { field_name: "request_ref_id", }.into()); } Ok(format!( "{}payment/v1/order/getbyreference/{}", self.connector_base_url_refunds(req), request_ref_id, )) } } ); // Implementation for empty stubs - these will need to be properly implemented later impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData> for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData> for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData> for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize>
{ "chunk": 5, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_2904792466304541049_6
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/noon.rs ConnectorIntegrationV2< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Noon<T> { } // SourceVerification implementations for all flows impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Refund, RefundFlowData, RefundsData, RefundsResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< RSync, RefundFlowData, RefundSyncData, RefundsResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorSpecifications for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize>
{ "chunk": 6, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_2904792466304541049_7
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/noon.rs interfaces::verification::SourceVerification< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Noon<T> { } // We already have an implementation for ValidationTrait above impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData> for Noon<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Noon<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Noon<T> { } // ConnectorIntegrationV2 implementations for authentication flows impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Noon<T> { } // SourceVerification implementations for authentication flows impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Noon<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Noon<T> { }
{ "chunk": 7, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-5825213018000437869_0
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs pub mod transformers; use base64::Engine; use common_enums; use common_utils::{ errors::CustomResult, events, ext_traits::{deserialize_xml_to_struct, BytesExt}, request::RequestContent, types::MinorUnit, }; use domain_types::{ connector_flow::{ Accept, Authenticate, Authorize, Capture, CreateConnectorCustomer, CreateOrder, CreateSessionToken, DefendDispute, PSync, PostAuthenticate, PreAuthenticate, RSync, Refund, RepeatPayment, SetupMandate, SubmitEvidence, Void, VoidPC, }, connector_types::{ AcceptDisputeData, ConnectorCustomerData, ConnectorCustomerResponse, ConnectorSpecifications, ConnectorWebhookSecrets, DisputeDefendData, DisputeFlowData, DisputeResponseData, EventType, PaymentCreateOrderData, PaymentCreateOrderResponse, PaymentFlowData, PaymentVoidData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsResponseData, PaymentsSyncData, RefundFlowData, RefundSyncData, RefundWebhookDetailsResponse, RefundsData, RefundsResponseData, RepeatPaymentData, RequestDetails, SessionTokenRequestData, SessionTokenResponseData, SetupMandateRequestData, SubmitEvidenceData, WebhookDetailsResponse, }, errors::{self, ConnectorError}, payment_method_data::PaymentMethodDataTypes, router_data::{ConnectorAuthType, ErrorResponse}, router_data_v2::RouterDataV2, router_response_types::Response, types::Connectors, }; use error_stack::ResultExt; use hyperswitch_masking::{Maskable, PeekInterface}; use interfaces::{ api::ConnectorCommon, connector_integration_v2::ConnectorIntegrationV2, connector_types::{ AcceptDispute, ConnectorServiceTrait, CreateConnectorCustomer as CreateConnectorCustomerTrait, DisputeDefend, IncomingWebhook, PaymentAuthenticateV2, PaymentAuthorizeV2, PaymentCapture, PaymentOrderCreate, PaymentPostAuthenticateV2, PaymentPreAuthenticateV2, PaymentSessionToken, PaymentSyncV2, PaymentVoidPostCaptureV2, PaymentVoidV2, RefundSyncV2, RefundV2, RepeatPaymentV2, SetupMandateV2, SubmitEvidenceV2, ValidationTrait, }, verification::SourceVerification, }; use serde::Serialize; use self::transformers::{ CnpOnlineResponse, VantivSyncResponse, WorldpayvantivAuthType, WorldpayvantivPaymentsRequest, BASE64_ENGINE, }; use super::macros; use crate::{types::ResponseRouterData, with_response_body}; pub(crate) mod headers { pub(crate) const AUTHORIZATION: &str = "Authorization"; } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > PaymentPreAuthenticateV2<T> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > PaymentAuthenticateV2<T> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > PaymentPostAuthenticateV2<T> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>,
{ "chunk": 0, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-5825213018000437869_1
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs PaymentsResponseData, > for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorServiceTrait<T> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > PaymentSessionToken for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > CreateConnectorCustomerTrait for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SetupMandateV2<T> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ValidationTrait for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > IncomingWebhook for Worldpayvantiv<T> { fn verify_webhook_source( &self, _request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<bool, error_stack::Report<ConnectorError>> { Ok(false) // WorldpayVantiv doesn't support webhooks } fn get_event_type( &self, _request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<EventType, error_stack::Report<ConnectorError>> { Err(error_stack::report!(ConnectorError::WebhooksNotImplemented)) } fn process_payment_webhook( &self, _request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<WebhookDetailsResponse, error_stack::Report<ConnectorError>> { Err(error_stack::report!(ConnectorError::WebhooksNotImplemented)) } fn process_refund_webhook( &self, _request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<RefundWebhookDetailsResponse, error_stack::Report<ConnectorError>> { Err(error_stack::report!(ConnectorError::WebhooksNotImplemented)) } } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SubmitEvidenceV2 for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize,
{ "chunk": 1, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-5825213018000437869_2
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs > DisputeDefend for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > RefundSyncV2 for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > AcceptDispute for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > RepeatPaymentV2 for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > PaymentOrderCreate for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > PaymentAuthorizeV2<T> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > PaymentSyncV2 for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > PaymentVoidV2 for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > PaymentVoidPostCaptureV2 for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::connector_types::PaymentTokenV2<T> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::connector_types::PaymentAccessToken for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > RefundV2 for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > PaymentCapture for Worldpayvantiv<T> { } // Basic connector implementation impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorCommon for Worldpayvantiv<T> { fn id(&self) -> &'static str { "worldpayvantiv" } fn common_get_content_type(&self) -> &'static str { "text/xml" } fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.worldpayvantiv.base_url.as_ref() } fn build_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response_str = std::str::from_utf8(&res.response) .map_err(|_| ConnectorError::ResponseDeserializationFailed)?; let response: transformers::CnpOnlineResponse = deserialize_xml_to_struct(response_str) .map_err(|_parse_error| ConnectorError::ResponseDeserializationFailed)?; with_response_body!(event_builder, response); Ok(ErrorResponse { status_code: res.status_code, code: response.response_code, message: response.message.clone(), reason: Some(response.message), attempt_status: None, connector_transaction_id: None, network_decline_code: None, network_advice_code: None, network_error_message: None, }) } fn get_currency_unit(&self) -> common_enums::CurrencyUnit { common_enums::CurrencyUnit::Minor } }
{ "chunk": 2, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-5825213018000437869_3
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs // Define connector prerequisites for payment flows (XML-based) // Group flows by unique request/response combinations to avoid duplicate templating structs macros::create_all_prerequisites!( connector_name: Worldpayvantiv, generic_type: T, api: [ ( flow: Authorize, request_body: WorldpayvantivPaymentsRequest<T>, response_body: CnpOnlineResponse, router_data: RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ), ( flow: PSync, response_body: VantivSyncResponse, router_data: RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) ], amount_converters: [ amount_converter: MinorUnit ], member_functions: { fn preprocess_response_bytes<F, FCD, Req, Res>( &self, _req: &RouterDataV2<F, FCD, Req, Res>, bytes: bytes::Bytes, ) -> CustomResult<bytes::Bytes, errors::ConnectorError> { // Convert XML responses to JSON format for the macro's JSON parser let response_str = std::str::from_utf8(&bytes) .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; // Parse XML to struct, then serialize back to JSON if response_str.trim().starts_with("<?xml") || response_str.trim().starts_with("<") { // This is an XML response - convert to JSON let xml_response: CnpOnlineResponse = deserialize_xml_to_struct(response_str) .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; let json_bytes = serde_json::to_vec(&xml_response) .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; Ok(bytes::Bytes::from(json_bytes)) } else { // This is already JSON or another format Ok(bytes) } } pub fn build_headers<F, FCD, Req, Res>( &self, req: &RouterDataV2<F, FCD, Req, Res>, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { let mut header = vec![]; let mut api_key = self.get_auth_header(&req.connector_auth_type)?; header.append(&mut api_key); Ok(header) } pub fn connector_base_url_payments<F, Req, Res>( &self, req: &RouterDataV2<F, PaymentFlowData, Req, Res>, ) -> String { let base_url = &req.resource_common_data.connectors.worldpayvantiv.base_url; base_url.to_string() } pub fn connector_base_url_refunds<F, Req, Res>( &self, req: &RouterDataV2<F, RefundFlowData, Req, Res>, ) -> String { req.resource_common_data.connectors.worldpayvantiv.base_url.to_string() } pub fn get_auth_header( &self, auth_type: &ConnectorAuthType, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { let auth = WorldpayvantivAuthType::try_from(auth_type)?; let auth_key = format!("{}:{}", auth.user.peek(), auth.password.peek()); let auth_header = format!("Basic {}", BASE64_ENGINE.encode(auth_key)); Ok(vec![( headers::AUTHORIZATION.to_string(), auth_header.into(), )]) } } ); // Implement the specific flows macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Worldpayvantiv, curl_request: Xml(WorldpayvantivPaymentsRequest<T>), curl_response: CnpOnlineResponse, flow_name: Authorize, resource_common_data: PaymentFlowData, flow_request: PaymentsAuthorizeData<T>, flow_response: PaymentsResponseData, http_method: Post, preprocess_response: true, generic_type: T, [PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>,
{ "chunk": 3, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-5825213018000437869_4
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<String, ConnectorError> { Ok(self.connector_base_url_payments(req).to_string()) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Worldpayvantiv, curl_response: VantivSyncResponse, flow_name: PSync, resource_common_data: PaymentFlowData, flow_request: PaymentsSyncData, flow_response: PaymentsResponseData, http_method: Get, generic_type: T, [PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { self.get_auth_header(&req.connector_auth_type) } fn get_url( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<String, ConnectorError> { let txn_id = req.request.get_connector_transaction_id() .change_context(ConnectorError::MissingConnectorTransactionID)?; let secondary_base_url = req.resource_common_data.connectors.worldpayvantiv.secondary_base_url .as_ref() .unwrap_or(&req.resource_common_data.connectors.worldpayvantiv.base_url); Ok(format!( "{secondary_base_url}/reports/dtrPaymentStatus/{txn_id}" )) } } ); // Manual implementations for flows that share request/response types impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData> for Worldpayvantiv<T> { fn get_headers( &self, req: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { self.build_headers(req) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_url( &self, req: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ) -> CustomResult<String, ConnectorError> { Ok(self.connector_base_url_payments(req).to_string()) } fn get_request_body( &self, req: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ) -> CustomResult<Option<RequestContent>, ConnectorError> { let request = WorldpayvantivPaymentsRequest::try_from(WorldpayvantivRouterData { router_data: req.clone(), connector: self.clone(), })?; Ok(Some(RequestContent::Xml(Box::new(request)))) } fn handle_response_v2( &self, data: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, event_builder: Option<&mut events::Event>, res: Response, ) -> CustomResult< RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ConnectorError, > { let response_str = std::str::from_utf8(&res.response) .change_context(ConnectorError::ResponseDeserializationFailed)?; let response: CnpOnlineResponse = deserialize_xml_to_struct(response_str) .change_context(ConnectorError::ResponseDeserializationFailed)?; if let Some(i) = event_builder { i.set_connector_response(&response) } RouterDataV2::try_from(ResponseRouterData { response, router_data: data.clone(), http_code: res.status_code, }) } fn get_error_response_v2( &self, res: Response, event_builder: Option<&mut events::Event>,
{ "chunk": 4, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-5825213018000437869_5
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs ) -> CustomResult<ErrorResponse, ConnectorError> { self.build_error_response(res, event_builder) } fn get_http_method(&self) -> common_utils::request::Method { common_utils::request::Method::Post } } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData> for Worldpayvantiv<T> { fn get_headers( &self, req: &RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { self.build_headers(req) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_url( &self, req: &RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ) -> CustomResult<String, ConnectorError> { Ok(self.connector_base_url_payments(req).to_string()) } fn get_request_body( &self, req: &RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ) -> CustomResult<Option<RequestContent>, ConnectorError> { let request = WorldpayvantivPaymentsRequest::try_from(WorldpayvantivRouterData { router_data: req.clone(), connector: self.clone(), })?; Ok(Some(RequestContent::Xml(Box::new(request)))) } fn handle_response_v2( &self, data: &RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, event_builder: Option<&mut events::Event>, res: Response, ) -> CustomResult< RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ConnectorError, > { let response_str = std::str::from_utf8(&res.response) .change_context(ConnectorError::ResponseDeserializationFailed)?; let response: CnpOnlineResponse = deserialize_xml_to_struct(response_str) .change_context(ConnectorError::ResponseDeserializationFailed)?; if let Some(i) = event_builder { i.set_connector_response(&response) } RouterDataV2::try_from(ResponseRouterData { response, router_data: data.clone(), http_code: res.status_code, }) } fn get_error_response_v2( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, ConnectorError> { self.build_error_response(res, event_builder) } fn get_http_method(&self) -> common_utils::request::Method { common_utils::request::Method::Post } } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Worldpayvantiv<T> { fn get_headers( &self, req: &RouterDataV2< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, >, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { self.build_headers(req) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_url( &self, req: &RouterDataV2< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, >, ) -> CustomResult<String, ConnectorError> { Ok(self.connector_base_url_payments(req).to_string()) } fn get_request_body( &self, req: &RouterDataV2< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, >, ) -> CustomResult<Option<RequestContent>, ConnectorError> { let request = WorldpayvantivPaymentsRequest::try_from(WorldpayvantivRouterData { router_data: req.clone(), connector: self.clone(), })?; Ok(Some(RequestContent::Xml(Box::new(request)))) } fn handle_response_v2( &self,
{ "chunk": 5, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-5825213018000437869_6
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs data: &RouterDataV2< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, >, event_builder: Option<&mut events::Event>, res: Response, ) -> CustomResult< RouterDataV2<VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData>, ConnectorError, > { let response_str = std::str::from_utf8(&res.response) .change_context(ConnectorError::ResponseDeserializationFailed)?; let response: CnpOnlineResponse = deserialize_xml_to_struct(response_str) .change_context(ConnectorError::ResponseDeserializationFailed)?; if let Some(i) = event_builder { i.set_connector_response(&response) } RouterDataV2::try_from(ResponseRouterData { response, router_data: data.clone(), http_code: res.status_code, }) } fn get_error_response_v2( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, ConnectorError> { self.build_error_response(res, event_builder) } fn get_http_method(&self) -> common_utils::request::Method { common_utils::request::Method::Post } } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<Refund, RefundFlowData, RefundsData, RefundsResponseData> for Worldpayvantiv<T> { fn get_headers( &self, req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { self.build_headers(req) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_url( &self, req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ) -> CustomResult<String, ConnectorError> { Ok(self.connector_base_url_refunds(req).to_string()) } fn get_request_body( &self, req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ) -> CustomResult<Option<RequestContent>, ConnectorError> { let request = WorldpayvantivPaymentsRequest::try_from(WorldpayvantivRouterData { router_data: req.clone(), connector: self.clone(), })?; Ok(Some(RequestContent::Xml(Box::new(request)))) } fn handle_response_v2( &self, data: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, event_builder: Option<&mut events::Event>, res: Response, ) -> CustomResult< RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ConnectorError, > { let response_str = std::str::from_utf8(&res.response) .change_context(ConnectorError::ResponseDeserializationFailed)?; let response: CnpOnlineResponse = deserialize_xml_to_struct(response_str) .change_context(ConnectorError::ResponseDeserializationFailed)?; if let Some(i) = event_builder { i.set_connector_response(&response) } RouterDataV2::try_from(ResponseRouterData { response, router_data: data.clone(), http_code: res.status_code, }) } fn get_error_response_v2( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, ConnectorError> { self.build_error_response(res, event_builder) } fn get_http_method(&self) -> common_utils::request::Method { common_utils::request::Method::Post } } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData> for Worldpayvantiv<T> { fn get_headers( &self, req: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> {
{ "chunk": 6, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-5825213018000437869_7
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs self.get_auth_header(&req.connector_auth_type) } fn get_content_type(&self) -> &'static str { "application/json" } fn get_url( &self, req: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<String, ConnectorError> { let refund_id = req.request.connector_refund_id.clone(); let secondary_base_url = req .resource_common_data .connectors .worldpayvantiv .secondary_base_url .as_ref() .unwrap_or(&req.resource_common_data.connectors.worldpayvantiv.base_url); Ok(format!( "{}/reports/dtrPaymentStatus/{}", secondary_base_url, refund_id )) } fn get_request_body( &self, _req: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<Option<RequestContent>, ConnectorError> { // GET request doesn't need a body Ok(None) } fn handle_response_v2( &self, data: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, event_builder: Option<&mut events::Event>, res: Response, ) -> CustomResult< RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ConnectorError, > { let response: VantivSyncResponse = res .response .parse_struct("VantivSyncResponse") .change_context(ConnectorError::ResponseDeserializationFailed)?; if let Some(i) = event_builder { i.set_connector_response(&response) } RouterDataV2::try_from(ResponseRouterData { response, router_data: data.clone(), http_code: res.status_code, }) } fn get_error_response_v2( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, ConnectorError> { self.build_error_response(res, event_builder) } fn get_http_method(&self) -> common_utils::request::Method { common_utils::request::Method::Get } } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData, > for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData> for Worldpayvantiv<T> { } // Empty implementations for dispute flows impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData> for Worldpayvantiv<T> { } // Empty implementations for order flows impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<
{ "chunk": 7, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-5825213018000437869_8
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Worldpayvantiv<T> { } impl<T: PaymentMethodDataTypes + std::fmt::Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< domain_types::connector_flow::CreateAccessToken, PaymentFlowData, domain_types::connector_types::AccessTokenRequestData, domain_types::connector_types::AccessTokenResponseData, > for Worldpayvantiv<T> { } impl<T: PaymentMethodDataTypes + std::fmt::Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< domain_types::connector_flow::PaymentMethodToken, PaymentFlowData, domain_types::connector_types::PaymentMethodTokenizationData<T>, domain_types::connector_types::PaymentMethodTokenResponse, > for Worldpayvantiv<T> { } // SourceVerification implementations for all flows impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SourceVerification<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SourceVerification< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SourceVerification<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SourceVerification<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SourceVerification<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SourceVerification<VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SourceVerification<Refund, RefundFlowData, RefundsData, RefundsResponseData> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SourceVerification<RSync, RefundFlowData, RefundSyncData, RefundsResponseData> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SourceVerification< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SourceVerification< SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData, > for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SourceVerification<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes
{ "chunk": 8, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-5825213018000437869_9
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SourceVerification<Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SourceVerification<SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData> for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SourceVerification<DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData> for Worldpayvantiv<T> { } impl<T: PaymentMethodDataTypes + std::fmt::Debug + Sync + Send + 'static + Serialize> SourceVerification< domain_types::connector_flow::CreateAccessToken, PaymentFlowData, domain_types::connector_types::AccessTokenRequestData, domain_types::connector_types::AccessTokenResponseData, > for Worldpayvantiv<T> { } impl<T: PaymentMethodDataTypes + std::fmt::Debug + Sync + Send + 'static + Serialize> SourceVerification< domain_types::connector_flow::PaymentMethodToken, PaymentFlowData, domain_types::connector_types::PaymentMethodTokenizationData<T>, domain_types::connector_types::PaymentMethodTokenResponse, > for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Worldpayvantiv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorSpecifications for Worldpayvantiv<T> { }
{ "chunk": 9, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_3913227822941483108_0
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/xendit.rs pub mod transformers; use std::fmt::Debug; use base64::Engine; use common_enums::CurrencyUnit; use common_utils::{ consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE}, errors::CustomResult, events, ext_traits::ByteSliceExt, types::FloatMajorUnit, }; use domain_types::{ connector_flow::{ Accept, Authenticate, Authorize, Capture, CreateAccessToken, CreateConnectorCustomer, CreateOrder, CreateSessionToken, DefendDispute, PSync, PaymentMethodToken, PostAuthenticate, PreAuthenticate, RSync, Refund, RepeatPayment, SetupMandate, SubmitEvidence, Void, VoidPC, }, connector_types::{ AcceptDisputeData, AccessTokenRequestData, AccessTokenResponseData, ConnectorCustomerData, ConnectorCustomerResponse, DisputeDefendData, DisputeFlowData, DisputeResponseData, PaymentCreateOrderData, PaymentCreateOrderResponse, PaymentFlowData, PaymentMethodTokenResponse, PaymentMethodTokenizationData, PaymentVoidData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsResponseData, PaymentsSyncData, RefundFlowData, RefundSyncData, RefundsData, RefundsResponseData, RepeatPaymentData, SessionTokenRequestData, SessionTokenResponseData, SetupMandateRequestData, SubmitEvidenceData, }, errors, payment_method_data::PaymentMethodDataTypes, router_data::{ConnectorAuthType, ErrorResponse}, router_data_v2::RouterDataV2, router_response_types::Response, types::Connectors, }; use hyperswitch_masking::{Mask, Maskable, PeekInterface}; use interfaces::{ api::ConnectorCommon, connector_integration_v2::ConnectorIntegrationV2, connector_types, }; use serde::Serialize; use transformers::{ self as xendit, RefundResponse, RefundResponse as RefundSyncResponse, XenditCaptureResponse, XenditErrorResponse, XenditPaymentResponse, XenditPaymentsCaptureRequest, XenditPaymentsRequest, XenditRefundRequest, XenditResponse, }; use super::macros; use crate::{types::ResponseRouterData, with_error_response_body}; pub const BASE64_ENGINE: base64::engine::GeneralPurpose = base64::engine::general_purpose::STANDARD; use error_stack::ResultExt; pub(crate) mod headers { pub(crate) const CONTENT_TYPE: &str = "Content-Type"; pub(crate) const AUTHORIZATION: &str = "Authorization"; } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::ConnectorServiceTrait<T> for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentSessionToken for Xendit<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAccessToken for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::CreateConnectorCustomer for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentAuthorizeV2<T> for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentSyncV2 for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentVoidV2 for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::RefundSyncV2 for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static
{ "chunk": 0, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_3913227822941483108_1
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/xendit.rs + Serialize, > connector_types::RefundV2 for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentCapture for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::SetupMandateV2<T> for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::AcceptDispute for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::SubmitEvidenceV2 for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::DisputeDefend for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::RepeatPaymentV2 for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentVoidPostCaptureV2 for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentTokenV2<T> for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentPreAuthenticateV2<T> for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentAuthenticateV2<T> for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentPostAuthenticateV2<T> for Xendit<T> { } macros::create_amount_converter_wrapper!(connector_name: Xendit, amount_type: FloatMajorUnit); macros::create_all_prerequisites!( connector_name: Xendit, generic_type: T, api: [ ( flow: Authorize, request_body: XenditPaymentsRequest<T>, response_body: XenditPaymentResponse, router_data: RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ), ( flow: PSync, response_body: XenditResponse, router_data: RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ), ( flow: Capture, request_body: XenditPaymentsCaptureRequest, response_body: XenditCaptureResponse, router_data: RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ), ( flow: Refund, request_body: XenditRefundRequest, response_body: RefundResponse, router_data: RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ), ( flow: RSync, response_body: RefundSyncResponse, router_data: RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) ], amount_converters: [ amount_converter: FloatMajorUnit ], member_functions: { pub fn build_headers<F, FCD, Req, Res>( &self, req: &RouterDataV2<F, FCD, Req, Res>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> where Self: ConnectorIntegrationV2<F, FCD, Req, Res>, {
{ "chunk": 1, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_3913227822941483108_2
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/xendit.rs let mut header = vec![( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), )]; let mut api_key = self.get_auth_header(&req.connector_auth_type)?; header.append(&mut api_key); Ok(header) } pub fn connector_base_url_payments<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, PaymentFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.xendit.base_url } pub fn connector_base_url_refunds<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, RefundFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.xendit.base_url } } ); impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorCommon for Xendit<T> { fn id(&self) -> &'static str { "xendit" } fn get_currency_unit(&self) -> CurrencyUnit { CurrencyUnit::Base } fn common_get_content_type(&self) -> &'static str { "application/json" } fn get_auth_header( &self, auth_type: &ConnectorAuthType, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { let auth = xendit::XenditAuthType::try_from(auth_type) .change_context(errors::ConnectorError::FailedToObtainAuthType)?; let encoded_api_key = BASE64_ENGINE.encode(format!("{}:", auth.api_key.peek())); Ok(vec![( headers::AUTHORIZATION.to_string(), format!("Basic {encoded_api_key}").into_masked(), )]) } fn base_url<'a>(&self, _connectors: &'a Connectors) -> &'a str { "" } fn build_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: XenditErrorResponse = res .response .parse_struct("XenditErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; with_error_response_body!(event_builder, response); Ok(ErrorResponse { status_code: res.status_code, code: response .error_code .unwrap_or_else(|| NO_ERROR_CODE.to_string()), message: response .message .unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()), reason: response.reason, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, }) } } macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Xendit, curl_request: Json(XenditPaymentsRequest), curl_response: XenditResponse, flow_name: Authorize, resource_common_data: PaymentFlowData, flow_request: PaymentsAuthorizeData<T>, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}/payment_requests", self.connector_base_url_payments(req))) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Xendit, curl_response: XenditPaymentResponse, flow_name: PSync, resource_common_data: PaymentFlowData, flow_request: PaymentsSyncData, flow_response: PaymentsResponseData, http_method: Get,
{ "chunk": 2, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_3913227822941483108_3
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/xendit.rs generic_type: T, [PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let connector_payment_id = req .request .connector_transaction_id .get_connector_transaction_id() .change_context(errors::ConnectorError::MissingConnectorTransactionID)?; Ok(format!( "{}/payment_requests/{connector_payment_id}", self.connector_base_url_payments(req), )) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Xendit, curl_request: Json(XenditPaymentsCaptureRequest), curl_response: XenditCaptureResponse, flow_name: Capture, resource_common_data: PaymentFlowData, flow_request: PaymentsCaptureData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let connector_payment_id = req .request .connector_transaction_id .get_connector_transaction_id() .change_context(errors::ConnectorError::MissingConnectorTransactionID)?; Ok(format!( "{}/payment_requests/{connector_payment_id}/captures", self.connector_base_url_payments(req) )) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Xendit, curl_request: Json(XenditRefundRequest), curl_response: RefundResponse, flow_name: Refund, resource_common_data: RefundFlowData, flow_request: RefundsData, flow_response: RefundsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!( "{}/refunds", self.connector_base_url_refunds(req) )) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Xendit, curl_response: RefundSyncResponse, flow_name: RSync, resource_common_data: RefundFlowData, flow_request: RefundSyncData, flow_response: RefundsResponseData, http_method: Get, generic_type: T, [PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
{ "chunk": 3, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_3913227822941483108_4
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/xendit.rs self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let connector_refund_id = req.request.connector_refund_id.clone(); Ok(format!( "{}/refunds/{}", self.connector_base_url_refunds(req), connector_refund_id )) } } ); impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::ValidationTrait for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentOrderCreate for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData> for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData> for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData> for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData> for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<
{ "chunk": 4, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_3913227822941483108_5
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/xendit.rs PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Xendit<T> { } // SourceVerification implementations for all flows impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< Refund, RefundFlowData, RefundsData, RefundsResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< RSync, RefundFlowData, RefundSyncData, RefundsResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes
{ "chunk": 5, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_3913227822941483108_6
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/xendit.rs + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::IncomingWebhook for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData> for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Xendit<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Xendit<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Xendit<T> { }
{ "chunk": 6, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_86351679979432987_0
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/adyen.rs mod test; pub mod transformers; use std::{ fmt::Debug, marker::{Send, Sync}, sync::LazyLock, }; use common_enums::{ AttemptStatus, CaptureMethod, CardNetwork, EventClass, PaymentMethod, PaymentMethodType, }; use common_utils::{ errors::CustomResult, events, ext_traits::ByteSliceExt, pii::SecretSerdeValue, types::StringMinorUnit, }; use domain_types::{ connector_flow::{ Accept, Authenticate, Authorize, Capture, CreateAccessToken, CreateConnectorCustomer, CreateOrder, CreateSessionToken, DefendDispute, PSync, PaymentMethodToken, PostAuthenticate, PreAuthenticate, RSync, Refund, SetupMandate, SubmitEvidence, Void, VoidPC, }, connector_types::{ AcceptDisputeData, AccessTokenRequestData, AccessTokenResponseData, ConnectorCustomerData, ConnectorCustomerResponse, ConnectorSpecifications, ConnectorWebhookSecrets, DisputeDefendData, DisputeFlowData, DisputeResponseData, PaymentCreateOrderData, PaymentCreateOrderResponse, PaymentFlowData, PaymentMethodTokenResponse, PaymentMethodTokenizationData, PaymentVoidData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsResponseData, PaymentsSyncData, RefundFlowData, RefundSyncData, RefundWebhookDetailsResponse, RefundsData, RefundsResponseData, RequestDetails, ResponseId, SessionTokenRequestData, SessionTokenResponseData, SetupMandateRequestData, SubmitEvidenceData, SupportedPaymentMethodsExt, WebhookDetailsResponse, }, errors, payment_method_data::{DefaultPCIHolder, PaymentMethodData, PaymentMethodDataTypes}, router_data::{ConnectorAuthType, ErrorResponse}, router_data_v2::RouterDataV2, router_response_types::Response, types::{ self, CardSpecificFeatures, ConnectorInfo, Connectors, FeatureStatus, PaymentMethodDataType, PaymentMethodDetails, PaymentMethodSpecificFeatures, SupportedPaymentMethods, }, utils, }; use error_stack::report; use hyperswitch_masking::{Mask, Maskable}; use interfaces::{ api::ConnectorCommon, connector_integration_v2::ConnectorIntegrationV2, connector_types::{self, is_mandate_supported, ConnectorValidation}, }; use serde::Serialize; use transformers::{ self as adyen, AdyenCaptureRequest, AdyenCaptureResponse, AdyenDefendDisputeRequest, AdyenDefendDisputeResponse, AdyenDisputeAcceptRequest, AdyenDisputeAcceptResponse, AdyenDisputeSubmitEvidenceRequest, AdyenNotificationRequestItemWH, AdyenPSyncResponse, AdyenPaymentRequest, AdyenPaymentResponse, AdyenRedirectRequest, AdyenRefundRequest, AdyenRefundResponse, AdyenSubmitEvidenceResponse, AdyenVoidRequest, AdyenVoidResponse, SetupMandateRequest, SetupMandateResponse, }; use super::macros; use crate::{types::ResponseRouterData, with_error_response_body}; pub(crate) mod headers { pub(crate) const CONTENT_TYPE: &str = "Content-Type"; pub(crate) const X_API_KEY: &str = "X-Api-Key"; } // Type alias for non-generic trait implementations impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::ConnectorServiceTrait<T> for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAuthorizeV2<T> for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentSessionToken for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAccessToken for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::CreateConnectorCustomer for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentSyncV2 for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentVoidV2 for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RefundSyncV2 for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RefundV2 for Adyen<T> { }
{ "chunk": 0, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_86351679979432987_1
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/adyen.rs impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentCapture for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::SetupMandateV2<T> for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::AcceptDispute for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::SubmitEvidenceV2 for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::DisputeDefend for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RepeatPaymentV2 for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentTokenV2<T> for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentPreAuthenticateV2<T> for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAuthenticateV2<T> for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentPostAuthenticateV2<T> for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentVoidPostCaptureV2 for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Adyen<T> { } macros::create_all_prerequisites!( connector_name: Adyen, generic_type: T, api: [ ( flow: Authorize, request_body: AdyenPaymentRequest<T>, response_body: AdyenPaymentResponse, router_data: RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ), ( flow: PSync, request_body: AdyenRedirectRequest, response_body: AdyenPSyncResponse, router_data: RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ), ( flow: Capture, request_body: AdyenCaptureRequest, response_body: AdyenCaptureResponse, router_data: RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ), ( flow: Void, request_body: AdyenVoidRequest, response_body: AdyenVoidResponse, router_data: RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ), ( flow: Refund, request_body: AdyenRefundRequest, response_body: AdyenRefundResponse, router_data: RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ), ( flow: SetupMandate, request_body: SetupMandateRequest<T>, response_body: SetupMandateResponse, router_data: RouterDataV2<SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData>, ), ( flow: Accept, request_body: AdyenDisputeAcceptRequest, response_body: AdyenDisputeAcceptResponse, router_data: RouterDataV2<Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData>, ), ( flow: SubmitEvidence, request_body: AdyenDisputeSubmitEvidenceRequest, response_body: AdyenSubmitEvidenceResponse, router_data: RouterDataV2<SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData>, ), ( flow: DefendDispute, request_body: AdyenDefendDisputeRequest, response_body: AdyenDefendDisputeResponse, router_data: RouterDataV2<DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData>, ) ], amount_converters: [ amount_converter_webhooks: StringMinorUnit ], member_functions: { pub fn build_headers<F, FCD, Req, Res>( &self, req: &RouterDataV2<F, FCD, Req, Res>,
{ "chunk": 1, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_86351679979432987_2
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/adyen.rs ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { let mut header = vec![( headers::CONTENT_TYPE.to_string(), "application/json".to_string().into(), )]; let mut api_key = self.get_auth_header(&req.connector_auth_type)?; header.append(&mut api_key); Ok(header) } pub fn connector_base_url_payments<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, PaymentFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.adyen.base_url } pub fn connector_base_url_refunds<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, RefundFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.adyen.base_url } pub fn connector_base_url_disputes<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, DisputeFlowData, Req, Res>, ) -> Option<&'a str> { req.resource_common_data.connectors.adyen.dispute_base_url.as_deref() } } ); impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorCommon for Adyen<T> { fn id(&self) -> &'static str { "adyen" } fn get_currency_unit(&self) -> common_enums::CurrencyUnit { common_enums::CurrencyUnit::Minor } fn get_auth_header( &self, auth_type: &ConnectorAuthType, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { let auth = adyen::AdyenAuthType::try_from(auth_type) .map_err(|_| errors::ConnectorError::FailedToObtainAuthType)?; Ok(vec![( headers::X_API_KEY.to_string(), auth.api_key.into_masked(), )]) } fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.adyen.base_url.as_ref() } fn build_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: adyen::AdyenErrorResponse = res .response .parse_struct("ErrorResponse") .map_err(|_| errors::ConnectorError::ResponseDeserializationFailed)?; with_error_response_body!(event_builder, response); Ok(ErrorResponse { status_code: res.status_code, code: response.error_code, message: response.message.to_owned(), reason: Some(response.message), attempt_status: None, connector_transaction_id: response.psp_reference, network_decline_code: None, network_advice_code: None, network_error_message: None, }) } } const ADYEN_API_VERSION: &str = "v68"; macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Adyen, curl_request: Json(AdyenPaymentRequest), curl_response: AdyenPaymentResponse, flow_name: Authorize, resource_common_data: PaymentFlowData, flow_request: PaymentsAuthorizeData<T>, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize ], other_functions: { fn get_headers( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}{}/payments", self.connector_base_url_payments(req), ADYEN_API_VERSION)) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Adyen, curl_request: Json(AdyenRedirectRequest), curl_response: AdyenPSyncResponse, flow_name: PSync, resource_common_data: PaymentFlowData, flow_request: PaymentsSyncData,
{ "chunk": 2, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_86351679979432987_3
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/adyen.rs flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize ], other_functions: { fn get_headers( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}{}/payments/details", self.connector_base_url_payments(req), ADYEN_API_VERSION)) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Adyen, curl_request: Json(AdyenCaptureRequest), curl_response: AdyenCaptureResponse, flow_name: Capture, resource_common_data: PaymentFlowData, flow_request: PaymentsCaptureData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let id = match &req.request.connector_transaction_id { ResponseId::ConnectorTransactionId(id) => id, _ => return Err(errors::ConnectorError::MissingConnectorTransactionID.into()) }; Ok(format!("{}{}/payments/{}/captures", self.connector_base_url_payments(req), ADYEN_API_VERSION, id)) } } ); impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::ValidationTrait for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentOrderCreate for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Adyen<T> { } macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Adyen, curl_request: Json(AdyenVoidRequest), curl_response: AdyenVoidResponse, flow_name: Void, resource_common_data: PaymentFlowData, flow_request: PaymentVoidData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let id = req.request.connector_transaction_id.clone(); Ok(format!("{}{}/payments/{}/cancels", self.connector_base_url_payments(req), ADYEN_API_VERSION, id)) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Adyen, curl_request: Json(AdyenDefendDisputeRequest), curl_response: AdyenDefendDisputeResponse, flow_name: DefendDispute, resource_common_data: DisputeFlowData, flow_request: DisputeDefendData, flow_response: DisputeResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers(
{ "chunk": 3, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_86351679979432987_4
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/adyen.rs &self, req: &RouterDataV2<DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let dispute_url = self.connector_base_url_disputes(req) .ok_or(errors::ConnectorError::FailedToObtainIntegrationUrl)?; Ok(format!("{dispute_url}ca/services/DisputeService/v30/defendDispute")) } } ); impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData> for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Adyen<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Adyen<T> { } // SourceVerification implementations for all flows impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Refund, RefundFlowData, RefundsData, RefundsResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< RSync, RefundFlowData, RefundSyncData, RefundsResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< SetupMandate, PaymentFlowData,
{ "chunk": 4, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_86351679979432987_5
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/adyen.rs SetupMandateRequestData<T>, PaymentsResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Adyen<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Adyen<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::IncomingWebhook for Adyen<T> { fn get_event_type( &self, request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<domain_types::connector_types::EventType, error_stack::Report<errors::ConnectorError>> { let notif: AdyenNotificationRequestItemWH = transformers::get_webhook_object_from_body(request.body).map_err(|err| { report!(errors::ConnectorError::WebhookBodyDecodingFailed) .attach_printable(format!("error while decoding webhook body {err}")) })?; Ok(transformers::get_adyen_webhook_event_type(notif.event_code)) } fn process_payment_webhook( &self, request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<WebhookDetailsResponse, error_stack::Report<errors::ConnectorError>> { let request_body_copy = request.body.clone();
{ "chunk": 5, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_86351679979432987_6
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/adyen.rs let notif: AdyenNotificationRequestItemWH = transformers::get_webhook_object_from_body(request.body).map_err(|err| { report!(errors::ConnectorError::WebhookBodyDecodingFailed) .attach_printable(format!("error while decoding webhook body {err}")) })?; Ok(WebhookDetailsResponse { resource_id: Some(ResponseId::ConnectorTransactionId( notif.psp_reference.clone(), )), status: transformers::get_adyen_payment_webhook_event(notif.event_code, notif.success)?, connector_response_reference_id: Some(notif.psp_reference), error_code: notif.reason.clone(), mandate_reference: None, error_message: notif.reason, raw_connector_response: Some(String::from_utf8_lossy(&request_body_copy).to_string()), status_code: 200, response_headers: None, transformation_status: common_enums::WebhookTransformationStatus::Complete, minor_amount_captured: None, amount_captured: None, error_reason: None, network_txn_id: None, }) } fn process_refund_webhook( &self, request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result< domain_types::connector_types::RefundWebhookDetailsResponse, error_stack::Report<errors::ConnectorError>, > { let request_body_copy = request.body.clone(); let notif: AdyenNotificationRequestItemWH = transformers::get_webhook_object_from_body(request.body).map_err(|err| { report!(errors::ConnectorError::WebhookBodyDecodingFailed) .attach_printable(format!("error while decoding webhook body {err}")) })?; Ok(RefundWebhookDetailsResponse { connector_refund_id: Some(notif.psp_reference.clone()), status: transformers::get_adyen_refund_webhook_event(notif.event_code, notif.success)?, connector_response_reference_id: Some(notif.psp_reference.clone()), error_code: notif.reason.clone(), error_message: notif.reason, raw_connector_response: Some(String::from_utf8_lossy(&request_body_copy).to_string()), status_code: 200, response_headers: None, }) } fn process_dispute_webhook( &self, request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result< domain_types::connector_types::DisputeWebhookDetailsResponse, error_stack::Report<errors::ConnectorError>, > { let request_body_copy = request.body.clone(); let notif: AdyenNotificationRequestItemWH = transformers::get_webhook_object_from_body(request.body).map_err(|err| { report!(errors::ConnectorError::WebhookBodyDecodingFailed) .attach_printable(format!("error while decoding webhook body {err}")) })?; let (stage, status) = transformers::get_dispute_stage_and_status( notif.event_code, notif.additional_data.dispute_status, ); let amount = utils::convert_amount( self.amount_converter_webhooks, notif.amount.value, notif.amount.currency, )?; Ok( domain_types::connector_types::DisputeWebhookDetailsResponse { amount, currency: notif.amount.currency, dispute_id: notif.psp_reference.clone(), stage, status, connector_response_reference_id: Some(notif.psp_reference.clone()), dispute_message: notif.reason, connector_reason_code: notif.additional_data.chargeback_reason_code, raw_connector_response: Some( String::from_utf8_lossy(&request_body_copy).to_string(), ), status_code: 200, response_headers: None, }, ) } } macros::macro_connector_implementation!(
{ "chunk": 6, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_86351679979432987_7
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/adyen.rs connector_default_implementations: [get_content_type, get_error_response_v2], connector: Adyen, curl_request: Json(AdyenRefundRequest), curl_response: AdyenRefundResponse, flow_name: Refund, resource_common_data: RefundFlowData, flow_request: RefundsData, flow_response: RefundsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!("{}{}/payments/{}/refunds", self.connector_base_url_refunds(req), ADYEN_API_VERSION, connector_payment_id)) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Adyen, curl_request: Json(SetupMandateRequest), curl_response: SetupMandateResponse, flow_name: SetupMandate, resource_common_data: PaymentFlowData, flow_request: SetupMandateRequestData<T>, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}{}/payments", self.connector_base_url_payments(req), ADYEN_API_VERSION)) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Adyen, curl_request: Json(AdyenDisputeAcceptRequest), curl_response: AdyenDisputeAcceptResponse, flow_name: Accept, resource_common_data: DisputeFlowData, flow_request: AcceptDisputeData, flow_response: DisputeResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let dispute_url = self.connector_base_url_disputes(req) .ok_or(errors::ConnectorError::FailedToObtainIntegrationUrl)?; Ok(format!("{dispute_url}ca/services/DisputeService/v30/acceptDispute")) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Adyen, curl_request: Json(AdyenDisputeSubmitEvidenceRequest), curl_response: AdyenSubmitEvidenceResponse, flow_name: SubmitEvidence, resource_common_data: DisputeFlowData, flow_request: SubmitEvidenceData, flow_response: DisputeResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
{ "chunk": 7, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_86351679979432987_8
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/adyen.rs self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let dispute_url = self.connector_base_url_disputes(req) .ok_or(errors::ConnectorError::FailedToObtainIntegrationUrl)?; Ok(format!("{dispute_url}ca/services/DisputeService/v30/supplyDefenseDocument")) } } ); static ADYEN_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLock::new(|| { let adyen_supported_capture_methods = vec![ CaptureMethod::Automatic, CaptureMethod::Manual, CaptureMethod::ManualMultiple, // CaptureMethod::Scheduled, ]; let adyen_supported_card_network = vec![ CardNetwork::AmericanExpress, CardNetwork::CartesBancaires, CardNetwork::UnionPay, CardNetwork::DinersClub, CardNetwork::Discover, CardNetwork::Interac, CardNetwork::JCB, CardNetwork::Maestro, CardNetwork::Mastercard, CardNetwork::Visa, ]; let mut adyen_supported_payment_methods = SupportedPaymentMethods::new(); adyen_supported_payment_methods.add( PaymentMethod::Card, PaymentMethodType::Credit, PaymentMethodDetails { mandates: FeatureStatus::Supported, refunds: FeatureStatus::Supported, supported_capture_methods: adyen_supported_capture_methods.clone(), specific_features: Some(PaymentMethodSpecificFeatures::Card(CardSpecificFeatures { three_ds: FeatureStatus::Supported, no_three_ds: FeatureStatus::Supported, supported_card_networks: adyen_supported_card_network.clone(), })), }, ); adyen_supported_payment_methods.add( PaymentMethod::Card, PaymentMethodType::Debit, PaymentMethodDetails { mandates: FeatureStatus::Supported, refunds: FeatureStatus::Supported, supported_capture_methods: adyen_supported_capture_methods.clone(), specific_features: Some(PaymentMethodSpecificFeatures::Card(CardSpecificFeatures { three_ds: FeatureStatus::Supported, no_three_ds: FeatureStatus::Supported, supported_card_networks: adyen_supported_card_network.clone(), })), }, ); adyen_supported_payment_methods }); static ADYEN_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { display_name: "Adyen", description: "Adyen is a Dutch payment company with the status of an acquiring bank that allows businesses to accept e-commerce, mobile, and point-of-sale payments. It is listed on the stock exchange Euronext Amsterdam.", connector_type: types::PaymentConnectorCategory::PaymentGateway, }; static ADYEN_SUPPORTED_WEBHOOK_FLOWS: &[EventClass] = &[EventClass::Payments, EventClass::Refunds]; impl ConnectorSpecifications for Adyen<DefaultPCIHolder> { fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { Some(&ADYEN_CONNECTOR_INFO) } fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { Some(&ADYEN_SUPPORTED_PAYMENT_METHODS) } fn get_supported_webhook_flows(&self) -> Option<&'static [EventClass]> { Some(ADYEN_SUPPORTED_WEBHOOK_FLOWS) } } impl ConnectorValidation for Adyen<DefaultPCIHolder> { fn validate_mandate_payment( &self, pm_type: Option<PaymentMethodType>, pm_data: PaymentMethodData<DefaultPCIHolder>, ) -> CustomResult<(), errors::ConnectorError> { let mandate_supported_pmd = std::collections::HashSet::from([PaymentMethodDataType::Card]); is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id()) } fn validate_psync_reference_id( &self, data: &PaymentsSyncData, _is_three_ds: bool, _status: AttemptStatus, _connector_meta_data: Option<SecretSerdeValue>, ) -> CustomResult<(), errors::ConnectorError> { if data.encoded_data.is_some() { return Ok(()); } Err(errors::ConnectorError::MissingRequiredField { field_name: "encoded_data",
{ "chunk": 8, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_86351679979432987_9
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/adyen.rs } .into()) } fn is_webhook_source_verification_mandatory(&self) -> bool { false } } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< domain_types::connector_flow::RepeatPayment, PaymentFlowData, domain_types::connector_types::RepeatPaymentData, PaymentsResponseData, > for Adyen<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< domain_types::connector_flow::RepeatPayment, PaymentFlowData, domain_types::connector_types::RepeatPaymentData, PaymentsResponseData, > for Adyen<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Adyen<T> { }
{ "chunk": 9, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_8636526284244175173_0
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cybersource.rs use std::fmt::Debug; use common_utils::{ consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE}, errors::CustomResult, events, ext_traits::BytesExt, types::StringMajorUnit, Method, }; use domain_types::{ connector_flow::{ Accept, Authenticate, Authorize, Capture, CreateAccessToken, CreateConnectorCustomer, CreateOrder, CreateSessionToken, DefendDispute, PSync, PaymentMethodToken, PostAuthenticate, PreAuthenticate, RSync, Refund, RepeatPayment, SetupMandate, SubmitEvidence, Void, VoidPC, }, connector_types::{ AcceptDisputeData, AccessTokenRequestData, AccessTokenResponseData, ConnectorCustomerData, ConnectorCustomerResponse, DisputeDefendData, DisputeFlowData, DisputeResponseData, PaymentCreateOrderData, PaymentCreateOrderResponse, PaymentFlowData, PaymentMethodTokenResponse, PaymentMethodTokenizationData, PaymentVoidData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsResponseData, PaymentsSyncData, RefundFlowData, RefundSyncData, RefundsData, RefundsResponseData, RepeatPaymentData, SessionTokenRequestData, SessionTokenResponseData, SetupMandateRequestData, SubmitEvidenceData, }, errors, payment_method_data::PaymentMethodDataTypes, router_data::ErrorResponse, router_data_v2::RouterDataV2, router_response_types::Response, types::{Connectors, HasConnectors}, }; use hyperswitch_masking::{ExposeInterface, Mask, Maskable, PeekInterface}; use interfaces::{ api::ConnectorCommon, connector_integration_v2::ConnectorIntegrationV2, connector_types, }; use serde::Serialize; pub mod transformers; use base64::Engine; use error_stack::{Report, ResultExt}; use ring::{digest, hmac}; use time::OffsetDateTime; pub const BASE64_ENGINE: base64::engine::GeneralPurpose = base64::engine::general_purpose::STANDARD; use transformers::{ self as cybersource, CybersourceAuthEnrollmentRequest, CybersourceAuthSetupRequest, CybersourceAuthSetupResponse, CybersourceAuthValidateRequest, CybersourceAuthenticateResponse, CybersourceAuthenticateResponse as CybersourcePostAuthenticateResponse, CybersourcePaymentsCaptureRequest, CybersourcePaymentsRequest, CybersourcePaymentsResponse, CybersourcePaymentsResponse as CybersourceCaptureResponse, CybersourcePaymentsResponse as CybersourceVoidResponse, CybersourcePaymentsResponse as CybersourceSetupMandateResponse, CybersourcePaymentsResponse as CybersourceRepeatPaymentResponse, CybersourceRefundRequest, CybersourceRefundResponse, CybersourceRepeatPaymentRequest, CybersourceRsyncResponse, CybersourceTransactionResponse, CybersourceVoidRequest, CybersourceZeroMandateRequest, }; use super::macros; use crate::{types::ResponseRouterData, with_error_response_body}; pub(crate) mod headers { pub(crate) const CONTENT_TYPE: &str = "Content-Type"; pub(crate) const ACCEPT: &str = "Accept"; pub(crate) const CONNECTOR_UNAUTHORIZED_ERROR: &str = "Authentication Error from the connector"; } // Trait implementations with generic type parameters impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::ConnectorServiceTrait<T> for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAuthorizeV2<T> for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentSyncV2 for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentVoidV2 for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentVoidPostCaptureV2 for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RefundSyncV2 for Cybersource<T> { }
{ "chunk": 0, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_8636526284244175173_1
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cybersource.rs impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RefundV2 for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentCapture for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::ValidationTrait for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentOrderCreate for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::SetupMandateV2<T> for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RepeatPaymentV2 for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::AcceptDispute for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::SubmitEvidenceV2 for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::DisputeDefend for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::IncomingWebhook for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentSessionToken for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAccessToken for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentTokenV2<T> for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentPreAuthenticateV2<T> for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAuthenticateV2<T> for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentPostAuthenticateV2<T> for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::CreateConnectorCustomer for Cybersource<T> { } macros::create_all_prerequisites!( connector_name: Cybersource, generic_type: T, api: [ ( flow: Authorize, request_body: CybersourcePaymentsRequest<T>, response_body: CybersourcePaymentsResponse, router_data: RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ), ( flow: PreAuthenticate, request_body: CybersourceAuthSetupRequest<T>, response_body: CybersourceAuthSetupResponse, router_data: RouterDataV2<PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData>, ), ( flow: Authenticate, request_body: CybersourceAuthEnrollmentRequest<T>, response_body: CybersourceAuthenticateResponse, router_data: RouterDataV2<Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData>, ), ( flow: PostAuthenticate, request_body: CybersourceAuthValidateRequest<T>, response_body: CybersourcePostAuthenticateResponse, router_data: RouterDataV2<PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData>, ), ( flow: PSync, response_body: CybersourceTransactionResponse, router_data: RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ), ( flow: Capture, request_body: CybersourcePaymentsCaptureRequest, response_body: CybersourceCaptureResponse, router_data: RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ), ( flow: Void, request_body: CybersourceVoidRequest, response_body: CybersourceVoidResponse, router_data: RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ), (
{ "chunk": 1, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_8636526284244175173_2
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cybersource.rs flow: Refund, request_body: CybersourceRefundRequest, response_body: CybersourceRefundResponse, router_data: RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ), ( flow: SetupMandate, request_body: CybersourceZeroMandateRequest<T>, response_body: CybersourceSetupMandateResponse, router_data: RouterDataV2<SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData>, ), ( flow: RSync, response_body: CybersourceRsyncResponse, router_data: RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ), ( flow: RepeatPayment, request_body: CybersourceRepeatPaymentRequest, response_body: CybersourceRepeatPaymentResponse, router_data: RouterDataV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData>, ) ], amount_converters: [ amount_converter: StringMajorUnit ], member_functions: { pub fn build_headers<F, FCD, Req, Res>( &self, req: &RouterDataV2<F, FCD, Req, Res>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> where Self: ConnectorIntegrationV2<F, FCD, Req, Res>, FCD: HasConnectors, { let date = OffsetDateTime::now_utc(); let cybersource_req = self.get_request_body(req)?; let auth = cybersource::CybersourceAuthType::try_from(&req.connector_auth_type)?; let merchant_account = auth.merchant_account.clone(); let base_url = self.base_url(req.resource_common_data.connectors()); let cybersource_host = url::Url::parse(base_url).change_context(errors::ConnectorError::RequestEncodingFailed)?; let host = cybersource_host .host_str() .ok_or(errors::ConnectorError::RequestEncodingFailed)?; let path: String = self .get_url(req)? .chars() .skip(base_url.len() - 1) .collect(); let sha256 = self.generate_digest( cybersource_req .map(|req| req.get_inner_value().expose()) .unwrap_or_default() .as_bytes() ); let http_method = self.get_http_method(); let signature = self.generate_signature( auth, host.to_string(), path.as_str(), &sha256, date, http_method, )?; let mut headers = vec![ ( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), ), ( headers::ACCEPT.to_string(), "application/hal+json;charset=utf-8".to_string().into(), ), ( "v-c-merchant-id".to_string(), merchant_account.into_masked(), ), ("Date".to_string(), date.to_string().into()), ("Host".to_string(), host.to_string().into()), ("Signature".to_string(), signature.into_masked()), ]; if matches!(http_method, Method::Post | Method::Put | Method::Patch) { headers.push(( "Digest".to_string(), format!("SHA-256={sha256}").into_masked(), )); } Ok(headers) } pub fn connector_base_url_payments<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, PaymentFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.cybersource.base_url } pub fn connector_base_url_refunds<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, RefundFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.cybersource.base_url } pub fn generate_digest(&self, payload: &[u8]) -> String { let payload_digest = digest::digest(&digest::SHA256, payload); BASE64_ENGINE.encode(payload_digest) } pub fn generate_signature( &self, auth: cybersource::CybersourceAuthType, host: String, resource: &str,
{ "chunk": 2, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_8636526284244175173_3
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cybersource.rs payload: &String, date: OffsetDateTime, http_method: Method, ) -> CustomResult<String, errors::ConnectorError> { let cybersource::CybersourceAuthType { api_key, merchant_account, api_secret, } = auth; let is_post_method = matches!(http_method, Method::Post); let is_patch_method = matches!(http_method, Method::Patch); let is_delete_method = matches!(http_method, Method::Delete); let digest_str = if is_post_method || is_patch_method { "digest " } else { "" }; let headers = format!("host date (request-target) {digest_str}v-c-merchant-id"); let request_target = if is_post_method { format!("(request-target): post {resource}\ndigest: SHA-256={payload}\n") } else if is_patch_method { format!("(request-target): patch {resource}\ndigest: SHA-256={payload}\n") } else if is_delete_method { format!("(request-target): delete {resource}\n") } else { format!("(request-target): get {resource}\n") }; let signature_string = format!( "host: {host}\ndate: {date}\n{request_target}v-c-merchant-id: {}", merchant_account.peek() ); let key_value = BASE64_ENGINE .decode(api_secret.expose()) .change_context(errors::ConnectorError::InvalidConnectorConfig { config: "connector_account_details.api_secret", })?; let key = hmac::Key::new(hmac::HMAC_SHA256, &key_value); let signature_value = BASE64_ENGINE.encode(hmac::sign(&key, signature_string.as_bytes()).as_ref()); let signature_header = format!( r#"keyid="{}", algorithm="HmacSHA256", headers="{headers}", signature="{signature_value}""#, api_key.peek() ); Ok(signature_header) } } ); impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorCommon for Cybersource<T> { fn id(&self) -> &'static str { "cybersource" } fn common_get_content_type(&self) -> &'static str { "application/json;charset=utf-8" } fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.cybersource.base_url.as_ref() } fn build_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: Result< cybersource::CybersourceErrorResponse, Report<common_utils::errors::ParsingError>, > = res.response.parse_struct("Cybersource ErrorResponse"); let error_message = if res.status_code == 401 { headers::CONNECTOR_UNAUTHORIZED_ERROR.to_string() } else { NO_ERROR_MESSAGE.to_string() }; match response { Ok(transformers::CybersourceErrorResponse::StandardError(response)) => { with_error_response_body!(event_builder, response); let (code, message, reason) = match response.error_information { Some(ref error_info) => { let detailed_error_info = error_info.details.as_ref().map(|details| { details .iter() .map(|det| format!("{} : {}", det.field, det.reason)) .collect::<Vec<_>>() .join(", ") }); ( error_info.reason.clone(), error_info.reason.clone(), transformers::get_error_reason( Some(error_info.message.clone()), detailed_error_info, None, ), ) } None => { let detailed_error_info = response.details.map(|details| { details .iter()
{ "chunk": 3, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_8636526284244175173_4
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cybersource.rs .map(|det| format!("{} : {}", det.field, det.reason)) .collect::<Vec<_>>() .join(", ") }); ( response .reason .clone() .map_or(NO_ERROR_CODE.to_string(), |reason| reason.to_string()), response .reason .map_or(error_message.to_string(), |reason| reason.to_string()), transformers::get_error_reason( response.message, detailed_error_info, None, ), ) } }; Ok(ErrorResponse { status_code: res.status_code, code, message, reason, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, }) } Ok(transformers::CybersourceErrorResponse::AuthenticationError(response)) => { with_error_response_body!(event_builder, response); Ok(ErrorResponse { status_code: res.status_code, code: NO_ERROR_CODE.to_string(), message: response.response.rmsg.clone(), reason: Some(response.response.rmsg), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, }) } Ok(transformers::CybersourceErrorResponse::NotAvailableError(response)) => { with_error_response_body!(event_builder, response); let error_response = response .errors .iter() .map(|error_info| { format!( "{}: {}", error_info.error_type.clone().unwrap_or("".to_string()), error_info.message.clone().unwrap_or("".to_string()) ) }) .collect::<Vec<String>>() .join(" & "); Ok(ErrorResponse { status_code: res.status_code, code: NO_ERROR_CODE.to_string(), message: error_response.clone(), reason: Some(error_response), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, }) } Err(error_msg) => { if let Some(event) = event_builder { event.set_connector_response(&serde_json::json!({"error": "Error response parsing failed", "status_code": res.status_code})) }; tracing::error!(deserialization_error =? error_msg); domain_types::utils::handle_json_response_deserialization_failure( res, "cybersource", ) } } } } macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Cybersource, curl_request: Json(CybersourcePaymentsRequest), curl_response: CybersourcePaymentsResponse, flow_name: Authorize, resource_common_data: PaymentFlowData, flow_request: PaymentsAuthorizeData<T>, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self,
{ "chunk": 4, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_8636526284244175173_5
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cybersource.rs req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}pts/v2/payments/", self.connector_base_url_payments(req))) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Cybersource, curl_request: Json(CybersourceAuthSetupRequest<T>), curl_response: CybersourceAuthSetupResponse, flow_name: PreAuthenticate, resource_common_data: PaymentFlowData, flow_request: PaymentsPreAuthenticateData<T>, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!( "{}risk/v1/authentication-setups", self.connector_base_url_payments(req) )) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Cybersource, curl_request: Json(CybersourceAuthEnrollmentRequest<T>), curl_response: CybersourceAuthenticateResponse, flow_name: Authenticate, resource_common_data: PaymentFlowData, flow_request: PaymentsAuthenticateData<T>, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!( "{}risk/v1/authentications", self.connector_base_url_payments(req) )) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Cybersource, curl_request: Json(CybersourceAuthValidateRequest<T>), curl_response: CybersourcePostAuthenticateResponse, flow_name: PostAuthenticate, resource_common_data: PaymentFlowData, flow_request: PaymentsPostAuthenticateData<T>, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!( "{}risk/v1/authentication-results", self.connector_base_url_payments(req) )) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2],
{ "chunk": 5, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_8636526284244175173_6
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cybersource.rs connector: Cybersource, curl_request: Json(CybersourceZeroMandateRequest<T>), curl_response: CybersourceSetupMandateResponse, flow_name: SetupMandate, resource_common_data: PaymentFlowData, flow_request: SetupMandateRequestData<T>, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}pts/v2/payments/", self.connector_base_url_payments(req))) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Cybersource, curl_response: CybersourceTransactionResponse, flow_name: PSync, resource_common_data: PaymentFlowData, flow_request: PaymentsSyncData, flow_response: PaymentsResponseData, http_method: Get, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let connector_payment_id = req .request .connector_transaction_id .get_connector_transaction_id() .change_context(errors::ConnectorError::MissingConnectorTransactionID)?; Ok(format!( "{}tss/v2/transactions/{}", self.connector_base_url_payments(req), connector_payment_id )) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Cybersource, curl_request: Json(CybersourcePaymentsCaptureRequest), curl_response: CybersourceCaptureResponse, flow_name: Capture, resource_common_data: PaymentFlowData, flow_request: PaymentsCaptureData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let connector_payment_id = req .request .connector_transaction_id .get_connector_transaction_id() .change_context(errors::ConnectorError::MissingConnectorTransactionID)?; Ok(format!( "{}pts/v2/payments/{}/captures", self.connector_base_url_payments(req), connector_payment_id, )) } } ); // Add implementation for Void macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Cybersource, curl_request: Json(CybersourceVoidRequest), curl_response: CybersourceVoidResponse, flow_name: Void, resource_common_data: PaymentFlowData, flow_request: PaymentVoidData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: {
{ "chunk": 6, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_8636526284244175173_7
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cybersource.rs fn get_headers( &self, req: &RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!( "{}pts/v2/payments/{connector_payment_id}/reversals", self.connector_base_url_payments(req), )) } } ); // Add implementation for Refund macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Cybersource, curl_request: Json(CybersourceRefundRequest), curl_response: CybersourceRefundResponse, flow_name: Refund, resource_common_data: RefundFlowData, flow_request: RefundsData, flow_response: RefundsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!( "{}pts/v2/payments/{}/refunds", self.connector_base_url_refunds(req), connector_payment_id )) } } ); // Implement RSync to fix the RefundSyncV2 trait requirement macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Cybersource, curl_response: CybersourceRsyncResponse, flow_name: RSync, resource_common_data: RefundFlowData, flow_request: RefundSyncData, flow_response: RefundsResponseData, http_method: Get, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<domain_types::connector_flow::RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let refund_id = req.request.connector_refund_id.clone(); Ok(format!( "{}tss/v2/transactions/{}", self.connector_base_url_refunds(req), refund_id )) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Cybersource, curl_request: Json(CybersourceRepeatPaymentRequest), curl_response: CybersourceRepeatPaymentResponse, flow_name: RepeatPayment, resource_common_data: PaymentFlowData, flow_request: RepeatPaymentData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!( "{}pts/v2/payments/",
{ "chunk": 7, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_8636526284244175173_8
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cybersource.rs self.connector_base_url_payments(req), )) } } ); // Stub implementations for unsupported flows impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Cybersource<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData> for Cybersource<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData> for Cybersource<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData> for Cybersource<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Cybersource<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Cybersource<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Cybersource<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Cybersource<T> { } // SourceVerification implementations for all flows impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData, > for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData, > for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData, > for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData, > for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Refund, RefundFlowData, RefundsData, RefundsResponseData, > for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< RSync, RefundFlowData, RefundSyncData, RefundsResponseData, > for Cybersource<T> { }
{ "chunk": 8, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_8636526284244175173_9
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cybersource.rs impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData, > for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData, > for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData, > for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData, > for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData, > for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Cybersource<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Cybersource<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Cybersource<T> { } // Authentication flow SourceVerification implementations impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Cybersource<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Cybersource<T> { }
{ "chunk": 9, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_2622184531550450552_0
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/dlocal.rs pub mod transformers; use common_utils::{ crypto::{self, SignMessage}, date_time, errors::CustomResult, events, ext_traits::ByteSliceExt, types::MinorUnit, }; use domain_types::{ connector_flow::{ Accept, Authenticate, Authorize, Capture, CreateAccessToken, CreateConnectorCustomer, CreateOrder, CreateSessionToken, DefendDispute, PSync, PaymentMethodToken, PostAuthenticate, PreAuthenticate, RSync, Refund, RepeatPayment, SetupMandate, SubmitEvidence, Void, VoidPC, }, connector_types::{ AcceptDisputeData, AccessTokenRequestData, AccessTokenResponseData, ConnectorCustomerData, ConnectorCustomerResponse, DisputeDefendData, DisputeFlowData, DisputeResponseData, PaymentCreateOrderData, PaymentCreateOrderResponse, PaymentFlowData, PaymentMethodTokenResponse, PaymentMethodTokenizationData, PaymentVoidData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsResponseData, PaymentsSyncData, RefundFlowData, RefundSyncData, RefundsData, RefundsResponseData, RepeatPaymentData, SessionTokenRequestData, SessionTokenResponseData, SetupMandateRequestData, SubmitEvidenceData, }, errors, payment_method_data::PaymentMethodDataTypes, router_data::ErrorResponse, router_data_v2::RouterDataV2, router_response_types::Response, types::Connectors, }; use error_stack::ResultExt; use hyperswitch_masking::{Mask, Maskable, PeekInterface}; use interfaces::{ api::ConnectorCommon, connector_integration_v2::ConnectorIntegrationV2, connector_types, }; use serde::Serialize; use std::fmt::Debug; use transformers::{ self as dlocal, DlocalPaymentsCaptureRequest, DlocalPaymentsRequest, DlocalPaymentsResponse, DlocalPaymentsResponse as DlocalPaymentsSyncResponse, DlocalPaymentsResponse as DlocalPaymentsCaptureResponse, DlocalPaymentsResponse as DlocalPaymentsVoidResponse, DlocalRefundRequest, RefundResponse, RefundResponse as RefundSyncResponse, }; use super::macros; use crate::{types::ResponseRouterData, with_error_response_body}; const VERSION: &str = "2.1"; // Trait implementations with generic type parameters impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::ConnectorServiceTrait<T> for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAuthorizeV2<T> for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentSyncV2 for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentVoidV2 for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RefundSyncV2 for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RefundV2 for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentCapture for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentVoidPostCaptureV2 for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::ValidationTrait for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentOrderCreate for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::SetupMandateV2<T> for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RepeatPaymentV2 for Dlocal<T> { }
{ "chunk": 0, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_2622184531550450552_1
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/dlocal.rs impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::AcceptDispute for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::SubmitEvidenceV2 for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::DisputeDefend for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::IncomingWebhook for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentSessionToken for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentTokenV2<T> for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAccessToken for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::CreateConnectorCustomer for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentPreAuthenticateV2<T> for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAuthenticateV2<T> for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentPostAuthenticateV2<T> for Dlocal<T> { } pub(crate) mod headers { pub(crate) const AUTHORIZATION: &str = "Authorization"; pub(crate) const CONTENT_TYPE: &str = "Content-Type"; pub(crate) const X_DATE: &str = "X-Date"; pub(crate) const X_LOGIN: &str = "X-Login"; pub(crate) const X_TRANS_KEY: &str = "X-Trans-Key"; pub(crate) const X_VERSION: &str = "X-Version"; } macros::create_all_prerequisites!( connector_name: Dlocal, generic_type: T, api: [ ( flow: Authorize, request_body: DlocalPaymentsRequest<T>, response_body: DlocalPaymentsResponse, router_data: RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ), ( flow: PSync, response_body: DlocalPaymentsSyncResponse, router_data: RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ), ( flow: Refund, request_body: DlocalRefundRequest, response_body: RefundResponse, router_data: RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ), ( flow: RSync, response_body: RefundSyncResponse, router_data: RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ), ( flow: Capture, request_body: DlocalPaymentsCaptureRequest, response_body: DlocalPaymentsCaptureResponse, router_data: RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ), ( flow: Void, response_body: DlocalPaymentsVoidResponse, router_data: RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ) ], amount_converters: [ amount_converter: MinorUnit ], member_functions: { pub fn build_headers<F, FCD, Req, Res>( &self, req: &RouterDataV2<F, FCD, Req, Res>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> where Self: ConnectorIntegrationV2<F, FCD, Req, Res>, { let date = date_time::date_as_yyyymmddthhmmssmmmz() .change_context(errors::ConnectorError::RequestEncodingFailed)?; let auth = dlocal::DlocalAuthType::try_from(&req.connector_auth_type)?; let request_body = match self.get_request_body(req)? { Some(dlocal_req) => dlocal_req.get_inner_value().peek().to_owned(), None => String::new(), }; let sign_req: String = format!( "{}{}{}", auth.x_login.peek(), date, request_body ); let authz = crypto::HmacSha256::sign_message( &crypto::HmacSha256,
{ "chunk": 1, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_2622184531550450552_2
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/dlocal.rs auth.secret.peek().as_bytes(), sign_req.as_bytes(), ) .change_context(errors::ConnectorError::RequestEncodingFailed) .attach_printable("Failed to sign the message")?; let auth_string: String = format!("V2-HMAC-SHA256, Signature: {}", hex::encode(authz)); let headers = vec![ ( headers::AUTHORIZATION.to_string(), auth_string.into_masked(), ), (headers::X_LOGIN.to_string(), auth.x_login.into_masked()), ( headers::X_TRANS_KEY.to_string(), auth.x_trans_key.into_masked(), ), (headers::X_VERSION.to_string(), VERSION.to_string().into()), (headers::X_DATE.to_string(), date.into()), ( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), ), ]; Ok(headers) } pub fn connector_base_url_payments<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, PaymentFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.dlocal.base_url } pub fn connector_base_url_refunds<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, RefundFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.dlocal.base_url } } ); impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorCommon for Dlocal<T> { fn id(&self) -> &'static str { "dlocal" } fn get_currency_unit(&self) -> common_enums::CurrencyUnit { common_enums::CurrencyUnit::Minor } fn common_get_content_type(&self) -> &'static str { "application/json" } fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.dlocal.base_url.as_ref() } fn build_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: dlocal::DlocalErrorResponse = res .response .parse_struct("Dlocal ErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; with_error_response_body!(event_builder, response); Ok(ErrorResponse { status_code: res.status_code, code: response.code.to_string(), message: response.message, reason: response.param, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, }) } } macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Dlocal, curl_request: Json(DlocalPaymentsRequest), curl_response: DlocalPaymentsResponse, flow_name: Authorize, resource_common_data: PaymentFlowData, flow_request: PaymentsAuthorizeData<T>, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}secure_payments", self.connector_base_url_payments(req))) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Dlocal, curl_response: DlocalPaymentsResponse, flow_name: PSync, resource_common_data: PaymentFlowData, flow_request: PaymentsSyncData, flow_response: PaymentsResponseData, http_method: Get,
{ "chunk": 2, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_2622184531550450552_3
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/dlocal.rs generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let sync_data = dlocal::DlocalPaymentsSyncRequest::try_from(req)?; Ok(format!( "{}payments/{}/status", self.connector_base_url_payments(req), sync_data.authz_id, )) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Dlocal, curl_request: Json(DlocalRefundRequest), curl_response: RefundResponse, flow_name: Refund, resource_common_data: RefundFlowData, flow_request: RefundsData, flow_response: RefundsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}refunds", self.connector_base_url_refunds(req))) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Dlocal, curl_response: RefundResponse, flow_name: RSync, resource_common_data: RefundFlowData, flow_request: RefundSyncData, flow_response: RefundsResponseData, http_method: Get, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let sync_data = dlocal::DlocalRefundsSyncRequest::try_from(req)?; Ok(format!( "{}refunds/{}/status", self.connector_base_url_refunds(req), sync_data.refund_id, )) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Dlocal, curl_request: Json(DlocalPaymentsCaptureRequest), curl_response: DlocalPaymentsResponse, flow_name: Capture, resource_common_data: PaymentFlowData, flow_request: PaymentsCaptureData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}payments", self.connector_base_url_payments(req))) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Dlocal, curl_response: DlocalPaymentsResponse,
{ "chunk": 3, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_2622184531550450552_4
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/dlocal.rs flow_name: Void, resource_common_data: PaymentFlowData, flow_request: PaymentVoidData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let cancel_data = dlocal::DlocalPaymentsCancelRequest::try_from(req)?; Ok(format!( "{}payments/{}/cancel", self.connector_base_url_payments(req), cancel_data.cancel_id )) } } ); // Stub implementations for unsupported flows impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Dlocal<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData> for Dlocal<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData> for Dlocal<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData> for Dlocal<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData, > for Dlocal<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData> for Dlocal<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Dlocal<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Dlocal<T> { }
{ "chunk": 4, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_2622184531550450552_5
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/dlocal.rs impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Dlocal<T> { } // SourceVerification implementations for all flows impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Refund, RefundFlowData, RefundsData, RefundsResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< RSync, RefundFlowData, RefundSyncData, RefundsResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Dlocal<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Dlocal<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< CreateAccessToken,
{ "chunk": 5, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_2622184531550450552_6
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/dlocal.rs PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Dlocal<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Dlocal<T> { }
{ "chunk": 6, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_9070135151576569909_0
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/novalnet.rs pub mod transformers; use std::fmt::Debug; use base64::Engine; use common_enums::CurrencyUnit; use common_utils::{ crypto::{self, VerifySignature}, errors::CustomResult, events, ext_traits::ByteSliceExt, types::StringMinorUnit, }; use domain_types::{ connector_flow::{ Accept, Authenticate, Authorize, Capture, CreateAccessToken, CreateConnectorCustomer, CreateOrder, CreateSessionToken, DefendDispute, PSync, PaymentMethodToken, PostAuthenticate, PreAuthenticate, RSync, Refund, RepeatPayment, SetupMandate, SubmitEvidence, Void, VoidPC, }, connector_types::{ AcceptDisputeData, AccessTokenRequestData, AccessTokenResponseData, ConnectorCustomerData, ConnectorCustomerResponse, ConnectorWebhookSecrets, DisputeDefendData, DisputeFlowData, DisputeResponseData, DisputeWebhookDetailsResponse, EventType, PaymentCreateOrderData, PaymentCreateOrderResponse, PaymentFlowData, PaymentMethodTokenResponse, PaymentMethodTokenizationData, PaymentVoidData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsResponseData, PaymentsSyncData, RefundFlowData, RefundSyncData, RefundWebhookDetailsResponse, RefundsData, RefundsResponseData, RepeatPaymentData, RequestDetails, SessionTokenRequestData, SessionTokenResponseData, SetupMandateRequestData, SubmitEvidenceData, WebhookDetailsResponse, }, errors, payment_method_data::PaymentMethodDataTypes, router_data::{ConnectorAuthType, ErrorResponse}, router_data_v2::RouterDataV2, router_response_types::Response, types::Connectors, utils::{self, ForeignTryFrom}, }; use hyperswitch_masking::{ExposeInterface, Mask, Maskable}; use interfaces::{ api::ConnectorCommon, connector_integration_v2::ConnectorIntegrationV2, connector_types, }; use serde::Serialize; use transformers::{ self as novalnet, NovalnetCancelRequest, NovalnetCancelResponse, NovalnetCaptureRequest, NovalnetCaptureResponse, NovalnetPSyncResponse, NovalnetPaymentsRequest, NovalnetPaymentsRequest as NovalnetPaymentsRequestMandate, NovalnetPaymentsRequest as NovalnetRepeatPaymentsRequest, NovalnetPaymentsResponse, NovalnetPaymentsResponse as NovalnetPaymentsResponseMandate, NovalnetPaymentsResponse as NovalnetRepeatPaymentsResponse, NovalnetRefundRequest, NovalnetRefundResponse, NovalnetRefundSyncResponse, NovalnetSyncRequest, NovalnetSyncRequest as NovalnetRSyncRequest, }; use super::macros; use crate::{types::ResponseRouterData, with_error_response_body}; pub const BASE64_ENGINE: base64::engine::GeneralPurpose = base64::engine::general_purpose::STANDARD; use error_stack::ResultExt; pub(crate) mod headers { pub(crate) const CONTENT_TYPE: &str = "Content-Type"; pub(crate) const X_NN_ACCESS_KEY: &str = "X-NN-Access-Key"; } // Trait implementations with generic type parameters impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::ConnectorServiceTrait<T> for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAuthorizeV2<T> for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentSyncV2 for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentVoidV2 for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RefundSyncV2 for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RefundV2 for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentCapture for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::ValidationTrait for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentOrderCreate for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize>
{ "chunk": 0, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_9070135151576569909_1
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/novalnet.rs connector_types::SetupMandateV2<T> for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RepeatPaymentV2 for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentVoidPostCaptureV2 for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::AcceptDispute for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::SubmitEvidenceV2 for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::DisputeDefend for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentTokenV2<T> for Novalnet<T> { } // Authentication trait implementations impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentPreAuthenticateV2<T> for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAuthenticateV2<T> for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentPostAuthenticateV2<T> for Novalnet<T> { } macros::create_all_prerequisites!( connector_name: Novalnet, generic_type: T, api: [ ( flow: Authorize, request_body: NovalnetPaymentsRequest<T>, response_body: NovalnetPaymentsResponse, router_data: RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ), ( flow: PSync, request_body: NovalnetSyncRequest, response_body: NovalnetPSyncResponse, router_data: RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ), ( flow: Capture, request_body: NovalnetCaptureRequest, response_body: NovalnetCaptureResponse, router_data: RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ), ( flow: Refund, request_body: NovalnetRefundRequest, response_body: NovalnetRefundResponse, router_data: RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ), ( flow: RSync, request_body: NovalnetRSyncRequest, response_body: NovalnetRefundSyncResponse, router_data: RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ), ( flow: Void, request_body: NovalnetCancelRequest, response_body: NovalnetCancelResponse, router_data: RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ), ( flow: SetupMandate, request_body: NovalnetPaymentsRequestMandate<T>, response_body: NovalnetPaymentsResponseMandate, router_data: RouterDataV2<SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData>, ), ( flow: RepeatPayment, request_body: NovalnetRepeatPaymentsRequest<T>, response_body: NovalnetRepeatPaymentsResponse, router_data: RouterDataV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData>, ) ], amount_converters: [ amount_converter: StringMinorUnit ], member_functions: { pub fn build_headers<F, FCD, Req, Res>( &self, req: &RouterDataV2<F, FCD, Req, Res>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> where Self: ConnectorIntegrationV2<F, FCD, Req, Res>, { let mut header = vec![( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), )]; let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
{ "chunk": 1, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_9070135151576569909_2
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/novalnet.rs header.append(&mut api_key); Ok(header) } pub fn connector_base_url_payments<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, PaymentFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.novalnet.base_url } pub fn connector_base_url_refunds<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, RefundFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.novalnet.base_url } } ); // Stub implementation for CreateSessionToken // After adding the ConnectorIntegrationV2 implementation, we can now implement PaymentSessionToken // Type alias for non-generic trait implementations impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorCommon for Novalnet<T> { fn id(&self) -> &'static str { "novalnet" } fn get_currency_unit(&self) -> CurrencyUnit { CurrencyUnit::Minor } fn common_get_content_type(&self) -> &'static str { "application/json" } fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.novalnet.base_url.as_ref() } fn get_auth_header( &self, auth_type: &ConnectorAuthType, ) -> CustomResult<Vec<(String, hyperswitch_masking::Maskable<String>)>, errors::ConnectorError> { let auth = novalnet::NovalnetAuthType::try_from(auth_type) .change_context(errors::ConnectorError::FailedToObtainAuthType)?; let api_key: String = auth.payment_access_key.expose(); let encoded_api_key = BASE64_ENGINE.encode(api_key); Ok(vec![( headers::X_NN_ACCESS_KEY.to_string(), encoded_api_key.into_masked(), )]) } fn build_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: novalnet::NovalnetErrorResponse = res .response .parse_struct("NovalnetErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; with_error_response_body!(event_builder, response); Ok(ErrorResponse { status_code: res.status_code, code: response.code, message: response.message, reason: response.reason, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, }) } } macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Novalnet, curl_request: Json(NovalnetPaymentsRequest), curl_response: NovalnetPaymentsResponse, flow_name: Authorize, resource_common_data: PaymentFlowData, flow_request: PaymentsAuthorizeData<T>, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let url = if req.request.is_auto_capture()? { format!("{}/payment",self.connector_base_url_payments(req)) } else { format!("{}/authorize",self.connector_base_url_payments(req)) }; Ok(url) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Novalnet, curl_request: Json(NovalnetSyncRequest), curl_response: NovalnetPSyncResponse, flow_name: PSync, resource_common_data: PaymentFlowData, flow_request: PaymentsSyncData, flow_response: PaymentsResponseData,
{ "chunk": 2, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_9070135151576569909_3
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/novalnet.rs http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!( "{}/transaction/details", self.connector_base_url_payments(req), )) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Novalnet, curl_request: Json(NovalnetCaptureRequest), curl_response: NovalnetCaptureResponse, flow_name: Capture, resource_common_data: PaymentFlowData, flow_request: PaymentsCaptureData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!( "{}/transaction/capture", self.connector_base_url_payments(req) )) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Novalnet, curl_request: Json(NovalnetRefundRequest), curl_response: NovalnetRefundResponse, flow_name: Refund, resource_common_data: RefundFlowData, flow_request: RefundsData, flow_response: RefundsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!( "{}/transaction/refund", self.connector_base_url_refunds(req) )) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Novalnet, curl_request: Json(NovalnetSyncRequest), curl_response: NovalnetRefundSyncResponse, flow_name: RSync, resource_common_data: RefundFlowData, flow_request: RefundSyncData, flow_response: RefundsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!( "{}/transaction/details", self.connector_base_url_refunds(req) )) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Novalnet, curl_request: Json(NovalnetCancelRequest),
{ "chunk": 3, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_9070135151576569909_4
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/novalnet.rs curl_response: NovalnetCancelResponse, flow_name: Void, resource_common_data: PaymentFlowData, flow_request: PaymentVoidData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}/transaction/cancel", self.connector_base_url_payments(req))) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Novalnet, curl_request: Json(NovalnetPaymentsRequest), curl_response: NovalnetPaymentsResponse, flow_name: SetupMandate, resource_common_data: PaymentFlowData, flow_request: SetupMandateRequestData<T>, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}/payment", self.connector_base_url_payments(req))) } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Novalnet, curl_request: Json(NovalnetRepeatPaymentsRequest), curl_response: NovalnetRepeatPaymentsResponse, flow_name: RepeatPayment, resource_common_data: PaymentFlowData, flow_request: RepeatPaymentData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let url = if req.request.is_auto_capture()? { format!("{}/payment",self.connector_base_url_payments(req)) } else { format!("{}/authorize",self.connector_base_url_payments(req)) }; Ok(url) } } ); impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::IncomingWebhook for Novalnet<T> { fn get_webhook_source_verification_signature( &self, request: &RequestDetails, _connector_webhook_secret: &ConnectorWebhookSecrets, ) -> Result<Vec<u8>, error_stack::Report<domain_types::errors::ConnectorError>> { let notif_item = get_webhook_object_from_body(&request.body) .change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?; hex::decode(notif_item.event.checksum) .change_context(errors::ConnectorError::WebhookVerificationSecretInvalid) } fn get_webhook_source_verification_message( &self, request: &RequestDetails, connector_webhook_secrets: &ConnectorWebhookSecrets, ) -> Result<Vec<u8>, error_stack::Report<domain_types::errors::ConnectorError>> { let notif = get_webhook_object_from_body(&request.body)
{ "chunk": 4, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_9070135151576569909_5
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/novalnet.rs .change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?; let (amount, currency) = match notif.transaction { novalnet::NovalnetWebhookTransactionData::CaptureTransactionData(data) => { (data.amount, data.currency) } novalnet::NovalnetWebhookTransactionData::CancelTransactionData(data) => { (data.amount, data.currency) } novalnet::NovalnetWebhookTransactionData::RefundsTransactionData(data) => { (data.amount, data.currency) } novalnet::NovalnetWebhookTransactionData::SyncTransactionData(data) => { (data.amount, data.currency) } }; let amount = amount .map(|amount| amount.to_string()) .unwrap_or("".to_string()); let currency = currency .map(|amount| amount.to_string()) .unwrap_or("".to_string()); let secret_auth = String::from_utf8(connector_webhook_secrets.secret.to_vec()) .change_context(errors::ConnectorError::WebhookVerificationSecretInvalid) .attach_printable("Could not convert webhook secret auth to UTF-8")?; let reversed_secret_auth = novalnet::reverse_string(&secret_auth); let message = format!( "{}{}{}{}{}{}", notif.event.tid, notif.event.event_type, notif.result.status, amount, currency, reversed_secret_auth ); Ok(message.into_bytes()) } fn verify_webhook_source( &self, request: RequestDetails, connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<bool, error_stack::Report<domain_types::errors::ConnectorError>> { let algorithm = crypto::Sha256; let connector_webhook_secrets = match connector_webhook_secret { Some(secrets) => secrets, None => { tracing::warn!( target: "novalnet_webhook", "Missing webhook secret for Novalnet webhook verification - verification failed but continuing processing" ); return Ok(false); } }; let signature = match self .get_webhook_source_verification_signature(&request, &connector_webhook_secrets) { Ok(sig) => sig, Err(error) => { tracing::warn!( target: "novalnet_webhook", "Failed to get webhook source verification signature for Novalnet: {} - verification failed but continuing processing", error ); return Ok(false); } }; let message = match self .get_webhook_source_verification_message(&request, &connector_webhook_secrets) { Ok(msg) => msg, Err(error) => { tracing::warn!( target: "novalnet_webhook", "Failed to get webhook source verification message for Novalnet: {} - verification failed but continuing processing", error ); return Ok(false); } }; match algorithm.verify_signature(&connector_webhook_secrets.secret, &signature, &message) { Ok(is_verified) => Ok(is_verified), Err(error) => { tracing::warn!( target: "novalnet_webhook", "Failed to verify webhook signature for Novalnet: {} - verification failed but continuing processing", error ); Ok(false) } } } fn get_event_type( &self, request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<EventType, error_stack::Report<domain_types::errors::ConnectorError>> { let notif = get_webhook_object_from_body(&request.body) .change_context(errors::ConnectorError::WebhookEventTypeNotFound)?; let optional_transaction_status = match notif.transaction {
{ "chunk": 5, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_9070135151576569909_6
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/novalnet.rs novalnet::NovalnetWebhookTransactionData::CaptureTransactionData(data) => { Some(data.status) } novalnet::NovalnetWebhookTransactionData::CancelTransactionData(data) => data.status, novalnet::NovalnetWebhookTransactionData::RefundsTransactionData(data) => { Some(data.status) } novalnet::NovalnetWebhookTransactionData::SyncTransactionData(data) => { Some(data.status) } }; let transaction_status = optional_transaction_status.ok_or(errors::ConnectorError::MissingRequiredField { field_name: "transaction_status", })?; // NOTE: transaction_status will always be present for Webhooks // But we are handling optional type here, since we are reusing TransactionData Struct from NovalnetPaymentsResponseTransactionData for Webhooks response too // In NovalnetPaymentsResponseTransactionData, transaction_status is optional let incoming_webhook_event = novalnet::get_incoming_webhook_event(notif.event.event_type, transaction_status); Ok(incoming_webhook_event) } fn process_payment_webhook( &self, request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<WebhookDetailsResponse, error_stack::Report<domain_types::errors::ConnectorError>> { let notif = get_webhook_object_from_body(&request.body) .change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?; let response = WebhookDetailsResponse::try_from(notif) .change_context(errors::ConnectorError::WebhookBodyDecodingFailed); response.map(|mut response| { response.raw_connector_response = Some(String::from_utf8_lossy(&request.body).to_string()); response }) } fn process_refund_webhook( &self, request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result< RefundWebhookDetailsResponse, error_stack::Report<domain_types::errors::ConnectorError>, > { let notif: novalnet::NovalnetWebhookNotificationResponseRefunds = request .body .parse_struct("NovalnetWebhookNotificationResponse") .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; let response = RefundWebhookDetailsResponse::try_from(notif) .change_context(errors::ConnectorError::WebhookBodyDecodingFailed); response.map(|mut response| { response.raw_connector_response = Some(String::from_utf8_lossy(&request.body).to_string()); response }) } fn process_dispute_webhook( &self, request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result< DisputeWebhookDetailsResponse, error_stack::Report<domain_types::errors::ConnectorError>, > { let notif: transformers::NovalnetWebhookNotificationResponse = get_webhook_object_from_body(&request.body) .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; let (amount, currency, reason, reason_code) = match notif.transaction { novalnet::NovalnetWebhookTransactionData::CaptureTransactionData(data) => { (data.amount, data.currency, None, None) } novalnet::NovalnetWebhookTransactionData::CancelTransactionData(data) => { (data.amount, data.currency, None, None) } novalnet::NovalnetWebhookTransactionData::RefundsTransactionData(data) => { (data.amount, data.currency, None, None) } novalnet::NovalnetWebhookTransactionData::SyncTransactionData(data) => { (data.amount, data.currency, data.reason, data.reason_code) } };
{ "chunk": 6, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_9070135151576569909_7
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/novalnet.rs let dispute_status = novalnet::get_novalnet_dispute_status(notif.event.event_type); Ok(DisputeWebhookDetailsResponse { amount: utils::convert_amount( self.amount_converter, amount.ok_or(errors::ConnectorError::AmountConversionFailed)?, novalnet::option_to_result(currency)?, )?, currency: novalnet::option_to_result(currency)?, stage: common_enums::DisputeStage::Dispute, dispute_id: notif.event.tid.to_string(), connector_reason_code: reason_code, status: common_enums::DisputeStatus::foreign_try_from(dispute_status)?, connector_response_reference_id: None, dispute_message: reason, raw_connector_response: Some(String::from_utf8_lossy(&request.body).to_string()), status_code: 200, response_headers: None, }) } } fn get_webhook_object_from_body( body: &[u8], ) -> CustomResult<novalnet::NovalnetWebhookNotificationResponse, errors::ConnectorError> { let novalnet_webhook_notification_response = body .parse_struct("NovalnetWebhookNotificationResponse") .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; Ok(novalnet_webhook_notification_response) } // Stub implementations for unsupported flows impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData> for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData> for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData> for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Novalnet<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentSessionToken for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAccessToken for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::CreateConnectorCustomer for Novalnet<T> { } // Authentication flow implementations impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< PostAuthenticate, PaymentFlowData,
{ "chunk": 7, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_9070135151576569909_8
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/novalnet.rs PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Novalnet<T> { } // SourceVerification implementations for all flows impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Refund, RefundFlowData, RefundsData, RefundsResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< RSync, RefundFlowData, RefundSyncData, RefundsResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Novalnet<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Novalnet<T> { } // Authentication SourceVerification implementations impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Novalnet<T> { }
{ "chunk": 8, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_9070135151576569909_9
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/novalnet.rs impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Novalnet<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Novalnet<T> { }
{ "chunk": 9, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_4065829933475296120_0
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cashtocode.rs pub mod transformers; use std::fmt::Debug; use base64::Engine; use common_enums::CurrencyUnit; use common_utils::{errors::CustomResult, events, ext_traits::ByteSliceExt, types::FloatMajorUnit}; use domain_types::{ connector_flow::{ Accept, Authenticate, Authorize, Capture, CreateAccessToken, CreateConnectorCustomer, CreateOrder, CreateSessionToken, DefendDispute, PSync, PaymentMethodToken, PostAuthenticate, PreAuthenticate, RSync, Refund, RepeatPayment, SetupMandate, SubmitEvidence, Void, VoidPC, }, connector_types::{ AcceptDisputeData, AccessTokenRequestData, AccessTokenResponseData, ConnectorCustomerData, ConnectorCustomerResponse, ConnectorWebhookSecrets, DisputeDefendData, DisputeFlowData, DisputeResponseData, PaymentCreateOrderData, PaymentCreateOrderResponse, PaymentFlowData, PaymentMethodTokenResponse, PaymentMethodTokenizationData, PaymentVoidData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsResponseData, PaymentsSyncData, RefundFlowData, RefundSyncData, RefundsData, RefundsResponseData, RepeatPaymentData, RequestDetails, SessionTokenRequestData, SessionTokenResponseData, SetupMandateRequestData, SubmitEvidenceData, }, errors, payment_method_data::PaymentMethodDataTypes, router_data::{ConnectorAuthType, ErrorResponse}, router_data_v2::RouterDataV2, router_response_types::Response, types::Connectors, }; use error_stack::ResultExt; use hyperswitch_masking::{Mask, Maskable, PeekInterface, Secret}; use interfaces::{ api::ConnectorCommon, connector_integration_v2::ConnectorIntegrationV2, connector_types, verification::{ConnectorSourceVerificationSecrets, SourceVerification}, }; use serde::Serialize; use transformers::{self as cashtocode, CashtocodePaymentsRequest, CashtocodePaymentsResponse}; use super::macros; use crate::{types::ResponseRouterData, with_error_response_body}; pub(crate) mod headers { pub(crate) const CONTENT_TYPE: &str = "Content-Type"; pub(crate) const AUTHORIZATION: &str = "Authorization"; } // Trait implementations with generic type parameters impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::ConnectorServiceTrait<T> for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentAuthorizeV2<T> for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentSyncV2 for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentSessionToken for Cashtocode<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAccessToken for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::CreateConnectorCustomer for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentVoidV2 for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::RefundSyncV2 for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::RefundV2 for Cashtocode<T> { } impl<
{ "chunk": 0, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_4065829933475296120_1
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cashtocode.rs T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentCapture for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::SetupMandateV2<T> for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::AcceptDispute for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::SubmitEvidenceV2 for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::DisputeDefend for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::IncomingWebhook for Cashtocode<T> { fn verify_webhook_source( &self, request: RequestDetails, connector_webhook_secrets: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<bool, error_stack::Report<domain_types::errors::ConnectorError>> { let webhook_secret = match connector_webhook_secrets.clone() { Some(secrets) => secrets, None => return Ok(false), }; let base64_signature = request .headers .get("authorization") .ok_or(errors::ConnectorError::WebhookSignatureNotFound)?; let signature = base64_signature.as_bytes(); let secret_auth = String::from_utf8(webhook_secret.secret.to_vec()) .change_context(errors::ConnectorError::WebhookSourceVerificationFailed) .attach_printable("Could not convert secret to UTF-8")?; let signature_auth = String::from_utf8(signature.to_vec()) .change_context(errors::ConnectorError::WebhookSourceVerificationFailed) .attach_printable("Could not convert secret to UTF-8")?; Ok(signature_auth == secret_auth) } fn get_event_type( &self, _request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result< domain_types::connector_types::EventType, error_stack::Report<domain_types::errors::ConnectorError>, > { Ok(domain_types::connector_types::EventType::PaymentIntentSuccess) } fn process_payment_webhook( &self, request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result< domain_types::connector_types::WebhookDetailsResponse, error_stack::Report<domain_types::errors::ConnectorError>, > { let webhook: transformers::CashtocodePaymentsSyncResponse = request .body .parse_struct("CashtocodePaymentsSyncResponse") .change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?; Ok(domain_types::connector_types::WebhookDetailsResponse { resource_id: Some( domain_types::connector_types::ResponseId::ConnectorTransactionId( webhook.transaction_id.clone(), ), ), status: common_enums::AttemptStatus::Charged, status_code: 200, mandate_reference: None, connector_response_reference_id: None, error_code: None, error_message: None, raw_connector_response: Some(String::from_utf8_lossy(&request.body).to_string()), response_headers: None, minor_amount_captured: None, amount_captured: None, error_reason: None,
{ "chunk": 1, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_4065829933475296120_2
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cashtocode.rs network_txn_id: None, transformation_status: common_enums::WebhookTransformationStatus::Complete, }) } } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentOrderCreate for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::ValidationTrait for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::RepeatPaymentV2 for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentTokenV2<T> for Cashtocode<T> { } // Authentication trait implementations impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentPreAuthenticateV2<T> for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentAuthenticateV2<T> for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentPostAuthenticateV2<T> for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentVoidPostCaptureV2 for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Cashtocode<T> { } macros::create_all_prerequisites!( connector_name: Cashtocode, generic_type: T, api: [ ( flow: Authorize, request_body: CashtocodePaymentsRequest, response_body: CashtocodePaymentsResponse, router_data: RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) ], amount_converters: [ amount_converter: FloatMajorUnit ], member_functions: { pub fn build_headers<F, FCD, Req, Res>( &self, _req: &RouterDataV2<F, FCD, Req, Res>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> where Self: ConnectorIntegrationV2<F, FCD, Req, Res>, { Ok(vec![( headers::CONTENT_TYPE.to_string(), self.common_get_content_type().to_string().into(), )]) } pub fn connector_base_url_payments<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, PaymentFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.cashtocode.base_url } pub fn connector_base_url_refunds<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, RefundFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.cashtocode.base_url } } ); macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Cashtocode, curl_request: Json(CashtocodePaymentsRequest), curl_response: CashtocodePaymentsResponse, flow_name: Authorize, resource_common_data: PaymentFlowData, flow_request: PaymentsAuthorizeData<T>, flow_response: PaymentsResponseData, http_method: Post, generic_type: T,
{ "chunk": 2, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_4065829933475296120_3
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cashtocode.rs [PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { let mut header = vec![( headers::CONTENT_TYPE.to_string(), self.common_get_content_type().to_string().into(), )]; let auth_type = transformers::CashtocodeAuth::try_from(( &req.connector_auth_type, &req.request.currency, ))?; let mut api_key = get_b64_auth_cashtocode(req.request.payment_method_type, &auth_type)?; header.append(&mut api_key); Ok(header) } fn get_url( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}/merchant/paytokens", self.connector_base_url_payments(req))) } } ); impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorCommon for Cashtocode<T> { fn id(&self) -> &'static str { "cashtocode" } fn get_currency_unit(&self) -> CurrencyUnit { CurrencyUnit::Base } fn common_get_content_type(&self) -> &'static str { "application/json" } fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.cashtocode.base_url.as_ref() } fn get_auth_header( &self, _auth_type: &ConnectorAuthType, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { // Cashtocode uses custom auth in get_headers Ok(vec![]) } fn build_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: cashtocode::CashtocodeErrorResponse = res .response .parse_struct("CashtocodeErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; with_error_response_body!(event_builder, response); Ok(ErrorResponse { status_code: res.status_code, code: response.error.to_string(), message: response.error_description.clone(), reason: Some(response.error_description), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, }) } } // Stub implementations for unsupported flows impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData> for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData> for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData> for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<Refund, RefundFlowData, RefundsData, RefundsResponseData> for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize,
{ "chunk": 3, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_4065829933475296120_4
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cashtocode.rs > ConnectorIntegrationV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData> for Cashtocode<T> { } // Authentication flow implementations impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Cashtocode<T> { } //marker traits // Duplicate create_all_prerequisites! call removed - already defined above // Duplicate macro_connector_implementation! for Authorize flow removed - already defined above impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData> for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData> for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData> for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData, > for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData> for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug
{ "chunk": 4, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_4065829933475296120_5
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cashtocode.rs + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Cashtocode<T> { } // SourceVerification implementations for all flows macro_rules! impl_source_verification_stub { ($flow:ty, $common_data:ty, $req:ty, $resp:ty) => { impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SourceVerification<$flow, $common_data, $req, $resp> for Cashtocode<T> { fn get_secrets( &self, _secrets: ConnectorSourceVerificationSecrets, ) -> CustomResult<Vec<u8>, errors::ConnectorError> { Ok(Vec::new()) // STUB - will be implemented in Phase 10 } fn get_algorithm( &self, ) -> CustomResult< Box<dyn common_utils::crypto::VerifySignature + Send>, errors::ConnectorError, > { Ok(Box::new(common_utils::crypto::NoAlgorithm)) // STUB - will be implemented in Phase 10 } fn get_signature( &self, _payload: &[u8], _router_data: &RouterDataV2<$flow, $common_data, $req, $resp>, _secrets: &[u8], ) -> CustomResult<Vec<u8>, errors::ConnectorError> { Ok(Vec::new()) // STUB - will be implemented in Phase 10 } fn get_message( &self, payload: &[u8], _router_data: &RouterDataV2<$flow, $common_data, $req, $resp>, _secrets: &[u8], ) -> CustomResult<Vec<u8>, errors::ConnectorError> { Ok(payload.to_owned()) // STUB - will be implemented in Phase 10 } } }; } // Apply to all flows impl_source_verification_stub!( Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData ); impl_source_verification_stub!( PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData ); impl_source_verification_stub!( Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData ); impl_source_verification_stub!(Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData); impl_source_verification_stub!(Refund, RefundFlowData, RefundsData, RefundsResponseData); impl_source_verification_stub!(RSync, RefundFlowData, RefundSyncData, RefundsResponseData); impl_source_verification_stub!( SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData ); impl_source_verification_stub!( RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData ); impl_source_verification_stub!( Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData ); impl_source_verification_stub!( SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData ); impl_source_verification_stub!( DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData ); impl_source_verification_stub!( CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse ); impl_source_verification_stub!( PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData ); impl_source_verification_stub!( Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData ); impl_source_verification_stub!( PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData ); impl_source_verification_stub!( VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData ); impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Cashtocode<T> { } impl< T: PaymentMethodDataTypes
{ "chunk": 5, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_4065829933475296120_6
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cashtocode.rs + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Cashtocode<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Cashtocode<T> { } fn get_b64_auth_cashtocode( payment_method_type: Option<common_enums::PaymentMethodType>, auth_type: &transformers::CashtocodeAuth, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { fn construct_basic_auth( username: Option<Secret<String>>, password: Option<Secret<String>>, ) -> Result<Maskable<String>, errors::ConnectorError> { let username = username.ok_or(errors::ConnectorError::FailedToObtainAuthType)?; let password = password.ok_or(errors::ConnectorError::FailedToObtainAuthType)?; Ok(format!( "Basic {}", base64::engine::general_purpose::STANDARD.encode(format!( "{}:{}", username.peek(), password.peek() )) ) .into_masked()) } let auth_header = match payment_method_type { Some(common_enums::PaymentMethodType::ClassicReward) => construct_basic_auth( auth_type.username_classic.to_owned(), auth_type.password_classic.to_owned(), ), Some(common_enums::PaymentMethodType::Evoucher) => construct_basic_auth( auth_type.username_evoucher.to_owned(), auth_type.password_evoucher.to_owned(), ), _ => return Err(errors::ConnectorError::MissingPaymentMethodType)?, }?; Ok(vec![(headers::AUTHORIZATION.to_string(), auth_header)]) }
{ "chunk": 6, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_8422386202000302436_0
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cashfree.rs pub mod test; pub mod transformers; use std::fmt::Debug; use cashfree::{ CashfreeOrderCreateRequest, CashfreeOrderCreateResponse, CashfreePaymentRequest, CashfreePaymentResponse, }; use common_enums::AttemptStatus; use common_utils::{errors::CustomResult, events, ext_traits::ByteSliceExt}; use domain_types::{ connector_flow::{ Accept, Authenticate, Authorize, Capture, CreateAccessToken, CreateConnectorCustomer, CreateOrder, CreateSessionToken, DefendDispute, PSync, PaymentMethodToken, PostAuthenticate, PreAuthenticate, RSync, Refund, RepeatPayment, SetupMandate, SubmitEvidence, Void, VoidPC, }, connector_types::{ AcceptDisputeData, AccessTokenRequestData, AccessTokenResponseData, ConnectorCustomerData, ConnectorCustomerResponse, DisputeDefendData, DisputeFlowData, DisputeResponseData, PaymentCreateOrderData, PaymentCreateOrderResponse, PaymentFlowData, PaymentMethodTokenResponse, PaymentMethodTokenizationData, PaymentVoidData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsResponseData, PaymentsSyncData, RefundFlowData, RefundSyncData, RefundsData, RefundsResponseData, RepeatPaymentData, SessionTokenRequestData, SessionTokenResponseData, SetupMandateRequestData, SubmitEvidenceData, }, errors, payment_method_data::PaymentMethodDataTypes, router_data::{ConnectorAuthType, ErrorResponse}, router_data_v2::RouterDataV2, router_response_types::Response, types::Connectors, }; use error_stack::ResultExt; use hyperswitch_masking::{Mask, Maskable}; use interfaces::{ api::ConnectorCommon, connector_integration_v2::ConnectorIntegrationV2, connector_types, verification::{ConnectorSourceVerificationSecrets, SourceVerification}, }; use serde::Serialize; use transformers as cashfree; use super::macros; use crate::{types::ResponseRouterData, with_response_body}; pub(crate) mod headers { pub(crate) const CONTENT_TYPE: &str = "Content-Type"; pub(crate) const X_CLIENT_ID: &str = "X-Client-Id"; pub(crate) const X_CLIENT_SECRET: &str = "X-Client-Secret"; pub(crate) const X_API_VERSION: &str = "x-api-version"; } // Trait implementations will be added after the macro creates the struct impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentPreAuthenticateV2<T> for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentAuthenticateV2<T> for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentPostAuthenticateV2<T> for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::ConnectorServiceTrait<T> for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentAuthorizeV2<T> for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentSessionToken for Cashfree<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAccessToken for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::CreateConnectorCustomer for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send
{ "chunk": 0, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_8422386202000302436_1
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cashfree.rs + 'static + Serialize, > connector_types::PaymentOrderCreate for Cashfree<T> { } // Trait implementations for all flows impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentSyncV2 for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentVoidV2 for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::RefundSyncV2 for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::RefundV2 for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentCapture for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::SetupMandateV2<T> for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::RepeatPaymentV2 for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentVoidPostCaptureV2 for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::AcceptDispute for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::SubmitEvidenceV2 for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::DisputeDefend for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::IncomingWebhook for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentTokenV2<T> for Cashfree<T> { } // Trait implementations after the macro creates the struct impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::ValidationTrait for Cashfree<T> { fn should_do_order_create(&self) -> bool { true // Cashfree V3 requires order creation } } // Define connector prerequisites macros::create_all_prerequisites!( connector_name: Cashfree, generic_type: T, api: [ ( flow: CreateOrder, request_body: CashfreeOrderCreateRequest, response_body: CashfreeOrderCreateResponse, router_data: RouterDataV2<CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse>, ), ( flow: Authorize, request_body: CashfreePaymentRequest, response_body: CashfreePaymentResponse, router_data: RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) ], amount_converters: [], member_functions: { pub fn build_headers<F, FCD, Req, Res>( &self,
{ "chunk": 1, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_8422386202000302436_2
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cashfree.rs req: &RouterDataV2<F, FCD, Req, Res>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { let mut headers = vec![( headers::CONTENT_TYPE.to_string(), "application/json".to_string().into(), )]; let mut auth_headers = self.get_auth_header(&req.connector_auth_type)?; headers.append(&mut auth_headers); Ok(headers) } pub fn connector_base_url<F, Req, Res>( &self, req: &RouterDataV2<F, PaymentFlowData, Req, Res>, ) -> String { req.resource_common_data.connectors.cashfree.base_url.to_string() } } ); // CreateOrder flow implementation using macros macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Cashfree, curl_request: Json(CashfreeOrderCreateRequest), curl_response: CashfreeOrderCreateResponse, flow_name: CreateOrder, resource_common_data: PaymentFlowData, flow_request: PaymentCreateOrderData, flow_response: PaymentCreateOrderResponse, http_method: Post, generic_type: T, [PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse>, ) -> CustomResult<String, errors::ConnectorError> { let base_url = self.connector_base_url(req); Ok(format!("{base_url}pg/orders")) } } ); // Authorize flow implementation using macros macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Cashfree, curl_request: Json(CashfreePaymentRequest), curl_response: CashfreePaymentResponse, flow_name: Authorize, resource_common_data: PaymentFlowData, flow_request: PaymentsAuthorizeData<T>, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let base_url = self.connector_base_url(req); Ok(format!("{base_url}pg/orders/sessions")) } } ); // Type alias for non-generic trait implementations impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorCommon for Cashfree<T> { fn id(&self) -> &'static str { "cashfree" } fn get_currency_unit(&self) -> common_enums::CurrencyUnit { common_enums::CurrencyUnit::Base // For major units } fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { &connectors.cashfree.base_url } fn get_auth_header( &self, auth_type: &ConnectorAuthType, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { let auth = cashfree::CashfreeAuthType::try_from(auth_type)?; Ok(vec![ (headers::X_CLIENT_ID.to_string(), auth.app_id.into_masked()), ( headers::X_CLIENT_SECRET.to_string(), auth.secret_key.into_masked(), ), ( headers::X_API_VERSION.to_string(), "2022-09-01".to_string().into(), ), (
{ "chunk": 2, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_8422386202000302436_3
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cashfree.rs headers::CONTENT_TYPE.to_string(), "application/json".to_string().into(), ), ]) } fn build_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: cashfree::CashfreeErrorResponse = res .response .parse_struct("CashfreeErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; with_response_body!(event_builder, response); let attempt_status = match response.code.as_str() { "AUTHENTICATION_ERROR" => AttemptStatus::AuthenticationFailed, "AUTHORIZATION_ERROR" => AttemptStatus::AuthorizationFailed, "INVALID_REQUEST_ERROR" => AttemptStatus::Failure, "GATEWAY_ERROR" => AttemptStatus::Failure, "SERVER_ERROR" => AttemptStatus::Pending, _ => AttemptStatus::Failure, }; Ok(ErrorResponse { status_code: res.status_code, code: response.code.clone(), message: response.message.clone(), reason: Some(response.message), attempt_status: Some(attempt_status), connector_transaction_id: None, network_decline_code: None, network_advice_code: None, network_error_message: None, }) } } // Stub implementations for unsupported flows impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData> for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData> for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData> for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<Refund, RefundFlowData, RefundsData, RefundsResponseData> for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData> for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData, > for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData> for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData> for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Cashfree<T> { } // CreateSessionToken stub implementation impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync
{ "chunk": 3, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_8422386202000302436_4
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cashfree.rs + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Cashfree<T> { } // CreateAccessToken stub implementation impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Cashfree<T> { } // CreateConnectorCustomer stub implementation impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Cashfree<T> { } // Trait implementations for all flows impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData> for Cashfree<T> { } // Default ConnectorIntegrationV2 implementations for unsupported flows impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData> for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Cashfree<T> { } // SourceVerification implementations for all flows macro_rules! impl_source_verification_stub { ($flow:ty, $common_data:ty, $req:ty, $resp:ty) => { impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SourceVerification<$flow, $common_data, $req, $resp> for Cashfree<T> { fn get_secrets( &self, _secrets: ConnectorSourceVerificationSecrets, ) -> CustomResult<Vec<u8>, errors::ConnectorError> { Ok(Vec::new()) // Stub implementation } fn get_algorithm( &self, ) -> CustomResult< Box<dyn common_utils::crypto::VerifySignature + Send>, errors::ConnectorError, > { Ok(Box::new(common_utils::crypto::NoAlgorithm)) // Stub implementation } fn get_signature( &self, _payload: &[u8], _router_data: &domain_types::router_data_v2::RouterDataV2< $flow, $common_data, $req, $resp, >, _secrets: &[u8], ) -> CustomResult<Vec<u8>, errors::ConnectorError> { Ok(Vec::new()) // Stub implementation } fn get_message( &self, payload: &[u8], _router_data: &domain_types::router_data_v2::RouterDataV2< $flow, $common_data, $req, $resp, >, _secrets: &[u8], ) -> CustomResult<Vec<u8>, errors::ConnectorError> { Ok(payload.to_owned()) // Stub implementation } } }; } // Apply to all flows impl_source_verification_stub!( Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData ); impl_source_verification_stub!( CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse ); impl_source_verification_stub!( PSync, PaymentFlowData,
{ "chunk": 4, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_8422386202000302436_5
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/cashfree.rs PaymentsSyncData, PaymentsResponseData ); impl_source_verification_stub!( Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData ); impl_source_verification_stub!(Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData); impl_source_verification_stub!(Refund, RefundFlowData, RefundsData, RefundsResponseData); impl_source_verification_stub!(RSync, RefundFlowData, RefundSyncData, RefundsResponseData); impl_source_verification_stub!( SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData ); impl_source_verification_stub!( RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData ); impl_source_verification_stub!( Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData ); impl_source_verification_stub!( SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData ); impl_source_verification_stub!( DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData ); impl_source_verification_stub!( CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData ); impl_source_verification_stub!( CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData ); impl_source_verification_stub!( PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse ); // Authentication flow ConnectorIntegrationV2 implementations impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Cashfree<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Cashfree<T> { } // Authentication flow SourceVerification implementations impl_source_verification_stub!( PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData ); impl_source_verification_stub!( Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData ); impl_source_verification_stub!( PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData ); impl_source_verification_stub!( CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse ); impl_source_verification_stub!( VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData );
{ "chunk": 5, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_3706374737360175375_0
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/payu.rs pub mod transformers; use std::fmt::Debug; use base64::Engine; use common_enums::{enums, CurrencyUnit}; use common_utils::{ errors::CustomResult, events, ext_traits::ByteSliceExt, types::StringMajorUnit, }; use domain_types::{ connector_flow::{ Accept, Authenticate, Authorize, Capture, CreateAccessToken, CreateConnectorCustomer, CreateOrder, CreateSessionToken, DefendDispute, PSync, PaymentMethodToken, PostAuthenticate, PreAuthenticate, RSync, Refund, RepeatPayment, SetupMandate, SubmitEvidence, Void, VoidPC, }, connector_types::{ AcceptDisputeData, AccessTokenRequestData, AccessTokenResponseData, ConnectorCustomerData, ConnectorCustomerResponse, DisputeDefendData, DisputeFlowData, DisputeResponseData, PaymentCreateOrderData, PaymentCreateOrderResponse, PaymentFlowData, PaymentMethodTokenResponse, PaymentMethodTokenizationData, PaymentVoidData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsResponseData, PaymentsSyncData, RefundFlowData, RefundSyncData, RefundsData, RefundsResponseData, RepeatPaymentData, SessionTokenRequestData, SessionTokenResponseData, SetupMandateRequestData, SubmitEvidenceData, }, errors::{self, ConnectorError}, payment_method_data::PaymentMethodDataTypes, router_data::{ConnectorAuthType, ErrorResponse}, router_data_v2::RouterDataV2, router_response_types::Response, types::Connectors, }; use error_stack::ResultExt; use hyperswitch_masking::Maskable; use interfaces::{ api::ConnectorCommon, connector_integration_v2::ConnectorIntegrationV2, connector_types, }; use serde::Serialize; pub const BASE64_ENGINE: base64::engine::GeneralPurpose = base64::engine::general_purpose::STANDARD; use transformers::{ is_upi_collect_flow, PayuAuthType, PayuPaymentRequest, PayuPaymentResponse, PayuSyncRequest, PayuSyncResponse, }; use super::macros; use crate::types::ResponseRouterData; // Trait implementations with generic type parameters impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::ConnectorServiceTrait<T> for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentAuthorizeV2<T> for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentSyncV2 for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentSessionToken for Payu<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAccessToken for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::CreateConnectorCustomer for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentVoidV2 for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::RefundSyncV2 for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::RefundV2 for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentCapture for Payu<T> { } impl<
{ "chunk": 0, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_3706374737360175375_1
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/payu.rs T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::SetupMandateV2<T> for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::AcceptDispute for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::SubmitEvidenceV2 for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::DisputeDefend for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::IncomingWebhook for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentOrderCreate for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::ValidationTrait for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::RepeatPaymentV2 for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentTokenV2<T> for Payu<T> { } // Authentication trait implementations impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentPreAuthenticateV2<T> for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentAuthenticateV2<T> for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentPostAuthenticateV2<T> for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentVoidPostCaptureV2 for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Payu<T> { } // Set up connector using macros with all framework integrations macros::create_all_prerequisites!( connector_name: Payu, generic_type: T, api: [ ( flow: Authorize, request_body: PayuPaymentRequest, response_body: PayuPaymentResponse, router_data: RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ), ( flow: PSync, request_body: PayuSyncRequest, response_body: PayuSyncResponse, router_data: RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) ], amount_converters: [ amount_converter: StringMajorUnit ], member_functions: { pub fn build_headers<F, FCD, Req, Res>( &self, _req: &RouterDataV2<F, FCD, Req, Res>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> where
{ "chunk": 1, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_3706374737360175375_2
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/payu.rs Self: ConnectorIntegrationV2<F, FCD, Req, Res>, { Ok(vec![ ("Content-Type".to_string(), "application/x-www-form-urlencoded".into()), ("Accept".to_string(), "application/json".into()), ]) } pub fn connector_base_url_payments<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, PaymentFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.payu.base_url } pub fn connector_base_url_refunds<'a, F, Req, Res>( &self, req: &'a RouterDataV2<F, RefundFlowData, Req, Res>, ) -> &'a str { &req.resource_common_data.connectors.payu.base_url } pub fn preprocess_response_bytes<F, FCD, Res>( &self, req: &RouterDataV2<F, FCD, PaymentsAuthorizeData<T>, Res>, bytes: bytes::Bytes, ) -> CustomResult<bytes::Bytes, ConnectorError> { if is_upi_collect_flow(&req.request) { // For UPI collect flows, we need to return base64 decoded response let decoded_value = BASE64_ENGINE.decode(bytes.clone()); match decoded_value { Ok(decoded_bytes) => Ok(decoded_bytes.into()), Err(_) => Ok(bytes.clone()) } } else { // For other flows, we can use the response itself Ok(bytes) } } } ); // Implement PSync flow using macro framework macros::macro_connector_implementation!( connector_default_implementations: [], connector: Payu, curl_request: FormUrlEncoded(PayuSyncRequest), curl_response: PayuSyncResponse, flow_name: PSync, resource_common_data: PaymentFlowData, flow_request: PaymentsSyncData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize], other_functions: { fn get_headers( &self, _req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { Ok(vec![ ("Content-Type".to_string(), "application/x-www-form-urlencoded".into()), ("Accept".to_string(), "application/json".into()), ]) } fn get_url( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<String, ConnectorError> { // Based on Haskell implementation: uses /merchant/postservice.php?form=2 for verification // Test: https://test.payu.in/merchant/postservice.php?form=2 let base_url = self.base_url(&req.resource_common_data.connectors); Ok(format!("{base_url}/merchant/postservice.php?form=2")) } fn get_content_type(&self) -> &'static str { "application/x-www-form-urlencoded" } fn get_error_response_v2( &self, res: Response, _event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, ConnectorError> { // PayU sync may return error responses in different formats let response: PayuSyncResponse = res .response .parse_struct("PayU Sync ErrorResponse") .change_context(ConnectorError::ResponseDeserializationFailed)?; // Check if PayU returned error status (0 = error) if response.status == Some(0) { Ok(ErrorResponse { status_code: res.status_code, code: "PAYU_SYNC_ERROR".to_string(), message: response.msg.unwrap_or_default(), reason: None, attempt_status: Some(enums::AttemptStatus::Failure), connector_transaction_id: None, network_error_message: None, network_advice_code: None, network_decline_code: None, }) } else { // Generic error response
{ "chunk": 2, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_3706374737360175375_3
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/payu.rs Ok(ErrorResponse { status_code: res.status_code, code: "SYNC_UNKNOWN_ERROR".to_string(), message: "Unknown PayU sync error".to_string(), reason: None, attempt_status: Some(enums::AttemptStatus::Failure), connector_transaction_id: None, network_error_message: None, network_advice_code: None, network_decline_code: None, }) } } } ); // Implement authorize flow using macro framework macros::macro_connector_implementation!( connector_default_implementations: [], connector: Payu, curl_request: FormUrlEncoded(PayuPaymentRequest), curl_response: PayuPaymentResponse, flow_name: Authorize, resource_common_data: PaymentFlowData, flow_request: PaymentsAuthorizeData<T>, flow_response: PaymentsResponseData, http_method: Post, preprocess_response: true, generic_type: T, [PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { self.build_headers(req) } fn get_url( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<String, ConnectorError> { // Based on Haskell Endpoints.hs: uses /_payment endpoint for UPI transactions // Test: https://test.payu.in/_payment // Prod: https://secure.payu.in/_payment let base_url = self.base_url(&req.resource_common_data.connectors); Ok(format!("{base_url}/_payment")) } fn get_content_type(&self) -> &'static str { "application/x-www-form-urlencoded" } fn get_error_response_v2( &self, res: Response, _event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, ConnectorError> { // PayU returns error responses in the same JSON format as success responses // We need to parse the response and check for error fields let response: PayuPaymentResponse = res .response .parse_struct("PayU ErrorResponse") .change_context(ConnectorError::ResponseDeserializationFailed)?; // Check if this is an error response if response.error.is_some() { Ok(ErrorResponse { status_code: res.status_code, code: response.error.unwrap_or_default(), message: response.message.unwrap_or_default(), reason: None, attempt_status: Some(enums::AttemptStatus::Failure), connector_transaction_id: response.reference_id, network_error_message: None, network_advice_code: None, network_decline_code: None, }) } else { // This shouldn't happen as successful responses go through normal flow // But fallback to generic error Ok(ErrorResponse { status_code: res.status_code, code: "UNKNOWN_ERROR".to_string(), message: "Unknown PayU error".to_string(), reason: None, attempt_status: Some(enums::AttemptStatus::Failure), connector_transaction_id: None, network_error_message: None, network_advice_code: None, network_decline_code: None, }) } } } ); // Implement ConnectorCommon trait impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorCommon for Payu<T> { fn id(&self) -> &'static str { "payu" }
{ "chunk": 3, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_3706374737360175375_4
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/payu.rs fn get_currency_unit(&self) -> common_enums::CurrencyUnit { CurrencyUnit::Minor } fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { &connectors.payu.base_url } fn get_auth_header( &self, auth_type: &ConnectorAuthType, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { let _auth = PayuAuthType::try_from(auth_type)?; // Payu uses form-based authentication, not headers Ok(vec![]) } } // **STUB IMPLEMENTATIONS**: Source Verification Framework stubs for main development // These will be replaced with actual implementations in Phase 10 use common_utils::crypto; use interfaces::verification::{ConnectorSourceVerificationSecrets, SourceVerification}; impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize + Serialize, > SourceVerification<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData> for Payu<T> { fn get_secrets( &self, _secrets: ConnectorSourceVerificationSecrets, ) -> CustomResult<Vec<u8>, ConnectorError> { // STUB: Return empty secrets - will be implemented in Phase 10 Ok(Vec::new()) } fn get_algorithm( &self, ) -> CustomResult<Box<dyn crypto::VerifySignature + Send>, ConnectorError> { // STUB: Use NoAlgorithm - will be replaced with actual algorithm in Phase 10 Ok(Box::new(crypto::NoAlgorithm)) } fn get_signature( &self, _payload: &[u8], _router_data: &RouterDataV2< Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData, >, _secrets: &[u8], ) -> CustomResult<Vec<u8>, ConnectorError> { // STUB: Return empty signature - will extract actual signature in Phase 10 Ok(Vec::new()) } fn get_message( &self, payload: &[u8], _router_data: &RouterDataV2< Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData, >, _secrets: &[u8], ) -> CustomResult<Vec<u8>, ConnectorError> { // STUB: Return payload as-is - will implement gateway-specific message format in Phase 10 Ok(payload.to_owned()) } } // Add Source Verification stubs for all other flows macro_rules! impl_source_verification_stub { ($flow:ty, $common_data:ty, $req:ty, $resp:ty) => { impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > SourceVerification<$flow, $common_data, $req, $resp> for Payu<T> { fn get_secrets( &self, _secrets: ConnectorSourceVerificationSecrets, ) -> CustomResult<Vec<u8>, ConnectorError> { Ok(Vec::new()) // STUB - will be implemented in Phase 10 } fn get_algorithm( &self, ) -> CustomResult<Box<dyn crypto::VerifySignature + Send>, ConnectorError> { Ok(Box::new(crypto::NoAlgorithm)) // STUB - will be implemented in Phase 10 } fn get_signature( &self, _payload: &[u8], _router_data: &RouterDataV2<$flow, $common_data, $req, $resp>, _secrets: &[u8], ) -> CustomResult<Vec<u8>, ConnectorError> { Ok(Vec::new()) // STUB - will be implemented in Phase 10 } fn get_message( &self, payload: &[u8], _router_data: &RouterDataV2<$flow, $common_data, $req, $resp>, _secrets: &[u8], ) -> CustomResult<Vec<u8>, ConnectorError> { Ok(payload.to_owned()) // STUB - will be implemented in Phase 10 } } }; } // Apply stub implementations to all flows impl_source_verification_stub!( PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData ); impl_source_verification_stub!( Capture, PaymentFlowData, PaymentsCaptureData,
{ "chunk": 4, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_3706374737360175375_5
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/payu.rs PaymentsResponseData ); impl_source_verification_stub!(Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData); impl_source_verification_stub!(Refund, RefundFlowData, RefundsData, RefundsResponseData); impl_source_verification_stub!(RSync, RefundFlowData, RefundSyncData, RefundsResponseData); impl_source_verification_stub!( DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData ); impl_source_verification_stub!( CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse ); impl_source_verification_stub!( SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData ); impl_source_verification_stub!( Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData ); impl_source_verification_stub!( SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData ); impl_source_verification_stub!( RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData ); // Connector integration implementations for unsupported flows (stubs) impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize + Serialize, > ConnectorIntegrationV2<Refund, RefundFlowData, RefundsData, RefundsResponseData> for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize + Serialize, > ConnectorIntegrationV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData> for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize + Serialize, > ConnectorIntegrationV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData> for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize + Serialize, > ConnectorIntegrationV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData> for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize + Serialize, > ConnectorIntegrationV2< SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData, > for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize + Serialize, > ConnectorIntegrationV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData> for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize + Serialize, > ConnectorIntegrationV2<Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData> for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize + Serialize, > ConnectorIntegrationV2<SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData> for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize + Serialize, > ConnectorIntegrationV2<DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData> for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize + Serialize, > ConnectorIntegrationV2< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync
{ "chunk": 5, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_3706374737360175375_6
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/payu.rs + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Payu<T> { } // Add stub implementation for CreateSessionToken impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize + Serialize, > ConnectorIntegrationV2< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Payu<T> { } // Add stub implementation for CreateAccessToken impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize + Serialize, > ConnectorIntegrationV2< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Payu<T> { } // Add stub implementation for CreateConnectorCustomer impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Payu<T> { } // Add source verification stub for CreateSessionToken impl_source_verification_stub!( CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData ); impl_source_verification_stub!( CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData ); // Add source verification stub for PaymentMethodToken impl_source_verification_stub!( PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse ); impl_source_verification_stub!( CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse ); // Authentication flow implementations impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Payu<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Payu<T> { } // Authentication source verification stubs impl_source_verification_stub!( PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData ); impl_source_verification_stub!( Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData ); impl_source_verification_stub!( PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData ); impl_source_verification_stub!( VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData );
{ "chunk": 6, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-7150087913631322942_0
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/paytm.rs pub mod transformers; use std::fmt::Debug; use common_enums::AttemptStatus; use common_utils::{errors::CustomResult, events, ext_traits::BytesExt, types::StringMajorUnit}; use domain_types::{ connector_flow::{ Accept, Authenticate, Authorize, Capture, CreateAccessToken, CreateConnectorCustomer, CreateOrder, CreateSessionToken, DefendDispute, PSync, PaymentMethodToken, PostAuthenticate, PreAuthenticate, RSync, Refund, RepeatPayment, SetupMandate, SubmitEvidence, Void, VoidPC, }, connector_types::{ AcceptDisputeData, AccessTokenRequestData, AccessTokenResponseData, ConnectorCustomerData, ConnectorCustomerResponse, DisputeDefendData, DisputeFlowData, DisputeResponseData, PaymentCreateOrderData, PaymentCreateOrderResponse, PaymentFlowData, PaymentMethodTokenResponse, PaymentMethodTokenizationData, PaymentVoidData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsResponseData, PaymentsSyncData, RefundFlowData, RefundSyncData, RefundsData, RefundsResponseData, RepeatPaymentData, SessionTokenRequestData, SessionTokenResponseData, SetupMandateRequestData, SubmitEvidenceData, }, errors, payment_method_data::PaymentMethodDataTypes, router_data::{ConnectorAuthType, ErrorResponse}, router_data_v2::RouterDataV2, router_response_types::Response, types::Connectors, }; use hyperswitch_masking::{Maskable, PeekInterface}; use interfaces::{ api::ConnectorCommon, connector_integration_v2::ConnectorIntegrationV2, connector_types, verification, }; use paytm::constants; use serde::Serialize; use transformers as paytm; use self::transformers::{ PaytmAuthorizeRequest, PaytmInitiateTxnRequest, PaytmInitiateTxnResponse, PaytmProcessTxnResponse, PaytmTransactionStatusRequest, PaytmTransactionStatusResponse, }; use crate::{connectors::macros, types::ResponseRouterData}; // Define connector prerequisites using macros - following the exact pattern from other connectors macros::create_all_prerequisites!( connector_name: Paytm, generic_type: T, api: [ ( flow: CreateSessionToken, request_body: PaytmInitiateTxnRequest, response_body: PaytmInitiateTxnResponse, router_data: RouterDataV2<CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData>, ), ( flow: Authorize, request_body: PaytmAuthorizeRequest, response_body: PaytmProcessTxnResponse, router_data: RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ), ( flow: PSync, request_body: PaytmTransactionStatusRequest, response_body: PaytmTransactionStatusResponse, router_data: RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) ], amount_converters: [amount_converter: StringMajorUnit], member_functions: { pub fn connector_base_url<F, Req, Res>( &self, req: &RouterDataV2<F, PaymentFlowData, Req, Res>, ) -> String { req.resource_common_data.connectors.paytm.base_url.to_string() } fn get_attempt_status_from_http_code(status_code: u16) -> AttemptStatus { match status_code { 500..=599 => AttemptStatus::Pending, // 5xx errors should be pending for retry _ => AttemptStatus::Failure, // All other errors are final failures } } fn build_custom_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<domain_types::router_data::ErrorResponse, errors::ConnectorError> { // First try to parse as session token error response format if let Ok(session_error_response) = res .response .parse_struct::<paytm::PaytmSessionTokenErrorResponse>("PaytmSessionTokenErrorResponse") { if let Some(event) = event_builder {
{ "chunk": 0, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-7150087913631322942_1
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/paytm.rs event.set_connector_response(&session_error_response); } return Ok(domain_types::router_data::ErrorResponse { code: session_error_response.body.result_info.result_code, message: session_error_response.body.result_info.result_msg, reason: None, status_code: res.status_code, attempt_status: Some(Self::get_attempt_status_from_http_code(res.status_code)), connector_transaction_id: None, network_decline_code: None, network_advice_code: None, network_error_message: None, }); } // Try to parse as callback error response format if let Ok(callback_response) = res .response .parse_struct::<paytm::PaytmCallbackErrorResponse>("PaytmCallbackErrorResponse") { if let Some(event) = event_builder { event.set_connector_response(&callback_response); } return Ok(domain_types::router_data::ErrorResponse { code: callback_response .body .txn_info .resp_code .unwrap_or(callback_response.body.result_info.result_code), message: callback_response .body .txn_info .resp_msg .unwrap_or(callback_response.body.result_info.result_msg), reason: None, status_code: res.status_code, attempt_status: Some(Self::get_attempt_status_from_http_code(res.status_code)), connector_transaction_id: callback_response.body.txn_info.order_id, network_decline_code: None, network_advice_code: None, network_error_message: None, }); } // Try to parse as original JSON error response format if let Ok(response) = res .response .parse_struct::<paytm::PaytmErrorResponse>("PaytmErrorResponse") { if let Some(event) = event_builder { event.set_connector_response(&response); } return Ok(domain_types::router_data::ErrorResponse { code: response.error_code.unwrap_or_default(), message: response.error_message.unwrap_or_default(), reason: response.error_description, status_code: res.status_code, attempt_status: Some(Self::get_attempt_status_from_http_code(res.status_code)), connector_transaction_id: response.transaction_id, network_decline_code: None, network_advice_code: None, network_error_message: None, }); } // Final fallback for non-JSON responses (HTML errors, etc.) let raw_response = String::from_utf8_lossy(&res.response); let error_message = match res.status_code { 503 => "Service temporarily unavailable".to_string(), 502 => "Bad gateway".to_string(), 500 => "Internal server error".to_string(), 404 => "Not found".to_string(), 400 => "Bad request".to_string(), _ => format!("HTTP {} error", res.status_code), }; Ok(domain_types::router_data::ErrorResponse { code: res.status_code.to_string(), message: error_message, reason: Some(format!( "Raw response: {}", raw_response.chars().take(200).collect::<String>() )), status_code: res.status_code, attempt_status: Some(Self::get_attempt_status_from_http_code(res.status_code)), connector_transaction_id: None, network_decline_code: None, network_advice_code: None, network_error_message: None,
{ "chunk": 1, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-7150087913631322942_2
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/paytm.rs }) } } ); impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::ValidationTrait for Paytm<T> { fn should_do_session_token(&self) -> bool { true // Enable CreateSessionToken flow for Paytm's initiate step } fn should_do_order_create(&self) -> bool { false // Paytm doesn't require separate order creation } } // Service trait implementations with generic type parameters impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::ConnectorServiceTrait<T> for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentSessionToken for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAccessToken for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::CreateConnectorCustomer for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAuthorizeV2<T> for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentSyncV2 for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentOrderCreate for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RefundV2 for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RefundSyncV2 for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::RepeatPaymentV2 for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentVoidPostCaptureV2 for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> interfaces::verification::SourceVerification< VoidPC, PaymentFlowData, PaymentsCancelPostCaptureData, PaymentsResponseData, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentCapture for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentVoidV2 for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::SetupMandateV2<T> for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::AcceptDispute for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::DisputeDefend for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::SubmitEvidenceV2 for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::IncomingWebhook for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentTokenV2<T> for Paytm<T> { } // Authentication trait implementations impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentPreAuthenticateV2<T> for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAuthenticateV2<T> for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentPostAuthenticateV2<T> for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorCommon for Paytm<T> { fn id(&self) -> &'static str { "paytm" } fn get_currency_unit(&self) -> common_enums::CurrencyUnit { common_enums::CurrencyUnit::Minor } fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { &connectors.paytm.base_url } fn get_auth_header( &self, _auth_type: &ConnectorAuthType,
{ "chunk": 2, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-7150087913631322942_3
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/paytm.rs ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { Ok(vec![( constants::CONTENT_TYPE_HEADER.to_string(), constants::CONTENT_TYPE_JSON.into(), )]) } fn build_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<domain_types::router_data::ErrorResponse, errors::ConnectorError> { self.build_custom_error_response(res, event_builder) } } // SourceVerification implementations for all flows impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification< Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData> for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification< Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData> for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification<Refund, RefundFlowData, RefundsData, RefundsResponseData> for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification<RSync, RefundFlowData, RefundSyncData, RefundsResponseData> for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification< SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification< Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification< SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification< DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification< CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification< RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData, > for Paytm<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > interfaces::verification::SourceVerification< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Paytm<T> { } // CreateSessionToken flow implementation using macros macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Paytm, curl_request: Json(PaytmInitiateTxnRequest),
{ "chunk": 3, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-7150087913631322942_4
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/paytm.rs curl_response: PaytmInitiateTxnResponse, flow_name: CreateSessionToken, resource_common_data: PaymentFlowData, flow_request: SessionTokenRequestData, flow_response: SessionTokenResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { let headers = self.get_auth_header(&req.connector_auth_type)?; Ok(headers) } fn get_url( &self, req: &RouterDataV2<CreateSessionToken, PaymentFlowData, SessionTokenRequestData, SessionTokenResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let base_url = self.connector_base_url(req); let auth = paytm::PaytmAuthType::try_from(&req.connector_auth_type)?; let merchant_id = auth.merchant_id.peek(); let order_id = &req.resource_common_data.connector_request_reference_id; Ok(format!( "{base_url}theia/api/v1/initiateTransaction?mid={merchant_id}&orderId={order_id}" )) } fn get_5xx_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<domain_types::router_data::ErrorResponse, errors::ConnectorError> { self.build_custom_error_response(res, event_builder) } } ); // CreateAccessToken implementation impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateAccessToken, PaymentFlowData, AccessTokenRequestData, AccessTokenResponseData, > for Paytm<T> { } // CreateConnectorCustomer implementation impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Paytm<T> { } // Authorize flow implementation using macros macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Paytm, curl_request: Json(PaytmAuthorizeRequest), curl_response: PaytmProcessTxnResponse, flow_name: Authorize, resource_common_data: PaymentFlowData, flow_request: PaymentsAuthorizeData<T>, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { let headers = self.get_auth_header(&req.connector_auth_type)?; Ok(headers) } fn get_url( &self, req: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let base_url = self.connector_base_url(req); let auth = paytm::PaytmAuthType::try_from(&req.connector_auth_type)?; let merchant_id = auth.merchant_id.peek(); let order_id = &req.resource_common_data.connector_request_reference_id; Ok(format!( "{base_url}theia/api/v1/processTransaction?mid={merchant_id}&orderId={order_id}" )) } fn get_5xx_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<domain_types::router_data::ErrorResponse, errors::ConnectorError> { self.build_custom_error_response(res, event_builder) } } ); // PSync flow implementation using macros macros::macro_connector_implementation!( connector_default_implementations: [get_content_type, get_error_response_v2], connector: Paytm, curl_request: Json(PaytmTransactionStatusRequest),
{ "chunk": 4, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-7150087913631322942_5
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/paytm.rs curl_response: PaytmTransactionStatusResponse, flow_name: PSync, resource_common_data: PaymentFlowData, flow_request: PaymentsSyncData, flow_response: PaymentsResponseData, http_method: Post, generic_type: T, [PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize], other_functions: { fn get_headers( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { let headers = self.get_auth_header(&req.connector_auth_type)?; Ok(headers) } fn get_url( &self, req: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ) -> CustomResult<String, errors::ConnectorError> { let base_url = self.connector_base_url(req); Ok(format!("{base_url}/v3/order/status")) } fn get_5xx_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<domain_types::router_data::ErrorResponse, errors::ConnectorError> { self.build_custom_error_response(res, event_builder) } } ); // Empty implementations for flows not yet implemented impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<Capture, PaymentFlowData, PaymentsCaptureData, PaymentsResponseData> for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData> for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<Refund, RefundFlowData, RefundsData, RefundsResponseData> for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData> for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< SetupMandate, PaymentFlowData, SetupMandateRequestData<T>, PaymentsResponseData, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData> for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<SubmitEvidence, DisputeFlowData, SubmitEvidenceData, DisputeResponseData> for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<DefendDispute, DisputeFlowData, DisputeDefendData, DisputeResponseData> for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< CreateOrder, PaymentFlowData, PaymentCreateOrderData, PaymentCreateOrderResponse, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData> for Paytm<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > ConnectorIntegrationV2< PaymentMethodToken, PaymentFlowData, PaymentMethodTokenizationData<T>, PaymentMethodTokenResponse, > for Paytm<T> { } // Authentication flow ConnectorIntegrationV2 implementations impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> ConnectorIntegrationV2< PostAuthenticate,
{ "chunk": 5, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-7150087913631322942_6
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/paytm.rs PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Paytm<T> { } // Authentication flow SourceVerification implementations impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification< PreAuthenticate, PaymentFlowData, PaymentsPreAuthenticateData<T>, PaymentsResponseData, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification< Authenticate, PaymentFlowData, PaymentsAuthenticateData<T>, PaymentsResponseData, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification< PostAuthenticate, PaymentFlowData, PaymentsPostAuthenticateData<T>, PaymentsResponseData, > for Paytm<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> verification::SourceVerification< CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, ConnectorCustomerResponse, > for Paytm<T> { }
{ "chunk": 6, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-8961258080012439964_0
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/fiserv.rs use std::fmt::Debug; use base64::{engine::general_purpose::STANDARD as BASE64_STANDARD_ENGINE, Engine}; use common_utils::{ consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE}, errors::CustomResult, events, ext_traits::BytesExt, request::RequestContent, types::FloatMajorUnit, }; use domain_types::{ connector_flow::{ Accept, Authenticate, Authorize, Capture, CreateAccessToken, CreateConnectorCustomer, CreateOrder, CreateSessionToken, DefendDispute, PSync, PaymentMethodToken, PostAuthenticate, PreAuthenticate, RSync, Refund, RepeatPayment, SetupMandate, SubmitEvidence, Void, VoidPC, }, connector_types::{ AcceptDisputeData, AccessTokenRequestData, AccessTokenResponseData, ConnectorCustomerData, ConnectorCustomerResponse, ConnectorSpecifications, DisputeDefendData, DisputeFlowData, DisputeResponseData, PaymentCreateOrderData, PaymentCreateOrderResponse, PaymentFlowData, PaymentMethodTokenResponse, PaymentMethodTokenizationData, PaymentVoidData, PaymentsAuthenticateData, PaymentsAuthorizeData, PaymentsCancelPostCaptureData, PaymentsCaptureData, PaymentsPostAuthenticateData, PaymentsPreAuthenticateData, PaymentsResponseData, PaymentsSyncData, RefundFlowData, RefundSyncData, RefundsData, RefundsResponseData, RepeatPaymentData, SessionTokenRequestData, SessionTokenResponseData, SetupMandateRequestData, SubmitEvidenceData, }, errors, payment_method_data::PaymentMethodDataTypes, router_data::{ConnectorAuthType, ErrorResponse}, router_data_v2::RouterDataV2, router_response_types::Response, types::Connectors, }; use error_stack::ResultExt; use hyperswitch_masking::{ExposeInterface, Mask, Maskable, PeekInterface}; use interfaces::{ api::ConnectorCommon, connector_integration_v2::ConnectorIntegrationV2, connector_types, }; use ring::hmac; use serde::Serialize; use time::OffsetDateTime; use uuid::Uuid; pub mod transformers; use transformers::{ FiservCaptureRequest, FiservCaptureResponse, FiservPaymentsRequest, FiservPaymentsResponse, FiservRefundRequest, FiservRefundResponse, FiservRefundSyncRequest, FiservRefundSyncResponse, FiservSyncRequest, FiservSyncResponse, FiservVoidRequest, FiservVoidResponse, }; use super::macros; use crate::{types::ResponseRouterData, with_error_response_body}; // Local headers module mod headers { pub const API_KEY: &str = "Api-Key"; pub const CONTENT_TYPE: &str = "Content-Type"; pub const TIMESTAMP: &str = "Timestamp"; pub const CLIENT_REQUEST_ID: &str = "Client-Request-Id"; pub const AUTH_TOKEN_TYPE: &str = "Auth-Token-Type"; pub const AUTHORIZATION: &str = "Authorization"; } // Type alias for non-generic trait implementations impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::ConnectorServiceTrait<T> for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentAuthorizeV2<T> for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentSessionToken for Fiserv<T> { } impl<T: PaymentMethodDataTypes + Debug + Sync + Send + 'static + Serialize> connector_types::PaymentAccessToken for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::CreateConnectorCustomer for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentSyncV2 for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentVoidV2 for Fiserv<T> { } impl<
{ "chunk": 0, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_mini_connector-integration_-8961258080012439964_1
clm
mini_chunk
// connector-service/backend/connector-integration/src/connectors/fiserv.rs T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::RefundSyncV2 for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::RefundV2 for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentCapture for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::ValidationTrait for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentOrderCreate for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::SetupMandateV2<T> for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::AcceptDispute for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::SubmitEvidenceV2 for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::DisputeDefend for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::IncomingWebhook for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::RepeatPaymentV2 for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentTokenV2<T> for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentPreAuthenticateV2<T> for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentAuthenticateV2<T> for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentPostAuthenticateV2<T> for Fiserv<T> { } impl< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, > connector_types::PaymentVoidPostCaptureV2 for Fiserv<T> { } macros::create_all_prerequisites!( connector_name: Fiserv, generic_type: T, api: [ ( flow: Authorize, request_body: FiservPaymentsRequest<T>, response_body: FiservPaymentsResponse, router_data: RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ), ( flow: PSync, request_body: FiservSyncRequest, response_body: FiservSyncResponse, router_data: RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, ), ( flow: Capture,
{ "chunk": 1, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }