pub struct ResponseProcessor<'pw, F, Res>where
F: Facilitator,{
pub paywall: &'pw PayWall<F>,
pub response: Response<Res>,
pub payload: PaymentPayload,
pub selected: PaymentRequirements,
pub payment_state: PaymentState,
}Expand description
Payment processing state after running the resource handler.
Fields§
§paywall: &'pw PayWall<F>§response: Response<Res>§payload: PaymentPayload§selected: PaymentRequirements§payment_state: PaymentStateImplementations§
Source§impl<'pw, F, Res> ResponseProcessor<'pw, F, Res>where
F: Facilitator,
impl<'pw, F, Res> ResponseProcessor<'pw, F, Res>where
F: Facilitator,
Sourcepub async fn settle(
self,
) -> Result<ResponseProcessor<'pw, F, Res>, ErrorResponse>
pub async fn settle( self, ) -> Result<ResponseProcessor<'pw, F, Res>, ErrorResponse>
Settle the payment with the facilitator after running the resource handler.
After settlement, self.payment_state.settled will be populated on success.
Sourcepub async fn settle_on(
self,
predicate: impl Fn(&Response<Res>) -> bool,
) -> Result<ResponseProcessor<'pw, F, Res>, ErrorResponse>
pub async fn settle_on( self, predicate: impl Fn(&Response<Res>) -> bool, ) -> Result<ResponseProcessor<'pw, F, Res>, ErrorResponse>
Conditionally settle the payment based on the provided prediction function.
After settlement, self.payment_state.settled will be populated on success.
Sourcepub async fn settle_on_success(
self,
) -> Result<ResponseProcessor<'pw, F, Res>, ErrorResponse>
pub async fn settle_on_success( self, ) -> Result<ResponseProcessor<'pw, F, Res>, ErrorResponse>
Settle the payment if the response status is a success (2xx).
After settlement, self.payment_state.settled will be populated on success.
Auto Trait Implementations§
impl<'pw, F, Res> Freeze for ResponseProcessor<'pw, F, Res>where
Res: Freeze,
impl<'pw, F, Res> !RefUnwindSafe for ResponseProcessor<'pw, F, Res>
impl<'pw, F, Res> Send for ResponseProcessor<'pw, F, Res>
impl<'pw, F, Res> Sync for ResponseProcessor<'pw, F, Res>
impl<'pw, F, Res> Unpin for ResponseProcessor<'pw, F, Res>where
Res: Unpin,
impl<'pw, F, Res> !UnwindSafe for ResponseProcessor<'pw, F, Res>
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> 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