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.



18399
18400
18401
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18399

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



18397
18398
18399
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18397

def value
  @value
end

Class Method Details

.ALLObject



18419
18420
18421
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18419

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



18404
18405
18406
18407
18408
18409
18410
18411
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18404

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



18424
18425
18426
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18424

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.



18450
18451
18452
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18450

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



18435
18436
18437
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18435

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



18414
18415
18416
18417
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18414

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. Note this feature was deprecated in early 2020.



18444
18445
18446
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18444

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

.onlineObject

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



18429
18430
18431
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18429

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

Instance Method Details

#to_hashObject



18454
18455
18456
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18454

def to_hash
  value
end