Class: OrbipayPaymentsapiClient::Refund

Inherits:
Base
  • Object
show all
Defined in:
lib/orbipay_paymentsapi_client/wrappers/refund.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#api_end_point, #http_status_code, #invocation_context, #live_mode

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#requested_by, #set_api_end_point, #with_context

Constructor Details

#initialize(id_refund: nil) ⇒ Refund

Returns a new instance of Refund.

Parameters:

  • id_refund (String) (defaults to: nil)

    attribute in the form of String.



128
129
130
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 128

def initialize(id_refund: nil)
    @id_refund = id_refund
end

Instance Attribute Details

#audit_infoAuditInfo (readonly)

Returns The attribute audit_info.

Returns:



62
63
64
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 62

def audit_info
  @audit_info
end

#commentsString (readonly)

Comments that can be used to recollect the operation performed on the resource object. API clients need to ensure that no sensitive information is passed in the memo. Alacriti (EBPP) is not responsible for the security of any sensitive information that may be passed as part of the memo.

Returns:

  • (String)

    The attribute comments.



53
54
55
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 53

def comments
  @comments
end

#confirmation_numberString (readonly)

The confirmation number or reference provided to the customer for the refund.

Returns:

  • (String)

    The attribute confirmation_number.



33
34
35
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 33

def confirmation_number
  @confirmation_number
end

#custom_fieldsHash<String, String> (readonly)

The additional information or meta-information that EBPP can accept, maintain and transmit back to the client. The custom fields need to be configured with EBPP before they can be accepted. EBPP would reject custom fields that are not pre-configured. Please contact <a href = "mailto: support@billerpayments.com">support@billerpayments.com</a> for more information on configuring and using custom fields.

Returns:

  • (Hash<String, String>)

    The attribute custom_fields.



49
50
51
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 49

def custom_fields
  @custom_fields
end

#expected_refund_settlement_dateString (readonly)

The date by which the credits would be posted to the original funding account. ISO8601 full-date format, YYYY-MM-DD

Returns:

  • (String)

    The attribute expected_refund_settlement_date.



45
46
47
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 45

def expected_refund_settlement_date
  @expected_refund_settlement_date
end

#fee_refundFeeRefund (readonly)

Returns The attribute fee_refund.

Returns:



25
26
27
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 25

def fee_refund
  @fee_refund
end

#idString (readonly)

The unique identifier assigned by EBPP to the refund.

Returns:

  • (String)

    The attribute id.



10
11
12
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 10

def id
  @id
end

#id_customerString (readonly)

The unique identifier assigned by EBPP to the customer.

Returns:

  • (String)

    The attribute id_customer.



70
71
72
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 70

def id_customer
  @id_customer
end

#id_paymentString (readonly)

The unique identifier assigned by EBPP to the payment.

Returns:

  • (String)

    The attribute id_payment.



66
67
68
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 66

def id_payment
  @id_payment
end

#id_refundString (readonly)

The unique identifier assigned by EBPP to the refund.

Returns:

  • (String)

    The attribute id_refund.



74
75
76
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 74

def id_refund
  @id_refund
end

#payment_network_responsePaymentNetworkResponse (readonly)

Returns The attribute payment_network_response.

Returns:



59
60
61
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 59

def payment_network_response
  @payment_network_response
end

#refund_amountString (readonly)

The refund amount upto 2 decimal places.

Returns:

  • (String)

    The attribute refund_amount.



22
23
24
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 22

def refund_amount
  @refund_amount
end

#refund_dateString (readonly)

The date on which the refund is scheduled to be made. It must be in ISO8601 full-date format, namely, YYYY-MM-DD.

Returns:

  • (String)

    The attribute refund_date.



37
38
39
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 37

def refund_date
  @refund_date
end

#refund_entry_dateString (readonly)

The date on which the refund captured in EBPP. It must be in ISO8601 full-date format, namely, YYYY-MM-DD.

Returns:

  • (String)

    The attribute refund_entry_date.



41
42
43
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 41

def 
  @refund_entry_date
end

#refund_referenceString (readonly)

The unique identifier in the client system for the refund.

Returns:

  • (String)

    The attribute refund_reference.



6
7
8
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 6

def refund_reference
  @refund_reference
end

#refund_typeString (readonly)

The portion of the payment amount that is to be or has been refunded. The original payment can be refunded fully including the amount and the fee components, or partially, for just the amount or the fee component. Refund can also be initiated for an arbitrary amount limited by the original payment amount.

Returns:

  • (String)

    The attribute refund_type.



18
19
20
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 18

def refund_type
  @refund_type
end

#source_paymentSourcePayment (readonly)

Returns The attribute source_payment.

Returns:



56
57
58
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 56

def source_payment
  @source_payment
end

#statusString (readonly)

The status of the refund.

Returns:

  • (String)

    The attribute status.



29
30
31
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 29

def status
  @status
end

#urlString (readonly)

This URL fetches the details of refund.

Returns:

  • (String)

    The attribute url.



14
15
16
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 14

def url
  @url
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 78

def self.attribute_map
  {
    :'refund_reference' => :'refund_reference', 
    :'id' => :'id', 
    :'url' => :'url', 
    :'refund_type' => :'refund_type', 
    :'refund_amount' => :'refund_amount', 
    :'fee_refund' => :'fee_refund', 
    :'status' => :'status', 
    :'confirmation_number' => :'confirmation_number', 
    :'refund_date' => :'refund_date', 
    :'refund_entry_date' => :'refund_entry_date', 
    :'expected_refund_settlement_date' => :'expected_refund_settlement_date', 
    :'custom_fields' => :'custom_fields', 
    :'comments' => :'comments', 
    :'source_payment' => :'source_payment', 
    :'payment_network_response' => :'payment_network_response', 
    :'audit_info' => :'audit_info', 
    :'id_payment' => :'ID_PAYMENT', 
    :'id_customer' => :'ID_CUSTOMER', 
    :'id_refund' => :'ID_REFUND' 
  }
end

.swagger_typesObject

Attribute type mapping.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 103

def self.swagger_types
  {
    :'refund_reference' => :'String',	
    :'id' => :'String',	
    :'url' => :'String',	
    :'refund_type' => :'String',	
    :'refund_amount' => :'String',	
    :'fee_refund' => :'FeeRefund',	
    :'status' => :'String',	
    :'confirmation_number' => :'String',	
    :'refund_date' => :'String',	
    :'refund_entry_date' => :'String',	
    :'expected_refund_settlement_date' => :'String',	
    :'custom_fields' => :'Hash<String, String>',	
    :'comments' => :'String',	
    :'source_payment' => :'SourcePayment',	
    :'payment_network_response' => :'PaymentNetworkResponse',	
    :'audit_info' => :'AuditInfo',	
    :'id_payment' => :'String',	
    :'id_customer' => :'String',	
    :'id_refund' => :'String'	
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 256

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      refund_reference == o.refund_reference &&
      id == o.id &&
      url == o.url &&
      refund_type == o.refund_type &&
      refund_amount == o.refund_amount &&
      fee_refund == o.fee_refund &&
      status == o.status &&
      confirmation_number == o.confirmation_number &&
      refund_date == o.refund_date &&
       == o. &&
      expected_refund_settlement_date == o.expected_refund_settlement_date &&
      custom_fields == o.custom_fields &&
      comments == o.comments &&
      source_payment == o.source_payment &&
      payment_network_response == o.payment_network_response &&
      audit_info == o.audit_info &&
      id_payment == o.id_payment &&
      id_customer == o.id_customer &&
      id_refund == o.id_refund
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • type (string)

    Data type

  • value (string)

    Value to be deserialized

Returns:

  • (Object)

    Deserialized data



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 315

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    if value.nil?
      value
    else
      value.to_s
    end
  when :Integer
    if value.nil?
      value
    else
      value.to_i
    end
  when :Float
    if value.nil?
      value
    else
      value.to_f
    end
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = OrbipayPaymentsapiClient::OrbipayPaymentsapiClientModels.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash, Object

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash

  • (Object)

    Returns the object if it cannot be converted to hash



394
395
396
397
398
399
400
401
402
403
404
405
406
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 394

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 294

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        set_values(key => attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      set_values(key => _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#create(invocation_context: nil, live_mode: nil, api_end_point: nil) ⇒ Refund

Returns The Instance of Refund.

Returns:

  • (Refund)

    The Instance of Refund.



220
221
222
223
224
225
226
227
228
229
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 220

def create(invocation_context: nil, live_mode: nil, api_end_point: nil)
	begin
		Base.instance_method(:with_context).bind(self).call(invocation_context, live_mode: live_mode, api_end_point: api_end_point)
    	OrbipayPaymentsapiClientHandlers::CreateRefundHandler.new.process(self)
		rescue ApiError => e
			raise OrbipayApiError.new(http_status_code: e.code, response_headers: e.response_headers, timed_out:e.timed_out, response_body: e.response_body, message: e.message,  masked_authorization_string: e.masked_authorization_string, http_request_body: e.request_body, http_request_headers: e.request_headers),nil, e.backtrace
		rescue StandardError => e
			raise OrbipayApiError.new(message: e.message),nil, e.backtrace
		end
end

#created_by(requestor: nil, requestor_type: nil) ⇒ Refund

Returns The Instance of Refund.

Parameters:

  • requestor (String) (defaults to: nil)

    attribute in the form of String.

  • requestor_type (String) (defaults to: nil)

    attribute in the form of String.

Returns:

  • (Refund)

    The Instance of Refund.



206
207
208
209
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 206

def created_by(requestor: nil, requestor_type: nil)
    Base.instance_method(:requested_by).bind(self).call(requestor: requestor, requestor_type: requestor_type)
    self
end

#eql?(o) ⇒ Boolean

Returns:

  • (Boolean)

See Also:

  • `==` method


281
282
283
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 281

def eql?(o)
  self == o
end

#for_client(client_key: nil) ⇒ Refund

Returns The Instance of Refund.

Parameters:

  • client_key (String) (defaults to: nil)

    attribute in the form of String.

Returns:

  • (Refund)

    The Instance of Refund.



135
136
137
138
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 135

def for_client(client_key: nil)
    super(client_key: client_key)
    self 
end

#for_customer(id_customer: nil) ⇒ Refund

Returns The Instance of Refund.

Parameters:

  • id_customer (String) (defaults to: nil)

    attribute in the form of String.

Returns:

  • (Refund)

    The Instance of Refund.



177
178
179
180
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 177

def for_customer(id_customer: nil)
    @id_customer = id_customer
    self 
end

#for_payment(id_payment: nil) ⇒ Refund

Returns The Instance of Refund.

Parameters:

  • id_payment (String) (defaults to: nil)

    attribute in the form of String.

Returns:

  • (Refund)

    The Instance of Refund.



184
185
186
187
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 184

def for_payment(id_payment: nil)
    @id_payment = id_payment
    self 
end

#get(invocation_context: nil, live_mode: nil, api_end_point: nil) ⇒ Refund

Returns The Instance of Refund.

Returns:

  • (Refund)

    The Instance of Refund.



233
234
235
236
237
238
239
240
241
242
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 233

def get(invocation_context: nil, live_mode: nil, api_end_point: nil)
	begin
		Base.instance_method(:with_context).bind(self).call(invocation_context, live_mode: live_mode, api_end_point: api_end_point)
    	OrbipayPaymentsapiClientHandlers::GetRefundHandler.new.process(self)
		rescue ApiError => e
			raise OrbipayApiError.new(http_status_code: e.code, response_headers: e.response_headers, timed_out:e.timed_out, response_body: e.response_body, message: e.message,  masked_authorization_string: e.masked_authorization_string, http_request_body: e.request_body, http_request_headers: e.request_headers),nil, e.backtrace
		rescue StandardError => e
			raise OrbipayApiError.new(message: e.message),nil, e.backtrace
		end
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



287
288
289
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 287

def hash
  [refund_reference, id, url, refund_type, refund_amount, fee_refund, status, confirmation_number, refund_date, , expected_refund_settlement_date, custom_fields, comments, source_payment, payment_network_response, audit_info, id_payment, id_customer, id_refund].hash
end

#retrieved_by(requestor: nil, requestor_type: nil) ⇒ Refund

Returns The Instance of Refund.

Parameters:

  • requestor (String) (defaults to: nil)

    attribute in the form of String.

  • requestor_type (String) (defaults to: nil)

    attribute in the form of String.

Returns:

  • (Refund)

    The Instance of Refund.



214
215
216
217
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 214

def retrieved_by(requestor: nil, requestor_type: nil)
    Base.instance_method(:requested_by).bind(self).call(requestor: requestor, requestor_type: requestor_type)
    self
end

#set_values(args) ⇒ Object



247
248
249
250
251
252
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 247

def set_values(args)
  args.each do |attr, arg|
    (class << self; self; end).send(:attr_reader, attr.to_sym)
    instance_variable_set("@#{attr}", arg)
  end
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



373
374
375
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 373

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



379
380
381
382
383
384
385
386
387
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 379

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



367
368
369
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 367

def to_s
  to_hash.to_s
end

#vide_channel(channel: nil) ⇒ Refund

Returns The Instance of Refund.

Parameters:

  • channel (String) (defaults to: nil)

    attribute in the form of String.

Returns:

  • (Refund)

    The Instance of Refund.



142
143
144
145
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 142

def vide_channel(channel: nil)
    super(channel: channel)
    self 
end

#with_custom_fields(custom_fields: nil) ⇒ Refund

Returns The Instance of Refund.

Parameters:

  • custom_fields (Hash<String, String>) (defaults to: nil)

    attribute in the form of Hash&lt;String, String&gt;.

Returns:

  • (Refund)

    The Instance of Refund.



191
192
193
194
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 191

def with_custom_fields(custom_fields: nil)
    @custom_fields = custom_fields
    self 
end

#with_details(refund_amount: nil) ⇒ Refund

Returns The Instance of Refund.

Parameters:

  • refund_amount (String) (defaults to: nil)

    attribute in the form of String.

Returns:

  • (Refund)

    The Instance of Refund.



149
150
151
152
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 149

def with_details(refund_amount: nil)
    @refund_amount = refund_amount
    self 
end

#with_fee_refund(fee_refund: nil) ⇒ Refund

Returns The Instance of Refund.

Parameters:

  • fee_refund (FeeRefund) (defaults to: nil)

    attribute in the form of FeeRefund.

Returns:

  • (Refund)

    The Instance of Refund.



198
199
200
201
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 198

def with_fee_refund(fee_refund: nil)
    @fee_refund = fee_refund
    self 
end

#with_memo(comments: nil) ⇒ Refund

Returns The Instance of Refund.

Parameters:

  • comments (String) (defaults to: nil)

    attribute in the form of String.

Returns:

  • (Refund)

    The Instance of Refund.



163
164
165
166
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 163

def with_memo(comments: nil)
    @comments = comments
    self 
end

#with_reference(refund_reference: nil) ⇒ Refund

Returns The Instance of Refund.

Parameters:

  • refund_reference (String) (defaults to: nil)

    attribute in the form of String.

Returns:

  • (Refund)

    The Instance of Refund.



156
157
158
159
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 156

def with_reference(refund_reference: nil)
    @refund_reference = refund_reference
    self 
end

#with_status(status: nil) ⇒ Refund

Returns The Instance of Refund.

Parameters:

  • status (String) (defaults to: nil)

    attribute in the form of String.

Returns:

  • (Refund)

    The Instance of Refund.



170
171
172
173
# File 'lib/orbipay_paymentsapi_client/wrappers/refund.rb', line 170

def with_status(status: nil)
    @status = status
    self 
end