compliance

package
v0.0.0-...-c9303cd Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// TransactionNotFoundError is an error response
	TransactionNotFoundError = &helpers.ErrorResponse{Code: "transaction_not_found", Message: "Transaction not found.", Status: http.StatusNotFound}

	// CannotResolveDestination is an error response
	CannotResolveDestination = &helpers.ErrorResponse{Code: "cannot_resolve_destination", Message: "Cannot resolve federated DiamNet address.", Status: http.StatusBadRequest}
	// AuthServerNotDefined is an error response
	AuthServerNotDefined = &helpers.ErrorResponse{Code: "auth_server_not_defined", Message: "No AUTH_SERVER defined in diamnet.toml file.", Status: http.StatusBadRequest}
)

Functions

This section is empty.

Types

type CallbackResponse

type CallbackResponse struct {
	// Estimated number of seconds utill the sender can check back for a change in status.
	Pending int    `json:"pending"`
	Error   string `json:"error"`
}

CallbackResponse is a response from Sanctions and AskUser callbacks when they return 202 Accepted or 400 Bad Requests statuses

type FetchInfoRequest

type FetchInfoRequest struct {
	Address string `form:"address"`
}

FetchInfoRequest represents a request sent to fetch_info callback

type FetchInfoResponse

type FetchInfoResponse struct {
	Name        string `json:"name"`
	Address     string `json:"address"`
	DateOfBirth string `json:"date_of_birth"`
}

FetchInfoResponse represents a response returned by fetch_info callback

type ReceiveRequest

type ReceiveRequest struct {
	Memo string `form:"memo" valid:"required"`
}

ReceiveRequest represents request sent to /receive endpoint of compliance server

func (*ReceiveRequest) Validate

func (request *ReceiveRequest) Validate(params ...interface{}) error

Validate is additional validation method to validate special fields.

type ReceiveResponse

type ReceiveResponse struct {
	helpers.SuccessResponse
	// The AuthData hash of this memo.
	Data string `json:"data"`
}

ReceiveResponse represents response returned by /receive endpoint

func (*ReceiveResponse) Marshal

func (response *ReceiveResponse) Marshal() ([]byte, error)

Marshal marshals ReceiveResponse

type SendRequest

type SendRequest struct {
	// Payment ID - used to resubmit auth request in case of `pending` response.
	ID string `form:"id" valid:"required"`
	// Source account ID
	Source string `form:"source" valid:"required,diamnet_accountid"`
	// Sender address (like alice*diamnet.org)
	Sender string `form:"sender" valid:"required,diamnet_address"`
	// Destination address (like bob*diamnet.org)
	Destination string `form:"destination" valid:"required,diamnet_address"`
	// ForwardDestination
	ForwardDestination *protocols.ForwardDestination `form:"forward_destination" valid:"-"`
	// Amount destination should receive
	Amount string `form:"amount" valid:"required,diamnet_amount"`
	// Code of the asset destination should receive
	AssetCode string `form:"asset_code" valid:"optional,diamnet_asset_code"`
	// Issuer of the asset destination should receive
	AssetIssuer string `form:"asset_issuer" valid:"optional,diamnet_accountid"`
	// Only for path_payment
	SendMax string `form:"send_max" valid:"optional,diamnet_amount"`
	// Only for path_payment
	SendAssetCode string `form:"send_asset_code" valid:"optional,diamnet_asset_code"`
	// Only for path_payment
	SendAssetIssuer string `form:"send_asset_issuer" valid:"optional,diamnet_accountid"`
	// path[n][asset_code] path[n][asset_issuer]
	Path []protocols.Asset `form:"path" valid:"-"`
	// Extra memo
	ExtraMemo string `form:"extra_memo" valid:"-"`
}

SendRequest represents request sent to /send endpoint of compliance server

func (*SendRequest) FromRequestSpecial

func (request *SendRequest) FromRequestSpecial(r *http.Request, destination interface{}) error

ToValuesSpecial converts special values from http.Request to struct

func (SendRequest) ToValuesSpecial

func (request SendRequest) ToValuesSpecial(values url.Values)

ToValuesSpecial adds special values (not easily convertable) to given url.Values

func (*SendRequest) Validate

func (request *SendRequest) Validate(params ...interface{}) error

Validate is additional validation method to validate special fields.

type SendResponse

type SendResponse struct {
	helpers.SuccessResponse
	compliance.AuthResponse `json:"auth_response"`
	// xdr.Transaction base64-encoded. Sequence number of this transaction will be equal 0.
	TransactionXdr string `json:"transaction_xdr,omitempty"`
}

SendResponse represents response returned by /send endpoint

func (*SendResponse) Marshal

func (response *SendResponse) Marshal() ([]byte, error)

Marshal marshals SendResponse

Jump to

Keyboard shortcuts

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