Struct mpesa::services::B2bBuilder[][src]

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

B2B transaction builder struct

Implementations

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

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

Creates a new B2B builder Requires an initiator_name, the credential/ username used to authenticate the transaction request

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

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

Errors

If invalid CommandId is provided

pub fn party_a(self, party_a: &'a str) -> B2bBuilder<'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) -> B2bBuilder<'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) -> B2bBuilder<'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 timeout_url(self, timeout_url: &'a str) -> B2bBuilder<'a>[src]

Error

If QueueTimeoutUrl is invalid or not provided

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

Error

If ResultUrl is invalid or not provided

pub fn urls(self, timeout_url: &'a str, result_url: &'a str) -> B2bBuilder<'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 sender_id(self, sender_id: IdentifierTypes) -> B2bBuilder<'a>[src]

Adds sender_id. Will default to IdentifierTypes::ShortCode if not explicitly provided

pub fn receiver_id(self, receiver_id: IdentifierTypes) -> B2bBuilder<'a>[src]

Adds receiver_id. Will default to IdentifierTypes::ShortCode if not explicitly provided

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

Adds account_ref. This field is required

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

This is a required field

Errors

If the amount is less than 10?

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

Adds remarks. This field is optional, will default to “None” if not explicitly passed

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

B2B API

Sends b2b payment request.

This API enables Business to Business (B2B) transactions between a business and another business. Use of this API requires a valid and verified B2B M-Pesa short code for the business initiating the transaction and the both businesses involved in the transaction See more here

A successful request returns a serde_json::Value type

Errors

Returns a MpesaError on failure

Trait Implementations

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

Auto Trait Implementations

impl<'a> RefUnwindSafe for B2bBuilder<'a>

impl<'a> Send for B2bBuilder<'a>

impl<'a> Sync for B2bBuilder<'a>

impl<'a> Unpin for B2bBuilder<'a>

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