unionpay_app 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7afd21bfe81de80f0153d31d23e192cd803a5617
4
- data.tar.gz: 23a2262bf8d3bca7699c8fde77e2734d1d92e288
3
+ metadata.gz: a5a55cbcaae7b52d07dc33c0d124c2210c13516d
4
+ data.tar.gz: 168a8a8128e34a304671aae79bebd0b9c678fde5
5
5
  SHA512:
6
- metadata.gz: 7e3d9713349471d32f03cc0bdaeb99272d5087b6e6dce2e0b962ba45a5744d0911c6dc86352adad500d0b22e7822eb06bbf5c9e2e3b5359006850bcdff40e471
7
- data.tar.gz: 9a7d7ab2af53d3ebc0c04946500c4269eed618b3fd39d4be2c4831810eb31e800c4445d6dfa8f5a0f0198ede1055e8bc28094df6b585719ff670fda9edd493ce
6
+ metadata.gz: df0d6e827780b8bb96b633d8602b0d76f9c44f47446a3b5daf7737147679bbc24c71295606e999a462af235173b406a20ccd8da1ec0c2c200b0b0b94a7b6ccc5
7
+ data.tar.gz: ac49e9a1385de89b9d36be14526ad2f4e9a0e13570f44d287d3867cc4871ee2d76dedd80040437f0af2ff48cdf58c95c07cec938f882cd41354ead0b5c3160b9
data/README.md CHANGED
@@ -1,12 +1,49 @@
1
+ <<<<<<< HEAD
1
2
  该gem是一个银联手机控件支付接口
3
+
4
+ Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ gem 'unionpay_app', '~> 0.6.0'
9
+ or development version
10
+
11
+ $ bundle
12
+ Usage
13
+
14
+ Config
15
+
16
+ UnionpayApp.front_url = Settings.union.frontUrl
17
+ UnionpayApp.back_url = Settings.union.backUrl
18
+ UnionpayApp.mer_id = Settings.union.merId
19
+ UnionpayApp.uri = Settings.union.uri
20
+ UnionpayApp.private_key = Settings.union.private_key
21
+ UnionpayApp.cer = Settings.union.cer
22
+ UnionpayApp.cert_id = Settings.union.certId
23
+ Generate payment url for web
24
+
2
25
  1. #银联签名 返回hash {time: "交易时间", sign: "post给银联的hash"}
3
- UnionpayApp::Service.sign txtAmt, orderId
4
- params = UnionpayApp::Service.sign("100", "20150415122801272")
26
+ UnionpayApp::Service.sign txtAmt, orderId
27
+ params = UnionpayApp::Service.sign("100", "20150415122801272")
5
28
  2. #发送给银联post请求 换取tn值
6
- UnionpayApp::Service.post UnionpayApp::Service.sign(txtAmt, orderId)[:sign]
29
+ UnionpayApp::Service.post UnionpayApp::Service.sign(txtAmt, orderId)
7
30
  UnionpayApp::Service.post(params)
8
31
  3. #银联验签:当请求银联获取tn后,或者请求银联查询交易后,或者当交易完成后,银联通过backUrl、frontUrl返回你结果时要进行验签
9
- UnionpayApp::Service.verify params
32
+ UnionpayApp::Service.verify params
10
33
  4. #查询交易是否成功 传入参数order_id
11
- UnionpayApp::Service.query order_id, UnionpayApp::Service.sign(txtAmt, orderId)[:time]
12
- UnionpayApp::Service.query "20150415122801272", params[:time]
34
+ UnionpayApp::Service.query order_id, UnionpayApp::Service.sign(txtAmt, orderId)[:time]
35
+ UnionpayApp::Service.query "20150415122801272", params[:time]
36
+ =======
37
+ 该gem是一个银联手机控件支付接口
38
+ 1. #银联签名 返回hash {time: "交易时间", sign: "post给银联的hash"}
39
+ UnionpayApp::Service.sign txtAmt, orderId
40
+ params = UnionpayApp::Service.sign("100", "20150415122801272")
41
+ 2. #发送给银联post请求 换取tn值
42
+ UnionpayApp::Service.post UnionpayApp::Service.sign(txtAmt, orderId)[:sign]
43
+ UnionpayApp::Service.post(params)
44
+ 3. #银联验签:当请求银联获取tn后,或者请求银联查询交易后,或者当交易完成后,银联通过backUrl、frontUrl返回你结果时要进行验签
45
+ UnionpayApp::Service.verify params
46
+ 4. #查询交易是否成功 传入参数order_id
47
+ UnionpayApp::Service.query order_id, UnionpayApp::Service.sign(txtAmt, orderId)[:time]
48
+ UnionpayApp::Service.query "20150415122801272", params[:time]
49
+ >>>>>>> 760bcdda0389701cee33cbedba2d424b7ce36d7d
@@ -80,7 +80,7 @@ module UnionpayApp
80
80
  }
81
81
  data = Digest::SHA1.hexdigest(union_params.sort.map{|key, value| "#{key}=#{value}" }.join('&'))
82
82
  sign = Base64.encode64(OpenSSL::PKey::RSA.new(UnionpayApp.private_key).sign('sha1', data.force_encoding("utf-8"))).gsub("\n", "")
83
- request = Typhoeus::Request.new(UnionpayApp.uri, method: :post, params: union_params.merge(signature: sign), ssl_verifypeer: false, headers: {'Content-Type' =>'application/x-www-form-urlencoded'} )
83
+ request = Typhoeus::Request.new(UnionpayApp.query_uri, method: :post, params: union_params.merge(signature: sign), ssl_verifypeer: false, headers: {'Content-Type' =>'application/x-www-form-urlencoded'} )
84
84
  request.run
85
85
  if request.response.success?
86
86
  code = Hash[*request.response.body.split("&").map{|a| a.gsub("==", "@@").split("=")}.flatten]['origRespCode']
@@ -1,3 +1,3 @@
1
1
  module UnionpayApp
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
data/lib/unionpay_app.rb CHANGED
@@ -9,5 +9,6 @@ module UnionpayApp
9
9
  attr_accessor :private_key
10
10
  attr_accessor :cer
11
11
  attr_accessor :cert_id
12
+ attr_accessor :query_uri
12
13
  end
13
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unionpay_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yohansun