utils

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: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encrypt3Des

func Encrypt3Des(key string, payload []byte) (string, error)

func EnrichRequest

func EnrichRequest(req *http.Request, headers map[string]string) *http.Request

func EnrichRequestWithAuth

func EnrichRequestWithAuth(req *http.Request, token string, headers map[string]string) *http.Request

func GenerateRef

func GenerateRef(referencePrefix string) string

GenerateRef Generate transaction reference

func MapToJson

func MapToJson(data interface{}) ([]byte, error)

func Pkcs5Padding

func Pkcs5Padding(ciphertext []byte, blockSize int) []byte

func VerifyChargeResponse

func VerifyChargeResponse(chargeResponse string) error

func VerifyChargedAmount

func VerifyChargedAmount(apiChargedAmount, chargedAmount float64) error

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

func VerifyCurrencyCode

func VerifyCurrencyCode(apiCurrencyCode, currencyCode interface{}) error

VerifyCurrencyCode The Currency code must match

func VerifySuccessMessage

func VerifySuccessMessage(status string) error

VerifySuccessMessage The status should equal "success" for a successful transaction

func VerifyTransactionReference

func VerifyTransactionReference(apiTransactionRef, transactionRef interface{}) error

VerifyTransactionReference Checks that the transaction reference(TxRef) match

Types

type DefaultFlutterHttpClient

type DefaultFlutterHttpClient struct{}

func (DefaultFlutterHttpClient) Delete

func (d DefaultFlutterHttpClient) Delete(ctx context.Context, endpoint string, token string, body []byte, headers map[string]string) (*http.Response, error)

func (DefaultFlutterHttpClient) Get

func (d DefaultFlutterHttpClient) Get(ctx context.Context, endpoint string, token string, headers map[string]string) (*http.Response, error)

func (DefaultFlutterHttpClient) Options

func (d DefaultFlutterHttpClient) Options(ctx context.Context, endpoint string, token string, headers map[string]string) (*http.Response, error)

func (DefaultFlutterHttpClient) Post

func (d DefaultFlutterHttpClient) Post(ctx context.Context, endpoint string, token string, body []byte, headers map[string]string) (*http.Response, error)

func (DefaultFlutterHttpClient) Put

func (d DefaultFlutterHttpClient) Put(ctx context.Context, endpoint string, token string, body []byte, headers map[string]string) (*http.Response, error)

type FlutterHttpClient

type FlutterHttpClient interface {
	Get(ctx context.Context, endpoint string, token string, headers map[string]string) (*http.Response, error)
	Options(ctx context.Context, endpoint string, token string, headers map[string]string) (*http.Response, error)
	Post(ctx context.Context, endpoint string, token string, body []byte, headers map[string]string) (*http.Response, error)
	Delete(ctx context.Context, endpoint string, token string, body []byte, headers map[string]string) (*http.Response, error)
	Put(ctx context.Context, endpoint string, token string, body []byte, headers map[string]string) (*http.Response, error)
}

Jump to

Keyboard shortcuts

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