Struct mpesa::services::C2bSimulateBuilder
source · pub struct C2bSimulateBuilder<'mpesa, Env: ApiEnvironment> { /* private fields */ }
Implementations§
source§impl<'mpesa, Env: ApiEnvironment> C2bSimulateBuilder<'mpesa, Env>
impl<'mpesa, Env: ApiEnvironment> C2bSimulateBuilder<'mpesa, Env>
sourcepub fn new(client: &'mpesa Mpesa<Env>) -> C2bSimulateBuilder<'mpesa, Env>
pub fn new(client: &'mpesa Mpesa<Env>) -> C2bSimulateBuilder<'mpesa, Env>
Creates a new C2B Simulate builder
sourcepub fn command_id(
self,
command_id: CommandId
) -> C2bSimulateBuilder<'mpesa, Env>
pub fn command_id( self, command_id: CommandId ) -> C2bSimulateBuilder<'mpesa, Env>
Adds CommandId
. Defaults to CommandId::CustomerPaybillOnline
if no value explicitly passed
Errors
If CommandId
is not valid
sourcepub fn amount<Number: Into<f64>>(
self,
amount: Number
) -> C2bSimulateBuilder<'mpesa, Env>
pub fn amount<Number: Into<f64>>( self, amount: Number ) -> C2bSimulateBuilder<'mpesa, Env>
sourcepub fn msisdn(self, msisdn: &'mpesa str) -> C2bSimulateBuilder<'mpesa, Env>
pub fn msisdn(self, msisdn: &'mpesa str) -> C2bSimulateBuilder<'mpesa, Env>
Adds the MSISDN(phone number) sending the transaction, start by country code without the +
.
This is a required field
Errors
If MSISDN
is invalid or not provided
sourcepub fn short_code(
self,
short_code: &'mpesa str
) -> C2bSimulateBuilder<'mpesa, Env>
pub fn short_code( self, short_code: &'mpesa str ) -> C2bSimulateBuilder<'mpesa, Env>
Adds ShortCode
; the 6 digit MPESA Till Number or PayBill Number
Errors
If Till or PayBill number is invalid or not provided
sourcepub fn bill_ref_number(
self,
bill_ref_number: &'mpesa str
) -> C2bSimulateBuilder<'mpesa, Env>
pub fn bill_ref_number( self, bill_ref_number: &'mpesa str ) -> C2bSimulateBuilder<'mpesa, Env>
sourcepub async fn send(self) -> MpesaResult<C2bSimulateResponse>
pub async fn send(self) -> MpesaResult<C2bSimulateResponse>
C2B Simulate API
Make payment requests from Client to Business
This enables you to receive the payment requests in real time. See more here
A successful request returns a C2bSimulateResponse
type
Errors
Returns a MpesaError
on failure
Trait Implementations§
Auto Trait Implementations§
impl<'mpesa, Env> !RefUnwindSafe for C2bSimulateBuilder<'mpesa, Env>
impl<'mpesa, Env> !Send for C2bSimulateBuilder<'mpesa, Env>
impl<'mpesa, Env> !Sync for C2bSimulateBuilder<'mpesa, Env>
impl<'mpesa, Env> Unpin for C2bSimulateBuilder<'mpesa, Env>
impl<'mpesa, Env> !UnwindSafe for C2bSimulateBuilder<'mpesa, Env>
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