omise-go: github.com/omise/omise-go Index | Examples | Files | Directories

package omise

import "github.com/omise/omise-go"

Package omise provides GO binding for Omise REST API. Full REST API documentation is available at https://www.omise.co/docs.

Usage

Create a client with omise.NewClient, supply your public and secret key. Then use the client.Do method with operation objects from the operations subpackage to perform API calls. The first parameter to client.Do lets you supply a struct to unmarshal the result into.

Example:

client, e := omise.NewClient(OMISE_PUBKEY, OMISE_KEY)
if e != nil {
	panic(e)
}

charge, create := &omise.Charge{}, &operations.CreateCharge{
	Amount:   100000, // ฿1,000.00
	Currency: "thb",
	Card:     "tok_1234",
}

if e := client.Do(charge, create); e != nil {
	panic(e)
}

fmt.Printf("%#v\n", charge)

Handling nils

For REQUESTS: Where optional parameters are concerned, empty values are considered as not sending the value except where doing so may have undesirable implications. This is to avoid the need for pointer indirections when creating the struct.

For RESPONSES: Optional fields always use nillable types or types with well-defined "empty" value. For example, an optional `string` field will have `*string` type.

Test keys

You will need to supply a valid Omise API keys in order to run tests. Refer to the official documentation on Authentication at https://www.omise.co/api-authentication for more information.

To specify the keys, set the environment variables before running the tests as follows:

export OMISE_PUBKEY=pkey_test_yourpublickey
export OMISE_KEY=skey_test_yoursecretkey

Live tests

Tests are run against fixtures by default. If you want to run network test against Omise test servers you can do so by supplying valid test keys *and* setting NETWORK environment variable to 1.

cd $GOPATH/src/github.com/omise/omise-go
NETWORK=1 go test -v ./operations

Index

Examples

Package Files

account.go balance.go bank_account.go base.go card.go charge.go charge_status.go client.go customer.go date.go dispute.go dispute_status.go document.go error.go event.go link.go list.go list_types.go occurrence.go occurrence_status.go offsite_types.go omise.go ordering.go receipt.go recipient.go recipient_type.go refund.go schedule.go search_result.go search_result_types.go search_scope.go source_of_funds.go token.go transaction.go transaction_type.go transfer.go transport.go webhook.go

Variables

var ErrInvalidKey = errors.New("invalid public or secret key")

ErrInvalidKey represents missing or bad API key errors.

func WebhookHTTPHandler Uses

func WebhookHTTPHandler(handler EventHandler) http.Handler

WebhookHTTPHandler creates an http.Handler that you can use to receive Omise's webhook API calls for events. The returned handler will automatically consume the request body and unmarshals an Event object from JSON for you.

See https://www.omise.co/api-webhooks for more information.

type Account Uses

type Account struct {
    Base
    Email string `json:"email" pretty:""`
}

Account represents Omise's account object. See https://www.omise.co/account-api for more information.

type AccountList Uses

type AccountList struct {
    List
    Data []*Account `json:"data"`
}

AccountList represents the list structure returned by Omise's REST API that contains Account struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*AccountList) Find Uses

func (list *AccountList) Find(id string) *Account

Find finds and returns Account with the given id. Returns nil if not found.

type Balance Uses

type Balance struct {
    Base
    Available int64  `json:"available" pretty:""`
    Total     int64  `json:"total" pretty:""`
    Currency  string `json:"currency" pretty:""`
}

Balance represents Omise's balance object. See https://www.omise.co/balance-api for more information.

type BalanceList Uses

type BalanceList struct {
    List
    Data []*Balance `json:"data"`
}

BalanceList represents the list structure returned by Omise's REST API that contains Balance struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*BalanceList) Find Uses

func (list *BalanceList) Find(id string) *Balance

Find finds and returns Balance with the given id. Returns nil if not found.

type BankAccount Uses

type BankAccount struct {
    Base
    Brand      string `json:"brand" pretty:""`
    Number     string `json:"number"`
    LastDigits string `json:"last_digits" pretty:""`
    Name       string `json:"name" pretty:""`

    // for Omise Japan
    BankCode    string          `json:"bank_code" pretty:""`
    BranchCode  string          `json:"branch_code" pretty:""`
    AccountType BankAccountType `json:"account_type" pretty:""`
}

BankAccount represents Omise's bank account object. See https://www.omise.co/bank-account-api for more information.

type BankAccountList Uses

type BankAccountList struct {
    List
    Data []*BankAccount `json:"data"`
}

BankAccountList represents the list structure returned by Omise's REST API that contains BankAccount struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*BankAccountList) Find Uses

func (list *BankAccountList) Find(id string) *BankAccount

Find finds and returns BankAccount with the given id. Returns nil if not found.

type BankAccountType Uses

type BankAccountType string

BankAccountType BankAccount an enumeration of possible types of BackAccount(s) which can be

const (
    Normal  BankAccountType = "normal"
    Current BankAccountType = "current"
)

BankAccountType can be one of the following list of constants:

type Base Uses

type Base struct {
    Object   string    `json:"object"`
    ID       string    `json:"id" pretty:""`
    Live     bool      `json:"livemode" pretty:""`
    Location *string   `json:"location"`
    Created  time.Time `json:"created"`
}

Base structure contains fields that are common to objects returned by the Omise's REST API.

type Card Uses

type Card struct {
    Base
    Country    string `json:"country"`
    City       string `json:"city"`
    Bank       string `json:"bank"`
    PostalCode string `json:"postal_code"`
    Financing  string `json:"financing"`
    LastDigits string `json:"last_digits" pretty:""`
    Brand      string `json:"brand" pretty:""`

    ExpirationMonth time.Month `json:"expiration_month" pretty:""`
    ExpirationYear  int        `json:"expiration_year" pretty:""`

    Fingerprint       string `json:"fingerprint"`
    Name              string `json:"name" pretty:""`
    SecurityCodeCheck bool   `json:"security_code_check"`
}

Card represents Omise's card object. See https://www.omise.co/cards-api for more information.

type CardList Uses

type CardList struct {
    List
    Data []*Card `json:"data"`
}

CardList represents the list structure returned by Omise's REST API that contains Card struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*CardList) Find Uses

func (list *CardList) Find(id string) *Card

Find finds and returns Card with the given id. Returns nil if not found.

type Charge Uses

type Charge struct {
    Base
    Status      ChargeStatus `json:"status"`
    Amount      int64        `json:"amount" pretty:""`
    Currency    string       `json:"currency" pretty:""`
    Description *string      `json:"description"`

    Capture    bool `json:"capture" pretty:""`
    Authorized bool `json:"authorized" pretty:""`
    Reversed   bool `json:"reversed" pretty:""`
    Paid       bool `json:"paid" pretty:""`

    Transaction string `json:"transaction"`
    Card        *Card  `json:"card"`

    Refunded       int64       `json:"refunded"`
    Refunds        *RefundList `json:"refunds"`
    FailureCode    *string     `json:"failure_code"`
    FailureMessage *string     `json:"failure_message"`

    CustomerID string   `json:"customer"`
    IP         *string  `json:"ip"`
    Dispute    *Dispute `json:"dispute"`

    ReturnURI    string `json:"return_uri"`
    AuthorizeURI string `json:"authorize_uri"`

    SourceOfFund SourceOfFunds `json:"source_of_fund"`
    Offsite      OffsiteTypes  `json:"offsite"`
}

Charge represents Omise's charge object. See https://www.omise.co/charges-api for more information.

type ChargeList Uses

type ChargeList struct {
    List
    Data []*Charge `json:"data"`
}

ChargeList represents the list structure returned by Omise's REST API that contains Charge struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*ChargeList) Find Uses

func (list *ChargeList) Find(id string) *Charge

Find finds and returns Charge with the given id. Returns nil if not found.

type ChargeSearchResult Uses

type ChargeSearchResult struct {
    SearchResult
    Data []*Charge `json:"data"`
}

ChargeSearchResult represents search result structure returned by Omise's Search API that contains Charge struct as result elements.

type ChargeStatus Uses

type ChargeStatus string

ChargeStatus represents an enumeration of possible status of a Charge object.

const (
    ChargeFailed     ChargeStatus = "failed"
    ChargePending    ChargeStatus = "pending"
    ChargeSuccessful ChargeStatus = "successful"
    ChargeReversed   ChargeStatus = "reversed"
)

ChargeStatus can be one of the following list of constants:

type Client Uses

type Client struct {
    *http.Client

    // Overrides
    Endpoints map[internal.Endpoint]string

    // configuration
    APIVersion string
    GoVersion  string
    // contains filtered or unexported fields
}

Client helps you configure and perform HTTP operations against Omise's REST API. It should be used with operation structures from the operations subpackage.

func NewClient Uses

func NewClient(pkey, skey string) (*Client, error)

NewClient creates and returns a Client with the given public key and secret key. Signs in to http://omise.co and visit https://dashboard.omise.co/test/dashboard to obtain your test (or live) keys.

func (*Client) Do Uses

func (c *Client) Do(result interface{}, operation internal.Operation) error

Do performs the supplied operation against Omise's REST API and unmarshal the response into the given result parameter. Results are usually basic objects or a list that corresponds to the operations being done.

If the operation is successful, result should contains the response data. Otherwise a non-nil error should be returned. Error maybe of the omise-go.Error struct type, in which case you can further inspect the Code and Message field for more information.

Code:

// gets your API keys
pkey, skey := "pkey_test_4yq6tct0llin5nyyi5l", "skey_test_4yq6tct0lblmed2yp5t"

// creates a client
client, e := NewClient(pkey, skey)
if e != nil {
    log.Fatal(e)
}

// creates a charge
charge, create := &Charge{}, &operations.CreateCharge{
    Amount:   100000, // ¥10,000
    Currency: "jpy",
    Card:     "tok_1234",
}

// checks for error
if e := client.Do(charge, create); e != nil {
    if omiseErr, ok := e.(*Error); ok {
        log.Fatal(omiseErr.Code + " " + omiseErr.Message)
    } else {
        log.Fatal("transport error: " + e.Error())
    }
}

// verify
fmt.Printf("authorized charge: %#v\n", charge)

func (*Client) Request Uses

func (c *Client) Request(operation internal.Operation) (*http.Request, error)

Request creates a new *http.Request that should performs the supplied Operation. Most people should use the Do method instead.

type Customer Uses

type Customer struct {
    Base
    DefaultCard string    `json:"default_card"`
    Email       string    `json:"email" pretty:""`
    Description string    `json:"description" pretty:""`
    Cards       *CardList `json:"cards"`
}

Customer represents Omise's customer object. See https://www.omise.co/customers-api for more information.

type CustomerList Uses

type CustomerList struct {
    List
    Data []*Customer `json:"data"`
}

CustomerList represents the list structure returned by Omise's REST API that contains Customer struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*CustomerList) Find Uses

func (list *CustomerList) Find(id string) *Customer

Find finds and returns Customer with the given id. Returns nil if not found.

type CustomerSearchResult Uses

type CustomerSearchResult struct {
    SearchResult
    Data []*Customer `json:"data"`
}

CustomerSearchResult represents search result structure returned by Omise's Search API that contains Customer struct as result elements.

type Date Uses

type Date time.Time

Date type for marshal/unmarshal JSON without time

func (Date) MarshalJSON Uses

func (d Date) MarshalJSON() ([]byte, error)

MarshalJSON Date type

func (Date) String Uses

func (d Date) String() string

func (*Date) UnmarshalJSON Uses

func (d *Date) UnmarshalJSON(b []byte) error

UnmarshalJSON Date type

type Deletion Uses

type Deletion struct {
    Base
    Deleted bool `json:"deleted" pretty:""`
}

Deletion struct is used to receive deletion responses from delete operations.

type DeletionList Uses

type DeletionList struct {
    List
    Data []*Deletion `json:"data"`
}

DeletionList represents the list structure returned by Omise's REST API that contains Deletion struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*DeletionList) Find Uses

func (list *DeletionList) Find(id string) *Deletion

Find finds and returns Deletion with the given id. Returns nil if not found.

type Dispute Uses

type Dispute struct {
    Base
    Amount   int64         `json:"amount" pretty:""`
    Currency string        `json:"currency" pretty:""`
    Status   DisputeStatus `json:"status" pretty:""`
    Message  string        `json:"message"`
    Charge   string        `json:"charge" pretty:""`
}

Dispute represents Omise's dispute object. See https://www.omise.co/disputes-api for more information.

type DisputeList Uses

type DisputeList struct {
    List
    Data []*Dispute `json:"data"`
}

DisputeList represents the list structure returned by Omise's REST API that contains Dispute struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*DisputeList) Find Uses

func (list *DisputeList) Find(id string) *Dispute

Find finds and returns Dispute with the given id. Returns nil if not found.

type DisputeSearchResult Uses

type DisputeSearchResult struct {
    SearchResult
    Data []*Dispute `json:"data"`
}

DisputeSearchResult represents search result structure returned by Omise's Search API that contains Dispute struct as result elements.

type DisputeStatus Uses

type DisputeStatus string

DisputeStatus represents an enumeration of possible status of a Dispute object.

const (
    Open    DisputeStatus = "open"
    Pending DisputeStatus = "pending"
    Won     DisputeStatus = "won"
    Lost    DisputeStatus = "lost"
    Closed  DisputeStatus = "closed" // meta-status only for querying, does not actually appear.
)

DisputeStatus can be one of the following list of constants:

type Document Uses

type Document struct {
    Base
    Filename string `json:"filename" pretty:""`
}

Document represents Omise's document object. See https://www.omise.co/documents-api for more information.

type DocumentList Uses

type DocumentList struct {
    List
    Data []*Document `json:"data"`
}

DocumentList represents the list structure returned by Omise's REST API that contains Document struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*DocumentList) Find Uses

func (list *DocumentList) Find(id string) *Document

Find finds and returns Document with the given id. Returns nil if not found.

type ErrInternal Uses

type ErrInternal string

ErrInternal represents internal library error. If you encounter this, it is mostly likely due to a bug in the omise-go library itself. Please report it by opening a new GitHub issue or contacting support.

func (ErrInternal) Error Uses

func (e ErrInternal) Error() string

type ErrTransport Uses

type ErrTransport struct {
    Err    error
    Buffer []byte
}

ErrTransport wraps error returned by omise-go internal HTTP transport implementation.

func (ErrTransport) Error Uses

func (e ErrTransport) Error() string

type Error Uses

type Error struct {
    Location   string `json:"location"`
    StatusCode int    `json:"status"`
    Code       string `json:"code"`
    Message    string `json:"message"`
}

Error struct represents errors that may be returned from Omise's REST API. You can use the Code or the HTTP StatusCode field to test for the exact error condition in your code.

func (*Error) Error Uses

func (e *Error) Error() string

func (*Error) String Uses

func (e *Error) String() string

type Event Uses

type Event struct {
    Base
    Key  string      `json:"key" pretty:""`
    Data interface{} `json:"data" pretty:""`
}

Event represents Omise's event object.

func (*Event) UnmarshalJSON Uses

func (ev *Event) UnmarshalJSON(buffer []byte) error

UnmarshalJSON unmarshals the buffer into an internal shim structure first, in order to determine the right structure to use for the .Data field. Then will re-unmarshal the structure as normal.

type EventHandler Uses

type EventHandler interface {
    HandleEvent(http.ResponseWriter, *http.Request, *Event)
}

EventHandler is an interface for handling events from the webhook http.Handler.

type EventHandlerFunc Uses

type EventHandlerFunc func(http.ResponseWriter, *http.Request, *Event)

EventHandlerFunc lets you use a plain function as an EventHandler type.

func (EventHandlerFunc) HandleEvent Uses

func (f EventHandlerFunc) HandleEvent(resp http.ResponseWriter, req *http.Request, event *Event)

HandleEvent implements the EventHandler interface by calling the underlying funciton.

type EventList Uses

type EventList struct {
    List
    Data []*Event `json:"data"`
}

EventList represents the list structure returned by Omise's REST API that contains Event struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*EventList) Find Uses

func (list *EventList) Find(id string) *Event

Find finds and returns Event with the given id. Returns nil if not found.

type Link struct {
    Base
    Amount     int64  `json:"amount"`
    Currency   string `json:"currency"`
    Used       bool   `json:"used"`
    Multiple   bool   `json:"multiple"`
    PaymentURI string `json:"payment_uri"`

    Title       string     `json:"title"`
    Description string     `json:"description"`
    Charges     ChargeList `json:"charges"`
}

Link represents Omise's link object. See https://www.omise.co/links-api for more information.

type LinkList struct {
    List
    Data []*Link `json:"data"`
}

LinkList represents the list structure returned by Omise's REST API that contains Link struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*LinkList) Find Uses

func (list *LinkList) Find(id string) *Link

Find finds and returns Link with the given id. Returns nil if not found.

type LinkSearchResult Uses

type LinkSearchResult struct {
    SearchResult
    Data []*Link `json:"data"`
}

LinkSearchResult represents search result structure returned by Omise's Search API that contains Link struct as result elements.

type List Uses

type List struct {
    Base
    From string `json:"from"`
    To   string `json:"to"`

    Offset int `json:"offset"`
    Limit  int `json:"limit"`
    Total  int `json:"total"`

    Order Ordering `json:"order"`
}

List structure contains fields that are common to list objects returned by the Omise's REST API. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

type Occurrence Uses

type Occurrence struct {
    Base
    Schedule     string                    `json:"schedule"`
    ScheduleDate Date                      `json:"schedule_date"`
    RetryDate    Date                      `json:"retry_date"`
    ProcessedAt  time.Time                 `json:"processed_at"`
    Status       schedule.OccurrenceStatus `json:"status"`
    Message      string                    `json:"message"`
    Result       string                    `json:"result"`
}

Occurrence represents occurrence charge from Schedule

type OccurrenceList Uses

type OccurrenceList struct {
    List
    Data []*Occurrence `json:"data"`
}

OccurrenceList represents the list structure returned by Omise's REST API that contains Occurrence struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*OccurrenceList) Find Uses

func (list *OccurrenceList) Find(id string) *Occurrence

Find finds and returns Occurrence with the given id. Returns nil if not found.

type OccurrenceStatus Uses

type OccurrenceStatus string

OccurrenceStatus represents an enumeration of possible status of a Occurrence object.

const (
    OccurrenceSkip       OccurrenceStatus = "skipped"
    OccurrenceFailed     OccurrenceStatus = "failed"
    OccurrenceSuccessful OccurrenceStatus = "successful"
)

OccurrenceStatus can be one of the following list of constants:

type OffsiteTypes Uses

type OffsiteTypes string

OffsiteTypes represents an enumeration of possible types of offsite charges.

const (
    InternetBankingSCB OffsiteTypes = "internet_banking_scb"
    InternetBankingBBL OffsiteTypes = "internet_banking_bbl"
    InternetBankingKTB OffsiteTypes = "internet_banking_ktb"
    InternetBankingBAY OffsiteTypes = "internet_banking_bay"
    Alipay             OffsiteTypes = "alipay"
)

OffsiteTypes can be one of the following list of constants:

type Ordering Uses

type Ordering string

Ordering represents an enumeration of possible values for list ordering while performing operations against the Omise API that result in List objects being returned.

const (
    UnspecifiedOrder     Ordering = ""
    Chronological        Ordering = "chronological"
    ReverseChronological Ordering = "reverse_chronological"
)

Ordering can be one of the following list of constants:

type Receipt Uses

type Receipt struct {
    Base
    Number                string    `json:"number"`
    Date                  time.Time `json:"date"`
    CustomerName          string    `json:"customer_name"`
    CustomerAddress       string    `json:"customer_address"`
    CustomerTaxID         string    `json:"customer_tax_id"`
    CustomerEmail         string    `json:"customer_email"`
    CustomerStatementName string    `json:"customer_statement_name"`

    CompanyName    string `json:"company_name"`
    CompanyAddress string `json:"company_address"`
    CompanyTaxID   string `json:"company_tax_id"`

    ChargeFee   int64  `json:"charge_fee"`
    VoidedFee   int64  `json:"voided_fee"`
    TransferFee int64  `json:"transfer_fee"`
    SubTotal    int64  `json:"subtotal"`
    VAT         int64  `json:"vat"`
    WHT         int64  `json:"wht"`
    Total       int64  `json:"total"`
    CreditNote  bool   `json:"credit_note"`
    Currency    string `json:"currency"`
}

Receipt represents Omise's receipt object. See https://www.omise.co/receipt-api for more information.

type ReceiptList Uses

type ReceiptList struct {
    List
    Data []*Receipt `json:"data"`
}

ReceiptList represents the list structure returned by Omise's REST API that contains Receipt struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*ReceiptList) Find Uses

func (list *ReceiptList) Find(id string) *Receipt

Find finds and returns Receipt with the given id. Returns nil if not found.

type Recipient Uses

type Recipient struct {
    Base
    Verified    bool          `json:"verified"`
    Active      bool          `json:"active"`
    Name        string        `json:"name" pretty:""`
    Email       string        `json:"email" pretty:""`
    Description *string       `json:"description"`
    Type        RecipientType `json:"type" pretty:""`
    TaxID       *string       `json:"tax_id"`
    BankAccount *BankAccount  `json:"bank_account"`
    FailureCode *string       `json:"failure_code"`
}

Recipient represents Omise's recipient object. See https://www.omise.co/recipients-api for more information.

type RecipientList Uses

type RecipientList struct {
    List
    Data []*Recipient `json:"data"`
}

RecipientList represents the list structure returned by Omise's REST API that contains Recipient struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*RecipientList) Find Uses

func (list *RecipientList) Find(id string) *Recipient

Find finds and returns Recipient with the given id. Returns nil if not found.

type RecipientSearchResult Uses

type RecipientSearchResult struct {
    SearchResult
    Data []*Recipient `json:"data"`
}

RecipientSearchResult represents search result structure returned by Omise's Search API that contains Recipient struct as result elements.

type RecipientType Uses

type RecipientType string

RecipientType represents an enumeration of possible types of Recipient(s).

const (
    Individual  RecipientType = "individual"
    Corporation RecipientType = "corporation"
)

RecipientType can be one of the following list of constants:

type Refund Uses

type Refund struct {
    Base
    Amount      int64  `json:"amount" pretty:""`
    Currency    string `json:"currency" pretty:""`
    Charge      string `json:"charge" pretty:""`
    Transaction string `json:"transaction"`
}

Refund represents Omise's refund object. See https://www.omise.co/refunds-api for more information.

type RefundList Uses

type RefundList struct {
    List
    Data []*Refund `json:"data"`
}

RefundList represents the list structure returned by Omise's REST API that contains Refund struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*RefundList) Find Uses

func (list *RefundList) Find(id string) *Refund

Find finds and returns Refund with the given id. Returns nil if not found.

type RefundSearchResult Uses

type RefundSearchResult struct {
    SearchResult
    Data []*Refund `json:"data"`
}

RefundSearchResult represents search result structure returned by Omise's Search API that contains Refund struct as result elements.

type Schedule Uses

type Schedule struct {
    Base
    Status          schedule.Status          `json:"status"`
    Every           int                      `json:"every"`
    Period          schedule.Period          `json:"period"`
    On              schedule.On              `json:"on"`
    InWords         string                   `json:"in_words"`
    StartDate       Date                     `json:"start_date"`
    EndDate         Date                     `json:"end_date"`
    Charge          *schedule.ChargeDetail   `json:"charge"`
    Transfer        *schedule.TransferDetail `json:"transfer"`
    Occurrences     OccurrenceList           `json:"occurrences"`
    NextOccurrences []Date                   `json:"next_occurrences"`
}

Schedule represents Omise's schedule object. See https://www.omise.co/schedule-api for more information.

type ScheduleList Uses

type ScheduleList struct {
    List
    Data []*Schedule `json:"data"`
}

ScheduleList represents the list structure returned by Omise's REST API that contains Schedule struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*ScheduleList) Find Uses

func (list *ScheduleList) Find(id string) *Schedule

Find finds and returns Schedule with the given id. Returns nil if not found.

type SearchResult Uses

type SearchResult struct {
    Base
    Scope   SearchScope       `json:"scope"`
    Query   string            `json:"query"`
    Filters map[string]string `json:"filters"`

    Page       int `json:"page"`
    Total      int `json:"total"`
    TotalPages int `json:"total_pages"`

    Order Ordering `json:"order"`
}

SearchResult structure contains fields that are common to search result objects returned by Omise's REST API.

type SearchScope Uses

type SearchScope string

SearchScope represents an enumeration of possible scopes that can be used with the Search API.

const (
    UnspecifiedScope SearchScope = ""

    ChargeScope    SearchScope = "charge"
    DisputeScope   SearchScope = "dispute"
    RecipientScope SearchScope = "recipient"
    CustomerScope  SearchScope = "customer"
    RefundScope    SearchScope = "refund"
    TransferScope  SearchScope = "transfer"
    LinkScope      SearchScope = "link"
)

SearchScope can be one of the following constants:

type SourceOfFunds Uses

type SourceOfFunds string

SourceOfFunds represents an enumeration of possible source of funds on a Charge object.

const (
    FromCard    SourceOfFunds = "card"
    FromOffsite SourceOfFunds = "offsite"
)

SourceOfFunds can be one the following list of constants:

type Token Uses

type Token struct {
    Base
    Used bool  `json:"used" pretty:""`
    Card *Card `json:"card" pretty:""`
}

Token represents Omise's token object. See https://www.omise.co/tokens-api for more information.

!!! IMPORTANT !!! - Full Credit Card data should never go through your server.

Sending card data from server requires a valid PCI-DSS certification. You can learn more about this on the Security Best Practices page at https://www.omise.co/security-best-practices

type TokenList Uses

type TokenList struct {
    List
    Data []*Token `json:"data"`
}

TokenList represents the list structure returned by Omise's REST API that contains Token struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*TokenList) Find Uses

func (list *TokenList) Find(id string) *Token

Find finds and returns Token with the given id. Returns nil if not found.

type Transaction Uses

type Transaction struct {
    Base
    Source string          `json:"source" pretty:""`
    Type   TransactionType `json:"type" pretty:""`

    Amount       int64     `json:"amount" pretty:""`
    Currency     string    `json:"currency" pretty:""`
    Transferable time.Time `json:"transferable" pretty:""`
}

Transaction represents Omise's transaction object. See https://www.omise.co/transactions-api for more information.

type TransactionList Uses

type TransactionList struct {
    List
    Data []*Transaction `json:"data"`
}

TransactionList represents the list structure returned by Omise's REST API that contains Transaction struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*TransactionList) Find Uses

func (list *TransactionList) Find(id string) *Transaction

Find finds and returns Transaction with the given id. Returns nil if not found.

type TransactionType Uses

type TransactionType string

TransactionType represents an enumeration of possible types of Transaction.

const (
    Credit TransactionType = "credit"
    Debit  TransactionType = "debit"
)

TransactionType can be one of the following list of constants:

type Transfer Uses

type Transfer struct {
    Base
    Recipient   string       `json:"recipient" pretty:""`
    BankAccount *BankAccount `json:"bank_account"`

    Sent     bool   `json:"sent" pretty:""`
    Paid     bool   `json:"paid" pretty:""`
    Fee      int64  `json:"fee" pretty:""`
    Amount   int64  `json:"amount" pretty:""`
    Currency string `json:"currency" pretty:""`

    FailureCode    *string `json:"failure_code"`
    FailureMessage *string `json:"failure_message"`
    Transaction    *string `json:"transaction"`
}

Transfer represents Omise's transfer object. See https://www.omise.co/transfers-api for more information.

type TransferList Uses

type TransferList struct {
    List
    Data []*Transfer `json:"data"`
}

TransferList represents the list structure returned by Omise's REST API that contains Transfer struct as member elements. See the pagination and lists documentation at https://www.omise.co/api-pagination for more information.

func (*TransferList) Find Uses

func (list *TransferList) Find(id string) *Transfer

Find finds and returns Transfer with the given id. Returns nil if not found.

type TransferSearchResult Uses

type TransferSearchResult struct {
    SearchResult
    Data []*Transfer `json:"data"`
}

TransferSearchResult represents search result structure returned by Omise's Search API that contains Transfer struct as result elements.

Directories

PathSynopsis
internal
internal/creds
internal/generator
internal/testutil
operationsPackage operations provide operation objects for use with Client.
schedule

Package omise imports 17 packages (graph) and is imported by 2 packages. Updated 2017-08-21. Refresh now. Tools for package owners.