class Docdata::Order::ExtendedStatusResponse
Response
to a extended status operation.
Public Instance Methods
approximate_totals()
click to toggle source
# File lib/docdata/order/response.rb, line 227 def approximate_totals report[:approximate_totals] end
cancelled?()
click to toggle source
# File lib/docdata/order/response.rb, line 284 def cancelled? authorization_status == "CANCELED" end
charged_back?()
click to toggle source
# File lib/docdata/order/response.rb, line 271 def charged_back? total_registered == total_charged_back end
consumer_bic()
click to toggle source
# File lib/docdata/order/response.rb, line 299 def consumer_bic case payment_method when PaymentMethod::IDEAL payment_info = payment[:extended][:i_deal_payment_info] payment_info[:shopper_bank_account][:bic] if payment_info && payment_info[:shopper_bank_account] when PaymentMethod::SEPA_DIRECT_DEBIT payment_info = payment[:extended][:sepa_direct_debit_payment_info] payment_info[:bic] if payment_info end end
consumer_iban()
click to toggle source
# File lib/docdata/order/response.rb, line 288 def consumer_iban case payment_method when PaymentMethod::IDEAL payment_info = payment[:extended][:i_deal_payment_info] payment_info[:shopper_bank_account][:iban] if payment_info && payment_info[:shopper_bank_account] when PaymentMethod::SEPA_DIRECT_DEBIT payment_info = payment[:extended][:sepa_direct_debit_payment_info] payment_info[:iban] if payment_info end end
consumer_name()
click to toggle source
# File lib/docdata/order/response.rb, line 310 def consumer_name if payment_method == PaymentMethod::IDEAL payment_info = payment[:extended][:i_deal_payment_info] payment_info[:holder_name] if payment_info end end
data()
click to toggle source
# File lib/docdata/order/response.rb, line 161 def data body[:extended_status_response] end
error?()
click to toggle source
# File lib/docdata/order/response.rb, line 169 def error? data.key?(:status_errors) end
errors()
click to toggle source
# File lib/docdata/order/response.rb, line 173 def errors data[:status_errors] end
mandate_number()
click to toggle source
# File lib/docdata/order/response.rb, line 317 def mandate_number if payment_method == PaymentMethod::SEPA_DIRECT_DEBIT payment_info = payment[:extended][:sepa_direct_debit_payment_info] payment_info[:mandate_number] if payment_info end end
paid?()
click to toggle source
# File lib/docdata/order/response.rb, line 263 def paid? (total_registered == total_captured) || (total_registered == total_acquirer_approved) end
payment()
click to toggle source
# File lib/docdata/order/response.rb, line 181 def payment payment = report[:payment] # When multiple payments are found, return the payment with the newest ID. if payment.is_a?(Array) payment.max_by { |key, _value| key[:id] } else payment end end
payment_id()
click to toggle source
# File lib/docdata/order/response.rb, line 192 def payment_id payment[:id] if payment end
payment_method()
click to toggle source
# File lib/docdata/order/response.rb, line 196 def payment_method payment[:payment_method] if payment end
refunded?()
click to toggle source
# File lib/docdata/order/response.rb, line 267 def refunded? total_registered == total_refunded end
report()
click to toggle source
# File lib/docdata/order/response.rb, line 177 def report data[:status_success][:report] end
reversed?()
click to toggle source
# File lib/docdata/order/response.rb, line 275 def reversed? total_registered == total_reversed end
started?()
click to toggle source
# File lib/docdata/order/response.rb, line 279 def started? (authorization_status == "NEW" || authorization_status == "STARTED" || (total_captured.zero? && total_acquirer_approved.zero?)) && authorization_status != "CANCELED" end
success?()
click to toggle source
# File lib/docdata/order/response.rb, line 165 def success? data.key?(:status_success) end
total_acquirer_approved()
click to toggle source
# File lib/docdata/order/response.rb, line 243 def total_acquirer_approved to_decimal(approximate_totals[:total_acquirer_approved]) end
total_acquirer_pending()
click to toggle source
# File lib/docdata/order/response.rb, line 239 def total_acquirer_pending to_decimal(approximate_totals[:total_acquirer_pending]) end
total_captured()
click to toggle source
# File lib/docdata/order/response.rb, line 247 def total_captured to_decimal(approximate_totals[:total_captured]) end
total_charged_back()
click to toggle source
# File lib/docdata/order/response.rb, line 259 def total_charged_back to_decimal(approximate_totals[:total_chargedback]) end
total_refunded()
click to toggle source
# File lib/docdata/order/response.rb, line 251 def total_refunded to_decimal(approximate_totals[:total_refunded]) end
total_registered()
click to toggle source
# File lib/docdata/order/response.rb, line 231 def total_registered to_decimal(approximate_totals[:total_registered]) end
total_reversed()
click to toggle source
# File lib/docdata/order/response.rb, line 255 def total_reversed to_decimal(approximate_totals[:total_reversed]) end
total_shopper_pending()
click to toggle source
# File lib/docdata/order/response.rb, line 235 def total_shopper_pending to_decimal(approximate_totals[:total_shopper_pending]) end
Private Instance Methods
to_decimal(cents)
click to toggle source
# File lib/docdata/order/response.rb, line 326 def to_decimal(cents) Amount.from_cents(cents).to_d end