Module: PaystackGateway::TransactionResponse
- Extended by:
- ActiveSupport::Concern
- Included in:
- Refunds::CreateResponse, Refunds::FetchRefundResponse, PaystackGateway::Transactions::ChargeAuthorizationResponse, PaystackGateway::Transactions::VerifyTransactionResponse, PaystackGateway::Transfers::InitiateTransferResponse
- Defined in:
- lib/paystack_gateway/transaction_response.rb
Overview
Common helpers for responses from transaction endpoints
Instance Method Summary collapse
- #failure_reason ⇒ Object
- #subaccount_amount ⇒ Object
- #transaction_abandoned? ⇒ Boolean
- #transaction_amount ⇒ Object
- #transaction_completed_at ⇒ Object
- #transaction_failed? ⇒ Boolean
- #transaction_pending? ⇒ Boolean
- #transaction_status ⇒ Object
- #transaction_success? ⇒ Boolean
Instance Method Details
#failure_reason ⇒ Object
29 30 31 32 33 |
# File 'lib/paystack_gateway/transaction_response.rb', line 29 def failure_reason return if !transaction_failed? && !transaction_abandoned? data.gateway_response || transaction_status || end |
#subaccount_amount ⇒ Object
23 24 25 26 27 |
# File 'lib/paystack_gateway/transaction_response.rb', line 23 def subaccount_amount return if !subaccount || !fees_split fees_split.subaccount / BigDecimal('100') end |
#transaction_abandoned? ⇒ Boolean
15 |
# File 'lib/paystack_gateway/transaction_response.rb', line 15 def transaction_abandoned? = transaction_status == :abandoned |
#transaction_amount ⇒ Object
20 |
# File 'lib/paystack_gateway/transaction_response.rb', line 20 def transaction_amount = amount / BigDecimal('100') |
#transaction_completed_at ⇒ Object
21 |
# File 'lib/paystack_gateway/transaction_response.rb', line 21 def transaction_completed_at = data[:updatedAt] || @completed_at |
#transaction_failed? ⇒ Boolean
16 |
# File 'lib/paystack_gateway/transaction_response.rb', line 16 def transaction_failed? = transaction_status == :failed |
#transaction_pending? ⇒ Boolean
17 |
# File 'lib/paystack_gateway/transaction_response.rb', line 17 def transaction_pending? = transaction_status.in?(%i[pending ongoing]) |
#transaction_status ⇒ Object
19 |
# File 'lib/paystack_gateway/transaction_response.rb', line 19 def transaction_status = data.status.to_sym |
#transaction_success? ⇒ Boolean
14 |
# File 'lib/paystack_gateway/transaction_response.rb', line 14 def transaction_success? = transaction_status.in?(%i[success reversed reversal_pending]) |