Documentation
¶
Index ¶
- Constants
- func GetMpesaB2CPushKey(msisdn string) string
- func GetMpesaRequestKey(requestId string) string
- func NewB2CAPI(ctx context.Context, opt *Options) (b2c.B2CV1Server, error)
- func PaymentProto(db *Payment) (*b2c.B2CPayment, error)
- func StatProto(db *DailyStat) (*b2c.DailyStat, error)
- func ValidateB2COptions(opt *B2COptions) error
- func ValidateOptions(opt *Options) error
- type B2COptions
- type DailyStat
- type Options
- type Payment
Constants ¶
View Source
const B2CTable = "b2c_transactions"
B2CTable is table name for b2c transactions
View Source
const SourceKey = "source"
Variables ¶
This section is empty.
Functions ¶
func GetMpesaB2CPushKey ¶
GetMpesaSTKPushKey retrives key storing initiator key
func GetMpesaRequestKey ¶
GetMpesaRequestKey is key that initiates data
func PaymentProto ¶
func PaymentProto(db *Payment) (*b2c.B2CPayment, error)
func ValidateB2COptions ¶
func ValidateB2COptions(opt *B2COptions) error
ValidateB2COptions validates b2c options
func ValidateOptions ¶
ValidateOptions validates options required by stk service
Types ¶
type B2COptions ¶
type B2COptions struct { ConsumerKey string ConsumerSecret string AccessTokenURL string QueueTimeOutURL string ResultURL string InitiatorUsername string InitiatorEncryptedPassword string // contains filtered or unexported fields }
B2COptions contains options for doing b2c with mpesa
type DailyStat ¶
type DailyStat struct { ID uint `gorm:"primaryKey;autoIncrement"` OrgShortCode string `gorm:"index;type:varchar(20);not null"` Date string `gorm:"index;type:varchar(10);not null"` TotalTransactions int32 `gorm:"type:int(10);not null"` SuccessfulTransactions int32 FailedTransactions int32 TotalAmountTransacted float32 `gorm:"index;type:float(15)"` TotalCharges float32 `gorm:"index;type:float(15)"` CreatedAt time.Time `gorm:"autoCreateTime"` UpdatedAt time.Time `gorm:"autoCreateTime"` DeletedAt gorm.DeletedAt `gorm:"index"` }
DailyStat contains statistics for a day
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 B2COptions *B2COptions TransactionCharges float32 }
Options contains options for starting b2c service
type Payment ¶
type Payment struct { ID uint `gorm:"primaryKey;autoIncrement"` InitiatorID string `gorm:"index;type:varchar(50)"` InitiatorCustomerReference string `gorm:"index;type:varchar(50)"` InitiatorCustomerNames string `gorm:"type:varchar(50)"` Msisdn string `gorm:"index;type:varchar(15)"` OrgShortCode string `gorm:"index;type:varchar(15)"` CommandId string `gorm:"index;type:varchar(30)"` TransactionAmount float32 `gorm:"index;type:float(10)"` ConversationID string `gorm:"index;type:varchar(50);not null"` OriginatorConversationID string `gorm:"index;type:varchar(50);not null"` ResponseDescription string `gorm:"type:varchar(300)"` ResponseCode string `gorm:"index;type:varchar(10)"` ResultCode string `gorm:"index;type:varchar(10)"` ResultDescription string `gorm:"type:varchar(300)"` WorkingAccountFunds float32 `gorm:"type:float(10)"` UtilityAccountFunds float32 `gorm:"type:float(10)"` MpesaCharges float32 `gorm:"type:float(10)"` SystemCharges float32 `gorm:"type:float(10)"` RecipientRegistered bool `gorm:"index;type:tinyint(1)"` MpesaReceiptId sql.NullString `gorm:"index;type:varchar(50);unique"` ReceiverPublicName string `gorm:"type:varchar(50)"` B2CStatus string `gorm:"index;type:varchar(30);column:b2c_status"` Source string `gorm:"index;type:varchar(30)"` Tag string `gorm:"index;type:varchar(30)"` Succeeded string `gorm:"index;type:enum('YES','NO', 'UNKNOWN');default:NO"` Processed string `gorm:"index;type:enum('YES','NO');default:NO"` TransactionTime sql.NullTime `gorm:"index;type:datetime(6)"` UpdatedAt time.Time `gorm:"autoUpdateTime;type:datetime(6)"` CreatedAt time.Time `gorm:"index;autoCreateTime;type:datetime(6);not null"` }
Payment is B2C payment model
Click to show internal directories.
Click to hide internal directories.