mpesaoverlay

package module
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: 2 Imported by: 0

README

MpesaOverlay

CI CD CodeQL GitHub GitHub code size in bytes GitHub go.mod Go version (subdirectory of monorepo) go.dev reference Go Report Card Coverage Status

MpesaOverlay is modern, scalable, secure open source and patent-free API overlay for the Daraja API by Safaricom written in Go.

It accepts connections over various API (i.e. REST, GRPC, Pub/Sub), thus making a seamless bridge between the client and the Daraja API. It is used as a middleware for building complex Payments solutions.

Features

  • Interface bridging (i.e. REST, GRPC, Pub/Sub)
  • CLI for managing the platform
  • Platform logging and instrumentation support
  • Container-based deployment using Docker

Upcoming features:

  • Ledger support. The platform should be able to store transactions in a ledger.
  • Clusterization. The platform should be able to run in a cluster of nodes for high availability and scalability.
  • Analytics and reporting. The should provide a way for developers to generate reports on their Mpesa transactions.
  • Event sourcing support
  • SDKs for various programming languages
  • Documentation: The API should have comprehensive and up-to-date documentation.

Architecture

Components

MpesaOverlay platform is comprised of the following services:

  • rest-adapter Provides a REST interface for accessing communication channels
  • grpc-adapter Provides a gRPC interface for accessing communication channels
  • pubsub-adapter Provides a Pub/Sub interface for accessing communication channels
  • mpesa-cli Command line interface

Mpesa Overlay Architecture

Documentation

Overview

Package mpesaoverlay is the root package for the mpesaoverlay services. The mpesaoverlay services are divided into subpackages:

  1. cli: responsible for the command line interface.

  2. pkg: responsible for the mpesaoverlay package.

  3. mqtt: responsible for the mqtt package.

  4. grpc: responsible for the grpc package.

Index

Constants

View Source
const SVCName = "mpesaoverlay"

SVCName is the name of the service.

Variables

View Source
var (
	// Version represents the last service git tag in git history.
	// It's meant to be set using go build ldflags:
	// -ldflags "-X 'github.com/0x6flab/mpesaoverlay.Version=0.0.0'".
	Version = "0.0.0"
	// Commit represents the service git commit hash.
	// It's meant to be set using go build ldflags:
	// -ldflags "-X 'github.com/0x6flab/mpesaoverlay.Commit=ffffffff'".
	Commit = "ffffffff"
	// BuildTime represetns the service build time.
	// It's meant to be set using go build ldflags:
	// -ldflags "-X 'github.com/0x6flab/mpesaoverlay.BuildTime=1970-01-01_00:00:00'".
	BuildTime = "1970-01-01_00:00:00"
)

Functions

func Health

func Health(service string) http.HandlerFunc

Health exposes an HTTP handler for retrieving service health.

Types

type HealthInfo

type HealthInfo struct {
	// Status contains service status.
	Status string `json:"status"`

	// Service contains service name.
	Service string `json:"service"`

	// Version contains current service version.
	Version string `json:"version"`

	// Commit represents the git hash commit.
	Commit string `json:"commit"`

	// BuildTime contains service build time.
	BuildTime string `json:"build_time"`
}

HealthInfo contains version endpoint response.

Directories

Path Synopsis
Package cli provides the command line interface for the mpesaoverlay.
Package cli provides the command line interface for the mpesaoverlay.
cmd
Package cmd provides the entrypoint for all the mpesaoverlay services.
Package cmd provides the entrypoint for all the mpesaoverlay services.
cli
Package main provides the entrypoint for the mpesaoverlay cli.
Package main provides the entrypoint for the mpesaoverlay cli.
grpc
Package main provides the entrypoint for the grpc service.
Package main provides the entrypoint for the grpc service.
mqtt
Package main provides the entrypoint for the mqtt service.
Package main provides the entrypoint for the mqtt service.
Package example is the root package for the example services.
Package example is the root package for the example services.
mqtt
Package sdk provides an example of how to use SDK method.
Package sdk provides an example of how to use SDK method.
mqtt/auth
Package main provides an example of how to use Token method.
Package main provides an example of how to use Token method.
mqtt/b2c
Package main provides an example of how to use B2C payment method.
Package main provides an example of how to use B2C payment method.
mqtt/balance
Package main provides an example of how to use AccountBalance method.
Package main provides an example of how to use AccountBalance method.
mqtt/c2bregisterurl
Package main provides an example of how to use C2BRegisterURL method.
Package main provides an example of how to use C2BRegisterURL method.
mqtt/c2bsimulate
Package main provides an example of how to use C2BSimulate method.
Package main provides an example of how to use C2BSimulate method.
mqtt/qrcode
Package main provides an example of how to use GenerateQR method.
Package main provides an example of how to use GenerateQR method.
mqtt/query
Package main provides an example of how to use ExpressQuery method.
Package main provides an example of how to use ExpressQuery method.
mqtt/reversal
Package main provides an example of how to use Reverse method.
Package main provides an example of how to use Reverse method.
mqtt/stkpush
Package main provides an example of how to use ExpressSimulate method.
Package main provides an example of how to use ExpressSimulate method.
mqtt/tax
Package main provides an example of how to use RemitTax method.
Package main provides an example of how to use RemitTax method.
mqtt/transaction
Package main provides an example of how to use TransactionStatus method.
Package main provides an example of how to use TransactionStatus method.
sdk
Package sdk provides an example of how to use SDK method.
Package sdk provides an example of how to use SDK method.
sdk/auth
Package main provides an example of how to use Token method.
Package main provides an example of how to use Token method.
sdk/b2c
Package main provides an example of how to use B2C payment method.
Package main provides an example of how to use B2C payment method.
sdk/balance
Package main provides an example of how to use AccountBalance method.
Package main provides an example of how to use AccountBalance method.
sdk/c2bregisterurl
Package main provides an example of how to use C2BRegisterURL method.
Package main provides an example of how to use C2BRegisterURL method.
sdk/c2bsimulate
Package main provides an example of how to use C2BSimulate method.
Package main provides an example of how to use C2BSimulate method.
sdk/qrcode
Package main provides an example of how to use GenerateQR method.
Package main provides an example of how to use GenerateQR method.
sdk/query
Package main provides an example of how to use ExpressQuery method.
Package main provides an example of how to use ExpressQuery method.
sdk/reversal
Package main provides an example of how to use Reverse method.
Package main provides an example of how to use Reverse method.
sdk/stkpush
Package main provides an example of how to use ExpressSimulate method.
Package main provides an example of how to use ExpressSimulate method.
sdk/tax
Package main provides an example of how to use RemitTax method.
Package main provides an example of how to use RemitTax method.
sdk/transaction
Package main provides an example of how to use TransactionStatus method.
Package main provides an example of how to use TransactionStatus method.
Package grpc provides an gRPC interface for the MpesaOverlay API.
Package grpc provides an gRPC interface for the MpesaOverlay API.
api
Package api provides the grpc api for the mpesaoverlay.
Package api provides the grpc api for the mpesaoverlay.
Package mqtt provides an MQTT interface for the MpesaOverlay API.
Package mqtt provides an MQTT interface for the MpesaOverlay API.
pkg
Package pkg provides a wrapper around the Mpesa API.
Package pkg provides a wrapper around the Mpesa API.
mpesa
Package mpesa provides a wrapper around the Mpesa API.
Package mpesa provides a wrapper around the Mpesa API.
mpesa/middleware
Package middleware provides a set of middleware for use with MpesaOverlay.
Package middleware provides a set of middleware for use with MpesaOverlay.
mpesa/middleware/database
Package database provides a middleware for database.
Package database provides a middleware for database.
mpesa/middleware/database/postgres
Package postgres implements the postgres database for the logging middleware to be used with MpesaOverlay SDK.
Package postgres implements the postgres database for the logging middleware to be used with MpesaOverlay SDK.
mpesa/middleware/logging
Package logging provides a middleware for logging.
Package logging provides a middleware for logging.
mpesa/middleware/logging/logrus
Package logrus implements the logrus logger for the logging middleware to be used with MpesaOverlay SDK.
Package logrus implements the logrus logger for the logging middleware to be used with MpesaOverlay SDK.
mpesa/middleware/logging/slog
Package slog implements the slog logger for the logging middleware to be used with MpesaOverlay SDK.
Package slog implements the slog logger for the logging middleware to be used with MpesaOverlay SDK.
mpesa/middleware/logging/zap
Package zap implements the zap logger for the logging middleware to be used with MpesaOverlay SDK.
Package zap implements the zap logger for the logging middleware to be used with MpesaOverlay SDK.
mpesa/middleware/metrics
Package metrics provides a middleware for metrics.
Package metrics provides a middleware for metrics.
mpesa/middleware/metrics/prometheus
Package prometheus provides a Prometheus metrics middleware for the MpesaOverlay API.
Package prometheus provides a Prometheus metrics middleware for the MpesaOverlay API.

Jump to

Keyboard shortcuts

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