class Io::Flow::V0::Models::PaymentCryptopay

Represents an online payment processed through CryptoPay.

Attributes

amount[R]
created_at[R]
cryptopay[R]
currency[R]
id[R]
order[R]

Public Class Methods

new(incoming={}) click to toggle source
Calls superclass method Io::Flow::V0::Models::Payment::new
# File lib/flow_commerce/flow_api_v0_client.rb, line 56677
def initialize(incoming={})
  super(:discriminator => Payment::Types::PAYMENT_CRYPTOPAY)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :amount, :currency, :cryptopay], 'PaymentCryptopay')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @order = (x = opts.delete(:order); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::AuthorizationOrderReference) ? x : ::Io::Flow::V0::Models::AuthorizationOrderReference.new(x)))
  @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
  @created_at = (x = opts.delete(:created_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
  @cryptopay = (x = opts.delete(:cryptopay); x.is_a?(::Io::Flow::V0::Models::OnlineAuthorizationDetails) ? x : ::Io::Flow::V0::Models::OnlineAuthorizationDetails.from_json(x))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 56693
def copy(incoming={})
  PaymentCryptopay.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
subtype_to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 56697
def subtype_to_hash
  {
    :id => id,
    :order => order.nil? ? nil : order.to_hash,
    :amount => amount.to_f.to_s,
    :currency => currency,
    :created_at => created_at,
    :cryptopay => cryptopay.to_hash
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 56689
def to_json
  JSON.dump(to_hash)
end