Class: Ipizza::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/ipizza/response.rb

Direct Known Subclasses

AuthenticationResponse, PaymentResponse

Constant Summary collapse

PARAM_ORDER =
{
  '1111' => %w(VK_SERVICE VK_VERSION VK_SND_ID VK_REC_ID VK_STAMP VK_T_NO VK_AMOUNT VK_CURR VK_REC_ACC VK_REC_NAME VK_SND_ACC VK_SND_NAME VK_REF VK_MSG VK_T_DATETIME),
  '3012' => %w(VK_SERVICE VK_VERSION VK_USER VK_DATETIME VK_SND_ID VK_REC_ID VK_USER_NAME VK_USER_ID VK_COUNTRY VK_OTHER VK_TOKEN VK_RID),
  '3013' => %w(VK_SERVICE VK_VERSION VK_DATETIME VK_SND_ID VK_REC_ID VK_NONCE VK_USER_NAME VK_USER_ID VK_COUNTRY VK_OTHER VK_TOKEN VK_RID),
  '1911' => %w(VK_SERVICE VK_VERSION VK_SND_ID VK_REC_ID VK_STAMP VK_REF VK_MSG)
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Response

Returns a new instance of Response.



13
14
15
# File 'lib/ipizza/response.rb', line 13

def initialize(params)
  @params = params
end

Instance Attribute Details

#verify_paramsObject

Returns the value of attribute verify_params.



3
4
5
# File 'lib/ipizza/response.rb', line 3

def verify_params
  @verify_params
end

#verify_params_orderObject

Returns the value of attribute verify_params_order.



4
5
6
# File 'lib/ipizza/response.rb', line 4

def verify_params_order
  @verify_params_order
end

Instance Method Details

#verify(certificate_path) ⇒ Object



17
18
19
20
21
# File 'lib/ipizza/response.rb', line 17

def verify(certificate_path)
  mac_string = Ipizza::Util.mac_data_string(@params, PARAM_ORDER[@params['VK_SERVICE']])

  @valid = Ipizza::Util.verify_signature(certificate_path, @params['VK_MAC'], mac_string)
end