funcs

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignBase64Txn

func SignBase64Txn(secretKey string, base64Txn string, networkPassPhrase string) (string, error)

SignBase64Txn signs the transaction hash from base64Txn string using the secret key

func SignHttp

func SignHttp(fullPathWithQuery string, body string, secretKey string) (string, error)

SignHttp returns a signed base64 encoded string of fullPathWithQuery+body

func SignString

func SignString(toSign string, secretKey string) (string, error)

SignString returns a signed base64 encoded string of toSign

func VerifyHttpSignature

func VerifyHttpSignature(fullPathWithQuery string, body string, base64Signature string, publicKey string) error

VerifyHttpSignature verifies the httpRequest signation retrieved from X-BANTUPAY-SIGNATURE header

func VerifySignatureString

func VerifySignatureString(toSign string, base64Signature string, publicKey string) error

VerifySignatureString verifies if the signatures match with the one to eb generated from toSign

Types

type ErrorResponse

type ErrorResponse struct {
	Error   string `json:"error"`
	Data    string `json:"data"`
	Message string `json:"message"`
}

type PaymentInfo

type PaymentInfo struct {
	Destination             string   `json:"destination"`                       //Receiver of the asset
	Memo                    string   `json:"memo,omitempty"`                    //Any description for the transaction. max of 28bytes
	AssetIssuer             string   `json:"assetIssuer"`                       //issuer of the asset you are sending
	AssetCode               string   `json:"assetCode"`                         //asset code of the asset you are sending
	Amount                  string   `json:"amount"`                            //the amount in 7dp. cannot be "0"
	Transaction             string   `json:"transaction,omitempty"`             //this is returned by the API service after ConfirmPaymentDetails has been invoked
	TransactionSignature    string   `json:"transactionSignature,omitempty"`    //used to send signature of the transaction back to the server on the second call
	TransactionID           string   `json:"transactionId,omitempty"`           //used to return transactionID for a successful transaction
	NetworkPassPhrase       string   `json:"networkPassPhrase,omitempty"`       //used to return network passphrase of the network connected to
	DestinationFirstName    string   `json:"destinationFirstName,omitempty"`    //used to return destination first name
	DestinationLastName     string   `json:"destinationLastName,omitempty"`     //used to return destination last name
	DestinationThumbnail    string   `json:"destinationThumbnail,omitempty"`    //used to return destination thumbnail
	ChannelAccount          string   `json:"channelAccount,omitempty"`          //used to send channel account that will be used for this transaction if any
	ChannelAccountSignature string   `json:"channelAccountSignature,omitempty"` //used to preserve the signature from the channel accounts
	Messages                []string `json:"messages,omitempty"`                //used to return any warnings or extra messages important to the user
}

PaymentInfo holds payment information

func PaymentInstance

func PaymentInstance() (p *PaymentInfo)

PaymentInstance returns a new payment struct

func (*PaymentInfo) ConfirmPaymentDetail

func (p *PaymentInfo) ConfirmPaymentDetail(baseUrl, ownerUsername, secretKey, ownerPublicKey, channelAccountSecret string) (err error)

ConfirmPaymentDetail calls bantupayAPI service to generate transactions and confirm payment details. This is the first method to be invoked during payment. the result is returned for UI display of payment details

func (*PaymentInfo) ExpressPay

func (p *PaymentInfo) ExpressPay(baseUrl, ownerUsername, secretKey, ownerPublicKey, channelAccountSecret string) (err error)

ExpressPay used by bots and bulk payment systems. this makes payments bypassing any form of confirmation. It chains together ConfirmPaymentDetails and MakePayment methods

func (*PaymentInfo) MakePayment

func (p *PaymentInfo) MakePayment(baseUrl, ownerUsername, secretKey, ownerPublicKey, channelAccountSecret string) (err error)

MakePayment makes payment after transaction has been generated using ConfirmPaymentDetails method

Jump to

Keyboard shortcuts

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