struggle 1.8.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 286dc699ce29f3c5d20c0b29924cb1456664468a
4
- data.tar.gz: 2f828400f7234ec0f8c87f5b877bdb71f28239c8
3
+ metadata.gz: 79a1b2ccf14b56ed01eb5455fbf37702e1bf7a1c
4
+ data.tar.gz: 791ba6701674ec37b69fa4c0b05f7aabff13c48e
5
5
  SHA512:
6
- metadata.gz: a2115f3e858f39ce81572743fa36f2cce32fb8a4cae03253dff8780209c0e8a2fff5498d6630035a102fb6c9af36c87b597ff5e6dd8b2880ce5934b38540cc8b
7
- data.tar.gz: 97a8e221c0020a5d4062e9bf943b051a0602249577c02cdb8a7cc2026f50107965296f64ba41803df936be77fbed6a772139d72098c84de02fdd6829deb966e2
6
+ metadata.gz: e20601dd8c3a01781eab2e956ffd1dd46ace91681b99192a3ef746ba5f91c31265f65920158ec6ffabe8d1e1a27ad62bc5b3ecd73c10509081f6524ab9a84dae
7
+ data.tar.gz: b926c368a0a97091559e5eed6617a5516f33d8f8edbfc91a2c13a1b2dd14a3080fb7ad476baf4fd3ec40c74529b12a874a82877a3b8e0ef4de085ec57400b395
@@ -0,0 +1,18 @@
1
+ class Aes
2
+ require 'openssl'
3
+ def self.encrypt(data, key ,iv)
4
+ cipher = OpenSSL::Cipher::AES.new(256, :CBC)
5
+ cipher.encrypt
6
+ cipher.key = key
7
+ cipher.iv = iv
8
+ cipher.update(data) + cipher.final
9
+ end
10
+
11
+ def self.decipher(data, key ,iv)
12
+ decipher = OpenSSL::Cipher::AES.new(256, :CBC)
13
+ decipher.decrypt
14
+ decipher.key = key
15
+ decipher.iv = iv
16
+ decipher.update(data) + decipher.final
17
+ end
18
+ end
@@ -5,7 +5,7 @@ module Struggle
5
5
  URL_UTF8 = "https://pay3.chinabank.com.cn/PayGate?encoding=UTF-8"
6
6
  URL = "https://pay3.chinabank.com.cn"
7
7
 
8
- def self.pay(v_mid, key, v_url, remark2, v_oid, v_amount, v_moneytype = "CNY")
8
+ def self.pay(v_mid, key, v_url, remark2, v_oid, v_amount, remark1, v_moneytype = "CNY")
9
9
  v_md5info = Digest::MD5.hexdigest(v_amount.to_s + v_moneytype + v_oid + v_mid + v_url + key).upcase
10
10
  html = '<html><head></head><body>'
11
11
  html += '<form method="post" name="cb_form" action="' + URL_UTF8 + '">'
@@ -17,6 +17,7 @@ module Struggle
17
17
  'v_url' => v_url,
18
18
  'key' => key,
19
19
  'v_md5info' => v_md5info,
20
+ 'remark1' => remark1,
20
21
  'remark2' => "[url:=#{remark2}]"
21
22
  }
22
23
  parameter.each do |key, val|
@@ -31,11 +32,12 @@ module Struggle
31
32
  v_pstatus = params["v_pstatus"]
32
33
  v_md5str = params["v_md5str"]
33
34
  v_amount = params["v_amount"]
35
+ remark1 = params["remark1"]
34
36
  v_moneytype = params["v_moneytype"]
35
37
  if v_pstatus=="20" && v_md5str==Digest::MD5.hexdigest(v_oid+v_pstatus+v_amount+v_moneytype+key).upcase
36
- return {state: true, code: params["v_oid"], amount: v_amount}
38
+ return {state: true, code: v_oid, amount: v_amount, remark1: remark1}
37
39
  else
38
- return {state: false, code: params["v_oid"], amount: v_amount}
40
+ return {state: false, code: v_oid, amount: v_amount, remark1: remark1}
39
41
  end
40
42
  end
41
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: struggle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - lean
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-21 00:00:00.000000000 Z
11
+ date: 2015-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iconv
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: vcode,tfile,pager,func,logistic,pay_gateway,tmagick,class_extend;
41
+ description: vcode,tfile,pager,func,logistic,pay_gateway,tmagick,class_extend,aes;
42
42
  email: 54850915@qq.com
43
43
  executables: []
44
44
  extensions: []
@@ -47,6 +47,7 @@ extra_rdoc_files:
47
47
  files:
48
48
  - README.md
49
49
  - lib/struggle.rb
50
+ - lib/struggle/aes.rb
50
51
  - lib/struggle/concerns/int_extend.rb
51
52
  - lib/struggle/concerns/string_extend.rb
52
53
  - lib/struggle/font/font.ttf