Class: FdxV660Api::MerchantEntity1

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

Overview

When payee is a merchant, typically a business from which goods or services are rendered, this field will be populated

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(status:, display_name: SKIP, name: SKIP, address: SKIP, phone: SKIP, merchant_account_ids: SKIP, payee_id: SKIP, expires_timestamp: SKIP, additional_properties: nil) ⇒ MerchantEntity1

Returns a new instance of MerchantEntity1.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/fdx_v660_api/models/merchant_entity1.rb', line 81

def initialize(status:, display_name: SKIP, name: SKIP, address: SKIP,
               phone: SKIP, merchant_account_ids: SKIP, payee_id: SKIP,
               expires_timestamp: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @display_name = display_name unless display_name == SKIP
  @name = name unless name == SKIP
  @address = address unless address == SKIP
  @phone = phone unless phone == SKIP
  @merchant_account_ids =  unless  == SKIP
  @payee_id = payee_id unless payee_id == SKIP
  @status = status
  @expires_timestamp = expires_timestamp unless expires_timestamp == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressDeliveryAddress2

Address of the merchant used to execute the payment

Returns:



25
26
27
# File 'lib/fdx_v660_api/models/merchant_entity1.rb', line 25

def address
  @address
end

#display_nameString

User defined name for the merchant. Used by the customer to identify the merchant. Not used by the system to process payments

Returns:

  • (String)


17
18
19
# File 'lib/fdx_v660_api/models/merchant_entity1.rb', line 17

def display_name
  @display_name
end

#expires_timestampDateTime

Describes when the entity will be automatically deleted. The entity will not go into the "DELETED" state. If this value is null or not provided, the entity will not expire automatically

Returns:

  • (DateTime)


47
48
49
# File 'lib/fdx_v660_api/models/merchant_entity1.rb', line 47

def expires_timestamp
  @expires_timestamp
end

#merchant_account_idsArray[String]

Account identifier(s) the customer has with the merchant

Returns:

  • (Array[String])


33
34
35
# File 'lib/fdx_v660_api/models/merchant_entity1.rb', line 33

def 
  @merchant_account_ids
end

#nameCustomerNameEntity2

Name of the merchant used to execute the payment

Returns:



21
22
23
# File 'lib/fdx_v660_api/models/merchant_entity1.rb', line 21

def name
  @name
end

#payee_idString

Persistent unique identifier for a merchant payee

Returns:

  • (String)


37
38
39
# File 'lib/fdx_v660_api/models/merchant_entity1.rb', line 37

def payee_id
  @payee_id
end

#phoneTelephoneNumber2

Phone number of the merchant used to execute the payment

Returns:



29
30
31
# File 'lib/fdx_v660_api/models/merchant_entity1.rb', line 29

def phone
  @phone
end

#statusPartyStatus3

Defines the Merchant's lifecycle

Returns:



41
42
43
# File 'lib/fdx_v660_api/models/merchant_entity1.rb', line 41

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



99
100
101
102
103
104
105
106
107
108
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/fdx_v660_api/models/merchant_entity1.rb', line 99

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  status = hash.key?('status') ? hash['status'] : nil
  display_name = hash.key?('displayName') ? hash['displayName'] : SKIP
  name = CustomerNameEntity2.from_hash(hash['name']) if hash['name']
  address = DeliveryAddress2.from_hash(hash['address']) if hash['address']
  phone = TelephoneNumber2.from_hash(hash['phone']) if hash['phone']
   =
    hash.key?('merchantAccountIds') ? hash['merchantAccountIds'] : SKIP
  payee_id = hash.key?('payeeId') ? hash['payeeId'] : SKIP
  expires_timestamp = if hash.key?('expiresTimestamp')
                        (DateTimeHelper.from_rfc3339(hash['expiresTimestamp']) if hash['expiresTimestamp'])
                      else
                        SKIP
                      end

  # 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.
  MerchantEntity1.new(status: status,
                      display_name: display_name,
                      name: name,
                      address: address,
                      phone: phone,
                      merchant_account_ids: ,
                      payee_id: payee_id,
                      expires_timestamp: expires_timestamp,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/fdx_v660_api/models/merchant_entity1.rb', line 50

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['display_name'] = 'displayName'
  @_hash['name'] = 'name'
  @_hash['address'] = 'address'
  @_hash['phone'] = 'phone'
  @_hash['merchant_account_ids'] = 'merchantAccountIds'
  @_hash['payee_id'] = 'payeeId'
  @_hash['status'] = 'status'
  @_hash['expires_timestamp'] = 'expiresTimestamp'
  @_hash
end

.nullablesObject

An array for nullable fields



77
78
79
# File 'lib/fdx_v660_api/models/merchant_entity1.rb', line 77

def self.nullables
  []
end

.optionalsObject

An array for optional fields



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/fdx_v660_api/models/merchant_entity1.rb', line 64

def self.optionals
  %w[
    display_name
    name
    address
    phone
    merchant_account_ids
    payee_id
    expires_timestamp
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



150
151
152
153
154
155
156
157
# File 'lib/fdx_v660_api/models/merchant_entity1.rb', line 150

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} display_name: #{@display_name.inspect}, name: #{@name.inspect}, address:"\
  " #{@address.inspect}, phone: #{@phone.inspect}, merchant_account_ids:"\
  " #{@merchant_account_ids.inspect}, payee_id: #{@payee_id.inspect}, status:"\
  " #{@status.inspect}, expires_timestamp: #{@expires_timestamp.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_expires_timestampObject



136
137
138
# File 'lib/fdx_v660_api/models/merchant_entity1.rb', line 136

def to_custom_expires_timestamp
  DateTimeHelper.to_rfc3339(expires_timestamp)
end

#to_sObject

Provides a human-readable string representation of the object.



141
142
143
144
145
146
147
# File 'lib/fdx_v660_api/models/merchant_entity1.rb', line 141

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} display_name: #{@display_name}, name: #{@name}, address: #{@address},"\
  " phone: #{@phone}, merchant_account_ids: #{@merchant_account_ids}, payee_id: #{@payee_id},"\
  " status: #{@status}, expires_timestamp: #{@expires_timestamp}, additional_properties:"\
  " #{@additional_properties}>"
end