lib/alipay/wap/service.rb in alipay-0.10.0 vs lib/alipay/wap/service.rb in alipay-0.11.0

- old
+ new

@@ -28,11 +28,10 @@ xml = Net::HTTP.get(request_uri(params, options)) CGI.unescape(xml).scan(/\<request_token\>(.*)\<\/request_token\>/).flatten.first end AUTH_AND_EXECUTE_REQUIRED_PARAMS = %w( request_token ) - def self.auth_and_execute_url(params, options = {}) params = Utils.stringify_keys(params) Alipay::Service.check_required_params(params, AUTH_AND_EXECUTE_REQUIRED_PARAMS) req_data_xml = "<auth_and_execute_req><request_token>#{params.delete('request_token')}</request_token></auth_and_execute_req>" @@ -44,9 +43,25 @@ 'format' => 'xml', 'v' => '2.0' }.merge(params) request_uri(params, options).to_s + end + + def self.security_risk_detect(params, options) + params = Utils.stringify_keys(params) + + params = { + 'service' => 'alipay.security.risk.detect', + '_input_charset' => 'utf-8', + 'partner' => options[:pid] || Alipay.pid, + 'timestamp' => Time.now.strftime('%Y-%m-%d %H:%M:%S'), + 'scene_code' => 'PAYMENT' + }.merge(params) + + sign_params(params, options) + + Net::HTTP.post_form(URI(GATEWAY_URL), params) end def self.request_uri(params, options = {}) uri = URI(GATEWAY_URL) uri.query = URI.encode_www_form(sign_params(params, options))