datatrans 4.0.1 → 5.0.0
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/CHANGELOG.md +8 -0
- data/README.markdown +1 -0
- data/lib/datatrans/config.rb +4 -1
- data/lib/datatrans/version.rb +1 -1
- data/lib/datatrans/xml/transaction/request.rb +4 -2
- data/spec/config_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/xml/request_spec.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb01c19e9afe3aecaa82ff08e7e9024fefb8c60d3cab86fbd3400e4598879dcd
|
4
|
+
data.tar.gz: 13a9c7a7068610907a8123c11cf50f60014f79b5de6db2b51f763a5509159fb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8d2cc670be21be5336b8856eca9603ef8351be8ebc9e8e19efca2486a2304d7a8701fcabeea629285434dcd4b6c99cf8f53b8382870cbd0a7dbf38db7b6ded2
|
7
|
+
data.tar.gz: a13b4a7a1934bfa437209b9eb53b2c8bba45d3e0c7e24cb699e8544c7d2af67d6497a0a1c885e3d6af034030b3b0b077d5928a4e8e6577a2b606824c1752be22
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## 5.0.0 - 2022-09-21
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
|
12
|
+
* [BREAKING CHANGE] Authenticate requests with HTTP Basic Auth (@crackofdusk [#41](https://github.com/simplificator/datatrans/pull/41))
|
13
|
+
|
14
|
+
Datatrans requires [HTTP Basic Auth for XML API calls](https://api-reference.datatrans.ch/xml/#authentication-tls) since 2022-09-14 ([announcement](https://mailchi.mp/datatrans/basic-authsign2_1-email_en))
|
15
|
+
|
8
16
|
## 4.0.1 - 2022-03-18
|
9
17
|
### Fixed
|
10
18
|
* Check for successful transaction depends on `status` and not on `response_message` that can be diferent for different payment methods (@schmijos [#8](https://github.com/simplificator/datatrans/pull/8) and @TatianaPan [#39](https://github.com/simplificator/datatrans/pull/39))
|
data/README.markdown
CHANGED
@@ -11,6 +11,7 @@ Build your Datatrans Configuration like so:
|
|
11
11
|
datatrans = Datatrans::Config.new(
|
12
12
|
:merchant_id => '1234567',
|
13
13
|
:sign_key => 'ab739fd5b7c2a1...',
|
14
|
+
:password => 'server to server request password',
|
14
15
|
:environment => :production,
|
15
16
|
:proxy => {
|
16
17
|
:http_proxyaddr => "proxy.com",
|
data/lib/datatrans/config.rb
CHANGED
@@ -11,10 +11,11 @@ module Datatrans
|
|
11
11
|
}
|
12
12
|
DOMAIN = 'datatrans.com'
|
13
13
|
|
14
|
-
attr_reader :environment, :merchant_id, :sign_key, :proxy
|
14
|
+
attr_reader :environment, :merchant_id, :sign_key, :password, :proxy
|
15
15
|
|
16
16
|
# Configure with following options
|
17
17
|
# * :merchant_id (required)
|
18
|
+
# * :password (required)
|
18
19
|
# * :sign_key (defaults to false)
|
19
20
|
# * :environment (defaults to :development, available environments are defined in ENVIRONMENTS)
|
20
21
|
# * :proxy (a hash containing :http_proxyaddr, :http_proxyport, :http_proxyuser, :http_proxypass)
|
@@ -22,6 +23,8 @@ module Datatrans
|
|
22
23
|
@merchant_id = options[:merchant_id]
|
23
24
|
raise ArgumentError.new(":merchant_id is required") unless self.merchant_id
|
24
25
|
self.environment = options[:environment] || DEFAULT_ENVIRONMENT
|
26
|
+
@password = options[:password]
|
27
|
+
raise ArgumentError.new(":password is required") unless self.password
|
25
28
|
@sign_key = options[:sign_key] || DEFAULT_SIGN_KEY
|
26
29
|
@proxy = options[:proxy] || {}
|
27
30
|
end
|
data/lib/datatrans/version.rb
CHANGED
@@ -7,7 +7,9 @@ class Datatrans::XML::Transaction
|
|
7
7
|
attr_accessor :params, :datatrans
|
8
8
|
|
9
9
|
def post(url, options = {})
|
10
|
-
options = options
|
10
|
+
options = options
|
11
|
+
.merge(self.datatrans.proxy)
|
12
|
+
.merge(:basic_auth => { :username => self.datatrans.merchant_id, :password => self.datatrans.password })
|
11
13
|
HTTParty.post(url, **options)
|
12
14
|
end
|
13
15
|
|
@@ -39,4 +41,4 @@ class Datatrans::XML::Transaction
|
|
39
41
|
xml.target!
|
40
42
|
end
|
41
43
|
end
|
42
|
-
end
|
44
|
+
end
|
data/spec/config_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Datatrans::Config do
|
4
4
|
describe "Instance Methods" do
|
5
5
|
before do
|
6
|
-
@datatrans = Datatrans::Config.new(:merchant_id => "xxx")
|
6
|
+
@datatrans = Datatrans::Config.new(:merchant_id => "xxx", :password => "yyy")
|
7
7
|
end
|
8
8
|
|
9
9
|
describe "web_transaction" do
|
data/spec/spec_helper.rb
CHANGED
@@ -15,6 +15,7 @@ RSpec.configure do |config|
|
|
15
15
|
@datatrans = Datatrans::Config.new(
|
16
16
|
:merchant_id => '1100000000',
|
17
17
|
:sign_key => 'd777c17ba2010282c2d2350a68b441ca07a799d294bfaa630b7c8442207c0b69703cc55775b0ca5a4e455b818a9bb10a43669c0c20ce31f4a43f10e0cabb9525',
|
18
|
+
:password => 'basic_auth_password',
|
18
19
|
:environment => :development
|
19
20
|
)
|
20
21
|
end
|
data/spec/xml/request_spec.rb
CHANGED
@@ -7,6 +7,7 @@ describe Datatrans::XML::Transaction::Request do
|
|
7
7
|
@datatrans = Datatrans::Config.new(
|
8
8
|
:merchant_id => '1100000000',
|
9
9
|
:sign_key => 'd777c17ba2010282c2d2350a68b441ca07a799d294bfaa630b7c8442207c0b69703cc55775b0ca5a4e455b818a9bb10a43669c0c20ce31f4a43f10e0cabb9525',
|
10
|
+
:password => 'basic_auth_password',
|
10
11
|
:key => "value",
|
11
12
|
:proxy => {
|
12
13
|
:http_proxyaddr => "proxy.com",
|
@@ -21,6 +22,7 @@ describe Datatrans::XML::Transaction::Request do
|
|
21
22
|
it "forward those options to HTTParty" do
|
22
23
|
request = Datatrans::XML::Transaction::Request.new(@datatrans, {})
|
23
24
|
expect(HTTParty).to receive(:post).with('lirum',
|
25
|
+
:basic_auth => {:password => 'basic_auth_password', :username => '1100000000'},
|
24
26
|
:params => {:foo => :bar},
|
25
27
|
:http_proxpass => 'xxx',
|
26
28
|
:http_proxyuser => 'hans',
|
@@ -33,7 +35,7 @@ describe Datatrans::XML::Transaction::Request do
|
|
33
35
|
describe "not configured" do
|
34
36
|
it "should not add any proxy settings" do
|
35
37
|
request = Datatrans::XML::Transaction::Request.new(@datatrans, {})
|
36
|
-
expect(HTTParty).to receive(:post).with('lirum', :params => {:foo => :bar})
|
38
|
+
expect(HTTParty).to receive(:post).with('lirum', :basic_auth => {:password => 'basic_auth_password', :username => '1100000000'}, :params => {:foo => :bar})
|
37
39
|
request.post('lirum', :params => {:foo => :bar})
|
38
40
|
end
|
39
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datatrans
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Miesel
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2022-
|
14
|
+
date: 2022-09-21 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: httparty
|