class Ingenico::Connect::SDK::DeclinedRefundException

Indicates that a refund is declined by the Ingenico ePayments platform or one of its downstream partners/acquirers.

Public Class Methods

new(status_code, response_body, errors) click to toggle source

Create a new DeclinedRefundException @see ApiException#initialize

Calls superclass method
# File lib/ingenico/connect/sdk/declined_refund_exception.rb, line 10
def initialize(status_code, response_body, errors)
  if errors.nil?
    super(status_code, response_body, nil, nil, build_message(errors))
  else
    super(status_code, response_body, errors.error_id, errors.errors,
          build_message(errors))
  end
  @errors = errors
end

Public Instance Methods

refund_result() click to toggle source

The declined refund result as returned by the Ingenico ePayments platform. @return [Ingenico::Connect::SDK::Domain::Refund::RefundResult]

# File lib/ingenico/connect/sdk/declined_refund_exception.rb, line 22
def refund_result
  if @errors.nil?
    nil
  else
    @errors.refund_result
  end
end

Private Instance Methods

build_message(errors) click to toggle source
# File lib/ingenico/connect/sdk/declined_refund_exception.rb, line 32
def build_message(errors)
  if !errors.nil?
    refund = errors.refund_result
  else
    refund = nil
  end
  if refund.nil?
    'the Ingenico ePayments platform returned a declined refund response'
  else
    "declined refund '" + refund.id + "' with status '" +
        refund.status + "'"
  end
end