datatrans 3.0.0 → 4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 00dfb98ec54350ac1a4d6d2a932a4ee08ed1ddd5
4
- data.tar.gz: 599f998c0f9bd6e489d9571e171893c3b463be24
2
+ SHA256:
3
+ metadata.gz: e0cd93431049ffc3deba79d3c594ae93aff9e6fd91dc158ad0a68ae1e766a83e
4
+ data.tar.gz: c67ba41b81de8adfbe9962cb85c80e881a57b69490972dae577f93e269935659
5
5
  SHA512:
6
- metadata.gz: 06eeebeafc026f0fdfc1296be4f2a2e8201aa7de21a12f950b4f938225bcee6b0ffe19f2e47a4a5432c30d68c478c9733bca30b20a55dda593d5e1135e898738
7
- data.tar.gz: 2a285a435167deae93bca53229ad7b01f4b536c739b50ca293c54f599312ad179fe90fbcc06789a4c6b0d94eb45650a585d0cea10d0e6bf7f36895da9fe93d81
6
+ metadata.gz: 2bf90e36d3ef096f0904cc03309931408d1e26c23761645de6e46ce1588c350850d4466127c7443408eddf2a3475b48a2fd4db69fa761779a2a15d0e5d37031c
7
+ data.tar.gz: eb8aa923a6599f0cbf10b4ed1fc2fc76e3068fbbd589768635f4d89e55063072c2c691f8a91504c04fb4eec761d798b92ad4522000094b932d775c5c195be6aa
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: CI
3
+ on: [push, pull_request]
4
+ jobs:
5
+ tests:
6
+ runs-on: ubuntu-latest
7
+ strategy:
8
+ fail-fast: false
9
+ matrix:
10
+ ruby: [ '2.6', '2.7', '3.0', '3.1' ]
11
+ rails: [ '5-2', '6-0', '6-1', '7-0' ]
12
+ exclude:
13
+ - ruby: 2.6 # Rails 7 requires 2.7 minimum
14
+ rails: 7-0
15
+ - ruby: 3.0 # Ruby 3 support for 5.2 hasn't been added
16
+ rails: 5-2
17
+ - ruby: 3.1 # Ruby 3.1 only works on the latest Rails 7 version
18
+ rails: 5-2
19
+ - ruby: 3.1
20
+ rails: 6-0
21
+ - ruby: 3.1
22
+ rails: 6-1
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+
27
+ - name: Set up Ruby
28
+ uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby }}
31
+ bundler-cache: false
32
+
33
+ - name: Bundle for Appraisal
34
+ run: bundle
35
+
36
+ - name: Install Appraisal dependencies
37
+ run: bundle exec appraisal rails-${{ matrix.rails }} bundle
38
+
39
+ - name: Run tests
40
+ run: bundle exec appraisal rails-${{ matrix.rails }} bundle exec rspec
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: Tag on Github and Release to RubyGems
3
+ on: [workflow_dispatch]
4
+
5
+ jobs:
6
+ release:
7
+ name: Release to RubyGems
8
+ runs-on: ubuntu-latest
9
+ if: github.ref == 'refs/heads/master'
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: 2.7
15
+ - name: Tag on Github
16
+ run: |
17
+ VERSION=$(ruby -e "puts Gem::Specification::load('datatrans.gemspec').version")
18
+ echo "v$VERSION"
19
+ git tag "v$VERSION"
20
+ git push origin "v$VERSION"
21
+ - name: Publish to RubyGems
22
+ run: |
23
+ mkdir -p $HOME/.gem
24
+ touch $HOME/.gem/credentials
25
+ chmod 0600 $HOME/.gem/credentials
26
+ printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials
27
+ gem build *.gemspec
28
+ gem push *.gem
29
+ env:
30
+ RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
1
  *.gem
2
2
  .bundle
3
3
  pkg/*
4
+ *.lock
5
+ coverage
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.6.9
data/Appraisals ADDED
@@ -0,0 +1,31 @@
1
+ appraise "rails-5-2" do
2
+ gem "activesupport", "~> 5.2"
3
+
4
+ group :development, :test do
5
+ gem "actionpack", "~> 5.2"
6
+ end
7
+ end
8
+
9
+ appraise "rails-6-0" do
10
+ gem "activesupport", "~> 6.0"
11
+
12
+ group :development, :test do
13
+ gem "actionpack", "~> 6.0"
14
+ end
15
+ end
16
+
17
+ appraise "rails-6-1" do
18
+ gem "activesupport", "~> 6.1"
19
+
20
+ group :development, :test do
21
+ gem "actionpack", "~> 6.1"
22
+ end
23
+ end
24
+
25
+ appraise "rails-7-0" do
26
+ gem "activesupport", "~> 7.0"
27
+
28
+ group :development, :test do
29
+ gem "actionpack", "~> 7.0"
30
+ end
31
+ end
data/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # Datatrans Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ This project adheres to [Semantic Versioning](http://semver.org/).
5
+
6
+ ## [Unreleased]
7
+
8
+ ## 4.0.0 - 2022-02-25
9
+ ### Changed
10
+ * [BREAKING CHANGE] Bump minimum required Ruby version to 2.6 and Rails to 5.2 (@andyundso [#34](https://github.com/simplificator/datatrans/pull/34))
11
+ * Change Datatrans hostnames (@rgisiger [#32](https://github.com/simplificator/datatrans/pull/32))
12
+
13
+ ## 3.0.2 - 2014-01-04
14
+ ### Added
15
+ * Specified MIT License.
16
+
17
+ ## 3.0.0 - 2013-09-25
18
+ ### Changed
19
+ * Refactored code to allow multiple configurations
20
+ * Proxy config now uses HTTParty naming convention.
21
+
22
+ ## 2.2.2 - 2011-10-11
23
+ ### Added
24
+
25
+ * ability to skip signing by setting `config.sign_key = false`
26
+
27
+ ## 1.0.0 - 2011-07-07
28
+
29
+ Initial release
30
+
31
+
data/Gemfile CHANGED
@@ -2,3 +2,4 @@ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in datatrans.gemspec
4
4
  gemspec
5
+ gem "simplecov", group: :test, require: nil
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 info@simplificator.com
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.markdown CHANGED
@@ -6,7 +6,7 @@ Ruby adapter for the Datatrans payment gateway (http://www.datatrans.ch).
6
6
  Configuration
7
7
  -------------
8
8
 
9
- Buidl your Datatrans Configuration like so:
9
+ Build your Datatrans Configuration like so:
10
10
 
11
11
  datatrans = Datatrans::Config.new(
12
12
  :merchant_id => '1234567',
@@ -149,20 +149,6 @@ To make an authorized transaction invalid use void.
149
149
  # transaction.error_code, transaction.error_message, transaction.error_detail
150
150
  end
151
151
 
152
-
153
- CHANGELOG
154
- =========
155
-
156
- 3.0.0
157
- -------
158
- * Refactored Code to allow multiple configurations
159
- * Proxy config now uses HTTParty naming convention.
160
-
161
- 2.2.2
162
- -------
163
- * added ability to skip signing by setting config.sign_key = false
164
-
165
-
166
152
  Todo
167
153
  ====
168
154
 
data/datatrans.gemspec CHANGED
@@ -18,13 +18,17 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
+ s.required_ruby_version = '>= 2.6'
22
+
21
23
  s.add_dependency 'httparty'
22
- s.add_dependency 'activesupport', '>= 3.0.0'
24
+ s.add_dependency 'activesupport', '>= 5.2'
23
25
  s.add_dependency 'i18n'
24
26
  s.add_dependency 'builder'
25
27
  s.add_dependency 'multi_xml', '>= 0.5.1'
26
28
 
29
+ s.add_development_dependency 'actionpack', '>= 5.2'
30
+ s.add_development_dependency 'appraisal'
27
31
  s.add_development_dependency 'rake'
28
32
  s.add_development_dependency 'rspec'
29
- s.add_development_dependency 'actionpack', '>= 3.0.0'
33
+ s.license = 'MIT'
30
34
  end
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "simplecov", group: :test, require: nil
6
+ gem "activesupport", "~> 5.2"
7
+
8
+ group :development, :test do
9
+ gem "actionpack", "~> 5.2"
10
+ end
11
+
12
+ gemspec path: "../"
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "simplecov", group: :test, require: nil
6
+ gem "activesupport", "~> 6.0"
7
+
8
+ group :development, :test do
9
+ gem "actionpack", "~> 6.0"
10
+ end
11
+
12
+ gemspec path: "../"
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "simplecov", group: :test, require: nil
6
+ gem "activesupport", "~> 6.1"
7
+
8
+ group :development, :test do
9
+ gem "actionpack", "~> 6.1"
10
+ end
11
+
12
+ gemspec path: "../"
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "simplecov", group: :test, require: nil
6
+ gem "activesupport", "~> 7.0"
7
+
8
+ group :development, :test do
9
+ gem "actionpack", "~> 7.0"
10
+ end
11
+
12
+ gemspec path: "../"
@@ -5,23 +5,11 @@ module Datatrans
5
5
 
6
6
  DEFAULT_SIGN_KEY = false
7
7
 
8
- BASE_URL_PRODUCTION = 'https://payment.datatrans.biz'.freeze
9
- BASE_URL_DEVELOPMENT = 'https://pilot.datatrans.biz'.freeze
10
-
11
- URLS = {
12
- :development => {
13
- :web_authorize_url => "#{BASE_URL_PRODUCTION}/upp/jsp/upStart.jsp".freeze,
14
- :xml_authorize_url => "#{BASE_URL_PRODUCTION}/upp/jsp/XML_authorize.jsp".freeze,
15
- :xml_settlement_url => "#{BASE_URL_PRODUCTION}/upp/jsp/XML_processor.jsp".freeze,
16
- :xml_status_url => "#{BASE_URL_PRODUCTION}/upp/jsp/XML_status.jsp".freeze
17
- },
18
- :production => {
19
- :web_authorize_url => "#{BASE_URL_DEVELOPMENT}/upp/jsp/upStart.jsp".freeze,
20
- :xml_authorize_url => "#{BASE_URL_DEVELOPMENT}/upp/jsp/XML_authorize.jsp".freeze,
21
- :xml_settlement_url => "#{BASE_URL_DEVELOPMENT}/upp/jsp/XML_processor.jsp".freeze,
22
- :xml_status_url => "#{BASE_URL_DEVELOPMENT}/upp/jsp/XML_status.jsp".freeze
23
- }.freeze
24
- }.freeze
8
+ SUBDOMAINS = {
9
+ payment_page: 'pay',
10
+ server_to_server_api: 'api'
11
+ }
12
+ DOMAIN = 'datatrans.com'
25
13
 
26
14
  attr_reader :environment, :merchant_id, :sign_key, :proxy
27
15
 
@@ -49,7 +37,24 @@ module Datatrans
49
37
 
50
38
  # Access a url, is automatically scoped to environment
51
39
  def url(what)
52
- URLS[self.environment][what]
40
+ case what
41
+ when :web_authorize_url
42
+ subdomain = SUBDOMAINS[:payment_page]
43
+ path = '/upp/jsp/upStart.jsp'
44
+ when :xml_authorize_url
45
+ subdomain = SUBDOMAINS[:server_to_server_api]
46
+ path = '/upp/jsp/XML_authorize.jsp'
47
+ when :xml_settlement_url
48
+ subdomain = SUBDOMAINS[:server_to_server_api]
49
+ path = '/upp/jsp/XML_processor.jsp'
50
+ when :xml_status_url
51
+ subdomain = SUBDOMAINS[:server_to_server_api]
52
+ path = '/upp/jsp/XML_status.jsp'
53
+ else
54
+ raise "Unknown wanted action '#{what}'."
55
+ end
56
+ subdomain += '.sandbox' unless self.environment == :production
57
+ "https://#{subdomain}.#{DOMAIN}#{path}"
53
58
  end
54
59
 
55
60
  def web_transaction(*args)
@@ -1,3 +1,3 @@
1
1
  module Datatrans
2
- VERSION = "3.0.0"
2
+ VERSION = "4.0.0"
3
3
  end
@@ -8,7 +8,7 @@ class Datatrans::XML::Transaction
8
8
 
9
9
  def post(url, options = {})
10
10
  options = options.merge(self.datatrans.proxy)
11
- HTTParty.post(url, options)
11
+ HTTParty.post(url, **options)
12
12
  end
13
13
 
14
14
  def initialize(datatrans, params)
data/spec/common_spec.rb CHANGED
@@ -14,7 +14,7 @@ describe Datatrans::Common do
14
14
  currency = 'CHF'
15
15
  reference_number = 'ABCEDF'
16
16
 
17
- @request.sign(@datatrans.merchant_id, amount, currency, reference_number).should == '4e7d4d5bbde548c586f3b7f109635ffc'
17
+ expect(@request.sign(@datatrans.merchant_id, amount, currency, reference_number)).to eq '4e7d4d5bbde548c586f3b7f109635ffc'
18
18
  end
19
19
  end
20
20
  end
data/spec/config_spec.rb CHANGED
@@ -8,13 +8,13 @@ describe Datatrans::Config do
8
8
 
9
9
  describe "web_transaction" do
10
10
  it "builds a new web transaction object" do
11
- @datatrans.web_transaction({}).class.should eq(Datatrans::Web::Transaction)
11
+ expect(@datatrans.web_transaction({}).class).to eq(Datatrans::Web::Transaction)
12
12
  end
13
13
  end
14
14
 
15
15
  describe "xml_transaction" do
16
16
  it "builds a new xml transaction object" do
17
- @datatrans.xml_transaction({}).class.should eq(Datatrans::XML::Transaction)
17
+ expect(@datatrans.xml_transaction({}).class).to eq(Datatrans::XML::Transaction)
18
18
  end
19
19
  end
20
20
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
+ require 'simplecov'
4
+ SimpleCov.start
3
5
 
4
6
  require 'active_support'
5
7
  require 'datatrans'
@@ -1,5 +1,4 @@
1
- #encoding: utf-8
2
-
1
+ require 'action_controller'
3
2
  require 'spec_helper'
4
3
 
5
4
  describe Datatrans::Web::Transaction do
@@ -70,23 +69,34 @@ describe Datatrans::Web::Transaction do
70
69
  context "rails form helper" do
71
70
  before do
72
71
  @transaction = Datatrans::Web::Transaction.new(@datatrans, @valid_params)
73
- @view = ActionView::Base.new
72
+
73
+ if Gem.loaded_specs['activesupport'].version >= Gem::Version.create('6.0')
74
+ @view = ActionView::Base.new(ActionController::Base.view_paths, {}, {})
75
+ else
76
+ @view = ActionView::Base.new
77
+ end
74
78
  end
75
79
 
76
- it "should generate valid form field string" do
77
- @view.datatrans_notification_request_hidden_fields(@datatrans, @transaction).should == "<input id=\"merchantId\" name=\"merchantId\" type=\"hidden\" value=\"1100000000\" /><input id=\"hiddenMode\" name=\"hiddenMode\" type=\"hidden\" value=\"yes\" /><input id=\"reqtype\" name=\"reqtype\" type=\"hidden\" value=\"NOA\" /><input id=\"amount\" name=\"amount\" type=\"hidden\" value=\"1000\" /><input id=\"currency\" name=\"currency\" type=\"hidden\" value=\"CHF\" /><input id=\"useAlias\" name=\"useAlias\" type=\"hidden\" value=\"yes\" /><input id=\"sign\" name=\"sign\" type=\"hidden\" value=\"0402fb3fba8c6fcb40df9b7756e7e637\" /><input id=\"refno\" name=\"refno\" type=\"hidden\" value=\"ABCDEF\" /><input id=\"uppCustomerDetails\" name=\"uppCustomerDetails\" type=\"hidden\" /><input id=\"uppCustomerEmail\" name=\"uppCustomerEmail\" type=\"hidden\" value=\"customer@email.com\" />"
80
+ it 'should generate valid form field string' do
81
+ if Gem.loaded_specs['activesupport'].version >= Gem::Version.create('7.0')
82
+ expected_output = '<input type="hidden" name="merchantId" id="merchantId" value="1100000000" autocomplete="off" /><input type="hidden" name="hiddenMode" id="hiddenMode" value="yes" autocomplete="off" /><input type="hidden" name="reqtype" id="reqtype" value="NOA" autocomplete="off" /><input type="hidden" name="amount" id="amount" value="1000" autocomplete="off" /><input type="hidden" name="currency" id="currency" value="CHF" autocomplete="off" /><input type="hidden" name="useAlias" id="useAlias" value="yes" autocomplete="off" /><input type="hidden" name="sign" id="sign" value="0402fb3fba8c6fcb40df9b7756e7e637" autocomplete="off" /><input type="hidden" name="refno" id="refno" value="ABCDEF" autocomplete="off" /><input type="hidden" name="uppCustomerDetails" id="uppCustomerDetails" autocomplete="off" /><input type="hidden" name="uppCustomerEmail" id="uppCustomerEmail" value="customer@email.com" autocomplete="off" />'
83
+ else
84
+ expected_output = '<input type="hidden" name="merchantId" id="merchantId" value="1100000000" /><input type="hidden" name="hiddenMode" id="hiddenMode" value="yes" /><input type="hidden" name="reqtype" id="reqtype" value="NOA" /><input type="hidden" name="amount" id="amount" value="1000" /><input type="hidden" name="currency" id="currency" value="CHF" /><input type="hidden" name="useAlias" id="useAlias" value="yes" /><input type="hidden" name="sign" id="sign" value="0402fb3fba8c6fcb40df9b7756e7e637" /><input type="hidden" name="refno" id="refno" value="ABCDEF" /><input type="hidden" name="uppCustomerDetails" id="uppCustomerDetails" /><input type="hidden" name="uppCustomerEmail" id="uppCustomerEmail" value="customer@email.com" />'
85
+ end
86
+
87
+ expect(@view.datatrans_notification_request_hidden_fields(@datatrans, @transaction)).to eq expected_output
78
88
  end
79
89
  end
80
90
 
81
91
  context "successful response" do
82
92
  before do
83
- Datatrans::Web::Transaction::AuthorizeResponse.any_instance.stub(:params).and_return(@successful_response)
93
+ allow_any_instance_of(Datatrans::Web::Transaction::AuthorizeResponse).to receive(:params).and_return(@successful_response)
84
94
  end
85
95
 
86
96
  context "process" do
87
97
  it "handles a valid datatrans authorize response" do
88
98
  @transaction = Datatrans::Web::Transaction.new(@datatrans, @valid_params)
89
- @transaction.authorize.should be_true
99
+ expect(@transaction.authorize).to be true
90
100
  end
91
101
  end
92
102
  end
@@ -95,7 +105,7 @@ describe Datatrans::Web::Transaction do
95
105
  before do
96
106
  fake_response = @successful_response
97
107
  fake_response[:sign2] = 'invalid'
98
- Datatrans::Web::Transaction::AuthorizeResponse.any_instance.stub(:params).and_return(fake_response)
108
+ allow_any_instance_of(Datatrans::Web::Transaction::AuthorizeResponse).to receive(:params).and_return(fake_response)
99
109
  @transaction = Datatrans::Web::Transaction.new(@datatrans, @valid_params)
100
110
  end
101
111
 
@@ -108,21 +118,21 @@ describe Datatrans::Web::Transaction do
108
118
 
109
119
  context "failed response" do
110
120
  before do
111
- Datatrans::Web::Transaction::AuthorizeResponse.any_instance.stub(:params).and_return(@failed_response)
121
+ allow_any_instance_of(Datatrans::Web::Transaction::AuthorizeResponse).to receive(:params).and_return(@failed_response)
112
122
  @transaction = Datatrans::Web::Transaction.new(@datatrans, @valid_params)
113
123
  end
114
124
 
115
125
  context "process" do
116
126
  it "handles a failed datatrans authorize response" do
117
- @transaction.authorize.should be_false
127
+ expect(@transaction.authorize).to be false
118
128
  end
119
129
 
120
130
  it "returns error details" do
121
131
  @transaction.authorize
122
- @transaction.error_code.length.should > 0
123
- @transaction.error_message.length.should > 0
124
- @transaction.error_detail.length.should > 0
132
+ expect(@transaction.error_code.length).to be > 0
133
+ expect(@transaction.error_message.length).to be > 0
134
+ expect(@transaction.error_detail.length).to be > 0
125
135
  end
126
136
  end
127
137
  end
128
- end
138
+ end
@@ -74,41 +74,41 @@ describe Datatrans::XML::Transaction::AuthorizeRequest do
74
74
 
75
75
  context "successful response" do
76
76
  before do
77
- Datatrans::XML::Transaction::AuthorizeRequest.any_instance.stub(:process).and_return(@successful_response)
77
+ allow_any_instance_of(Datatrans::XML::Transaction::AuthorizeRequest).to receive(:process).and_return(@successful_response)
78
78
  end
79
79
 
80
80
  context "build_authorize_request" do
81
81
  it "generates a valid datatrans authorize xml" do
82
82
  @request = Datatrans::XML::Transaction::AuthorizeRequest.new(@datatrans, @valid_params)
83
- @request.send(:build_authorize_request).should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><authorizationService version=\"1\"><body merchantId=\"1100000000\"><transaction refno=\"ABCDEF\"><request><amount>1000</amount><currency>CHF</currency><aliasCC>3784982984234</aliasCC><expm>12</expm><expy>15</expy><sign>0402fb3fba8c6fcb40df9b7756e7e637</sign></request></transaction></body></authorizationService>"
83
+ expect(@request.send(:build_authorize_request)).to eq "<?xml version=\"1.0\" encoding=\"UTF-8\"?><authorizationService version=\"1\"><body merchantId=\"1100000000\"><transaction refno=\"ABCDEF\"><request><amount>1000</amount><currency>CHF</currency><aliasCC>3784982984234</aliasCC><expm>12</expm><expy>15</expy><sign>0402fb3fba8c6fcb40df9b7756e7e637</sign></request></transaction></body></authorizationService>"
84
84
  end
85
85
  end
86
86
 
87
87
  context "process" do
88
88
  it "handles a valid datatrans authorize response" do
89
89
  @transaction = Datatrans::XML::Transaction.new(@datatrans, @valid_params)
90
- @transaction.authorize.should be_true
90
+ expect(@transaction.authorize).to be true
91
91
  end
92
92
  end
93
93
  end
94
94
 
95
95
  context "failed response" do
96
96
  before do
97
- Datatrans::XML::Transaction::AuthorizeRequest.any_instance.stub(:process).and_return(@failed_response)
97
+ allow_any_instance_of(Datatrans::XML::Transaction::AuthorizeRequest).to receive(:process).and_return(@failed_response)
98
98
  @transaction = Datatrans::XML::Transaction.new(@datatrans, @valid_params)
99
99
  end
100
100
 
101
101
  context "process" do
102
102
  it "handles a failed datatrans authorize response" do
103
- @transaction.authorize.should be_false
103
+ expect(@transaction.authorize).to be false
104
104
  end
105
105
 
106
106
  it "returns error details" do
107
107
  @transaction.authorize
108
- @transaction.error_code.length.should > 0
109
- @transaction.error_message.length.should > 0
110
- @transaction.error_detail.length.should > 0
108
+ expect(@transaction.error_code.length).to be > 0
109
+ expect(@transaction.error_message.length).to be > 0
110
+ expect(@transaction.error_detail.length).to be > 0
111
111
  end
112
112
  end
113
113
  end
114
- end
114
+ end
@@ -63,41 +63,41 @@ describe Datatrans::XML::Transaction::CaptureRequest do
63
63
 
64
64
  context "successful response" do
65
65
  before do
66
- Datatrans::XML::Transaction::CaptureRequest.any_instance.stub(:process).and_return(@successful_response)
66
+ allow_any_instance_of(Datatrans::XML::Transaction::CaptureRequest).to receive(:process).and_return(@successful_response)
67
67
  end
68
68
 
69
69
  context "build_capture_request" do
70
70
  it "generates a valid datatrans capture xml" do
71
71
  @request = Datatrans::XML::Transaction::CaptureRequest.new(@datatrans, @valid_params)
72
- @request.send(:build_capture_request).should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><paymentService version=\"1\"><body merchantId=\"1100000000\"><transaction refno=\"ABCDEF\"><request><amount>1000</amount><currency>CHF</currency><uppTransactionId>110808142256858007</uppTransactionId></request></transaction></body></paymentService>"
72
+ expect(@request.send(:build_capture_request)).to eq "<?xml version=\"1.0\" encoding=\"UTF-8\"?><paymentService version=\"1\"><body merchantId=\"1100000000\"><transaction refno=\"ABCDEF\"><request><amount>1000</amount><currency>CHF</currency><uppTransactionId>110808142256858007</uppTransactionId></request></transaction></body></paymentService>"
73
73
  end
74
74
  end
75
75
 
76
76
  context "process" do
77
77
  it "handles a valid datatrans capture response" do
78
78
  @transaction = Datatrans::XML::Transaction.new(@datatrans, @valid_params)
79
- @transaction.capture.should be_true
79
+ expect(@transaction.capture).to be true
80
80
  end
81
81
  end
82
82
  end
83
83
 
84
84
  context "failed response" do
85
85
  before do
86
- Datatrans::XML::Transaction::CaptureRequest.any_instance.stub(:process).and_return(@failed_response)
86
+ allow_any_instance_of(Datatrans::XML::Transaction::CaptureRequest).to receive(:process).and_return(@failed_response)
87
87
  @transaction = Datatrans::XML::Transaction.new(@datatrans, @valid_params)
88
88
  end
89
89
 
90
90
  context "process" do
91
91
  it "handles a failed datatrans capture response" do
92
- @transaction.capture.should be_false
92
+ expect(@transaction.capture).to be false
93
93
  end
94
94
 
95
95
  it "returns error details" do
96
96
  @transaction.capture
97
- @transaction.error_code.length.should > 0
98
- @transaction.error_message.length.should > 0
99
- @transaction.error_detail.length.should > 0
97
+ expect(@transaction.error_code.length).to be > 0
98
+ expect(@transaction.error_message.length).to be > 0
99
+ expect(@transaction.error_detail.length).to be > 0
100
100
  end
101
101
  end
102
102
  end
103
- end
103
+ end
@@ -20,7 +20,7 @@ describe Datatrans::XML::Transaction::Request do
20
20
  end
21
21
  it "forward those options to HTTParty" do
22
22
  request = Datatrans::XML::Transaction::Request.new(@datatrans, {})
23
- HTTParty.should_receive(:post).with('lirum',
23
+ expect(HTTParty).to receive(:post).with('lirum',
24
24
  :params => {:foo => :bar},
25
25
  :http_proxpass => 'xxx',
26
26
  :http_proxyuser => 'hans',
@@ -33,9 +33,9 @@ describe Datatrans::XML::Transaction::Request do
33
33
  describe "not configured" do
34
34
  it "should not add any proxy settings" do
35
35
  request = Datatrans::XML::Transaction::Request.new(@datatrans, {})
36
- HTTParty.should_receive(:post).with('lirum', :params => {:foo => :bar})
36
+ expect(HTTParty).to receive(:post).with('lirum', :params => {:foo => :bar})
37
37
  request.post('lirum', :params => {:foo => :bar})
38
38
  end
39
39
  end
40
40
  end
41
- end
41
+ end
@@ -61,34 +61,34 @@ describe Datatrans::XML::Transaction::StatusRequest do
61
61
 
62
62
  context "successful response" do
63
63
  before do
64
- Datatrans::XML::Transaction::StatusRequest.any_instance.stub(:process).and_return(@successful_response)
64
+ allow_any_instance_of(Datatrans::XML::Transaction::StatusRequest).to receive(:process).and_return(@successful_response)
65
65
  end
66
66
 
67
67
  context "build_status_request" do
68
68
  it "generates a valid datatrans status xml" do
69
69
  @request = Datatrans::XML::Transaction::StatusRequest.new(@datatrans, @valid_params)
70
- @request.send(:build_status_request).should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><statusService version=\"1\"><body merchantId=\"1100000000\"><transaction refno=\"\"><request><uppTransactionId>111013090000394044</uppTransactionId></request></transaction></body></statusService>"
70
+ expect(@request.send(:build_status_request)).to eq "<?xml version=\"1.0\" encoding=\"UTF-8\"?><statusService version=\"1\"><body merchantId=\"1100000000\"><transaction refno=\"\"><request><uppTransactionId>111013090000394044</uppTransactionId></request></transaction></body></statusService>"
71
71
  end
72
72
  end
73
73
 
74
74
  context "process" do
75
75
  it "handles a valid datatrans status response" do
76
76
  @transaction = Datatrans::XML::Transaction.new(@datatrans, @valid_params)
77
- @transaction.status.should be_true
77
+ expect(@transaction.status).to be true
78
78
  end
79
79
  end
80
80
  end
81
81
 
82
82
  context "failed response" do
83
83
  before do
84
- Datatrans::XML::Transaction::StatusRequest.any_instance.stub(:process).and_return(@failed_response)
84
+ allow_any_instance_of(Datatrans::XML::Transaction::StatusRequest).to receive(:process).and_return(@failed_response)
85
85
  @transaction = Datatrans::XML::Transaction.new(@datatrans, @valid_params)
86
86
  end
87
87
 
88
88
  context "process" do
89
89
  it "handles a failed datatrans status response" do
90
- @transaction.status.should be_false
90
+ expect(@transaction.status).to be false
91
91
  end
92
92
  end
93
93
  end
94
- end
94
+ end
@@ -63,41 +63,41 @@ describe Datatrans::XML::Transaction::VoidRequest do
63
63
 
64
64
  context "successful response" do
65
65
  before do
66
- Datatrans::XML::Transaction::VoidRequest.any_instance.stub(:process).and_return(@successful_response)
66
+ allow_any_instance_of(Datatrans::XML::Transaction::VoidRequest).to receive(:process).and_return(@successful_response)
67
67
  end
68
68
 
69
69
  context "build_void_request" do
70
70
  it "generates a valid datatrans void xml" do
71
71
  @request = Datatrans::XML::Transaction::VoidRequest.new(@datatrans, @valid_params)
72
- @request.send(:build_void_request).should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><paymentService version=\"1\"><body merchantId=\"1100000000\"><transaction refno=\"ABCDEF\"><request><amount>1000</amount><currency>CHF</currency><uppTransactionId>110808143302868124</uppTransactionId><reqtype>DOA</reqtype></request></transaction></body></paymentService>"
72
+ expect(@request.send(:build_void_request)).to eq "<?xml version=\"1.0\" encoding=\"UTF-8\"?><paymentService version=\"1\"><body merchantId=\"1100000000\"><transaction refno=\"ABCDEF\"><request><amount>1000</amount><currency>CHF</currency><uppTransactionId>110808143302868124</uppTransactionId><reqtype>DOA</reqtype></request></transaction></body></paymentService>"
73
73
  end
74
74
  end
75
75
 
76
76
  context "process" do
77
77
  it "handles a valid datatrans void response" do
78
78
  @transaction = Datatrans::XML::Transaction.new(@datatrans, @valid_params)
79
- @transaction.void.should be_true
79
+ expect(@transaction.void).to be true
80
80
  end
81
81
  end
82
82
  end
83
83
 
84
84
  context "failed response" do
85
85
  before do
86
- Datatrans::XML::Transaction::VoidRequest.any_instance.stub(:process).and_return(@failed_response)
86
+ allow_any_instance_of(Datatrans::XML::Transaction::VoidRequest).to receive(:process).and_return(@failed_response)
87
87
  @transaction = Datatrans::XML::Transaction.new(@datatrans, @valid_params)
88
88
  end
89
89
 
90
90
  context "process" do
91
91
  it "handles a failed datatrans void response" do
92
- @transaction.void.should be_false
92
+ expect(@transaction.void).to be false
93
93
  end
94
94
 
95
95
  it "returns error details" do
96
96
  @transaction.void
97
- @transaction.error_code.length.should > 0
98
- @transaction.error_message.length.should > 0
99
- @transaction.error_detail.length.should > 0
97
+ expect(@transaction.error_code.length).to be > 0
98
+ expect(@transaction.error_message.length).to be > 0
99
+ expect(@transaction.error_detail.length).to be > 0
100
100
  end
101
101
  end
102
102
  end
103
- end
103
+ 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: 3.0.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Miesel
@@ -11,120 +11,134 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-09-25 00:00:00.000000000 Z
14
+ date: 2022-02-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: httparty
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
- - - '>='
20
+ - - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - '>='
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: activesupport
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - '>='
34
+ - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: 3.0.0
36
+ version: '5.2'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - '>='
41
+ - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 3.0.0
43
+ version: '5.2'
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: i18n
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - '>='
48
+ - - ">="
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0'
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - '>='
55
+ - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: builder
60
60
  requirement: !ruby/object:Gem::Requirement
61
61
  requirements:
62
- - - '>='
62
+ - - ">="
63
63
  - !ruby/object:Gem::Version
64
64
  version: '0'
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - '>='
69
+ - - ">="
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: multi_xml
74
74
  requirement: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - '>='
76
+ - - ">="
77
77
  - !ruby/object:Gem::Version
78
78
  version: 0.5.1
79
79
  type: :runtime
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - '>='
83
+ - - ">="
84
84
  - !ruby/object:Gem::Version
85
85
  version: 0.5.1
86
86
  - !ruby/object:Gem::Dependency
87
- name: rake
87
+ name: actionpack
88
+ requirement: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '5.2'
93
+ type: :development
94
+ prerelease: false
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '5.2'
100
+ - !ruby/object:Gem::Dependency
101
+ name: appraisal
88
102
  requirement: !ruby/object:Gem::Requirement
89
103
  requirements:
90
- - - '>='
104
+ - - ">="
91
105
  - !ruby/object:Gem::Version
92
106
  version: '0'
93
107
  type: :development
94
108
  prerelease: false
95
109
  version_requirements: !ruby/object:Gem::Requirement
96
110
  requirements:
97
- - - '>='
111
+ - - ">="
98
112
  - !ruby/object:Gem::Version
99
113
  version: '0'
100
114
  - !ruby/object:Gem::Dependency
101
- name: rspec
115
+ name: rake
102
116
  requirement: !ruby/object:Gem::Requirement
103
117
  requirements:
104
- - - '>='
118
+ - - ">="
105
119
  - !ruby/object:Gem::Version
106
120
  version: '0'
107
121
  type: :development
108
122
  prerelease: false
109
123
  version_requirements: !ruby/object:Gem::Requirement
110
124
  requirements:
111
- - - '>='
125
+ - - ">="
112
126
  - !ruby/object:Gem::Version
113
127
  version: '0'
114
128
  - !ruby/object:Gem::Dependency
115
- name: actionpack
129
+ name: rspec
116
130
  requirement: !ruby/object:Gem::Requirement
117
131
  requirements:
118
- - - '>='
132
+ - - ">="
119
133
  - !ruby/object:Gem::Version
120
- version: 3.0.0
134
+ version: '0'
121
135
  type: :development
122
136
  prerelease: false
123
137
  version_requirements: !ruby/object:Gem::Requirement
124
138
  requirements:
125
- - - '>='
139
+ - - ">="
126
140
  - !ruby/object:Gem::Version
127
- version: 3.0.0
141
+ version: '0'
128
142
  description: Datatrans Integration for Ruby on Rails
129
143
  email:
130
144
  - info@simplificator.com
@@ -132,15 +146,22 @@ executables: []
132
146
  extensions: []
133
147
  extra_rdoc_files: []
134
148
  files:
135
- - .gitignore
136
- - .rspec
137
- - .rvmrc
138
- - .travis.yml
149
+ - ".github/workflows/ci.yml"
150
+ - ".github/workflows/release.yml"
151
+ - ".gitignore"
152
+ - ".rspec"
153
+ - ".ruby-version"
154
+ - Appraisals
155
+ - CHANGELOG.md
139
156
  - Gemfile
140
- - Gemfile.lock
157
+ - LICENSE
141
158
  - README.markdown
142
159
  - Rakefile
143
160
  - datatrans.gemspec
161
+ - gemfiles/rails_5_2.gemfile
162
+ - gemfiles/rails_6_0.gemfile
163
+ - gemfiles/rails_6_1.gemfile
164
+ - gemfiles/rails_7_0.gemfile
144
165
  - lib/datatrans.rb
145
166
  - lib/datatrans/common.rb
146
167
  - lib/datatrans/config.rb
@@ -165,7 +186,8 @@ files:
165
186
  - spec/xml/status_spec.rb
166
187
  - spec/xml/void_spec.rb
167
188
  homepage: ''
168
- licenses: []
189
+ licenses:
190
+ - MIT
169
191
  metadata: {}
170
192
  post_install_message:
171
193
  rdoc_options: []
@@ -173,17 +195,16 @@ require_paths:
173
195
  - lib
174
196
  required_ruby_version: !ruby/object:Gem::Requirement
175
197
  requirements:
176
- - - '>='
198
+ - - ">="
177
199
  - !ruby/object:Gem::Version
178
- version: '0'
200
+ version: '2.6'
179
201
  required_rubygems_version: !ruby/object:Gem::Requirement
180
202
  requirements:
181
- - - '>='
203
+ - - ">="
182
204
  - !ruby/object:Gem::Version
183
205
  version: '0'
184
206
  requirements: []
185
- rubyforge_project: datatrans
186
- rubygems_version: 2.0.2
207
+ rubygems_version: 3.1.6
187
208
  signing_key:
188
209
  specification_version: 4
189
210
  summary: Datatrans Integration for Ruby on Rails
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm ruby-1.9.3
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- script: "bundle exec rspec spec"
2
- rvm:
3
- - 1.8.7
4
- - 1.9.3
5
- - ree
6
- - 2.0.0
7
- gemfile:
8
- - Gemfile
data/Gemfile.lock DELETED
@@ -1,69 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- datatrans (3.0.0)
5
- activesupport (>= 3.0.0)
6
- builder
7
- httparty
8
- i18n
9
- multi_xml (>= 0.5.1)
10
-
11
- GEM
12
- remote: http://rubygems.org/
13
- specs:
14
- actionpack (3.2.11)
15
- activemodel (= 3.2.11)
16
- activesupport (= 3.2.11)
17
- builder (~> 3.0.0)
18
- erubis (~> 2.7.0)
19
- journey (~> 1.0.4)
20
- rack (~> 1.4.0)
21
- rack-cache (~> 1.2)
22
- rack-test (~> 0.6.1)
23
- sprockets (~> 2.2.1)
24
- activemodel (3.2.11)
25
- activesupport (= 3.2.11)
26
- builder (~> 3.0.0)
27
- activesupport (3.2.11)
28
- i18n (~> 0.6)
29
- multi_json (~> 1.0)
30
- builder (3.0.4)
31
- diff-lcs (1.1.3)
32
- erubis (2.7.0)
33
- hike (1.2.1)
34
- httparty (0.11.0)
35
- multi_json (~> 1.0)
36
- multi_xml (>= 0.5.2)
37
- i18n (0.6.1)
38
- journey (1.0.4)
39
- multi_json (1.5.0)
40
- multi_xml (0.5.5)
41
- rack (1.4.4)
42
- rack-cache (1.2)
43
- rack (>= 0.4)
44
- rack-test (0.6.2)
45
- rack (>= 1.0)
46
- rake (10.0.3)
47
- rspec (2.12.0)
48
- rspec-core (~> 2.12.0)
49
- rspec-expectations (~> 2.12.0)
50
- rspec-mocks (~> 2.12.0)
51
- rspec-core (2.12.2)
52
- rspec-expectations (2.12.1)
53
- diff-lcs (~> 1.1.3)
54
- rspec-mocks (2.12.2)
55
- sprockets (2.2.2)
56
- hike (~> 1.2)
57
- multi_json (~> 1.0)
58
- rack (~> 1.0)
59
- tilt (~> 1.1, != 1.3.0)
60
- tilt (1.3.3)
61
-
62
- PLATFORMS
63
- ruby
64
-
65
- DEPENDENCIES
66
- actionpack (>= 3.0.0)
67
- datatrans!
68
- rake
69
- rspec