paytrail-client 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +15 -0
- data/lib/paytrail_client.rb +1 -1
- data/lib/paytrail_client/errors.rb +4 -0
- data/lib/paytrail_client/payment.rb +11 -0
- data/lib/paytrail_client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d1e57c3c46687abab5311541327080c20a84b34
|
4
|
+
data.tar.gz: 0071f9635631174bd8c9e33496e08f393c28fe19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c56227e19fca6b14779048e973fa01943a1755b4537d50a5ab504f6a0ef6bdd491e975a5037efe71b21cf151d4061753c0ff8ad1a5d4f2714a7f886bc1651d6
|
7
|
+
data.tar.gz: 84239f0994f302bcd111199886543435eabecce80ecbecec36a4c4f15aaeaa87f589ca2299a1d8061ee4c5d1b791f6605f3587fbbf5e4a17e080d3bcf36be54c
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -38,6 +38,21 @@ token = PaytrailClient::Payment.create(order_number: '1234',
|
|
38
38
|
# Redirect to received url
|
39
39
|
redirect_to(token['url'])
|
40
40
|
|
41
|
+
|
42
|
+
# Verify payment
|
43
|
+
|
44
|
+
begin
|
45
|
+
PaytrailClient::Payment.verify_payment!(
|
46
|
+
params['ORDER_NUMBER'],
|
47
|
+
params['TIMESTAMP'],
|
48
|
+
params['PAID'],
|
49
|
+
params['METHOD'],
|
50
|
+
params['RETURN_AUTHCODE'])
|
51
|
+
puts 'Payment verified'
|
52
|
+
rescue PaytrailClient::InvalidPaymentError
|
53
|
+
puts 'Could not verify payment'
|
54
|
+
end
|
55
|
+
|
41
56
|
```
|
42
57
|
|
43
58
|
## Contributing
|
data/lib/paytrail_client.rb
CHANGED
@@ -2,6 +2,6 @@ module PaytrailClient
|
|
2
2
|
GEM_ROOT = File.expand_path('../', __FILE__)
|
3
3
|
end
|
4
4
|
|
5
|
-
%w(version paytrail_client helpers request payment).each do |file|
|
5
|
+
%w(version errors paytrail_client helpers request payment).each do |file|
|
6
6
|
require File.join(PaytrailClient::GEM_ROOT, 'paytrail_client', file)
|
7
7
|
end
|
@@ -4,4 +4,15 @@ module PaytrailClient::Payment
|
|
4
4
|
def self.create(payload)
|
5
5
|
post('https://payment.paytrail.com/api-payment/create', payload)
|
6
6
|
end
|
7
|
+
|
8
|
+
def self.verify_payment!(order_number, time_stamp, paid, method, auth_code)
|
9
|
+
unless Digest::MD5.hexdigest(
|
10
|
+
[order_number,
|
11
|
+
time_stamp,
|
12
|
+
paid,
|
13
|
+
method,
|
14
|
+
PaytrailClient.configuration.merchant_secret].join('|')).casecmp(auth_code).zero?
|
15
|
+
raise PaytrailClient::InvalidPaymentError
|
16
|
+
end
|
17
|
+
end
|
7
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paytrail-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joakim Antman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -152,6 +152,7 @@ files:
|
|
152
152
|
- Rakefile
|
153
153
|
- lib/paytrail-client.rb
|
154
154
|
- lib/paytrail_client.rb
|
155
|
+
- lib/paytrail_client/errors.rb
|
155
156
|
- lib/paytrail_client/helpers.rb
|
156
157
|
- lib/paytrail_client/payment.rb
|
157
158
|
- lib/paytrail_client/paytrail_client.rb
|