id
stringlengths
20
153
type
stringclasses
1 value
granularity
stringclasses
14 values
content
stringlengths
16
84.3k
metadata
dict
connector-service_snippet_-1482355156531562553_125_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs // Helper function to create a payment authorize request fn create_payment_authorize_request( capture_method: CaptureMethod, ) -> PaymentServiceAuthorizeRequest { let card_details = card_payment_method_type::CardType::Credit(CardDetails { card_number: Some(CardNumber::from_str(TEST_CARD_NUMBER).unwrap()), card_exp_month: Some(Secret::new(TEST_CARD_EXP_MONTH.to_string())), card_exp_year: Some(Secret::new(TEST_CARD_EXP_YEAR.to_string())), card_cvc: Some(Secret::new(TEST_CARD_CVC.to_string())), card_holder_name: Some(Secret::new(TEST_CARD_HOLDER.to_string())), card_network: Some(1), card_issuer: None, card_type: None, card_issuing_country_alpha2: None, bank_code: None, nick_name: None, }); let mut metadata = HashMap::new(); metadata.insert( "description".to_string(), "Its my first payment request".to_string(), ); PaymentServiceAuthorizeRequest { amount: TEST_AMOUNT, minor_amount: TEST_AMOUNT, currency: i32::from(Currency::Aed), payment_method: Some(PaymentMethod { payment_method: Some(payment_method::PaymentMethod::Card(CardPaymentMethodType { card_type: Some(card_details), })),
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 125, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_125_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs // Helper function to create a payment authorize request fn create_payment_authorize_request( capture_method: CaptureMethod, ) -> PaymentServiceAuthorizeRequest { let card_details = card_payment_method_type::CardType::Credit(CardDetails { card_number: Some(CardNumber::from_str(TEST_CARD_NUMBER).unwrap()), card_exp_month: Some(Secret::new(TEST_CARD_EXP_MONTH.to_string())), card_exp_year: Some(Secret::new(TEST_CARD_EXP_YEAR.to_string())), card_cvc: Some(Secret::new(TEST_CARD_CVC.to_string())), card_holder_name: Some(Secret::new(TEST_CARD_HOLDER.to_string())), card_network: Some(1), card_issuer: None, card_type: None, card_issuing_country_alpha2: None, bank_code: None, nick_name: None, }); let mut metadata = HashMap::new(); metadata.insert( "description".to_string(), "Its my first payment request".to_string(), ); PaymentServiceAuthorizeRequest { amount: TEST_AMOUNT, minor_amount: TEST_AMOUNT, currency: i32::from(Currency::Aed), payment_method: Some(PaymentMethod { payment_method: Some(payment_method::PaymentMethod::Card(CardPaymentMethodType { card_type: Some(card_details), })), }), return_url: Some("https://duck.com".to_string()), email: Some(TEST_EMAIL.to_string().into()), address: Some(grpc_api_types::payments::PaymentAddress::default()), auth_type: i32::from(AuthenticationType::NoThreeDs), request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("noon_test_{}", get_timestamp()))), }), enrolled_for_3ds: false, request_incremental_authorization: false, capture_method: Some(i32::from(capture_method)), order_category: Some("PAY".to_string()), metadata, // payment_method_type: Some(i32::from(PaymentMethodType::Credit)), ..Default::default() } } // Helper function to create a payment sync request fn create_payment_sync_request(
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 125, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_150_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs currency: i32::from(Currency::Aed), payment_method: Some(PaymentMethod { payment_method: Some(payment_method::PaymentMethod::Card(CardPaymentMethodType { card_type: Some(card_details), })), }), return_url: Some("https://duck.com".to_string()), email: Some(TEST_EMAIL.to_string().into()), address: Some(grpc_api_types::payments::PaymentAddress::default()), auth_type: i32::from(AuthenticationType::NoThreeDs), request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("noon_test_{}", get_timestamp()))), }), enrolled_for_3ds: false, request_incremental_authorization: false,
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 150, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_150_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs currency: i32::from(Currency::Aed), payment_method: Some(PaymentMethod { payment_method: Some(payment_method::PaymentMethod::Card(CardPaymentMethodType { card_type: Some(card_details), })), }), return_url: Some("https://duck.com".to_string()), email: Some(TEST_EMAIL.to_string().into()), address: Some(grpc_api_types::payments::PaymentAddress::default()), auth_type: i32::from(AuthenticationType::NoThreeDs), request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("noon_test_{}", get_timestamp()))), }), enrolled_for_3ds: false, request_incremental_authorization: false, capture_method: Some(i32::from(capture_method)), order_category: Some("PAY".to_string()), metadata, // payment_method_type: Some(i32::from(PaymentMethodType::Credit)), ..Default::default() } } // Helper function to create a payment sync request fn create_payment_sync_request( transaction_id: &str, request_ref_id: &str, ) -> PaymentServiceGetRequest { PaymentServiceGetRequest { transaction_id: Some(Identifier {
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 150, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_150_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs currency: i32::from(Currency::Aed), payment_method: Some(PaymentMethod { payment_method: Some(payment_method::PaymentMethod::Card(CardPaymentMethodType { card_type: Some(card_details), })), }), return_url: Some("https://duck.com".to_string()), email: Some(TEST_EMAIL.to_string().into()), address: Some(grpc_api_types::payments::PaymentAddress::default()), auth_type: i32::from(AuthenticationType::NoThreeDs), request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("noon_test_{}", get_timestamp()))), }), enrolled_for_3ds: false, request_incremental_authorization: false, capture_method: Some(i32::from(capture_method)), order_category: Some("PAY".to_string()), metadata, // payment_method_type: Some(i32::from(PaymentMethodType::Credit)), ..Default::default() } } // Helper function to create a payment sync request fn create_payment_sync_request( transaction_id: &str, request_ref_id: &str, ) -> PaymentServiceGetRequest { PaymentServiceGetRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), request_ref_id: Some(Identifier { id_type: Some(IdType::Id(request_ref_id.to_string())), }), // all_keys_required: None, capture_method: None, handle_response: None, amount: TEST_AMOUNT, currency: i32::from(Currency::Aed), state: None, } } // Helper function to create a payment capture request fn create_payment_capture_request(transaction_id: &str) -> PaymentServiceCaptureRequest { PaymentServiceCaptureRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }),
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 150, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_175_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs transaction_id: &str, request_ref_id: &str, ) -> PaymentServiceGetRequest { PaymentServiceGetRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), request_ref_id: Some(Identifier { id_type: Some(IdType::Id(request_ref_id.to_string())), }), // all_keys_required: None, capture_method: None, handle_response: None, amount: TEST_AMOUNT, currency: i32::from(Currency::Aed),
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 175, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_175_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs transaction_id: &str, request_ref_id: &str, ) -> PaymentServiceGetRequest { PaymentServiceGetRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), request_ref_id: Some(Identifier { id_type: Some(IdType::Id(request_ref_id.to_string())), }), // all_keys_required: None, capture_method: None, handle_response: None, amount: TEST_AMOUNT, currency: i32::from(Currency::Aed), state: None, } } // Helper function to create a payment capture request fn create_payment_capture_request(transaction_id: &str) -> PaymentServiceCaptureRequest { PaymentServiceCaptureRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), amount_to_capture: TEST_AMOUNT, currency: i32::from(Currency::Aed), multiple_capture_data: None, request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("capture_ref_{}", get_timestamp()))),
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 175, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_175_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs transaction_id: &str, request_ref_id: &str, ) -> PaymentServiceGetRequest { PaymentServiceGetRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), request_ref_id: Some(Identifier { id_type: Some(IdType::Id(request_ref_id.to_string())), }), // all_keys_required: None, capture_method: None, handle_response: None, amount: TEST_AMOUNT, currency: i32::from(Currency::Aed), state: None, } } // Helper function to create a payment capture request fn create_payment_capture_request(transaction_id: &str) -> PaymentServiceCaptureRequest { PaymentServiceCaptureRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), amount_to_capture: TEST_AMOUNT, currency: i32::from(Currency::Aed), multiple_capture_data: None, request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("capture_ref_{}", get_timestamp()))), }), ..Default::default() } } // Helper function to create a payment void request fn create_payment_void_request(transaction_id: &str) -> PaymentServiceVoidRequest { PaymentServiceVoidRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), cancellation_reason: None, request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("void_ref_{}", get_timestamp()))), }), all_keys_required: None, browser_info: None, amount: None, currency: None, ..Default::default()
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 175, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_200_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs amount_to_capture: TEST_AMOUNT, currency: i32::from(Currency::Aed), multiple_capture_data: None, request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("capture_ref_{}", get_timestamp()))), }), ..Default::default() } } // Helper function to create a payment void request fn create_payment_void_request(transaction_id: &str) -> PaymentServiceVoidRequest { PaymentServiceVoidRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())),
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 200, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_200_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs amount_to_capture: TEST_AMOUNT, currency: i32::from(Currency::Aed), multiple_capture_data: None, request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("capture_ref_{}", get_timestamp()))), }), ..Default::default() } } // Helper function to create a payment void request fn create_payment_void_request(transaction_id: &str) -> PaymentServiceVoidRequest { PaymentServiceVoidRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), cancellation_reason: None, request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("void_ref_{}", get_timestamp()))), }), all_keys_required: None, browser_info: None, amount: None, currency: None, ..Default::default() } } // Helper function to create a refund request fn create_refund_request(transaction_id: &str) -> PaymentServiceRefundRequest {
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 200, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_200_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs amount_to_capture: TEST_AMOUNT, currency: i32::from(Currency::Aed), multiple_capture_data: None, request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("capture_ref_{}", get_timestamp()))), }), ..Default::default() } } // Helper function to create a payment void request fn create_payment_void_request(transaction_id: &str) -> PaymentServiceVoidRequest { PaymentServiceVoidRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), cancellation_reason: None, request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("void_ref_{}", get_timestamp()))), }), all_keys_required: None, browser_info: None, amount: None, currency: None, ..Default::default() } } // Helper function to create a refund request fn create_refund_request(transaction_id: &str) -> PaymentServiceRefundRequest { PaymentServiceRefundRequest { refund_id: format!("refund_{}", get_timestamp()), transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), currency: i32::from(Currency::Aed), payment_amount: TEST_AMOUNT, refund_amount: TEST_AMOUNT, minor_payment_amount: TEST_AMOUNT, minor_refund_amount: TEST_AMOUNT, reason: None, webhook_url: None, browser_info: None, merchant_account_id: None, capture_method: None, request_ref_id: None, ..Default::default() } }
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 200, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_225_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs } } // Helper function to create a refund request fn create_refund_request(transaction_id: &str) -> PaymentServiceRefundRequest { PaymentServiceRefundRequest { refund_id: format!("refund_{}", get_timestamp()), transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), currency: i32::from(Currency::Aed), payment_amount: TEST_AMOUNT, refund_amount: TEST_AMOUNT, minor_payment_amount: TEST_AMOUNT, minor_refund_amount: TEST_AMOUNT,
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 225, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_225_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs } } // Helper function to create a refund request fn create_refund_request(transaction_id: &str) -> PaymentServiceRefundRequest { PaymentServiceRefundRequest { refund_id: format!("refund_{}", get_timestamp()), transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), currency: i32::from(Currency::Aed), payment_amount: TEST_AMOUNT, refund_amount: TEST_AMOUNT, minor_payment_amount: TEST_AMOUNT, minor_refund_amount: TEST_AMOUNT, reason: None, webhook_url: None, browser_info: None, merchant_account_id: None, capture_method: None, request_ref_id: None, ..Default::default() } } // Helper function to create a refund sync request fn create_refund_sync_request(transaction_id: &str, refund_id: &str) -> RefundServiceGetRequest { RefundServiceGetRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())),
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 225, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_225_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs } } // Helper function to create a refund request fn create_refund_request(transaction_id: &str) -> PaymentServiceRefundRequest { PaymentServiceRefundRequest { refund_id: format!("refund_{}", get_timestamp()), transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), currency: i32::from(Currency::Aed), payment_amount: TEST_AMOUNT, refund_amount: TEST_AMOUNT, minor_payment_amount: TEST_AMOUNT, minor_refund_amount: TEST_AMOUNT, reason: None, webhook_url: None, browser_info: None, merchant_account_id: None, capture_method: None, request_ref_id: None, ..Default::default() } } // Helper function to create a refund sync request fn create_refund_sync_request(transaction_id: &str, refund_id: &str) -> RefundServiceGetRequest { RefundServiceGetRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), refund_id: refund_id.to_string(), refund_reason: None, request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("rsync_ref_{}", get_timestamp()))), }), browser_info: None, refund_metadata: HashMap::new(), state: None, } } // Test for basic health check #[tokio::test] async fn test_health() { grpc_test!(client, HealthClient<Channel>, { let response = client .check(Request::new(HealthCheckRequest { service: "connector_service".to_string(), }))
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 225, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_250_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs // Helper function to create a refund sync request fn create_refund_sync_request(transaction_id: &str, refund_id: &str) -> RefundServiceGetRequest { RefundServiceGetRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), refund_id: refund_id.to_string(), refund_reason: None, request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("rsync_ref_{}", get_timestamp()))), }), browser_info: None, refund_metadata: HashMap::new(), state: None, }
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 250, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_250_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs // Helper function to create a refund sync request fn create_refund_sync_request(transaction_id: &str, refund_id: &str) -> RefundServiceGetRequest { RefundServiceGetRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), refund_id: refund_id.to_string(), refund_reason: None, request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("rsync_ref_{}", get_timestamp()))), }), browser_info: None, refund_metadata: HashMap::new(), state: None, } } // Test for basic health check #[tokio::test] async fn test_health() { grpc_test!(client, HealthClient<Channel>, { let response = client .check(Request::new(HealthCheckRequest { service: "connector_service".to_string(), })) .await .expect("Failed to call health check") .into_inner(); assert_eq!(
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 250, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_250_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs // Helper function to create a refund sync request fn create_refund_sync_request(transaction_id: &str, refund_id: &str) -> RefundServiceGetRequest { RefundServiceGetRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), refund_id: refund_id.to_string(), refund_reason: None, request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("rsync_ref_{}", get_timestamp()))), }), browser_info: None, refund_metadata: HashMap::new(), state: None, } } // Test for basic health check #[tokio::test] async fn test_health() { grpc_test!(client, HealthClient<Channel>, { let response = client .check(Request::new(HealthCheckRequest { service: "connector_service".to_string(), })) .await .expect("Failed to call health check") .into_inner(); assert_eq!( response.status(), grpc_api_types::health_check::health_check_response::ServingStatus::Serving ); }); } // Test payment authorization with auto capture #[tokio::test] async fn test_payment_authorization_auto_capture() { grpc_test!(client, PaymentServiceClient<Channel>, { // Create the payment authorization request let request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers let mut grpc_request = Request::new(request); add_noon_metadata(&mut grpc_request); // Send the request let response = client .authorize(grpc_request) .await .expect("gRPC payment_authorize call failed")
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 250, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_275_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs .await .expect("Failed to call health check") .into_inner(); assert_eq!( response.status(), grpc_api_types::health_check::health_check_response::ServingStatus::Serving ); }); } // Test payment authorization with auto capture #[tokio::test] async fn test_payment_authorization_auto_capture() { grpc_test!(client, PaymentServiceClient<Channel>, {
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 275, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_275_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs .await .expect("Failed to call health check") .into_inner(); assert_eq!( response.status(), grpc_api_types::health_check::health_check_response::ServingStatus::Serving ); }); } // Test payment authorization with auto capture #[tokio::test] async fn test_payment_authorization_auto_capture() { grpc_test!(client, PaymentServiceClient<Channel>, { // Create the payment authorization request let request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers let mut grpc_request = Request::new(request); add_noon_metadata(&mut grpc_request); // Send the request let response = client .authorize(grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Verify the response assert!( response.transaction_id.is_some(), "Resource ID should be present"
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 275, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_275_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs .await .expect("Failed to call health check") .into_inner(); assert_eq!( response.status(), grpc_api_types::health_check::health_check_response::ServingStatus::Serving ); }); } // Test payment authorization with auto capture #[tokio::test] async fn test_payment_authorization_auto_capture() { grpc_test!(client, PaymentServiceClient<Channel>, { // Create the payment authorization request let request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers let mut grpc_request = Request::new(request); add_noon_metadata(&mut grpc_request); // Send the request let response = client .authorize(grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Verify the response assert!( response.transaction_id.is_some(), "Resource ID should be present" ); assert!( response.status == i32::from(PaymentStatus::AuthenticationPending), "Payment should be in AuthenticationPending state" ); }); } // Test payment authorization with manual capture #[tokio::test] async fn test_payment_authorization_manual_capture() { grpc_test!(client, PaymentServiceClient<Channel>, { // Create the payment authorization request with manual capture let auth_request = create_payment_authorize_request(CaptureMethod::Manual); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request); // Send the auth request
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 275, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_300_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs .into_inner(); // Verify the response assert!( response.transaction_id.is_some(), "Resource ID should be present" ); assert!( response.status == i32::from(PaymentStatus::AuthenticationPending), "Payment should be in AuthenticationPending state" ); }); } // Test payment authorization with manual capture #[tokio::test]
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 300, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_300_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs .into_inner(); // Verify the response assert!( response.transaction_id.is_some(), "Resource ID should be present" ); assert!( response.status == i32::from(PaymentStatus::AuthenticationPending), "Payment should be in AuthenticationPending state" ); }); } // Test payment authorization with manual capture #[tokio::test] async fn test_payment_authorization_manual_capture() { grpc_test!(client, PaymentServiceClient<Channel>, { // Create the payment authorization request with manual capture let auth_request = create_payment_authorize_request(CaptureMethod::Manual); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request); // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner();
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 300, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_300_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs .into_inner(); // Verify the response assert!( response.transaction_id.is_some(), "Resource ID should be present" ); assert!( response.status == i32::from(PaymentStatus::AuthenticationPending), "Payment should be in AuthenticationPending state" ); }); } // Test payment authorization with manual capture #[tokio::test] async fn test_payment_authorization_manual_capture() { grpc_test!(client, PaymentServiceClient<Channel>, { // Create the payment authorization request with manual capture let auth_request = create_payment_authorize_request(CaptureMethod::Manual); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request); // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); assert!( auth_response.transaction_id.is_some(), "Transaction ID should be present" ); // Extract the transaction ID let transaction_id = extract_transaction_id(&auth_response); // Verify payment status is authorized if auth_response.status == i32::from(PaymentStatus::Authorized) { // Create capture request let capture_request = create_payment_capture_request(&transaction_id); // Add metadata headers for capture request let mut capture_grpc_request = Request::new(capture_request); add_noon_metadata(&mut capture_grpc_request); // Send the capture request let capture_response = client
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 300, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_325_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); assert!( auth_response.transaction_id.is_some(), "Transaction ID should be present" ); // Extract the transaction ID let transaction_id = extract_transaction_id(&auth_response); // Verify payment status is authorized
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 325, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_325_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); assert!( auth_response.transaction_id.is_some(), "Transaction ID should be present" ); // Extract the transaction ID let transaction_id = extract_transaction_id(&auth_response); // Verify payment status is authorized if auth_response.status == i32::from(PaymentStatus::Authorized) { // Create capture request let capture_request = create_payment_capture_request(&transaction_id); // Add metadata headers for capture request let mut capture_grpc_request = Request::new(capture_request); add_noon_metadata(&mut capture_grpc_request); // Send the capture request let capture_response = client .capture(capture_grpc_request) .await .expect("gRPC payment_capture call failed") .into_inner();
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 325, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_325_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); assert!( auth_response.transaction_id.is_some(), "Transaction ID should be present" ); // Extract the transaction ID let transaction_id = extract_transaction_id(&auth_response); // Verify payment status is authorized if auth_response.status == i32::from(PaymentStatus::Authorized) { // Create capture request let capture_request = create_payment_capture_request(&transaction_id); // Add metadata headers for capture request let mut capture_grpc_request = Request::new(capture_request); add_noon_metadata(&mut capture_grpc_request); // Send the capture request let capture_response = client .capture(capture_grpc_request) .await .expect("gRPC payment_capture call failed") .into_inner(); // Verify payment status is charged after capture assert!( capture_response.status == i32::from(PaymentStatus::Charged), "Payment should be in CHARGED state after capture" ); } }); } // Test payment void #[tokio::test] async fn test_payment_void() { grpc_test!(client, PaymentServiceClient<Channel>, { // First create a payment with manual capture to void let auth_request = create_payment_authorize_request(CaptureMethod::Manual); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request);
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 325, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_350_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs .capture(capture_grpc_request) .await .expect("gRPC payment_capture call failed") .into_inner(); // Verify payment status is charged after capture assert!( capture_response.status == i32::from(PaymentStatus::Charged), "Payment should be in CHARGED state after capture" ); } }); } // Test payment void
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 350, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_350_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs .capture(capture_grpc_request) .await .expect("gRPC payment_capture call failed") .into_inner(); // Verify payment status is charged after capture assert!( capture_response.status == i32::from(PaymentStatus::Charged), "Payment should be in CHARGED state after capture" ); } }); } // Test payment void #[tokio::test] async fn test_payment_void() { grpc_test!(client, PaymentServiceClient<Channel>, { // First create a payment with manual capture to void let auth_request = create_payment_authorize_request(CaptureMethod::Manual); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request); // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed")
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 350, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_350_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs .capture(capture_grpc_request) .await .expect("gRPC payment_capture call failed") .into_inner(); // Verify payment status is charged after capture assert!( capture_response.status == i32::from(PaymentStatus::Charged), "Payment should be in CHARGED state after capture" ); } }); } // Test payment void #[tokio::test] async fn test_payment_void() { grpc_test!(client, PaymentServiceClient<Channel>, { // First create a payment with manual capture to void let auth_request = create_payment_authorize_request(CaptureMethod::Manual); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request); // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Extract the transaction ID let transaction_id = extract_transaction_id(&auth_response); // Extract the request ref ID let request_ref_id = extract_request_ref_id(&auth_response); // After authentication, sync the payment to get updated status let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id); let mut sync_grpc_request = Request::new(sync_request); add_noon_metadata(&mut sync_grpc_request); let sync_response = client .get(sync_grpc_request) .await .expect("gRPC payment_sync call failed") .into_inner(); std::thread::sleep(std::time::Duration::from_secs(1)); // Verify payment status is authorized
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 350, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_375_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Extract the transaction ID let transaction_id = extract_transaction_id(&auth_response); // Extract the request ref ID let request_ref_id = extract_request_ref_id(&auth_response); // After authentication, sync the payment to get updated status let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id);
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 375, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_375_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Extract the transaction ID let transaction_id = extract_transaction_id(&auth_response); // Extract the request ref ID let request_ref_id = extract_request_ref_id(&auth_response); // After authentication, sync the payment to get updated status let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id); let mut sync_grpc_request = Request::new(sync_request); add_noon_metadata(&mut sync_grpc_request); let sync_response = client .get(sync_grpc_request) .await .expect("gRPC payment_sync call failed") .into_inner(); std::thread::sleep(std::time::Duration::from_secs(1)); // Verify payment status is authorized if sync_response.status == i32::from(PaymentStatus::Authorized) { // Create void request with a unique reference ID let void_request = create_payment_void_request(&transaction_id); // Add metadata headers for void request
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 375, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_375_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Extract the transaction ID let transaction_id = extract_transaction_id(&auth_response); // Extract the request ref ID let request_ref_id = extract_request_ref_id(&auth_response); // After authentication, sync the payment to get updated status let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id); let mut sync_grpc_request = Request::new(sync_request); add_noon_metadata(&mut sync_grpc_request); let sync_response = client .get(sync_grpc_request) .await .expect("gRPC payment_sync call failed") .into_inner(); std::thread::sleep(std::time::Duration::from_secs(1)); // Verify payment status is authorized if sync_response.status == i32::from(PaymentStatus::Authorized) { // Create void request with a unique reference ID let void_request = create_payment_void_request(&transaction_id); // Add metadata headers for void request let mut void_grpc_request = Request::new(void_request); add_noon_metadata(&mut void_grpc_request); // Send the void request let void_response = client .void(void_grpc_request) .await .expect("gRPC void_payment call failed") .into_inner(); // Verify the void response assert!( void_response.transaction_id.is_some(), "Transaction ID should be present in void response" ); assert!( void_response.status == i32::from(PaymentStatus::Voided), "Payment should be in VOIDED state after void" );
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 375, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_400_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs if sync_response.status == i32::from(PaymentStatus::Authorized) { // Create void request with a unique reference ID let void_request = create_payment_void_request(&transaction_id); // Add metadata headers for void request let mut void_grpc_request = Request::new(void_request); add_noon_metadata(&mut void_grpc_request); // Send the void request let void_response = client .void(void_grpc_request) .await .expect("gRPC void_payment call failed") .into_inner();
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 400, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_400_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs if sync_response.status == i32::from(PaymentStatus::Authorized) { // Create void request with a unique reference ID let void_request = create_payment_void_request(&transaction_id); // Add metadata headers for void request let mut void_grpc_request = Request::new(void_request); add_noon_metadata(&mut void_grpc_request); // Send the void request let void_response = client .void(void_grpc_request) .await .expect("gRPC void_payment call failed") .into_inner(); // Verify the void response assert!( void_response.transaction_id.is_some(), "Transaction ID should be present in void response" ); assert!( void_response.status == i32::from(PaymentStatus::Voided), "Payment should be in VOIDED state after void" ); // Verify the payment status with a sync operation let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id); let mut sync_grpc_request = Request::new(sync_request); add_noon_metadata(&mut sync_grpc_request);
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 400, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_400_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs if sync_response.status == i32::from(PaymentStatus::Authorized) { // Create void request with a unique reference ID let void_request = create_payment_void_request(&transaction_id); // Add metadata headers for void request let mut void_grpc_request = Request::new(void_request); add_noon_metadata(&mut void_grpc_request); // Send the void request let void_response = client .void(void_grpc_request) .await .expect("gRPC void_payment call failed") .into_inner(); // Verify the void response assert!( void_response.transaction_id.is_some(), "Transaction ID should be present in void response" ); assert!( void_response.status == i32::from(PaymentStatus::Voided), "Payment should be in VOIDED state after void" ); // Verify the payment status with a sync operation let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id); let mut sync_grpc_request = Request::new(sync_request); add_noon_metadata(&mut sync_grpc_request); // Send the sync request to verify void status let sync_response = client .get(sync_grpc_request) .await .expect("gRPC payment_sync call failed") .into_inner(); // Verify the payment is properly voided assert!( sync_response.status == i32::from(PaymentStatus::Voided), "Payment should be in VOIDED state after void sync" ); } }); } // Test payment sync #[tokio::test] async fn test_payment_sync() {
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 400, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_425_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs // Verify the payment status with a sync operation let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id); let mut sync_grpc_request = Request::new(sync_request); add_noon_metadata(&mut sync_grpc_request); // Send the sync request to verify void status let sync_response = client .get(sync_grpc_request) .await .expect("gRPC payment_sync call failed") .into_inner(); // Verify the payment is properly voided assert!(
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 425, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_425_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs // Verify the payment status with a sync operation let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id); let mut sync_grpc_request = Request::new(sync_request); add_noon_metadata(&mut sync_grpc_request); // Send the sync request to verify void status let sync_response = client .get(sync_grpc_request) .await .expect("gRPC payment_sync call failed") .into_inner(); // Verify the payment is properly voided assert!( sync_response.status == i32::from(PaymentStatus::Voided), "Payment should be in VOIDED state after void sync" ); } }); } // Test payment sync #[tokio::test] async fn test_payment_sync() { grpc_test!(client, PaymentServiceClient<Channel>, { // First create a payment to sync let auth_request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers for auth request
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 425, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_425_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs // Verify the payment status with a sync operation let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id); let mut sync_grpc_request = Request::new(sync_request); add_noon_metadata(&mut sync_grpc_request); // Send the sync request to verify void status let sync_response = client .get(sync_grpc_request) .await .expect("gRPC payment_sync call failed") .into_inner(); // Verify the payment is properly voided assert!( sync_response.status == i32::from(PaymentStatus::Voided), "Payment should be in VOIDED state after void sync" ); } }); } // Test payment sync #[tokio::test] async fn test_payment_sync() { grpc_test!(client, PaymentServiceClient<Channel>, { // First create a payment to sync let auth_request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request); // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Extract the transaction ID let transaction_id = extract_transaction_id(&auth_response); // Extract the request ref ID let request_ref_id = extract_request_ref_id(&auth_response); // Wait longer for the transaction to be processed - some async processing may happen std::thread::sleep(std::time::Duration::from_secs(2)); // Create sync request with the specific transaction ID
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 425, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_450_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs grpc_test!(client, PaymentServiceClient<Channel>, { // First create a payment to sync let auth_request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request); // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner();
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 450, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_450_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs grpc_test!(client, PaymentServiceClient<Channel>, { // First create a payment to sync let auth_request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request); // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Extract the transaction ID let transaction_id = extract_transaction_id(&auth_response); // Extract the request ref ID let request_ref_id = extract_request_ref_id(&auth_response); // Wait longer for the transaction to be processed - some async processing may happen std::thread::sleep(std::time::Duration::from_secs(2)); // Create sync request with the specific transaction ID let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id); // Add metadata headers for sync request let mut sync_grpc_request = Request::new(sync_request); add_noon_metadata(&mut sync_grpc_request);
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 450, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_450_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs grpc_test!(client, PaymentServiceClient<Channel>, { // First create a payment to sync let auth_request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request); // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Extract the transaction ID let transaction_id = extract_transaction_id(&auth_response); // Extract the request ref ID let request_ref_id = extract_request_ref_id(&auth_response); // Wait longer for the transaction to be processed - some async processing may happen std::thread::sleep(std::time::Duration::from_secs(2)); // Create sync request with the specific transaction ID let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id); // Add metadata headers for sync request let mut sync_grpc_request = Request::new(sync_request); add_noon_metadata(&mut sync_grpc_request); // Send the sync request let sync_response = client .get(sync_grpc_request) .await .expect("Payment sync request failed") .into_inner(); // Verify the sync response - could be charged, authorized, or pending for automatic capture assert!( sync_response.status == i32::from(PaymentStatus::AuthenticationPending) || sync_response.status == i32::from(PaymentStatus::Charged), "Payment should be in AUTHENTICATIONPENDING or CHARGED state" ); }); } // Test refund flow #[tokio::test] async fn test_refund() {
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 450, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_475_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id); // Add metadata headers for sync request let mut sync_grpc_request = Request::new(sync_request); add_noon_metadata(&mut sync_grpc_request); // Send the sync request let sync_response = client .get(sync_grpc_request) .await .expect("Payment sync request failed") .into_inner(); // Verify the sync response - could be charged, authorized, or pending for automatic capture assert!(
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 475, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_475_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id); // Add metadata headers for sync request let mut sync_grpc_request = Request::new(sync_request); add_noon_metadata(&mut sync_grpc_request); // Send the sync request let sync_response = client .get(sync_grpc_request) .await .expect("Payment sync request failed") .into_inner(); // Verify the sync response - could be charged, authorized, or pending for automatic capture assert!( sync_response.status == i32::from(PaymentStatus::AuthenticationPending) || sync_response.status == i32::from(PaymentStatus::Charged), "Payment should be in AUTHENTICATIONPENDING or CHARGED state" ); }); } // Test refund flow #[tokio::test] async fn test_refund() { grpc_test!(client, PaymentServiceClient<Channel>, { // First create a payment with automatic capture let auth_request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers for auth request
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 475, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_475_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id); // Add metadata headers for sync request let mut sync_grpc_request = Request::new(sync_request); add_noon_metadata(&mut sync_grpc_request); // Send the sync request let sync_response = client .get(sync_grpc_request) .await .expect("Payment sync request failed") .into_inner(); // Verify the sync response - could be charged, authorized, or pending for automatic capture assert!( sync_response.status == i32::from(PaymentStatus::AuthenticationPending) || sync_response.status == i32::from(PaymentStatus::Charged), "Payment should be in AUTHENTICATIONPENDING or CHARGED state" ); }); } // Test refund flow #[tokio::test] async fn test_refund() { grpc_test!(client, PaymentServiceClient<Channel>, { // First create a payment with automatic capture let auth_request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request); // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Extract the transaction ID let transaction_id = extract_transaction_id(&auth_response); // Extract the request ref ID let request_ref_id = extract_request_ref_id(&auth_response); // Verify payment status is authorized (for manual capture) assert!( auth_response.status == i32::from(PaymentStatus::AuthenticationPending), "Payment should be in AUTHENTICATIONPENDING state with auto capture"
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 475, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_500_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs grpc_test!(client, PaymentServiceClient<Channel>, { // First create a payment with automatic capture let auth_request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request); // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner();
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 500, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_500_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs grpc_test!(client, PaymentServiceClient<Channel>, { // First create a payment with automatic capture let auth_request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request); // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Extract the transaction ID let transaction_id = extract_transaction_id(&auth_response); // Extract the request ref ID let request_ref_id = extract_request_ref_id(&auth_response); // Verify payment status is authorized (for manual capture) assert!( auth_response.status == i32::from(PaymentStatus::AuthenticationPending), "Payment should be in AUTHENTICATIONPENDING state with auto capture" ); // Create sync request with the specific transaction ID let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id);
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 500, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_500_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs grpc_test!(client, PaymentServiceClient<Channel>, { // First create a payment with automatic capture let auth_request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request); // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Extract the transaction ID let transaction_id = extract_transaction_id(&auth_response); // Extract the request ref ID let request_ref_id = extract_request_ref_id(&auth_response); // Verify payment status is authorized (for manual capture) assert!( auth_response.status == i32::from(PaymentStatus::AuthenticationPending), "Payment should be in AUTHENTICATIONPENDING state with auto capture" ); // Create sync request with the specific transaction ID let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id); // Add metadata headers for sync request let mut sync_grpc_request = Request::new(sync_request); add_noon_metadata(&mut sync_grpc_request); // Send the sync request let sync_response = client .get(sync_grpc_request) .await .expect("Payment sync request failed") .into_inner(); // Allow more time for the capture to be processed - increase wait time std::thread::sleep(std::time::Duration::from_secs(1)); if sync_response.status == i32::from(PaymentStatus::Authorized) { // Create refund request with a unique refund_id that includes timestamp let refund_request = create_refund_request(&transaction_id); // Add metadata headers for refund request let mut refund_grpc_request = Request::new(refund_request); add_noon_metadata(&mut refund_grpc_request);
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 500, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_525_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs ); // Create sync request with the specific transaction ID let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id); // Add metadata headers for sync request let mut sync_grpc_request = Request::new(sync_request); add_noon_metadata(&mut sync_grpc_request); // Send the sync request let sync_response = client .get(sync_grpc_request) .await .expect("Payment sync request failed") .into_inner();
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 525, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_525_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs ); // Create sync request with the specific transaction ID let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id); // Add metadata headers for sync request let mut sync_grpc_request = Request::new(sync_request); add_noon_metadata(&mut sync_grpc_request); // Send the sync request let sync_response = client .get(sync_grpc_request) .await .expect("Payment sync request failed") .into_inner(); // Allow more time for the capture to be processed - increase wait time std::thread::sleep(std::time::Duration::from_secs(1)); if sync_response.status == i32::from(PaymentStatus::Authorized) { // Create refund request with a unique refund_id that includes timestamp let refund_request = create_refund_request(&transaction_id); // Add metadata headers for refund request let mut refund_grpc_request = Request::new(refund_request); add_noon_metadata(&mut refund_grpc_request); // Send the refund request let refund_response = client .refund(refund_grpc_request) .await
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 525, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_525_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs ); // Create sync request with the specific transaction ID let sync_request = create_payment_sync_request(&transaction_id, &request_ref_id); // Add metadata headers for sync request let mut sync_grpc_request = Request::new(sync_request); add_noon_metadata(&mut sync_grpc_request); // Send the sync request let sync_response = client .get(sync_grpc_request) .await .expect("Payment sync request failed") .into_inner(); // Allow more time for the capture to be processed - increase wait time std::thread::sleep(std::time::Duration::from_secs(1)); if sync_response.status == i32::from(PaymentStatus::Authorized) { // Create refund request with a unique refund_id that includes timestamp let refund_request = create_refund_request(&transaction_id); // Add metadata headers for refund request let mut refund_grpc_request = Request::new(refund_request); add_noon_metadata(&mut refund_grpc_request); // Send the refund request let refund_response = client .refund(refund_grpc_request) .await .expect("Refund request failed") .into_inner(); // Extract the refund ID let _refund_id = refund_response.refund_id.clone(); // Verify the refund status assert!( refund_response.status == i32::from(RefundStatus::RefundSuccess) || refund_response.status == i32::from(RefundStatus::RefundPending), "Refund should be in SUCCESS or PENDING state" ); } }); } // Test refund sync flow #[tokio::test] async fn test_refund_sync() { grpc_test!(client, PaymentServiceClient<Channel>, {
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 525, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_550_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs // Send the refund request let refund_response = client .refund(refund_grpc_request) .await .expect("Refund request failed") .into_inner(); // Extract the refund ID let _refund_id = refund_response.refund_id.clone(); // Verify the refund status assert!( refund_response.status == i32::from(RefundStatus::RefundSuccess) || refund_response.status == i32::from(RefundStatus::RefundPending),
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 550, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_550_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs // Send the refund request let refund_response = client .refund(refund_grpc_request) .await .expect("Refund request failed") .into_inner(); // Extract the refund ID let _refund_id = refund_response.refund_id.clone(); // Verify the refund status assert!( refund_response.status == i32::from(RefundStatus::RefundSuccess) || refund_response.status == i32::from(RefundStatus::RefundPending), "Refund should be in SUCCESS or PENDING state" ); } }); } // Test refund sync flow #[tokio::test] async fn test_refund_sync() { grpc_test!(client, PaymentServiceClient<Channel>, { grpc_test!(refund_client, RefundServiceClient<Channel>, { // First create a payment with manual capture (same as the script) let auth_request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers for auth request
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 550, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_550_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs // Send the refund request let refund_response = client .refund(refund_grpc_request) .await .expect("Refund request failed") .into_inner(); // Extract the refund ID let _refund_id = refund_response.refund_id.clone(); // Verify the refund status assert!( refund_response.status == i32::from(RefundStatus::RefundSuccess) || refund_response.status == i32::from(RefundStatus::RefundPending), "Refund should be in SUCCESS or PENDING state" ); } }); } // Test refund sync flow #[tokio::test] async fn test_refund_sync() { grpc_test!(client, PaymentServiceClient<Channel>, { grpc_test!(refund_client, RefundServiceClient<Channel>, { // First create a payment with manual capture (same as the script) let auth_request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request); // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Extract the transaction ID let transaction_id = extract_transaction_id(&auth_response); // Verify payment status is authorized (for manual capture) assert!( auth_response.status == i32::from(PaymentStatus::AuthenticationPending), "Payment should be in AUTHENTICATIONPENDING state with auto capture" ); // Create refund request
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 550, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_575_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs grpc_test!(refund_client, RefundServiceClient<Channel>, { // First create a payment with manual capture (same as the script) let auth_request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request); // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner();
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 575, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_575_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs grpc_test!(refund_client, RefundServiceClient<Channel>, { // First create a payment with manual capture (same as the script) let auth_request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request); // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Extract the transaction ID let transaction_id = extract_transaction_id(&auth_response); // Verify payment status is authorized (for manual capture) assert!( auth_response.status == i32::from(PaymentStatus::AuthenticationPending), "Payment should be in AUTHENTICATIONPENDING state with auto capture" ); // Create refund request let refund_request = create_refund_request(&transaction_id); // Add metadata headers for refund request let mut refund_grpc_request = Request::new(refund_request); add_noon_metadata(&mut refund_grpc_request);
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 575, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_575_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs grpc_test!(refund_client, RefundServiceClient<Channel>, { // First create a payment with manual capture (same as the script) let auth_request = create_payment_authorize_request(CaptureMethod::Automatic); // Add metadata headers for auth request let mut auth_grpc_request = Request::new(auth_request); add_noon_metadata(&mut auth_grpc_request); // Send the auth request let auth_response = client .authorize(auth_grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Extract the transaction ID let transaction_id = extract_transaction_id(&auth_response); // Verify payment status is authorized (for manual capture) assert!( auth_response.status == i32::from(PaymentStatus::AuthenticationPending), "Payment should be in AUTHENTICATIONPENDING state with auto capture" ); // Create refund request let refund_request = create_refund_request(&transaction_id); // Add metadata headers for refund request let mut refund_grpc_request = Request::new(refund_request); add_noon_metadata(&mut refund_grpc_request); // Send the refund request and expect a successful response let refund_response = client .refund(refund_grpc_request) .await .expect("gRPC refund call failed") .into_inner(); if refund_response.status == i32::from(RefundStatus::RefundSuccess) { // Extract the request ref ID let request_ref_id = extract_request_ref_id(&auth_response); // Allow more time for the refund to be processed std::thread::sleep(std::time::Duration::from_secs(4)); // Create refund sync request let refund_sync_request = create_refund_sync_request(&transaction_id, &request_ref_id); // Add metadata headers for refund sync request let mut refund_sync_grpc_request = Request::new(refund_sync_request);
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 575, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_600_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs let refund_request = create_refund_request(&transaction_id); // Add metadata headers for refund request let mut refund_grpc_request = Request::new(refund_request); add_noon_metadata(&mut refund_grpc_request); // Send the refund request and expect a successful response let refund_response = client .refund(refund_grpc_request) .await .expect("gRPC refund call failed") .into_inner(); if refund_response.status == i32::from(RefundStatus::RefundSuccess) { // Extract the request ref ID let request_ref_id = extract_request_ref_id(&auth_response);
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 600, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_600_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs let refund_request = create_refund_request(&transaction_id); // Add metadata headers for refund request let mut refund_grpc_request = Request::new(refund_request); add_noon_metadata(&mut refund_grpc_request); // Send the refund request and expect a successful response let refund_response = client .refund(refund_grpc_request) .await .expect("gRPC refund call failed") .into_inner(); if refund_response.status == i32::from(RefundStatus::RefundSuccess) { // Extract the request ref ID let request_ref_id = extract_request_ref_id(&auth_response); // Allow more time for the refund to be processed std::thread::sleep(std::time::Duration::from_secs(4)); // Create refund sync request let refund_sync_request = create_refund_sync_request(&transaction_id, &request_ref_id); // Add metadata headers for refund sync request let mut refund_sync_grpc_request = Request::new(refund_sync_request); add_noon_metadata(&mut refund_sync_grpc_request); // Send the refund sync request and expect a successful response let response = refund_client .get(refund_sync_grpc_request)
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 600, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_600_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs let refund_request = create_refund_request(&transaction_id); // Add metadata headers for refund request let mut refund_grpc_request = Request::new(refund_request); add_noon_metadata(&mut refund_grpc_request); // Send the refund request and expect a successful response let refund_response = client .refund(refund_grpc_request) .await .expect("gRPC refund call failed") .into_inner(); if refund_response.status == i32::from(RefundStatus::RefundSuccess) { // Extract the request ref ID let request_ref_id = extract_request_ref_id(&auth_response); // Allow more time for the refund to be processed std::thread::sleep(std::time::Duration::from_secs(4)); // Create refund sync request let refund_sync_request = create_refund_sync_request(&transaction_id, &request_ref_id); // Add metadata headers for refund sync request let mut refund_sync_grpc_request = Request::new(refund_sync_request); add_noon_metadata(&mut refund_sync_grpc_request); // Send the refund sync request and expect a successful response let response = refund_client .get(refund_sync_grpc_request) .await .expect("gRPC refund_sync call failed"); let refund_sync_response = response.into_inner(); // Verify the refund sync status assert!( refund_sync_response.status == i32::from(RefundStatus::RefundSuccess) || refund_sync_response.status == i32::from(RefundStatus::RefundPending), "Refund sync should be in SUCCESS or PENDING state" ); } }); }); }
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 45, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 600, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_625_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs add_noon_metadata(&mut refund_sync_grpc_request); // Send the refund sync request and expect a successful response let response = refund_client .get(refund_sync_grpc_request) .await .expect("gRPC refund_sync call failed"); let refund_sync_response = response.into_inner(); // Verify the refund sync status assert!( refund_sync_response.status == i32::from(RefundStatus::RefundSuccess) || refund_sync_response.status == i32::from(RefundStatus::RefundPending), "Refund sync should be in SUCCESS or PENDING state"
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 625, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_625_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs add_noon_metadata(&mut refund_sync_grpc_request); // Send the refund sync request and expect a successful response let response = refund_client .get(refund_sync_grpc_request) .await .expect("gRPC refund_sync call failed"); let refund_sync_response = response.into_inner(); // Verify the refund sync status assert!( refund_sync_response.status == i32::from(RefundStatus::RefundSuccess) || refund_sync_response.status == i32::from(RefundStatus::RefundPending), "Refund sync should be in SUCCESS or PENDING state" ); } }); }); }
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 20, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 625, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_-1482355156531562553_625_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/noon_payment_flows_test.rs add_noon_metadata(&mut refund_sync_grpc_request); // Send the refund sync request and expect a successful response let response = refund_client .get(refund_sync_grpc_request) .await .expect("gRPC refund_sync call failed"); let refund_sync_response = response.into_inner(); // Verify the refund sync status assert!( refund_sync_response.status == i32::from(RefundStatus::RefundSuccess) || refund_sync_response.status == i32::from(RefundStatus::RefundPending), "Refund sync should be in SUCCESS or PENDING state" ); } }); }); }
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 20, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 625, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_0_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs #![allow(clippy::expect_used)] #![allow(clippy::unwrap_used)] #![allow(clippy::panic)] use grpc_server::{app, configs}; mod common; mod utils; use std::{ collections::HashMap, time::{SystemTime, UNIX_EPOCH}, }; use grpc_api_types::{ health_check::{health_client::HealthClient, HealthCheckRequest},
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 0, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_0_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs #![allow(clippy::expect_used)] #![allow(clippy::unwrap_used)] #![allow(clippy::panic)] use grpc_server::{app, configs}; mod common; mod utils; use std::{ collections::HashMap, time::{SystemTime, UNIX_EPOCH}, }; use grpc_api_types::{ health_check::{health_client::HealthClient, HealthCheckRequest}, payments::{ identifier::IdType, payment_method, payment_service_client::PaymentServiceClient, wallet_payment_method_type, Address, AuthenticationType, Bluecode, BrowserInformation, CaptureMethod, CountryAlpha2, Identifier, PaymentAddress, PaymentMethod, PaymentServiceAuthorizeRequest, PaymentServiceAuthorizeResponse, PaymentServiceGetRequest, PaymentStatus, WalletPaymentMethodType, }, }; use hyperswitch_masking::{ExposeInterface, Secret}; use rand::{distributions::Alphanumeric, Rng}; use tonic::{transport::Channel, Request}; // Constants for Bluecode connector const CONNECTOR_NAME: &str = "bluecode";
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 0, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_0_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs #![allow(clippy::expect_used)] #![allow(clippy::unwrap_used)] #![allow(clippy::panic)] use grpc_server::{app, configs}; mod common; mod utils; use std::{ collections::HashMap, time::{SystemTime, UNIX_EPOCH}, }; use grpc_api_types::{ health_check::{health_client::HealthClient, HealthCheckRequest}, payments::{ identifier::IdType, payment_method, payment_service_client::PaymentServiceClient, wallet_payment_method_type, Address, AuthenticationType, Bluecode, BrowserInformation, CaptureMethod, CountryAlpha2, Identifier, PaymentAddress, PaymentMethod, PaymentServiceAuthorizeRequest, PaymentServiceAuthorizeResponse, PaymentServiceGetRequest, PaymentStatus, WalletPaymentMethodType, }, }; use hyperswitch_masking::{ExposeInterface, Secret}; use rand::{distributions::Alphanumeric, Rng}; use tonic::{transport::Channel, Request}; // Constants for Bluecode connector const CONNECTOR_NAME: &str = "bluecode"; // Test card data const TEST_AMOUNT: i64 = 1000; // Helper function to get current timestamp fn get_timestamp() -> u64 { SystemTime::now() .duration_since(UNIX_EPOCH) .unwrap() .as_secs() } // Helper function to add Bluecode metadata headers to a request fn add_bluecode_metadata<T>(request: &mut Request<T>) { let auth = utils::credential_utils::load_connector_auth(CONNECTOR_NAME) .expect("Failed to load bluecode credentials"); let api_key = match auth { domain_types::router_data::ConnectorAuthType::HeaderKey { api_key } => api_key.expose(), _ => panic!("Expected HeaderKey auth type for bluecode"), };
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 0, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_25_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs use tonic::{transport::Channel, Request}; // Constants for Bluecode connector const CONNECTOR_NAME: &str = "bluecode"; // Test card data const TEST_AMOUNT: i64 = 1000; // Helper function to get current timestamp fn get_timestamp() -> u64 { SystemTime::now() .duration_since(UNIX_EPOCH) .unwrap() .as_secs() }
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 25, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_25_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs use tonic::{transport::Channel, Request}; // Constants for Bluecode connector const CONNECTOR_NAME: &str = "bluecode"; // Test card data const TEST_AMOUNT: i64 = 1000; // Helper function to get current timestamp fn get_timestamp() -> u64 { SystemTime::now() .duration_since(UNIX_EPOCH) .unwrap() .as_secs() } // Helper function to add Bluecode metadata headers to a request fn add_bluecode_metadata<T>(request: &mut Request<T>) { let auth = utils::credential_utils::load_connector_auth(CONNECTOR_NAME) .expect("Failed to load bluecode credentials"); let api_key = match auth { domain_types::router_data::ConnectorAuthType::HeaderKey { api_key } => api_key.expose(), _ => panic!("Expected HeaderKey auth type for bluecode"), }; // Get the shop_name from metadata let metadata = utils::credential_utils::load_connector_metadata(CONNECTOR_NAME) .expect("Failed to load bluecode metadata"); let shop_name = metadata
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 25, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_25_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs use tonic::{transport::Channel, Request}; // Constants for Bluecode connector const CONNECTOR_NAME: &str = "bluecode"; // Test card data const TEST_AMOUNT: i64 = 1000; // Helper function to get current timestamp fn get_timestamp() -> u64 { SystemTime::now() .duration_since(UNIX_EPOCH) .unwrap() .as_secs() } // Helper function to add Bluecode metadata headers to a request fn add_bluecode_metadata<T>(request: &mut Request<T>) { let auth = utils::credential_utils::load_connector_auth(CONNECTOR_NAME) .expect("Failed to load bluecode credentials"); let api_key = match auth { domain_types::router_data::ConnectorAuthType::HeaderKey { api_key } => api_key.expose(), _ => panic!("Expected HeaderKey auth type for bluecode"), }; // Get the shop_name from metadata let metadata = utils::credential_utils::load_connector_metadata(CONNECTOR_NAME) .expect("Failed to load bluecode metadata"); let shop_name = metadata .get("shop_name") .expect("shop_name not found in bluecode metadata") .clone(); request.metadata_mut().append( "x-connector", CONNECTOR_NAME.parse().expect("Failed to parse x-connector"), ); request.metadata_mut().append( "x-auth", "header-key".parse().expect("Failed to parse x-auth"), ); request.metadata_mut().append( "x-api-key", api_key.parse().expect("Failed to parse x-api-key"), ); // Add the terminal_id in the metadata JSON // This metadata must be in the proper format that the connector expects let metadata_json = format!(r#"{{"shop_name":"{shop_name}"}}"#);
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 25, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_50_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs // Get the shop_name from metadata let metadata = utils::credential_utils::load_connector_metadata(CONNECTOR_NAME) .expect("Failed to load bluecode metadata"); let shop_name = metadata .get("shop_name") .expect("shop_name not found in bluecode metadata") .clone(); request.metadata_mut().append( "x-connector", CONNECTOR_NAME.parse().expect("Failed to parse x-connector"), ); request.metadata_mut().append( "x-auth",
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 50, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_50_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs // Get the shop_name from metadata let metadata = utils::credential_utils::load_connector_metadata(CONNECTOR_NAME) .expect("Failed to load bluecode metadata"); let shop_name = metadata .get("shop_name") .expect("shop_name not found in bluecode metadata") .clone(); request.metadata_mut().append( "x-connector", CONNECTOR_NAME.parse().expect("Failed to parse x-connector"), ); request.metadata_mut().append( "x-auth", "header-key".parse().expect("Failed to parse x-auth"), ); request.metadata_mut().append( "x-api-key", api_key.parse().expect("Failed to parse x-api-key"), ); // Add the terminal_id in the metadata JSON // This metadata must be in the proper format that the connector expects let metadata_json = format!(r#"{{"shop_name":"{shop_name}"}}"#); request.metadata_mut().append( "x-metadata", metadata_json.parse().expect("Failed to parse x-metadata"), );
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 50, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_50_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs // Get the shop_name from metadata let metadata = utils::credential_utils::load_connector_metadata(CONNECTOR_NAME) .expect("Failed to load bluecode metadata"); let shop_name = metadata .get("shop_name") .expect("shop_name not found in bluecode metadata") .clone(); request.metadata_mut().append( "x-connector", CONNECTOR_NAME.parse().expect("Failed to parse x-connector"), ); request.metadata_mut().append( "x-auth", "header-key".parse().expect("Failed to parse x-auth"), ); request.metadata_mut().append( "x-api-key", api_key.parse().expect("Failed to parse x-api-key"), ); // Add the terminal_id in the metadata JSON // This metadata must be in the proper format that the connector expects let metadata_json = format!(r#"{{"shop_name":"{shop_name}"}}"#); request.metadata_mut().append( "x-metadata", metadata_json.parse().expect("Failed to parse x-metadata"), ); request.metadata_mut().append( "x-tenant-id", "default".parse().expect("Failed to parse x-tenant-id"), ); // Add request ID which is required by the server request.metadata_mut().append( "x-request-id", format!("mifinity_req_{}", get_timestamp()) .parse() .expect("Failed to parse x-request-id"), ); request.metadata_mut().append( "x-merchant-id", "12abc123-f8a3-99b8-9ef8-b31180358hh4" .parse() .expect("Failed to parse x-merchant-id"), ); }
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 50, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_75_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs request.metadata_mut().append( "x-metadata", metadata_json.parse().expect("Failed to parse x-metadata"), ); request.metadata_mut().append( "x-tenant-id", "default".parse().expect("Failed to parse x-tenant-id"), ); // Add request ID which is required by the server request.metadata_mut().append( "x-request-id", format!("mifinity_req_{}", get_timestamp()) .parse()
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 75, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_75_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs request.metadata_mut().append( "x-metadata", metadata_json.parse().expect("Failed to parse x-metadata"), ); request.metadata_mut().append( "x-tenant-id", "default".parse().expect("Failed to parse x-tenant-id"), ); // Add request ID which is required by the server request.metadata_mut().append( "x-request-id", format!("mifinity_req_{}", get_timestamp()) .parse() .expect("Failed to parse x-request-id"), ); request.metadata_mut().append( "x-merchant-id", "12abc123-f8a3-99b8-9ef8-b31180358hh4" .parse() .expect("Failed to parse x-merchant-id"), ); } // Helper function to extract connector transaction ID from response fn extract_transaction_id(response: &PaymentServiceAuthorizeResponse) -> String { match &response.transaction_id { Some(id) => match id.id_type.as_ref().unwrap() {
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 75, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_75_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs request.metadata_mut().append( "x-metadata", metadata_json.parse().expect("Failed to parse x-metadata"), ); request.metadata_mut().append( "x-tenant-id", "default".parse().expect("Failed to parse x-tenant-id"), ); // Add request ID which is required by the server request.metadata_mut().append( "x-request-id", format!("mifinity_req_{}", get_timestamp()) .parse() .expect("Failed to parse x-request-id"), ); request.metadata_mut().append( "x-merchant-id", "12abc123-f8a3-99b8-9ef8-b31180358hh4" .parse() .expect("Failed to parse x-merchant-id"), ); } // Helper function to extract connector transaction ID from response fn extract_transaction_id(response: &PaymentServiceAuthorizeResponse) -> String { match &response.transaction_id { Some(id) => match id.id_type.as_ref().unwrap() { IdType::Id(id) => id.clone(), _ => panic!("Expected connector transaction ID"), }, None => panic!("Resource ID is None"), } } // Helper function to generate unique request reference ID fn generate_unique_request_ref_id(prefix: &str) -> String { format!( "{}_{}", prefix, &uuid::Uuid::new_v4().simple().to_string()[..8] ) } // Helper function to generate unique email fn generate_unique_email() -> String { format!("testcustomer{}@gmail.com", get_timestamp()) }
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 75, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_100_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs // Helper function to extract connector transaction ID from response fn extract_transaction_id(response: &PaymentServiceAuthorizeResponse) -> String { match &response.transaction_id { Some(id) => match id.id_type.as_ref().unwrap() { IdType::Id(id) => id.clone(), _ => panic!("Expected connector transaction ID"), }, None => panic!("Resource ID is None"), } } // Helper function to generate unique request reference ID fn generate_unique_request_ref_id(prefix: &str) -> String { format!(
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 100, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_100_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs // Helper function to extract connector transaction ID from response fn extract_transaction_id(response: &PaymentServiceAuthorizeResponse) -> String { match &response.transaction_id { Some(id) => match id.id_type.as_ref().unwrap() { IdType::Id(id) => id.clone(), _ => panic!("Expected connector transaction ID"), }, None => panic!("Resource ID is None"), } } // Helper function to generate unique request reference ID fn generate_unique_request_ref_id(prefix: &str) -> String { format!( "{}_{}", prefix, &uuid::Uuid::new_v4().simple().to_string()[..8] ) } // Helper function to generate unique email fn generate_unique_email() -> String { format!("testcustomer{}@gmail.com", get_timestamp()) } // Function to generate random name fn random_name() -> String { rand::thread_rng() .sample_iter(&Alphanumeric)
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 100, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_100_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs // Helper function to extract connector transaction ID from response fn extract_transaction_id(response: &PaymentServiceAuthorizeResponse) -> String { match &response.transaction_id { Some(id) => match id.id_type.as_ref().unwrap() { IdType::Id(id) => id.clone(), _ => panic!("Expected connector transaction ID"), }, None => panic!("Resource ID is None"), } } // Helper function to generate unique request reference ID fn generate_unique_request_ref_id(prefix: &str) -> String { format!( "{}_{}", prefix, &uuid::Uuid::new_v4().simple().to_string()[..8] ) } // Helper function to generate unique email fn generate_unique_email() -> String { format!("testcustomer{}@gmail.com", get_timestamp()) } // Function to generate random name fn random_name() -> String { rand::thread_rng() .sample_iter(&Alphanumeric) .take(8) .map(char::from) .collect() } // Helper function to create a payment authorization request #[allow(clippy::field_reassign_with_default)] fn create_payment_authorize_request( capture_method: common_enums::CaptureMethod, ) -> PaymentServiceAuthorizeRequest { // Initialize with all required fields let mut request = PaymentServiceAuthorizeRequest { payment_method: Some(PaymentMethod { payment_method: Some(payment_method::PaymentMethod::Wallet( WalletPaymentMethodType { wallet_type: Some(wallet_payment_method_type::WalletType::Bluecode( Bluecode {}, )), }, )),
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 100, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_125_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs // Function to generate random name fn random_name() -> String { rand::thread_rng() .sample_iter(&Alphanumeric) .take(8) .map(char::from) .collect() } // Helper function to create a payment authorization request #[allow(clippy::field_reassign_with_default)] fn create_payment_authorize_request( capture_method: common_enums::CaptureMethod, ) -> PaymentServiceAuthorizeRequest {
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 125, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_125_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs // Function to generate random name fn random_name() -> String { rand::thread_rng() .sample_iter(&Alphanumeric) .take(8) .map(char::from) .collect() } // Helper function to create a payment authorization request #[allow(clippy::field_reassign_with_default)] fn create_payment_authorize_request( capture_method: common_enums::CaptureMethod, ) -> PaymentServiceAuthorizeRequest { // Initialize with all required fields let mut request = PaymentServiceAuthorizeRequest { payment_method: Some(PaymentMethod { payment_method: Some(payment_method::PaymentMethod::Wallet( WalletPaymentMethodType { wallet_type: Some(wallet_payment_method_type::WalletType::Bluecode( Bluecode {}, )), }, )), }), ..Default::default() }; if let common_enums::CaptureMethod::Manual = capture_method {
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 125, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_125_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs // Function to generate random name fn random_name() -> String { rand::thread_rng() .sample_iter(&Alphanumeric) .take(8) .map(char::from) .collect() } // Helper function to create a payment authorization request #[allow(clippy::field_reassign_with_default)] fn create_payment_authorize_request( capture_method: common_enums::CaptureMethod, ) -> PaymentServiceAuthorizeRequest { // Initialize with all required fields let mut request = PaymentServiceAuthorizeRequest { payment_method: Some(PaymentMethod { payment_method: Some(payment_method::PaymentMethod::Wallet( WalletPaymentMethodType { wallet_type: Some(wallet_payment_method_type::WalletType::Bluecode( Bluecode {}, )), }, )), }), ..Default::default() }; if let common_enums::CaptureMethod::Manual = capture_method { request.capture_method = Some(i32::from(CaptureMethod::Manual)); // request.request_incremental_authorization = true; } else { request.capture_method = Some(i32::from(CaptureMethod::Automatic)); } let mut request_ref_id = Identifier::default(); request_ref_id.id_type = Some(IdType::Id( generate_unique_request_ref_id("req_"), // Using timestamp to make unique )); request.request_ref_id = Some(request_ref_id); // Set the basic payment details matching working grpcurl request.amount = TEST_AMOUNT; request.minor_amount = TEST_AMOUNT; request.currency = 146; // Currency value from working grpcurl request.email = Some(Secret::new(generate_unique_email())); // Generate random names for billing to prevent duplicate transaction errors
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 125, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_150_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs }), ..Default::default() }; if let common_enums::CaptureMethod::Manual = capture_method { request.capture_method = Some(i32::from(CaptureMethod::Manual)); // request.request_incremental_authorization = true; } else { request.capture_method = Some(i32::from(CaptureMethod::Automatic)); } let mut request_ref_id = Identifier::default(); request_ref_id.id_type = Some(IdType::Id( generate_unique_request_ref_id("req_"), // Using timestamp to make unique ));
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 150, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_150_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs }), ..Default::default() }; if let common_enums::CaptureMethod::Manual = capture_method { request.capture_method = Some(i32::from(CaptureMethod::Manual)); // request.request_incremental_authorization = true; } else { request.capture_method = Some(i32::from(CaptureMethod::Automatic)); } let mut request_ref_id = Identifier::default(); request_ref_id.id_type = Some(IdType::Id( generate_unique_request_ref_id("req_"), // Using timestamp to make unique )); request.request_ref_id = Some(request_ref_id); // Set the basic payment details matching working grpcurl request.amount = TEST_AMOUNT; request.minor_amount = TEST_AMOUNT; request.currency = 146; // Currency value from working grpcurl request.email = Some(Secret::new(generate_unique_email())); // Generate random names for billing to prevent duplicate transaction errors let billing_first_name = random_name(); let billing_last_name = random_name(); // Minimal address structure matching working grpcurl request.address = Some(PaymentAddress {
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 150, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_150_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs }), ..Default::default() }; if let common_enums::CaptureMethod::Manual = capture_method { request.capture_method = Some(i32::from(CaptureMethod::Manual)); // request.request_incremental_authorization = true; } else { request.capture_method = Some(i32::from(CaptureMethod::Automatic)); } let mut request_ref_id = Identifier::default(); request_ref_id.id_type = Some(IdType::Id( generate_unique_request_ref_id("req_"), // Using timestamp to make unique )); request.request_ref_id = Some(request_ref_id); // Set the basic payment details matching working grpcurl request.amount = TEST_AMOUNT; request.minor_amount = TEST_AMOUNT; request.currency = 146; // Currency value from working grpcurl request.email = Some(Secret::new(generate_unique_email())); // Generate random names for billing to prevent duplicate transaction errors let billing_first_name = random_name(); let billing_last_name = random_name(); // Minimal address structure matching working grpcurl request.address = Some(PaymentAddress { billing_address: Some(Address { first_name: Some(Secret::new(billing_first_name)), last_name: Some(Secret::new(billing_last_name)), line1: Some(Secret::new("14 Main Street".to_string())), line2: None, line3: None, city: Some(Secret::new("Pecan Springs".to_string())), state: Some(Secret::new("TX".to_string())), zip_code: Some(Secret::new("44628".to_string())), country_alpha2_code: Some(i32::from(CountryAlpha2::Us)), phone_number: None, phone_country_code: None, email: None, }), shipping_address: None, // Minimal address - no shipping for working grpcurl }); let browser_info = BrowserInformation { color_depth: None, java_enabled: Some(false),
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 150, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_175_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs let billing_first_name = random_name(); let billing_last_name = random_name(); // Minimal address structure matching working grpcurl request.address = Some(PaymentAddress { billing_address: Some(Address { first_name: Some(Secret::new(billing_first_name)), last_name: Some(Secret::new(billing_last_name)), line1: Some(Secret::new("14 Main Street".to_string())), line2: None, line3: None, city: Some(Secret::new("Pecan Springs".to_string())), state: Some(Secret::new("TX".to_string())), zip_code: Some(Secret::new("44628".to_string())), country_alpha2_code: Some(i32::from(CountryAlpha2::Us)),
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 175, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_175_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs let billing_first_name = random_name(); let billing_last_name = random_name(); // Minimal address structure matching working grpcurl request.address = Some(PaymentAddress { billing_address: Some(Address { first_name: Some(Secret::new(billing_first_name)), last_name: Some(Secret::new(billing_last_name)), line1: Some(Secret::new("14 Main Street".to_string())), line2: None, line3: None, city: Some(Secret::new("Pecan Springs".to_string())), state: Some(Secret::new("TX".to_string())), zip_code: Some(Secret::new("44628".to_string())), country_alpha2_code: Some(i32::from(CountryAlpha2::Us)), phone_number: None, phone_country_code: None, email: None, }), shipping_address: None, // Minimal address - no shipping for working grpcurl }); let browser_info = BrowserInformation { color_depth: None, java_enabled: Some(false), screen_height: Some(1080), screen_width: Some(1920), user_agent: Some("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)".to_string()), accept_header: Some( "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8".to_string(),
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 175, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_175_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs let billing_first_name = random_name(); let billing_last_name = random_name(); // Minimal address structure matching working grpcurl request.address = Some(PaymentAddress { billing_address: Some(Address { first_name: Some(Secret::new(billing_first_name)), last_name: Some(Secret::new(billing_last_name)), line1: Some(Secret::new("14 Main Street".to_string())), line2: None, line3: None, city: Some(Secret::new("Pecan Springs".to_string())), state: Some(Secret::new("TX".to_string())), zip_code: Some(Secret::new("44628".to_string())), country_alpha2_code: Some(i32::from(CountryAlpha2::Us)), phone_number: None, phone_country_code: None, email: None, }), shipping_address: None, // Minimal address - no shipping for working grpcurl }); let browser_info = BrowserInformation { color_depth: None, java_enabled: Some(false), screen_height: Some(1080), screen_width: Some(1920), user_agent: Some("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)".to_string()), accept_header: Some( "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8".to_string(), ), java_script_enabled: Some(false), language: Some("en-US".to_string()), ip_address: None, os_type: None, os_version: None, device_model: None, accept_language: None, time_zone_offset_minutes: None, referer: None, }; request.browser_info = Some(browser_info); request.return_url = Some("www.google.com".to_string()); // Set the transaction details request.auth_type = i32::from(AuthenticationType::NoThreeDs); request.request_incremental_authorization = true; request.enrolled_for_3ds = true;
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 175, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_200_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs screen_height: Some(1080), screen_width: Some(1920), user_agent: Some("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)".to_string()), accept_header: Some( "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8".to_string(), ), java_script_enabled: Some(false), language: Some("en-US".to_string()), ip_address: None, os_type: None, os_version: None, device_model: None, accept_language: None, time_zone_offset_minutes: None, referer: None,
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 200, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_200_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs screen_height: Some(1080), screen_width: Some(1920), user_agent: Some("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)".to_string()), accept_header: Some( "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8".to_string(), ), java_script_enabled: Some(false), language: Some("en-US".to_string()), ip_address: None, os_type: None, os_version: None, device_model: None, accept_language: None, time_zone_offset_minutes: None, referer: None, }; request.browser_info = Some(browser_info); request.return_url = Some("www.google.com".to_string()); // Set the transaction details request.auth_type = i32::from(AuthenticationType::NoThreeDs); request.request_incremental_authorization = true; request.enrolled_for_3ds = true; // Set capture method // request.capture_method = Some(i32::from(CaptureMethod::from(capture_method))); // Get shop_name for metadata
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 200, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_200_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs screen_height: Some(1080), screen_width: Some(1920), user_agent: Some("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)".to_string()), accept_header: Some( "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8".to_string(), ), java_script_enabled: Some(false), language: Some("en-US".to_string()), ip_address: None, os_type: None, os_version: None, device_model: None, accept_language: None, time_zone_offset_minutes: None, referer: None, }; request.browser_info = Some(browser_info); request.return_url = Some("www.google.com".to_string()); // Set the transaction details request.auth_type = i32::from(AuthenticationType::NoThreeDs); request.request_incremental_authorization = true; request.enrolled_for_3ds = true; // Set capture method // request.capture_method = Some(i32::from(CaptureMethod::from(capture_method))); // Get shop_name for metadata let metadata = utils::credential_utils::load_connector_metadata(CONNECTOR_NAME) .expect("Failed to load bluecode metadata"); let shop_name = metadata .get("shop_name") .expect("shop_name not found in bluecode metadata") .clone(); // Create connector metadata as a proper JSON object let mut connector_metadata = HashMap::new(); connector_metadata.insert("shop_name".to_string(), shop_name); let connector_metadata_json = serde_json::to_string(&connector_metadata).expect("Failed to serialize connector metadata"); let mut metadata = HashMap::new(); metadata.insert("connector_meta_data".to_string(), connector_metadata_json); request.metadata = metadata; request
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 200, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_225_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs // Set capture method // request.capture_method = Some(i32::from(CaptureMethod::from(capture_method))); // Get shop_name for metadata let metadata = utils::credential_utils::load_connector_metadata(CONNECTOR_NAME) .expect("Failed to load bluecode metadata"); let shop_name = metadata .get("shop_name") .expect("shop_name not found in bluecode metadata") .clone(); // Create connector metadata as a proper JSON object let mut connector_metadata = HashMap::new(); connector_metadata.insert("shop_name".to_string(), shop_name);
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 225, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_225_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs // Set capture method // request.capture_method = Some(i32::from(CaptureMethod::from(capture_method))); // Get shop_name for metadata let metadata = utils::credential_utils::load_connector_metadata(CONNECTOR_NAME) .expect("Failed to load bluecode metadata"); let shop_name = metadata .get("shop_name") .expect("shop_name not found in bluecode metadata") .clone(); // Create connector metadata as a proper JSON object let mut connector_metadata = HashMap::new(); connector_metadata.insert("shop_name".to_string(), shop_name); let connector_metadata_json = serde_json::to_string(&connector_metadata).expect("Failed to serialize connector metadata"); let mut metadata = HashMap::new(); metadata.insert("connector_meta_data".to_string(), connector_metadata_json); request.metadata = metadata; request } // Helper function to create a payment sync request fn create_payment_sync_request(transaction_id: &str) -> PaymentServiceGetRequest { PaymentServiceGetRequest {
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 225, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_225_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs // Set capture method // request.capture_method = Some(i32::from(CaptureMethod::from(capture_method))); // Get shop_name for metadata let metadata = utils::credential_utils::load_connector_metadata(CONNECTOR_NAME) .expect("Failed to load bluecode metadata"); let shop_name = metadata .get("shop_name") .expect("shop_name not found in bluecode metadata") .clone(); // Create connector metadata as a proper JSON object let mut connector_metadata = HashMap::new(); connector_metadata.insert("shop_name".to_string(), shop_name); let connector_metadata_json = serde_json::to_string(&connector_metadata).expect("Failed to serialize connector metadata"); let mut metadata = HashMap::new(); metadata.insert("connector_meta_data".to_string(), connector_metadata_json); request.metadata = metadata; request } // Helper function to create a payment sync request fn create_payment_sync_request(transaction_id: &str) -> PaymentServiceGetRequest { PaymentServiceGetRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("fiserv_sync_{}", get_timestamp()))), }), capture_method: None, handle_response: None, // all_keys_required: None, amount: TEST_AMOUNT, currency: 146, // Currency value from working grpcurl state: None, } } // Test for basic health check #[tokio::test] async fn test_health() { grpc_test!(client, HealthClient<Channel>, { let response = client
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 225, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_250_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs } // Helper function to create a payment sync request fn create_payment_sync_request(transaction_id: &str) -> PaymentServiceGetRequest { PaymentServiceGetRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("fiserv_sync_{}", get_timestamp()))), }), capture_method: None, handle_response: None, // all_keys_required: None, amount: TEST_AMOUNT,
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 250, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_250_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs } // Helper function to create a payment sync request fn create_payment_sync_request(transaction_id: &str) -> PaymentServiceGetRequest { PaymentServiceGetRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("fiserv_sync_{}", get_timestamp()))), }), capture_method: None, handle_response: None, // all_keys_required: None, amount: TEST_AMOUNT, currency: 146, // Currency value from working grpcurl state: None, } } // Test for basic health check #[tokio::test] async fn test_health() { grpc_test!(client, HealthClient<Channel>, { let response = client .check(Request::new(HealthCheckRequest { service: "connector_service".to_string(), })) .await .expect("Failed to call health check")
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 250, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_250_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs } // Helper function to create a payment sync request fn create_payment_sync_request(transaction_id: &str) -> PaymentServiceGetRequest { PaymentServiceGetRequest { transaction_id: Some(Identifier { id_type: Some(IdType::Id(transaction_id.to_string())), }), request_ref_id: Some(Identifier { id_type: Some(IdType::Id(format!("fiserv_sync_{}", get_timestamp()))), }), capture_method: None, handle_response: None, // all_keys_required: None, amount: TEST_AMOUNT, currency: 146, // Currency value from working grpcurl state: None, } } // Test for basic health check #[tokio::test] async fn test_health() { grpc_test!(client, HealthClient<Channel>, { let response = client .check(Request::new(HealthCheckRequest { service: "connector_service".to_string(), })) .await .expect("Failed to call health check") .into_inner(); assert_eq!( response.status(), grpc_api_types::health_check::health_check_response::ServingStatus::Serving ); }); } // Test payment authorization with auto capture #[tokio::test] async fn test_payment_authorization_auto_capture() { grpc_test!(client, PaymentServiceClient<Channel>, { // Create the payment authorization request let request = create_payment_authorize_request(common_enums::CaptureMethod::Automatic); // Add metadata headers let mut grpc_request = Request::new(request); add_bluecode_metadata(&mut grpc_request);
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 250, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_275_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs .check(Request::new(HealthCheckRequest { service: "connector_service".to_string(), })) .await .expect("Failed to call health check") .into_inner(); assert_eq!( response.status(), grpc_api_types::health_check::health_check_response::ServingStatus::Serving ); }); } // Test payment authorization with auto capture
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 275, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_275_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs .check(Request::new(HealthCheckRequest { service: "connector_service".to_string(), })) .await .expect("Failed to call health check") .into_inner(); assert_eq!( response.status(), grpc_api_types::health_check::health_check_response::ServingStatus::Serving ); }); } // Test payment authorization with auto capture #[tokio::test] async fn test_payment_authorization_auto_capture() { grpc_test!(client, PaymentServiceClient<Channel>, { // Create the payment authorization request let request = create_payment_authorize_request(common_enums::CaptureMethod::Automatic); // Add metadata headers let mut grpc_request = Request::new(request); add_bluecode_metadata(&mut grpc_request); // Send the request let response = client .authorize(grpc_request) .await .expect("gRPC payment_authorize call failed")
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 275, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_275_50
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs .check(Request::new(HealthCheckRequest { service: "connector_service".to_string(), })) .await .expect("Failed to call health check") .into_inner(); assert_eq!( response.status(), grpc_api_types::health_check::health_check_response::ServingStatus::Serving ); }); } // Test payment authorization with auto capture #[tokio::test] async fn test_payment_authorization_auto_capture() { grpc_test!(client, PaymentServiceClient<Channel>, { // Create the payment authorization request let request = create_payment_authorize_request(common_enums::CaptureMethod::Automatic); // Add metadata headers let mut grpc_request = Request::new(request); add_bluecode_metadata(&mut grpc_request); // Send the request let response = client .authorize(grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Debug print has been removed // Verify the response assert!( response.transaction_id.is_some(), "Resource ID should be present" ); // Extract the transaction ID let _transaction_id = extract_transaction_id(&response); // Verify payment status assert!( response.status == i32::from(PaymentStatus::AuthenticationPending), "Payment should be in AuthenticationPending state" ); }); }
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 50, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 275, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_300_15
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs // Send the request let response = client .authorize(grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Debug print has been removed // Verify the response assert!( response.transaction_id.is_some(), "Resource ID should be present" );
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 15, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 300, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_snippet_559727822511286263_300_30
clm
snippet
// connector-service/backend/grpc-server/tests/beta_tests/bluecode_payment_flows_test.rs // Send the request let response = client .authorize(grpc_request) .await .expect("gRPC payment_authorize call failed") .into_inner(); // Debug print has been removed // Verify the response assert!( response.transaction_id.is_some(), "Resource ID should be present" ); // Extract the transaction ID let _transaction_id = extract_transaction_id(&response); // Verify payment status assert!( response.status == i32::from(PaymentStatus::AuthenticationPending), "Payment should be in AuthenticationPending state" ); }); } // Test payment sync #[tokio::test] async fn test_payment_sync() { grpc_test!(client, PaymentServiceClient<Channel>, {
{ "chunk": null, "crate": "grpc-server", "enum_name": null, "file_size": null, "for_type": null, "function_name": null, "is_async": null, "is_pub": null, "lines": 30, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": 300, "struct_name": null, "total_crates": null, "trait_name": null }