payment

package
v0.0.0-...-8bb53dc Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderMpesa  = "Mpesa"
	ProviderAthena = "Athena"

	TransferTypeBuyGoods = "BusinessBuyGoods"
	TransferTypePayBill  = "BusinessPayBill"
	TransferTypeDisburse = "DisburseFundsToBusiness"
	TransferTypeB2B      = "BusinessToBusinessTransfer"

	ReasonSalary             = "SalaryPayment"
	ReasonSalaryWithCharge   = "SalaryPaymentWithWithdrawalChargePaid"
	ReasonBusiness           = "BusinessPayment"
	ReasonBusinessWithCharge = "BusinessPaymentWithWithdrawalChargePaid"
	ReasonPromotion          = "PromotionPayment"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type B2BRequest

type B2BRequest struct {
	Username    string `json:"username"`
	ProductName string `json:"productName"`
	Business
}

B2BRequest is a model

type B2BResponse

type B2BResponse struct {
	Status          string `json:"status"`
	TransactionID   string `json:"transactionId"`
	TransactionFee  string `json:"transactionFee"`
	ProviderChannel string `json:"providerChannel"`
}

B2BResponse is a service

type B2CEntry

type B2CEntry struct {
	PhoneNumber     string `json:"phoneNumber"`
	Status          string `json:"status"`
	Provider        string `json:"provider"`
	ProviderChannel string `json:"providerChannel"`
	Value           string `json:"value"`
	TransactionID   string `json:"transactionId"`
	TransactionFee  string `json:"transactionFee"`
	ErrorMessage    string `json:"errorMessage"`
}

B2CEntry is a model

type B2CRequest

type B2CRequest struct {
	Username    string     `json:"username"`
	ProductName string     `json:"productName"`
	Recipients  []Consumer `json:"recipients"`
}

B2CRequest is a model

type B2CResponse

type B2CResponse struct {
	NumQueued           int        `json:"numQueued"`
	TotalValue          string     `json:"totalValue"`
	TotalTransactionFee string     `json:"totalTransactionFee"`
	Entries             []B2CEntry `json:"entries"`
}

B2CResponse is a service

type Bank

type Bank struct {
	CurrencyCode string            `json:"currencyCode"`
	Amount       float64           `json:"amount"`
	BankAccount  BankAccount       `json:"bankAccount"`
	Narration    string            `json:"narration"`
	Metadata     map[string]string `json:"metadata"`
}

Bank is a.. Bank

type BankAccount

type BankAccount struct {
	AccountName   string   `json:"accountName"`
	AccountNumber string   `json:"accountNumber"`
	BankCode      BankCode `json:"bankCode"`
	DateOfBirth   string   `json:"dateOfBirth"`
}

BankAccount is a model

type BankCheckoutRequest

type BankCheckoutRequest struct {
	CheckoutRequest
	BankAccount BankAccount `json:"bankAccount"`
}

BankCheckoutRequest is just a req

type BankCode

type BankCode int

BankCode really?

const (
	FCMB_NG       BankCode = 234001
	Zenith_NG     BankCode = 234002
	Access_NG     BankCode = 234003
	GTBank_NG     BankCode = 234004
	Ecobank_NG    BankCode = 234005
	Diamond_NG    BankCode = 234006
	Providus_NG   BankCode = 234007
	Unity_NG      BankCode = 234008
	Stanbic_NG    BankCode = 234009
	Sterling_NG   BankCode = 234010
	Parkway_NG    BankCode = 234011
	Afribank_NG   BankCode = 234012
	Enterprise_NG BankCode = 234013
	Fidelity_NG   BankCode = 234014
	Heritage_NG   BankCode = 234015
	Keystone_NG   BankCode = 234016
	Skye_NG       BankCode = 234017
	Stanchart_NG  BankCode = 234018
	Union_NG      BankCode = 234019
	Uba_NG        BankCode = 234020
	Wema_NG       BankCode = 234021
	First_NG      BankCode = 234022
	CBA_KE        BankCode = 254001
	UNKNOWN       BankCode = -1
)

type BankEntry

type BankEntry struct {
	AccountNumber  string `json:"accountNumber"`
	Status         string `json:"status"`
	TransactioID   string `json:"transactionId"`
	TransactionFee string `json:"transactionFee"`
	ErrorMessage   string `json:"errorMessage"`
}

BankEntry is a model

type BankTransferRequest

type BankTransferRequest struct {
	Username    string `json:"username"`
	ProductName string `json:"productName"`
	Recipients  []Bank `json:"recipients"`
}

BankTransferRequest is a req

type BankTransferResponse

type BankTransferResponse struct {
	ErrorMessage string      `json:"errorMessage"`
	Entries      []BankEntry `json:"entries"`
}

BankTransferResponse is a model

type BankValidateCheckoutRequest

type BankValidateCheckoutRequest struct {
	CheckoutValidateRequest
}

BankValidateCheckoutRequest is a req

type Business

type Business struct {
	CurrencyCode       string            `json:"currencyCode"`
	Amount             float64           `json:"amount"`
	Provider           string            `json:"provider"`
	TransferType       string            `json:"transferType"`
	DestinationChannel string            `json:"destinationChannel"`
	DestinationAccount string            `json:"destinationAccount"`
	Metadata           map[string]string `json:"metadata"`
}

Business is a business

type Card

type Card struct {
	Number      string `json:"number"`
	CVVNumber   int    `json:"cvvNumber"`
	ExpiryMonth int    `json:"expiryMonth"`
	ExpiryYear  int    `json:"expiryYear"`
	CountryCode string `json:"countryCode"`
	AuthToken   string `json:"authToken"`
}

Card is a model

func (Card) IsValid

func (card Card) IsValid() bool

IsValid checks whether card details are valid

type CardCheckoutRequest

type CardCheckoutRequest struct {
	CheckoutRequest
	Card  Card   `json:"paymentCard"`
	Token string `json:"checkoutToken"`
}

CardCheckoutRequest is a checkout type for card payment

type CardValidateCheckoutRequest

type CardValidateCheckoutRequest struct {
	CheckoutValidateRequest
}

CardValidateCheckoutRequest is a model

type CheckoutRequest

type CheckoutRequest struct {
	Username     string            `json:"username"`
	ProductName  string            `json:"productName"`
	Narration    string            `json:"narration"`
	Metadata     map[string]string `json:"metadata"`
	CurrencyCode string            `json:"currencyCode"`
	Amount       float64           `json:"amount"`
}

CheckoutRequest is a model

type CheckoutResponse

type CheckoutResponse struct {
	Status        string `json:"status"`
	TransactioID  string `json:"transactionId"`
	Description   string `json:"description"`
	CheckoutToken string `json:"checkoutToken"`
}

CheckoutResponse is a model

type CheckoutValidateRequest

type CheckoutValidateRequest struct {
	Username      string `json:"username"`
	TransactionID string `json:"transactionId"`
	OTP           string `json:"otp"`
}

CheckoutValidateRequest is a model

type CheckoutValidateResponse

type CheckoutValidateResponse struct {
	Status        string `json:"status"`
	Description   string `json:"description"`
	CheckoutToken string `json:"checkoutToken"`
}

CheckoutValidateResponse is a model

type Consumer

type Consumer struct {
	Name            string            `json:"name"`
	PhoneNumber     string            `json:"phoneNumber"`
	CurrencyCode    string            `json:"currencyCode"`
	Amount          float64           `json:"amount"`
	ProviderChannel string            `json:"providerChannel"`
	Reason          string            `json:"reason"`
	Metadata        map[string]string `json:"metadata"`
}

Consumer is a model

type MobileCheckoutRequest

type MobileCheckoutRequest struct {
	CheckoutRequest
	PhoneNumber string `json:"phoneNumber"`
}

MobileCheckoutRequest is a model

type Service

type Service struct {
	Username string
	APIKey   string
	Env      string
}

Service is a service

func NewService

func NewService(username, apiKey, env string) Service

NewService creates a new Service

func (Service) BankCheckoutCharge

func (service Service) BankCheckoutCharge(body BankCheckoutRequest) (*CheckoutResponse, error)

BankCheckoutCharge requests

func (Service) BankCheckoutValidate

func (service Service) BankCheckoutValidate(body BankValidateCheckoutRequest) (*CheckoutValidateResponse, error)

BankCheckoutValidate requests

func (Service) BankTransfer

func (service Service) BankTransfer(body BankTransferRequest) (*BankTransferResponse, error)

BankTransfer requests

func (Service) CardCheckoutCharge

func (service Service) CardCheckoutCharge(body CardCheckoutRequest) (*CheckoutResponse, error)

CardCheckoutCharge requests

func (Service) CardCheckoutValidate

func (service Service) CardCheckoutValidate(body CardValidateCheckoutRequest) (*CheckoutValidateResponse, error)

CardCheckoutValidate requests

func (Service) MobileCheckout

func (service Service) MobileCheckout(body MobileCheckoutRequest) (*CheckoutResponse, error)

MobileCheckout requests

func (Service) RequestB2B

func (service Service) RequestB2B(body B2BRequest) (*B2BResponse, error)

RequestB2B sends a B2B request

func (Service) RequestB2C

func (service Service) RequestB2C(body B2CRequest) (*B2CResponse, error)

RequestB2C sends a B2C request

Jump to

Keyboard shortcuts

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