operations

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: May 21, 2021 License: MIT Imports: 5 Imported by: 3

Documentation

Overview

Package operations provide operation objects for use with Client. The operation object itself is also used to specify the parameters to be sent. See the Client documentation and example attached to each operation for usage instruction.

!!! IMPORTANT !!! - Always refer to the official Omise's REST API documentation at https://www.omise.co/charges-api for the most up-to-date version of what each of these operations does.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaptureCharge

type CaptureCharge struct {
	ChargeID string `json:"-"`
}

If you have created a charge and passed capture=false you'll have an authorized only charge that you can capture at a later time. You can hold it for as long as permitted by the issuing bank. This delay may vary between cards from 1 to 30 days.

Example:

charge := &omise.Charge{ID: "chrg_1234"}
if e := client.Do(charge, &CaptureCharge{charge.ID}); e != nil {
	panic(e)
}

fmt.Println("captured:", charge.Captured)

func (*CaptureCharge) Describe added in v1.0.0

func (req *CaptureCharge) Describe() *internal.Description

type CreateCharge

type CreateCharge struct {
	Customer    string                 `json:"customer,omitempty"`
	Card        string                 `json:"card,omitempty"`
	Source      string                 `json:"source,omitempty"`
	Amount      int64                  `json:"amount"`
	Currency    string                 `json:"currency"`
	Offsite     omise.OffsiteTypes     `json:"offsite,omitempty"`
	Description string                 `json:"description,omitempty"`
	DontCapture bool                   `json:"-"` // inverse, since `capture` defaults to true
	ReturnURI   string                 `json:"return_uri,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

Note that because bool defaults to false in GO, we use DontCapture instead of Capture here so it matches with Omise's REST API default capture=true.

Example:

charge, create := &omise.Charge{}, &CreateCharge{
	Amount:      204842,
	Currency:    "thb",
	Description: "initial charge.",
	Card:        token.ID,
}
if e := client.Do(charge, create); e != nil {
	panic(e)
}

fmt.Println("created charge:", charge.ID)

func (*CreateCharge) Describe added in v1.0.0

func (req *CreateCharge) Describe() *internal.Description

func (*CreateCharge) MarshalJSON

func (req *CreateCharge) MarshalJSON() ([]byte, error)

type CreateChargeSchedule

type CreateChargeSchedule struct {
	Every          int
	Period         schedule.Period
	StartDate      string
	EndDate        string
	Weekdays       schedule.Weekdays
	DaysOfMonth    schedule.DaysOfMonth
	WeekdayOfMonth string

	Customer    string
	Amount      int
	Currency    string
	Card        string
	Description string
}

CreateChargeSchedule represent create charge schedule API payload

Example:

	var schd omise.Schedule
	create := operations.CreateChargeSchedule{
             Every:  3,
             Period: schedule.PeriodWeek,
             Weekdays: []schedule.Weekday{
             schedule.Monday,
             	schedule.Saturday,
             },
             StartDate: "2017-05-15",
             EndDate:   "2018-05-15",
             Customer:  "customer_id",
             Amount:    100000,
	}
	if e := client.Do(&schd, &create); e != nil {
		panic(e)
	}

	fmt.Println("created schedule:", schd.ID)

func (*CreateChargeSchedule) Describe added in v1.0.0

func (req *CreateChargeSchedule) Describe() *internal.Description

func (*CreateChargeSchedule) MarshalJSON

func (req *CreateChargeSchedule) MarshalJSON() ([]byte, error)

type CreateCustomer

type CreateCustomer struct {
	Email       string                 `json:"email,omitempty"`
	Description string                 `json:"description,omitempty"`
	Card        string                 `json:"card,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

Example:

customer, create := &omise.Customer{}, &CreateCustomer{
	Email:       "kokyaku@omise.co",
	Description: "I'm a customer",
	Card:        token.ID,
})
if e := client.Do(customer, create); e != nil {
	panic(e)
}

fmt.Printf("created customer: %#v\n", customer)

func (*CreateCustomer) Describe added in v1.0.0

func (req *CreateCustomer) Describe() *internal.Description
type CreateLink struct {
	Amount      int64  `json:"amount"`
	Currency    string `json:"currency"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Multiple    bool   `json:"multiple"`
}

func (*CreateLink) Describe added in v1.0.0

func (req *CreateLink) Describe() *internal.Description

type CreateRecipient

type CreateRecipient struct {
	Name        string              `json:"name"`
	Email       string              `json:"email,omitempty"`
	Description string              `json:"description,omitempty"`
	Type        omise.RecipientType `json:"type"`
	TaxID       string              `json:"tax_id,omitempty"`
	BankAccount *omise.BankAccount  `json:"-"`
}

Example:

	bankAccount := &omise.BankAccount{
		Brand:  "bbl",
		Number: "1234567890",
		Name:   "Joe Example",
	}

	jun, create := &omise.Recipient{}, &CreateRecipient{
		Name:        "Jun Hasegawa",
		Email:       "jun@omise.co",
		Description: "Owns Omise",
		Type:        omise.Individual,
		BankAccount: bankAccount,
	}
	if e := client.Do(jun, create); e != nil {
		panic(e)
	}

	fmt.Println("created recipient:", jun.ID)

     # For Japan Bank Account
	bankAccount := &omise.BankAccount{
		BankCode:    "0001",
		BranchCode:  "001",
 	        AccountType: omise.Normal,
 	        Number:      "0000001",
		Name:        "Joe Example",
	}

	jun, create := &omise.Recipient{}, &CreateRecipient{
		Name:        "Jun Hasegawa",
		Email:       "jun@omise.co",
		Description: "Owns Omise",
		Type:        omise.Individual,
		BankAccount: bankAccount,
	}
	if e := client.Do(jun, create); e != nil {
		panic(e)
	}

	fmt.Println("created recipient:", jun.ID)

func (*CreateRecipient) Describe added in v1.0.0

func (req *CreateRecipient) Describe() *internal.Description

func (*CreateRecipient) MarshalJSON

func (req *CreateRecipient) MarshalJSON() ([]byte, error)

type CreateRefund

type CreateRefund struct {
	ChargeID string                 `json:"-"`
	Amount   int64                  `json:"amount"`
	Void     bool                   `json:"void,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

Example:

refund, create := &omise.Refund{}, &CreateRefund{
	ChargeID: charge.ID,
	Amount:   charge.Amount >> 1, // half
}
if e := client.Do(refund, create); e != nil {
	panic(e)
}

fmt.Println("refunded half of charge with:", refund.ID)

func (*CreateRefund) Describe added in v1.0.0

func (req *CreateRefund) Describe() *internal.Description

type CreateSource

type CreateSource struct {
	Type                     string `json:"type"`
	Amount                   int64  `json:"amount"`
	Currency                 string `json:"currency"`
	Bank                     string `json:"bank,omitempty"`
	Barcode                  string `json:"barcode,omitempty"`
	Email                    string `json:"email,omitempty"`
	InstallmentTerm          int64  `json:"installment_term,omitempty"`
	Name                     string `json:"name,omitempty"`
	PhoneNumber              string `json:"phone_number,omitempty"`
	StoreID                  string `json:"store_id,omitempty"`
	StoreName                string `json:"store_name,omitempty"`
	TerminalID               string `json:"terminal_id,omitempty"`
	ZeroInterestInstallments bool   `json:"zero_interest_installments,omitempty"`
}

Example: Create source

source, createSource := &omise.Source{}, &CreateSource{
	Amount:   100000,
	Currency: "thb",
	Type:     "bill_payment_tesco_lotus",
}
if e := client.Do(source, createSource); e != nil {
	panic(e)
}

fmt.Println("created source:", source.ID)

func (*CreateSource) Describe added in v1.0.0

func (req *CreateSource) Describe() *internal.Description

type CreateToken

type CreateToken struct {
	Name            string     `json:"name"`
	Number          string     `json:"number"`
	ExpirationMonth time.Month `json:"expiration_month"`
	ExpirationYear  int        `json:"expiration_year"`

	SecurityCode string `json:"security_code"`
	City         string `json:"city,omitempty"`
	PostalCode   string `json:"postal_code,omitempty"`
}

Example:

token, create := &omise.Token{}, &CreateToken{
	Name:            "Chakrit Wichian",
	Number:          "4242424242424242",
	ExpirationMonth: 2,
	ExpirationYear:  time.Now().AddDate(1, 0, 0).Year(),

	SecurityCode: "123",
	City:         "Bangkok",
	PostalCode:   "10240",
}
if e := client.Do(token, CreateTokenOp); e != nil {
	panic(e)
}

fmt.Println("created token:", token.ID)

func (*CreateToken) Describe added in v1.0.0

func (req *CreateToken) Describe() *internal.Description

func (*CreateToken) MarshalJSON added in v1.0.1

func (req *CreateToken) MarshalJSON() ([]byte, error)

type CreateTransfer

type CreateTransfer struct {
	Amount    int64                  `json:"amount,omitempty"`
	Recipient string                 `json:"recipient,omitempty"`
	FailFast  bool                   `json:"fail_fast,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

Example:

transfer, create := &omise.Transfer{}, &CreateTransfer{
	Amount: 32100,
}
if e := client.Do(transfer, create); e != nil {
	panic(e)
}

fmt.Println("transferred to default recipient with:", transfer.ID)

func (*CreateTransfer) Describe added in v1.0.0

func (req *CreateTransfer) Describe() *internal.Description

type CreateTransferSchedule

type CreateTransferSchedule struct {
	Every          int
	Period         schedule.Period
	StartDate      string
	EndDate        string
	Weekdays       schedule.Weekdays
	DaysOfMonth    schedule.DaysOfMonth
	WeekdayOfMonth string

	Recipient           string
	Amount              int
	PercentageOfBalance float64
}

CreateTransferSchedule represent create transfer schedule API payload

Example:

	var schd omise.Schedule
	create = operations.CreateTransferSchedule{
             Every:  3,
             Period: schedule.PeriodWeek,
             Weekdays: []schedule.Weekday{
             schedule.Monday,
             	schedule.Saturday,
             },
             StartDate: "2017-05-15",
             EndDate:   "2018-05-15",
             Recipient:  "recipient_id",
             Amount:    100000,
	}
	if e := client.Do(&schd, &create); e != nil {
		panic(e)
	}

	fmt.Println("created schedule:", schd.ID)

func (*CreateTransferSchedule) Describe added in v1.0.0

func (req *CreateTransferSchedule) Describe() *internal.Description

func (*CreateTransferSchedule) MarshalJSON

func (req *CreateTransferSchedule) MarshalJSON() ([]byte, error)

type DestroyCard

type DestroyCard struct {
	CustomerID string `json:"-"`
	CardID     string `json:"-"`
}

Example:

del, destroy := &omise.Deletion{}, &DestroyCard{
	CustomerID: "cust_123",
	CardID:     "card_456",
}
if e := client.Do(del, destroy); e != nil {
	panic(e)
}

fmt.Println("deleted:", del.ID, del.Deleted)

func (*DestroyCard) Describe added in v1.0.0

func (req *DestroyCard) Describe() *internal.Description

type DestroyCustomer

type DestroyCustomer struct {
	CustomerID string `json:"-"`
}

Example:

del, destroy := &omise.Deletion{}, &DestroyCustomer{
	CustomerID: "cust_123",
}
if e := client.Do(del, destroy); e != nil {
	panic(e)
}

fmt.Println("destroyed customer:", del.ID)

func (*DestroyCustomer) Describe added in v1.0.0

func (req *DestroyCustomer) Describe() *internal.Description

type DestroyRecipient

type DestroyRecipient struct {
	RecipientID string `json:"-"`
}

Example:

del, destroy := &omise.Deletion{}, &DestroyRecipient{"recp-123"}
if e := client.Do(del, destroy); e != nil {
	panic(e)
}

fmt.Println("destroyed recipient:", del.ID)

func (*DestroyRecipient) Describe added in v1.0.0

func (req *DestroyRecipient) Describe() *internal.Description

type DestroySchedule

type DestroySchedule struct {
	ScheduleID string `json:"-"`
}

DestroySchedule represent destroy schedule API payload

Example:

     var deletedSchd omise.Schedule
	if e := client.Do(&deletedSchd, &DestroySchedule{ScheduleID: "schd_57z9hj228pusa652nk1"}); e != nil {
		panic(e)
	}

	fmt.Println("destroyed schedule:", deletedSchd.ID)

func (*DestroySchedule) Describe added in v1.0.0

func (req *DestroySchedule) Describe() *internal.Description

type DestroyTransfer

type DestroyTransfer struct {
	TransferID string `json:"-"`
}

Example:

del, destroy := &omise.Deletion{}, &DestroyTransfer{"trsf_777"}
if e := client.Do(del, destroy); e != nil {
	panic(e)
}

fmt.Println("not transferring anymore:", del.ID)

func (*DestroyTransfer) Describe added in v1.0.0

func (req *DestroyTransfer) Describe() *internal.Description

type List

type List struct {
	Offset int            `json:"offset,omitempty"`
	Limit  int            `json:"limit,omitempty"`
	From   time.Time      `json:"-"`
	To     time.Time      `json:"-"`
	Order  omise.Ordering `json:"order,omitempty"`
}

List contains fields that represent parameters common to most list operations. List struct is not an operation in and of itself and cannot be used with client.Do directly. Use one of the predefined XXXList operations defined blow instead and supply List struct as the first field.

See the Pagination and Lists documentation at https://www.omise.co/api-pagination for more information.

func (List) MarshalJSON

func (l List) MarshalJSON() ([]byte, error)

MarshalJSON List type

type ListCards

type ListCards struct {
	CustomerID string
	List
}

Example:

cards, list := &omise.CardList{}, &ListCards{
	CustomerID: "cust_333",
}
if e := client.Do(cards, list); e != nil {
	panic(e)
}

fmt.Println("# of customer's cards:", len(cards.Data))

func (*ListCards) Describe added in v1.0.0

func (req *ListCards) Describe() *internal.Description

type ListChargeSchedules

type ListChargeSchedules struct {
	List
}

ListChargeSchedules represent list charge schedules API payload

Example:

     var schds omise.ScheduleList
	list = ListChargeSchedules{
		List: List{
			Limit: 100,
			From: time.Now().Add(-1 * time.Hour),
		},
	}
	if e := client.Do(&schds, &list); e != nil {
		panic(e)
	}

	fmt.Println("# of charge schedules made in the last hour:", len(schds.Data))

func (*ListChargeSchedules) Describe added in v1.0.0

func (req *ListChargeSchedules) Describe() *internal.Description

type ListCharges

type ListCharges struct {
	List
}

Example:

charges, list := &omise.ChargeList{}, &ListCharges{
	List{
		Limit: 100,
		From: time.Now().Add(-1 * time.Hour),
	},
}
if e := client.Do(charges, list); e != nil {
	panic(e)
}

fmt.Println("# of charges made in the last hour:", len(charges.Data))

func (*ListCharges) Describe added in v1.0.0

func (req *ListCharges) Describe() *internal.Description

type ListCustomerChargeSchedules

type ListCustomerChargeSchedules struct {
	CustomerID string
	List
}

ListCustomerChargeSchedules represent list customer schedule schedules API payload

Example:

     var schds omise.ScheduleList
	list := ListCustomerChargeSchedules{
		CustomerID: "cust_123"
		List: List{
			Limit: 100,
			From: time.Now().Add(-1 * time.Hour),
		},
	}
	if e := client.Do(&schds, &list); e != nil {
		panic(e)
	}

	fmt.Println("# of schedules made in the last hour:", len(schds.Data))

func (*ListCustomerChargeSchedules) Describe added in v1.0.0

type ListCustomers

type ListCustomers struct {
	List
}

Example:

customers, list := &omise.CustomerList{}, &ListCustomers{
	List{
		From: time.Now().Add(-1 * time.Hour),
		Limit: 100
	},
}
if e := client.Do(customers, list); e != nil {
	panic(e)
}

fmt.Println("# of new customers in the last hour:", len(customers.Data))

func (*ListCustomers) Describe added in v1.0.0

func (req *ListCustomers) Describe() *internal.Description

type ListDisputes

type ListDisputes struct {
	State omise.DisputeStatus
	List
}

Example:

disputes, list := &omise.DisputeList{}, &ListDisputes{
	State: omise.Open,
}
if e := client.Do(disputes, list); e != nil {
	panic(e)
}

fmt.Println("# of open disputes:", len(disputes.Data))

func (*ListDisputes) Describe added in v1.0.0

func (req *ListDisputes) Describe() *internal.Description

type ListEvents

type ListEvents struct {
	List
}

Example:

events, list := &omise.EventList{}, &ListEvents{}
if e := client.Do(events, list); e != nil {
	panic(e)
}

fmt.Println("# of events:", len(events.Data))

func (*ListEvents) Describe added in v1.0.0

func (req *ListEvents) Describe() *internal.Description
type ListLinks struct {
	List
}

func (*ListLinks) Describe added in v1.0.0

func (req *ListLinks) Describe() *internal.Description

type ListReceipts

type ListReceipts struct {
	List
}

Example:

receipts, list := &omise.ReceiptList{}, &ListReceipts{
	List{Offset: 100, Limit: 20},
}
if e := client.Do(receipts, list); e != nil {
	panic(e)
}

fmt.Println("receipts #100-#120:", receipts.Data)

func (*ListReceipts) Describe added in v1.0.0

func (req *ListReceipts) Describe() *internal.Description

type ListRecipientTransferSchedules

type ListRecipientTransferSchedules struct {
	RecipientID string
	List
}

ListRecipientTransferSchedules represent list recipient transfer schedules API payload

Example:

     var schds omise.ScheduleList
	list := ListRecipientTransferSchedules{
		RecipientID: "reci_123"
		List: List{
			Limit: 100,
			From: time.Now().Add(-1 * time.Hour),
		},
	}
	if e := client.Do(&schds, &list); e != nil {
		panic(e)
	}

	fmt.Println("# of schedules made in the last hour:", len(schds.Data))

func (*ListRecipientTransferSchedules) Describe added in v1.0.0

type ListRecipients

type ListRecipients struct {
	List
}

Example:

recipients, list := &omise.RecipientList{}, &ListRecipients{
	List{Offset: 100, Limit: 20},
}
if e := client.Do(recipients, list); e != nil {
	panic(e)
}

fmt.Println("recipients #100-#120:", recipients.Data)

func (*ListRecipients) Describe added in v1.0.0

func (req *ListRecipients) Describe() *internal.Description

type ListRefunds

type ListRefunds struct {
	ChargeID string
	List
}

Example:

refunds, list := &omise.RefundList{}, &ListRefunds{"chrg_333"}
if e := client.Do(refunds, list); e != nil {
	panic(e)
}

fmt.Println("refunded on chrg_333:", refunds.Data[0].Amount)

func (*ListRefunds) Describe added in v1.0.0

func (req *ListRefunds) Describe() *internal.Description

type ListScheduleOccurrences

type ListScheduleOccurrences struct {
	ScheduleID string
	List
}

ListScheduleOccurrences represent list schedule occurrences API payload

Example:

     var occurrences omise.OccurrenceList
	list := ListOccurrenceSchedules{
		ScheduleID: "schd_57z9hj228pusa652nk1",
		List: List{
			Limit: 100,
			From: time.Now().Add(-1 * time.Hour),
		},
	}
	if e := client.Do(&occurrences, &list); e != nil {
		panic(e)
	}

	fmt.Println("occurrences made in the last hour:", len(occurrences.Data))

func (*ListScheduleOccurrences) Describe added in v1.0.0

func (req *ListScheduleOccurrences) Describe() *internal.Description

type ListSchedules

type ListSchedules struct {
	List
}

ListSchedules represent list schedule API payload

Example:

     var schds omise.ScheduleList
	list := ListSchedules{
		List: List{
			Limit: 100,
			From: time.Now().Add(-1 * time.Hour),
		},
	}
	if e := client.Do(&schds, &list); e != nil {
		panic(e)
	}

	fmt.Println("# of schedules made in the last hour:", len(schds.Data))

func (*ListSchedules) Describe added in v1.0.0

func (req *ListSchedules) Describe() *internal.Description

type ListTransactions

type ListTransactions struct {
	List
}

Example:

transactions, list := &omise.TransactionList{}, &ListTransaction{
	List{
		Limit: 100,
		From: time.Now().Add(-1 * time.Hour),
	},
}
if e := client.Do(transactions, list); !a.NoError(t, e) {
	return
}

fmt.Println("# of transactions in the last hour:", len(transactions.Data))

func (*ListTransactions) Describe added in v1.0.0

func (req *ListTransactions) Describe() *internal.Description

type ListTransferSchedules

type ListTransferSchedules struct {
	List
}

ListTransferSchedules represent list transfer schedules API payload

Example:

     var schds omise.ScheduleList
	list = ListTransferSchedules{
		List: List{
			Limit: 100,
			From: time.Now().Add(-1 * time.Hour),
		},
	}
	if e := client.Do(&schds, &list); e != nil {
		panic(e)
	}

	fmt.Println("# of transfer schedules made in the last hour:", len(schds.Data))

func (*ListTransferSchedules) Describe added in v1.0.0

func (req *ListTransferSchedules) Describe() *internal.Description

type ListTransfers

type ListTransfers struct {
	List
}

Example:

transfers, list := &omise.TransferList{}, &ListTransfers{
	List{
		Limit: 100,
		From: time.Now().Add(-1 * time.Hour),
	},
}
if e := client.Do(transfers, list); e != nil {
	panic(e)
}

fmt.Println("# of transfers in the last hour:", len(transfers.Data))

func (*ListTransfers) Describe added in v1.0.0

func (req *ListTransfers) Describe() *internal.Description

type RetrieveAccount

type RetrieveAccount struct{}

Example:

account := &omise.Account{}
if e := client.Do(account, &RetrieveAccount{}); e != nil {
	panic(e)
}

fmt.Printf("my account!: %#v\n", account)

func (*RetrieveAccount) Describe added in v1.0.0

func (req *RetrieveAccount) Describe() *internal.Description

type RetrieveBalance

type RetrieveBalance struct{}

Example:

balance := &omise.Balance{}
if e := client.Do(balance, &RetrieveBalance{}); e != nil {
	panic(e)
}

fmt.Println("we have $", balance.Available)

func (*RetrieveBalance) Describe added in v1.0.0

func (req *RetrieveBalance) Describe() *internal.Description

type RetrieveCapability added in v1.0.6

type RetrieveCapability struct{}

Example: Retrieve Capability

capability, retrieve := &omise.RetrieveCapability{}, &RetrieveCapability{}
if e := client.Do(capability, retrieve); e != nil {
	panic(e)
}

fmt.Printf("list payment methods: %#v\n", capability.PaymentMethods)

func (*RetrieveCapability) Describe added in v1.0.6

func (req *RetrieveCapability) Describe() *internal.Description

type RetrieveCard

type RetrieveCard struct {
	CustomerID string `json:"-"`
	CardID     string `json:"-"`
}

Example:

card, retrieve := &omise.Card{}, &RetrieveCard{
	CustomerID: "cust_888",
	CardID:     "card_999",
}
if e := client.Do(card, retrieve); e != nil {
	panic(e)
}

fmt.Printf("the card: %#v\n", card)

func (*RetrieveCard) Describe added in v1.0.0

func (req *RetrieveCard) Describe() *internal.Description

type RetrieveCharge

type RetrieveCharge struct {
	ChargeID string `json:"-"`
}

Example:

charge := &omise.Charge{ID: "chrg_323"}
if e := client.Do(charge, &RetrieveCharge{charge.ID}); e != nil {
	panic(e)
}

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

func (*RetrieveCharge) Describe added in v1.0.0

func (req *RetrieveCharge) Describe() *internal.Description

type RetrieveCustomer

type RetrieveCustomer struct {
	CustomerID string `json:"-"`
}

Example:

cust, retrieve := &omise.Customer{}, &RetrieveCustomer{"cust_123"}
if e := client.Do(cust, retrieve); e != nil {
	panic(e)
}

fmt.Printf("cust_123: %#v\n", cust)

func (*RetrieveCustomer) Describe added in v1.0.0

func (req *RetrieveCustomer) Describe() *internal.Description

type RetrieveDispute

type RetrieveDispute struct {
	DisputeID string `json:"-"`
}

Example:

dispute, retrieve := &omise.Dispute{}, &RetrieveDispute{"dspt_123"}
if e := client.Do(dispute, retrieve); e != nil {
	panic(e)
}

fmt.Printf("dispute #123: %#v\n", dispute)

func (*RetrieveDispute) Describe added in v1.0.0

func (req *RetrieveDispute) Describe() *internal.Description

type RetrieveEvent

type RetrieveEvent struct {
	EventID string `json:"-"`
}

Example:

event, retrieve := &omise.Event{}, &RetrieveEvent{"evnt_123"}
if e := client.Do(event, retrieve); e != nil {
	panic(e)
}

fmt.Printf("evnt_123: %#v\n", event)

func (*RetrieveEvent) Describe added in v1.0.0

func (req *RetrieveEvent) Describe() *internal.Description
type RetrieveLink struct {
	LinkID string `json:"-"`
}

func (*RetrieveLink) Describe added in v1.0.0

func (req *RetrieveLink) Describe() *internal.Description

type RetrieveOccurrence

type RetrieveOccurrence struct {
	OccurrenceID string `json:"-"`
}

RetrieveOccurrence represent retrieve occurrence API payload

Example:

var occurrence omise.Occurrence
if e := client.Do(&occurrence, &RetrieveOccurrence{OccurrenceID: "occu_57z9hj228pusa652nk1"}); e != nil {
	panic(e)
}

fmt.Printf("occurrence #occu_57z9hj228pusa652nk1: %#v\n", occurrence)

func (*RetrieveOccurrence) Describe added in v1.0.0

func (req *RetrieveOccurrence) Describe() *internal.Description

type RetrieveReceipt

type RetrieveReceipt struct {
	ReceiptID string `json:"-"`
}

Example:

rcpt, receipt := &omise.Receipt{}, &RetrieveReceipt{"rcpt_123"}
if e := client.Do(rcpt, receipt); e != nil {
	panic(e)
}

fmt.Printf("receipt #123: %#v\n", rcpt)

func (*RetrieveReceipt) Describe added in v1.0.0

func (req *RetrieveReceipt) Describe() *internal.Description

type RetrieveRecipient

type RetrieveRecipient struct {
	RecipientID string `json:"-"`
}

Example:

recp, retrieve := &omise.Recipient{}, &RetrieveRecipient{"recp_123"}
if e := client.Do(recp, retrieve); e != nil {
	panic(e)
}

fmt.Printf("recipient #123: %#v\n", recp)

func (*RetrieveRecipient) Describe added in v1.0.0

func (req *RetrieveRecipient) Describe() *internal.Description

type RetrieveRefund

type RetrieveRefund struct {
	ChargeID string `json:"-"`
	RefundID string `json:"-"`
}

Example:

refund, retrieve := &omise.Refund{}, &RetrieveRefund{
	ChargeID: "chrg_123",
	RefundID: "rfnd_777",
}
if e := client.Do(refund, retrieve); e != nil {
	panic(e)
}

fmt.Printf("refund #777: %#v\n", refund)

func (*RetrieveRefund) Describe added in v1.0.0

func (req *RetrieveRefund) Describe() *internal.Description

type RetrieveSchedule

type RetrieveSchedule struct {
	ScheduleID string `json:"-"`
}

RetrieveSchedule represent retrieve schedule API payload

Example:

var schd omise.Schedule
if e := client.Do(&schd, &RetrieveSchedule{ScheduleID: "schd_57z9hj228pusa652nk1"}); e != nil {
	panic(e)
}

fmt.Printf("schedule #schd_57z9hj228pusa652nk1: %#v\n", schd)

func (*RetrieveSchedule) Describe added in v1.0.0

func (req *RetrieveSchedule) Describe() *internal.Description

type RetrieveSource

type RetrieveSource struct {
	SourceID string `json:"-"`
}

Example: Retrieve Source

source, retrieve := &omise.Source{}, &RetrieveSource{"src_123"}
if e := client.Do(source, retrieve); e != nil {
	panic(e)
}

fmt.Printf("source #123: %#v\n", source)

func (*RetrieveSource) Describe added in v1.0.0

func (req *RetrieveSource) Describe() *internal.Description

type RetrieveToken

type RetrieveToken struct {
	ID string `json:"-"`
}

Example:

token, retrieve := &omise.Token{}, &RetrieveToken{"tok_789"}
if e := client.Do(token, retrieve); e != nil {
	panic(e)
}

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

func (*RetrieveToken) Describe added in v1.0.0

func (token *RetrieveToken) Describe() *internal.Description

type RetrieveTransaction

type RetrieveTransaction struct {
	TransactionID string `json:"-"`
}

Example:

transaction, retrieve := &omise.Transaction{}, &RetrieveTransaction{"trxn_987"}
	TransactionID: transactions.Data[0].ID,
}
if e := client.Do(transaction, retrieve); e != nil {
	panic(e)
}

fmt.Printf("transaction #trxn_987: %#v\n", transaction)

func (*RetrieveTransaction) Describe added in v1.0.0

func (req *RetrieveTransaction) Describe() *internal.Description

type RetrieveTransfer

type RetrieveTransfer struct {
	TransferID string `json:"-"`
}

Example:

transfer, retrieve := &omise.Transfer{}, &RetrieveTransfer{"trsf_123"}
if e := client.Do(transfer, retrieve); e != nil {
	panic(e)
}

fmt.Printf("transfer #123: %#v\n", transfer)

func (*RetrieveTransfer) Describe added in v1.0.0

func (req *RetrieveTransfer) Describe() *internal.Description

type ReverseCharge

type ReverseCharge struct {
	ChargeID string `json:"-"`
}

If you have created a charge and passed capture=false you'll have an authorized only charge that can be reversed, releasing held money, at a later time without incurring a refund fee.

func (*ReverseCharge) Describe added in v1.0.0

func (req *ReverseCharge) Describe() *internal.Description
type Search struct {
	Scope   omise.SearchScope `json:"scope"`
	Query   string            `json:"query,omitempty"`
	Filters map[string]string `json:"filters,omitempty"`
	Order   omise.Ordering    `json:"order,omitempty"`
	Page    int               `json:"page,omitempty"`
	PerPage int               `json:"per_page,omitempty"`
}

Example:

result, search := &omise.ChargeSearchResult{}, &Search{
	Scope: omise.ChargeScope,
	Query: "chrg_test_12345",
}
if e := client.Do(result, search); e != nil {
	panic(e)
}

func (*Search) Describe added in v1.0.0

func (req *Search) Describe() *internal.Description

type UpdateCard

type UpdateCard struct {
	CustomerID string `json:"-"`
	CardID     string `json:"-"`

	Name       string `json:"name,omitempty"`
	City       string `json:"city,omitempty"`
	PostalCode string `json:"postal_code,omitempty"`

	ExpirationMonth time.Month `json:"expiration_month,omitempty"`
	ExpirationYear  int        `json:"expiration_year,omitempty"`
}

Example:

card, update := &omise.Card{}, &UpdateCard{
	CustomerID: "cust_123",
	CardID:     "card_123",
	Name:       "Changed my name",
}
if e := client.Do(card, update); e != nil {
	panic(e)
}

fmt.Printf("updated card: %#v\n", card)

func (*UpdateCard) Describe added in v1.0.0

func (req *UpdateCard) Describe() *internal.Description

type UpdateCharge

type UpdateCharge struct {
	ChargeID    string                 `json:"-"`
	Description string                 `json:"description"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

Example:

charge, update := &omise.Charge{}, &UpdateCharge{
	ChargeID:    "chrg_456",
	Description: "updated charge.",
}
if e := client.Do(charge, update); e != nil {
	panic(e)
}

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

func (*UpdateCharge) Describe added in v1.0.0

func (req *UpdateCharge) Describe() *internal.Description

type UpdateCustomer

type UpdateCustomer struct {
	CustomerID  string                 `json:"-"`
	Email       string                 `json:"email,omitempty"`
	Description string                 `json:"description,omitempty"`
	Card        string                 `json:"card,omitempty"`
	DefaultCard string                 `json:"default_card,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

Example:

cust, update := &&omise.Customer{}, UpdateCustomer{
	CustomerID:  "cust_987",
	Description: "I'm JOHN now.",
}
if e := client.Do(cust, update); e != nil {
	panic(e)
}

fmt.Printf("updated customer: %#v\n", cust)

func (*UpdateCustomer) Describe added in v1.0.0

func (req *UpdateCustomer) Describe() *internal.Description

type UpdateDispute

type UpdateDispute struct {
	DisputeID string                 `json:"-"`
	Message   string                 `json:"message"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

Example:

dispute, update := &omise.Dispute{}, &UpdateDispute{
	DisputeID: "dspt_777",
	Message:   "update me!",
}
if e := client.Do(dispute, update); e != nil {
	panic(e)
}

fmt.Printf("updated dispute: %#v\n", dispute)

func (*UpdateDispute) Describe added in v1.0.0

func (req *UpdateDispute) Describe() *internal.Description

type UpdateRecipient

type UpdateRecipient struct {
	RecipientID string              `json:"-"`
	Name        string              `json:"name"`
	Email       string              `json:"email,omitempty"`
	Description string              `json:"description,omitempty"`
	Type        omise.RecipientType `json:"type"`
	TaxID       string              `json:"tax_id,omitempty"`
	BankAccount *omise.BankAccount  `json:"-"`
}

Example:

jones, update := &omise.Recipient{}, &UpdateRecipient{
	RecipientID: "recp_123",
	Description: "I'm JONES now.",
}
if e := client.Do(jones, update); e != nil {
	panic(e)
}

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

func (*UpdateRecipient) Describe added in v1.0.0

func (req *UpdateRecipient) Describe() *internal.Description

func (*UpdateRecipient) MarshalJSON

func (req *UpdateRecipient) MarshalJSON() ([]byte, error)

type UpdateTransfer

type UpdateTransfer struct {
	TransferID string                 `json:"-"`
	Amount     int64                  `json:"amount,omitempty"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

Example:

transfer, update := &omise.Transfer{}, &UpdateTransfer{
	TransferID: "trsf_777",
	Amount:     12300,
}
if e := client.Do(transfer, update); e != nil {
	panic(e)
}

fmt.Printf("updated transfer #777: %#v\n", transfer)

func (*UpdateTransfer) Describe added in v1.0.0

func (req *UpdateTransfer) Describe() *internal.Description

Jump to

Keyboard shortcuts

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