Class: PaypalServerSdk::ShippingType

Inherits:
Object
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/shipping_type.rb

Overview

A classification for the method of purchase fulfillment.

Constant Summary collapse

SHIPPING_TYPE =
[
  # The payer intends to receive the items at a specified address.

  SHIPPING = 'SHIPPING'.freeze,

  # DEPRECATED. To ensure that seller protection is correctly assigned,

  # please use 'PICKUP_IN_STORE' or 'PICKUP_FROM_PERSON' instead. Currently,

  # this field indicates that the payer intends to pick up the items at a

  # specified address (ie. a store address).

  PICKUP = 'PICKUP'.freeze,

  # The payer intends to pick up the item(s) from the payee's physical

  # store. Also termed as BOPIS, "Buy Online, Pick-up in Store". Seller

  # protection is provided with this option.

  PICKUP_IN_STORE = 'PICKUP_IN_STORE'.freeze,

  # The payer intends to pick up the item(s) from the payee in person. Also

  # termed as BOPIP, "Buy Online, Pick-up in Person". Seller protection is

  # not available, since the payer is receiving the item from the payee in

  # person, and can validate the item prior to payment.

  PICKUP_FROM_PERSON = 'PICKUP_FROM_PERSON'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = SHIPPING) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/paypal_server_sdk/models/shipping_type.rb', line 37

def self.from_value(value, default_value = SHIPPING)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'shipping' then SHIPPING
  when 'pickup' then PICKUP
  when 'pickup_in_store' then PICKUP_IN_STORE
  when 'pickup_from_person' then PICKUP_FROM_PERSON
  else
    default_value
  end
end

.validate(value) ⇒ Object



31
32
33
34
35
# File 'lib/paypal_server_sdk/models/shipping_type.rb', line 31

def self.validate(value)
  return false if value.nil?

  true
end