Class: Kentaa::Api::Resources::Payment

Inherits:
Resource show all
Defined in:
lib/kentaa/api/resources/payment.rb

Instance Attribute Summary

Attributes inherited from Resource

#id

Attributes inherited from Base

#config, #endpoint_path, #options, #resource_class

Instance Method Summary collapse

Methods inherited from Resource

#create, #created_at, #delete, #initialize, #load, #save, #updated_at

Methods inherited from Base

attribute_key, #initialize, #load, #loaded?

Constructor Details

This class inherits a constructor from Kentaa::Api::Resources::Resource

Instance Method Details

#account_bicObject



53
54
55
# File 'lib/kentaa/api/resources/payment.rb', line 53

def 
  data[:account_bic]
end

#account_ibanObject



49
50
51
# File 'lib/kentaa/api/resources/payment.rb', line 49

def 
  data[:account_iban]
end

#account_nameObject



57
58
59
# File 'lib/kentaa/api/resources/payment.rb', line 57

def 
  data[:account_name]
end

#amountObject



25
26
27
# File 'lib/kentaa/api/resources/payment.rb', line 25

def amount
  BigDecimal(data[:amount])
end

#currencyObject



21
22
23
# File 'lib/kentaa/api/resources/payment.rb', line 21

def currency
  data[:currency]
end

#descriptionObject



61
62
63
# File 'lib/kentaa/api/resources/payment.rb', line 61

def description
  data[:description]
end

#donationsObject



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/kentaa/api/resources/payment.rb', line 65

def donations
  @donations ||= begin
    donations = []

    if data[:donations]
      data[:donations].each do |donation|
        donations << Kentaa::Api::Resources::Donation.new(config, data: donation, options: options)
      end
    end

    donations
  end
end

#invoicenumberObject



29
30
31
# File 'lib/kentaa/api/resources/payment.rb', line 29

def invoicenumber
  data[:invoicenumber]
end

#object_keyObject



9
10
11
# File 'lib/kentaa/api/resources/payment.rb', line 9

def object_key
  "Payment_#{id}"
end

#ordersObject



79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/kentaa/api/resources/payment.rb', line 79

def orders
  @orders ||= begin
    orders = []

    if data[:orders]
      data[:orders].each do |order|
        orders << Kentaa::Api::Resources::Order.new(config, data: order, options: options)
      end
    end

    orders
  end
end

#payment_idObject



45
46
47
# File 'lib/kentaa/api/resources/payment.rb', line 45

def payment_id
  data[:payment_id]
end

#payment_methodObject



33
34
35
# File 'lib/kentaa/api/resources/payment.rb', line 33

def payment_method
  data[:payment_method]
end

#payment_statusObject



37
38
39
# File 'lib/kentaa/api/resources/payment.rb', line 37

def payment_status
  data[:payment_status]
end

#siteObject



13
14
15
# File 'lib/kentaa/api/resources/payment.rb', line 13

def site
  Kentaa::Api::Resources::Site.new(config, id: site_id, options: options)
end

#site_idObject



17
18
19
# File 'lib/kentaa/api/resources/payment.rb', line 17

def site_id
  data[:site_id]
end

#transaction_idObject



41
42
43
# File 'lib/kentaa/api/resources/payment.rb', line 41

def transaction_id
  data[:transaction_id]
end