rave

package
v0.0.0-...-bfb4d9f Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Endpoints = map[string]map[string]string{
	"card": {
		"charge":          "flwv3-pug/getpaidx/api/charge",
		"validate":        "flwv3-pug/getpaidx/api/validatecharge",
		"verify":          "flwv3-pug/getpaidx/api/v2/verify",
		"chargeSavedCard": "flwv3-pug/getpaidx/api/tokenized/charge",
	},
	"preauth": {
		"charge":       "flwv3-pug/getpaidx/api/tokenized/preauth_charge",
		"capture":      "flwv3-pug/getpaidx/api/capture",
		"refundorvoid": "flwv3-pug/getpaidx/api/refundorvoid",
	},
	"account": {
		"charge":   "flwv3-pug/getpaidx/api/charge",
		"validate": "flwv3-pug/getpaidx/api/validate",
		"verify":   "flwv3-pug/getpaidx/api/v2/verify",
	},
	"payment_plan": {
		"create": "v2/gpx/paymentplans/create",
		"fetch":  "v2/gpx/paymentplans/query",
		"list":   "v2/gpx/paymentplans/query",
		"cancel": "v2/gpx/paymentplans/",
		"edit":   "v2/gpx/paymentplans/",
	},
	"subscriptions": {
		"fetch":    "v2/gpx/subscriptions/query",
		"list":     "v2/gpx/subscriptions/query",
		"cancel":   "v2/gpx/subscriptions/",
		"activate": "v2/gpx/subscriptions/",
	},
	"subaccount": {
		"create": "v2/gpx/subaccounts/create",
		"list":   "v2/gpx/subaccounts/",
		"fetch":  "v2/gpx/subaccounts/get",
		"delete": "v2/gpx/subaccounts/delete",
	},
	"transfer": {
		"initiate":            "v2/gpx/transfers/create",
		"bulk":                "v2/gpx/transfers/create_bulk",
		"fetch":               "v2/gpx/transfers",
		"fee":                 "v2/gpx/transfers/fee",
		"balance":             "v2/gpx/balance",
		"accountVerification": "flwv3-pug/getpaidx/api/resolve_account",
	},
	"verify": {
		"verify": "flwv3-pug/getpaidx/api/v2/verify",
	},
	"refund": {
		"refund": "gpx/merchant/transactions/refund",
	},
	"mobilemoney": {
		"charge": "flwv3-pug/getpaidx/api/charge",
	},
	"virtualcard": {
		"create":    "v2/services/virtualcards/new",
		"list":      "v2/services/virtualcards/search",
		"get":       "v2/services/virtualcards/get",
		"terminate": "v2/services/virtualcards/",
		"fund":      "v2/services/virtualcards/fund",
		"fetch":     "v2/services/virtualcards/transactions",
		"withdraw":  "v2/services/virtualcards/withdraw",
		"freeze":    "v2/services/virtualcards/",
	},

	"bvn": {
		"bvnverification": "v2/kyc/bvn/",
	},

	"virtualaccount": {
		"virtualaccountnumber": "v2/banktransfers/accountnumbers",
	},

	"settlement": {
		"list":  "v2/merchant/settlements",
		"fetch": "v2/merchant/settlements/",
	},

	"verifytransaction": {
		"verify": "flwv3-pug/getpaidx/api/v2/verify",
	},

	"ebills": {
		"createorder": "flwv3-pug/getpaidx/api/ebills/generateorder/",
		"updateorder": "flwv3-pug/getpaidx/api/ebills/update/",
	},

	"Banktransfer": {
		"charge": "flwv3-pug/getpaidx/api/charge",
	},

	"Beneficiaries": {
		"list":   "v2/gpx/transfers/beneficiaries",
		"fetch":  "v2/gpx/transfers/beneficiaries",
		"create": "v2/gpx/transfers/beneficiaries/create",
		"delete": "v2/gpx/transfers/beneficiaries/delete",
	},
	"Billspayments": {
		"flybuy":     "v2/services/confluence",
		"categories": "v3/bill-categories",
		"validate":   "v3/bill-items/:item_code/validate",
		"list":       "/v3/bills",
		"fetch":      "/v3/bills",
		"create":     "/v3/bills",
	},
	"flutterwaveOTP": {
		"otp": "v2/services/confluence",
	},
}

Functions

func CheckRequiredParameters

func CheckRequiredParameters(params map[string]interface{}, keys []string) error

Checks if all required parameters are present

func GenerateRef

func GenerateRef() string

func MakeGetRequest

func MakeGetRequest(url string, params map[string]string) (error error, response map[string]interface{})

Makes a get request to rave api

func MakePostRequest

func MakePostRequest(data interface{}, url string) (error error, response map[string]interface{})

Makes a post request to rave api

func MapToJSON

func MapToJSON(mapData interface{}) []byte

Converts map[string]interface{} to JSON

func VerifyChargeResponse

func VerifyChargeResponse(chargeResponse string) error

The Charge response should equal "00" or "0"

func VerifyChargedAmount

func VerifyChargedAmount(apiChargedAmount, funcChargedAmount float64) error

The Charged Amount must be greater than or equal to the paid amount

func VerifyCurrencyCode

func VerifyCurrencyCode(apiCurrencyCode, funcCurrencyCode interface{}) error

The Currency code must match

func VerifySuccessMessage

func VerifySuccessMessage(status string) error

The status should equal "success" for a succesful transaction

func VerifyTransactionReference

func VerifyTransactionReference(apiTransactionRef, funcTransactionRef interface{}) error

Checks that the transaction reference(TxRef) match

Types

type Account

type Account struct {
	Rave
}

func (Account) ChargeAccount

func (a Account) ChargeAccount(data AccountChargeData) (error error, response map[string]interface{})

func (Account) ValidateAccount

func (a Account) ValidateAccount(data AccountValidateData) (error error, response map[string]interface{})

Validates account charge using otp

func (Account) VerifyAccount

func (a Account) VerifyAccount(data AccountVerifyData) (error error, response map[string]interface{})

Verifies the transaction, amount, and currency

type AccountCharge

type AccountCharge interface {
	ChargeAccount(data AccountChargeData) (error error, response map[string]interface{})
}

type AccountChargeData

type AccountChargeData struct {
	Cardno            string      `json:"cardno"`
	Cvv               string      `json:"cvv"`
	Accountbank       string      `json:"accountbank"`
	Accountnumber     string      `json:"accountnumber"`
	Paymenttype       string      `json:"payment_type"`
	Amount            float64     `json:"amount"`
	Currency          string      `json:"currency"`
	Country           string      `json:"country"`
	Bvn               string      `json:"bvn"`
	Passcode          string      `json:"passcode"`
	CustomerPhone     string      `json:"customer_phone"`
	Firstname         string      `json:"firstname"`
	Lastname          string      `json:"lastname"`
	Email             string      `json:"email"`
	IP                string      `json:"IP"`
	Txref             string      `json:"txRef"`
	SuggestedAuth     string      `json:"suggested_auth"`
	RedirectUrl       string      `json:"redirect_url"`
	Subaccounts       types.Slice `json:"subaccounts"`
	DeviceFingerprint string      `json:"device_fingerprint"`
	Meta              types.Slice `json:"meta"`
}

type AccountInterface

type AccountInterface interface {
	AccountCharge
	AccountValidate
	AccountVerify
}

type AccountResolveData

type AccountResolveData struct {
	PublicKey        string `json:"PBFPubKey"`
	RecipientAccount string `json:"recipientaccount"`
	DestBankCode     string `json:"destbankcode"`
	Currency         string `json:"currency"`
	Country          string `json:"country"`
}

type AccountValidate

type AccountValidate interface {
	ValidateAccount(data AccountValidateData) (error error, response map[string]interface{})
}

type AccountValidateData

type AccountValidateData struct {
	PublicKey string `json:"PBFPubKey"`
	Reference string `json:"transactionreference"`
	Otp       string `json:"otp"`
}

type AccountVerify

type AccountVerify interface {
	VerifyAccount(data AccountVerifyData) (error error, response map[string]interface{})
}

type AccountVerifyData

type AccountVerifyData struct {
	Reference string  `json:"txref"`
	Amount    float64 `json:"amount"`
	Currency  string  `json:"currency"`
	SecretKey string  `json:"SECKEY"`
}

type AllTransfersGetter

type AllTransfersGetter interface {
	FetchAllTransfers() (error error, response map[string]interface{})
}

type BVN

type BVN struct {
	Rave
}

func (BVN) Bvn

func (b BVN) Bvn(bvn string) (error error, response map[string]interface{})

type BankTransfer

type BankTransfer interface {
	BankTransfer(data BankTransferData) (error error, response map[string]interface{})
}

type BankTransferData

type BankTransferData struct {
	Pubkey         string      `json:"PBFPubKey"`
	Currency       string      `json:"currency"`
	Country        string      `json:"country"`
	Amount         string      `json:"amount"`
	Email          string      `json:"email"`
	Phonenumber    string      `json:"phonenumber"`
	Firstname      string      `json:"firstname"`
	Lastname       string      `json:"lastname"`
	IP             string      `json:"IP"`
	Txref          string      `json:"txRef"`
	Meta           types.Slice `json:"meta"`
	Subaccounts    types.Slice `json:"subaccounts"`
	Frequency      int         `json:"frequency"`
	IsBankTransfer bool        `json:"is_bank_transfer"`
	IsPermanent    int         `json:"is_permanent"`
	Narration      string      `json:"narration"`
	Duration       int         `json:"duration"`
	PaymentType    string      `json:"payment_type"`
}

type Banktransfers

type Banktransfers struct {
	Rave
}

func (Banktransfers) SetupCharge

func (b Banktransfers) SetupCharge(data BankTransferData) map[string]interface{}

func (Banktransfers) Transfer

func (b Banktransfers) Transfer(data BankTransferData) (error error, response map[string]interface{})

type BaseUrlGetter

type BaseUrlGetter interface {
	GetBaseUrl() string
}

BaseUrlGetter implements behaviour to get the base url (live or sandbox)

type BillCategory

type BillCategory struct {
	Id                int       `json:"id"`
	BillerCode        string    `json:"biller_code"`
	Name              string    `json:"name"`
	DefaultCommission float64   `json:"default_commission"`
	DateAdded         time.Time `json:"date_added"`
	Country           string    `json:"country"`
	IsAirtime         bool      `json:"is_airtime"`
	BillerName        string    `json:"biller_name"`
	ItemCode          string    `json:"item_code"`
	ShortName         string    `json:"short_name"`
	Fee               int       `json:"fee"`
	CommissionOnFee   bool      `json:"commission_on_fee"`
	LabelName         string    `json:"label_name"`
	Amount            int       `json:"amount"`
}

type BillCategoryFilter

type BillCategoryFilter string
const (
	Airtime    BillCategoryFilter = "airtime"
	DataBundle BillCategoryFilter = "data_bundle"
	Power      BillCategoryFilter = "power"
	Internet   BillCategoryFilter = "internet"
	Toll       BillCategoryFilter = "toll"
	Cable      BillCategoryFilter = "cable"
	BillerCode BillCategoryFilter = "biller_code"
)

type BillPaymentRequest

type BillPaymentRequest struct {
	Country    string `json:"country"`
	Customer   string `json:"customer"`
	Amount     string `json:"amount"`
	Recurrence string `json:"recurrence"`
	Type       string `json:"type"`
	Reference  string `json:"reference"`
	BillerName string `json:"biller_name"`
}

type BillPaymentResponse

type BillPaymentResponse struct {
	PhoneNumber string      `json:"phone_number"`
	Amount      int         `json:"amount"`
	Network     string      `json:"network"`
	FlwRef      string      `json:"flw_ref"`
	TxRef       string      `json:"tx_ref"`
	Reference   interface{} `json:"reference"`
	Fee         int         `json:"fee"`
	Currency    *string     `json:"currency"`
	Extra       interface{} `json:"extra"`
	Token       interface{} `json:"token"`
}

type BillPayments

type BillPayments struct {
	Rave
}

func (BillPayments) Create

func (b BillPayments) Create(req *BillPaymentRequest) (response BillPaymentResponse, err error)

func (BillPayments) GetBillCategories

func (b BillPayments) GetBillCategories(filter ...BillCategoryFilter) (categories []BillCategory, err error)

func (BillPayments) Status

func (b BillPayments) Status(ref string) (response BillPaymentResponse, err error)

func (BillPayments) ValidateBillCategory

func (b BillPayments) ValidateBillCategory(data *ValidationData) (response ValidationResponse, err error)

type Billpayment

type Billpayment struct {
	Rave
}

func (Billpayment) Bill

func (b Billpayment) Bill(data FlyBuyData) (error error, response map[string]interface{})

type BulkPaymentData

type BulkPaymentData struct {
	SecKey   string              `json:"seckey"`
	Title    string              `json:"title"`
	BulkData []map[string]string `json:"bulk_data"`
}

type BulkTransfer

type BulkTransfer interface {
	InitiateBulkTransfer(data BulkPaymentData) (error error, response map[string]interface{})
}

type BulkTransferStatus

type BulkTransferStatus interface {
	GetBulkTransferStatus() (error error, response map[string]interface{})
}

type Card

type Card struct {
	Rave
}

func (Card) ChargeCard

func (c Card) ChargeCard(data CardChargeData) (error error, response map[string]interface{})

func (Card) SetupCharge

func (c Card) SetupCharge(data CardChargeData) map[string]interface{}

func (Card) TokenizedCharge

func (c Card) TokenizedCharge(data TokenizedChargeData) (error error, response map[string]interface{})

func (Card) ValidateCard

func (c Card) ValidateCard(data CardValidateData) (error error, response map[string]interface{})

func (Card) VerifyCard

func (c Card) VerifyCard(data CardVerifyData) (error error, response map[string]interface{})

type CardCharge

type CardCharge interface {
	ChargeCard(data CardChargeData) (error error, response map[string]interface{})
}

type CardChargeData

type CardChargeData struct {
	Cardno            string      `json:"cardno"`
	Cvv               string      `json:"cvv"`
	Expirymonth       string      `json:"expirymonth"`
	Expiryyear        string      `json:"expiryyear"`
	Pin               string      `json:"pin"`
	Amount            float64     `json:"amount"`
	Currency          string      `json:"currency"`
	Country           string      `json:"country"`
	CustomerPhone     string      `json:"customer_phone"`
	Firstname         string      `json:"firstname"`
	Lastname          string      `json:"lastname"`
	Email             string      `json:"email"`
	Ip                string      `json:"IP"`
	Txref             string      `json:"txRef"`
	RedirectUrl       string      `json:"redirect_url"`
	Subaccounts       types.Slice `json:"subaccounts"`
	DeviceFingerprint string      `json:"device_fingerprint"`
	Meta              types.Slice `json:"meta"`
	SuggestedAuth     string      `json:"suggested_auth"`
	BillingZip        string      `json:"billingzip"`
	BillingCity       string      `json:"billingcity"`
	BillingAddress    string      `json:"billingaddress"`
	BillingState      string      `json:"billingstate"`
	BillingCountry    string      `json:"billingcountry"`
	Chargetype        string      `json:"charge_type"`
}

type CardInterface

type CardInterface interface {
	CardCharge
	CardValidate
	CardVerify
	CardTokenized
}

type CardTokenized

type CardTokenized interface {
	TokenizedCharge(data TokenizedChargeData) (error error, response map[string]interface{})
}

type CardValidate

type CardValidate interface {
	ValidateCard(data CardValidateData) (error error, response map[string]interface{})
}

type CardValidateData

type CardValidateData struct {
	Reference string `json:"transaction_reference"`
	Otp       string `json:"otp"`
	PublicKey string `json:"PBFPubKey"`
}

type CardVerify

type CardVerify interface {
	VerifyCard(data CardVerifyData) (error error, response map[string]interface{})
}

type CardVerifyData

type CardVerifyData struct {
	Reference string  `json:"txref"`
	Amount    float64 `json:"amount"`
	Currency  string  `json:"currency"`
	SecretKey string  `json:"SECKEY"`
}

type Create

type Create interface {
	Create(data CreateData) (
		error error,
		response map[string]interface{},
	)
}

type CreateAcct

type CreateAcct interface {
	Create(data CreateData) (error error, response map[string]interface{})
}

type CreateAcctData

type CreateAcctData struct {
	Email       string `json:"email"`
	Ispermanent bool   `json:"is_permanent"`
	Frequency   int    `json:"frequency"`
	Duration    int    `json:"duration"`
	Narration   string `json:"narration"`

	Seckey string `json:"seckey"`
}

type CreateData

type CreateData struct {
	Currency          string `json:"currency"`
	Amount            string `json:"amount"`
	BillingName       string `json:"billing_name"`
	BillingAddress    string `json:"billing_address"`
	BillingCity       string `json:"billing_city"`
	BillingState      string `json:"billing_state"`
	BillingPostalCode string `json:"billing_postal_code"`
	BillingCountry    string `json:"billing_country"`
	Seckey            string `json:"seckey"`
	CallbackURL       string `json:"callback_url"`
}

type CreateOrder

type CreateOrder interface {
	Create(data CreateOrderData) (error error, response map[string]interface{})
}

type CreateOrderData

type CreateOrderData struct {
	Currency      string `json:"currency"`
	NumberOfUnits int    `json:"numberofunits"`
	Amount        int    `json:"amount"`
	Narration     string `json:"narration"`
	Seckey        string `json:"SECKEY"`
	PhoneNumber   string `json:"phonenumber"`
	Email         string `json:"email"`
	Txref         string `json:"txRef"`
	IP            string `json:"IP"`
	Country       string `json:"country"`
}

type CreateRecipientData

type CreateRecipientData struct {
	AccountNo string `json:"account_number"`
	Acctbank  string `json:"account_bank"`
	Seckey    string `json:"seckey"`
}

type CreateSubaccount

type CreateSubaccount interface {
	CreateSubaccount(data CreateSubaccountData) (error error, response map[string]interface{})
}

type CreateSubaccountData

type CreateSubaccountData struct {
	AccountBank           string      `json:"account_bank"`
	AccountNumber         string      `json:"account_number"`
	BusinessName          string      `json:"business_name"`
	BusinessEmail         string      `json:"business_email"`
	BusinessContact       string      `json:"business_contact"`
	BusinessMobile        string      `json:"business_mobile"`
	BusinessContactMobile string      `json:"business_contact_mobile"`
	Seckey                string      `json:"seckey"`
	Meta                  types.Slice `json:"meta"`
	SplitType             string      `json:"split_type"`
	SplitValue            string      `json:"split_value"`
}

type CustomerInfoData

type CustomerInfoData struct {
	Firstname string `json:"first_name"`
	Email     string `json:"email"`
	Mobile    string `json:"mobile"`
}

type DeleteRecipientData

type DeleteRecipientData struct {
	Id     string `json:"id"`
	Seckey string `json:"seckey"`
}

type DeleteSubaccount

type DeleteSubaccount interface {
	DeleteSubaccount(id string) (error error, response map[string]interface{})
}

type Ebills

type Ebills struct {
	Rave
}

func (Ebills) CreateOrder

func (e Ebills) CreateOrder(data CreateOrderData) (error error, response map[string]interface{})

func (Ebills) UpdateOrder

func (e Ebills) UpdateOrder(data UpdateOrderData) (error error, response map[string]interface{})

type Encryptor

type Encryptor interface {
	Encrypt() string
}

Encryptor implements behaviour to encrypt payment payload with user secret key

type EndpointGetter

type EndpointGetter interface {
	GetEndpoint(endpointName string) map[string]string
}

EndpointGetter implements behaviour to get the endpoint needed for a particular action

type Fetch

type Fetch interface {
	Fetch(data string) (
		error error,
		response map[string]interface{},
	)
}

type FetchData

type FetchData struct {
	FromDate  time.Time `json:"FromDate"`
	ToDate    time.Time `json:"ToDate"`
	PageIndex int32     `json:"PageIndex"`
	PageSize  int32     `json:"PageSize"`
	CardId    string    `json:"CardId"`
	Seckey    string    `json:"seckey"`
}

type FetchRecipientsData

type FetchRecipientsData struct {
	SecKey              string `json:"seckey"`
	Id                  string `json:"id"`
	FullnameOrAccountNo string `json:"q"`
}

type FetchSettlement

type FetchSettlement interface {
	FetchSettlement(data string) (error error, response map[string]interface{})
}

type FetchSettlementData

type FetchSettlementData struct {
	Id     string `json:"id"`
	To     string `json:"to"`
	From   string `json:"from"`
	Seckey string `json:"seckey"`
}

type FetchSubaccount

type FetchSubaccount interface {
	FetchSubaccount(id string) (error error, response map[string]interface{})
}

type FlutterwaveOTP

type FlutterwaveOTP struct {
	Rave
}

func (FlutterwaveOTP) Otp

func (o FlutterwaveOTP) Otp(data OTPData) (
	error error,
	response map[string]interface{},
)

type FlyBuyData

type FlyBuyData struct {
	Service        string             `json:"service"`
	ServiceMethod  string             `json:"service_method"`
	ServiceVersion string             `json:"service_version"`
	ServiceChannel string             `json:"service_channel`
	ServicePayload ServicepayLoadData `json:"service_payload"`
	Seckey         string             `json:"secret_key"`
}

type Flybuy

type Flybuy interface {
	Bill(data FlyBuyData) (error error, response map[string]interface{})
}

type Freeze

type Freeze interface {
	Freeze(data string) (
		error error,
		response map[string]interface{},
	)
}

type FreezeData

type FreezeData struct {
	CardId       string `json:"card_id"`
	StatusAction string `json:"status_action"`
	Seckey       string `json:"seckey"`
}

type Fund

type Fund interface {
	Fund(data string) (
		error error,
		response map[string]interface{},
	)
}

type FundData

type FundData struct {
	Id            string `json:"id"`
	Amount        string `json:"amount"`
	DebitCurrency string `json:"debit_currency"`
	Seckey        string `json:"seckey"`
}

type Get

type Get interface {
	Get(data string) (
		error error,
		response map[string]interface{},
	)
}

type GetData

type GetData struct {
	Id     int32  `json:"page"`
	Seckey string `json:"seckey"`
}

type List

type List interface {
	List(data List) (
		error error,
		response map[string]interface{},
	)
}

type ListData

type ListData struct {
	Page   string `json:"page"`
	Seckey string `json:"seckey"`
}

type ListSettlementData

type ListSettlementData struct {
	From         string `json:"from"`
	To           string `json:"to"`
	Page         string `json:"page"`
	Subaccountid string `json:"subaccountid"`
	Seckey       string `json:"seckey"`
}

type ListSubaccount

type ListSubaccount interface {
	ListSubaccount(data ListSubaccountData) (error error, response map[string]interface{})
}

type ListSubaccountData

type ListSubaccountData struct {
	AccountBank   string `json:"account_bank"`
	AccountNumber string `json:"account_number"`
	BankName      string `json:"bank_name"`
	Seckey        string `json:"seckey"`
}

type OTPData

type OTPData struct {
	Service            string         `json:"service"`
	ServiceMethod      string         `json:"service_method"`
	ServiceVersion     string         `json:"service_version"`
	ServiceChannel     string         `json:"service_channel`
	ServicePayload     ServicepayData `json:"service_payload"`
	Seckey             string         `json:"secret_key"`
	OtpExpiresInMins   int            `json:"otp_expires_in_minutes"`
	SenderBusinessname string         `json:"sender_business_name"`
	SenderSameOTP      bool           `json:"send_same_otp"`
	SenderAsIs         int            `json:"send_as_is"`
}

type PaymentPlan

type PaymentPlan struct {
	Rave
}

func (PaymentPlan) Cancel

func (p PaymentPlan) Cancel(id int) (error error, response map[string]interface{})

func (PaymentPlan) Create

func (p PaymentPlan) Create(data PaymentPlanData) (error error, response map[string]interface{})

func (PaymentPlan) Edit

func (p PaymentPlan) Edit(id int, name string, status string) (error error, response map[string]interface{})

func (PaymentPlan) Fetch

func (p PaymentPlan) Fetch(id string) (error error, response map[string]interface{})

func (PaymentPlan) List

func (p PaymentPlan) List() (error error, response map[string]interface{})

type PaymentPlanData

type PaymentPlanData struct {
	Amount   string `json:"amount"`
	Name     string `json:"name"`
	Interval string `json:"interval"`
	Duration string `json:"duration"`
	Seckey   string `json:"seckey"`
}

type Preauth

type Preauth struct {
	Rave
	Card
}

func (Preauth) CapturePreauth

func (p Preauth) CapturePreauth(data PreauthCaptureData) (error error, response map[string]interface{})

func (Preauth) ChargePreauth

func (p Preauth) ChargePreauth(data TokenizedChargeData) (error error, response map[string]interface{})

func (Preauth) RefundOrVoidPreauth

func (p Preauth) RefundOrVoidPreauth(data PreauthRefundData) (error error, response map[string]interface{})

func (Preauth) VerifyPreauth

func (p Preauth) VerifyPreauth(data CardVerifyData) (error error, response map[string]interface{})

type PreauthCapture

type PreauthCapture interface {
	CapturePreauth(data CardValidateData) (
		error error,
		response map[string]interface{},
	)
}

type PreauthCaptureData

type PreauthCaptureData struct {
	SecretKey string  `json:"SECKEY"`
	Amount    float64 `json:"amount"`
	Flwref    string  `json:"flwRef"`
}

type PreauthCharge

type PreauthCharge interface {
	ChargePreauth(data TokenizedChargeData) (
		error error,
		response map[string]interface{},
	)
}

type PreauthRefundData

type PreauthRefundData struct {
	Flwref    string `json:"ref"`
	Action    string `json:"action"`
	SecretKey string `json:"SECKEY"`
}

type PreauthRefundOrVoid

type PreauthRefundOrVoid interface {
	RefundOrVoidPreauth(data CardVerifyData) (
		error error,
		response map[string]interface{},
	)
}

type PreauthVerify

type PreauthVerify interface {
	VerifyPreauth(data CardVerifyData) (
		error error,
		response map[string]interface{},
	)
}

type PublickeyGetter

type PublickeyGetter interface {
	GetPublicKey() string
}

PublickeyGetter implements behaviour to get the developers public key

type Rave

type Rave struct {
	Live          bool
	PublicKey     string
	SecretKey     string
	EnableLogging bool
}

Rave base type

func (Rave) Encrypt

func (r Rave) Encrypt(payload string) string

func (*Rave) Get

func (r *Rave) Get(url string, params map[string]string, resp any) (err error)

func (Rave) GetBaseURL

func (r Rave) GetBaseURL() string

gets the correct url for live and test mode

func (Rave) GetEndpoint

func (Rave) GetEndpoint(raveType string, action string) string

func (Rave) GetPublicKey

func (r Rave) GetPublicKey() string

gets the public key from the environment variable if set or from the Rave object

func (Rave) GetSecretKey

func (r Rave) GetSecretKey() string

gets the secret key

func (*Rave) Post

func (r *Rave) Post(url string, params map[string]string, body, resp interface{}) (err error)

type RaveBalanceGetter

type RaveBalanceGetter interface {
	GetRaveBalance()
}

type Refund

type Refund struct {
	Rave
}

func (Refund) RefundTransaction

func (r Refund) RefundTransaction(data RefundData) (error error, response map[string]interface{})

type RefundCharge

type RefundCharge interface {
	RefundTransaction(data RefundData) (error error, response map[string]interface{})
}

type RefundData

type RefundData struct {
	Ref       string `json:"ref"`
	Amount    int    `json:"amount"`
	SecretKey string `json:"seckey"`
}

type RefundInterface

type RefundInterface interface {
	RefundCharge
}

type RequestsData

type RequestsData struct {
	Country       string `json:"Country"`
	Amount        int    `json:"Amount"`
	CustomerId    string `json:"CustomerId"`
	RecurringType int    `json:"RecurringType"`
	IsAirtime     bool   `json:"IsAirtime"`
	BillerName    string `json:"BillerName"`
	Reference     string `json:"Reference"`
}

type SecretkeyGetter

type SecretkeyGetter interface {
	GetSecretKey() string
}

SecretkeyGetter implements behaviour to get the developers secret key

type ServicepayData

type ServicepayData struct {
	LenghtOfOTP       int              `json:"length_of_otp"`
	SendOTPasCustomer bool             `json:"send_otp_to_customer"`
	CustomerInfo      CustomerInfoData `json:"customer_info"`
	Medium            []string         `json:"medium"`
	TransactionRef    string           `json:"transaction_reference"`
}
type MediumData struct {
	Whatsapp string `json:"whatsapp"`
	SMS      string `json:"sms"`     TBC................................................................
	Email    string `json:"email"`
}

type ServicepayLoadData

type ServicepayLoadData struct {
	Country       string         `json:"Country"`
	Amount        int            `json:"Amount"`
	CustomerId    string         `json:"CustomerId"`
	RecurringType int            `json:"RecurringType"`
	IsAirtime     bool           `json:"IsAirtime"`
	BillerName    string         `json:"BillerName"`
	Reference     string         `json:"Reference"`
	BatchRef      string         `json:"BatchReference"`
	CallBackURL   string         `json:"CallBackUrl"`
	Requests      []RequestsData `json:"Requests"`
}

type SettlementInterface

type SettlementInterface interface {
	List
	Fetch
}

type Settlements

type Settlements struct {
	Rave
}

func (Settlements) Fetch

func (s Settlements) Fetch(data FetchSettlementData) (
	error error,
	response map[string]interface{},
)

func (Settlements) List

func (s Settlements) List(data ListSettlementData) (
	error error,
	response map[string]interface{},
)

type SinglePaymentData

type SinglePaymentData struct {
	SecKey          string      `json:"seckey"`
	AccountBank     string      `json:"account_bank"`
	AccountNumber   string      `json:"account_number"`
	Amount          int         `json:"amount"`
	Narration       string      `json:"narration"`
	Currency        string      `json:"currency"`
	Reference       string      `json:"reference"`
	Meta            types.Slice `json:"meta"`
	BeneficiaryName string      `json:"beneficiary_name"`
}

type SingleTransfer

type SingleTransfer interface {
	InitiateSingleTransfer(data SinglePaymentData) (error error, response map[string]interface{})
}

type SingleTransferGetter

type SingleTransferGetter interface {
	FetchTransfer(reference string) (error error, response map[string]interface{})
}

type Subaccount

type Subaccount struct {
	Rave
}

func (Subaccount) CreateSubaccount

func (s Subaccount) CreateSubaccount(data CreateSubaccountData) (error error, response map[string]interface{})

func (Subaccount) DeleteSubaccount

func (s Subaccount) DeleteSubaccount(id string) (error error, response map[string]interface{})

func (Subaccount) FetchSubaccount

func (s Subaccount) FetchSubaccount(id string) (error error, response map[string]interface{})

func (Subaccount) ListSubaccount

func (s Subaccount) ListSubaccount(data ListSubaccountData) (error error, response map[string]interface{})

type Subscription

type Subscription struct {
	Rave
}

func (Subscription) Activate

func (s Subscription) Activate(id int) (
	error error,
	response map[string]interface{},
)

func (Subscription) Cancel

func (s Subscription) Cancel(id int) (
	error error,
	response map[string]interface{},
)

func (Subscription) Fetch

func (s Subscription) Fetch(id string) (
	error error,
	response map[string]interface{},
)

func (Subscription) List

func (s Subscription) List() (
	error error,
	response map[string]interface{},
)

type TokenizedChargeData

type TokenizedChargeData struct {
	SecretKey  string  `json:"SECKEY"`
	Currency   string  `json:"currency"`
	Token      string  `json:"token"`
	Country    string  `json:"country"`
	Amount     float64 `json:"amount"`
	Email      string  `json:"email"`
	Firstname  string  `json:"firstname"`
	Lastname   string  `json:"lastname"`
	Ip         string  `json:"IP"`
	Txref      string  `json:"txRef"`
	Chargetype string  `json:"charge_type"`
}

type TransRecipients

type TransRecipients struct {
	Rave
}

func (TransRecipients) CreateRecipient

func (t TransRecipients) CreateRecipient(data CreateRecipientData) (error error, response map[string]interface{})

func (TransRecipients) DeleteRecipient

func (t TransRecipients) DeleteRecipient(data DeleteRecipientData) (error error, response map[string]interface{})

func (TransRecipients) Fetch

func (t TransRecipients) Fetch(data FetchRecipientsData) (error error, response map[string]interface{})

func (TransRecipients) List

func (t TransRecipients) List() (error error, response map[string]interface{})

type Transfer

type Transfer struct {
	Rave
}

func (Transfer) FetchAllTransfers

func (t Transfer) FetchAllTransfers(status string) (error error, response map[string]interface{})

Gets all transfers

func (Transfer) FetchTransfer

func (t Transfer) FetchTransfer(reference string) (error error, response map[string]interface{})

Gets a single transfer

func (Transfer) GetBulkTransferStatus

func (t Transfer) GetBulkTransferStatus(batch_id string) (error error, response map[string]interface{})

func (Transfer) GetRaveBalance

func (t Transfer) GetRaveBalance(currency string) (error error, response map[string]interface{})

Gets a customer's Rave available Balance

func (Transfer) GetTransferFee

func (t Transfer) GetTransferFee(currency string) (error error, response map[string]interface{})

Gets the transfer fee

func (Transfer) InitiateBulkTransfer

func (t Transfer) InitiateBulkTransfer(paymentData BulkPaymentData) (error error, response map[string]interface{})

initiates a bulk transfer

func (Transfer) InitiateSingleTransfer

func (t Transfer) InitiateSingleTransfer(paymentData SinglePaymentData) (error error, response map[string]interface{})

Initiates a single transfer

func (Transfer) ResolveAccount

func (t Transfer) ResolveAccount(account_data AccountResolveData) (error error, response map[string]interface{})

type TransferFeeGetter

type TransferFeeGetter interface {
	GetTransferFee()
}

type TransferInterface

type TransferInterface interface {
	SingleTransfer
	BulkTransfer
	TransferHelpers
}

type UpdateOrder

type UpdateOrder interface {
	Update(data UpdateOrderData) (error error, response map[string]interface{})
}

type UpdateOrderData

type UpdateOrderData struct {
	Currency string `json:"currency"`
	FlwRef   string `json:"reference"`
	Amount   int    `json:"amount"`
	Seckey   string `json:"SECKEY"`
}

type ValidationData

type ValidationData struct {
	ItemCode *string `json:"item_code"`
	Code     *string `json:"code"`
	Customer *string `json:"customer"`
}

type ValidationResponse

type ValidationResponse struct {
	ResponseCode    string      `json:"response_code"`
	Address         interface{} `json:"address"`
	ResponseMessage string      `json:"response_message"`
	Name            string      `json:"name"`
	BillerCode      string      `json:"biller_code"`
	Customer        string      `json:"customer"`
	ProductCode     string      `json:"product_code"`
	Email           interface{} `json:"email"`
	Fee             int         `json:"fee"`
	Maximum         int         `json:"maximum"`
	Minimum         int         `json:"minimum"`
}

type VerifyTransaction

type VerifyTransaction interface {
	Verify(data VerifyTransactionData) (error error, response map[string]interface{})
}

type VerifyTransactionData

type VerifyTransactionData struct {
	Txref  string `json:"txref"`
	Seckey string `json:"SECKEY"`
}

type Verifytransaction

type Verifytransaction struct {
	Rave
}

func (Verifytransaction) Verfiy

func (v Verifytransaction) Verfiy(data VerifyTransactionData) (error error, response map[string]interface{})

type Virtualaccount

type Virtualaccount struct {
	Rave
}

func (Virtualaccount) Create

func (v Virtualaccount) Create(data CreateAcctData) (error error, response map[string]interface{})

type Virtualcard

type Virtualcard interface {
	Create
	List
	Get
	Fund
	// Fetch  TBC...
	Withdraw
}

type Virtualcards

type Virtualcards struct {
	Rave
}

func (Virtualcards) Create

func (v Virtualcards) Create(data CreateData) (
	error error,
	response map[string]interface{},
)

func (Virtualcards) Fetch

func (v Virtualcards) Fetch(data FetchData) (
	error error,
	response map[string]interface{},
)

func (Virtualcards) Freeze

func (v Virtualcards) Freeze(data FreezeData) (
	error error,
	response map[string]interface{},
)

func (Virtualcards) Fund

func (v Virtualcards) Fund(data FundData) (
	error error,
	response map[string]interface{},
)

func (Virtualcards) Get

func (v Virtualcards) Get(data GetData) (
	error error,
	response map[string]interface{},
)

func (Virtualcards) List

func (v Virtualcards) List(data ListData) (
	error error,
	response map[string]interface{},
)

func (Virtualcards) Withdraw

func (v Virtualcards) Withdraw(data WithdrawData) (
	error error,
	response map[string]interface{},
)

type Withdraw

type Withdraw interface {
	Withdraw(data string) (
		error error,
		response map[string]interface{},
	)
}

type WithdrawData

type WithdrawData struct {
	CardId string `json:"card_id"`
	Amount string `json:"amount"`
	Seckey string `json:"seckey"`
}

Jump to

Keyboard shortcuts

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