Module: EPayCo::Client::Customer

Included in:
EPayCo::Client
Defined in:
lib/epayco/client/customer.rb

Overview

Defines methods related to Customers

Instance Method Summary collapse

Instance Method Details

#customer_all(params = {}) ⇒ Array

Returns all the Customers registered

Examples:

All the Customers

[
  {
    "id_customer": "PKEMb9wfxQjttGeP",
    "object": "customer",
    "name": "Juan Fernando",
    "email": "[email protected]",
    "phone": "3333333",
    "created": "21-10-2016"
  },
  {
    "id_customer": "qRTGGssNKXZo2Q6pL",
    "object": "customer",
    "name": "Pedro Jaramillo",
    "email": "[email protected]",
    "phone": "3333333",
    "created": "21-10-2016"
  }
]

Returns:

  • (Array)

Supported formats:

  • :json



28
29
30
31
32
# File 'lib/epayco/client/customer.rb', line 28

def customer_all(params={})
  path = "/payment/v1/customers/#{public_key}"
  response_options = { return_object: true }
  get(path, params, response_options)
end

#customer_create(options = {}) ⇒ Hashie::Mash

Creates a new customer

Examples:

Success

{
  "status": "Creado",
  "description": "El cliente ha sido creado con exito para realizar operaciones y enlazarlo use el id: 6eba2u73ZBh49Po7q",
  "customerId": "6eba2u73ZBh49Po7q",
  "token": "ZdTo2WFZEH9r3HC7N"
}

Parameters:

  • options (defaults to: {})

    The Customer Attributes

Options Hash (options):

  • :token_card (String)

    Token de la tarjeta tokenizada

  • :name (String)

    Nombre del cliente al que se asocia la tarjeta

  • :email (String)

    Email del cliente al que se asocia la tarjeta

  • :phone (String)

    Phone del cliente al que se asocia la tarjeta

  • :default (Boolean)

    Define la terjeta con la cobra por default

Returns:

  • (Hashie::Mash)

Supported formats:

  • :json



51
52
53
54
55
# File 'lib/epayco/client/customer.rb', line 51

def customer_create(options={})
  path = "/payment/v1/customer/create"
  response_options = { return_object: 'data' }
  post(path, options.merge(public_key: public_key), response_options)
end