Class: Io::Flow::V0::Models::OrderPaymentType

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ OrderPaymentType

Returns a new instance of OrderPaymentType.



14317
14318
14319
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14317

def initialize(value)
  @value = HttpClient::Preconditions.assert_class('value', value, String)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14315
14316
14317
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14315

def value
  @value
end

Class Method Details

.ALLObject



14337
14338
14339
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14337

def OrderPaymentType.ALL
  @@all ||= [OrderPaymentType.card, OrderPaymentType.online, OrderPaymentType.credit, OrderPaymentType.installment_plan, OrderPaymentType.cash_on_delivery]
end

.apply(value) ⇒ Object

Returns the instance of OrderPaymentType for this value, creating a new instance for an unknown value



14322
14323
14324
14325
14326
14327
14328
14329
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14322

def OrderPaymentType.apply(value)
  if value.instance_of?(OrderPaymentType)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || OrderPaymentType.new(value))
  end
end

.cardObject

Represents a payment in the form of a credit or debit card



14342
14343
14344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14342

def OrderPaymentType.card
  @@_card ||= OrderPaymentType.new('card')
end

.cash_on_deliveryObject

Request to pay the balance with cash on delivery. Offered only when the final mile carriers support cash on delivery.



14367
14368
14369
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14367

def OrderPaymentType.cash_on_delivery
  @@_cash_on_delivery ||= OrderPaymentType.new('cash_on_delivery')
end

.creditObject

A payment in the form of a credit of some type (e.g. a store credit, gift card) applied to an order



14353
14354
14355
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14353

def OrderPaymentType.credit
  @@_credit ||= OrderPaymentType.new('credit')
end

.from_string(value) ⇒ Object

Returns the instance of OrderPaymentType for this value, or nil if not found



14332
14333
14334
14335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14332

def OrderPaymentType.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  OrderPaymentType.ALL.find { |v| v.value == value }
end

.installment_planObject

An installment plan payment represents that the user has elected an installment plan to pay for this order. For the purposes of the order, the balance will reflect fully paid for the total value of the installment plan, even though individual installments may be created in the future.



14361
14362
14363
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14361

def OrderPaymentType.installment_plan
  @@_installment_plan ||= OrderPaymentType.new('installment_plan')
end

.onlineObject

Represents an online payment (e.g. paypal, alipay, etc)



14347
14348
14349
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14347

def OrderPaymentType.online
  @@_online ||= OrderPaymentType.new('online')
end

Instance Method Details

#to_hashObject



14371
14372
14373
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14371

def to_hash
  value
end