Skip to main content

ErrorCode

Enum ErrorCode 

Source
pub enum ErrorCode {
Show 88 variants InvalidAppKey, InvalidPaymentId, ProcessFailed, InvalidFirstPaymentDate, InvalidFrequency, InvalidAmount, InvalidCurrency, InvalidIntent, InvalidWallet, InvalidOtp, InvalidPin, InvalidReceiverMsisdn, ResendLimitExceeded, WrongPin, WrongPinCountExceeded, WrongVerificationCode, WrongVerificationLimit, OtpVerificationTimeExpired, PinVerificationTimeExpired, ExceptionOccurred, InvalidMandateId, MissingMandateId, InsufficientBalance, ExceptionOccurredAlt, InvalidRequestBody, ReversalAmountExceedsOriginal, MandateAlreadyExists, ReversalError, DuplicateRequest, MandateTypeError, InvalidMerchantInvoiceNumber, InvalidTransferType, TransactionNotFound, ReversalNotAllowed, AccountStateError, AccountPermissionError, AccountStateErrorAlt, AccountStateErrorAlt2, AccountStateErrorAlt3, AccountStateErrorAlt4, AccountStateErrorAlt5, AccountStateErrorAlt6, SecurityError, SecurityErrorAlt, SubscriptionError, SubscriptionErrorAlt, TlvFormat, InvalidPayerReference, InvalidMerchantCallbackUrl, AgreementAlreadyExists, InvalidAgreementId, AgreementStateError, AgreementStateErrorAlt, AgreementStateErrorAlt2, AgreementStateErrorAlt3, InvalidPaymentState, NotBkashAccount, CustomerWalletError, MultipleOtpRequestDenied, PaymentExecutionPrerequisiteNotMet, InitiatorOnlyAction, PaymentAlreadyCompleted, ModeNotValid, ProductModeUnavailable, MandatoryFieldMissing, AgreementSharingNotAllowed, AgreementPermissionError, PaymentAlreadyCompletedAlt, AgreementAlreadyCancelled, RefundInvalidAmount, RefundAmountExceedsAvailable, RefundTransactionNotEligible, RefundAlreadyFullyRefunded, RefundDuplicate, RefundChargeExceedsOriginal, RefundNotPermitted, RefundMaxRefundsReached, RefundInvalidReference, RefundNotFound, RefundInvalidState, MerchantNotPermitted, AgreementExecutionAlreadyCompleted, PaymentExecutionAlreadyCompleted, InvalidPlatform, AuthorizedPaymentAlreadyProcessed, TransactionNotYetCompleted, SystemUndergoingMaintenance, Other(String),
}
Expand description

Strongly-typed view of bKash’s errorCode field.

Unknown codes are captured as ErrorCode::Other so the client never panics on a new code bKash may introduce.

Variants§

§

InvalidAppKey

2001 — Invalid App Key.

§

InvalidPaymentId

2002 — Invalid Payment ID.

§

ProcessFailed

2003 — Process failed.

§

InvalidFirstPaymentDate

2004 — Invalid firstPaymentDate.

§

InvalidFrequency

2005 — Invalid frequency.

§

InvalidAmount

2006 — Invalid amount.

§

InvalidCurrency

2007 — Invalid currency.

§

InvalidIntent

2008 — Invalid intent.

§

InvalidWallet

2009 — Invalid Wallet.

§

InvalidOtp

2010 — Invalid OTP.

§

InvalidPin

2011 — Invalid PIN.

§

InvalidReceiverMsisdn

2012 — Invalid Receiver MSISDN.

§

ResendLimitExceeded

2013 — Resend Limit Exceeded.

§

WrongPin

2014 — Wrong PIN.

§

WrongPinCountExceeded

2015 — Wrong PIN count exceeded.

§

WrongVerificationCode

2016 — Wrong verification code.

§

WrongVerificationLimit

2017 — Wrong verification limit.

§

OtpVerificationTimeExpired

2018 — OTP verification time expired.

§

PinVerificationTimeExpired

2019 — PIN verification time expired.

§

ExceptionOccurred

2020 — Exception occurred.

§

InvalidMandateId

2021 — Invalid Mandate ID.

§

MissingMandateId

2022 — Missing Mandate ID.

§

InsufficientBalance

2023 — Insufficient Balance.

§

ExceptionOccurredAlt

2024 — Exception occurred (alternate).

§

InvalidRequestBody

2025 — Invalid request body.

§

ReversalAmountExceedsOriginal

2026 — Reversal amount > original.

§

MandateAlreadyExists

2027 — Mandate already exists.

§

ReversalError

2028 — Reversal error.

§

DuplicateRequest

2029 — Duplicate request.

§

MandateTypeError

2030 — Mandate type error.

§

InvalidMerchantInvoiceNumber

2031 — Invalid merchant invoice number.

§

InvalidTransferType

2032 — Invalid transfer type.

§

TransactionNotFound

2033 — Transaction not found.

§

ReversalNotAllowed

2034 — Reversal not allowed.

§

AccountStateError

2035 — Account state error.

§

AccountPermissionError

2036 — Account permission error.

§

AccountStateErrorAlt

2037 — Account state error (alt).

§

AccountStateErrorAlt2

2038 — Account state error (alt 2).

§

AccountStateErrorAlt3

2039 — Account state error (alt 3).

§

AccountStateErrorAlt4

2040 — Account state error (alt 4).

§

AccountStateErrorAlt5

2041 — Account state error (alt 5).

§

AccountStateErrorAlt6

2042 — Account state error (alt 6).

§

SecurityError

2043 — Security error.

§

SecurityErrorAlt

2044 — Security error (alt).

§

SubscriptionError

2045 — Subscription error.

§

SubscriptionErrorAlt

2046 — Subscription error (alt).

§

TlvFormat

2047 — TLV format error.

§

InvalidPayerReference

2048 — Invalid Payer Reference.

§

InvalidMerchantCallbackUrl

2049 — Invalid Merchant Callback URL.

§

AgreementAlreadyExists

2050 — Agreement already exists.

§

InvalidAgreementId

2051 — Invalid Agreement ID.

§

AgreementStateError

2052 — Agreement state error.

§

AgreementStateErrorAlt

2053 — Agreement state error (alt).

§

AgreementStateErrorAlt2

2054 — Agreement state error (alt 2).

§

AgreementStateErrorAlt3

2055 — Agreement state error (alt 3).

§

InvalidPaymentState

2056 — Invalid Payment State.

§

NotBkashAccount

2057 — Not a bKash Account.

§

CustomerWalletError

2058 — Customer Wallet error.

§

MultipleOtpRequestDenied

2059 — Multiple OTP request denied.

§

PaymentExecutionPrerequisiteNotMet

2060 — Payment execution pre-requisite not met.

§

InitiatorOnlyAction

2061 — Initiator-only action.

§

PaymentAlreadyCompleted

2062 — Payment already completed.

§

ModeNotValid

2063 — Mode not valid.

§

ProductModeUnavailable

2064 — Product mode unavailable.

§

MandatoryFieldMissing

2065 — Mandatory field missing.

§

AgreementSharingNotAllowed

2066 — Agreement sharing not allowed.

§

AgreementPermissionError

2067 — Agreement permission error.

§

PaymentAlreadyCompletedAlt

2068 — Payment already completed (alt).

§

AgreementAlreadyCancelled

2069 — Agreement already cancelled.

§

RefundInvalidAmount

2071 — Refund: invalid amount.

§

RefundAmountExceedsAvailable

2072 — Refund: amount exceeds available.

§

RefundTransactionNotEligible

2073 — Refund: transaction not eligible.

§

RefundAlreadyFullyRefunded

2074 — Refund: already fully refunded.

§

RefundDuplicate

2075 — Refund: duplicate refund.

§

RefundChargeExceedsOriginal

2076 — Refund: charge greater than original.

§

RefundNotPermitted

2077 — Refund: not permitted.

§

RefundMaxRefundsReached

2078 — Refund: maximum refunds reached.

§

RefundInvalidReference

2079 — Refund: invalid refund reference.

§

RefundNotFound

2080 — Refund: not found.

§

RefundInvalidState

2081 — Refund: not allowed in current state.

§

MerchantNotPermitted

2082 — Merchant not permitted.

§

AgreementExecutionAlreadyCompleted

2116 — Agreement execution already completed.

§

PaymentExecutionAlreadyCompleted

2117 — Payment execution already completed.

§

InvalidPlatform

2118 — Invalid Platform.

§

AuthorizedPaymentAlreadyProcessed

2119 — Authorized payment already processed.

§

TransactionNotYetCompleted

2127 — Transaction not yet completed.

§

SystemUndergoingMaintenance

503 — System undergoing maintenance.

§

Other(String)

Any unknown / unrecognised error code. Preserved as a raw string.

Implementations§

Source§

impl ErrorCode

Source

pub fn from_code(code: &str) -> Self

Parse a bKash errorCode string into a typed ErrorCode.

Source

pub fn as_code(&self) -> &str

Returns the string code (e.g. "2001").

Source

pub fn is_transient(&self) -> bool

Returns true if this error is a transient condition eligible for retry (e.g. system maintenance).

Source

pub fn is_auth(&self) -> bool

Returns true if this error is a credential / authorization failure that warrants clearing the token cache and forcing a re-grant.

Trait Implementations§

Source§

impl Clone for ErrorCode

Source§

fn clone(&self) -> ErrorCode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ErrorCode

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ErrorCode

Source§

fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for ErrorCode

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for ErrorCode

Source§

impl FromStr for ErrorCode

Source§

type Err = Infallible

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for ErrorCode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ErrorCode

Source§

fn eq(&self, other: &ErrorCode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ErrorCode

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ErrorCode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more