card

package
v0.0.0-...-dd9457e Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizeRequest

type AuthorizeRequest struct {
	CardNumber    string            `json:"card_number"`
	Cvv           string            `json:"cvv"`
	ExpiryMonth   string            `json:"expiry_month"`
	ExpiryYear    string            `json:"expiry_year"`
	Currency      string            `json:"currency"`
	Amount        string            `json:"amount"`
	Fullname      string            `json:"fullname"`
	Email         string            `json:"email"`
	TxRef         string            `json:"tx_ref"`
	RedirectUrl   string            `json:"redirect_url"`
	Authorization map[string]string `json:"authorization"`
}

type AuthorizeResponse

type AuthorizeResponse struct {
	Status  string `json:"status"`
	Message string `json:"message"`
	Data    struct {
		Id                int         `json:"id"`
		TxRef             string      `json:"tx_ref"`
		FlwRef            string      `json:"flw_ref"`
		DeviceFingerprint string      `json:"device_fingerprint"`
		Amount            int         `json:"amount"`
		ChargedAmount     int         `json:"charged_amount"`
		AppFee            float64     `json:"app_fee"`
		MerchantFee       int         `json:"merchant_fee"`
		ProcessorResponse string      `json:"processor_response"`
		AuthModel         string      `json:"auth_model"`
		Currency          string      `json:"currency"`
		Ip                string      `json:"ip"`
		Narration         string      `json:"narration"`
		Status            string      `json:"status"`
		AuthUrl           string      `json:"auth_url"`
		PaymentType       string      `json:"payment_type"`
		Plan              interface{} `json:"plan"`
		FraudStatus       string      `json:"fraud_status"`
		ChargeType        string      `json:"charge_type"`
		CreatedAt         time.Time   `json:"created_at"`
		AccountId         int         `json:"account_id"`
		Customer          struct {
			Id          int         `json:"id"`
			PhoneNumber interface{} `json:"phone_number"`
			Name        string      `json:"name"`
			Email       string      `json:"email"`
			CreatedAt   time.Time   `json:"created_at"`
		} `json:"customer"`
		Card struct {
			First6Digits string `json:"first_6digits"`
			Last4Digits  string `json:"last_4digits"`
			Issuer       string `json:"issuer"`
			Country      string `json:"country"`
			Type         string `json:"type"`
			Expiry       string `json:"expiry"`
		} `json:"card"`
	} `json:"data"`
	Meta struct {
		Authorization struct {
			Mode     string `json:"mode"`
			Endpoint string `json:"endpoint"`
			Redirect string `json:"redirect"`
		} `json:"authorization"`
	} `json:"meta"`
}

type DefaultCardService

type DefaultCardService struct {
	configuration.Flutter
	utils.FlutterHttpClient
}

func (DefaultCardService) AuthorizeCharge

func (d DefaultCardService) AuthorizeCharge(ctx context.Context, request AuthorizeRequest) (AuthorizeResponse, error)

func (DefaultCardService) InitiateCharge

func (d DefaultCardService) InitiateCharge(ctx context.Context, request InitiateRequest) (InitiateResponse, error)

func (DefaultCardService) TokenizedCharge

func (DefaultCardService) ValidateCharge

type EncryptedRequest

type EncryptedRequest struct {
	Client string `json:"client"`
}

type InitiateRequest

type InitiateRequest struct {
	CardNumber  string `json:"card_number"`
	Cvv         string `json:"cvv"`
	ExpiryMonth string `json:"expiry_month"`
	ExpiryYear  string `json:"expiry_year"`
	Currency    string `json:"currency"`
	Amount      string `json:"amount"`
	Fullname    string `json:"fullname"`
	Email       string `json:"email"`
	TxRef       string `json:"tx_ref"`
	RedirectUrl string `json:"redirect_url"`
}

type InitiateResponse

type InitiateResponse struct {
	Status  string `json:"status"`
	Message string `json:"message"`
	Meta    struct {
		Authorization struct {
			Mode   string   `json:"mode"`
			Fields []string `json:"fields"`
		} `json:"authorization"`
	} `json:"meta"`
}

type Service

type Service interface {
	InitiateCharge(ctx context.Context, request InitiateRequest) (InitiateResponse, error)
	AuthorizeCharge(ctx context.Context, request AuthorizeRequest) (AuthorizeResponse, error)
	ValidateCharge(ctx context.Context, request ValidateChargeRequest) (ValidateChargeResponse, error)

	TokenizedCharge(ctx context.Context, request TokenizedChargeRequest) (TokenizedChargeResponse, error)
}

type TokenizedChargeRequest

type TokenizedChargeRequest struct {
	Token     string `json:"token"`
	Currency  string `json:"currency"`
	Country   string `json:"country"`
	Amount    int    `json:"amount"`
	Email     string `json:"email"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Ip        string `json:"ip"`
	Narration string `json:"narration"`
	TxRef     string `json:"tx_ref"`
}

type TokenizedChargeResponse

type TokenizedChargeResponse struct {
	Status  string `json:"status"`
	Message string `json:"message"`
	Data    struct {
		Id                int       `json:"id"`
		TxRef             string    `json:"tx_ref"`
		FlwRef            string    `json:"flw_ref"`
		RedirectUrl       string    `json:"redirect_url"`
		DeviceFingerprint string    `json:"device_fingerprint"`
		Amount            int       `json:"amount"`
		ChargedAmount     int       `json:"charged_amount"`
		AppFee            float64   `json:"app_fee"`
		MerchantFee       int       `json:"merchant_fee"`
		ProcessorResponse string    `json:"processor_response"`
		AuthModel         string    `json:"auth_model"`
		Currency          string    `json:"currency"`
		Ip                string    `json:"ip"`
		Narration         string    `json:"narration"`
		Status            string    `json:"status"`
		PaymentType       string    `json:"payment_type"`
		CreatedAt         time.Time `json:"created_at"`
		AccountId         int       `json:"account_id"`
		Customer          struct {
			Id          int         `json:"id"`
			PhoneNumber interface{} `json:"phone_number"`
			Name        string      `json:"name"`
			Email       string      `json:"email"`
			CreatedAt   time.Time   `json:"created_at"`
		} `json:"customer"`
		Card struct {
			First6Digits string `json:"first_6digits"`
			Last4Digits  string `json:"last_4digits"`
			Issuer       string `json:"issuer"`
			Country      string `json:"country"`
			Type         string `json:"type"`
			Expiry       string `json:"expiry"`
			Token        string `json:"token"`
		} `json:"card"`
	} `json:"data"`
}

type ValidateChargeRequest

type ValidateChargeRequest struct {
	Otp    string `json:"otp"`
	FlwRef string `json:"flw_ref"`
}

type ValidateChargeResponse

type ValidateChargeResponse struct {
	Status  string `json:"status"`
	Message string `json:"message"`
	Data    struct {
		Id                int         `json:"id"`
		TxRef             string      `json:"tx_ref"`
		FlwRef            string      `json:"flw_ref"`
		DeviceFingerprint string      `json:"device_fingerprint"`
		Amount            int         `json:"amount"`
		ChargedAmount     int         `json:"charged_amount"`
		AppFee            float64     `json:"app_fee"`
		MerchantFee       int         `json:"merchant_fee"`
		ProcessorResponse string      `json:"processor_response"`
		AuthModel         string      `json:"auth_model"`
		Currency          string      `json:"currency"`
		Ip                string      `json:"ip"`
		Narration         string      `json:"narration"`
		Status            string      `json:"status"`
		AuthUrl           string      `json:"auth_url"`
		PaymentType       string      `json:"payment_type"`
		Plan              interface{} `json:"plan"`
		FraudStatus       string      `json:"fraud_status"`
		ChargeType        string      `json:"charge_type"`
		CreatedAt         time.Time   `json:"created_at"`
		AccountId         int         `json:"account_id"`
		Customer          struct {
			Id          int         `json:"id"`
			PhoneNumber interface{} `json:"phone_number"`
			Name        string      `json:"name"`
			Email       string      `json:"email"`
			CreatedAt   time.Time   `json:"created_at"`
		} `json:"customer"`
		Card struct {
			First6Digits string `json:"first_6digits"`
			Last4Digits  string `json:"last_4digits"`
			Issuer       string `json:"issuer"`
			Country      string `json:"country"`
			Type         string `json:"type"`
			Expiry       string `json:"expiry"`
		} `json:"card"`
	} `json:"data"`
}

type VerifyChargeResponse

type VerifyChargeResponse struct {
	Status  string `json:"status"`
	Message string `json:"message"`
	Data    struct {
		Id                int       `json:"id"`
		TxRef             string    `json:"tx_ref"`
		FlwRef            string    `json:"flw_ref"`
		DeviceFingerprint string    `json:"device_fingerprint"`
		Amount            int       `json:"amount"`
		Currency          string    `json:"currency"`
		ChargedAmount     int       `json:"charged_amount"`
		AppFee            float64   `json:"app_fee"`
		MerchantFee       int       `json:"merchant_fee"`
		ProcessorResponse string    `json:"processor_response"`
		AuthModel         string    `json:"auth_model"`
		Ip                string    `json:"ip"`
		Narration         string    `json:"narration"`
		Status            string    `json:"status"`
		PaymentType       string    `json:"payment_type"`
		CreatedAt         time.Time `json:"created_at"`
		AccountId         int       `json:"account_id"`
		Card              struct {
			First6Digits string `json:"first_6digits"`
			Last4Digits  string `json:"last_4digits"`
			Issuer       string `json:"issuer"`
			Country      string `json:"country"`
			Type         string `json:"type"`
			Token        string `json:"token"`
			Expiry       string `json:"expiry"`
		} `json:"card"`
		Meta          interface{} `json:"meta"`
		AmountSettled float64     `json:"amount_settled"`
		Customer      struct {
			Id          int       `json:"id"`
			Name        string    `json:"name"`
			PhoneNumber string    `json:"phone_number"`
			Email       string    `json:"email"`
			CreatedAt   time.Time `json:"created_at"`
		} `json:"customer"`
	} `json:"data"`
}

Jump to

Keyboard shortcuts

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