Class: FdxV660Api::TransactionPayeeEntity

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

Overview

Primary demographic information for payee on a transaction; name, location, contact phone

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) ⇒ TransactionPayeeEntity

Returns a new instance of TransactionPayeeEntity.



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

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:



28
29
30
# File 'lib/fdx_v660_api/models/transaction_payee_entity.rb', line 28

def address
  @address
end

#individual_nameIndividualName7

Name when payee is an individual

Returns:



24
25
26
# File 'lib/fdx_v660_api/models/transaction_payee_entity.rb', line 24

def individual_name
  @individual_name
end

#merchant_idString

Merchant identifier (MID) for card processing

Returns:

  • (String)


20
21
22
# File 'lib/fdx_v660_api/models/transaction_payee_entity.rb', line 20

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:



16
17
18
# File 'lib/fdx_v660_api/models/transaction_payee_entity.rb', line 16

def merchant_name
  @merchant_name
end

#phoneTelephoneNumber3

Phone number of the payee who received the payment

Returns:



32
33
34
# File 'lib/fdx_v660_api/models/transaction_payee_entity.rb', line 32

def phone
  @phone
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
101
# File 'lib/fdx_v660_api/models/transaction_payee_entity.rb', line 76

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.
  TransactionPayeeEntity.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.



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

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



57
58
59
# File 'lib/fdx_v660_api/models/transaction_payee_entity.rb', line 57

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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.



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

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