Documentation ¶
Overview ¶
Package twikey provides the bindings for Twikey REST APIs.
Index ¶
- type AmdmntRsn
- type Client
- func (c *Client) DocumentCancel(mandate string, reason string) error
- func (c *Client) DocumentFeed(newDocument func(mandate Mndt), ...) error
- func (c *Client) DocumentInvite(request InviteRequest) (*Invite, error)
- func (c *Client) DocumentUpdate(request UpdateRequest) error
- func (c *Client) DownloadPdf(mndtId string, downloadFile string) error
- func (c *Client) InvoiceFeed(callback func(invoice Invoice)) error
- func (c *Client) InvoiceFromUbl(ctx context.Context, ublBytes []byte, ref string) (*Invoice, error)
- func (c *Client) PaylinkFeed(callback func(paylink Paylink)) error
- func (c *Client) PaylinkNew(paylinkRequest PaylinkRequest) (*Paylink, error)
- func (c *Client) TransactionFeed(callback func(transaction Transaction)) error
- func (c *Client) TransactionNew(transaction TransactionRequest) (*Transaction, error)
- func (c *Client) VerifyWebhook(signatureHeader string, payload string) error
- type CtctDtls
- type Customer
- type CxlRsn
- type DbtrAgt
- type FinInstnId
- type Invite
- type InviteRequest
- type Invoice
- type InvoiceFeed
- type KeyValue
- type MandateUpdate
- type MandateUpdates
- type Mndt
- type Paylink
- type PaylinkRequest
- type Prty
- type PstlAdr
- type Transaction
- type TransactionList
- type TransactionRequest
- type UpdateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AmdmntRsn ¶
type AmdmntRsn struct {
Rsn string
}
AmdmntRsn contains the reason why something was updated
type Client ¶
type Client struct { BaseURL string APIKey string PrivateKey string Salt string UserAgent string HTTPClient *http.Client Debug *log.Logger // contains filtered or unexported fields }
Client is the base class, please use a dedicated UserAgent so we can notify the emergency contact if weird behaviour is perceived.
func NewClient ¶
NewClient is a convenience method to hit the ground running with the Twikey Rest API
func (*Client) DocumentCancel ¶
DocumentCancel allows to cancel (or delete if unsigned) a previously added document
func (*Client) DocumentFeed ¶
func (c *Client) DocumentFeed( newDocument func(mandate Mndt), updateDocument func(mandate Mndt, reason AmdmntRsn), cancelledDocument func(mandate string, reason CxlRsn)) error
DocumentFeed retrieves all documents since the last call with callbacks since there may be many
func (*Client) DocumentInvite ¶
func (c *Client) DocumentInvite(request InviteRequest) (*Invite, error)
DocumentInvite allows to invite a customer to sign a specific document
func (*Client) DocumentUpdate ¶
func (c *Client) DocumentUpdate(request UpdateRequest) error
DocumentUpdate allows to update a previously added document
func (*Client) DownloadPdf ¶
DownloadPdf allows the download of a specific (signed) pdf
func (*Client) InvoiceFeed ¶
InvoiceFeed Get invoice Feed twikey
func (*Client) InvoiceFromUbl ¶
InvoiceFromUbl sends an invoice to Twikey in UBL format
func (*Client) PaylinkFeed ¶
PaylinkFeed retrieves the feed of updated paylinks since last call
func (*Client) PaylinkNew ¶
func (c *Client) PaylinkNew(paylinkRequest PaylinkRequest) (*Paylink, error)
PaylinkNew sends the new paylink to Twikey for creation
func (*Client) TransactionFeed ¶
func (c *Client) TransactionFeed(callback func(transaction Transaction)) error
TransactionFeed retrieves all transaction updates since the last call with a callback since there may be many
func (*Client) TransactionNew ¶
func (c *Client) TransactionNew(transaction TransactionRequest) (*Transaction, error)
TransactionNew sends a new transaction to Twikey
type Customer ¶
type Customer struct { Email string `json:"email,omitempty"` FirstName string `json:"firstName"` LastName string `json:"lastName"` Address string `json:"address"` City string `json:"city"` Zip string `json:"zip"` Country string `json:"country"` Language string `json:"l"` Mobile string `json:"mobile,omitempty"` }
Customer is a json wrapper for usage inside the Invoice object
type CxlRsn ¶
type CxlRsn struct {
Rsn string
}
CxlRsn contains the reason why something was cancelled
type DbtrAgt ¶
type DbtrAgt struct {
FinInstnId FinInstnId
}
type FinInstnId ¶
type FinInstnId struct {
BICFI string
}
type Invite ¶
type Invite struct { MndtId string // documentNumber Url string // where the customer can sign the document Key string // specific invite key }
Invite is the response containing the documentNumber, key and the url to point the customer too.
type InviteRequest ¶
type InviteRequest struct { Template string // mandatory CustomerNumber string Email string Mobile string Language string Lastname string Firstname string MandateNumber string ContractNumber string CompanyName string Coc string Address string City string Zip string Country string SignDate string Amount string Iban string Bic string Campaign string }
InviteRequest contains all possible parameters that can be send to invite a customer to sign a document
type Invoice ¶
type Invoice struct { Id string `json:"id,omitempty"` Number string `json:"number"` Title string `json:"title"` Remittence string `json:"remittence"` Ct int `json:"ct,omitempty"` State string `json:"state,omitempty"` Amount float64 `json:"amount"` Date string `json:"date"` Duedate string `json:"duedate"` Ref string `json:"ref,omitempty"` Customer Customer `json:"customer"` Pdf []byte `json:"pdf,omitempty"` Meta invoiceFeedMeta `json:"meta,omitempty"` }
Invoice is the base object for sending and receiving invoices to Twikey
func (*Invoice) HasMeta ¶
HasMeta convenience method to indicate that there is extra info available on the invoice
type InvoiceFeed ¶
type InvoiceFeed struct {
Invoices []Invoice
}
InvoiceFeed is a struct to contain the response coming from Twikey, should be considered internal
type KeyValue ¶
type KeyValue struct { Key string Value interface{} }
KeyValue key value pairs of extra data in a document
type MandateUpdate ¶
type MandateUpdate struct { Mndt *Mndt AmdmntRsn *AmdmntRsn `json:",omitempty"` CxlRsn *CxlRsn `json:",omitempty"` OrgnlMndtId string EvtTime string }
MandateUpdate contains all info regarding a new/update or cancelled document
type MandateUpdates ¶
type MandateUpdates struct {
Messages []MandateUpdate
}
MandateUpdates is a struct to contain the response coming from Twikey, should be considered internal
type Paylink ¶
type Paylink struct { Id int64 `json:"id,omitempty"` Amount float64 `json:"amount,omitempty"` Msg string `json:"msg,omitempty"` Ref string `json:"ref,omitempty"` State string `json:"state,omitempty"` Url string `json:"url,omitempty"` }
Paylink is the response receiving from Twikey upon a request
type PaylinkRequest ¶
type PaylinkRequest struct { CustomerNumber string // The customer number (strongly advised) Email string // Email of the debtor (Required to send invite) Lastname string // lastname Firstname string // firstname Language string // Language (en/fr/nl/de/pt/es/it) Mobile string // mobile number Template string // contract template Title string // Message to the debto Remittance string // Payment message, if empty then title will be used Amount float64 // Amount to be billed RedirectUrl string // Optional redirect after pay url (must use http(s)://) Place string // Optional place Expiry string // Optional expiration date SendInvite string // Send out invite email or sms directly (email, sms) Address string // Address (street + number) City string // City of debtor Zip string // Zipcode of debtor Country string // ISO format (2 letters) Txref string // References from existing transactions Method string // Circumvents the payment selection with PSP (bancontact/ideal/maestro/mastercard/visa/inghomepay/kbc/belfius) Invoice string // create payment link for specific invoice number }
PaylinkRequest is the base object for sending and receiving paylinks to Twikey
type Transaction ¶
type Transaction struct { Id int64 `json:"id,omitempty"` DocumentId int64 `json:"contractId,omitempty"` DocumentReference string `json:"mndtId"` Amount float64 `json:"amount"` Message string `json:"msg"` Ref string `json:"ref"` Place string `json:"place"` Final bool `json:"final"` State string `json:"state"` BookedDate string `json:"bkdate"` BookedError string `json:"bkerror"` BookedAmount float64 `json:"bkamount"` RequestedCollection string `json:"reqcolldt"` }
Transaction is the response from Twikey when updates are received
type TransactionList ¶
type TransactionList struct {
Entries []Transaction
}
TransactionList is a struct to contain the response coming from Twikey, should be considered internal
type TransactionRequest ¶
type TransactionRequest struct { DocumentReference string TransactionDate string RequestedCollection string Msg string Ref string Amount float64 Place string ReferenceIsEndToEndIdentifier bool }
TransactionRequest is the payload to be send to Twikey when a new transaction should be send
type UpdateRequest ¶
type UpdateRequest struct { MandateNumber string // Document or MandateNumber State string // active or passive (activated or suspend mandate) Mobile string // Owner's mobile number Iban string // Debtor's IBAN Bic string // Debtor's BIC code Email string // email address of debtor Firstname string // Firstname of the debtor Lastname string // Lastname of the debtor CompanyName string // Company name on the mandate Vatno string // The enterprise number (can only be changed if companyName is changed) CustomerNumber string // The customer number (can be added, updated or used to move a mandate) Language string // language on the mandate (ISO 2 letters) Address string // Address (street + number) City string // City of debtor Zip string // Zipcode of debtor Country string // Country of debtor }
UpdateRequest contains all possible parameters that can be send to update a document