Struct mpesa::services::B2cBuilder[][src]

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

B2C transaction builder struct

Implementations

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

pub fn new(client: &'a Mpesa, initiator_name: &'a str) -> B2cBuilder<'a>[src]

Create a new B2C builder. Requires an initiator_name, the credential/ username used to authenticate the transaction request

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

Adds the CommandId. Defaults to CommandId::BusinessPayment if not explicitly provided.

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

Adds Party A which is a required field Party A should be a paybill number.

Errors

If Party A is invalid or not provided

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

Adds Party B which is a required field Party B should be a mobile number.

Errors

If Party B is invalid or not provided

pub fn parties(self, party_a: &'a str, party_b: &'a str) -> B2cBuilder<'a>[src]

👎 Deprecated

Adds Party A and Party B. Both are required fields Party A should be a paybill number while Party B should be a mobile number.

Errors

If either Party A or Party B is invalid or not provided

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

Adds Remarks. This is an optional field, will default to “None” if not explicitly provided

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

Adds Occasion. This is an optional field, will default to an empty string

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

This is a required field

Errors

If the amount is less than 10?

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

Error

If QueueTimeoutUrl is invalid or not provided

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

Error

If ResultUrl is invalid or not provided

pub fn urls(self, timeout_url: &'a str, result_url: &'a str) -> B2cBuilder<'a>[src]

👎 Deprecated

Adds QueueTimeoutUrl and ResultUrl. This is a required field

Error

If either QueueTimeoutUrl and ResultUrl is invalid or not provided

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

B2C API

Sends b2c payment request.

This API enables Business to Customer (B2C) transactions between a company and customers who are the end-users of its products or services. Use of this API requires a valid and verified B2C M-Pesa Short code. See more here

A successful request returns a serde_json::Value type

Errors

Returns a MpesaError on failure.

Trait Implementations

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

Auto Trait Implementations

impl<'a> RefUnwindSafe for B2cBuilder<'a>

impl<'a> Send for B2cBuilder<'a>

impl<'a> Sync for B2cBuilder<'a>

impl<'a> Unpin for B2cBuilder<'a>

impl<'a> UnwindSafe for B2cBuilder<'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.