allpay_client 1.0.4 → 1.0.5
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 +4 -4
- data/lib/allpay/client.rb +5 -0
- data/lib/allpay/version.rb +1 -1
- data/spec/allpay_spec.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f2ea281442ca99d54d3bc51dc63afd1fce0989b
|
4
|
+
data.tar.gz: 31660c2bdb5fcc1aa177ac87e1e9883dad3aa751
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c31fc37d54e1759313214f633b7583af1ed4626bef102ab619b0ff545b0e5c61f9bbdb70f006e742633759f289715dbb40db3d55690509ba59627bf5e2751219
|
7
|
+
data.tar.gz: 60129cf16cdb2f8a670b28daa42e03d052dc0e5c0c90cc2f1ada4b01c2bc5f582c32acbe90d0fa636827cce553329dbf8b47b4728c14c68bbf93b6a7248bb606
|
data/lib/allpay/client.rb
CHANGED
@@ -31,6 +31,11 @@ module Allpay
|
|
31
31
|
Digest::MD5.hexdigest(url_encoded).upcase!
|
32
32
|
end
|
33
33
|
|
34
|
+
def verify_mac params = {}
|
35
|
+
check_mac_value = params.delete(:CheckMacValue)
|
36
|
+
make_mac(params) == check_mac_value
|
37
|
+
end
|
38
|
+
|
34
39
|
def request path, params = {}
|
35
40
|
params[:MerchantID] = @merchant_id
|
36
41
|
params[:CheckMacValue] = make_mac(params)
|
data/lib/allpay/version.rb
CHANGED
data/spec/allpay_spec.rb
CHANGED
@@ -54,4 +54,20 @@ describe Allpay::Client do
|
|
54
54
|
})
|
55
55
|
expect(mac).to eq '40D9A6C00A4A78A300ED458237071BDA'
|
56
56
|
end
|
57
|
+
|
58
|
+
it '#verify_mac' do
|
59
|
+
result = @client.verify_mac RtnCode: '1',
|
60
|
+
PaymentType: 'Credit_CreditCard',
|
61
|
+
TradeAmt: '700',
|
62
|
+
PaymentTypeChargeFee: '14',
|
63
|
+
PaymentDate: '2015/02/07 14:21:00',
|
64
|
+
SimulatePaid: '0',
|
65
|
+
CheckMacValue: '3AF270CCCFA58CA0349F4FD462E21643',
|
66
|
+
TradeDate: '2015/02/07 14:20:47',
|
67
|
+
MerchantID: '2000132',
|
68
|
+
TradeNo: '1502071420478656',
|
69
|
+
RtnMsg: '交易成功',
|
70
|
+
MerchantTradeNo: '355313'
|
71
|
+
expect(result).to eq true
|
72
|
+
end
|
57
73
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allpay_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jian Weihang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|