Struct mpesa::services::AccountBalanceBuilder
source · pub struct AccountBalanceBuilder<'mpesa, Env: ApiEnvironment> { /* private fields */ }
Implementations§
source§impl<'mpesa, Env: ApiEnvironment> AccountBalanceBuilder<'mpesa, Env>
impl<'mpesa, Env: ApiEnvironment> AccountBalanceBuilder<'mpesa, Env>
sourcepub fn new(
client: &'mpesa Mpesa<Env>,
initiator_name: &'mpesa str
) -> AccountBalanceBuilder<'mpesa, Env>
pub fn new( client: &'mpesa Mpesa<Env>, initiator_name: &'mpesa str ) -> AccountBalanceBuilder<'mpesa, Env>
Creates a new AccountBalanceBuilder
.
Requires an initiator_name
, the credential/ username used to authenticate the transaction request
sourcepub fn command_id(
self,
command_id: CommandId
) -> AccountBalanceBuilder<'mpesa, Env>
pub fn command_id( self, command_id: CommandId ) -> AccountBalanceBuilder<'mpesa, Env>
Adds a CommandId
, the unique command passed to the MPESA system.
Defaults to CommandId::AccountBalance
if not passed explicitly.
Errors
If CommandId
is invalid
sourcepub fn party_a(self, party_a: &'mpesa str) -> AccountBalanceBuilder<'mpesa, Env>
pub fn party_a(self, party_a: &'mpesa str) -> AccountBalanceBuilder<'mpesa, Env>
Adds PartyA
, the shortcode of the organization receiving the transaction.
This is a required field.
Errors
If Party A
is not provided or invalid
sourcepub fn identifier_type(
self,
identifier_type: IdentifierTypes
) -> AccountBalanceBuilder<'mpesa, Env>
pub fn identifier_type( self, identifier_type: IdentifierTypes ) -> AccountBalanceBuilder<'mpesa, Env>
Adds the ReceiverIdentifierType
, the type of organization receiving the transaction.
Defaults to IdentifierTypes::ShortCode
if not passed explicitly
Errors
If invalid ReceiverIdentifierType
is provided
sourcepub fn remarks(self, remarks: &'mpesa str) -> AccountBalanceBuilder<'mpesa, Env>
pub fn remarks(self, remarks: &'mpesa str) -> AccountBalanceBuilder<'mpesa, Env>
Adds Remarks
, a comment sent along transaction.
Optional field that defaults to "None"
if no value is provided
sourcepub fn timeout_url(
self,
timeout_url: &'mpesa str
) -> AccountBalanceBuilder<'mpesa, Env>
pub fn timeout_url( self, timeout_url: &'mpesa str ) -> AccountBalanceBuilder<'mpesa, Env>
Error
If QueueTimeoutUrl
is invalid or not provided
sourcepub fn result_url(
self,
result_url: &'mpesa str
) -> AccountBalanceBuilder<'mpesa, Env>
pub fn result_url( self, result_url: &'mpesa str ) -> AccountBalanceBuilder<'mpesa, Env>
Error
If ResultUrl
is invalid or not provided
sourcepub fn urls(
self,
timeout_url: &'mpesa str,
result_url: &'mpesa str
) -> AccountBalanceBuilder<'mpesa, Env>
👎Deprecated
pub fn urls( self, timeout_url: &'mpesa str, result_url: &'mpesa str ) -> AccountBalanceBuilder<'mpesa, Env>
Adds QueueTimeoutUrl
and ResultUrl
. This is a required field
Error
If either QueueTimeoutUrl
and ResultUrl
is invalid or not provided
sourcepub async fn send(self) -> MpesaResult<AccountBalanceResponse>
pub async fn send(self) -> MpesaResult<AccountBalanceResponse>
AccountBalance API
Enquire the balance on an M-Pesa BuyGoods (Till Number).
A successful request returns a C2bRegisterResponse
type.
See more here
Errors
Returns a MpesaError
on failure