allpay_client 2.0.0 → 2.0.1

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: 289f14a5eea78b627c25e2ba352b8db3fefc0085
4
- data.tar.gz: 33a5f66099a93de19b3a2d0fded4d3642bf195d5
3
+ metadata.gz: 3a446ba56f2f942e6440dc53a76f6387788a55b8
4
+ data.tar.gz: 9af5ae0d137d7530bf91caa58cf8c47ba187c314
5
5
  SHA512:
6
- metadata.gz: 53a307012b9805ee5bd2c2f284d7eeaa6455b71d0b877d5ce00d1dc2bdf8e75910771e3dcc3a7c5d616c5fd3f7acab547d340c5a9061a02296b4f46f449fa952
7
- data.tar.gz: c1e186805948c1339029b4bab674f2aa506687d7be994a41d07f69157de9f8c3a880eb71cf878dc05a77db55f14cc88af15c155a0315853e33007f3a4c530613
6
+ metadata.gz: ffe404699d2306918ba7636918a3e96b807867c6d4150fe78503dbbdf72dc5170988916ff406425dc424a310c5674787e50cc4ede15e641872da37f5768d6b4c
7
+ data.tar.gz: ff7969058c8c713835c41b597a240f64adeb3e5484986b1627ab7e184f0e3de66ee2e1888dc30c470e26f1edab2f09ec673792d09b2d0f06fb36d30cba8ca9b9
data/lib/allpay/client.rb CHANGED
@@ -38,7 +38,7 @@ module Allpay
38
38
  end
39
39
 
40
40
  def make_mac params = {}
41
- raw = params.sort.map!{|k,v| "#{k}=#{v}"}.join('&')
41
+ raw = params.sort_by{|k,v|k.downcase}.map!{|k,v| "#{k}=#{v}"}.join('&')
42
42
  padded = "HashKey=#{@options[:hash_key]}&#{raw}&HashIV=#{@options[:hash_iv]}"
43
43
  url_encoded = CGI.escape(padded).downcase!
44
44
  Digest::MD5.hexdigest(url_encoded).upcase!
@@ -1,3 +1,3 @@
1
1
  module Allpay
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
data/spec/allpay_spec.rb CHANGED
@@ -40,7 +40,7 @@ describe Allpay::Client do
40
40
  card6no TotalSuccessTimes TotalSuccessAmount ExecLog]
41
41
  end
42
42
 
43
- it '#make_mac' do
43
+ it '#make_mac' do
44
44
  client = Allpay::Client.new(merchant_id: '12345678', hash_key: 'xdfaefasdfasdfa32d', hash_iv: 'sdfxfafaeafwexfe', mode: :test)
45
45
  mac = client.make_mac({
46
46
  ItemName: 'sdfasdfa',
@@ -70,4 +70,50 @@ describe Allpay::Client do
70
70
  MerchantTradeNo: '355313'
71
71
  expect(result).to eq true
72
72
  end
73
+
74
+ it '#verify_mac with more parameters' do
75
+ result = @client.verify_mac AlipayID: nil,
76
+ AlipayTradeNo: nil,
77
+ amount: '1290',
78
+ ATMAccBank: nil,
79
+ ATMAccNo: nil,
80
+ auth_code: '777777',
81
+ card4no: '2222',
82
+ card6no: '431195',
83
+ eci: '0',
84
+ ExecTimes: nil,
85
+ Frequency: nil,
86
+ gwsr: '12303658',
87
+ MerchantID: '2000132',
88
+ MerchantTradeNo: 'R9710358221432568191',
89
+ PayFrom: nil,
90
+ PaymentDate: '2015/05/25 23:37:42',
91
+ PaymentNo: nil,
92
+ PaymentType: 'Credit_CreditCard',
93
+ PaymentTypeChargeFee: '26',
94
+ PeriodAmount: nil,
95
+ PeriodType: nil,
96
+ process_date: '2015/05/25 23:37:42',
97
+ red_dan: '0',
98
+ red_de_amt: '0',
99
+ red_ok_amt: '0',
100
+ red_yet: '0',
101
+ RtnCode: '1',
102
+ RtnMsg: '交易成功',
103
+ SimulatePaid: '0',
104
+ staed: '0',
105
+ stage: '0',
106
+ stast: '0',
107
+ TenpayTradeNo: nil,
108
+ TotalSuccessAmount: nil,
109
+ TotalSuccessTimes: nil,
110
+ TradeAmt: '1290',
111
+ TradeDate: '2015/05/25 23:37:13',
112
+ TradeNo: '1505252337131701',
113
+ WebATMAccBank: nil,
114
+ WebATMAccNo: nil,
115
+ WebATMBankName: nil,
116
+ CheckMacValue: 'B8C4C0524C6D0F8E6F855A072FE4A340'
117
+ expect(result).to eq true
118
+ end
73
119
  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: 2.0.0
4
+ version: 2.0.1
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-03-11 00:00:00.000000000 Z
11
+ date: 2015-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  version: '0'
112
112
  requirements: []
113
113
  rubyforge_project:
114
- rubygems_version: 2.4.5
114
+ rubygems_version: 2.4.6
115
115
  signing_key:
116
116
  specification_version: 4
117
117
  summary: "歐付寶(Allpay)API 包裝"