pub struct RemoteFacilitatorClient<VReq, VRes, SReq, SRes>where
VReq: From<FacilitatorPaymentRequest> + Serialize,
VRes: IntoVerifyResponse + for<'de> Deserialize<'de>,
SReq: From<FacilitatorPaymentRequest> + Serialize,
SRes: IntoSettleResponse + for<'de> Deserialize<'de>,{
pub base_url: Url,
pub client: Client,
pub supported_headers: HeaderMap,
pub verify_headers: HeaderMap,
pub settle_headers: HeaderMap,
pub _phantom: PhantomData<(VReq, VRes, SReq, SRes)>,
}Expand description
A remote facilitator client that communicates over HTTP.
You can customize the request and response types for verification and settlement
§Type Parameters
VReq: The request type for verification, must be convertible fromFacilitatorPaymentRequestand serializable.VRes: The response type for verification, must be convertible intoFacilitatorVerifyResponseand deserializable.SReq: The request type for settlement, must be convertible fromFacilitatorPaymentRequestand serializable.SRes: The response type for settlement, must be convertible intoFacilitatorSettleResponseand deserializable.
Fields§
§base_url: Url§client: Client§supported_headers: HeaderMap§verify_headers: HeaderMap§settle_headers: HeaderMap§_phantom: PhantomData<(VReq, VRes, SReq, SRes)>Implementations§
Source§impl<VReq, VRes, SReq, SRes> RemoteFacilitatorClient<VReq, VRes, SReq, SRes>where
VReq: From<FacilitatorPaymentRequest> + Serialize,
VRes: IntoVerifyResponse + for<'de> Deserialize<'de>,
SReq: From<FacilitatorPaymentRequest> + Serialize,
SRes: IntoSettleResponse + for<'de> Deserialize<'de>,
impl<VReq, VRes, SReq, SRes> RemoteFacilitatorClient<VReq, VRes, SReq, SRes>where
VReq: From<FacilitatorPaymentRequest> + Serialize,
VRes: IntoVerifyResponse + for<'de> Deserialize<'de>,
SReq: From<FacilitatorPaymentRequest> + Serialize,
SRes: IntoSettleResponse + for<'de> Deserialize<'de>,
pub fn new_from_url(base_url: Url) -> Self
pub fn with_verify_request_type<NewVReq>( self, ) -> RemoteFacilitatorClient<NewVReq, VRes, SReq, SRes>
pub fn with_verify_response_type<NewVRes>(
self,
) -> RemoteFacilitatorClient<VReq, NewVRes, SReq, SRes>where
NewVRes: IntoVerifyResponse + for<'de> Deserialize<'de>,
pub fn with_settle_request_type<NewSReq>( self, ) -> RemoteFacilitatorClient<VReq, VRes, NewSReq, SRes>
pub fn with_settle_response_type<NewSRes>(
self,
) -> RemoteFacilitatorClient<VReq, VRes, SReq, NewSRes>where
NewSRes: IntoSettleResponse + for<'de> Deserialize<'de>,
pub fn header(self, key: &HeaderName, value: &HeaderValue) -> Self
pub fn supported_header(self, key: &HeaderName, value: &HeaderValue) -> Self
pub fn verify_header(self, key: &HeaderName, value: &HeaderValue) -> Self
pub fn settle_header(self, key: &HeaderName, value: &HeaderValue) -> Self
Trait Implementations§
Source§impl<VReq, VRes, SReq, SRes> Clone for RemoteFacilitatorClient<VReq, VRes, SReq, SRes>where
VReq: From<FacilitatorPaymentRequest> + Serialize + Clone,
VRes: IntoVerifyResponse + for<'de> Deserialize<'de> + Clone,
SReq: From<FacilitatorPaymentRequest> + Serialize + Clone,
SRes: IntoSettleResponse + for<'de> Deserialize<'de> + Clone,
impl<VReq, VRes, SReq, SRes> Clone for RemoteFacilitatorClient<VReq, VRes, SReq, SRes>where
VReq: From<FacilitatorPaymentRequest> + Serialize + Clone,
VRes: IntoVerifyResponse + for<'de> Deserialize<'de> + Clone,
SReq: From<FacilitatorPaymentRequest> + Serialize + Clone,
SRes: IntoSettleResponse + for<'de> Deserialize<'de> + Clone,
Source§fn clone(&self) -> RemoteFacilitatorClient<VReq, VRes, SReq, SRes>
fn clone(&self) -> RemoteFacilitatorClient<VReq, VRes, SReq, SRes>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<VReq, VRes, SReq, SRes> Debug for RemoteFacilitatorClient<VReq, VRes, SReq, SRes>where
VReq: From<FacilitatorPaymentRequest> + Serialize + Debug,
VRes: IntoVerifyResponse + for<'de> Deserialize<'de> + Debug,
SReq: From<FacilitatorPaymentRequest> + Serialize + Debug,
SRes: IntoSettleResponse + for<'de> Deserialize<'de> + Debug,
impl<VReq, VRes, SReq, SRes> Debug for RemoteFacilitatorClient<VReq, VRes, SReq, SRes>where
VReq: From<FacilitatorPaymentRequest> + Serialize + Debug,
VRes: IntoVerifyResponse + for<'de> Deserialize<'de> + Debug,
SReq: From<FacilitatorPaymentRequest> + Serialize + Debug,
SRes: IntoSettleResponse + for<'de> Deserialize<'de> + Debug,
Source§impl<VReq, VRes, SReq, SRes> Facilitator for RemoteFacilitatorClient<VReq, VRes, SReq, SRes>where
VReq: From<FacilitatorPaymentRequest> + Serialize,
VRes: IntoVerifyResponse + for<'de> Deserialize<'de>,
SReq: From<FacilitatorPaymentRequest> + Serialize,
SRes: IntoSettleResponse + for<'de> Deserialize<'de>,
impl<VReq, VRes, SReq, SRes> Facilitator for RemoteFacilitatorClient<VReq, VRes, SReq, SRes>where
VReq: From<FacilitatorPaymentRequest> + Serialize,
VRes: IntoVerifyResponse + for<'de> Deserialize<'de>,
SReq: From<FacilitatorPaymentRequest> + Serialize,
SRes: IntoSettleResponse + for<'de> Deserialize<'de>,
type Error = RemoteFacilitatorClientError
async fn supported(&self) -> Result<FacilitatorSupportedResponse, Self::Error>
async fn verify( &self, request: FacilitatorPaymentRequest, ) -> Result<FacilitatorVerifyResponse, Self::Error>
async fn settle( &self, request: FacilitatorPaymentRequest, ) -> Result<FacilitatorSettleResponse, Self::Error>
Auto Trait Implementations§
impl<VReq, VRes, SReq, SRes> Freeze for RemoteFacilitatorClient<VReq, VRes, SReq, SRes>
impl<VReq, VRes, SReq, SRes> !RefUnwindSafe for RemoteFacilitatorClient<VReq, VRes, SReq, SRes>
impl<VReq, VRes, SReq, SRes> Send for RemoteFacilitatorClient<VReq, VRes, SReq, SRes>
impl<VReq, VRes, SReq, SRes> Sync for RemoteFacilitatorClient<VReq, VRes, SReq, SRes>
impl<VReq, VRes, SReq, SRes> Unpin for RemoteFacilitatorClient<VReq, VRes, SReq, SRes>
impl<VReq, VRes, SReq, SRes> !UnwindSafe for RemoteFacilitatorClient<VReq, VRes, SReq, SRes>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more