Class: NewStoreApi::ReturnProcessedDto
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::ReturnProcessedDto
- Defined in:
- lib/new_store_api/models/return_processed_dto.rb
Overview
return.processed is sent when one or more items have been returned.
Processing of the associated refund transaction might not be completed yet.
Instance Attribute Summary collapse
-
#associate_email ⇒ String
Contains the email address of the associate who processed the return.
-
#associate_id ⇒ String
Contains the identifier of the associate who processed the return.
-
#blind_order_id ⇒ String
The id of the order that was created to execute a blind return.
-
#currency ⇒ String
The currency used in processing this return, using ISO-4217 Currency Code.
-
#customer_email ⇒ String
Contains the email address of the customer who bought the items.
-
#customer_id ⇒ String
Contains the identifier of the customer who bought the items.
-
#external_order_id ⇒ String
Unique human-friendly identifier for the order.
-
#id ⇒ String
The id of the return.
-
#items ⇒ Array[Item12]
The id of the return.
-
#order_id ⇒ String
The order id this return is related to.
-
#return_fee ⇒ Float
The fee a consumer has to pay for a return.
-
#return_location_id ⇒ String
The fulfillment location id where the return comes from.
-
#returned_at ⇒ DateTime
The UTC time the return was processed in the DC or store.
-
#total_refund_amount ⇒ Float
Total refund amount of this return before adjustment due to return policy.
-
#total_refund_amount_adjusted ⇒ Float
Total refund amount of this return after adjustment due to return policy.
-
#total_refund_excl_tax ⇒ Float
Refund amount of this return without taxes.
-
#total_refund_tax ⇒ Float
Refund tax of this return.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(currency = nil, id = nil, items = nil, return_location_id = nil, returned_at = nil, total_refund_amount = nil, total_refund_amount_adjusted = nil, total_refund_excl_tax = nil, total_refund_tax = nil, associate_email = SKIP, associate_id = SKIP, blind_order_id = SKIP, customer_email = SKIP, customer_id = SKIP, external_order_id = SKIP, order_id = SKIP, return_fee = SKIP) ⇒ ReturnProcessedDto
constructor
A new instance of ReturnProcessedDto.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_returned_at ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(currency = nil, id = nil, items = nil, return_location_id = nil, returned_at = nil, total_refund_amount = nil, total_refund_amount_adjusted = nil, total_refund_excl_tax = nil, total_refund_tax = nil, associate_email = SKIP, associate_id = SKIP, blind_order_id = SKIP, customer_email = SKIP, customer_id = SKIP, external_order_id = SKIP, order_id = SKIP, return_fee = SKIP) ⇒ ReturnProcessedDto
Returns a new instance of ReturnProcessedDto.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 126 def initialize(currency = nil, id = nil, items = nil, return_location_id = nil, returned_at = nil, total_refund_amount = nil, total_refund_amount_adjusted = nil, total_refund_excl_tax = nil, total_refund_tax = nil, associate_email = SKIP, associate_id = SKIP, blind_order_id = SKIP, customer_email = SKIP, customer_id = SKIP, external_order_id = SKIP, order_id = SKIP, return_fee = SKIP) @associate_email = associate_email unless associate_email == SKIP @associate_id = associate_id unless associate_id == SKIP @blind_order_id = blind_order_id unless blind_order_id == SKIP @currency = currency @customer_email = customer_email unless customer_email == SKIP @customer_id = customer_id unless customer_id == SKIP @external_order_id = external_order_id unless external_order_id == SKIP @id = id @items = items @order_id = order_id unless order_id == SKIP @return_fee = return_fee unless return_fee == SKIP @return_location_id = return_location_id @returned_at = returned_at @total_refund_amount = total_refund_amount @total_refund_amount_adjusted = total_refund_amount_adjusted @total_refund_excl_tax = total_refund_excl_tax @total_refund_tax = total_refund_tax end |
Instance Attribute Details
#associate_email ⇒ String
Contains the email address of the associate who processed the return.
16 17 18 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 16 def associate_email @associate_email end |
#associate_id ⇒ String
Contains the identifier of the associate who processed the return.
20 21 22 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 20 def associate_id @associate_id end |
#blind_order_id ⇒ String
The id of the order that was created to execute a blind return. Omitted if the return is not a blind return.
25 26 27 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 25 def blind_order_id @blind_order_id end |
#currency ⇒ String
The currency used in processing this return, using ISO-4217 Currency Code.
29 30 31 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 29 def currency @currency end |
#customer_email ⇒ String
Contains the email address of the customer who bought the items.
33 34 35 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 33 def customer_email @customer_email end |
#customer_id ⇒ String
Contains the identifier of the customer who bought the items.
37 38 39 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 37 def customer_id @customer_id end |
#external_order_id ⇒ String
Unique human-friendly identifier for the order.
41 42 43 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 41 def external_order_id @external_order_id end |
#id ⇒ String
The id of the return.
45 46 47 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 45 def id @id end |
#items ⇒ Array[Item12]
The id of the return.
49 50 51 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 49 def items @items end |
#order_id ⇒ String
The order id this return is related to. Order id is omitted for blind returns.
54 55 56 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 54 def order_id @order_id end |
#return_fee ⇒ Float
The fee a consumer has to pay for a return.
58 59 60 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 58 def return_fee @return_fee end |
#return_location_id ⇒ String
The fulfillment location id where the return comes from.
62 63 64 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 62 def return_location_id @return_location_id end |
#returned_at ⇒ DateTime
The UTC time the return was processed in the DC or store.
66 67 68 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 66 def returned_at @returned_at end |
#total_refund_amount ⇒ Float
Total refund amount of this return before adjustment due to return policy.
70 71 72 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 70 def total_refund_amount @total_refund_amount end |
#total_refund_amount_adjusted ⇒ Float
Total refund amount of this return after adjustment due to return policy.
74 75 76 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 74 def total_refund_amount_adjusted @total_refund_amount_adjusted end |
#total_refund_excl_tax ⇒ Float
Refund amount of this return without taxes.
78 79 80 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 78 def total_refund_excl_tax @total_refund_excl_tax end |
#total_refund_tax ⇒ Float
Refund tax of this return.
82 83 84 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 82 def total_refund_tax @total_refund_tax end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 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 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 155 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. currency = hash.key?('currency') ? hash['currency'] : nil id = hash.key?('id') ? hash['id'] : nil # Parameter is an array, so we need to iterate through it items = nil unless hash['items'].nil? items = [] hash['items'].each do |structure| items << (Item12.from_hash(structure) if structure) end end items = nil unless hash.key?('items') return_location_id = hash.key?('return_location_id') ? hash['return_location_id'] : nil returned_at = if hash.key?('returned_at') (DateTimeHelper.from_rfc3339(hash['returned_at']) if hash['returned_at']) end total_refund_amount = hash.key?('total_refund_amount') ? hash['total_refund_amount'] : nil total_refund_amount_adjusted = hash.key?('total_refund_amount_adjusted') ? hash['total_refund_amount_adjusted'] : nil total_refund_excl_tax = hash.key?('total_refund_excl_tax') ? hash['total_refund_excl_tax'] : nil total_refund_tax = hash.key?('total_refund_tax') ? hash['total_refund_tax'] : nil associate_email = hash.key?('associate_email') ? hash['associate_email'] : SKIP associate_id = hash.key?('associate_id') ? hash['associate_id'] : SKIP blind_order_id = hash.key?('blind_order_id') ? hash['blind_order_id'] : SKIP customer_email = hash.key?('customer_email') ? hash['customer_email'] : SKIP customer_id = hash.key?('customer_id') ? hash['customer_id'] : SKIP external_order_id = hash.key?('external_order_id') ? hash['external_order_id'] : SKIP order_id = hash.key?('order_id') ? hash['order_id'] : SKIP return_fee = hash.key?('return_fee') ? hash['return_fee'] : SKIP # Create object from extracted values. ReturnProcessedDto.new(currency, id, items, return_location_id, returned_at, total_refund_amount, total_refund_amount_adjusted, total_refund_excl_tax, total_refund_tax, associate_email, associate_id, blind_order_id, customer_email, customer_id, external_order_id, order_id, return_fee) end |
.names ⇒ Object
A mapping from model property names to API property names.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 85 def self.names @_hash = {} if @_hash.nil? @_hash['associate_email'] = 'associate_email' @_hash['associate_id'] = 'associate_id' @_hash['blind_order_id'] = 'blind_order_id' @_hash['currency'] = 'currency' @_hash['customer_email'] = 'customer_email' @_hash['customer_id'] = 'customer_id' @_hash['external_order_id'] = 'external_order_id' @_hash['id'] = 'id' @_hash['items'] = 'items' @_hash['order_id'] = 'order_id' @_hash['return_fee'] = 'return_fee' @_hash['return_location_id'] = 'return_location_id' @_hash['returned_at'] = 'returned_at' @_hash['total_refund_amount'] = 'total_refund_amount' @_hash['total_refund_amount_adjusted'] = 'total_refund_amount_adjusted' @_hash['total_refund_excl_tax'] = 'total_refund_excl_tax' @_hash['total_refund_tax'] = 'total_refund_tax' @_hash end |
.nullables ⇒ Object
An array for nullable fields
122 123 124 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 122 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 108 def self.optionals %w[ associate_email associate_id blind_order_id customer_email customer_id external_order_id order_id return_fee ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
223 224 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 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 223 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.currency, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.items, ->(val) { Item12.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value.return_location_id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.returned_at, ->(val) { val.instance_of? DateTime }) and APIHelper.valid_type?(value.total_refund_amount, ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value.total_refund_amount_adjusted, ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value.total_refund_excl_tax, ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value.total_refund_tax, ->(val) { val.instance_of? Float }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['currency'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['items'], ->(val) { Item12.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value['return_location_id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['returned_at'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['total_refund_amount'], ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value['total_refund_amount_adjusted'], ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value['total_refund_excl_tax'], ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value['total_refund_tax'], ->(val) { val.instance_of? Float }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 289 def inspect class_name = self.class.name.split('::').last "<#{class_name} associate_email: #{@associate_email.inspect}, associate_id:"\ " #{@associate_id.inspect}, blind_order_id: #{@blind_order_id.inspect}, currency:"\ " #{@currency.inspect}, customer_email: #{@customer_email.inspect}, customer_id:"\ " #{@customer_id.inspect}, external_order_id: #{@external_order_id.inspect}, id:"\ " #{@id.inspect}, items: #{@items.inspect}, order_id: #{@order_id.inspect}, return_fee:"\ " #{@return_fee.inspect}, return_location_id: #{@return_location_id.inspect}, returned_at:"\ " #{@returned_at.inspect}, total_refund_amount: #{@total_refund_amount.inspect},"\ " total_refund_amount_adjusted: #{@total_refund_amount_adjusted.inspect},"\ " total_refund_excl_tax: #{@total_refund_excl_tax.inspect}, total_refund_tax:"\ " #{@total_refund_tax.inspect}>" end |
#to_custom_returned_at ⇒ Object
217 218 219 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 217 def to_custom_returned_at DateTimeHelper.to_rfc3339(returned_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/new_store_api/models/return_processed_dto.rb', line 276 def to_s class_name = self.class.name.split('::').last "<#{class_name} associate_email: #{@associate_email}, associate_id: #{@associate_id},"\ " blind_order_id: #{@blind_order_id}, currency: #{@currency}, customer_email:"\ " #{@customer_email}, customer_id: #{@customer_id}, external_order_id:"\ " #{@external_order_id}, id: #{@id}, items: #{@items}, order_id: #{@order_id}, return_fee:"\ " #{@return_fee}, return_location_id: #{@return_location_id}, returned_at: #{@returned_at},"\ " total_refund_amount: #{@total_refund_amount}, total_refund_amount_adjusted:"\ " #{@total_refund_amount_adjusted}, total_refund_excl_tax: #{@total_refund_excl_tax},"\ " total_refund_tax: #{@total_refund_tax}>" end |