Struct mpesa::services::B2cBuilder [−][src]
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]
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]
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]
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
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]
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>,