Class: DnaPaymentsPartnerReportingSettlementApIs::Terminal

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

Overview

Terminal 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(id: SKIP, mid: SKIP, daily_settlement: SKIP, settlement_period: SKIP, store_name: SKIP, type: SKIP, status: SKIP, additional_properties: nil) ⇒ Terminal

Returns a new instance of Terminal.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/terminal.rb', line 75

def initialize(id: SKIP, mid: SKIP, daily_settlement: SKIP,
               settlement_period: SKIP, store_name: SKIP, type: SKIP,
               status: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id unless id == SKIP
  @mid = mid unless mid == SKIP
  @daily_settlement = daily_settlement unless daily_settlement == SKIP
  @settlement_period = settlement_period unless settlement_period == SKIP
  @store_name = store_name unless store_name == SKIP
  @type = type unless type == SKIP
  @status = status unless status == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#daily_settlementTrueClass | FalseClass

If true, a separate payment is received each day. If false, a single payment is received on Monday for the entire weekend (Fri/Sat/Sun combined).

Returns:

  • (TrueClass | FalseClass)


24
25
26
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/terminal.rb', line 24

def daily_settlement
  @daily_settlement
end

#idString

Unique Terminal ID for the merchant, allocated by DNA Payments.

Returns:

  • (String)


14
15
16
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/terminal.rb', line 14

def id
  @id
end

#midString

MID allocated by DNA Payments. Available only for the pos terminal type.

Returns:

  • (String)


18
19
20
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/terminal.rb', line 18

def mid
  @mid
end

#settlement_periodInteger

Number of days after which settlement is processed for this merchant.

Returns:

  • (Integer)


28
29
30
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/terminal.rb', line 28

def settlement_period
  @settlement_period
end

#statusStatus

open: all operations allowed. suspended/pending-closure: merchant-initiated operations prohibited, settlements/disputes still allowed. closed: no activity allowed.

Returns:



42
43
44
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/terminal.rb', line 42

def status
  @status
end

#store_nameString

Name of the merchant store provided during onboarding.

Returns:

  • (String)


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

def store_name
  @store_name
end

#typeType

Type of terminal: ecom (Ecommerce TID) or pos (physical terminal).

Returns:



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

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
120
121
122
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/terminal.rb', line 92

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  mid = hash.key?('mid') ? hash['mid'] : SKIP
  daily_settlement =
    hash.key?('dailySettlement') ? hash['dailySettlement'] : SKIP
  settlement_period =
    hash.key?('settlementPeriod') ? hash['settlementPeriod'] : SKIP
  store_name = hash.key?('storeName') ? hash['storeName'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP

  # 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.
  Terminal.new(id: id,
               mid: mid,
               daily_settlement: daily_settlement,
               settlement_period: settlement_period,
               store_name: store_name,
               type: type,
               status: status,
               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/terminal.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['mid'] = 'mid'
  @_hash['daily_settlement'] = 'dailySettlement'
  @_hash['settlement_period'] = 'settlementPeriod'
  @_hash['store_name'] = 'storeName'
  @_hash['type'] = 'type'
  @_hash['status'] = 'status'
  @_hash
end

.nullablesObject

An array for nullable fields



71
72
73
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/terminal.rb', line 71

def self.nullables
  []
end

.optionalsObject

An array for optional fields



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/terminal.rb', line 58

def self.optionals
  %w[
    id
    mid
    daily_settlement
    settlement_period
    store_name
    type
    status
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



133
134
135
136
137
138
139
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/terminal.rb', line 133

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, mid: #{@mid.inspect}, daily_settlement:"\
  " #{@daily_settlement.inspect}, settlement_period: #{@settlement_period.inspect},"\
  " store_name: #{@store_name.inspect}, type: #{@type.inspect}, status: #{@status.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



125
126
127
128
129
130
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/terminal.rb', line 125

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, mid: #{@mid}, daily_settlement: #{@daily_settlement},"\
  " settlement_period: #{@settlement_period}, store_name: #{@store_name}, type: #{@type},"\
  " status: #{@status}, additional_properties: #{@additional_properties}>"
end