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.<blockquote><strong>Note:</strong> Partners and Marketplaces might configure brand_name and shipping_preference during partner account setup, which overrides the request values.</blockquote>

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

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

Returns a new instance of PaypalWalletExperienceContext.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 91

def initialize(
  brand_name: SKIP, locale: SKIP,
  shipping_preference: ShippingPreference::GET_FROM_FILE, return_url: SKIP,
  cancel_url: SKIP,
  landing_page: PaypalExperienceLandingPage::NO_PREFERENCE,
  user_action: PaypalExperienceUserAction::CONTINUE,
  payment_method_preference: PayeePaymentMethodPreference::UNRESTRICTED
)
  @brand_name = brand_name unless brand_name == SKIP
  @locale = locale unless locale == SKIP
  @shipping_preference = shipping_preference unless shipping_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
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)


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

def brand_name
  @brand_name
end

#cancel_urlString

Describes the URL.

Returns:

  • (String)


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

def cancel_url
  @cancel_url
end

#landing_pagePaypalExperienceLandingPage

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



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

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)


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

def locale
  @locale
end

#payment_method_preferencePayeePaymentMethodPreference

The merchant-preferred payment methods.



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

def payment_method_preference
  @payment_method_preference
end

#return_urlString

Describes the URL.

Returns:

  • (String)


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

def return_url
  @return_url
end

#shipping_preferenceShippingPreference

The location from which the shipping address is derived.

Returns:



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

def shipping_preference
  @shipping_preference
end

#user_actionPaypalExperienceUserAction

Configures a <strong>Continue</strong> or <strong>Pay Now</strong> checkout flow.



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

def user_action
  @user_action
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 113

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'] ||= ShippingPreference::GET_FROM_FILE
  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

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

.namesObject

A mapping from model property names to API property names.



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 59

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['brand_name'] = 'brand_name'
  @_hash['locale'] = 'locale'
  @_hash['shipping_preference'] = 'shipping_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
end

.nullablesObject

An array for nullable fields



87
88
89
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 87

def self.nullables
  []
end

.optionalsObject

An array for optional fields



73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb', line 73

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