Class: PaypalServerSdk::OrderApplicationContextShippingPreference

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

Overview

DEPRECATED. DEPRECATED. The shipping preference: Displays the shipping address to the customer. Enables the customer to choose an address on the PayPal site. Restricts the customer from changing the address during the payment-approval process. . The fields in ‘application_context` are now available in the `experience_context` object under the `payment_source` which supports them (eg. `payment_source.paypal.experience_context.shipping_preference`). Please specify this field in the `experience_context` object instead of the `application_context` object.

Constant Summary collapse

ORDER_APPLICATION_CONTEXT_SHIPPING_PREFERENCE =
[
  # Use the customer-provided shipping address on the PayPal site.
  GET_FROM_FILE = 'GET_FROM_FILE'.freeze,

  # Redact the shipping address from the PayPal site. Recommended for
  # digital goods.
  NO_SHIPPING = 'NO_SHIPPING'.freeze,

  # Use the merchant-provided 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



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

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



30
31
32
33
34
# File 'lib/paypal_server_sdk/models/order_application_context_shipping_preference.rb', line 30

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

  true
end