Class: Mollie::Order

Inherits:
Base
  • Object
show all
Defined in:
lib/mollie/order.rb,
lib/mollie/order/line.rb,
lib/mollie/order/refund.rb,
lib/mollie/order/shipment.rb

Defined Under Namespace

Classes: Line, Refund, Shipment

Constant Summary collapse

STATUS_PENDING =
'pending'.freeze
STATUS_AUTHORIZED =
'authorized'.freeze
STATUS_PAID =
'paid'.freeze
STATUS_SHIPPING =
'shipping'.freeze
STATUS_EXPIRED =
'expired'.freeze
STATUS_CANCELED =
'canceled'.freeze
STATUS_COMPLETED =
'completed'.freeze

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes

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.



11
12
13
# File 'lib/mollie/order.rb', line 11

def _links
  @_links
end

#amountObject

Returns the value of attribute amount.



11
12
13
# File 'lib/mollie/order.rb', line 11

def amount
  @amount
end

#amount_capturedObject

Returns the value of attribute amount_captured.



11
12
13
# File 'lib/mollie/order.rb', line 11

def amount_captured
  @amount_captured
end

#amount_refundedObject

Returns the value of attribute amount_refunded.



11
12
13
# File 'lib/mollie/order.rb', line 11

def amount_refunded
  @amount_refunded
end

#authorized_atObject

Returns the value of attribute authorized_at.



11
12
13
# File 'lib/mollie/order.rb', line 11

def authorized_at
  @authorized_at
end

#billing_addressObject

Returns the value of attribute billing_address.



11
12
13
# File 'lib/mollie/order.rb', line 11

def billing_address
  @billing_address
end

#canceled_atObject

Returns the value of attribute canceled_at.



11
12
13
# File 'lib/mollie/order.rb', line 11

def canceled_at
  @canceled_at
end

#completed_atObject

Returns the value of attribute completed_at.



11
12
13
# File 'lib/mollie/order.rb', line 11

def completed_at
  @completed_at
end

#consumer_date_of_birthObject

Returns the value of attribute consumer_date_of_birth.



11
12
13
# File 'lib/mollie/order.rb', line 11

def consumer_date_of_birth
  @consumer_date_of_birth
end

#created_atObject

Returns the value of attribute created_at.



11
12
13
# File 'lib/mollie/order.rb', line 11

def created_at
  @created_at
end

#expired_atObject

Returns the value of attribute expired_at.



11
12
13
# File 'lib/mollie/order.rb', line 11

def expired_at
  @expired_at
end

#expires_atObject

Returns the value of attribute expires_at.



11
12
13
# File 'lib/mollie/order.rb', line 11

def expires_at
  @expires_at
end

#idObject

Returns the value of attribute id.



11
12
13
# File 'lib/mollie/order.rb', line 11

def id
  @id
end

#is_cancelableObject

Returns the value of attribute is_cancelable.



11
12
13
# File 'lib/mollie/order.rb', line 11

def is_cancelable
  @is_cancelable
end

#linesObject

Returns the value of attribute lines.



11
12
13
# File 'lib/mollie/order.rb', line 11

def lines
  @lines
end

#localeObject

Returns the value of attribute locale.



11
12
13
# File 'lib/mollie/order.rb', line 11

def locale
  @locale
end

#metadataObject

Returns the value of attribute metadata.



11
12
13
# File 'lib/mollie/order.rb', line 11

def 
  
end

#methodObject

Returns the value of attribute method.



11
12
13
# File 'lib/mollie/order.rb', line 11

def method
  @method
end

#modeObject

Returns the value of attribute mode.



11
12
13
# File 'lib/mollie/order.rb', line 11

def mode
  @mode
end

#order_numberObject

Returns the value of attribute order_number.



11
12
13
# File 'lib/mollie/order.rb', line 11

def order_number
  @order_number
end

Returns the value of attribute paid_at.



11
12
13
# File 'lib/mollie/order.rb', line 11

def paid_at
  @paid_at
end

#profile_idObject

Returns the value of attribute profile_id.



11
12
13
# File 'lib/mollie/order.rb', line 11

def profile_id
  @profile_id
end

#redirect_urlObject

Returns the value of attribute redirect_url.



11
12
13
# File 'lib/mollie/order.rb', line 11

def redirect_url
  @redirect_url
end

#shipping_addressObject

Returns the value of attribute shipping_address.



11
12
13
# File 'lib/mollie/order.rb', line 11

def shipping_address
  @shipping_address
end

#statusObject

Returns the value of attribute status.



11
12
13
# File 'lib/mollie/order.rb', line 11

def status
  @status
end

#webhook_urlObject

Returns the value of attribute webhook_url.



11
12
13
# File 'lib/mollie/order.rb', line 11

def webhook_url
  @webhook_url
end

Instance Method Details

#authorized?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/mollie/order.rb', line 44

def authorized?
  status == STATUS_AUTHORIZED
end

#cancelable?Boolean

Returns:

  • (Boolean)


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

def cancelable?
  is_cancelable
end

#canceled?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/mollie/order.rb', line 60

def canceled?
  status == STATUS_CANCELED
end

#checkout_urlObject



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

def checkout_url
  Util.extract_url(links, 'checkout')
end

#completed?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/mollie/order.rb', line 64

def completed?
  status == STATUS_COMPLETED
end

#expired?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/mollie/order.rb', line 56

def expired?
  status == STATUS_EXPIRED
end

#paid?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/mollie/order.rb', line 48

def paid?
  status == STATUS_PAID
end

#pending?Boolean

Returns:

  • (Boolean)


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

def pending?
  status == STATUS_PENDING
end

#refund!(options = {}) ⇒ Object



136
137
138
139
140
# File 'lib/mollie/order.rb', line 136

def refund!(options = {})
  options[:order_id] = id
  options[:lines] ||= []
  Order::Refund.create(options)
end

#refunds(options = {}) ⇒ Object



132
133
134
# File 'lib/mollie/order.rb', line 132

def refunds(options = {})
  Order::Refund.all(options.merge(order_id: id))
end

#shipping?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/mollie/order.rb', line 52

def shipping?
  status == STATUS_SHIPPING
end