Documentation
¶
Index ¶
- Constants
- func GeneratePassword(shortCode, passkey, timestamp string) string
- type B2B
- type B2C
- type BalanceInquiry
- type C2B
- type C2BRegisterURL
- type Env
- type Express
- type MpesaCallbackResponse
- type MpesaResponse
- type Pull
- type Reversal
- type Service
- func (s Service) B2BRequest(b2b B2B) (*MpesaResponse, error)
- func (s Service) B2CRequest(b2c B2C) (*MpesaResponse, error)
- func (s Service) BalanceInquiry(balanceInquiry *BalanceInquiry) (*MpesaResponse, error)
- func (s Service) C2BRegisterURL(c2bRegisterURL C2BRegisterURL) (*MpesaResponse, error)
- func (s Service) C2BSimulation(c2b C2B) (*MpesaResponse, error)
- func (s Service) GetSecurityCredential(initiatorPassword string) (string, error)
- func (s Service) MpesaExpress(express Express) (*MpesaResponse, error)
- func (s Service) PullTransactions(pull Pull) (*MpesaResponse, error)
- func (s Service) Reversal(reversal Reversal) (*MpesaResponse, error)
- func (s Service) TransactionStatus(express Express) (*MpesaResponse, error)
Constants ¶
const ( // SANDBOX is the sandbox env tag SANDBOX = iota // PRODUCTION is the production env tag PRODUCTION )
Variables ¶
This section is empty.
Functions ¶
func GeneratePassword ¶
GeneratePassword by base64 encoding BusinessShortcode, Passkey, and Timestamp
Types ¶
type B2B ¶
type B2B struct { Initiator string SecurityCredential string CommandID string SenderIdentifierType string RecieverIdentifierType string Amount int PartyA string PartyB string Remarks string AccountReference string QueueTimeOutURL string ResultURL string }
B2B is a model
type B2C ¶
type B2C struct { InitiatorName string SecurityCredential string CommandID string Amount int PartyA string PartyB string Remarks string QueueTimeOutURL string ResultURL string Occassion string }
B2C is a model
type BalanceInquiry ¶
type BalanceInquiry struct { Initiator string SecurityCredential string CommandID string PartyA string IdentifierType string Remarks string QueueTimeOutURL string ResultURL string }
BalanceInquiry is a model
type C2BRegisterURL ¶
type C2BRegisterURL struct { ShortCode string ResponseType string ConfirmationURL string ValidationURL string }
RegisterURL is a model
type Express ¶
type Express struct { BusinessShortCode string Password string Timestamp string TransactionType string Amount int PartyA string PartyB string PhoneNumber string CallBackURL string AccountReference string TransactionDesc string }
Express is a model
type MpesaCallbackResponse ¶
type MpesaCallbackResponse struct { Body struct { StkCallback struct { MerchantRequestID string `json:"MerchantRequestID"` CheckoutRequestID string `json:"CheckoutRequestID"` ResultCode int `json:"ResultCode"` ResultDesc string `json:"ResultDesc"` CallbackMetadata struct { Item []struct { Name string `json:"Name"` Value string `json:"Value"` } `json:"Item"` } `json:"CallbackMetadata"` } `json:"stkCallback"` } `json:"Body"` }
Mpesa Response Callback model
type MpesaResponse ¶
type Reversal ¶
type Reversal struct { Initiator string SecurityCredential string CommandID string TransactionID string Amount int ReceiverParty string ReceiverIdentifierType string QueueTimeOutURL string ResultURL string Remarks string Occassion string }
Reversal is a model
type Service ¶
Service is an Mpesa Service
func (Service) B2BRequest ¶
func (s Service) B2BRequest(b2b B2B) (*MpesaResponse, error)
B2BRequest sends a new request
func (Service) B2CRequest ¶
func (s Service) B2CRequest(b2c B2C) (*MpesaResponse, error)
B2CRequest sends a new request
func (Service) BalanceInquiry ¶
func (s Service) BalanceInquiry(balanceInquiry *BalanceInquiry) (*MpesaResponse, error)
BalanceInquiry sends a balance inquiry
func (Service) C2BRegisterURL ¶
func (s Service) C2BRegisterURL(c2bRegisterURL C2BRegisterURL) (*MpesaResponse, error)
C2BRegisterURL requests
func (Service) C2BSimulation ¶
func (s Service) C2BSimulation(c2b C2B) (*MpesaResponse, error)
C2BSimulation sends a new request
func (Service) GetSecurityCredential ¶
GetSecurityCredential generates a security credential The security credential depends on the environment set
func (Service) MpesaExpress ¶
func (s Service) MpesaExpress(express Express) (*MpesaResponse, error)
Simulation requests user device for payment
func (Service) PullTransactions ¶
func (s Service) PullTransactions(pull Pull) (*MpesaResponse, error)
BalanceInquiry sends a balance inquiry
func (Service) Reversal ¶
func (s Service) Reversal(reversal Reversal) (*MpesaResponse, error)
Reversal requests a reversal?
func (Service) TransactionStatus ¶
func (s Service) TransactionStatus(express Express) (*MpesaResponse, error)
TransactionStatus gets status of a transaction