Class: Mollie::Payment
- Defined in:
- lib/mollie/payment.rb,
lib/mollie/payment/refund.rb,
lib/mollie/payment/capture.rb,
lib/mollie/payment/chargeback.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Capture, Chargeback, Refund
Constant Summary collapse
- STATUS_OPEN =
'open'.freeze
- STATUS_CANCELED =
'canceled'.freeze
- STATUS_PENDING =
'pending'.freeze
- STATUS_EXPIRED =
'expired'.freeze
- STATUS_FAILED =
'failed'.freeze
- STATUS_PAID =
'paid'.freeze
- STATUS_AUTHORIZED =
'authorized'.freeze
- RECURRINGTYPE_NONE =
nil
- RECURRINGTYPE_FIRST =
'first'.freeze
- RECURRINGTYPE_RECURRING =
'recurring'.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_charged_back ⇒ Object
Returns the value of attribute amount_charged_back.
-
#amount_refunded ⇒ Object
Returns the value of attribute amount_refunded.
-
#amount_remaining ⇒ Object
Returns the value of attribute amount_remaining.
-
#application_fee ⇒ Object
Returns the value of attribute application_fee.
-
#authorized_at ⇒ Object
Returns the value of attribute authorized_at.
-
#cancel_url ⇒ Object
Returns the value of attribute cancel_url.
-
#canceled_at ⇒ Object
Returns the value of attribute canceled_at.
-
#country_code ⇒ Object
Returns the value of attribute country_code.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#customer_id ⇒ Object
Returns the value of attribute customer_id.
-
#description ⇒ Object
Returns the value of attribute description.
-
#details ⇒ Object
Returns the value of attribute details.
-
#expired_at ⇒ Object
Returns the value of attribute expired_at.
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#failed_at ⇒ Object
Returns the value of attribute failed_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_cancelable ⇒ Object
Returns the value of attribute is_cancelable.
-
#locale ⇒ Object
Returns the value of attribute locale.
-
#mandate_id ⇒ Object
Returns the value of attribute mandate_id.
-
#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_id ⇒ Object
Returns the value of attribute order_id.
-
#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.
-
#restrict_payment_methods_to_country ⇒ Object
Returns the value of attribute restrict_payment_methods_to_country.
-
#sequence_type ⇒ Object
Returns the value of attribute sequence_type.
-
#settlement_amount ⇒ Object
Returns the value of attribute settlement_amount.
-
#settlement_id ⇒ Object
Returns the value of attribute settlement_id.
-
#status ⇒ Object
Returns the value of attribute status.
-
#subscription_id ⇒ Object
Returns the value of attribute subscription_id.
-
#webhook_url ⇒ Object
Returns the value of attribute webhook_url.
Attributes inherited from Base
Instance Method Summary collapse
- #authorized? ⇒ Boolean
- #cancelable? ⇒ Boolean
- #canceled? ⇒ Boolean
- #captures(options = {}) ⇒ Object
- #chargebacks(options = {}) ⇒ Object
- #checkout_url ⇒ Object
- #customer(options = {}) ⇒ Object
- #expired? ⇒ Boolean
- #failed? ⇒ Boolean
- #mandate(options = {}) ⇒ Object
- #open? ⇒ Boolean
- #order(options = {}) ⇒ Object
- #paid? ⇒ Boolean
- #pending? ⇒ Boolean
- #refund!(options = {}) ⇒ Object
- #refunded? ⇒ Boolean
- #refunds(options = {}) ⇒ Object
- #settlement(options = {}) ⇒ Object
- #subscription(options = {}) ⇒ Object
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.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def _links @_links end |
#amount ⇒ Object
Returns the value of attribute amount.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def amount @amount end |
#amount_captured ⇒ Object
Returns the value of attribute amount_captured.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def amount_captured @amount_captured end |
#amount_charged_back ⇒ Object
Returns the value of attribute amount_charged_back.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def amount_charged_back @amount_charged_back end |
#amount_refunded ⇒ Object
Returns the value of attribute amount_refunded.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def amount_refunded @amount_refunded end |
#amount_remaining ⇒ Object
Returns the value of attribute amount_remaining.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def amount_remaining @amount_remaining end |
#application_fee ⇒ Object
Returns the value of attribute application_fee.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def application_fee @application_fee end |
#authorized_at ⇒ Object
Returns the value of attribute authorized_at.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def @authorized_at end |
#cancel_url ⇒ Object
Returns the value of attribute cancel_url.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def cancel_url @cancel_url end |
#canceled_at ⇒ Object
Returns the value of attribute canceled_at.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def canceled_at @canceled_at end |
#country_code ⇒ Object
Returns the value of attribute country_code.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def country_code @country_code end |
#created_at ⇒ Object
Returns the value of attribute created_at.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def created_at @created_at end |
#customer_id ⇒ Object
Returns the value of attribute customer_id.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def customer_id @customer_id end |
#description ⇒ Object
Returns the value of attribute description.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def description @description end |
#details ⇒ Object
Returns the value of attribute details.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def details @details end |
#expired_at ⇒ Object
Returns the value of attribute expired_at.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def expired_at @expired_at end |
#expires_at ⇒ Object
Returns the value of attribute expires_at.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def expires_at @expires_at end |
#failed_at ⇒ Object
Returns the value of attribute failed_at.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def failed_at @failed_at end |
#id ⇒ Object
Returns the value of attribute id.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def id @id end |
#is_cancelable ⇒ Object
Returns the value of attribute is_cancelable.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def is_cancelable @is_cancelable end |
#locale ⇒ Object
Returns the value of attribute locale.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def locale @locale end |
#mandate_id ⇒ Object
Returns the value of attribute mandate_id.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def mandate_id @mandate_id end |
#metadata ⇒ Object
Returns the value of attribute metadata.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def @metadata end |
#method ⇒ Object
Returns the value of attribute method.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def method @method end |
#mode ⇒ Object
Returns the value of attribute mode.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def mode @mode end |
#order_id ⇒ Object
Returns the value of attribute order_id.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def order_id @order_id end |
#paid_at ⇒ Object
Returns the value of attribute paid_at.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def paid_at @paid_at end |
#profile_id ⇒ Object
Returns the value of attribute profile_id.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def profile_id @profile_id end |
#redirect_url ⇒ Object
Returns the value of attribute redirect_url.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def redirect_url @redirect_url end |
#restrict_payment_methods_to_country ⇒ Object
Returns the value of attribute restrict_payment_methods_to_country.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def restrict_payment_methods_to_country @restrict_payment_methods_to_country end |
#sequence_type ⇒ Object
Returns the value of attribute sequence_type.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def sequence_type @sequence_type end |
#settlement_amount ⇒ Object
Returns the value of attribute settlement_amount.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def settlement_amount @settlement_amount end |
#settlement_id ⇒ Object
Returns the value of attribute settlement_id.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def settlement_id @settlement_id end |
#status ⇒ Object
Returns the value of attribute status.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def status @status end |
#subscription_id ⇒ Object
Returns the value of attribute subscription_id.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def subscription_id @subscription_id end |
#webhook_url ⇒ Object
Returns the value of attribute webhook_url.
15 16 17 |
# File 'lib/mollie/payment.rb', line 15 def webhook_url @webhook_url end |
Instance Method Details
#authorized? ⇒ Boolean
78 79 80 |
# File 'lib/mollie/payment.rb', line 78 def status == STATUS_AUTHORIZED end |
#cancelable? ⇒ Boolean
90 91 92 |
# File 'lib/mollie/payment.rb', line 90 def cancelable? is_cancelable end |
#canceled? ⇒ Boolean
58 59 60 |
# File 'lib/mollie/payment.rb', line 58 def canceled? status == STATUS_CANCELED end |
#captures(options = {}) ⇒ Object
207 208 209 |
# File 'lib/mollie/payment.rb', line 207 def captures( = {}) Payment::Capture.all(.merge(payment_id: id)) end |
#chargebacks(options = {}) ⇒ Object
203 204 205 |
# File 'lib/mollie/payment.rb', line 203 def chargebacks( = {}) Payment::Chargeback.all(.merge(payment_id: id)) end |
#checkout_url ⇒ Object
188 189 190 |
# File 'lib/mollie/payment.rb', line 188 def checkout_url Util.extract_url(links, 'checkout') end |
#customer(options = {}) ⇒ Object
211 212 213 214 |
# File 'lib/mollie/payment.rb', line 211 def customer( = {}) return if customer_id.nil? Customer.get(customer_id, ) end |
#expired? ⇒ Boolean
66 67 68 |
# File 'lib/mollie/payment.rb', line 66 def expired? status == STATUS_EXPIRED end |
#failed? ⇒ Boolean
70 71 72 |
# File 'lib/mollie/payment.rb', line 70 def failed? status == STATUS_FAILED end |
#mandate(options = {}) ⇒ Object
216 217 218 219 220 221 |
# File 'lib/mollie/payment.rb', line 216 def mandate( = {}) return if customer_id.nil? return if mandate_id.nil? = .merge(customer_id: customer_id) Customer::Mandate.get(mandate_id, ) end |
#open? ⇒ Boolean
54 55 56 |
# File 'lib/mollie/payment.rb', line 54 def open? status == STATUS_OPEN end |
#order(options = {}) ⇒ Object
235 236 237 238 |
# File 'lib/mollie/payment.rb', line 235 def order( = {}) return if order_id.nil? Order.get(order_id, ) end |
#paid? ⇒ Boolean
74 75 76 |
# File 'lib/mollie/payment.rb', line 74 def paid? status == STATUS_PAID end |
#pending? ⇒ Boolean
62 63 64 |
# File 'lib/mollie/payment.rb', line 62 def pending? status == STATUS_PENDING end |
#refund!(options = {}) ⇒ Object
192 193 194 195 196 197 |
# File 'lib/mollie/payment.rb', line 192 def refund!( = {}) [:payment_id] = id # refund full amount by default [:amount] ||= amount.to_h Payment::Refund.create() end |
#refunded? ⇒ Boolean
82 83 84 85 86 87 88 |
# File 'lib/mollie/payment.rb', line 82 def refunded? if amount_refunded amount_refunded.value > 0 else false end end |
#refunds(options = {}) ⇒ Object
199 200 201 |
# File 'lib/mollie/payment.rb', line 199 def refunds( = {}) Payment::Refund.all(.merge(payment_id: id)) end |
#settlement(options = {}) ⇒ Object
223 224 225 226 |
# File 'lib/mollie/payment.rb', line 223 def settlement( = {}) return if settlement_id.nil? Settlement.get(settlement_id, ) end |
#subscription(options = {}) ⇒ Object
228 229 230 231 232 233 |
# File 'lib/mollie/payment.rb', line 228 def subscription( = {}) return if customer_id.nil? return if subscription_id.nil? = .merge(customer_id: customer_id) Customer::Subscription.get(subscription_id, ) end |