Class: Moip::Assinaturas::Payment

Inherits:
Object
  • Object
show all
Defined in:
lib/moip-assinaturas/payment.rb

Class Method Summary collapse

Class Method Details

.details(id, opts = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/moip-assinaturas/payment.rb', line 21

def details(id, opts={})
  response = Moip::Assinaturas::Client.details_payment(id, opts)
  hash     = JSON.load(response.body).with_indifferent_access

  case response.code
  when 200
    return {
      success:  true,
      payment:  hash
    }
  else
    raise(WebServerResponseError, "Ocorreu um erro no retorno do webservice")
  end
end

.list(invoice_id, opts = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/moip-assinaturas/payment.rb', line 6

def list(invoice_id, opts={})
  response = Moip::Assinaturas::Client.list_payments(invoice_id, opts)
  hash     = JSON.load(response.body).with_indifferent_access

  case response.code
  when 200
    return {
      success:  true,
      payments: hash[:payments]
    }
  else
    raise(WebServerResponseError, "Ocorreu um erro no retorno do webservice")
  end
end