b2c

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const SourceKey = "source"

Variables

This section is empty.

Functions

func B2CPaymentDB

func B2CPaymentDB(pb *b2c.B2CPayment) (*b2c_model.Payment, error)

B2CPaymentDB is wrapper to converts database model to protobuf b2c payment

func B2CPaymentPB

func B2CPaymentPB(db *b2c_model.Payment) (*b2c.B2CPayment, error)

B2CPaymentPB is wrapper to converts protobuf b2c payment to database model

func GetDailyStatDB

func GetDailyStatDB(pb *b2c.DailyStat) (*b2c_model.DailyStat, error)

GetDailyStatDB gets mpesa statistics model from protobuf message

func GetDailyStatPB

func GetDailyStatPB(db *b2c_model.DailyStat) (*b2c.DailyStat, error)

GetDailyStatPB gets mpesa statistics protobuf from model

func GetMpesaB2CPushKey added in v1.2.3

func GetMpesaB2CPushKey(msisdn string) string

GetMpesaSTKPushKey retrives key storing initiator key

func GetMpesaRequestKey added in v1.2.3

func GetMpesaRequestKey(requestId string) string

GetMpesaRequestKey is key that initiates data

func NewB2CAPI

func NewB2CAPI(ctx context.Context, opt *Options) (b2c.B2CAPIServer, error)

NewB2CAPI creates a B2C API for mpesa

func ValidateOptionB2C added in v1.2.6

func ValidateOptionB2C(opt *OptionB2C) error

ValidateOptionB2C validates b2c options

func ValidateOptions

func ValidateOptions(opt *Options) error

ValidateOptions validates options required by stk service

func ValidatePayment

func ValidatePayment(paymentPB *b2c.B2CPayment) error

ValidatePayment validates b2c payment

Types

type OptionB2C added in v1.2.6

type OptionB2C struct {
	ConsumerKey                string
	ConsumerSecret             string
	AccessTokenURL             string
	QueueTimeOutURL            string
	ResultURL                  string
	InitiatorUsername          string
	InitiatorPassword          string
	InitiatorEncryptedPassword string
	PublicKeyCertificateFile   string
	// contains filtered or unexported fields
}

OptionB2C contains options for doing b2c with mpesa

type Options

type Options struct {
	PublishChannel     string
	QueryBalanceURL    string
	B2CURL             string
	ReversalURL        string
	SQLDB              *gorm.DB
	RedisDB            *redis.Client
	Logger             grpclog.LoggerV2
	AuthAPI            auth.API
	HTTPClient         httpClient
	OptionB2C          *OptionB2C
	TransactionCharges float32
}

Options contains options for starting b2c service

Jump to

Keyboard shortcuts

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