Class: FdxV660Api::TransactionPayeeEntity3

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/transaction_payee_entity3.rb

Overview

The merchant or individual payee who was involved in the transaction

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(merchant_name: SKIP, merchant_id: SKIP, individual_name: SKIP, address: SKIP, phone: SKIP, additional_properties: nil) ⇒ TransactionPayeeEntity3

Returns a new instance of TransactionPayeeEntity3.



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

def initialize(merchant_name: SKIP, merchant_id: SKIP,
               individual_name: SKIP, address: SKIP, phone: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @merchant_name = merchant_name unless merchant_name == SKIP
  @merchant_id = merchant_id unless merchant_id == SKIP
  @individual_name = individual_name unless individual_name == SKIP
  @address = address unless address == SKIP
  @phone = phone unless phone == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressDeliveryAddress1

Address of the payee who received the payment

Returns:



27
28
29
# File 'lib/fdx_v660_api/models/transaction_payee_entity3.rb', line 27

def address
  @address
end

#individual_nameIndividualName7

Name when payee is an individual

Returns:



23
24
25
# File 'lib/fdx_v660_api/models/transaction_payee_entity3.rb', line 23

def individual_name
  @individual_name
end

#merchant_idString

Merchant identifier (MID) for card processing

Returns:

  • (String)


19
20
21
# File 'lib/fdx_v660_api/models/transaction_payee_entity3.rb', line 19

def merchant_id
  @merchant_id
end

#merchant_nameBusinessName5

Name when payee is a merchant, typically a business from which goods or services are rendered

Returns:



15
16
17
# File 'lib/fdx_v660_api/models/transaction_payee_entity3.rb', line 15

def merchant_name
  @merchant_name
end

#phoneTelephoneNumber3

Phone number of the payee who received the payment

Returns:



31
32
33
# File 'lib/fdx_v660_api/models/transaction_payee_entity3.rb', line 31

def phone
  @phone
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/fdx_v660_api/models/transaction_payee_entity3.rb', line 75

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  merchant_name = BusinessName5.from_hash(hash['merchantName']) if hash['merchantName']
  merchant_id = hash.key?('merchantId') ? hash['merchantId'] : SKIP
  individual_name = IndividualName7.from_hash(hash['individualName']) if
    hash['individualName']
  address = DeliveryAddress1.from_hash(hash['address']) if hash['address']
  phone = TelephoneNumber3.from_hash(hash['phone']) if hash['phone']

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  TransactionPayeeEntity3.new(merchant_name: merchant_name,
                              merchant_id: merchant_id,
                              individual_name: individual_name,
                              address: address,
                              phone: phone,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
41
42
# File 'lib/fdx_v660_api/models/transaction_payee_entity3.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['merchant_name'] = 'merchantName'
  @_hash['merchant_id'] = 'merchantId'
  @_hash['individual_name'] = 'individualName'
  @_hash['address'] = 'address'
  @_hash['phone'] = 'phone'
  @_hash
end

.nullablesObject

An array for nullable fields



56
57
58
# File 'lib/fdx_v660_api/models/transaction_payee_entity3.rb', line 56

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
52
53
# File 'lib/fdx_v660_api/models/transaction_payee_entity3.rb', line 45

def self.optionals
  %w[
    merchant_name
    merchant_id
    individual_name
    address
    phone
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



104
105
106
107
108
109
110
# File 'lib/fdx_v660_api/models/transaction_payee_entity3.rb', line 104

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



121
122
123
124
125
126
127
# File 'lib/fdx_v660_api/models/transaction_payee_entity3.rb', line 121

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} merchant_name: #{@merchant_name.inspect}, merchant_id:"\
  " #{@merchant_id.inspect}, individual_name: #{@individual_name.inspect}, address:"\
  " #{@address.inspect}, phone: #{@phone.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



113
114
115
116
117
118
# File 'lib/fdx_v660_api/models/transaction_payee_entity3.rb', line 113

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} merchant_name: #{@merchant_name}, merchant_id: #{@merchant_id},"\
  " individual_name: #{@individual_name}, address: #{@address}, phone: #{@phone},"\
  " additional_properties: #{@additional_properties}>"
end