class Docdata::Order::CreateResponse
Response
to a create operation.
Public Instance Methods
data()
click to toggle source
# File lib/docdata/order/response.rb, line 31 def data body[:create_response] end
error?()
click to toggle source
# File lib/docdata/order/response.rb, line 39 def error? data.key?(:create_errors) end
errors()
click to toggle source
# File lib/docdata/order/response.rb, line 43 def errors data[:create_errors] end
order_key()
click to toggle source
# File lib/docdata/order/response.rb, line 47 def order_key data[:create_success][:key] end
redirect_url()
click to toggle source
# File lib/docdata/order/response.rb, line 51 def redirect_url params = { command: "show_payment_cluster", merchant_name: merchant_name, client_language: client_language, payment_cluster_key: order_key } if payment_method params[:default_pm] = payment_method case payment_method when PaymentMethod::IDEAL params[:default_act] = true params[:ideal_issuer_id] = issuer_id if issuer_id when PaymentMethod::PAYPAL, PaymentMethod::SOFORT params[:default_act] = true end end if return_url params.merge!( return_url_success: build_return_url("success"), return_url_canceled: build_return_url("cancelled"), return_url_pending: build_return_url("pending"), return_url_error: build_return_url("error") ) end uri = URI.parse(redirect_base_url) uri.query = URI.encode_www_form(params) uri.to_s end
success?()
click to toggle source
# File lib/docdata/order/response.rb, line 35 def success? data.key?(:create_success) end
Private Instance Methods
build_return_url(status)
click to toggle source
# File lib/docdata/order/response.rb, line 120 def build_return_url(status) uri = URI.parse(return_url) query = URI.decode_www_form(uri.query || "") << ["status", status] uri.query = URI.encode_www_form(query) uri.to_s end
client_language()
click to toggle source
# File lib/docdata/order/response.rb, line 104 def client_language options.fetch(:shopper).fetch(:language) end
issuer_id()
click to toggle source
# File lib/docdata/order/response.rb, line 112 def issuer_id options[:issuer_id] end
merchant_name()
click to toggle source
# File lib/docdata/order/response.rb, line 95 def merchant_name # Use subject merchant when present, otherwise fallback to merchant. if options[:subject_merchant] options.fetch(:subject_merchant).fetch(:name) else options.fetch(:merchant).fetch(:name) end end
payment_method()
click to toggle source
# File lib/docdata/order/response.rb, line 108 def payment_method options[:payment_method].to_s end
redirect_base_url()
click to toggle source
# File lib/docdata/order/response.rb, line 87 def redirect_base_url if options[:test] Urls::MENU_TEST_URL else Urls::MENU_LIVE_URL end end
return_url()
click to toggle source
# File lib/docdata/order/response.rb, line 116 def return_url options[:return_url] end