Class: GpWebpay::Http::HttpResponse
- Defined in:
- lib/gp_webpay/http/http_response.rb
Constant Summary collapse
- GP_TO_ATTRS_MAPPER =
{ 'OPERATION' => :operation, 'ORDERNUMBER' => :order_number, 'MERORDERNUM' => :mer_order_num, 'MD' => :md, 'PRCODE' => :pr_code, 'SRCODE' => :sr_code, 'RESULTTEXT' => :result_text, 'USERPARAM1' => :user_param1, 'TOKEN' => :token, 'EXPIRY' => :expiry, 'ACSRES' => :acsres, 'ACCODE' => :accode, 'PANPATTERN' => :pan_pattern, 'DAYTOCAPTURE' => :day_to_capture, 'TOKENREGSTATUS' => :token_reg_status }.freeze
Instance Attribute Summary
Attributes inherited from Response
#config, #original_response, #params, #pr_code, #result_text, #sr_code, #status, #token
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Response
Constructor Details
This class inherits a constructor from GpWebpay::Response
Class Method Details
.from_hash(hash, merchant_number) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/gp_webpay/http/http_response.rb', line 23 def self.from_hash(hash, merchant_number) params = GP_TO_ATTRS_MAPPER.each_with_object({}) do |(k, v), result| value = hash[k.to_s] || hash[k.to_sym] result[v] = value if value end params[:add_info] = Hash.from_xml(hash['ADDINFO']) if hash['ADDINFO'] new(original_response: hash, result_text: params[:result_text], token: params[:token], status: nil, pr_code: params[:pr_code], sr_code: params[:sr_code], params: params, merchant_number: merchant_number) end |
Instance Method Details
#valid? ⇒ Boolean
35 36 37 |
# File 'lib/gp_webpay/http/http_response.rb', line 35 def valid? GpWebpay::Http::ValidateResult.call(original_response, config) end |