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
Public Instance Methods
Source
# File lib/mollie/payment.rb, line 164 def amount=(amount) @amount = Mollie::Amount.new(amount) end
Source
# File lib/mollie/payment.rb, line 172 def amount_captured=(amount_captured) @amount_captured = Mollie::Amount.new(amount_captured) end
Source
# File lib/mollie/payment.rb, line 176 def amount_charged_back=(amount_charged_back) @amount_charged_back = Mollie::Amount.new(amount_charged_back) end
Source
# File lib/mollie/payment.rb, line 184 def amount_refunded=(amount_refunded) @amount_refunded = Mollie::Amount.new(amount_refunded) end
Source
# File lib/mollie/payment.rb, line 180 def amount_remaining=(amount_remaining) @amount_remaining = Mollie::Amount.new(amount_remaining) end
Source
# File lib/mollie/payment.rb, line 94 def application_fee=(application_fee) amount = Amount.new(application_fee['amount']) description = application_fee['description'] @application_fee = OpenStruct.new( amount: amount, description: description ) end
Source
# File lib/mollie/payment.rb, line 58 def canceled? status == STATUS_CANCELED end
Source
# File lib/mollie/payment.rb, line 136 def canceled_at=(canceled_at) @canceled_at = begin Time.parse(canceled_at.to_s) rescue StandardError nil end end
Source
# File lib/mollie/payment.rb, line 223 def captures(options = {}) resources = (attributes['_embedded']['captures'] if attributes['_embedded']) if resources.nil? Payment::Capture.all(options.merge(payment_id: id)) else List.new({ '_embedded' => { 'captures' => resources } }, Payment::Capture) end end
Source
# File lib/mollie/payment.rb, line 213 def chargebacks(options = {}) resources = (attributes['_embedded']['chargebacks'] if attributes['_embedded']) if resources.nil? Payment::Chargeback.all(options.merge(payment_id: id)) else List.new({ '_embedded' => { 'chargebacks' => resources } }, Payment::Chargeback) end end
Source
# File lib/mollie/payment.rb, line 188 def checkout_url Util.extract_url(links, 'checkout') end
Source
# File lib/mollie/payment.rb, line 112 def created_at=(created_at) @created_at = begin Time.parse(created_at.to_s) rescue StandardError nil end end
Source
# File lib/mollie/payment.rb, line 233 def customer(options = {}) return if customer_id.nil? Customer.get(customer_id, options) end
Source
# File lib/mollie/payment.rb, line 104 def details=(details) @details = OpenStruct.new(details) if details.is_a?(Hash) end
Source
# File lib/mollie/payment.rb, line 144 def expired_at=(expired_at) @expired_at = begin Time.parse(expired_at.to_s) rescue StandardError nil end end
Source
# File lib/mollie/payment.rb, line 152 def expires_at=(expires_at) @expires_at = begin Time.parse(expires_at.to_s) rescue StandardError nil end end
Source
# File lib/mollie/payment.rb, line 160 def failed_at=(failed_at) @failed_at = Time.parse(failed_at) end
Source
# File lib/mollie/payment.rb, line 238 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
Source
# File lib/mollie/payment.rb, line 108 def metadata=(metadata) @metadata = OpenStruct.new(metadata) if metadata.is_a?(Hash) end
Source
# File lib/mollie/payment.rb, line 257 def order(options = {}) return if order_id.nil? Order.get(order_id, options) end
Source
# File lib/mollie/payment.rb, line 128 def paid_at=(paid_at) @paid_at = begin Time.parse(paid_at.to_s) rescue StandardError nil end end
Source
# File lib/mollie/payment.rb, line 192 def refund!(options = {}) options[:payment_id] = id # refund full amount by default options[:amount] ||= amount.to_h Payment::Refund.create(options) end
Source
# File lib/mollie/payment.rb, line 82 def refunded? if amount_refunded amount_refunded.value > 0 else false end end
Source
# File lib/mollie/payment.rb, line 203 def refunds(options = {}) resources = (attributes['_embedded']['refunds'] if attributes['_embedded']) if resources.nil? Payment::Refund.all(options.merge(payment_id: id)) else List.new({ '_embedded' => { 'refunds' => resources } }, Payment::Refund) end end
Source
# File lib/mollie/payment.rb, line 245 def settlement(options = {}) return if settlement_id.nil? Settlement.get(settlement_id, options) end
Source
# File lib/mollie/payment.rb, line 168 def settlement_amount=(settlement_amount) @settlement_amount = Mollie::Amount.new(settlement_amount) end
Source
# File lib/mollie/payment.rb, line 250 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