Struct mpesa::services::C2bRegisterBuilder[][src]

pub struct C2bRegisterBuilder<'a> { /* fields omitted */ }
Expand description

C2B Register builder

Implementations

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

pub fn new(client: &'a Mpesa) -> C2bRegisterBuilder<'a>[src]

Creates a new C2B Builder

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

Adds ValidationURL for the client. This is a required field

Error

If ValidationURL is invalid or not provided

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

Adds ConfirmationUrl for the client. This is a required field

Error

If ConfirmationUrl is invalid or not provided

pub fn response_type(
    self,
    response_type: ResponseType
) -> C2bRegisterBuilder<'a>
[src]

Adds ResponseType for timeout. Will default to ResponseType::Complete if not explicitly provided

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

Adds ShortCode for the organization. This is a required field.

Error

If ShortCode is invalid

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

C2B Register API

Registers the the 3rd party’s confirmation and validation URLs to M-Pesa

Registering maps these URLs to the 3rd party shortcode. Whenever M-Pesa receives a transaction on the shortcode, M-Pesa triggers a validation request against the validation URL and the 3rd party system responds to M-Pesa with a validation response (either a success or an error code). See more here

The response expected is the success code the 3rd party

A successful request returns a serde_json::Value type

Errors

Returns a MpesaError on failure

Trait Implementations

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

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'a> !RefUnwindSafe for C2bRegisterBuilder<'a>

impl<'a> !Send for C2bRegisterBuilder<'a>

impl<'a> !Sync for C2bRegisterBuilder<'a>

impl<'a> Unpin for C2bRegisterBuilder<'a>

impl<'a> !UnwindSafe for C2bRegisterBuilder<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.