Documentation ¶
Index ¶
- Constants
- func NewTestClient(fn RoundTripFunc) *http.Client
- type AuthResponse
- type Card
- type Charge
- type ChargeLog
- type ChargeRequest
- type ChargeRequestOptional
- type ChargeSimpleRequest
- type ChargeSimpleRequestOptional
- type Client
- func (c *Client) CreateCharge(customerID, description string, amount float32, opt *ChargeRequestOptional) error
- func (c *Client) CreateCustomer(name, email, currency, credit_card_number, credit_card_cvc string, ...) (Customer, error)
- func (c *Client) CreatePlan(name, currency string, interval Interval, count int, opt *PlanRequestOptional) error
- func (c *Client) CreateRefund(amount float32, charge string, reason RefundReason) (Refund, error)
- func (c *Client) CreateSimpleCharge(amount float32, description, currency, creditCard, cvc string, month, year int, ...) error
- func (c *Client) CreateSubscription(customerID, planID string) error
- func (c *Client) Debug()
- func (c *Client) DeleteCustomer(id string) error
- func (c *Client) DeletePlan(id string) error
- func (c *Client) DeleteSubscription(id string) error
- func (c *Client) GetCharge(id string) (Charge, error)
- func (c *Client) GetCustomer(id string) (Customer, error)
- func (c *Client) GetPlan(id string) (Plan, error)
- func (c *Client) GetRefund(id string) (Refund, error)
- func (c *Client) GetSubscription(id string) (Subscription, error)
- func (c *Client) ListCharges() ([]Charge, error)
- func (c *Client) ListCustomers() ([]Customer, error)
- func (c *Client) ListPlans() ([]Plan, error)
- func (c *Client) ListRefunds() ([]Refund, error)
- func (c *Client) ListSubscriptions() ([]Subscription, error)
- func (c *Client) Me() (Me, error)
- func (c *Client) UpdateCustomer(u CustomerRequest, id string) (Customer, error)
- type Customer
- type CustomerRequest
- type Interval
- type Me
- type Plan
- type PlanInformation
- type PlanRequest
- type PlanRequestOptional
- type Refund
- type RefundReason
- type RoundTripFunc
- type SourceGPayments
- type Subscription
- type Time
Constants ¶
const ( APIVersion = "v1" ErrorMsjRequest = "no se pudo crear solicitud: %v" ErrorMsjMarshal = "no se pudo serializar: %v" ErrorMsjHTTPStatus = "respuesta inesperada HTTP STATUS %d - %s" )
const (
TimeLayoutWithTimezone = "2006-01-02 15:04:05"
)
Variables ¶
This section is empty.
Functions ¶
func NewTestClient ¶
func NewTestClient(fn RoundTripFunc) *http.Client
NewTestClient returns *http.Client with Transport replaced to avoid making real calls
Types ¶
type AuthResponse ¶
type ChargeRequest ¶
type ChargeRequestOptional ¶
type ChargeSimpleRequest ¶
type ChargeSimpleRequest struct { Amount float32 `json:"amount"` Description string `json:"description"` Currency string `json:"currency"` CreditCard string `json:"credit_card_number"` CVC string `json:"credit_card_security_code_number"` Month int `json:"month"` Year int `json:"year"` EntityDesc string `json:"entity_description"` }
type ChargeSimpleRequestOptional ¶
type ChargeSimpleRequestOptional struct {
EntityDesc string `json:"entity_description"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateCharge ¶
func (c *Client) CreateCharge(customerID, description string, amount float32, opt *ChargeRequestOptional) error
CreateCharge crea un charge, en otras palabras, realiza un rebajo a la tarjeta del cliente, utilizando sus datos financieros.
func (*Client) CreateCustomer ¶
func (c *Client) CreateCustomer(name, email, currency, credit_card_number, credit_card_cvc string, month, year int) (Customer, error)
CreateCustomer crea y asigna un customer a tu cuenta de 4Geeks payments.
func (*Client) CreatePlan ¶
func (c *Client) CreatePlan(name, currency string, interval Interval, count int, opt *PlanRequestOptional) error
CreatePlan crea un plan de pago.
func (*Client) CreateRefund ¶
CreateRefund crea un reembolso y lo asocia con una transacción.
func (*Client) CreateSimpleCharge ¶
func (c *Client) CreateSimpleCharge(amount float32, description, currency, creditCard, cvc string, month, year int, opt *ChargeSimpleRequestOptional) error
CreateSimpleCharge crea un simple charge, en otras palabras, realiza un rebajo a la tarjeta que venga en el POST, no esta asignada a ningun customer.
func (*Client) CreateSubscription ¶
CreateSubscription crea un y asigna una subscripción a un cliente.
func (*Client) Debug ¶ added in v1.0.1
func (c *Client) Debug()
Debug activa o desactiva la depuracion de solicitudes HTTP
func (*Client) DeleteCustomer ¶
DeleteCustomer elimina un customer en especifico por su ID.
func (*Client) DeletePlan ¶
DeletePlan elimina un plan que el key indicado.
func (*Client) DeleteSubscription ¶
DeleteSubscription elimina una subscripcion en especifico.
func (*Client) GetCustomer ¶
GetCustomer retorna un customer encontrado por el ID identificador.
func (*Client) GetSubscription ¶
func (c *Client) GetSubscription(id string) (Subscription, error)
GetSubscription retorna un plan que el key indicado.
func (*Client) ListCharges ¶
ListCharges retorna todos los logs de los cargos creados a mis clientes.
func (*Client) ListCustomers ¶
ListCustomers retorna la informacion de todos los customers asociados a mi cuenta en 4Geeks Payments.
func (*Client) ListRefunds ¶
ListRefunds retorna todos los reembolsos activos.
func (*Client) ListSubscriptions ¶
func (c *Client) ListSubscriptions() ([]Subscription, error)
ListSubscription retorna todos las subscripciones creadas.
func (*Client) UpdateCustomer ¶
func (c *Client) UpdateCustomer(u CustomerRequest, id string) (Customer, error)
UpdateCustomer edita un customer en especifico.
type CustomerRequest ¶
type Plan ¶
type Plan struct { ID string `json:"key"` Information PlanInformation `json:"information"` }
type PlanInformation ¶
type PlanInformation struct { Currency string `json:"currency"` Amount float32 `json:"amount"` Name string `json:"name"` CreatedOn Time `json:"created"` Description string `json:"credit_card_description"` TrialDays int `json:"trial_period_days"` Interval Interval `json:"interval"` Count int `json:"interval_count"` }
type PlanRequest ¶
type PlanRequestOptional ¶
type RefundReason ¶
type RefundReason int
const ( Duplicate RefundReason = iota + 1 Fraudulent RequestedByCustomer )
func (*RefundReason) MarshalJSON ¶
func (r *RefundReason) MarshalJSON() (text []byte, err error)
func (RefundReason) String ¶
func (r RefundReason) String() string
func (*RefundReason) UnmarshalJSON ¶
func (r *RefundReason) UnmarshalJSON(text []byte) error
type RoundTripFunc ¶
RoundTripFunc .
type SourceGPayments ¶
type SourceGPayments struct {
// contains filtered or unexported fields
}
func NewSourceToken ¶
func NewSourceToken(id, secret string) *SourceGPayments