Class: Io::Flow::V0::Models::PaymentCryptopay
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents an online payment processed through CryptoPay.
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#cryptopay ⇒ Object
readonly
Returns the value of attribute cryptopay.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
Attributes inherited from Payment
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ PaymentCryptopay
constructor
A new instance of PaymentCryptopay.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Payment
Constructor Details
#initialize(incoming = {}) ⇒ PaymentCryptopay
Returns a new instance of PaymentCryptopay.
56677 56678 56679 56680 56681 56682 56683 56684 56685 56686 56687 |
# 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 |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
56675 56676 56677 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56675 def amount @amount end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
56675 56676 56677 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56675 def created_at @created_at end |
#cryptopay ⇒ Object (readonly)
Returns the value of attribute cryptopay.
56675 56676 56677 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56675 def cryptopay @cryptopay end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
56675 56676 56677 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56675 def currency @currency end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
56675 56676 56677 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56675 def id @id end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
56675 56676 56677 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56675 def order @order end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
56693 56694 56695 |
# 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 ⇒ Object
56697 56698 56699 56700 56701 56702 56703 56704 56705 56706 |
# 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 ⇒ Object
56689 56690 56691 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56689 def to_json JSON.dump(to_hash) end |