cic_payment 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cic_payment.gemspec +1 -1
- data/lib/cic_payment.rb +21 -7
- data/lib/version.rb +1 -1
- 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: f679ba6a46ee7a98387216fcfdea9fc47a8d10b0
|
4
|
+
data.tar.gz: 300f771598cdbcb7098d05e8e28098236e4693c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce64d963b555a0d8b3ce6c04e923b5df08d88c8ebb7896ca8594e3b81f05df9ae091d39e74b9f3474adec27e648453c2df916b09cda006f9db67bf314bd9054b
|
7
|
+
data.tar.gz: 1cbac1e6ca79fe105d486747ece59b086b2bed28ad18bd8381623b4daad0919f05cb6b2d021789f919d89feb29d09bc05300c38f2d76f586130f73d05df50e68
|
data/cic_payment.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "cic_payment"
|
6
|
-
s.version = "0.4.
|
6
|
+
s.version = "0.4.2"
|
7
7
|
s.date = "2014-03-18"
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Novelys Team", 'Guillaume Barillot', 'Regis Millet (aka Kulgar)']
|
data/lib/cic_payment.rb
CHANGED
@@ -64,13 +64,27 @@ class CicPayment < PaymentSettings
|
|
64
64
|
params.update(:success => false)
|
65
65
|
end
|
66
66
|
end
|
67
|
-
|
68
|
-
#
|
67
|
+
|
68
|
+
# === response_mac(params)
|
69
|
+
# This function is used to verify that the sent MAC by CIC is the one expected.
|
70
|
+
# It calculates the hmac from the correct chain of params.
|
71
|
+
#
|
72
|
+
# The HMAC returned by the bank uses this chain:
|
73
|
+
# <TPE>*<date>*<montant>*<reference>*<texte-libre>*3.0*<code-retour>*
|
74
|
+
# <cvx>*<vld>*<brand>*<status3ds>*<numauto>*<motifrefus>*<originecb>*
|
75
|
+
# <bincb>*<hpancb>*<ipclient>*<originetr>*<veres>*<pares>*
|
76
|
+
#
|
77
|
+
# Here is an example of the parameters sent back by the CIC payment module:
|
78
|
+
# Parameters: {"TPE"=>"012345", "date"=>"01/01/2011_a_00:00:00", "montant"=>"10.00EUR", "reference"=>"12_unique_caracters_string",
|
79
|
+
# "MAC"=>"CalculatedMAC by the bank",
|
80
|
+
# "texte-libre"=>"{\"custom_id\":1,\"user_id\":1,\"text\":\"Your text\"}",
|
81
|
+
# "code-retour"=>"payetest", "cvx"=>"oui", "vld"=>"1219", "brand"=>"na", "status3ds"=>"-1",
|
82
|
+
# "motifrefus"=>"", "originecb"=>"00x", "bincb"=>"000001", "hpancb"=>"F6FBF44A7EC30941DA2E411AA8A50C77F174B2BB",
|
83
|
+
# "ipclient"=>"01.01.01.01", "originetr"=>"FRA", "veres"=>"", "pares"=>"", "modepaiement"=>"CB"}
|
84
|
+
#
|
85
|
+
# You can also Use this function for your tests to simulate an exchange with the bank.
|
69
86
|
def response_mac params
|
70
|
-
|
71
|
-
# <TPE>*<date>*<montant>*<reference>*<texte-libre>*3.0*<code-retour>*
|
72
|
-
# <cvx>*<vld>*<brand>*<status3ds>*<numauto>*<motifrefus>*<originecb>*
|
73
|
-
# <bincb>*<hpancb>*<ipclient>*<originetr>*<veres>*<pares>*
|
87
|
+
|
74
88
|
chain = [
|
75
89
|
self.tpe, params['date'], params['montant'], params['reference'], params['texte-libre'], self.version, params['code-retour'],
|
76
90
|
params['cvx'], params['vld'], params['brand'], params['status3ds'], params["numauto"], params['motifrefus'], params['originecb'],
|
@@ -84,7 +98,7 @@ class CicPayment < PaymentSettings
|
|
84
98
|
params['MAC'] ? hmac = params['MAC'] : hmac = ""
|
85
99
|
|
86
100
|
# Check if the HMAC matches the HMAC of the data string
|
87
|
-
response_mac(params) == hmac
|
101
|
+
response_mac(params).downcase == hmac.downcase
|
88
102
|
end
|
89
103
|
|
90
104
|
# Return the HMAC for a data string
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cic_payment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Novelys Team
|
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
48
|
version: '0'
|
49
49
|
requirements: []
|
50
50
|
rubyforge_project:
|
51
|
-
rubygems_version: 2.
|
51
|
+
rubygems_version: 2.0.3
|
52
52
|
signing_key:
|
53
53
|
specification_version: 4
|
54
54
|
summary: CIC / Credit Mutuel credit card payment toolbox
|