lib/alipay/client.rb in alipay-0.15.2 vs lib/alipay/client.rb in alipay-0.16.0
- old
+ new
@@ -35,10 +35,12 @@
@app_private_key = options['app_private_key']
@alipay_public_key = options['alipay_public_key']
@format = options['format'] || 'json'
@charset = options['charset'] || 'UTF-8'
@sign_type = options['sign_type'] || 'RSA2'
+ @app_cert_sn = options['app_cert_sn']
+ @alipay_root_cert_sn = options['alipay_root_cert_sn']
end
# Generate a query string that use for APP SDK excute.
#
# Example:
@@ -181,9 +183,15 @@
'charset' => @charset,
'sign_type' => @sign_type,
'version' => '1.0',
'timestamp' => Time.now.localtime('+08:00').strftime("%Y-%m-%d %H:%M:%S")
}.merge(::Alipay::Utils.stringify_keys(params))
+ if !@app_cert_sn.nil? && !@alipay_root_cert_sn.nil?
+ params = params.merge({
+ 'app_cert_sn' => @app_cert_sn,
+ 'alipay_root_cert_sn' => @alipay_root_cert_sn
+ })
+ end
params['sign'] = sign(params)
params
end
def params_to_string(params)