Class: PaypalServerSdk::PaypalWalletContactPreference

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

Overview

The preference to display the contact information (buyer’s shipping email & phone number) on PayPal’s checkout for easy merchant-buyer communication.

Constant Summary collapse

PAYPAL_WALLET_CONTACT_PREFERENCE =
[
  # The merchant can opt out of showing buyer's contact information on
  # PayPal checkout.
  NO_CONTACT_INFO = 'NO_CONTACT_INFO'.freeze,

  # The merchant allows buyer to add or update shipping contact information
  # on the PayPal checkout. Please ensure to use this updated information
  # returned in shipping.email_address and shipping.phone_number to contact
  # your buyers.
  UPDATE_CONTACT_INFO = 'UPDATE_CONTACT_INFO'.freeze,

  # The buyer can only see but can not override merchant passed contact
  # information (shipping.email_address and shipping.phone_number) on PayPal
  # checkout. NOTE: If you don't pass the contact information, the behavior
  # is the same as NO_CONTACT_INFO preference.
  RETAIN_CONTACT_INFO = 'RETAIN_CONTACT_INFO'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = NO_CONTACT_INFO) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/paypal_server_sdk/models/paypal_wallet_contact_preference.rb', line 34

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

  str = value.to_s.strip

  case str.downcase
  when 'no_contact_info' then NO_CONTACT_INFO
  when 'update_contact_info' then UPDATE_CONTACT_INFO
  when 'retain_contact_info' then RETAIN_CONTACT_INFO
  else
    default_value
  end
end

.validate(value) ⇒ Object



28
29
30
31
32
# File 'lib/paypal_server_sdk/models/paypal_wallet_contact_preference.rb', line 28

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

  true
end