Class: PaypalServerSdk::ExperienceContextShippingPreference

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

Overview

The location from which the shipping address is derived., The shipping preference. This only applies to PayPal payment source., The shipping preference. This only applies to PayPal payment source., The location from which the shipping address is derived.

Constant Summary collapse

EXPERIENCE_CONTEXT_SHIPPING_PREFERENCE =
[
  # Get the customer-provided shipping address on the PayPal site.

  GET_FROM_FILE = 'GET_FROM_FILE'.freeze,

  # Redacts the shipping address from the PayPal site. Recommended for

  # digital goods.

  NO_SHIPPING = 'NO_SHIPPING'.freeze,

  # Merchant sends the shipping address using

  # purchase_units.shipping.address. The customer cannot change this address

  # on the PayPal site.

  SET_PROVIDED_ADDRESS = 'SET_PROVIDED_ADDRESS'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = GET_FROM_FILE) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/paypal_server_sdk/models/experience_context_shipping_preference.rb', line 32

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

  str = value.to_s.strip

  case str.downcase
  when 'get_from_file' then GET_FROM_FILE
  when 'no_shipping' then NO_SHIPPING
  when 'set_provided_address' then SET_PROVIDED_ADDRESS
  else
    default_value
  end
end

.validate(value) ⇒ Object



26
27
28
29
30
# File 'lib/paypal_server_sdk/models/experience_context_shipping_preference.rb', line 26

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

  true
end