Documentation ¶
Index ¶
- func GetMpesaRequestKey(requestId string) string
- func GetMpesaSTKPushKey(msisdn string) string
- func NewStkAPI(ctx context.Context, opt *Options) (_ stk.StkPushV2Server, err error)
- func STKTransactionPB(db *stk_model.STKTransaction) (*stk.StkTransaction, error)
- func ValidateOptionSTK(opt *OptionSTK) error
- func ValidateOptions(opt *Options) error
- type HTTPClient
- type OptionSTK
- type Options
- type STKRequestBody
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMpesaRequestKey ¶
GetMpesaRequestKey is key that initiates data
func GetMpesaSTKPushKey ¶
GetMpesaSTKPushKey retrives key storing initiator key
func STKTransactionPB ¶
func STKTransactionPB(db *stk_model.STKTransaction) (*stk.StkTransaction, error)
STKTransactionPB returns the protobuf message of mpesa payment model
func ValidateOptionSTK ¶
ValidateOptionSTK validates stk options
func ValidateOptions ¶
ValidateOptions validates options required by stk service
Types ¶
type HTTPClient ¶
HTTPClient makes mocking test easier
type OptionSTK ¶
type OptionSTK struct { AccessTokenURL string PassKey string ConsumerKey string ConsumerSecret string BusinessShortCode string AccountReference string Timestamp string CallBackURL string PostURL string QueryURL string // contains filtered or unexported fields }
OptionSTK contains options for sending push stk
type Options ¶
type Options struct { SQLDB *gorm.DB RedisDB *redis.Client Logger grpclog.LoggerV2 AuthAPI auth.API OptionSTK *OptionSTK HTTPClient HTTPClient UpdateAccessTokenDuration time.Duration }
Options contain parameters passed for creating stk service
type STKRequestBody ¶
type STKRequestBody struct { BusinessShortCode string `json:"BusinessShortCode,omitempty"` Password string `json:"Password,omitempty"` Timestamp string `json:"Timestamp,omitempty"` TransactionType string `json:"TransactionType,omitempty"` Amount string `json:"Amount,omitempty"` PartyA string `json:"PartyA,omitempty"` PartyB string `json:"PartyB,omitempty"` PhoneNumber string `json:"PhoneNumber,omitempty"` CallBackURL string `json:"CallBackURL,omitempty"` AccountReference string `json:"AccountReference,omitempty"` TransactionDesc string `json:"TransactionDesc,omitempty"` }
STKRequestBody is STK push request payload
Click to show internal directories.
Click to hide internal directories.