mpesa

package
v0.0.0-...-ed04d4c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// SANDBOX is the sandbox env tag
	SANDBOX = iota
	// PRODUCTION is the production env tag
	PRODUCTION
)

Variables

This section is empty.

Functions

This section is empty.

Types

type B2B

type B2B struct {
	Initiator              string
	SecurityCredential     string
	CommandID              string
	SenderIdentifierType   string
	RecieverIdentifierType string
	Amount                 string
	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             string
	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 C2B

type C2B struct {
	ShortCode     string
	CommandID     string
	Amount        string
	Msisdn        string
	BillRefNumber string
}

C2B is a model

type C2BRegisterURL

type C2BRegisterURL struct {
	ShortCode       string
	ResponseType    string
	ConfirmationURL string
	ValidationURL   string
}

RegisterURL is a model

type Env

type Env string

Env is the environment type

type Express

type Express struct {
	BusinessShortCode string
	Password          string
	Timestamp         string
	TransactionType   string
	Amount            string
	PartyA            string
	PartyB            string
	PhoneNumber       string
	CallBackURL       string
	AccountReference  string
	TransactionDesc   string
}

Express is a model

type Pull

type Pull struct {
	ShortCode  string
	StartDate  string
	EndDate    string
	PageNumber string
}

Pull is a model

type Reversal

type Reversal struct {
	Initiator              string
	SecurityCredential     string
	CommandID              string
	TransactionID          string
	Amount                 string
	ReceiverParty          string
	ReceiverIdentifierType string
	QueueTimeOutURL        string
	ResultURL              string
	Remarks                string
	Occassion              string
}

Reversal is a model

type Service

type Service struct {
	AppKey    string
	AppSecret string
	Env       int
}

Service is an Mpesa Service

func New

func New(appKey, appSecret string, env int) (Service, error)

New return a new Mpesa Service

func (Service) B2BRequest

func (s Service) B2BRequest(b2b B2B) (string, error)

B2BRequest sends a new request

func (Service) B2CRequest

func (s Service) B2CRequest(b2c B2C) (string, error)

B2CRequest sends a new request

func (Service) BalanceInquiry

func (s Service) BalanceInquiry(balanceInquiry BalanceInquiry) (string, error)

BalanceInquiry sends a balance inquiry

func (Service) C2BRegisterURL

func (s Service) C2BRegisterURL(c2bRegisterURL C2BRegisterURL) (string, error)

C2BRegisterURL requests

func (Service) C2BSimulation

func (s Service) C2BSimulation(c2b C2B) (string, error)

C2BSimulation sends a new request

func (Service) PullTransactions

func (s Service) PullTransactions(pull Pull) (string, error)

BalanceInquiry sends a balance inquiry

func (Service) Reversal

func (s Service) Reversal(reversal Reversal) (string, error)

Reversal requests a reversal?

func (Service) Simulation

func (s Service) Simulation(express Express) (Transaction, error)

Simulation requests user device for payment

func (Service) TransactionStatus

func (s Service) TransactionStatus(transaction Transaction) (string, error)

TransactionStatus gets status of a transaction

type Transaction

type Transaction struct {
	MerchantRequestID   string
	CheckoutRequestID   string
	ResponseCode        string
	ResponseDescription string
	CustomerMessage     string
	BusinessShortCode   string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL