Class: PaypalServerSdk::PaypalWalletExperienceContext

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

Overview

Customizes the payer experience during the approval process for payment with PayPal. Note: Partners and Marketplaces might configure brand_name and shipping_preference during partner account setup, which overrides the request values.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(brand_name: SKIP, locale: SKIP, shipping_preference: PaypalWalletContextShippingPreference::GET_FROM_FILE, contact_preference: PaypalWalletContactPreference::NO_CONTACT_INFO, return_url: SKIP, cancel_url: SKIP, landing_page: PaypalExperienceLandingPage::NO_PREFERENCE, user_action: PaypalExperienceUserAction::CONTINUE, payment_method_preference: PayeePaymentMethodPreference::UNRESTRICTED, order_update_callback_config: SKIP) ⇒ PaypalWalletExperienceContext

Returns a new instance of PaypalWalletExperienceContext.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 103

def initialize(
  brand_name: SKIP, locale: SKIP,
  shipping_preference: PaypalWalletContextShippingPreference::GET_FROM_FILE,
  contact_preference: PaypalWalletContactPreference::NO_CONTACT_INFO,
  return_url: SKIP, cancel_url: SKIP,
  landing_page: PaypalExperienceLandingPage::NO_PREFERENCE,
  user_action: PaypalExperienceUserAction::CONTINUE,
  payment_method_preference: PayeePaymentMethodPreference::UNRESTRICTED,
  order_update_callback_config: SKIP
)
  @brand_name = brand_name unless brand_name == SKIP
  @locale = locale unless locale == SKIP
  @shipping_preference = shipping_preference unless shipping_preference == SKIP
  @contact_preference = contact_preference unless contact_preference == SKIP
  @return_url = return_url unless return_url == SKIP
  @cancel_url = cancel_url unless cancel_url == SKIP
  @landing_page = landing_page unless landing_page == SKIP
  @user_action = user_action unless user_action == SKIP
  unless payment_method_preference == SKIP
    @payment_method_preference =
      payment_method_preference
  end
  unless order_update_callback_config == SKIP
    @order_update_callback_config =
      order_update_callback_config
  end
end

Instance Attribute Details

#brand_nameString

The label that overrides the business name in the PayPal account on the PayPal site. The pattern is defined by an external party and supports Unicode.

Returns:

  • (String)


19
20
21
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 19

def brand_name
  @brand_name
end

#cancel_urlString

Describes the URL.

Returns:

  • (String)


48
49
50
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 48

def cancel_url
  @cancel_url
end

#contact_preferencePaypalWalletContactPreference

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



40
41
42
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 40

def contact_preference
  @contact_preference
end

#landing_pagePaypalExperienceLandingPage

The type of landing page to show on the PayPal site for customer checkout.



52
53
54
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 52

def landing_page
  @landing_page
end

#localeString

The [language tag](tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/api/rest/reference/country-codes/) or [M49 region code](unstats.un.org/unsd/methodology/m49/).

Returns:

  • (String)


30
31
32
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 30

def locale
  @locale
end

#order_update_callback_configCallbackConfiguration

CallBack Configuration that the merchant can provide to PayPal/Venmo.



64
65
66
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 64

def order_update_callback_config
  @order_update_callback_config
end

#payment_method_preferencePayeePaymentMethodPreference

The merchant-preferred payment methods.



60
61
62
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 60

def payment_method_preference
  @payment_method_preference
end

#return_urlString

Describes the URL.

Returns:

  • (String)


44
45
46
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 44

def return_url
  @return_url
end

#shipping_preferencePaypalWalletContextShippingPreference

The location from which the shipping address is derived.



34
35
36
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 34

def shipping_preference
  @shipping_preference
end

#user_actionPaypalExperienceUserAction

Configures a Continue or Pay Now checkout flow.



56
57
58
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 56

def user_action
  @user_action
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 132

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  brand_name = hash.key?('brand_name') ? hash['brand_name'] : SKIP
  locale = hash.key?('locale') ? hash['locale'] : SKIP
  shipping_preference =
    hash['shipping_preference'] ||= PaypalWalletContextShippingPreference::GET_FROM_FILE
  contact_preference =
    hash['contact_preference'] ||= PaypalWalletContactPreference::NO_CONTACT_INFO
  return_url = hash.key?('return_url') ? hash['return_url'] : SKIP
  cancel_url = hash.key?('cancel_url') ? hash['cancel_url'] : SKIP
  landing_page =
    hash['landing_page'] ||= PaypalExperienceLandingPage::NO_PREFERENCE
  user_action = hash['user_action'] ||= PaypalExperienceUserAction::CONTINUE
  payment_method_preference =
    hash['payment_method_preference'] ||= PayeePaymentMethodPreference::UNRESTRICTED
  if hash['order_update_callback_config']
    order_update_callback_config = CallbackConfiguration.from_hash(hash['order_update_callback_config'])
  end

  # Create object from extracted values.
  PaypalWalletExperienceContext.new(brand_name: brand_name,
                                    locale: locale,
                                    shipping_preference: shipping_preference,
                                    contact_preference: contact_preference,
                                    return_url: return_url,
                                    cancel_url: cancel_url,
                                    landing_page: landing_page,
                                    user_action: user_action,
                                    payment_method_preference: payment_method_preference,
                                    order_update_callback_config: order_update_callback_config)
end

.namesObject

A mapping from model property names to API property names.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 67

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['brand_name'] = 'brand_name'
  @_hash['locale'] = 'locale'
  @_hash['shipping_preference'] = 'shipping_preference'
  @_hash['contact_preference'] = 'contact_preference'
  @_hash['return_url'] = 'return_url'
  @_hash['cancel_url'] = 'cancel_url'
  @_hash['landing_page'] = 'landing_page'
  @_hash['user_action'] = 'user_action'
  @_hash['payment_method_preference'] = 'payment_method_preference'
  @_hash['order_update_callback_config'] = 'order_update_callback_config'
  @_hash
end

.nullablesObject

An array for nullable fields



99
100
101
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 99

def self.nullables
  []
end

.optionalsObject

An array for optional fields



83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 83

def self.optionals
  %w[
    brand_name
    locale
    shipping_preference
    contact_preference
    return_url
    cancel_url
    landing_page
    user_action
    payment_method_preference
    order_update_callback_config
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



177
178
179
180
181
182
183
184
185
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 177

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} brand_name: #{@brand_name.inspect}, locale: #{@locale.inspect},"\
  " shipping_preference: #{@shipping_preference.inspect}, contact_preference:"\
  " #{@contact_preference.inspect}, return_url: #{@return_url.inspect}, cancel_url:"\
  " #{@cancel_url.inspect}, landing_page: #{@landing_page.inspect}, user_action:"\
  " #{@user_action.inspect}, payment_method_preference: #{@payment_method_preference.inspect},"\
  " order_update_callback_config: #{@order_update_callback_config.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



167
168
169
170
171
172
173
174
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 167

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} brand_name: #{@brand_name}, locale: #{@locale}, shipping_preference:"\
  " #{@shipping_preference}, contact_preference: #{@contact_preference}, return_url:"\
  " #{@return_url}, cancel_url: #{@cancel_url}, landing_page: #{@landing_page}, user_action:"\
  " #{@user_action}, payment_method_preference: #{@payment_method_preference},"\
  " order_update_callback_config: #{@order_update_callback_config}>"
end