Struct mpesa::services::C2bSimulateBuilder[][src]

pub struct C2bSimulateBuilder<'a> { /* fields omitted */ }

Implementations

impl<'a> C2bSimulateBuilder<'a>[src]

pub fn new(client: &'a Mpesa) -> C2bSimulateBuilder<'a>[src]

Creates a new C2B Simulate builder

pub fn command_id(self, command_id: CommandId) -> C2bSimulateBuilder<'a>[src]

Adds CommandId. Defaults to CommandId::CustomerPaybillOnline if no value explicitly passed

Errors

If CommandId is not valid

pub fn amount(self, amount: u32) -> C2bSimulateBuilder<'a>[src]

Adds the amount being transacted. This is a required field

Errors

If invalid amount, less than 10?

pub fn msisdn(self, msisdn: &'a str) -> C2bSimulateBuilder<'a>[src]

Adds the MSISDN(phone number) sending the transaction, start by country code without the +. This is a required field

Errors

If MSISDN is invalid

pub fn short_code(self, short_code: &'a str) -> C2bSimulateBuilder<'a>[src]

Adds ShortCode; the 6 digit MPESA Till Number or PayBill Number

Errors

If Till or PayBill number is invalid

pub fn bill_ref_number(self, bill_ref_number: &'a str) -> C2bSimulateBuilder<'a>[src]

Adds Bull reference number. This field is optional and will by default be "None".

pub fn send(self) -> MpesaResult<C2bSimulateResponse>[src]

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 serde_json::Value type

Errors

Returns a MpesaError on failure

Trait Implementations

impl<'a> Debug for C2bSimulateBuilder<'a>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'a> !RefUnwindSafe for C2bSimulateBuilder<'a>

impl<'a> !Send for C2bSimulateBuilder<'a>

impl<'a> !Sync for C2bSimulateBuilder<'a>

impl<'a> Unpin for C2bSimulateBuilder<'a>

impl<'a> !UnwindSafe for C2bSimulateBuilder<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.