mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
feat(core): Hyperswitch <|> UCS integration v2 (#8439)
Co-authored-by: debarshi.gupta <debarshi.gupta@juspay.in> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Aishwariyaa Anand <aishwariyaa.anand@Aishwariyaa-Anand-C3PGW02T6Y.local> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Kashif <kashif.dev@protonmail.com> Co-authored-by: likhinbopanna <131246334+likhinbopanna@users.noreply.github.com>
This commit is contained in:
@ -84,6 +84,10 @@ pub enum UnifiedConnectorServiceError {
|
||||
/// Failed to perform Payment Authorize from gRPC Server
|
||||
#[error("Failed to perform Payment Authorize from gRPC Server")]
|
||||
PaymentAuthorizeFailure,
|
||||
|
||||
/// Failed to perform Payment Get from gRPC Server
|
||||
#[error("Failed to perform Payment Get from gRPC Server")]
|
||||
PaymentGetFailure,
|
||||
}
|
||||
|
||||
/// Result type for Dynamic Routing
|
||||
@ -191,6 +195,28 @@ impl UnifiedConnectorServiceClient {
|
||||
.change_context(UnifiedConnectorServiceError::PaymentAuthorizeFailure)
|
||||
.inspect_err(|error| logger::error!(?error))
|
||||
}
|
||||
|
||||
/// Performs Payment Sync/Get
|
||||
pub async fn payment_get(
|
||||
&self,
|
||||
payment_get_request: payments_grpc::PaymentServiceGetRequest,
|
||||
connector_auth_metadata: ConnectorAuthMetadata,
|
||||
grpc_headers: GrpcHeaders,
|
||||
) -> UnifiedConnectorServiceResult<tonic::Response<payments_grpc::PaymentServiceGetResponse>>
|
||||
{
|
||||
let mut request = tonic::Request::new(payment_get_request);
|
||||
|
||||
let metadata =
|
||||
build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
|
||||
*request.metadata_mut() = metadata;
|
||||
|
||||
self.client
|
||||
.clone()
|
||||
.get(request)
|
||||
.await
|
||||
.change_context(UnifiedConnectorServiceError::PaymentGetFailure)
|
||||
.inspect_err(|error| logger::error!(?error))
|
||||
}
|
||||
}
|
||||
|
||||
/// Build the gRPC Headers for Unified Connector Service Request
|
||||
|
||||
Reference in New Issue
Block a user