class Ingenico::Direct::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/direct/sdk/declined_refund_exception.rb, line 10
def initialize(status_code, response_body, errors)
  super(status_code, response_body, errors&.error_id, errors&.errors, build_message(errors))
  @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::Direct::SDK::Domain::RefundResult, nil]

# File lib/ingenico/direct/sdk/declined_refund_exception.rb, line 17
def refund_result
  @errors&.refund_result
end

Private Instance Methods

build_message(errors) click to toggle source
# File lib/ingenico/direct/sdk/declined_refund_exception.rb, line 23
def build_message(errors)
  refund = errors&.refund_result
  if refund
    "declined refund '#{refund.id}' with status '#{refund.status}'"
  else
    'the Ingenico ePayments platform returned a declined refund response'
  end
end