Documentation
¶
Index ¶
- type APIResponse
- type AccountBalanceRequest
- type B2CRequest
- type Body
- type CallbackMeta
- type GenericAPIResponse
- func (gRes *GenericAPIResponse) ConversationID() string
- func (gRes *GenericAPIResponse) Error() string
- func (gRes *GenericAPIResponse) ErrorCode() string
- func (gRes *GenericAPIResponse) ErrorMessage() string
- func (gRes *GenericAPIResponse) OriginatorConversationID() string
- func (gRes *GenericAPIResponse) ResponseCode() string
- func (gRes *GenericAPIResponse) ResponseDescription() string
- func (gRes *GenericAPIResponse) Succeeded() bool
- type IncomingTransactionOnfon
- func (tx *IncomingTransactionOnfon) Amount() float64
- func (tx *IncomingTransactionOnfon) B2CRecipientIsRegisteredCustomerV2() bool
- func (tx *IncomingTransactionOnfon) B2CUtilityAccountAvailableFundsV2() float64
- func (tx *IncomingTransactionOnfon) CompletedDateTime() time.Time
- func (tx *IncomingTransactionOnfon) MSISDN() string
- func (tx *IncomingTransactionOnfon) Succeeded() bool
- type Item
- type MpesaPayload
- type ReversalRequest
- type STKCallback
- type STKPayload
- type Transaction
- func (tx *Transaction) B2CChargesPaidAccountAvailableFunds() float64
- func (tx *Transaction) B2CRecipientIsRegisteredCustomer() bool
- func (tx *Transaction) B2CUtilityAccountAvailableFunds() float64
- func (tx *Transaction) B2CWorkingAccountAvailableFunds() float64
- func (tx *Transaction) MSISDN() string
- func (tx *Transaction) QueueTimeoutURL() string
- func (tx *Transaction) ReceiverPartyPublicName() string
- func (tx *Transaction) Succeeded() bool
- func (tx *Transaction) TransactionAmount() float64
- func (tx *Transaction) TransactionCompletedDateTime() time.Time
- func (tx *Transaction) TransactionReceipt() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type APIResponse struct { ConversationID string `json:"ConversationID"` OriginatorConversationID string `json:"OriginatorConversationID"` ResponseCode string `json:"ResponseCode"` ResponseDescription string `json:"ResponseDescription"` }
APIResponse is response returned after interacting with mpesa API
func (*APIResponse) Succeeded ¶
func (apiRes *APIResponse) Succeeded() bool
Succeeded checks whether response was successful
type AccountBalanceRequest ¶
type AccountBalanceRequest struct { CommandID string `json:"CommandID,omitempty"` PartyA int32 `json:"PartyA,omitempty"` IdentifierType int32 `json:"IdentifierType,omitempty"` Remarks string `json:"Remarks,omitempty"` Initiator string `json:"Initiator,omitempty"` SecurityCredential string `json:"SecurityCredential,omitempty"` QueueTimeOutURL string `json:"QueueTimeOutURL,omitempty"` ResultURL string `json:"ResultURL,omitempty"` }
AccountBalanceRequest is request to make balance inquiry
type B2CRequest ¶
type B2CRequest struct { InitiatorName string `json:"InitiatorName,omitempty"` SecurityCredential string `json:"SecurityCredential,omitempty"` CommandID string `json:"CommandID,omitempty"` Amount string `json:"Amount,omitempty"` PartyA string `json:"PartyA,omitempty"` PartyB int64 `json:"PartyB,omitempty"` Remarks string `json:"Remarks,omitempty"` QueueTimeOutURL string `json:"QueueTimeOutURL,omitempty"` ResultURL string `json:"ResultURL,omitempty"` Occassion string `json:"Occassion,omitempty"` }
B2CRequest is request to transact between an M-Pesa short code to a phone number registered on M-Pesa.
type CallbackMeta ¶
type CallbackMeta struct {
Item []Item `json:"Item,omitempty"`
}
CallbackMeta is response body for successful response
func (*CallbackMeta) GetAmount ¶
func (c *CallbackMeta) GetAmount() float32
GetAmount returns the transaction amount
func (*CallbackMeta) GetTransTime ¶
func (c *CallbackMeta) GetTransTime() time.Time
GetTransTime returns the transaction time
func (*CallbackMeta) MpesaReceiptNumber ¶
func (c *CallbackMeta) MpesaReceiptNumber() string
MpesaReceiptNumber returns the receipt number
func (*CallbackMeta) PhoneNumber ¶
func (c *CallbackMeta) PhoneNumber() string
PhoneNumber returns the phone number
type GenericAPIResponse ¶
GenericAPIResponse is generic API response
func (*GenericAPIResponse) ConversationID ¶
func (gRes *GenericAPIResponse) ConversationID() string
ConversationID returns the conversation id
func (*GenericAPIResponse) Error ¶
func (gRes *GenericAPIResponse) Error() string
Error returns the error
func (*GenericAPIResponse) ErrorCode ¶
func (gRes *GenericAPIResponse) ErrorCode() string
ErrorCode returns the error code
func (*GenericAPIResponse) ErrorMessage ¶
func (gRes *GenericAPIResponse) ErrorMessage() string
ErrorMessage returns the error message
func (*GenericAPIResponse) OriginatorConversationID ¶
func (gRes *GenericAPIResponse) OriginatorConversationID() string
OriginatorConversationID returns the originator conversation id
func (*GenericAPIResponse) ResponseCode ¶
func (gRes *GenericAPIResponse) ResponseCode() string
ResponseCode returns the response code
func (*GenericAPIResponse) ResponseDescription ¶
func (gRes *GenericAPIResponse) ResponseDescription() string
ResponseDescription returns the response description
func (*GenericAPIResponse) Succeeded ¶
func (gRes *GenericAPIResponse) Succeeded() bool
Succeeded checks whether the request succeeded
type IncomingTransactionOnfon ¶
type IncomingTransactionOnfon struct { OriginatorConversationID string `json:"originatorConversationID"` ResultType string `json:"resultType"` ResultCode string `json:"resultCode"` ResultDesc string `json:"resultDesc"` ConversationID string `json:"conversationID"` TransactionAmount string `json:"transactionAmount"` TransactionID string `json:"transactionID"` TransactionReceipt string `json:"transactionReceipt"` ReceiverPartyPublicName string `json:"receiverPartyPublicName"` B2CUtilityAccountAvailableFunds string `json:"b2CUtilityAccountAvailableFunds"` TransactionCompletedDateTime string `json:"transactionCompletedDateTime"` B2CRecipientIsRegisteredCustomer string `json:"b2CRecipientIsRegisteredCustomer"` }
IncomingTransactionOnfon is the payload for incoming transaction from onfon
func (*IncomingTransactionOnfon) Amount ¶
func (tx *IncomingTransactionOnfon) Amount() float64
Amount retrievs transaction amount
func (*IncomingTransactionOnfon) B2CRecipientIsRegisteredCustomerV2 ¶
func (tx *IncomingTransactionOnfon) B2CRecipientIsRegisteredCustomerV2() bool
B2CRecipientIsRegisteredCustomerV2 checks whether the b2c recipient is a registred customer
func (*IncomingTransactionOnfon) B2CUtilityAccountAvailableFundsV2 ¶
func (tx *IncomingTransactionOnfon) B2CUtilityAccountAvailableFundsV2() float64
B2CUtilityAccountAvailableFundsV2 retrievs B2CUtilityAccountAvailableFunds as float64
func (*IncomingTransactionOnfon) CompletedDateTime ¶
func (tx *IncomingTransactionOnfon) CompletedDateTime() time.Time
CompletedDateTime is time the transacction was completed
func (*IncomingTransactionOnfon) MSISDN ¶
func (tx *IncomingTransactionOnfon) MSISDN() string
MSISDN retrieves phone number
func (*IncomingTransactionOnfon) Succeeded ¶
func (tx *IncomingTransactionOnfon) Succeeded() bool
Succeeded checks whether transaction was successful
type Item ¶
type Item struct { Name string `json:"Name,omitempty"` Value interface{} `json:"Value,omitempty"` }
Item ...
type MpesaPayload ¶
type MpesaPayload struct { TransactionType string TransID string TransTime string TransAmount string BusinessShortCode string BillRefNumber string InvoiceNumber string OrgAccountBalance string ThirdPartyTransID string MSISDN string FirstName string MiddleName string LastName string }
MpesaPayload is incoming paybill transaction from mpesa
type ReversalRequest ¶
type ReversalRequest struct { CommandID string `json:"CommandID,omitempty"` ReceiverParty int32 `json:"ReceiverParty,omitempty"` ReceiverIdentifierType int64 `json:"ReceiverIdentifierType,omitempty"` Remarks string `json:"Remarks,omitempty"` Initiator string `json:"Initiator,omitempty"` SecurityCredential string `json:"SecurityCredential,omitempty"` QueueTimeOutURL string `json:"QueueTimeOutURL,omitempty"` ResultURL string `json:"ResultURL,omitempty"` TransactionID string `json:"TransactionID,omitempty"` Occassion string `json:"Occassion,omitempty"` }
ReversalRequest is request to reverses a M-Pesa transaction.
type STKCallback ¶
type STKCallback struct { MerchantRequestID string `json:"MerchantRequestID,omitempty"` CheckoutRequestID string `json:"CheckoutRequestID,omitempty"` ResultCode int `json:"ResultCode,omitempty"` ResultDesc string `json:"ResultDesc,omitempty"` CallbackMetadata CallbackMeta `json:"CallbackMetadata,omitempty"` }
STKCallback ...
type STKPayload ¶
type STKPayload struct {
Body Body `json:"Body,omitempty"`
}
STKPayload is incoming transaction payload for stk push
type Transaction ¶
type Transaction struct { Result struct { ResultType int `json:"ResultType"` ResultCode int `json:"ResultCode"` ResultDesc string `json:"ResultDesc"` OriginatorConversationID string `json:"OriginatorConversationID"` ConversationID string `json:"ConversationID"` TransactionID string `json:"TransactionID"` ResultParameters struct { ResultParameter []struct { Key string `json:"Key"` Value interface{} `json:"Value"` } `json:"ResultParameter"` } `json:"ResultParameters"` ReferenceData struct { ReferenceItem struct { Key string `json:"Key"` Value interface{} `json:"Value"` } `json:"ReferenceItem"` } `json:"ReferenceData"` } `json:"Result"` }
Transaction is response from mpesa
func (*Transaction) B2CChargesPaidAccountAvailableFunds ¶
func (tx *Transaction) B2CChargesPaidAccountAvailableFunds() float64
B2CChargesPaidAccountAvailableFunds ...
func (*Transaction) B2CRecipientIsRegisteredCustomer ¶
func (tx *Transaction) B2CRecipientIsRegisteredCustomer() bool
B2CRecipientIsRegisteredCustomer checks whether the b2c recipient is a registred customer
func (*Transaction) B2CUtilityAccountAvailableFunds ¶
func (tx *Transaction) B2CUtilityAccountAvailableFunds() float64
B2CUtilityAccountAvailableFunds returns the utility funds available
func (*Transaction) B2CWorkingAccountAvailableFunds ¶
func (tx *Transaction) B2CWorkingAccountAvailableFunds() float64
B2CWorkingAccountAvailableFunds returns the available funds for the organization
func (*Transaction) QueueTimeoutURL ¶
func (tx *Transaction) QueueTimeoutURL() string
QueueTimeoutURL ...
func (*Transaction) ReceiverPartyPublicName ¶
func (tx *Transaction) ReceiverPartyPublicName() string
ReceiverPartyPublicName ...
func (*Transaction) Succeeded ¶
func (tx *Transaction) Succeeded() bool
Succeeded checks whether transaction was successful
func (*Transaction) TransactionAmount ¶
func (tx *Transaction) TransactionAmount() float64
TransactionAmount retrievs transaction phone number
func (*Transaction) TransactionCompletedDateTime ¶
func (tx *Transaction) TransactionCompletedDateTime() time.Time
TransactionCompletedDateTime is time the transacction was completed
func (*Transaction) TransactionReceipt ¶
func (tx *Transaction) TransactionReceipt() string
TransactionReceipt retrieves transaction receipt