Class: Payment::Gateways::BasePaymentGateway
- Inherits:
-
BaseService
- Object
- BaseService
- Payment::Gateways::BasePaymentGateway
- Defined in:
- app/services/payment/gateways/base_payment_gateway.rb
Overview
Common superclass for payment gateway strategy services
(Payment::Gateways::CreditCard, Payment::Gateways::Paypal, etc).
Provides shared exception reporting that funnels gateway failures into
AppSignal with payment context.
Direct Known Subclasses
CreditCard, Default, Echeck, Paypal, PaypalInvoice, PurchaseOrder, VerbalPurchaseOrder
Instance Method Summary collapse
-
#report_exception(exception, options = {}) ⇒ Object
Log and report a gateway exception with attached payment context.
Instance Method Details
#report_exception(exception, options = {}) ⇒ Object
Log and report a gateway exception with attached payment context.
The error is logged with full backtrace locally and forwarded to
AppSignal so the on-call engineer can correlate.
17 18 19 20 21 22 23 24 25 |
# File 'app/services/payment/gateways/base_payment_gateway.rb', line 17 def report_exception(exception, ={}) payment_id = [:payment]&.id || [:payment_id] = [:message] || String.new("General Payment Error") = .dup << ". For payment id #{payment_id}" if payment_id << "#{exception.}.\n #{exception.backtrace.join("\n")}" logger.error ErrorReporting.error exception, payment_id: payment_id, message: end |