class Mollie::Payment
Constants
- RECURRINGTYPE_FIRST
- RECURRINGTYPE_NONE
- RECURRINGTYPE_RECURRING
- STATUS_AUTHORIZED
- STATUS_CANCELED
- STATUS_EXPIRED
- STATUS_FAILED
- STATUS_OPEN
- STATUS_PAID
- STATUS_PENDING
Attributes
_links[RW]
amount[RW]
amount_captured[RW]
amount_refunded[RW]
amount_remaining[RW]
application_fee[RW]
canceled_at[RW]
country_code[RW]
created_at[RW]
customer_id[RW]
description[RW]
details[RW]
expired_at[RW]
expires_at[RW]
failed_at[RW]
id[RW]
is_cancelable[RW]
links[RW]
locale[RW]
mandate_id[RW]
metadata[RW]
method[RW]
mode[RW]
order_id[RW]
paid_at[RW]
profile_id[RW]
redirect_url[RW]
restrict_payment_methods_to_country[RW]
sequence_type[RW]
settlement_amount[RW]
settlement_id[RW]
status[RW]
subscription_id[RW]
webhook_url[RW]
Public Instance Methods
amount=(amount)
click to toggle source
# File lib/mollie/payment.rb, line 162 def amount=(amount) @amount = Mollie::Amount.new(amount) end
amount_refunded=(amount_refunded)
click to toggle source
# File lib/mollie/payment.rb, line 178 def amount_refunded=(amount_refunded) @amount_refunded = Mollie::Amount.new(amount_refunded) end
amount_remaining=(amount_remaining)
click to toggle source
# File lib/mollie/payment.rb, line 174 def amount_remaining=(amount_remaining) @amount_remaining = Mollie::Amount.new(amount_remaining) end
application_fee=(application_fee)
click to toggle source
# File lib/mollie/payment.rb, line 92 def application_fee=(application_fee) amount = Amount.new(application_fee['amount']) description = application_fee['description'] @application_fee = OpenStruct.new( amount: amount, description: description ) end
cancelable?()
click to toggle source
# File lib/mollie/payment.rb, line 88 def cancelable? is_cancelable end
canceled?()
click to toggle source
# File lib/mollie/payment.rb, line 56 def canceled? status == STATUS_CANCELED end
canceled_at=(canceled_at)
click to toggle source
# File lib/mollie/payment.rb, line 134 def canceled_at=(canceled_at) @canceled_at = begin Time.parse(canceled_at.to_s) rescue StandardError nil end end
captures(options = {})
click to toggle source
# File lib/mollie/payment.rb, line 201 def captures(options = {}) Payment::Capture.all(options.merge(payment_id: id)) end
chargebacks(options = {})
click to toggle source
# File lib/mollie/payment.rb, line 197 def chargebacks(options = {}) Payment::Chargeback.all(options.merge(payment_id: id)) end
checkout_url()
click to toggle source
# File lib/mollie/payment.rb, line 182 def checkout_url Util.extract_url(links, 'checkout') end
created_at=(created_at)
click to toggle source
# File lib/mollie/payment.rb, line 110 def created_at=(created_at) @created_at = begin Time.parse(created_at.to_s) rescue StandardError nil end end
customer(options = {})
click to toggle source
# File lib/mollie/payment.rb, line 205 def customer(options = {}) return if customer_id.nil? Customer.get(customer_id, options) end
details=(details)
click to toggle source
# File lib/mollie/payment.rb, line 102 def details=(details) @details = OpenStruct.new(details) if details.is_a?(Hash) end
expired?()
click to toggle source
# File lib/mollie/payment.rb, line 64 def expired? status == STATUS_EXPIRED end
expired_at=(expired_at)
click to toggle source
# File lib/mollie/payment.rb, line 142 def expired_at=(expired_at) @expired_at = begin Time.parse(expired_at.to_s) rescue StandardError nil end end
expires_at=(expires_at)
click to toggle source
# File lib/mollie/payment.rb, line 150 def expires_at=(expires_at) @expires_at = begin Time.parse(expires_at.to_s) rescue StandardError nil end end
failed?()
click to toggle source
# File lib/mollie/payment.rb, line 68 def failed? status == STATUS_FAILED end
failed_at=(failed_at)
click to toggle source
# File lib/mollie/payment.rb, line 158 def failed_at=(failed_at) @failed_at = Time.parse(failed_at) end
mandate(options = {})
click to toggle source
# File lib/mollie/payment.rb, line 210 def mandate(options = {}) return if customer_id.nil? return if mandate_id.nil? options = options.merge(customer_id: customer_id) Customer::Mandate.get(mandate_id, options) end
metadata=(metadata)
click to toggle source
# File lib/mollie/payment.rb, line 106 def metadata=(metadata) @metadata = OpenStruct.new(metadata) if metadata.is_a?(Hash) end
open?()
click to toggle source
# File lib/mollie/payment.rb, line 52 def open? status == STATUS_OPEN end
order(options = {})
click to toggle source
# File lib/mollie/payment.rb, line 229 def order(options = {}) return if order_id.nil? Order.get(order_id, options) end
paid?()
click to toggle source
# File lib/mollie/payment.rb, line 72 def paid? status == STATUS_PAID end
paid_at=(paid_at)
click to toggle source
# File lib/mollie/payment.rb, line 126 def paid_at=(paid_at) @paid_at = begin Time.parse(paid_at.to_s) rescue StandardError nil end end
pending?()
click to toggle source
# File lib/mollie/payment.rb, line 60 def pending? status == STATUS_PENDING end
refund!(options = {})
click to toggle source
# File lib/mollie/payment.rb, line 186 def refund!(options = {}) options[:payment_id] = id # refund full amount by default options[:amount] ||= amount.to_h Payment::Refund.create(options) end
refunded?()
click to toggle source
# File lib/mollie/payment.rb, line 80 def refunded? if amount_refunded amount_refunded.value > 0 else false end end
refunds(options = {})
click to toggle source
# File lib/mollie/payment.rb, line 193 def refunds(options = {}) Payment::Refund.all(options.merge(payment_id: id)) end
settlement(options = {})
click to toggle source
# File lib/mollie/payment.rb, line 217 def settlement(options = {}) return if settlement_id.nil? Settlement.get(settlement_id, options) end
settlement_amount=(settlement_amount)
click to toggle source
# File lib/mollie/payment.rb, line 166 def settlement_amount=(settlement_amount) @settlement_amount = Mollie::Amount.new(settlement_amount) end
subscription(options = {})
click to toggle source
# File lib/mollie/payment.rb, line 222 def subscription(options = {}) return if customer_id.nil? return if subscription_id.nil? options = options.merge(customer_id: customer_id) Customer::Subscription.get(subscription_id, options) end