Documentation
¶
Index ¶
- type APIError
- type Client
- type CreateTransactionRequest
- type Customer
- type CustomerList
- type CustomerService
- func (s *CustomerService) Create(customer *Customer) (*Customer, error)
- func (s *CustomerService) Get(customerCode string) (*Customer, error)
- func (s *CustomerService) List() (*CustomerList, error)
- func (s *CustomerService) ListN(count, offset int) (*CustomerList, error)
- func (s *CustomerService) Update(customer *Customer) (*Customer, error)
- type ErrorResponse
- type Invoice
- type InvoiceList
- type InvoiceService
- func (s *InvoiceService) Create(invoice *Invoice) (*Invoice, error)
- func (s *InvoiceService) Get(id string) (*Invoice, error)
- func (s *InvoiceService) List() (*InvoiceList, error)
- func (s *InvoiceService) ListN(count, offset int) (*InvoiceList, error)
- func (s *InvoiceService) Update(customer *Invoice) (*Invoice, error)
- type ListMeta
- type Logger
- type Metadata
- type Page
- type PageList
- type PageService
- type RequestValues
- type Response
- type Transaction
- type TransactionList
- type TransactionService
- func (s *TransactionService) Get(id int) (*Transaction, error)
- func (s *TransactionService) Initialize(txn *CreateTransactionRequest) (Response, error)
- func (s *TransactionService) List() (*TransactionList, error)
- func (s *TransactionService) ListN(count, offset int) (*TransactionList, error)
- func (s *TransactionService) Verify(reference string) (*Transaction, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type Client ¶
type Client struct {
// Services supported by the Petra API.
// Miscellaneous actions are directly implemented on the Client object
Customer *CustomerService
Transaction *TransactionService
Page *PageService
Invoice *InvoiceService
LoggingEnabled bool
Log Logger
// contains filtered or unexported fields
}
Client manages communication with the Petra API
type Customer ¶
type Customer struct {
ID int `json:"id,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
UpdatedAt string `json:"updatedAt,omitempty"`
Domain string `json:"domain,omitempty"`
Integration int `json:"integration,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Email string `json:"email,omitempty"`
Phone string `json:"phone,omitempty"`
Metadata Metadata `json:"metadata,omitempty"`
CustomerCode string `json:"customer_code,omitempty"`
}
type CustomerList ¶
type CustomerService ¶
type CustomerService service
func (*CustomerService) Create ¶
func (s *CustomerService) Create(customer *Customer) (*Customer, error)
func (*CustomerService) List ¶
func (s *CustomerService) List() (*CustomerList, error)
func (*CustomerService) ListN ¶
func (s *CustomerService) ListN(count, offset int) (*CustomerList, error)
type ErrorResponse ¶
type ErrorResponse struct {
Status bool `json:"status,omitempty"`
Message string `json:"message,omitempty"`
Errors map[string]interface{} `json:"errors,omitempty"`
}
ErrorResponse represents an error response from the Petra API server
type InvoiceList ¶
type InvoiceService ¶
type InvoiceService service
func (*InvoiceService) List ¶
func (s *InvoiceService) List() (*InvoiceList, error)
func (*InvoiceService) ListN ¶
func (s *InvoiceService) ListN(count, offset int) (*InvoiceList, error)
type ListMeta ¶
type ListMeta struct {
Total int `json:"total"`
Skipped int `json:"skipped"`
PerPage int `json:"perPage"`
Page int `json:"page"`
PageCount int `json:"pageCount"`
}
ListMeta is pagination metadata for paginated responses from the Petra API
type Logger ¶
type Logger interface {
Printf(format string, v ...interface{})
}
Logger interface for custom loggers
type Metadata ¶
type Metadata map[string]interface{}
Metadata is an key-value pairs added to Petra API requests
type Page ¶
type Page struct {
ID int `json:"id,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
UpdatedAt string `json:"updatedAt,omitempty"`
Domain string `json:"domain,omitempty"`
Integration int `json:"integration,omitempty"`
Name string `json:"name,omitempty"`
Slug string `json:"slug,omitempty"`
Description string `json:"description,omitempty"`
Amount float32 `json:"amount,omitempty"`
Currency string `json:"currency,omitempty"`
Active bool `json:"active,omitempty"`
RedirectURL string `json:"redirect_url,omitempty"`
CustomFields []map[string]string `json:"custom_fields,omitempty"`
}
type PageService ¶
type PageService service
func (*PageService) List ¶
func (s *PageService) List() (*PageList, error)
type RequestValues ¶
RequestValues aliased to url.Values as a workaround
func (RequestValues) MarshalJSON ¶
func (v RequestValues) MarshalJSON() ([]byte, error)
MarshalJSON to handle custom JSON decoding for RequestValues
type Transaction ¶
type Transaction struct {
ID int `json:"id,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
Domain string `json:"domain,omitempty"`
Metadata string `json:"metadata,omitempty"` //TODO: why is transaction metadata a string?
Status string `json:"status,omitempty"`
Reference string `json:"reference,omitempty"`
Amount float32 `json:"amount,omitempty"`
Message string `json:"message,omitempty"`
GatewayResponse string `json:"gateway_response,omitempty"`
PaidAt string `json:"piad_at,omitempty"`
Channel string `json:"channel,omitempty"`
Currency string `json:"currency,omitempty"`
IPAddress string `json:"ip_address,omitempty"`
Log map[string]interface{} `json:"log,omitempty"` // TODO: same as timeline?
Fees int `json:"int,omitempty"`
FeesSplit string `json:"fees_split,omitempty"` // TODO: confirm data type
Customer Customer `json:"customer,omitempty"`
}
type TransactionList ¶
type TransactionList struct {
Meta ListMeta
Values []Transaction `json:"data"`
}
type TransactionService ¶
type TransactionService service
func (*TransactionService) Get ¶
func (s *TransactionService) Get(id int) (*Transaction, error)
func (*TransactionService) Initialize ¶
func (s *TransactionService) Initialize(txn *CreateTransactionRequest) (Response, error)
func (*TransactionService) List ¶
func (s *TransactionService) List() (*TransactionList, error)
func (*TransactionService) ListN ¶
func (s *TransactionService) ListN(count, offset int) (*TransactionList, error)
func (*TransactionService) Verify ¶
func (s *TransactionService) Verify(reference string) (*Transaction, error)
Click to show internal directories.
Click to hide internal directories.