Class: PaypalServerSdk::PaypalWalletVaultBase

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

Overview

Resource consolidating common request and response attributes for vaulting PayPal Wallet.

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(store_in_vault: SKIP, description: SKIP, usage_pattern: SKIP, usage_type: SKIP, customer_type: PaypalPaymentTokenCustomerType::CONSUMER, permit_multiple_payment_tokens: false) ⇒ PaypalWalletVaultBase

Returns a new instance of PaypalWalletVaultBase.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/paypal_server_sdk/models/paypal_wallet_vault_base.rb', line 78

def initialize(store_in_vault: SKIP, description: SKIP, usage_pattern: SKIP,
               usage_type: SKIP,
               customer_type: PaypalPaymentTokenCustomerType::CONSUMER,
               permit_multiple_payment_tokens: false)
  @store_in_vault = store_in_vault unless store_in_vault == SKIP
  @description = description unless description == SKIP
  @usage_pattern = usage_pattern unless usage_pattern == SKIP
  @usage_type = usage_type unless usage_type == SKIP
  @customer_type = customer_type unless customer_type == SKIP
  unless permit_multiple_payment_tokens == SKIP
    @permit_multiple_payment_tokens =
      permit_multiple_payment_tokens
  end
end

Instance Attribute Details

#customer_typePaypalPaymentTokenCustomerType

The customer type associated with the PayPal payment token. This is to indicate whether the customer acting on the merchant / platform is either a business or a consumer.



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

def customer_type
  @customer_type
end

#descriptionString

The description displayed to PayPal consumer on the approval flow for PayPal, as well as on the PayPal payment token management experience on PayPal.com.

Returns:

  • (String)


21
22
23
# File 'lib/paypal_server_sdk/models/paypal_wallet_vault_base.rb', line 21

def description
  @description
end

#permit_multiple_payment_tokensTrueClass | FalseClass

Create multiple payment tokens for the same payer, merchant/platform combination. Use this when the customer has not logged in at merchant/platform. The payment token thus generated, can then also be used to create the customer account at merchant/platform. Use this also when multiple payment tokens are required for the same payer, different customer at merchant/platform. This helps to identify customers distinctly even though they may share the same PayPal account. This only applies to PayPal payment source.

Returns:

  • (TrueClass | FalseClass)


46
47
48
# File 'lib/paypal_server_sdk/models/paypal_wallet_vault_base.rb', line 46

def permit_multiple_payment_tokens
  @permit_multiple_payment_tokens
end

#store_in_vaultStoreInVaultInstruction

Defines how and when the payment source gets vaulted.



15
16
17
# File 'lib/paypal_server_sdk/models/paypal_wallet_vault_base.rb', line 15

def store_in_vault
  @store_in_vault
end

#usage_patternUsagePattern

Expected business/pricing model for the billing agreement.

Returns:



25
26
27
# File 'lib/paypal_server_sdk/models/paypal_wallet_vault_base.rb', line 25

def usage_pattern
  @usage_pattern
end

#usage_typeUsageType

The usage type associated with the PayPal payment token.

Returns:



29
30
31
# File 'lib/paypal_server_sdk/models/paypal_wallet_vault_base.rb', line 29

def usage_type
  @usage_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/paypal_server_sdk/models/paypal_wallet_vault_base.rb', line 94

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  store_in_vault =
    hash.key?('store_in_vault') ? hash['store_in_vault'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  usage_pattern = hash.key?('usage_pattern') ? hash['usage_pattern'] : SKIP
  usage_type = hash.key?('usage_type') ? hash['usage_type'] : SKIP
  customer_type =
    hash['customer_type'] ||= PaypalPaymentTokenCustomerType::CONSUMER
  permit_multiple_payment_tokens =
    hash['permit_multiple_payment_tokens'] ||= false

  # Create object from extracted values.
  PaypalWalletVaultBase.new(store_in_vault: store_in_vault,
                            description: description,
                            usage_pattern: usage_pattern,
                            usage_type: usage_type,
                            customer_type: customer_type,
                            permit_multiple_payment_tokens: permit_multiple_payment_tokens)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/paypal_server_sdk/models/paypal_wallet_vault_base.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['store_in_vault'] = 'store_in_vault'
  @_hash['description'] = 'description'
  @_hash['usage_pattern'] = 'usage_pattern'
  @_hash['usage_type'] = 'usage_type'
  @_hash['customer_type'] = 'customer_type'
  @_hash['permit_multiple_payment_tokens'] =
    'permit_multiple_payment_tokens'
  @_hash
end

.nullablesObject

An array for nullable fields



74
75
76
# File 'lib/paypal_server_sdk/models/paypal_wallet_vault_base.rb', line 74

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    store_in_vault
    description
    usage_pattern
    usage_type
    customer_type
    permit_multiple_payment_tokens
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



126
127
128
129
130
131
132
# File 'lib/paypal_server_sdk/models/paypal_wallet_vault_base.rb', line 126

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} store_in_vault: #{@store_in_vault.inspect}, description:"\
  " #{@description.inspect}, usage_pattern: #{@usage_pattern.inspect}, usage_type:"\
  " #{@usage_type.inspect}, customer_type: #{@customer_type.inspect},"\
  " permit_multiple_payment_tokens: #{@permit_multiple_payment_tokens.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



118
119
120
121
122
123
# File 'lib/paypal_server_sdk/models/paypal_wallet_vault_base.rb', line 118

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} store_in_vault: #{@store_in_vault}, description: #{@description},"\
  " usage_pattern: #{@usage_pattern}, usage_type: #{@usage_type}, customer_type:"\
  " #{@customer_type}, permit_multiple_payment_tokens: #{@permit_multiple_payment_tokens}>"
end