pub struct PayoutsAPI { /* private fields */ }
Expand description
PayoutsAPI
struct implements methods for facilitating:
Sending of funds to different recipients programatically.
// Load .env file
dotenv().ok();
let intasend_public_key = env::var("INTASEND_PUBLIC_KEY").expect("INTASEND_PUBLIC_KEY must be set");
let intasend_secret_key = env::var("INTASEND_SECRET_KEY").expect("INTASEND_SECRET_KEY must be set");
// Intasend Client
let intasend = Intasend::new(
intasend_public_key,
intasend_secret_key,
true,
);
// PayoutsAPI
let payout: Payouts = intasend.payout();
Implementations§
Source§impl PayoutsAPI
impl PayoutsAPI
Sourcepub async fn initiate(&self, payload: PayoutRequest) -> Result<Payout>
pub async fn initiate(&self, payload: PayoutRequest) -> Result<Payout>
The initiate
method initiates the API requests to IntaSend’s Payouts
(Send Money) API.
This depends on the payload struct (PayoutRequest
) passed into the method as arguments.
This method is used under the hood to power all initiated requests depending on PayoutProvider.
It returns a Result of Payout.
Sourcepub async fn mpesa_b2c(&self, payload: PayoutRequest) -> Result<Payout>
pub async fn mpesa_b2c(&self, payload: PayoutRequest) -> Result<Payout>
The mpesa_b2c
method initates Mpesa B2C payout API requests to IntaSend’s Payouts
API.
This depends on the payload struct (PayoutRequest
) passed into the method as arguments.
It returns a Result of Payout.
Sourcepub async fn mpesa_b2b(&self, payload: PayoutRequest) -> Result<Payout>
pub async fn mpesa_b2b(&self, payload: PayoutRequest) -> Result<Payout>
The mpesa_b2b
method initates Mpesa B2B payout API requests to IntaSend’s Payouts
API.
This depends on the payload struct (PayoutRequest
) passed into the method as arguments.
It returns a Result of Payout.
Sourcepub async fn bank(&self, payload: PayoutRequest) -> Result<Payout>
pub async fn bank(&self, payload: PayoutRequest) -> Result<Payout>
The bank
method initates bank payout API requests to IntaSend’s Payouts
API.
This depends on the payload struct (PayoutRequest
) passed into the method as arguments.
It returns a Result of Payout.
Sourcepub async fn intasend(&self, payload: PayoutRequest) -> Result<Payout>
pub async fn intasend(&self, payload: PayoutRequest) -> Result<Payout>
The intasend
method initiates intasend payout API requests to IntaSend’s Payouts
API.
This depends on the payload struct (PayoutRequest
) passed into the method as arguments.
It returns a Payout Result.
Sourcepub async fn airtime(&self, payload: PayoutRequest) -> Result<Payout>
pub async fn airtime(&self, payload: PayoutRequest) -> Result<Payout>
The airtime
method initiates airtime payout API requests to IntaSend’s Payouts
API.
This depends on the payload struct (PayoutRequest
) passed into the method as arguments.
It returns a Result of Payout.
Sourcepub async fn approve(&self, payload: PayoutApprovalRequest) -> Result<Payout>
pub async fn approve(&self, payload: PayoutApprovalRequest) -> Result<Payout>
The approve
method approves the initiated payout API requests to IntaSend’s Payouts
API.
This depends on the payload struct (PayoutApprovalRequest
) passed into the method as arguments.
It returns a Result of Payout.
Sourcepub async fn status(&self, payload: PayoutStatusRequest) -> Result<Payout>
pub async fn status(&self, payload: PayoutStatusRequest) -> Result<Payout>
The status
method checks the status of the initiated payout API requests to IntaSend’s Payouts
API.
This depends on the payload struct (PayoutStatusRequest
) passed into the method as arguments.
It returns a Result of Payout.
Sourcepub async fn cancel(&self, payload: PayoutCancelRequest) -> Result<Payout>
pub async fn cancel(&self, payload: PayoutCancelRequest) -> Result<Payout>
The cancel
method cancels the initiated payout API requests to IntaSend’s Payouts
API.
This depends on the payload struct (PayoutStatusRequest
) passed into the method as arguments.
It returns a Result of Payout.
Sourcepub async fn bank_codes_ke(&self) -> Result<Vec<BankCodes>>
pub async fn bank_codes_ke(&self) -> Result<Vec<BankCodes>>
The bank_codes_ke
method gets all bank codes from the IntaSend’s API.
This depends on the payload struct (PayoutStatusRequest
) passed into the method as arguments
It returns a Result of Vec of BankCodes