Struct mpesa::services::B2bBuilder [−][src]
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]
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]
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]
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,