Class: PaypalServerSdk::SupplementaryData

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

Overview

Supplementary data about a payment. This object passes information that can be used to improve risk assessments and processing costs, for example, by providing Level 2 and Level 3 payment data.

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(card: SKIP, risk: SKIP) ⇒ SupplementaryData

Returns a new instance of SupplementaryData.



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

def initialize(card: SKIP, risk: SKIP)
  @card = card unless card == SKIP
  @risk = risk unless risk == SKIP
end

Instance Attribute Details

#cardCardSupplementaryData

Merchants and partners can add Level 2 and 3 data to payments to reduce risk and payment processing costs. For more information about processing payments, see checkout or multiparty checkout.



18
19
20
# File 'lib/paypal_server_sdk/models/supplementary_data.rb', line 18

def card
  @card
end

#riskRiskSupplementaryData

Additional information necessary to evaluate the risk profile of a transaction.



23
24
25
# File 'lib/paypal_server_sdk/models/supplementary_data.rb', line 23

def risk
  @risk
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/paypal_server_sdk/models/supplementary_data.rb', line 52

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  card = CardSupplementaryData.from_hash(hash['card']) if hash['card']
  risk = RiskSupplementaryData.from_hash(hash['risk']) if hash['risk']

  # Create object from extracted values.
  SupplementaryData.new(card: card,
                        risk: risk)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
# File 'lib/paypal_server_sdk/models/supplementary_data.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['card'] = 'card'
  @_hash['risk'] = 'risk'
  @_hash
end

.nullablesObject

An array for nullable fields



42
43
44
# File 'lib/paypal_server_sdk/models/supplementary_data.rb', line 42

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
37
38
39
# File 'lib/paypal_server_sdk/models/supplementary_data.rb', line 34

def self.optionals
  %w[
    card
    risk
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



71
72
73
74
# File 'lib/paypal_server_sdk/models/supplementary_data.rb', line 71

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} card: #{@card.inspect}, risk: #{@risk.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



65
66
67
68
# File 'lib/paypal_server_sdk/models/supplementary_data.rb', line 65

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} card: #{@card}, risk: #{@risk}>"
end