mqtt

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package mqtt provides an MQTT interface for the MpesaOverlay API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hook

type Hook struct {
	mqtt.HookBase

	Service
	// contains filtered or unexported fields
}

func NewHook

func NewHook(logger *zap.Logger, svc Service) *Hook

NewHook returns a new MQTT hook.

func (*Hook) ID

func (h *Hook) ID() string

func (*Hook) Init

func (h *Hook) Init(_ interface{}) error

func (*Hook) OnConnect

func (h *Hook) OnConnect(cl *mqtt.Client, _ packets.Packet) error

func (*Hook) OnDisconnect

func (h *Hook) OnDisconnect(cl *mqtt.Client, err error, expire bool)

func (*Hook) OnPublished

func (h *Hook) OnPublished(cl *mqtt.Client, pk packets.Packet)

func (*Hook) OnSubscribed

func (h *Hook) OnSubscribed(cl *mqtt.Client, pk packets.Packet, _ []byte)

func (*Hook) OnUnsubscribed

func (h *Hook) OnUnsubscribed(cl *mqtt.Client, pk packets.Packet)

func (*Hook) Provides

func (h *Hook) Provides(b byte) bool

func (*Hook) SetServer

func (h *Hook) SetServer(s *mqtt.Server)

type Service

type Service interface {
	Token(pk packets.Packet) (mpesa.TokenResp, error)

	ExpressQuery(pk packets.Packet) (mpesa.ExpressQueryResp, error)

	ExpressSimulate(pk packets.Packet) (mpesa.ExpressSimulateResp, error)

	B2CPayment(pk packets.Packet) (mpesa.B2CPaymentResp, error)

	AccountBalance(pk packets.Packet) (mpesa.AccountBalanceResp, error)

	C2BRegisterURL(pk packets.Packet) (mpesa.C2BRegisterURLResp, error)

	C2BSimulate(pk packets.Packet) (mpesa.C2BSimulateResp, error)

	GenerateQR(pk packets.Packet) (mpesa.GenerateQRResp, error)

	Reverse(pk packets.Packet) (mpesa.ReverseResp, error)

	TransactionStatus(pk packets.Packet) (mpesa.TransactionStatusResp, error)

	RemitTax(pk packets.Packet) (mpesa.RemitTaxResp, error)
}

Service is the interface that provides methods for the MpesaOverlay SDK.

func NewService

func NewService(sdk mpesa.SDK) Service

NewService returns a new MQTT service.

Jump to

Keyboard shortcuts

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