Class: Mollie::Order
- Defined in:
- lib/mollie/order.rb,
lib/mollie/order/line.rb,
lib/mollie/order/refund.rb,
lib/mollie/order/payment.rb,
lib/mollie/order/shipment.rb
Defined Under Namespace
Classes: Line, Payment, 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
-
#_links ⇒ Object
(also: #links)
Returns the value of attribute _links.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#amount_captured ⇒ Object
Returns the value of attribute amount_captured.
-
#amount_refunded ⇒ Object
Returns the value of attribute amount_refunded.
-
#authorized_at ⇒ Object
Returns the value of attribute authorized_at.
-
#billing_address ⇒ Object
Returns the value of attribute billing_address.
-
#cancel_url ⇒ Object
Returns the value of attribute cancel_url.
-
#canceled_at ⇒ Object
Returns the value of attribute canceled_at.
-
#completed_at ⇒ Object
Returns the value of attribute completed_at.
-
#consumer_date_of_birth ⇒ Object
Returns the value of attribute consumer_date_of_birth.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#expired_at ⇒ Object
Returns the value of attribute expired_at.
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_cancelable ⇒ Object
Returns the value of attribute is_cancelable.
-
#lines ⇒ Object
Returns the value of attribute lines.
-
#locale ⇒ Object
Returns the value of attribute locale.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#method ⇒ Object
Returns the value of attribute method.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#order_number ⇒ Object
Returns the value of attribute order_number.
-
#paid_at ⇒ Object
Returns the value of attribute paid_at.
-
#profile_id ⇒ Object
Returns the value of attribute profile_id.
-
#redirect_url ⇒ Object
Returns the value of attribute redirect_url.
-
#shipping_address ⇒ Object
Returns the value of attribute shipping_address.
-
#shopper_country_must_match_billing_country ⇒ Object
Returns the value of attribute shopper_country_must_match_billing_country.
-
#status ⇒ Object
Returns the value of attribute status.
-
#webhook_url ⇒ Object
Returns the value of attribute webhook_url.
Attributes inherited from Base
Instance Method Summary collapse
- #authorized? ⇒ Boolean
- #cancelable? ⇒ Boolean
- #canceled? ⇒ Boolean
- #checkout_url ⇒ Object
- #completed? ⇒ Boolean
- #expired? ⇒ Boolean
- #paid? ⇒ Boolean
- #payments ⇒ Object
- #pending? ⇒ Boolean
- #refund!(options = {}) ⇒ Object
- #refunds(options = {}) ⇒ Object
- #shipments ⇒ Object
- #shipping? ⇒ Boolean
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
#_links ⇒ Object Also known as: links
Returns the value of attribute _links.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def _links @_links end |
#amount ⇒ Object
Returns the value of attribute amount.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def amount @amount end |
#amount_captured ⇒ Object
Returns the value of attribute amount_captured.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def amount_captured @amount_captured end |
#amount_refunded ⇒ Object
Returns the value of attribute amount_refunded.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def amount_refunded @amount_refunded end |
#authorized_at ⇒ Object
Returns the value of attribute authorized_at.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def @authorized_at end |
#billing_address ⇒ Object
Returns the value of attribute billing_address.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def billing_address @billing_address end |
#cancel_url ⇒ Object
Returns the value of attribute cancel_url.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def cancel_url @cancel_url end |
#canceled_at ⇒ Object
Returns the value of attribute canceled_at.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def canceled_at @canceled_at end |
#completed_at ⇒ Object
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_birth ⇒ Object
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_at ⇒ Object
Returns the value of attribute created_at.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def created_at @created_at end |
#expired_at ⇒ Object
Returns the value of attribute expired_at.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def expired_at @expired_at end |
#expires_at ⇒ Object
Returns the value of attribute expires_at.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def expires_at @expires_at end |
#id ⇒ Object
Returns the value of attribute id.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def id @id end |
#is_cancelable ⇒ Object
Returns the value of attribute is_cancelable.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def is_cancelable @is_cancelable end |
#lines ⇒ Object
Returns the value of attribute lines.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def lines @lines end |
#locale ⇒ Object
Returns the value of attribute locale.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def locale @locale end |
#metadata ⇒ Object
Returns the value of attribute metadata.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def @metadata end |
#method ⇒ Object
Returns the value of attribute method.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def method @method end |
#mode ⇒ Object
Returns the value of attribute mode.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def mode @mode end |
#order_number ⇒ Object
Returns the value of attribute order_number.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def order_number @order_number end |
#paid_at ⇒ Object
Returns the value of attribute paid_at.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def paid_at @paid_at end |
#profile_id ⇒ Object
Returns the value of attribute profile_id.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def profile_id @profile_id end |
#redirect_url ⇒ Object
Returns the value of attribute redirect_url.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def redirect_url @redirect_url end |
#shipping_address ⇒ Object
Returns the value of attribute shipping_address.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def shipping_address @shipping_address end |
#shopper_country_must_match_billing_country ⇒ Object
Returns the value of attribute shopper_country_must_match_billing_country.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def shopper_country_must_match_billing_country @shopper_country_must_match_billing_country end |
#status ⇒ Object
Returns the value of attribute status.
11 12 13 |
# File 'lib/mollie/order.rb', line 11 def status @status end |
#webhook_url ⇒ Object
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
46 47 48 |
# File 'lib/mollie/order.rb', line 46 def status == STATUS_AUTHORIZED end |
#cancelable? ⇒ Boolean
70 71 72 |
# File 'lib/mollie/order.rb', line 70 def cancelable? is_cancelable end |
#canceled? ⇒ Boolean
62 63 64 |
# File 'lib/mollie/order.rb', line 62 def canceled? status == STATUS_CANCELED end |
#checkout_url ⇒ Object
74 75 76 |
# File 'lib/mollie/order.rb', line 74 def checkout_url Util.extract_url(links, 'checkout') end |
#completed? ⇒ Boolean
66 67 68 |
# File 'lib/mollie/order.rb', line 66 def completed? status == STATUS_COMPLETED end |
#expired? ⇒ Boolean
58 59 60 |
# File 'lib/mollie/order.rb', line 58 def expired? status == STATUS_EXPIRED end |
#payments ⇒ Object
134 135 136 137 138 139 140 141 142 |
# 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 |
#pending? ⇒ Boolean
42 43 44 |
# File 'lib/mollie/order.rb', line 42 def pending? status == STATUS_PENDING end |
#refund!(options = {}) ⇒ Object
166 167 168 169 170 |
# File 'lib/mollie/order.rb', line 166 def refund!( = {}) [:order_id] = id [:lines] ||= [] Order::Refund.create() end |
#refunds(options = {}) ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/mollie/order.rb', line 144 def refunds( = {}) 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(.merge(order_id: id)) else List.new({ '_embedded' => { 'refunds' => resources } }, Order::Refund) end end |
#shipments ⇒ Object
156 157 158 159 160 161 162 163 164 |
# 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 |
#shipping? ⇒ Boolean
54 55 56 |
# File 'lib/mollie/order.rb', line 54 def shipping? status == STATUS_SHIPPING end |