module Buckaruby::TransactionResponse
Base for a transaction response.
Public Instance Methods
account_bic()
click to toggle source
# File lib/buckaruby/response.rb, line 93 def account_bic case payment_method when PaymentMethod::IDEAL params[:brq_service_ideal_consumerbic] when PaymentMethod::IDEAL_PROCESSING params[:brq_service_idealprocessing_consumerbic] when PaymentMethod::SEPA_DIRECT_DEBIT params[:brq_service_sepadirectdebit_customerbic] end end
account_iban()
click to toggle source
# File lib/buckaruby/response.rb, line 104 def account_iban case payment_method when PaymentMethod::IDEAL params[:brq_service_ideal_consumeriban] when PaymentMethod::IDEAL_PROCESSING params[:brq_service_idealprocessing_consumeriban] when PaymentMethod::SEPA_DIRECT_DEBIT params[:brq_service_sepadirectdebit_customeriban] end end
account_name()
click to toggle source
# File lib/buckaruby/response.rb, line 115 def account_name case payment_method when PaymentMethod::IDEAL params[:brq_service_ideal_consumername] || params[:brq_customer_name] when PaymentMethod::IDEAL_PROCESSING params[:brq_service_idealprocessing_consumername] || params[:brq_customer_name] when PaymentMethod::SEPA_DIRECT_DEBIT params[:brq_service_sepadirectdebit_customername] || params[:brq_customer_name] end end
collect_date()
click to toggle source
# File lib/buckaruby/response.rb, line 126 def collect_date if payment_method == PaymentMethod::SEPA_DIRECT_DEBIT parse_date(params[:brq_service_sepadirectdebit_collectdate]) end end
invoicenumber()
click to toggle source
# File lib/buckaruby/response.rb, line 132 def invoicenumber params[:brq_invoicenumber] end
mandate_reference()
click to toggle source
# File lib/buckaruby/response.rb, line 136 def mandate_reference if payment_method == PaymentMethod::SEPA_DIRECT_DEBIT params[:brq_service_sepadirectdebit_mandatereference] end end
payment_id()
click to toggle source
# File lib/buckaruby/response.rb, line 142 def payment_id params[:brq_payment] end
payment_method()
click to toggle source
# File lib/buckaruby/response.rb, line 146 def payment_method parse_payment_method(params[:brq_payment_method] || params[:brq_transaction_method]) end
redirect_url()
click to toggle source
# File lib/buckaruby/response.rb, line 150 def redirect_url params[:brq_redirecturl] end
refund_transaction_id()
click to toggle source
# File lib/buckaruby/response.rb, line 154 def refund_transaction_id params[:brq_relatedtransaction_refund] end
reversal_transaction_id()
click to toggle source
# File lib/buckaruby/response.rb, line 158 def reversal_transaction_id params[:brq_relatedtransaction_reversal] end
to_h()
click to toggle source
# File lib/buckaruby/response.rb, line 174 def to_h hash = { account_bic: account_bic, account_iban: account_iban, account_name: account_name, collect_date: collect_date, invoicenumber: invoicenumber, mandate_reference: mandate_reference, payment_id: payment_id, payment_method: payment_method, refund_transaction_id: refund_transaction_id, reversal_transaction_id: reversal_transaction_id, timestamp: timestamp, transaction_id: transaction_id, transaction_type: transaction_type, transaction_status: transaction_status }.reject { |_key, value| value.nil? } hash end
transaction_id()
click to toggle source
# File lib/buckaruby/response.rb, line 162 def transaction_id params[:brq_transactions] end
transaction_status()
click to toggle source
# File lib/buckaruby/response.rb, line 170 def transaction_status status end
transaction_type()
click to toggle source
# File lib/buckaruby/response.rb, line 166 def transaction_type TransactionType.parse(params[:brq_transaction_type], params[:brq_recurring]) end
Private Instance Methods
parse_date(date)
click to toggle source
# File lib/buckaruby/response.rb, line 197 def parse_date(date) date ? Date.strptime(date, '%Y-%m-%d') : nil end
parse_payment_method(method)
click to toggle source
# File lib/buckaruby/response.rb, line 201 def parse_payment_method(method) method ? method.downcase : nil end