Exception: GooglePayRuby::GooglePaymentDecryptionError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/google_pay_ruby/google_payment_decryption_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, errors = []) ⇒ GooglePaymentDecryptionError

Returns a new instance of GooglePaymentDecryptionError.



7
8
9
10
# File 'lib/google_pay_ruby/google_payment_decryption_error.rb', line 7

def initialize(message, errors = [])
  @errors = errors
  super(message)
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



5
6
7
# File 'lib/google_pay_ruby/google_payment_decryption_error.rb', line 5

def errors
  @errors
end

Instance Method Details

#full_messageObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/google_pay_ruby/google_payment_decryption_error.rb', line 12

def full_message
  message_parts = [message]
  
  if errors.any?
    message_parts << "\nDecryption attempts failed:"
    errors.each_with_index do |error, index|
      merchant_id = error.respond_to?(:merchant_identifier) ? error.merchant_identifier : "Unknown"
      message_parts << "  [#{index + 1}] Merchant: #{merchant_id} - #{error.message}"
    end
  end
  
  message_parts.join("\n")
end