pub struct ResponseProcessor<'pw, F: Facilitator, Res> {
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: Facilitator, Res> ResponseProcessor<'pw, F, Res>
impl<'pw, F: Facilitator, Res> ResponseProcessor<'pw, F, Res>
Sourcepub async fn settle(self) -> Result<Self, ErrorResponse>
pub async fn settle(self) -> Result<Self, 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<Self, ErrorResponse>
pub async fn settle_on( self, predicate: impl Fn(&Response<Res>) -> bool, ) -> Result<Self, 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<Self, ErrorResponse>
pub async fn settle_on_success(self) -> Result<Self, 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