Class: PaypalServerSdk::VaultExperienceContext

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

Overview

Customizes the Vault creation flow experience for your customers.

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, return_url: SKIP, cancel_url: SKIP, shipping_preference: ExperienceContextShippingPreference::GET_FROM_FILE, vault_instruction: SKIP, app_switch_context: SKIP, user_action: VaultUserAction::CONTINUE) ⇒ VaultExperienceContext

Returns a new instance of VaultExperienceContext.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/paypal_server_sdk/models/vault_experience_context.rb', line 92

def initialize(
  brand_name: SKIP, locale: SKIP, return_url: SKIP, cancel_url: SKIP,
  shipping_preference: ExperienceContextShippingPreference::GET_FROM_FILE,
  vault_instruction: SKIP, app_switch_context: SKIP,
  user_action: VaultUserAction::CONTINUE
)
  @brand_name = brand_name unless brand_name == SKIP
  @locale = locale unless locale == SKIP
  @return_url = return_url unless return_url == SKIP
  @cancel_url = cancel_url unless cancel_url == SKIP
  @shipping_preference = shipping_preference unless shipping_preference == SKIP
  @vault_instruction = vault_instruction unless vault_instruction == SKIP
  @app_switch_context = app_switch_context unless app_switch_context == SKIP
  @user_action = user_action unless user_action == SKIP
end

Instance Attribute Details

#app_switch_contextAppSwitchContext

Merchant provided details of the native app or mobile web browser to facilitate buyer’s app switch to the PayPal consumer app.

Returns:



53
54
55
# File 'lib/paypal_server_sdk/models/vault_experience_context.rb', line 53

def app_switch_context
  @app_switch_context
end

#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)


16
17
18
# File 'lib/paypal_server_sdk/models/vault_experience_context.rb', line 16

def brand_name
  @brand_name
end

#cancel_urlString

The URL where the customer is redirected after customer cancels or leaves the flow. It is a required field for contingency flows like PayPal wallet, 3DS.

Returns:

  • (String)


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

def cancel_url
  @cancel_url
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)


27
28
29
# File 'lib/paypal_server_sdk/models/vault_experience_context.rb', line 27

def locale
  @locale
end

#return_urlString

The URL where the customer is redirected after customer approves leaves the flow. It is a required field for contingency flows like PayPal wallet, 3DS.

Returns:

  • (String)


33
34
35
# File 'lib/paypal_server_sdk/models/vault_experience_context.rb', line 33

def return_url
  @return_url
end

#shipping_preferenceExperienceContextShippingPreference

The shipping preference. This only applies to PayPal payment source.



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

def shipping_preference
  @shipping_preference
end

#user_actionVaultUserAction

User Action on action to be performed after a successful payer approval.

Returns:



57
58
59
# File 'lib/paypal_server_sdk/models/vault_experience_context.rb', line 57

def user_action
  @user_action
end

#vault_instructionVaultInstructionAction

DEPRECATED. Vault Instruction on action to be performed after a successful payer approval.



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

def vault_instruction
  @vault_instruction
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/paypal_server_sdk/models/vault_experience_context.rb', line 109

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
  return_url = hash.key?('return_url') ? hash['return_url'] : SKIP
  cancel_url = hash.key?('cancel_url') ? hash['cancel_url'] : SKIP
  shipping_preference =
    hash['shipping_preference'] ||= ExperienceContextShippingPreference::GET_FROM_FILE
  vault_instruction =
    hash.key?('vault_instruction') ? hash['vault_instruction'] : SKIP
  app_switch_context = AppSwitchContext.from_hash(hash['app_switch_context']) if
    hash['app_switch_context']
  user_action = hash['user_action'] ||= VaultUserAction::CONTINUE

  # Create object from extracted values.

  VaultExperienceContext.new(brand_name: brand_name,
                             locale: locale,
                             return_url: return_url,
                             cancel_url: cancel_url,
                             shipping_preference: shipping_preference,
                             vault_instruction: vault_instruction,
                             app_switch_context: app_switch_context,
                             user_action: user_action)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['brand_name'] = 'brand_name'
  @_hash['locale'] = 'locale'
  @_hash['return_url'] = 'return_url'
  @_hash['cancel_url'] = 'cancel_url'
  @_hash['shipping_preference'] = 'shipping_preference'
  @_hash['vault_instruction'] = 'vault_instruction'
  @_hash['app_switch_context'] = 'app_switch_context'
  @_hash['user_action'] = 'user_action'
  @_hash
end

.nullablesObject

An array for nullable fields



88
89
90
# File 'lib/paypal_server_sdk/models/vault_experience_context.rb', line 88

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    brand_name
    locale
    return_url
    cancel_url
    shipping_preference
    vault_instruction
    app_switch_context
    user_action
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



146
147
148
149
150
151
152
# File 'lib/paypal_server_sdk/models/vault_experience_context.rb', line 146

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

#to_sObject

Provides a human-readable string representation of the object.



137
138
139
140
141
142
143
# File 'lib/paypal_server_sdk/models/vault_experience_context.rb', line 137

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