class Wompi::RApi::PaymentSource

Attributes

customer_email[RW]
id[RW]
status[RW]

Public Class Methods

new(login) click to toggle source
Calls superclass method
# File lib/wompi/r_api/payment_source.rb, line 7
def initialize(login)
  super(login, "prv_key")
end

Public Instance Methods

create(payment_method, customer_email) click to toggle source
# File lib/wompi/r_api/payment_source.rb, line 11
def create(payment_method, customer_email)
  @http_verb = 'Post'
  @url += "v1/payment_sources"
  @params = {
    type: payment_method.type,
    token: payment_method.id,
    customer_email: customer_email,
    acceptance_token: @login.acceptance_token
  }

  http

  if success?
    if @response["data"]
      @id = @response["data"]["id"]
      @status = @response["data"]["status"]
      self
    else
      nil
    end
  end
end