id
stringlengths 20
153
| type
stringclasses 1
value | granularity
stringclasses 14
values | content
stringlengths 16
84.3k
| metadata
dict |
|---|---|---|---|---|
connector-service_snippet_-6689475451466318163_300_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
add_xendit_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"
);
});
}
// Test payment sync with auto capture
#[tokio::test]
async fn test_payment_sync_auto_capture() {
grpc_test!(client, PaymentServiceClient<Channel>, {
// Create the payment authorization request
let request = create_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_xendit_metadata(&mut grpc_request);
// Send the request
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": 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_-6689475451466318163_300_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
add_xendit_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"
);
});
}
// Test payment sync with auto capture
#[tokio::test]
async fn test_payment_sync_auto_capture() {
grpc_test!(client, PaymentServiceClient<Channel>, {
// Create the payment authorization request
let request = create_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_xendit_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&response);
// Add delay of 10 seconds
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
// Create sync request
let sync_request = create_payment_sync_request(&transaction_id);
// Add metadata headers for sync request
let mut sync_grpc_request = Request::new(sync_request);
add_xendit_metadata(&mut sync_grpc_request);
// Send the sync request
let sync_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_-6689475451466318163_325_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
let mut grpc_request = Request::new(request);
add_xendit_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&response);
// Add delay of 10 seconds
tokio::time::sleep(std::time::Duration::from_secs(10)).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": 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_-6689475451466318163_325_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
let mut grpc_request = Request::new(request);
add_xendit_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&response);
// Add delay of 10 seconds
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
// Create sync request
let sync_request = create_payment_sync_request(&transaction_id);
// Add metadata headers for sync request
let mut sync_grpc_request = Request::new(sync_request);
add_xendit_metadata(&mut sync_grpc_request);
// Send the sync request
let sync_response = client
.get(sync_grpc_request)
.await
.expect("gRPC payment_sync 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_-6689475451466318163_325_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
let mut grpc_request = Request::new(request);
add_xendit_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&response);
// Add delay of 10 seconds
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
// Create sync request
let sync_request = create_payment_sync_request(&transaction_id);
// Add metadata headers for sync request
let mut sync_grpc_request = Request::new(sync_request);
add_xendit_metadata(&mut sync_grpc_request);
// Send the sync request
let sync_response = client
.get(sync_grpc_request)
.await
.expect("gRPC payment_sync call failed")
.into_inner();
// Verify the sync response
assert!(
sync_response.status == i32::from(PaymentStatus::Charged),
"Payment should be in Charged state"
);
});
}
// Test refund flow - handles both success and error cases
#[tokio::test]
async fn test_refund() {
grpc_test!(client, PaymentServiceClient<Channel>, {
// Create the payment authorization request
let request = create_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_xendit_metadata(&mut grpc_request);
// Send the 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_-6689475451466318163_350_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
.get(sync_grpc_request)
.await
.expect("gRPC payment_sync call failed")
.into_inner();
// Verify the sync response
assert!(
sync_response.status == i32::from(PaymentStatus::Charged),
"Payment should be in Charged state"
);
});
}
// Test refund flow - handles both success and error cases
#[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": 350,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-6689475451466318163_350_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
.get(sync_grpc_request)
.await
.expect("gRPC payment_sync call failed")
.into_inner();
// Verify the sync response
assert!(
sync_response.status == i32::from(PaymentStatus::Charged),
"Payment should be in Charged state"
);
});
}
// Test refund flow - handles both success and error cases
#[tokio::test]
async fn test_refund() {
grpc_test!(client, PaymentServiceClient<Channel>, {
// Create the payment authorization request
let request = create_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_xendit_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC 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": 350,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-6689475451466318163_350_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
.get(sync_grpc_request)
.await
.expect("gRPC payment_sync call failed")
.into_inner();
// Verify the sync response
assert!(
sync_response.status == i32::from(PaymentStatus::Charged),
"Payment should be in Charged state"
);
});
}
// Test refund flow - handles both success and error cases
#[tokio::test]
async fn test_refund() {
grpc_test!(client, PaymentServiceClient<Channel>, {
// Create the payment authorization request
let request = create_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_xendit_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&response);
assert!(
response.status == i32::from(PaymentStatus::AuthenticationPending)
|| response.status == i32::from(PaymentStatus::Pending)
|| response.status == i32::from(PaymentStatus::Charged),
"Payment should be in AuthenticationPending or Pending state"
);
// Wait a bit longer to ensure the payment is fully processed
tokio::time::sleep(tokio::time::Duration::from_secs(30)).await;
// 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_xendit_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": 350,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-6689475451466318163_375_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&response);
assert!(
response.status == i32::from(PaymentStatus::AuthenticationPending)
|| response.status == i32::from(PaymentStatus::Pending)
|| response.status == i32::from(PaymentStatus::Charged),
"Payment should be in AuthenticationPending 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": 375,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-6689475451466318163_375_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&response);
assert!(
response.status == i32::from(PaymentStatus::AuthenticationPending)
|| response.status == i32::from(PaymentStatus::Pending)
|| response.status == i32::from(PaymentStatus::Charged),
"Payment should be in AuthenticationPending or Pending state"
);
// Wait a bit longer to ensure the payment is fully processed
tokio::time::sleep(tokio::time::Duration::from_secs(30)).await;
// 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_xendit_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": 375,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-6689475451466318163_375_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&response);
assert!(
response.status == i32::from(PaymentStatus::AuthenticationPending)
|| response.status == i32::from(PaymentStatus::Pending)
|| response.status == i32::from(PaymentStatus::Charged),
"Payment should be in AuthenticationPending or Pending state"
);
// Wait a bit longer to ensure the payment is fully processed
tokio::time::sleep(tokio::time::Duration::from_secs(30)).await;
// 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_xendit_metadata(&mut refund_grpc_request);
// Send the refund request
let refund_response = client
.refund(refund_grpc_request)
.await
.expect("gRPC refund call failed")
.into_inner();
// Verify the refund response
assert!(
refund_response.status == i32::from(RefundStatus::RefundSuccess),
"Refund should be in RefundSuccess state"
);
});
}
// Test refund sync flow - runs as a separate test since refund + sync is complex
#[tokio::test]
#[ignore] // Service not implemented on server side - Status code: Unimplemented
async fn test_refund_sync() {
grpc_test!(client, PaymentServiceClient<Channel>, {
grpc_test!(refund_client, RefundServiceClient<Channel>, {
// Create the payment authorization request
let request = create_authorize_request(CaptureMethod::Automatic);
|
{
"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_-6689475451466318163_400_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
// Send the refund request
let refund_response = client
.refund(refund_grpc_request)
.await
.expect("gRPC refund call failed")
.into_inner();
// Verify the refund response
assert!(
refund_response.status == i32::from(RefundStatus::RefundSuccess),
"Refund should be in RefundSuccess 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": 400,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-6689475451466318163_400_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
// Send the refund request
let refund_response = client
.refund(refund_grpc_request)
.await
.expect("gRPC refund call failed")
.into_inner();
// Verify the refund response
assert!(
refund_response.status == i32::from(RefundStatus::RefundSuccess),
"Refund should be in RefundSuccess state"
);
});
}
// Test refund sync flow - runs as a separate test since refund + sync is complex
#[tokio::test]
#[ignore] // Service not implemented on server side - Status code: Unimplemented
async fn test_refund_sync() {
grpc_test!(client, PaymentServiceClient<Channel>, {
grpc_test!(refund_client, RefundServiceClient<Channel>, {
// Create the payment authorization request
let request = create_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_xendit_metadata(&mut grpc_request);
// Send the 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_-6689475451466318163_400_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
// Send the refund request
let refund_response = client
.refund(refund_grpc_request)
.await
.expect("gRPC refund call failed")
.into_inner();
// Verify the refund response
assert!(
refund_response.status == i32::from(RefundStatus::RefundSuccess),
"Refund should be in RefundSuccess state"
);
});
}
// Test refund sync flow - runs as a separate test since refund + sync is complex
#[tokio::test]
#[ignore] // Service not implemented on server side - Status code: Unimplemented
async fn test_refund_sync() {
grpc_test!(client, PaymentServiceClient<Channel>, {
grpc_test!(refund_client, RefundServiceClient<Channel>, {
// Create the payment authorization request
let request = create_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_xendit_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&response);
assert!(
response.status == i32::from(PaymentStatus::AuthenticationPending)
|| response.status == i32::from(PaymentStatus::Pending)
|| response.status == i32::from(PaymentStatus::Charged),
"Payment should be in AuthenticationPending or Pending state"
);
// Wait a bit longer to ensure the payment is fully processed
tokio::time::sleep(tokio::time::Duration::from_secs(15)).await;
// 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": 400,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-6689475451466318163_425_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
// Add metadata headers
let mut grpc_request = Request::new(request);
add_xendit_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&response);
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_-6689475451466318163_425_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
// Add metadata headers
let mut grpc_request = Request::new(request);
add_xendit_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&response);
assert!(
response.status == i32::from(PaymentStatus::AuthenticationPending)
|| response.status == i32::from(PaymentStatus::Pending)
|| response.status == i32::from(PaymentStatus::Charged),
"Payment should be in AuthenticationPending or Pending state"
);
// Wait a bit longer to ensure the payment is fully processed
tokio::time::sleep(tokio::time::Duration::from_secs(15)).await;
// 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_xendit_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": 425,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-6689475451466318163_425_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
// Add metadata headers
let mut grpc_request = Request::new(request);
add_xendit_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&response);
assert!(
response.status == i32::from(PaymentStatus::AuthenticationPending)
|| response.status == i32::from(PaymentStatus::Pending)
|| response.status == i32::from(PaymentStatus::Charged),
"Payment should be in AuthenticationPending or Pending state"
);
// Wait a bit longer to ensure the payment is fully processed
tokio::time::sleep(tokio::time::Duration::from_secs(15)).await;
// 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_xendit_metadata(&mut refund_grpc_request);
// Send the refund request
let refund_response = client
.refund(refund_grpc_request)
.await
.expect("gRPC refund call failed")
.into_inner();
// Verify the refund response
assert!(
refund_response.status == i32::from(RefundStatus::RefundSuccess),
"Refund should be in RefundSuccess state"
);
let refund_id = extract_refund_id(&refund_response);
// Wait a bit longer to ensure the refund is fully processed
tokio::time::sleep(tokio::time::Duration::from_secs(2)).await;
// Create 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": 425,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-6689475451466318163_450_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_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_xendit_metadata(&mut refund_grpc_request);
// Send the refund request
let refund_response = client
.refund(refund_grpc_request)
.await
.expect("gRPC refund call failed")
.into_inner();
// Verify the refund response
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": 450,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-6689475451466318163_450_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_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_xendit_metadata(&mut refund_grpc_request);
// Send the refund request
let refund_response = client
.refund(refund_grpc_request)
.await
.expect("gRPC refund call failed")
.into_inner();
// Verify the refund response
assert!(
refund_response.status == i32::from(RefundStatus::RefundSuccess),
"Refund should be in RefundSuccess state"
);
let refund_id = extract_refund_id(&refund_response);
// Wait a bit longer to ensure the refund is fully processed
tokio::time::sleep(tokio::time::Duration::from_secs(2)).await;
// Create refund sync request
let refund_sync_request = create_refund_sync_request(&transaction_id, refund_id);
// Add metadata headers for refund sync request
let mut refund_sync_grpc_request = Request::new(refund_sync_request);
add_xendit_metadata(&mut 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": 450,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-6689475451466318163_450_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_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_xendit_metadata(&mut refund_grpc_request);
// Send the refund request
let refund_response = client
.refund(refund_grpc_request)
.await
.expect("gRPC refund call failed")
.into_inner();
// Verify the refund response
assert!(
refund_response.status == i32::from(RefundStatus::RefundSuccess),
"Refund should be in RefundSuccess state"
);
let refund_id = extract_refund_id(&refund_response);
// Wait a bit longer to ensure the refund is fully processed
tokio::time::sleep(tokio::time::Duration::from_secs(2)).await;
// Create refund sync request
let refund_sync_request = create_refund_sync_request(&transaction_id, refund_id);
// Add metadata headers for refund sync request
let mut refund_sync_grpc_request = Request::new(refund_sync_request);
add_xendit_metadata(&mut refund_sync_grpc_request);
// Send the refund sync request
let refund_sync_response = refund_client
.get(refund_sync_grpc_request)
.await
.expect("gRPC refund sync call failed")
.into_inner();
// Verify the refund sync response
assert!(
refund_sync_response.status == i32::from(RefundStatus::RefundSuccess),
"Refund Sync should be in RefundSuccess 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": 46,
"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_-6689475451466318163_475_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
let refund_sync_request = create_refund_sync_request(&transaction_id, refund_id);
// Add metadata headers for refund sync request
let mut refund_sync_grpc_request = Request::new(refund_sync_request);
add_xendit_metadata(&mut refund_sync_grpc_request);
// Send the refund sync request
let refund_sync_response = refund_client
.get(refund_sync_grpc_request)
.await
.expect("gRPC refund sync call failed")
.into_inner();
// Verify the refund sync response
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_-6689475451466318163_475_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
let refund_sync_request = create_refund_sync_request(&transaction_id, refund_id);
// Add metadata headers for refund sync request
let mut refund_sync_grpc_request = Request::new(refund_sync_request);
add_xendit_metadata(&mut refund_sync_grpc_request);
// Send the refund sync request
let refund_sync_response = refund_client
.get(refund_sync_grpc_request)
.await
.expect("gRPC refund sync call failed")
.into_inner();
// Verify the refund sync response
assert!(
refund_sync_response.status == i32::from(RefundStatus::RefundSuccess),
"Refund Sync should be in RefundSuccess 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": 21,
"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_-6689475451466318163_475_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/xendit_payment_flows_test.rs
let refund_sync_request = create_refund_sync_request(&transaction_id, refund_id);
// Add metadata headers for refund sync request
let mut refund_sync_grpc_request = Request::new(refund_sync_request);
add_xendit_metadata(&mut refund_sync_grpc_request);
// Send the refund sync request
let refund_sync_response = refund_client
.get(refund_sync_grpc_request)
.await
.expect("gRPC refund sync call failed")
.into_inner();
// Verify the refund sync response
assert!(
refund_sync_response.status == i32::from(RefundStatus::RefundSuccess),
"Refund Sync should be in RefundSuccess 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": 21,
"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_-7945249832950166259_0_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
#![allow(clippy::expect_used)]
#![allow(clippy::unwrap_used)]
#![allow(clippy::panic)]
use grpc_server::{app, configs};
use hyperswitch_masking::{ExposeInterface, Secret};
mod common;
mod utils;
use std::time::{SystemTime, UNIX_EPOCH};
use grpc_api_types::{
health_check::{health_client::HealthClient, HealthCheckRequest},
payments::{
identifier::IdType, payment_method, payment_service_client::PaymentServiceClient,
|
{
"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_-7945249832950166259_0_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
#![allow(clippy::expect_used)]
#![allow(clippy::unwrap_used)]
#![allow(clippy::panic)]
use grpc_server::{app, configs};
use hyperswitch_masking::{ExposeInterface, Secret};
mod common;
mod utils;
use std::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, AuthenticationType, CaptureMethod, Currency, Identifier,
MifinityWallet, PaymentMethod, PaymentServiceAuthorizeRequest,
PaymentServiceAuthorizeResponse, PaymentServiceGetRequest, PaymentStatus,
WalletPaymentMethodType,
},
};
use tonic::{transport::Channel, Request};
// 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": 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_-7945249832950166259_0_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
#![allow(clippy::expect_used)]
#![allow(clippy::unwrap_used)]
#![allow(clippy::panic)]
use grpc_server::{app, configs};
use hyperswitch_masking::{ExposeInterface, Secret};
mod common;
mod utils;
use std::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, AuthenticationType, CaptureMethod, Currency, Identifier,
MifinityWallet, PaymentMethod, PaymentServiceAuthorizeRequest,
PaymentServiceAuthorizeResponse, PaymentServiceGetRequest, PaymentStatus,
WalletPaymentMethodType,
},
};
use tonic::{transport::Channel, Request};
// Helper function to get current timestamp
fn get_timestamp() -> u64 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs()
}
// Constants for Mifinity connector
const CONNECTOR_NAME: &str = "mifinity";
// Test card data
const TEST_AMOUNT: i64 = 1000;
const TEST_DESTINATION_ACCOUNT_NUMBER: &str = "5001000001223369"; // Valid test destination account number for Mifinity
const TEST_BRAND_ID: &str = "001";
const TEST_DATE_OF_BIRTH: &str = "2001-10-16";
const TEST_EMAIL: &str = "customer@example.com";
fn add_mifinity_metadata<T>(request: &mut Request<T>) {
let auth = utils::credential_utils::load_connector_auth(CONNECTOR_NAME)
.expect("Failed to load mifinity credentials");
let api_key = match auth {
domain_types::router_data::ConnectorAuthType::HeaderKey { api_key } => api_key.expose(),
_ => panic!("Expected HeaderKey auth type for mifinity"),
};
|
{
"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_-7945249832950166259_25_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs()
}
// Constants for Mifinity connector
const CONNECTOR_NAME: &str = "mifinity";
// Test card data
const TEST_AMOUNT: i64 = 1000;
const TEST_DESTINATION_ACCOUNT_NUMBER: &str = "5001000001223369"; // Valid test destination account number for Mifinity
const TEST_BRAND_ID: &str = "001";
const TEST_DATE_OF_BIRTH: &str = "2001-10-16";
const TEST_EMAIL: &str = "customer@example.com";
|
{
"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_-7945249832950166259_25_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs()
}
// Constants for Mifinity connector
const CONNECTOR_NAME: &str = "mifinity";
// Test card data
const TEST_AMOUNT: i64 = 1000;
const TEST_DESTINATION_ACCOUNT_NUMBER: &str = "5001000001223369"; // Valid test destination account number for Mifinity
const TEST_BRAND_ID: &str = "001";
const TEST_DATE_OF_BIRTH: &str = "2001-10-16";
const TEST_EMAIL: &str = "customer@example.com";
fn add_mifinity_metadata<T>(request: &mut Request<T>) {
let auth = utils::credential_utils::load_connector_auth(CONNECTOR_NAME)
.expect("Failed to load mifinity credentials");
let api_key = match auth {
domain_types::router_data::ConnectorAuthType::HeaderKey { api_key } => api_key.expose(),
_ => panic!("Expected HeaderKey auth type for mifinity"),
};
request.metadata_mut().append(
"x-connector",
CONNECTOR_NAME.parse().expect("Failed to parse x-connector"),
);
request.metadata_mut().append(
|
{
"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_-7945249832950166259_25_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs()
}
// Constants for Mifinity connector
const CONNECTOR_NAME: &str = "mifinity";
// Test card data
const TEST_AMOUNT: i64 = 1000;
const TEST_DESTINATION_ACCOUNT_NUMBER: &str = "5001000001223369"; // Valid test destination account number for Mifinity
const TEST_BRAND_ID: &str = "001";
const TEST_DATE_OF_BIRTH: &str = "2001-10-16";
const TEST_EMAIL: &str = "customer@example.com";
fn add_mifinity_metadata<T>(request: &mut Request<T>) {
let auth = utils::credential_utils::load_connector_auth(CONNECTOR_NAME)
.expect("Failed to load mifinity credentials");
let api_key = match auth {
domain_types::router_data::ConnectorAuthType::HeaderKey { api_key } => api_key.expose(),
_ => panic!("Expected HeaderKey auth type for mifinity"),
};
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 merchant ID which is required by the server
request.metadata_mut().append(
"x-merchant-id",
"12abc123-f8a3-99b8-9ef8-b31180358hh4"
.parse()
.expect("Failed to parse x-merchant-id"),
);
// Add tenant ID which is required by the server
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
|
{
"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_-7945249832950166259_50_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
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 merchant ID which is required by the server
request.metadata_mut().append(
"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": 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_-7945249832950166259_50_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
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 merchant ID which is required by the server
request.metadata_mut().append(
"x-merchant-id",
"12abc123-f8a3-99b8-9ef8-b31180358hh4"
.parse()
.expect("Failed to parse x-merchant-id"),
);
// Add tenant ID which is required by the server
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"),
|
{
"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_-7945249832950166259_50_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
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 merchant ID which is required by the server
request.metadata_mut().append(
"x-merchant-id",
"12abc123-f8a3-99b8-9ef8-b31180358hh4"
.parse()
.expect("Failed to parse x-merchant-id"),
);
// Add tenant ID which is required by the server
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"),
);
}
// 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 create a payment authorize request
fn create_authorize_request(capture_method: CaptureMethod) -> PaymentServiceAuthorizeRequest {
let wallet_details = wallet_payment_method_type::WalletType::Mifinity(MifinityWallet {
date_of_birth: Some(Secret::new(TEST_DATE_OF_BIRTH.to_string())),
language_preference: Some("en-US".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": 50,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-7945249832950166259_75_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
request.metadata_mut().append(
"x-request-id",
format!("mifinity_req_{}", get_timestamp())
.parse()
.expect("Failed to parse x-request-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"),
},
|
{
"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_-7945249832950166259_75_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
request.metadata_mut().append(
"x-request-id",
format!("mifinity_req_{}", get_timestamp())
.parse()
.expect("Failed to parse x-request-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 create a payment authorize request
fn create_authorize_request(capture_method: CaptureMethod) -> PaymentServiceAuthorizeRequest {
let wallet_details = wallet_payment_method_type::WalletType::Mifinity(MifinityWallet {
date_of_birth: Some(Secret::new(TEST_DATE_OF_BIRTH.to_string())),
language_preference: Some("en-US".to_string()),
});
// Create connector metadata JSON string
let connector_meta_data = format!(
"{{\"brand_id\":\"{TEST_BRAND_ID}\",\"destination_account_number\":\"{TEST_DESTINATION_ACCOUNT_NUMBER}\"}}"
);
|
{
"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_-7945249832950166259_75_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
request.metadata_mut().append(
"x-request-id",
format!("mifinity_req_{}", get_timestamp())
.parse()
.expect("Failed to parse x-request-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 create a payment authorize request
fn create_authorize_request(capture_method: CaptureMethod) -> PaymentServiceAuthorizeRequest {
let wallet_details = wallet_payment_method_type::WalletType::Mifinity(MifinityWallet {
date_of_birth: Some(Secret::new(TEST_DATE_OF_BIRTH.to_string())),
language_preference: Some("en-US".to_string()),
});
// Create connector metadata JSON string
let connector_meta_data = format!(
"{{\"brand_id\":\"{TEST_BRAND_ID}\",\"destination_account_number\":\"{TEST_DESTINATION_ACCOUNT_NUMBER}\"}}"
);
PaymentServiceAuthorizeRequest {
amount: TEST_AMOUNT,
minor_amount: TEST_AMOUNT,
currency: i32::from(Currency::Eur),
payment_method: Some(PaymentMethod {
payment_method: Some(payment_method::PaymentMethod::Wallet(
WalletPaymentMethodType {
wallet_type: Some(wallet_details),
},
)),
}),
return_url: Some(
"https://hyperswitch.io/connector-service/authnet_webhook_grpcurl".to_string(),
),
email: Some(TEST_EMAIL.to_string().into()),
address: Some(grpc_api_types::payments::PaymentAddress {
shipping_address: Some(grpc_api_types::payments::Address::default()),
billing_address: Some(grpc_api_types::payments::Address {
first_name: Some("joseph".to_string().into()),
|
{
"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_-7945249832950166259_100_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
// Create connector metadata JSON string
let connector_meta_data = format!(
"{{\"brand_id\":\"{TEST_BRAND_ID}\",\"destination_account_number\":\"{TEST_DESTINATION_ACCOUNT_NUMBER}\"}}"
);
PaymentServiceAuthorizeRequest {
amount: TEST_AMOUNT,
minor_amount: TEST_AMOUNT,
currency: i32::from(Currency::Eur),
payment_method: Some(PaymentMethod {
payment_method: Some(payment_method::PaymentMethod::Wallet(
WalletPaymentMethodType {
wallet_type: Some(wallet_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": 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_-7945249832950166259_100_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
// Create connector metadata JSON string
let connector_meta_data = format!(
"{{\"brand_id\":\"{TEST_BRAND_ID}\",\"destination_account_number\":\"{TEST_DESTINATION_ACCOUNT_NUMBER}\"}}"
);
PaymentServiceAuthorizeRequest {
amount: TEST_AMOUNT,
minor_amount: TEST_AMOUNT,
currency: i32::from(Currency::Eur),
payment_method: Some(PaymentMethod {
payment_method: Some(payment_method::PaymentMethod::Wallet(
WalletPaymentMethodType {
wallet_type: Some(wallet_details),
},
)),
}),
return_url: Some(
"https://hyperswitch.io/connector-service/authnet_webhook_grpcurl".to_string(),
),
email: Some(TEST_EMAIL.to_string().into()),
address: Some(grpc_api_types::payments::PaymentAddress {
shipping_address: Some(grpc_api_types::payments::Address::default()),
billing_address: Some(grpc_api_types::payments::Address {
first_name: Some("joseph".to_string().into()),
last_name: Some("Doe".to_string().into()),
phone_number: Some("8056594427".to_string().into()),
phone_country_code: Some("+91".to_string()),
email: Some("swangi@gmail.com".to_string().into()),
line1: Some("1467".to_string().into()),
|
{
"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_-7945249832950166259_100_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
// Create connector metadata JSON string
let connector_meta_data = format!(
"{{\"brand_id\":\"{TEST_BRAND_ID}\",\"destination_account_number\":\"{TEST_DESTINATION_ACCOUNT_NUMBER}\"}}"
);
PaymentServiceAuthorizeRequest {
amount: TEST_AMOUNT,
minor_amount: TEST_AMOUNT,
currency: i32::from(Currency::Eur),
payment_method: Some(PaymentMethod {
payment_method: Some(payment_method::PaymentMethod::Wallet(
WalletPaymentMethodType {
wallet_type: Some(wallet_details),
},
)),
}),
return_url: Some(
"https://hyperswitch.io/connector-service/authnet_webhook_grpcurl".to_string(),
),
email: Some(TEST_EMAIL.to_string().into()),
address: Some(grpc_api_types::payments::PaymentAddress {
shipping_address: Some(grpc_api_types::payments::Address::default()),
billing_address: Some(grpc_api_types::payments::Address {
first_name: Some("joseph".to_string().into()),
last_name: Some("Doe".to_string().into()),
phone_number: Some("8056594427".to_string().into()),
phone_country_code: Some("+91".to_string()),
email: Some("swangi@gmail.com".to_string().into()),
line1: Some("1467".to_string().into()),
line2: Some("Harrison Street".to_string().into()),
line3: Some("Harrison Street".to_string().into()),
city: Some("San Fransico".to_string().into()),
state: Some("California".to_string().into()),
zip_code: Some("94122".to_string().into()),
country_alpha2_code: Some(grpc_api_types::payments::CountryAlpha2::De.into()),
}),
}),
auth_type: i32::from(AuthenticationType::NoThreeDs),
request_ref_id: Some(Identifier {
id_type: Some(IdType::Id(format!("mifinity_test_{}", get_timestamp()))),
}),
customer_id: Some("Test_customer".to_string()),
enrolled_for_3ds: false,
request_incremental_authorization: false,
capture_method: Some(i32::from(capture_method)),
metadata: {
let mut metadata = std::collections::HashMap::new();
metadata.insert("connector_meta_data".to_string(), connector_meta_data);
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": 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_-7945249832950166259_125_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
last_name: Some("Doe".to_string().into()),
phone_number: Some("8056594427".to_string().into()),
phone_country_code: Some("+91".to_string()),
email: Some("swangi@gmail.com".to_string().into()),
line1: Some("1467".to_string().into()),
line2: Some("Harrison Street".to_string().into()),
line3: Some("Harrison Street".to_string().into()),
city: Some("San Fransico".to_string().into()),
state: Some("California".to_string().into()),
zip_code: Some("94122".to_string().into()),
country_alpha2_code: Some(grpc_api_types::payments::CountryAlpha2::De.into()),
}),
}),
auth_type: i32::from(AuthenticationType::NoThreeDs),
request_ref_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": 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_-7945249832950166259_125_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
last_name: Some("Doe".to_string().into()),
phone_number: Some("8056594427".to_string().into()),
phone_country_code: Some("+91".to_string()),
email: Some("swangi@gmail.com".to_string().into()),
line1: Some("1467".to_string().into()),
line2: Some("Harrison Street".to_string().into()),
line3: Some("Harrison Street".to_string().into()),
city: Some("San Fransico".to_string().into()),
state: Some("California".to_string().into()),
zip_code: Some("94122".to_string().into()),
country_alpha2_code: Some(grpc_api_types::payments::CountryAlpha2::De.into()),
}),
}),
auth_type: i32::from(AuthenticationType::NoThreeDs),
request_ref_id: Some(Identifier {
id_type: Some(IdType::Id(format!("mifinity_test_{}", get_timestamp()))),
}),
customer_id: Some("Test_customer".to_string()),
enrolled_for_3ds: false,
request_incremental_authorization: false,
capture_method: Some(i32::from(capture_method)),
metadata: {
let mut metadata = std::collections::HashMap::new();
metadata.insert("connector_meta_data".to_string(), connector_meta_data);
metadata
},
// payment_method_type: Some(i32::from(PaymentMethodType::Credit)),
..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": 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_-7945249832950166259_125_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
last_name: Some("Doe".to_string().into()),
phone_number: Some("8056594427".to_string().into()),
phone_country_code: Some("+91".to_string()),
email: Some("swangi@gmail.com".to_string().into()),
line1: Some("1467".to_string().into()),
line2: Some("Harrison Street".to_string().into()),
line3: Some("Harrison Street".to_string().into()),
city: Some("San Fransico".to_string().into()),
state: Some("California".to_string().into()),
zip_code: Some("94122".to_string().into()),
country_alpha2_code: Some(grpc_api_types::payments::CountryAlpha2::De.into()),
}),
}),
auth_type: i32::from(AuthenticationType::NoThreeDs),
request_ref_id: Some(Identifier {
id_type: Some(IdType::Id(format!("mifinity_test_{}", get_timestamp()))),
}),
customer_id: Some("Test_customer".to_string()),
enrolled_for_3ds: false,
request_incremental_authorization: false,
capture_method: Some(i32::from(capture_method)),
metadata: {
let mut metadata = std::collections::HashMap::new();
metadata.insert("connector_meta_data".to_string(), connector_meta_data);
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) -> 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(transaction_id.to_string())),
}),
capture_method: None,
handle_response: None,
amount: TEST_AMOUNT,
currency: i32::from(Currency::Eur),
state: None,
}
}
// Test for basic health check
#[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": 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_-7945249832950166259_150_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
},
// 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) -> 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(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": 150,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-7945249832950166259_150_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
},
// 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) -> 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(transaction_id.to_string())),
}),
capture_method: None,
handle_response: None,
amount: TEST_AMOUNT,
currency: i32::from(Currency::Eur),
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": 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_-7945249832950166259_150_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
},
// 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) -> 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(transaction_id.to_string())),
}),
capture_method: None,
handle_response: None,
amount: TEST_AMOUNT,
currency: i32::from(Currency::Eur),
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_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
|
{
"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_-7945249832950166259_175_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
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
);
});
|
{
"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_-7945249832950166259_175_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
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_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_mifinity_metadata(&mut grpc_request);
// Send the request
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": 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_-7945249832950166259_175_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
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_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_mifinity_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
assert!(
response.status == i32::from(PaymentStatus::AuthenticationPending)
|| response.status == i32::from(PaymentStatus::Pending),
"Payment should be in AuthenticationPending or Pending state"
);
});
}
// Test payment sync with auto capture
#[tokio::test]
async fn test_payment_sync_auto_capture() {
grpc_test!(client, PaymentServiceClient<Channel>, {
// Add delay of 2 seconds
tokio::time::sleep(std::time::Duration::from_secs(2)).await;
// Create the payment authorization 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": 175,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-7945249832950166259_200_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
let mut grpc_request = Request::new(request);
add_mifinity_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
assert!(
response.status == i32::from(PaymentStatus::AuthenticationPending)
|| response.status == i32::from(PaymentStatus::Pending),
"Payment should be in AuthenticationPending 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": 200,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-7945249832950166259_200_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
let mut grpc_request = Request::new(request);
add_mifinity_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
assert!(
response.status == i32::from(PaymentStatus::AuthenticationPending)
|| response.status == i32::from(PaymentStatus::Pending),
"Payment should be in AuthenticationPending or Pending state"
);
});
}
// Test payment sync with auto capture
#[tokio::test]
async fn test_payment_sync_auto_capture() {
grpc_test!(client, PaymentServiceClient<Channel>, {
// Add delay of 2 seconds
tokio::time::sleep(std::time::Duration::from_secs(2)).await;
// Create the payment authorization request
let request = create_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_mifinity_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": 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_-7945249832950166259_200_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
let mut grpc_request = Request::new(request);
add_mifinity_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
assert!(
response.status == i32::from(PaymentStatus::AuthenticationPending)
|| response.status == i32::from(PaymentStatus::Pending),
"Payment should be in AuthenticationPending or Pending state"
);
});
}
// Test payment sync with auto capture
#[tokio::test]
async fn test_payment_sync_auto_capture() {
grpc_test!(client, PaymentServiceClient<Channel>, {
// Add delay of 2 seconds
tokio::time::sleep(std::time::Duration::from_secs(2)).await;
// Create the payment authorization request
let request = create_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_mifinity_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&response);
// Create sync request
let sync_request = create_payment_sync_request(&transaction_id);
// Add metadata headers for sync request
let mut sync_grpc_request = Request::new(sync_request);
add_mifinity_metadata(&mut sync_grpc_request);
// Send the sync request
let sync_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": 200,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-7945249832950166259_225_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
let request = create_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_mifinity_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&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": 225,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-7945249832950166259_225_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
let request = create_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_mifinity_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&response);
// Create sync request
let sync_request = create_payment_sync_request(&transaction_id);
// Add metadata headers for sync request
let mut sync_grpc_request = Request::new(sync_request);
add_mifinity_metadata(&mut sync_grpc_request);
// Send the sync request
let sync_response = client
.get(sync_grpc_request)
.await
.expect("gRPC payment_sync 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": 225,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-7945249832950166259_225_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
let request = create_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_mifinity_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&response);
// Create sync request
let sync_request = create_payment_sync_request(&transaction_id);
// Add metadata headers for sync request
let mut sync_grpc_request = Request::new(sync_request);
add_mifinity_metadata(&mut sync_grpc_request);
// Send the sync request
let sync_response = client
.get(sync_grpc_request)
.await
.expect("gRPC payment_sync call failed")
.into_inner();
// Verify the sync response
assert!(
sync_response.status == i32::from(PaymentStatus::AuthenticationPending)
|| sync_response.status == i32::from(PaymentStatus::Charged),
"Payment should be in AuthenticationPending or Charged 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": 38,
"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_-7945249832950166259_250_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
.get(sync_grpc_request)
.await
.expect("gRPC payment_sync call failed")
.into_inner();
// Verify the sync response
assert!(
sync_response.status == i32::from(PaymentStatus::AuthenticationPending)
|| sync_response.status == i32::from(PaymentStatus::Charged),
"Payment should be in AuthenticationPending or Charged 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": 13,
"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_-7945249832950166259_250_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
.get(sync_grpc_request)
.await
.expect("gRPC payment_sync call failed")
.into_inner();
// Verify the sync response
assert!(
sync_response.status == i32::from(PaymentStatus::AuthenticationPending)
|| sync_response.status == i32::from(PaymentStatus::Charged),
"Payment should be in AuthenticationPending or Charged 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": 13,
"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_-7945249832950166259_250_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/mifinity_payment_flows_test.rs
.get(sync_grpc_request)
.await
.expect("gRPC payment_sync call failed")
.into_inner();
// Verify the sync response
assert!(
sync_response.status == i32::from(PaymentStatus::AuthenticationPending)
|| sync_response.status == i32::from(PaymentStatus::Charged),
"Payment should be in AuthenticationPending or Charged 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": 13,
"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_-8438814131594319128_0_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_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::{
str::FromStr,
time::{SystemTime, UNIX_EPOCH},
};
use cards::CardNumber;
use grpc_api_types::{
|
{
"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_-8438814131594319128_0_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_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::{
str::FromStr,
time::{SystemTime, UNIX_EPOCH},
};
use cards::CardNumber;
use grpc_api_types::{
health_check::{health_client::HealthClient, HealthCheckRequest},
payments::{
card_payment_method_type, identifier::IdType, payment_method,
payment_service_client::PaymentServiceClient, refund_service_client::RefundServiceClient,
AuthenticationType, CaptureMethod, CardDetails, CardPaymentMethodType, Currency,
Identifier, PaymentMethod, PaymentServiceAuthorizeRequest, PaymentServiceAuthorizeResponse,
PaymentServiceCaptureRequest, PaymentServiceGetRequest, PaymentServiceRefundRequest,
PaymentServiceVoidRequest, PaymentStatus, RefundResponse, RefundServiceGetRequest,
RefundStatus,
},
};
use hyperswitch_masking::{ExposeInterface, Secret};
use tonic::{transport::Channel, Request};
use uuid::Uuid;
|
{
"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_-8438814131594319128_0_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_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::{
str::FromStr,
time::{SystemTime, UNIX_EPOCH},
};
use cards::CardNumber;
use grpc_api_types::{
health_check::{health_client::HealthClient, HealthCheckRequest},
payments::{
card_payment_method_type, identifier::IdType, payment_method,
payment_service_client::PaymentServiceClient, refund_service_client::RefundServiceClient,
AuthenticationType, CaptureMethod, CardDetails, CardPaymentMethodType, Currency,
Identifier, PaymentMethod, PaymentServiceAuthorizeRequest, PaymentServiceAuthorizeResponse,
PaymentServiceCaptureRequest, PaymentServiceGetRequest, PaymentServiceRefundRequest,
PaymentServiceVoidRequest, PaymentStatus, RefundResponse, RefundServiceGetRequest,
RefundStatus,
},
};
use hyperswitch_masking::{ExposeInterface, Secret};
use tonic::{transport::Channel, Request};
use uuid::Uuid;
// Helper function to get current timestamp
fn get_timestamp() -> u64 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs()
}
// Helper function to generate a unique ID using UUID
fn generate_unique_id(prefix: &str) -> String {
format!("{}_{}", prefix, Uuid::new_v4())
}
// Constants for Fiuu connector
const CONNECTOR_NAME: &str = "fiuu";
const AUTH_TYPE: &str = "signature-key";
const MERCHANT_ID: &str = "merchant_1234";
// Test card data
const TEST_AMOUNT: i64 = 1000;
|
{
"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_-8438814131594319128_25_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
};
use hyperswitch_masking::{ExposeInterface, Secret};
use tonic::{transport::Channel, Request};
use uuid::Uuid;
// Helper function to get current timestamp
fn get_timestamp() -> u64 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs()
}
// Helper function to generate a unique ID using UUID
fn generate_unique_id(prefix: &str) -> 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": 25,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8438814131594319128_25_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
};
use hyperswitch_masking::{ExposeInterface, Secret};
use tonic::{transport::Channel, Request};
use uuid::Uuid;
// Helper function to get current timestamp
fn get_timestamp() -> u64 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs()
}
// Helper function to generate a unique ID using UUID
fn generate_unique_id(prefix: &str) -> String {
format!("{}_{}", prefix, Uuid::new_v4())
}
// Constants for Fiuu connector
const CONNECTOR_NAME: &str = "fiuu";
const AUTH_TYPE: &str = "signature-key";
const MERCHANT_ID: &str = "merchant_1234";
// Test card data
const TEST_AMOUNT: i64 = 1000;
const TEST_CARD_NUMBER: &str = "4111111111111111"; // Valid test card for Fiuu
const TEST_CARD_EXP_MONTH: &str = "12";
const TEST_CARD_EXP_YEAR: &str = "2025";
const TEST_CARD_CVC: &str = "123";
const TEST_CARD_HOLDER: &str = "Test User";
|
{
"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_-8438814131594319128_25_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
};
use hyperswitch_masking::{ExposeInterface, Secret};
use tonic::{transport::Channel, Request};
use uuid::Uuid;
// Helper function to get current timestamp
fn get_timestamp() -> u64 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs()
}
// Helper function to generate a unique ID using UUID
fn generate_unique_id(prefix: &str) -> String {
format!("{}_{}", prefix, Uuid::new_v4())
}
// Constants for Fiuu connector
const CONNECTOR_NAME: &str = "fiuu";
const AUTH_TYPE: &str = "signature-key";
const MERCHANT_ID: &str = "merchant_1234";
// Test card data
const TEST_AMOUNT: i64 = 1000;
const TEST_CARD_NUMBER: &str = "4111111111111111"; // Valid test card for Fiuu
const TEST_CARD_EXP_MONTH: &str = "12";
const TEST_CARD_EXP_YEAR: &str = "2025";
const TEST_CARD_CVC: &str = "123";
const TEST_CARD_HOLDER: &str = "Test User";
const TEST_EMAIL: &str = "customer@example.com";
fn add_fiuu_metadata<T>(request: &mut Request<T>) {
let auth = utils::credential_utils::load_connector_auth(CONNECTOR_NAME)
.expect("Failed to load fiuu credentials");
let (api_key, key1, api_secret) = match auth {
domain_types::router_data::ConnectorAuthType::SignatureKey {
api_key,
key1,
api_secret,
} => (api_key.expose(), key1.expose(), api_secret.expose()),
_ => panic!("Expected SignatureKey auth type for fiuu"),
};
request.metadata_mut().append(
"x-connector",
CONNECTOR_NAME.parse().expect("Failed to parse x-connector"),
);
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": 25,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8438814131594319128_50_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
const TEST_CARD_NUMBER: &str = "4111111111111111"; // Valid test card for Fiuu
const TEST_CARD_EXP_MONTH: &str = "12";
const TEST_CARD_EXP_YEAR: &str = "2025";
const TEST_CARD_CVC: &str = "123";
const TEST_CARD_HOLDER: &str = "Test User";
const TEST_EMAIL: &str = "customer@example.com";
fn add_fiuu_metadata<T>(request: &mut Request<T>) {
let auth = utils::credential_utils::load_connector_auth(CONNECTOR_NAME)
.expect("Failed to load fiuu credentials");
let (api_key, key1, api_secret) = match auth {
domain_types::router_data::ConnectorAuthType::SignatureKey {
api_key,
key1,
|
{
"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_-8438814131594319128_50_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
const TEST_CARD_NUMBER: &str = "4111111111111111"; // Valid test card for Fiuu
const TEST_CARD_EXP_MONTH: &str = "12";
const TEST_CARD_EXP_YEAR: &str = "2025";
const TEST_CARD_CVC: &str = "123";
const TEST_CARD_HOLDER: &str = "Test User";
const TEST_EMAIL: &str = "customer@example.com";
fn add_fiuu_metadata<T>(request: &mut Request<T>) {
let auth = utils::credential_utils::load_connector_auth(CONNECTOR_NAME)
.expect("Failed to load fiuu credentials");
let (api_key, key1, api_secret) = match auth {
domain_types::router_data::ConnectorAuthType::SignatureKey {
api_key,
key1,
api_secret,
} => (api_key.expose(), key1.expose(), api_secret.expose()),
_ => panic!("Expected SignatureKey auth type for fiuu"),
};
request.metadata_mut().append(
"x-connector",
CONNECTOR_NAME.parse().expect("Failed to parse x-connector"),
);
request
.metadata_mut()
.append("x-auth", AUTH_TYPE.parse().expect("Failed to parse x-auth"));
request.metadata_mut().append(
"x-api-key",
api_key.parse().expect("Failed to parse x-api-key"),
|
{
"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_-8438814131594319128_50_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
const TEST_CARD_NUMBER: &str = "4111111111111111"; // Valid test card for Fiuu
const TEST_CARD_EXP_MONTH: &str = "12";
const TEST_CARD_EXP_YEAR: &str = "2025";
const TEST_CARD_CVC: &str = "123";
const TEST_CARD_HOLDER: &str = "Test User";
const TEST_EMAIL: &str = "customer@example.com";
fn add_fiuu_metadata<T>(request: &mut Request<T>) {
let auth = utils::credential_utils::load_connector_auth(CONNECTOR_NAME)
.expect("Failed to load fiuu credentials");
let (api_key, key1, api_secret) = match auth {
domain_types::router_data::ConnectorAuthType::SignatureKey {
api_key,
key1,
api_secret,
} => (api_key.expose(), key1.expose(), api_secret.expose()),
_ => panic!("Expected SignatureKey auth type for fiuu"),
};
request.metadata_mut().append(
"x-connector",
CONNECTOR_NAME.parse().expect("Failed to parse x-connector"),
);
request
.metadata_mut()
.append("x-auth", AUTH_TYPE.parse().expect("Failed to parse x-auth"));
request.metadata_mut().append(
"x-api-key",
api_key.parse().expect("Failed to parse x-api-key"),
);
request
.metadata_mut()
.append("x-key1", key1.parse().expect("Failed to parse x-key1"));
request.metadata_mut().append(
"x-api-secret",
api_secret.parse().expect("Failed to parse x-api-secret"),
);
request.metadata_mut().append(
"x-merchant-id",
MERCHANT_ID.parse().expect("Failed to parse x-merchant-id"),
);
request.metadata_mut().append(
"x-request-id",
format!("test_request_{}", get_timestamp())
.parse()
.expect("Failed to parse x-request-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_-8438814131594319128_75_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
.metadata_mut()
.append("x-auth", AUTH_TYPE.parse().expect("Failed to parse x-auth"));
request.metadata_mut().append(
"x-api-key",
api_key.parse().expect("Failed to parse x-api-key"),
);
request
.metadata_mut()
.append("x-key1", key1.parse().expect("Failed to parse x-key1"));
request.metadata_mut().append(
"x-api-secret",
api_secret.parse().expect("Failed to parse x-api-secret"),
);
request.metadata_mut().append(
"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": 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_-8438814131594319128_75_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
.metadata_mut()
.append("x-auth", AUTH_TYPE.parse().expect("Failed to parse x-auth"));
request.metadata_mut().append(
"x-api-key",
api_key.parse().expect("Failed to parse x-api-key"),
);
request
.metadata_mut()
.append("x-key1", key1.parse().expect("Failed to parse x-key1"));
request.metadata_mut().append(
"x-api-secret",
api_secret.parse().expect("Failed to parse x-api-secret"),
);
request.metadata_mut().append(
"x-merchant-id",
MERCHANT_ID.parse().expect("Failed to parse x-merchant-id"),
);
request.metadata_mut().append(
"x-request-id",
format!("test_request_{}", get_timestamp())
.parse()
.expect("Failed to parse x-request-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(),
|
{
"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_-8438814131594319128_75_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
.metadata_mut()
.append("x-auth", AUTH_TYPE.parse().expect("Failed to parse x-auth"));
request.metadata_mut().append(
"x-api-key",
api_key.parse().expect("Failed to parse x-api-key"),
);
request
.metadata_mut()
.append("x-key1", key1.parse().expect("Failed to parse x-key1"));
request.metadata_mut().append(
"x-api-secret",
api_secret.parse().expect("Failed to parse x-api-secret"),
);
request.metadata_mut().append(
"x-merchant-id",
MERCHANT_ID.parse().expect("Failed to parse x-merchant-id"),
);
request.metadata_mut().append(
"x-request-id",
format!("test_request_{}", get_timestamp())
.parse()
.expect("Failed to parse x-request-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 extract connector Refund ID from response
fn extract_refund_id(response: &RefundResponse) -> &String {
&response.refund_id
}
// Helper function to create a payment authorize request
fn create_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_issuer: 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": 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_-8438814131594319128_100_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_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 extract connector Refund ID from response
fn extract_refund_id(response: &RefundResponse) -> &String {
&response.refund_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": 100,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8438814131594319128_100_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_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 extract connector Refund ID from response
fn extract_refund_id(response: &RefundResponse) -> &String {
&response.refund_id
}
// Helper function to create a payment authorize request
fn create_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_issuer: None,
card_network: Some(1),
card_type: None,
card_issuing_country_alpha2: None,
bank_code: None,
nick_name: 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": 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_-8438814131594319128_100_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_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 extract connector Refund ID from response
fn extract_refund_id(response: &RefundResponse) -> &String {
&response.refund_id
}
// Helper function to create a payment authorize request
fn create_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_issuer: None,
card_network: Some(1),
card_type: None,
card_issuing_country_alpha2: None,
bank_code: None,
nick_name: None,
});
PaymentServiceAuthorizeRequest {
amount: TEST_AMOUNT,
minor_amount: TEST_AMOUNT,
currency: i32::from(Currency::Myr),
payment_method: Some(PaymentMethod {
payment_method: Some(payment_method::PaymentMethod::Card(CardPaymentMethodType {
card_type: Some(card_details),
})),
}),
return_url: Some(
"https://hyperswitch.io/connector-service/authnet_webhook_grpcurl".to_string(),
),
webhook_url: Some(
"https://hyperswitch.io/connector-service/authnet_webhook_grpcurl".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 {
|
{
"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_-8438814131594319128_125_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
card_network: Some(1),
card_type: None,
card_issuing_country_alpha2: None,
bank_code: None,
nick_name: None,
});
PaymentServiceAuthorizeRequest {
amount: TEST_AMOUNT,
minor_amount: TEST_AMOUNT,
currency: i32::from(Currency::Myr),
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": 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_-8438814131594319128_125_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
card_network: Some(1),
card_type: None,
card_issuing_country_alpha2: None,
bank_code: None,
nick_name: None,
});
PaymentServiceAuthorizeRequest {
amount: TEST_AMOUNT,
minor_amount: TEST_AMOUNT,
currency: i32::from(Currency::Myr),
payment_method: Some(PaymentMethod {
payment_method: Some(payment_method::PaymentMethod::Card(CardPaymentMethodType {
card_type: Some(card_details),
})),
}),
return_url: Some(
"https://hyperswitch.io/connector-service/authnet_webhook_grpcurl".to_string(),
),
webhook_url: Some(
"https://hyperswitch.io/connector-service/authnet_webhook_grpcurl".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(generate_unique_id("fiuu_test"))),
}),
enrolled_for_3ds: false,
request_incremental_authorization: false,
capture_method: Some(i32::from(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_-8438814131594319128_125_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
card_network: Some(1),
card_type: None,
card_issuing_country_alpha2: None,
bank_code: None,
nick_name: None,
});
PaymentServiceAuthorizeRequest {
amount: TEST_AMOUNT,
minor_amount: TEST_AMOUNT,
currency: i32::from(Currency::Myr),
payment_method: Some(PaymentMethod {
payment_method: Some(payment_method::PaymentMethod::Card(CardPaymentMethodType {
card_type: Some(card_details),
})),
}),
return_url: Some(
"https://hyperswitch.io/connector-service/authnet_webhook_grpcurl".to_string(),
),
webhook_url: Some(
"https://hyperswitch.io/connector-service/authnet_webhook_grpcurl".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(generate_unique_id("fiuu_test"))),
}),
enrolled_for_3ds: false,
request_incremental_authorization: false,
capture_method: Some(i32::from(capture_method)),
// 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) -> 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(generate_unique_id("fiuu_sync"))),
}),
capture_method: None,
handle_response: None,
amount: TEST_AMOUNT,
currency: i32::from(Currency::Myr),
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": 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_-8438814131594319128_150_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
id_type: Some(IdType::Id(generate_unique_id("fiuu_test"))),
}),
enrolled_for_3ds: false,
request_incremental_authorization: false,
capture_method: Some(i32::from(capture_method)),
// 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) -> PaymentServiceGetRequest {
PaymentServiceGetRequest {
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": 150,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8438814131594319128_150_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
id_type: Some(IdType::Id(generate_unique_id("fiuu_test"))),
}),
enrolled_for_3ds: false,
request_incremental_authorization: false,
capture_method: Some(i32::from(capture_method)),
// 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) -> 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(generate_unique_id("fiuu_sync"))),
}),
capture_method: None,
handle_response: None,
amount: TEST_AMOUNT,
currency: i32::from(Currency::Myr),
state: None,
}
}
// Helper function to create a payment capture request
fn create_payment_capture_request(transaction_id: &str) -> PaymentServiceCaptureRequest {
PaymentServiceCaptureRequest {
|
{
"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_-8438814131594319128_150_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
id_type: Some(IdType::Id(generate_unique_id("fiuu_test"))),
}),
enrolled_for_3ds: false,
request_incremental_authorization: false,
capture_method: Some(i32::from(capture_method)),
// 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) -> 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(generate_unique_id("fiuu_sync"))),
}),
capture_method: None,
handle_response: None,
amount: TEST_AMOUNT,
currency: i32::from(Currency::Myr),
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::Myr),
multiple_capture_data: None,
request_ref_id: None,
..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(generate_unique_id("fiuu_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": 150,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8438814131594319128_175_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
}
// 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::Myr),
multiple_capture_data: 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": 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_-8438814131594319128_175_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
}
// 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::Myr),
multiple_capture_data: None,
request_ref_id: None,
..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(generate_unique_id("fiuu_void"))),
}),
all_keys_required: None,
browser_info: None,
amount: None,
currency: 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": 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_-8438814131594319128_175_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
}
// 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::Myr),
multiple_capture_data: None,
request_ref_id: None,
..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(generate_unique_id("fiuu_void"))),
}),
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_{}", generate_unique_id("test")),
transaction_id: Some(Identifier {
id_type: Some(IdType::Id(transaction_id.to_string())),
}),
currency: i32::from(Currency::Myr),
payment_amount: TEST_AMOUNT,
refund_amount: TEST_AMOUNT,
minor_payment_amount: TEST_AMOUNT,
minor_refund_amount: TEST_AMOUNT,
reason: None,
browser_info: None,
merchant_account_id: None,
capture_method: 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": 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_-8438814131594319128_200_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
}),
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_{}", generate_unique_id("test")),
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_-8438814131594319128_200_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
}),
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_{}", generate_unique_id("test")),
transaction_id: Some(Identifier {
id_type: Some(IdType::Id(transaction_id.to_string())),
}),
currency: i32::from(Currency::Myr),
payment_amount: TEST_AMOUNT,
refund_amount: TEST_AMOUNT,
minor_payment_amount: TEST_AMOUNT,
minor_refund_amount: TEST_AMOUNT,
reason: None,
browser_info: None,
merchant_account_id: None,
capture_method: None,
request_ref_id: None,
webhook_url: Some(
"https://hyperswitch.io/connector-service/authnet_webhook_grpcurl".to_string(),
),
..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": 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_-8438814131594319128_200_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
}),
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_{}", generate_unique_id("test")),
transaction_id: Some(Identifier {
id_type: Some(IdType::Id(transaction_id.to_string())),
}),
currency: i32::from(Currency::Myr),
payment_amount: TEST_AMOUNT,
refund_amount: TEST_AMOUNT,
minor_payment_amount: TEST_AMOUNT,
minor_refund_amount: TEST_AMOUNT,
reason: None,
browser_info: None,
merchant_account_id: None,
capture_method: None,
request_ref_id: None,
webhook_url: Some(
"https://hyperswitch.io/connector-service/authnet_webhook_grpcurl".to_string(),
),
..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: None,
browser_info: None,
refund_metadata: std::collections::HashMap::new(),
state: None,
}
}
// Test for basic health check
#[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": 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_-8438814131594319128_225_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
request_ref_id: None,
webhook_url: Some(
"https://hyperswitch.io/connector-service/authnet_webhook_grpcurl".to_string(),
),
..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(),
|
{
"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_-8438814131594319128_225_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
request_ref_id: None,
webhook_url: Some(
"https://hyperswitch.io/connector-service/authnet_webhook_grpcurl".to_string(),
),
..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: None,
browser_info: None,
refund_metadata: std::collections::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": 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_-8438814131594319128_225_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
request_ref_id: None,
webhook_url: Some(
"https://hyperswitch.io/connector-service/authnet_webhook_grpcurl".to_string(),
),
..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: None,
browser_info: None,
refund_metadata: std::collections::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_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
|
{
"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_-8438814131594319128_250_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
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
);
});
|
{
"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_-8438814131594319128_250_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
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_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_fiuu_metadata(&mut grpc_request);
// Send the request
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": 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_-8438814131594319128_250_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
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_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_fiuu_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
assert!(
response.status == i32::from(PaymentStatus::Charged),
"Payment should be in Charged 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_authorize_request(CaptureMethod::Manual);
// 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": 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_-8438814131594319128_275_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
let mut grpc_request = Request::new(request);
add_fiuu_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
assert!(
response.status == i32::from(PaymentStatus::Charged),
"Payment should be in Charged 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": 275,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8438814131594319128_275_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
let mut grpc_request = Request::new(request);
add_fiuu_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
assert!(
response.status == i32::from(PaymentStatus::Charged),
"Payment should be in Charged 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_authorize_request(CaptureMethod::Manual);
// Add metadata headers for auth request
let mut auth_grpc_request = Request::new(auth_request);
add_fiuu_metadata(&mut auth_grpc_request);
// Send the auth request
let auth_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": 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_-8438814131594319128_275_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
let mut grpc_request = Request::new(request);
add_fiuu_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
assert!(
response.status == i32::from(PaymentStatus::Charged),
"Payment should be in Charged 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_authorize_request(CaptureMethod::Manual);
// Add metadata headers for auth request
let mut auth_grpc_request = Request::new(auth_request);
add_fiuu_metadata(&mut auth_grpc_request);
// Send the auth request
let auth_response = client
.authorize(auth_grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Verify payment status
assert!(
auth_response.status == i32::from(PaymentStatus::Authorized),
"Payment should be in Authorized state"
);
// Extract the transaction ID
let transaction_id = extract_transaction_id(&auth_response);
// Add delay of 15 seconds
tokio::time::sleep(std::time::Duration::from_secs(15)).await;
// Create capture request
let capture_request = create_payment_capture_request(&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": 275,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8438814131594319128_300_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
let mut auth_grpc_request = Request::new(auth_request);
add_fiuu_metadata(&mut auth_grpc_request);
// Send the auth request
let auth_response = client
.authorize(auth_grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Verify payment status
assert!(
auth_response.status == i32::from(PaymentStatus::Authorized),
"Payment should be in Authorized 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": 300,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8438814131594319128_300_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
let mut auth_grpc_request = Request::new(auth_request);
add_fiuu_metadata(&mut auth_grpc_request);
// Send the auth request
let auth_response = client
.authorize(auth_grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Verify payment status
assert!(
auth_response.status == i32::from(PaymentStatus::Authorized),
"Payment should be in Authorized state"
);
// Extract the transaction ID
let transaction_id = extract_transaction_id(&auth_response);
// Add delay of 15 seconds
tokio::time::sleep(std::time::Duration::from_secs(15)).await;
// Create capture request
let capture_request = create_payment_capture_request(&transaction_id);
// Add metadata headers for capture request - make sure they include the terminal_id
let mut capture_grpc_request = Request::new(capture_request);
add_fiuu_metadata(&mut capture_grpc_request);
// Send the capture 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": 300,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8438814131594319128_300_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
let mut auth_grpc_request = Request::new(auth_request);
add_fiuu_metadata(&mut auth_grpc_request);
// Send the auth request
let auth_response = client
.authorize(auth_grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Verify payment status
assert!(
auth_response.status == i32::from(PaymentStatus::Authorized),
"Payment should be in Authorized state"
);
// Extract the transaction ID
let transaction_id = extract_transaction_id(&auth_response);
// Add delay of 15 seconds
tokio::time::sleep(std::time::Duration::from_secs(15)).await;
// Create capture request
let capture_request = create_payment_capture_request(&transaction_id);
// Add metadata headers for capture request - make sure they include the terminal_id
let mut capture_grpc_request = Request::new(capture_request);
add_fiuu_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 sync with auto capture
#[tokio::test]
async fn test_payment_sync_auto_capture() {
grpc_test!(client, PaymentServiceClient<Channel>, {
// Create the payment authorization request
let request = create_authorize_request(CaptureMethod::Automatic);
|
{
"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_-8438814131594319128_325_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
// Add metadata headers for capture request - make sure they include the terminal_id
let mut capture_grpc_request = Request::new(capture_request);
add_fiuu_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"
|
{
"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_-8438814131594319128_325_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
// Add metadata headers for capture request - make sure they include the terminal_id
let mut capture_grpc_request = Request::new(capture_request);
add_fiuu_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 sync with auto capture
#[tokio::test]
async fn test_payment_sync_auto_capture() {
grpc_test!(client, PaymentServiceClient<Channel>, {
// Create the payment authorization request
let request = create_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_fiuu_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": 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_-8438814131594319128_325_50
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
// Add metadata headers for capture request - make sure they include the terminal_id
let mut capture_grpc_request = Request::new(capture_request);
add_fiuu_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 sync with auto capture
#[tokio::test]
async fn test_payment_sync_auto_capture() {
grpc_test!(client, PaymentServiceClient<Channel>, {
// Create the payment authorization request
let request = create_authorize_request(CaptureMethod::Automatic);
// Add metadata headers
let mut grpc_request = Request::new(request);
add_fiuu_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&response);
// Add delay of 10 seconds
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
// Create sync request
let sync_request = create_payment_sync_request(&transaction_id);
// Add metadata headers for sync request
let mut sync_grpc_request = Request::new(sync_request);
add_fiuu_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": 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_-8438814131594319128_350_15
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
// Add metadata headers
let mut grpc_request = Request::new(request);
add_fiuu_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&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": 350,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8438814131594319128_350_30
|
clm
|
snippet
|
// connector-service/backend/grpc-server/tests/fiuu_payment_flows_test.rs
// Add metadata headers
let mut grpc_request = Request::new(request);
add_fiuu_metadata(&mut grpc_request);
// Send the request
let response = client
.authorize(grpc_request)
.await
.expect("gRPC authorize call failed")
.into_inner();
// Extract the transaction ID
let transaction_id = extract_transaction_id(&response);
// Add delay of 10 seconds
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
// Create sync request
let sync_request = create_payment_sync_request(&transaction_id);
// Add metadata headers for sync request
let mut sync_grpc_request = Request::new(sync_request);
add_fiuu_metadata(&mut sync_grpc_request);
// Send the sync request
let sync_response = client
.get(sync_grpc_request)
.await
.expect("gRPC payment_sync 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
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.