class Mollie::Order
Constants
- STATUS_AUTHORIZED
- STATUS_CANCELED
- STATUS_COMPLETED
- STATUS_EXPIRED
- STATUS_PAID
- STATUS_PENDING
- STATUS_SHIPPING
Attributes
Public Instance Methods
Source
# File lib/mollie/order.rb, line 82 def amount=(amount) @amount = Mollie::Amount.new(amount) end
Source
# File lib/mollie/order.rb, line 86 def amount_captured=(amount) @amount_captured = Mollie::Amount.new(amount) end
Source
# File lib/mollie/order.rb, line 90 def amount_refunded=(amount) @amount_refunded = Mollie::Amount.new(amount) end
Source
# File lib/mollie/order.rb, line 94 def billing_address=(address) @billing_address = OpenStruct.new(address) if address.is_a?(Hash) end
Source
# File lib/mollie/order.rb, line 126 def canceled_at=(canceled_at) @canceled_at = Time.parse(canceled_at.to_s) end
Source
# File lib/mollie/order.rb, line 74 def checkout_url Util.extract_url(links, 'checkout') end
Source
# File lib/mollie/order.rb, line 66 def completed? status == STATUS_COMPLETED end
Source
# File lib/mollie/order.rb, line 130 def completed_at=(completed_at) @completed_at = Time.parse(completed_at.to_s) end
Source
# File lib/mollie/order.rb, line 106 def created_at=(created_at) @created_at = Time.parse(created_at.to_s) end
Source
# File lib/mollie/order.rb, line 114 def expired_at=(expired_at) @expired_at = Time.parse(expired_at.to_s) end
Source
# File lib/mollie/order.rb, line 110 def expires_at=(expires_at) @expires_at = Time.parse(expires_at.to_s) end
Source
# File lib/mollie/order.rb, line 78 def lines=(lines) @lines = lines.map { |line| Order::Line.new(line) } end
Source
# File lib/mollie/order.rb, line 102 def metadata=(metadata) @metadata = OpenStruct.new(metadata) if metadata.is_a?(Hash) end
Source
# File lib/mollie/order.rb, line 118 def paid_at=(paid_at) @paid_at = Time.parse(paid_at.to_s) end
Source
# File lib/mollie/order.rb, line 134 def payments resources = (attributes['_embedded']['payments'] if attributes['_embedded']) if resources.nil? List.new({}, Order::Payment) else List.new({ '_embedded' => { 'payments' => resources } }, Order::Payment) end end
Source
# File lib/mollie/order.rb, line 166 def refund!(options = {}) options[:order_id] = id options[:lines] ||= [] Order::Refund.create(options) end
Source
# File lib/mollie/order.rb, line 144 def refunds(options = {}) resources = (attributes['_embedded']['refunds'] if attributes['_embedded']) if resources.nil? # To avoid breaking changes, fallback to /v2/order/*orderId*/refunds # if the order was retrieved without embedded refunds. Order::Refund.all(options.merge(order_id: id)) else List.new({ '_embedded' => { 'refunds' => resources } }, Order::Refund) end end
Source
# File lib/mollie/order.rb, line 156 def shipments resources = (attributes['_embedded']['shipments'] if attributes['_embedded']) if resources.nil? List.new({}, Order::Shipment) else List.new({ '_embedded' => { 'shipments' => resources } }, Order::Shipment) end end
Source
# File lib/mollie/order.rb, line 98 def shipping_address=(address) @shipping_address = OpenStruct.new(address) if address.is_a?(Hash) end