use serde::{Deserialize, Serialize};
use std::fmt::{Display, Formatter, Result as FmtResult};
#[derive(Debug, Serialize, Deserialize)]
pub enum CommandId {
TransactionReversal,
SalaryPayment,
BusinessPayment,
PromotionPayment,
AccountBalance,
CustomerPayBillOnline,
TransactionStatusQuery,
CheckIdentity,
BusinessPayBill,
BusinessBuyGoods,
DisburseFundsToBusiness,
BusinessToBusinessTransfer,
BusinessTransferFromMMFToUtility,
}
impl Display for CommandId {
fn fmt(&self, f: &mut Formatter) -> FmtResult {
write!(f, "{}", self)
}
}
#[derive(Debug, Serialize, Copy, Clone)]
pub enum IdentifierTypes {
MSISDN = 1,
TillNumber = 2,
ShortCode = 4,
}
impl Display for IdentifierTypes {
fn fmt(&self, f: &mut Formatter) -> FmtResult {
write!(f, "{}", *self as u16)
}
}
#[derive(Debug, Copy, Clone, Deserialize)]
#[allow(unused)]
pub enum MpesaResponseCode {
Success = 0,
InsufficientFunds = 1,
LessThanMinimum = 2,
MoreThanMaximum = 3,
ExceededDailyLimit = 4,
ExceededMinimumBalance = 5,
UnresolvedPrimaryParty = 6,
UnresolvedReceiverParty = 7,
ExceededMaximumBalance = 8,
InvalidDebitAccount = 11,
InvalidCreditAccount = 12,
UnresolvedDebitAccount = 13,
UnresolvedCreditAccount = 14,
DuplicateDetected = 15,
InternalFailure = 17,
UnresolvedInitiator = 20,
TrafficBlocking = 26,
}
impl Display for MpesaResponseCode {
fn fmt(&self, f: &mut Formatter) -> FmtResult {
write!(f, "{}", *self as u16)
}
}
#[derive(Debug, Serialize, Deserialize)]
pub enum ResponseType {
Complete,
Cancelled,
}
impl Display for ResponseType {
fn fmt(&self, f: &mut Formatter) -> FmtResult {
write!(f, "{}", self)
}
}