Class: DnaPaymentsPartnerReportingSettlementApIs::MerchantV2

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v2.rb

Overview

MerchantV2 Model.

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(descriptor: SKIP, id: SKIP, name: SKIP, is_active: SKIP, reconciliation_id: SKIP, terminals: SKIP, additional_properties: nil) ⇒ MerchantV2

Returns a new instance of MerchantV2.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v2.rb', line 67

def initialize(descriptor: SKIP, id: SKIP, name: SKIP, is_active: SKIP,
               reconciliation_id: SKIP, terminals: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @descriptor = descriptor unless descriptor == SKIP
  @id = id unless id == SKIP
  @name = name unless name == SKIP
  @is_active = is_active unless is_active == SKIP
  @reconciliation_id = reconciliation_id unless reconciliation_id == SKIP
  @terminals = terminals unless terminals == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#descriptorString

Merchant descriptor as it appears on the consumer's bank statement for DNA Acquiring.

Returns:

  • (String)


15
16
17
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v2.rb', line 15

def descriptor
  @descriptor
end

#idString

Unique ID for the merchant, allocated by DNA Payments.

Returns:

  • (String)


19
20
21
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v2.rb', line 19

def id
  @id
end

#is_activeTrueClass | FalseClass

Whether the merchant is active.

Returns:

  • (TrueClass | FalseClass)


27
28
29
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v2.rb', line 27

def is_active
  @is_active
end

#nameString

Name of the merchant.

Returns:

  • (String)


23
24
25
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v2.rb', line 23

def name
  @name
end

#reconciliation_idString

Unique ID allocated by DNA Payments to the merchant account; appears on the merchant bank statement when payments/settlements are made.

Returns:

  • (String)


32
33
34
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v2.rb', line 32

def reconciliation_id
  @reconciliation_id
end

#terminalsArray[Terminal]

List of all Terminal IDs configured for the merchant.

Returns:



36
37
38
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v2.rb', line 36

def terminals
  @terminals
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v2.rb', line 83

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  descriptor = hash.key?('descriptor') ? hash['descriptor'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  is_active = hash.key?('isActive') ? hash['isActive'] : SKIP
  reconciliation_id =
    hash.key?('reconciliationId') ? hash['reconciliationId'] : SKIP
  # Parameter is an array, so we need to iterate through it
  terminals = nil
  unless hash['terminals'].nil?
    terminals = []
    hash['terminals'].each do |structure|
      terminals << (Terminal.from_hash(structure) if structure)
    end
  end

  terminals = SKIP unless hash.key?('terminals')

  # 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.
  MerchantV2.new(descriptor: descriptor,
                 id: id,
                 name: name,
                 is_active: is_active,
                 reconciliation_id: reconciliation_id,
                 terminals: terminals,
                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
46
47
48
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v2.rb', line 39

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['descriptor'] = 'descriptor'
  @_hash['id'] = 'id'
  @_hash['name'] = 'name'
  @_hash['is_active'] = 'isActive'
  @_hash['reconciliation_id'] = 'reconciliationId'
  @_hash['terminals'] = 'terminals'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v2.rb', line 63

def self.nullables
  []
end

.optionalsObject

An array for optional fields



51
52
53
54
55
56
57
58
59
60
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v2.rb', line 51

def self.optionals
  %w[
    descriptor
    id
    name
    is_active
    reconciliation_id
    terminals
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



130
131
132
133
134
135
136
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v2.rb', line 130

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} descriptor: #{@descriptor.inspect}, id: #{@id.inspect}, name:"\
  " #{@name.inspect}, is_active: #{@is_active.inspect}, reconciliation_id:"\
  " #{@reconciliation_id.inspect}, terminals: #{@terminals.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



122
123
124
125
126
127
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v2.rb', line 122

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} descriptor: #{@descriptor}, id: #{@id}, name: #{@name}, is_active:"\
  " #{@is_active}, reconciliation_id: #{@reconciliation_id}, terminals: #{@terminals},"\
  " additional_properties: #{@additional_properties}>"
end