Class: Io::Flow::V0::Models::PaymentPaypal
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents an online payment processed through PayPal.
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#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.
-
#paypal ⇒ Object
readonly
Returns the value of attribute paypal.
Attributes inherited from Payment
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ PaymentPaypal
constructor
A new instance of PaymentPaypal.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Payment
Constructor Details
#initialize(incoming = {}) ⇒ PaymentPaypal
Returns a new instance of PaymentPaypal.
23494 23495 23496 23497 23498 23499 23500 23501 23502 23503 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23494 def initialize(incoming={}) super(:discriminator => Payment::Types::PAYMENT_PAYPAL) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :amount, :currency, :paypal], 'PaymentPaypal') @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) @paypal = (x = opts.delete(:paypal); x.is_a?(::Io::Flow::V0::Models::PaymentPaypalData) ? x : ::Io::Flow::V0::Models::PaymentPaypalData.new(x)) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
23492 23493 23494 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23492 def amount @amount end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
23492 23493 23494 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23492 def currency @currency end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
23492 23493 23494 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23492 def id @id end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
23492 23493 23494 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23492 def order @order end |
#paypal ⇒ Object (readonly)
Returns the value of attribute paypal.
23492 23493 23494 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23492 def paypal @paypal end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
23509 23510 23511 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23509 def copy(incoming={}) PaymentPaypal.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
23513 23514 23515 23516 23517 23518 23519 23520 23521 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23513 def subtype_to_hash { :id => id, :order => order.nil? ? nil : order.to_hash, :amount => amount, :currency => currency, :paypal => paypal.to_hash } end |
#to_json ⇒ Object
23505 23506 23507 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23505 def to_json JSON.dump(to_hash) end |