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]

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]

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

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

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

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

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.

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.