Class: NewStoreApi::CashboxConfigAxenaSeV1Dto

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb

Overview

CashboxConfigAxenaSeV1Dto 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(address = nil, city = nil, corporate_id = nil, legal_entity = nil, postal_code = nil, axena_activation_data = SKIP, cash_register_name = SKIP, control_unit_address = SKIP, control_unit_journal_address = SKIP, control_unit_manufacturer = SKIP, control_unit_model = SKIP, control_unit_serial = SKIP, control_unit_type = SKIP, late_signing_enabled = false) ⇒ CashboxConfigAxenaSeV1Dto

Returns a new instance of CashboxConfigAxenaSeV1Dto.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 148

def initialize(address = nil, city = nil, corporate_id = nil,
               legal_entity = nil, postal_code = nil,
               axena_activation_data = SKIP, cash_register_name = SKIP,
               control_unit_address = SKIP,
               control_unit_journal_address = SKIP,
               control_unit_manufacturer = SKIP, control_unit_model = SKIP,
               control_unit_serial = SKIP, control_unit_type = SKIP,
               late_signing_enabled = false)
  @address = address
  @axena_activation_data = axena_activation_data unless axena_activation_data == SKIP
  @cash_register_name = cash_register_name unless cash_register_name == SKIP
  @city = city
  @control_unit_address = control_unit_address unless control_unit_address == SKIP
  unless control_unit_journal_address == SKIP
    @control_unit_journal_address =
      control_unit_journal_address
  end
  unless control_unit_manufacturer == SKIP
    @control_unit_manufacturer =
      control_unit_manufacturer
  end
  @control_unit_model = control_unit_model unless control_unit_model == SKIP
  @control_unit_serial = control_unit_serial unless control_unit_serial == SKIP
  @control_unit_type = control_unit_type unless control_unit_type == SKIP
  @corporate_id = corporate_id
  @late_signing_enabled = late_signing_enabled unless late_signing_enabled == SKIP
  @legal_entity = legal_entity
  @postal_code = postal_code
end

Instance Attribute Details

#addressString

Address of the store.

Returns:

  • (String)


14
15
16
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 14

def address
  @address
end

#axena_activation_dataAxenaActivationDataV1Dto

Axena (Srv4pos) activation data.

  • Can be optionally set during fiscal activations by providing a previously registered activation.
  • If a value is not provided during an activation, a new Cash Registry will be registered in Axena (Srv4pos) by using the /activations-advanced endpoint.


23
24
25
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 23

def axena_activation_data
  @axena_activation_data
end

#cash_register_nameString

Cash Register name to be used with the Axena (Srv4pos) API.

Returns:

  • (String)


30
31
32
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 30

def cash_register_name
  @cash_register_name
end

#cityString

City where the store is located.

Returns:

  • (String)


34
35
36
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 34

def city
  @city
end

#control_unit_addressString

Control unit address.

  • Can be optionally set during fiscal activations by providing a the control unit address retrieved from Axena (Srv4pos).
  • If a value is not provided during an activation, the default control unit information will be used.

Returns:

  • (String)


42
43
44
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 42

def control_unit_address
  @control_unit_address
end

#control_unit_journal_addressString

Control unit journal address.

  • Can be optionally set during fiscal activations by providing a the control unit journal address retrieved from Axena (Srv4pos).
  • If a value is not provided during an activation, the default control unit information will be used.

Returns:

  • (String)


50
51
52
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 50

def control_unit_journal_address
  @control_unit_journal_address
end

#control_unit_manufacturerString

Control unit manufacturer.

  • Can be optionally set during fiscal activations by providing a the control unit manufacturer retrieved from Axena (Srv4pos).
  • If a value is not provided during an activation, the default control unit information will be used.

Returns:

  • (String)


58
59
60
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 58

def control_unit_manufacturer
  @control_unit_manufacturer
end

#control_unit_modelString

Control unit model.

  • Can be optionally set during fiscal activations by providing a the control unit model retrieved from Axena (Srv4pos).
  • If a value is not provided during an activation, the default control unit information will be used.

Returns:

  • (String)


66
67
68
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 66

def control_unit_model
  @control_unit_model
end

#control_unit_serialString

Control unit serial number.

  • Can be optionally set during fiscal activations by providing a the control unit serial number retrieved from Axena (Srv4pos).
  • If a value is not provided during an activation, the default control unit serial number will be used.

Returns:

  • (String)


74
75
76
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 74

def control_unit_serial
  @control_unit_serial
end

#control_unit_typeString

Control unit type.

  • Can be optionally set during fiscal activations by providing a the control unit type retrieved from Axena (Srv4pos).
  • If a value is not provided during an activation, the default control unit information will be used.

Returns:

  • (String)


82
83
84
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 82

def control_unit_type
  @control_unit_type
end

#corporate_idString

Corporate identifier that represents particular tenant/merchant in Axena (Srv4pos).

Returns:

  • (String)


87
88
89
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 87

def corporate_id
  @corporate_id
end

#late_signing_enabledTrueClass | FalseClass

Flag for enabling late signing mode.

  • When enabled:
    • Transactions will be allowed when Axena (Srv4pos) is not reachable.
    • Receipt printing will be blocked until the transaction is proceesed by Axena (Srv4pos).
  • When not enabled:
    • Transaction processing will be blocked when Axena (Srv4pos) is not reachable.

Returns:

  • (TrueClass | FalseClass)


98
99
100
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 98

def late_signing_enabled
  @late_signing_enabled
end

Legal entity name of the tenant in Sweden.

Returns:

  • (String)


102
103
104
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 102

def legal_entity
  @legal_entity
end

#postal_codeString

Postal code of the store.

Returns:

  • (String)


106
107
108
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 106

def postal_code
  @postal_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 179

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  address = hash.key?('address') ? hash['address'] : nil
  city = hash.key?('city') ? hash['city'] : nil
  corporate_id = hash.key?('corporate_id') ? hash['corporate_id'] : nil
  legal_entity = hash.key?('legal_entity') ? hash['legal_entity'] : nil
  postal_code = hash.key?('postal_code') ? hash['postal_code'] : nil
  axena_activation_data = AxenaActivationDataV1Dto.from_hash(hash['axena_activation_data']) if
    hash['axena_activation_data']
  cash_register_name =
    hash.key?('cash_register_name') ? hash['cash_register_name'] : SKIP
  control_unit_address =
    hash.key?('control_unit_address') ? hash['control_unit_address'] : SKIP
  control_unit_journal_address =
    hash.key?('control_unit_journal_address') ? hash['control_unit_journal_address'] : SKIP
  control_unit_manufacturer =
    hash.key?('control_unit_manufacturer') ? hash['control_unit_manufacturer'] : SKIP
  control_unit_model =
    hash.key?('control_unit_model') ? hash['control_unit_model'] : SKIP
  control_unit_serial =
    hash.key?('control_unit_serial') ? hash['control_unit_serial'] : SKIP
  control_unit_type =
    hash.key?('control_unit_type') ? hash['control_unit_type'] : SKIP
  late_signing_enabled = hash['late_signing_enabled'] ||= false

  # Create object from extracted values.
  CashboxConfigAxenaSeV1Dto.new(address,
                                city,
                                corporate_id,
                                legal_entity,
                                postal_code,
                                axena_activation_data,
                                cash_register_name,
                                control_unit_address,
                                control_unit_journal_address,
                                control_unit_manufacturer,
                                control_unit_model,
                                control_unit_serial,
                                control_unit_type,
                                late_signing_enabled)
end

.namesObject

A mapping from model property names to API property names.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 109

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['address'] = 'address'
  @_hash['axena_activation_data'] = 'axena_activation_data'
  @_hash['cash_register_name'] = 'cash_register_name'
  @_hash['city'] = 'city'
  @_hash['control_unit_address'] = 'control_unit_address'
  @_hash['control_unit_journal_address'] = 'control_unit_journal_address'
  @_hash['control_unit_manufacturer'] = 'control_unit_manufacturer'
  @_hash['control_unit_model'] = 'control_unit_model'
  @_hash['control_unit_serial'] = 'control_unit_serial'
  @_hash['control_unit_type'] = 'control_unit_type'
  @_hash['corporate_id'] = 'corporate_id'
  @_hash['late_signing_enabled'] = 'late_signing_enabled'
  @_hash['legal_entity'] = 'legal_entity'
  @_hash['postal_code'] = 'postal_code'
  @_hash
end

.nullablesObject

An array for nullable fields



144
145
146
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 144

def self.nullables
  []
end

.optionalsObject

An array for optional fields



129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 129

def self.optionals
  %w[
    axena_activation_data
    cash_register_name
    control_unit_address
    control_unit_journal_address
    control_unit_manufacturer
    control_unit_model
    control_unit_serial
    control_unit_type
    late_signing_enabled
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 225

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.address,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.city,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.corporate_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.legal_entity,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.postal_code,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['address'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['city'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['corporate_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['legal_entity'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['postal_code'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 270

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} address: #{@address.inspect}, axena_activation_data:"\
  " #{@axena_activation_data.inspect}, cash_register_name: #{@cash_register_name.inspect},"\
  " city: #{@city.inspect}, control_unit_address: #{@control_unit_address.inspect},"\
  " control_unit_journal_address: #{@control_unit_journal_address.inspect},"\
  " control_unit_manufacturer: #{@control_unit_manufacturer.inspect}, control_unit_model:"\
  " #{@control_unit_model.inspect}, control_unit_serial: #{@control_unit_serial.inspect},"\
  " control_unit_type: #{@control_unit_type.inspect}, corporate_id: #{@corporate_id.inspect},"\
  " late_signing_enabled: #{@late_signing_enabled.inspect}, legal_entity:"\
  " #{@legal_entity.inspect}, postal_code: #{@postal_code.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



258
259
260
261
262
263
264
265
266
267
# File 'lib/new_store_api/models/cashbox_config_axena_se_v1_dto.rb', line 258

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} address: #{@address}, axena_activation_data: #{@axena_activation_data},"\
  " cash_register_name: #{@cash_register_name}, city: #{@city}, control_unit_address:"\
  " #{@control_unit_address}, control_unit_journal_address: #{@control_unit_journal_address},"\
  " control_unit_manufacturer: #{@control_unit_manufacturer}, control_unit_model:"\
  " #{@control_unit_model}, control_unit_serial: #{@control_unit_serial}, control_unit_type:"\
  " #{@control_unit_type}, corporate_id: #{@corporate_id}, late_signing_enabled:"\
  " #{@late_signing_enabled}, legal_entity: #{@legal_entity}, postal_code: #{@postal_code}>"
end