class Mollie::Order

Constants

STATUS_AUTHORIZED
STATUS_CANCELED
STATUS_COMPLETED
STATUS_EXPIRED
STATUS_PAID
STATUS_PENDING
STATUS_SHIPPING

Attributes

amount[RW]
amount_captured[RW]
amount_refunded[RW]
authorized_at[RW]
billing_address[RW]
canceled_at[RW]
completed_at[RW]
consumer_date_of_birth[RW]
created_at[RW]
expired_at[RW]
expires_at[RW]
id[RW]
is_cancelable[RW]
lines[RW]
locale[RW]
metadata[RW]
method[RW]
mode[RW]
order_number[RW]
paid_at[RW]
profile_id[RW]
redirect_url[RW]
shipping_address[RW]
shopper_country_must_match_billing_country[RW]
status[RW]
webhook_url[RW]

Public Instance Methods

amount=(amount) click to toggle source
# File lib/mollie/order.rb, line 81
def amount=(amount)
  @amount = Mollie::Amount.new(amount)
end
amount_captured=(amount) click to toggle source
# File lib/mollie/order.rb, line 85
def amount_captured=(amount)
  @amount_captured = Mollie::Amount.new(amount)
end
amount_refunded=(amount) click to toggle source
# File lib/mollie/order.rb, line 89
def amount_refunded=(amount)
  @amount_refunded = Mollie::Amount.new(amount)
end
authorized?() click to toggle source
# File lib/mollie/order.rb, line 45
def authorized?
  status == STATUS_AUTHORIZED
end
authorized_at=(authorized_at) click to toggle source
# File lib/mollie/order.rb, line 121
def authorized_at=(authorized_at)
  @authorized_at = Time.parse(authorized_at.to_s)
end
billing_address=(address) click to toggle source
# File lib/mollie/order.rb, line 93
def billing_address=(address)
  @billing_address = OpenStruct.new(address) if address.is_a?(Hash)
end
cancelable?() click to toggle source
# File lib/mollie/order.rb, line 69
def cancelable?
  is_cancelable
end
canceled?() click to toggle source
# File lib/mollie/order.rb, line 61
def canceled?
  status == STATUS_CANCELED
end
canceled_at=(canceled_at) click to toggle source
# File lib/mollie/order.rb, line 125
def canceled_at=(canceled_at)
  @canceled_at = Time.parse(canceled_at.to_s)
end
checkout_url() click to toggle source
# File lib/mollie/order.rb, line 73
def checkout_url
  Util.extract_url(links, 'checkout')
end
completed?() click to toggle source
# File lib/mollie/order.rb, line 65
def completed?
  status == STATUS_COMPLETED
end
completed_at=(completed_at) click to toggle source
# File lib/mollie/order.rb, line 129
def completed_at=(completed_at)
  @completed_at = Time.parse(completed_at.to_s)
end
created_at=(created_at) click to toggle source
# File lib/mollie/order.rb, line 105
def created_at=(created_at)
  @created_at = Time.parse(created_at.to_s)
end
expired?() click to toggle source
# File lib/mollie/order.rb, line 57
def expired?
  status == STATUS_EXPIRED
end
expired_at=(expired_at) click to toggle source
# File lib/mollie/order.rb, line 113
def expired_at=(expired_at)
  @expired_at = Time.parse(expired_at.to_s)
end
expires_at=(expires_at) click to toggle source
# File lib/mollie/order.rb, line 109
def expires_at=(expires_at)
  @expires_at = Time.parse(expires_at.to_s)
end
lines=(lines) click to toggle source
# File lib/mollie/order.rb, line 77
def lines=(lines)
  @lines = lines.map { |line| Order::Line.new(line) }
end
metadata=(metadata) click to toggle source
# File lib/mollie/order.rb, line 101
def metadata=(metadata)
  @metadata = OpenStruct.new(metadata) if metadata.is_a?(Hash)
end
paid?() click to toggle source
paid_at=(paid_at) click to toggle source
pending?() click to toggle source
# File lib/mollie/order.rb, line 41
def pending?
  status == STATUS_PENDING
end
refund!(options = {}) click to toggle source
# File lib/mollie/order.rb, line 137
def refund!(options = {})
  options[:order_id] = id
  options[:lines] ||= []
  Order::Refund.create(options)
end
refunds(options = {}) click to toggle source
# File lib/mollie/order.rb, line 133
def refunds(options = {})
  Order::Refund.all(options.merge(order_id: id))
end
shipping?() click to toggle source
# File lib/mollie/order.rb, line 53
def shipping?
  status == STATUS_SHIPPING
end
shipping_address=(address) click to toggle source
# File lib/mollie/order.rb, line 97
def shipping_address=(address)
  @shipping_address = OpenStruct.new(address) if address.is_a?(Hash)
end