Class: Mollie::Settlement

Inherits:
Base
  • Object
show all
Defined in:
lib/mollie/settlement.rb,
lib/mollie/settlement/refund.rb,
lib/mollie/settlement/capture.rb,
lib/mollie/settlement/payment.rb,
lib/mollie/settlement/chargeback.rb

Defined Under Namespace

Classes: Capture, Chargeback, Payment, Refund

Constant Summary collapse

STATUS_OPEN =
'open'.freeze
STATUS_PENDING =
'pending'.freeze
STATUS_PAIDOUT =
'paidout'.freeze
STATUS_FAILED =
'failed'.freeze

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all, #assign_attributes, cancel, create, #delete, delete, get, id_param, #initialize, parent_id, request, resource_name, update, #update

Constructor Details

This class inherits a constructor from Mollie::Base

Instance Attribute Details

Returns the value of attribute _links.



8
9
10
# File 'lib/mollie/settlement.rb', line 8

def _links
  @_links
end

#amountObject

Returns the value of attribute amount.



8
9
10
# File 'lib/mollie/settlement.rb', line 8

def amount
  @amount
end

#created_atObject

Returns the value of attribute created_at.



8
9
10
# File 'lib/mollie/settlement.rb', line 8

def created_at
  @created_at
end

#idObject

Returns the value of attribute id.



8
9
10
# File 'lib/mollie/settlement.rb', line 8

def id
  @id
end

#invoice_idObject

Returns the value of attribute invoice_id.



8
9
10
# File 'lib/mollie/settlement.rb', line 8

def invoice_id
  @invoice_id
end

#periodsObject

Returns the value of attribute periods.



8
9
10
# File 'lib/mollie/settlement.rb', line 8

def periods
  @periods
end

#referenceObject

Returns the value of attribute reference.



8
9
10
# File 'lib/mollie/settlement.rb', line 8

def reference
  @reference
end

#settled_atObject

Returns the value of attribute settled_at.



8
9
10
# File 'lib/mollie/settlement.rb', line 8

def settled_at
  @settled_at
end

#statusObject

Returns the value of attribute status.



8
9
10
# File 'lib/mollie/settlement.rb', line 8

def status
  @status
end

Class Method Details

.next(options = {}) ⇒ Object



24
25
26
# File 'lib/mollie/settlement.rb', line 24

def self.next(options = {})
  get('next', options)
end

.open(options = {}) ⇒ Object



20
21
22
# File 'lib/mollie/settlement.rb', line 20

def self.open(options = {})
  get('open', options)
end

Instance Method Details

#captures(options = {}) ⇒ Object



80
81
82
# File 'lib/mollie/settlement.rb', line 80

def captures(options = {})
  Settlement::Capture.all(options.merge(settlement_id: id))
end

#chargebacks(options = {}) ⇒ Object



76
77
78
# File 'lib/mollie/settlement.rb', line 76

def chargebacks(options = {})
  Settlement::Chargeback.all(options.merge(settlement_id: id))
end

#failed?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/mollie/settlement.rb', line 40

def failed?
  status == STATUS_FAILED
end

#invoice(options = {}) ⇒ Object



84
85
86
87
# File 'lib/mollie/settlement.rb', line 84

def invoice(options = {})
  return if invoice_id.nil?
  Invoice.get(invoice_id, options)
end

#open?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/mollie/settlement.rb', line 28

def open?
  status == STATUS_OPEN
end

#paidout?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/mollie/settlement.rb', line 36

def paidout?
  status == STATUS_PAIDOUT
end

#payments(options = {}) ⇒ Object



68
69
70
# File 'lib/mollie/settlement.rb', line 68

def payments(options = {})
  Settlement::Payment.all(options.merge(settlement_id: id))
end

#pending?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/mollie/settlement.rb', line 32

def pending?
  status == STATUS_PENDING
end

#refunds(options = {}) ⇒ Object



72
73
74
# File 'lib/mollie/settlement.rb', line 72

def refunds(options = {})
  Settlement::Refund.all(options.merge(settlement_id: id))
end