class Afterpay::PaymentEvent

Attributes

amount[RW]
created[RW]
expires[RW]
id[RW]
payment_event_merchant_reference[RW]
type[RW]

Public Class Methods

from_response(response) click to toggle source

Builds PaymentEvent from response

# File lib/afterpay/payment_event.rb, line 17
def self.from_response(response)
  return nil if response.nil?

  new(
    id: response[:id],
    created: response[:created],
    expires: response[:expires],
    type: response[:type],
    amount: Utils::Money.from_response(response[:amount]),
    payment_event_merchant_reference: response[:paymentEventMerchantReference]
  )
end
new(attributes = {}) click to toggle source
# File lib/afterpay/payment_event.rb, line 7
def initialize(attributes = {})
  @id = attributes[:id] || ""
  @created = attributes[:created] || ""
  @expires = attributes[:expires] || ""
  @type = attributes[:type] || ""
  @amount = attributes[:amount] || Money.from_amount(0)
  @payment_event_merchant_reference = attributes[:payment_event_merchant_reference] || ""
end