Documentation
¶
Index ¶
Constants ¶
const Timeout = 30 * time.Second
Variables ¶
var ( ErrIdentityRequired = errors.New("identity payload is required in webhook response") ErrTransactionRequired = errors.New("pending or transaction payload is required in webhook response") )
var MockURL *url.URL
Functions ¶
This section is empty.
Types ¶
type Mock ¶
Mock implements the webhook Handler and is used for testing webhook interactions.
func (*Mock) UseFixture ¶
type Payload ¶
type Payload struct {
Identity *ivms101.IdentityPayload `json:"identity"`
Pending *generic.Pending `json:"pending,omitempty"`
Transaction *generic.Transaction `json:"transaction,omitempty"`
SentAt string `json:"sent_at"`
ReceivedAt string `json:"received_at,omitempty"`
}
Payload is a denormalized representation of a TRISA payload that includes type-specific data structures. The payload should always have an identity IVMS101 payload and a sent at timestamp. It will have either a pending message or a transaction but not both. If payload is in an envelope with an accepted or completed transfer state it will have a received at timestamp as well.
type Reply ¶
type Reply struct {
TransactionID uuid.UUID `json:"transaction_id"`
Error *trisa.Error `json:"error,omitempty"`
Payload *Payload `json:"payload,omitempty"`
TransferAction string `json:"transfer_action,omitempty"`
}
Reply represents the expected response from the callback webhook to the Envoy node. Either an error or a pending message is returned in the common case, though Envoy will also handle synchronous compliance responses.
func (*Reply) TransferState ¶
func (r *Reply) TransferState() trisa.TransferState
Determine the API transfer state based on the reply
type Request ¶
type Request struct {
TransactionID uuid.UUID `json:"transaction_id"`
Timestamp string `json:"timestamp"`
Counterparty *api.Counterparty `json:"counterparty"`
HMAC string `json:"hmac_signature,omitempty"`
PKS string `json:"public_key_signature,omitempty"`
TransferState string `json:"transfer_state,omitempty"`
Error *trisa.Error `json:"error,omitempty"`
Payload *Payload `json:"payload,omitempty"`
}
The Request object is sent to the webhook via a POST http call. The request represents an incoming message to the server as an unsealed, decrypted secure envelope (whether the request came from a TRISA or TRP remote client). The request is guaranteed to have a transaction ID, timestamp, and counterparty. If it has a payload, then it will also have an HMAC signature and public key signature. Requests will have either errors or payloads, but not both.