six_saferpay 2.1.1 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.test.env +1 -1
  4. data/.travis.yml +4 -2
  5. data/Gemfile.lock +77 -82
  6. data/README.md +19 -1
  7. data/Thorfile +1 -0
  8. data/lib/generators/models.rb +96 -0
  9. data/lib/generators/templates/fabric.erb +15 -0
  10. data/lib/generators/templates/model.erb +56 -0
  11. data/lib/generators/templates/spec.erb +24 -0
  12. data/lib/six_saferpay.rb +5 -0
  13. data/lib/six_saferpay/api.rb +1 -1
  14. data/lib/six_saferpay/api/six_payment_page/requests/initialize.rb +4 -0
  15. data/lib/six_saferpay/api/six_payment_page/responses/assert_response.rb +11 -2
  16. data/lib/six_saferpay/api/six_secure_card_data/requests/insert.rb +6 -2
  17. data/lib/six_saferpay/api/six_secure_card_data/responses/insert_response.rb +9 -4
  18. data/lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb +61 -0
  19. data/lib/six_saferpay/api/six_secure_pay_gate_offer/responses/create_offer_response.rb +26 -0
  20. data/lib/six_saferpay/api/six_transaction/requests/authorize_direct.rb +4 -0
  21. data/lib/six_saferpay/api/six_transaction/requests/authorize_referenced.rb +4 -0
  22. data/lib/six_saferpay/api/six_transaction/requests/capture.rb +11 -2
  23. data/lib/six_saferpay/api/six_transaction/requests/initialize.rb +4 -0
  24. data/lib/six_saferpay/api/six_transaction/responses/authorize_direct_response.rb +11 -2
  25. data/lib/six_saferpay/api/six_transaction/responses/authorize_response.rb +11 -3
  26. data/lib/six_saferpay/client.rb +8 -2
  27. data/lib/six_saferpay/clients/secure_pay_gate_api/client.rb +23 -0
  28. data/lib/six_saferpay/models/authentication.rb +36 -0
  29. data/lib/six_saferpay/models/authentication_result.rb +20 -0
  30. data/lib/six_saferpay/models/card_form.rb +11 -2
  31. data/lib/six_saferpay/models/check_result.rb +6 -2
  32. data/lib/six_saferpay/models/chosen_plan.rb +62 -0
  33. data/lib/six_saferpay/models/custom_plan.rb +4 -0
  34. data/lib/six_saferpay/models/first_installment_amount.rb +4 -0
  35. data/lib/six_saferpay/models/ideal.rb +18 -0
  36. data/lib/six_saferpay/models/installment_fee.rb +4 -0
  37. data/lib/six_saferpay/models/installment_plans.rb +73 -0
  38. data/lib/six_saferpay/models/mastercard_issuer_installments.rb +49 -0
  39. data/lib/six_saferpay/models/payment_methods_options.rb +4 -2
  40. data/lib/six_saferpay/models/registration_result.rb +11 -2
  41. data/lib/six_saferpay/models/request_payment_means.rb +6 -2
  42. data/lib/six_saferpay/models/saferpay_fields.rb +18 -0
  43. data/lib/six_saferpay/models/subsequent_installment_amount.rb +4 -0
  44. data/lib/six_saferpay/models/total_amont_due.rb +4 -0
  45. data/lib/six_saferpay/version.rb +1 -1
  46. data/six_saferpay.gemspec +9 -8
  47. metadata +57 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fcb1cf7266884ce5d697cf903e3348bce7092647571b9a9920623b623bb8e6fb
4
- data.tar.gz: 45c7e73b54b42a78deb843373e68ae988fb175b5caaa21c6f703ce1018ec1f7f
3
+ metadata.gz: ccc4e59b09497c4bd69e43e3c83f144e0b77ed3b5fa3ab3c1a9ece66540f4b07
4
+ data.tar.gz: 5eb1be3135c3aa1eb253e8d0af0b0b5f9cda983466c5f861e3d4c01d05ad5b8a
5
5
  SHA512:
6
- metadata.gz: 4cfdfaacdcec37617caade03211d80bc3d6b5930d351826086b279384f0afefb0eff5545b2d2d2aff85304bf1d7308f45ca2b4d66b59a89d1c30d66be702e97b
7
- data.tar.gz: 1cdb579751bdd406904d70aaf9a59b79eeddfae75afcb8abf102a6b7a62e51dc5683efc3ba89121c8486f59d39e8442d51a172593648a95fac906aa308360aa5
6
+ metadata.gz: 2dc5c3e36ea120537bd0340e8d1b5228b795cadde23f6bdcfc6ab1da0ec5377f4ba85ab6f2cf877bace1e5a40511150b66c7ddb54d6fbb9ec604486ba316eb98
7
+ data.tar.gz: 20b80970bc27a450d1ecf2fb5569d11a68f0b9ae9e688c6c934d9cfa60c15379efe725d08f1555bbe43a0e76c8c275638ebeb3deaacb963e04ee091ef5481c59
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.1
1
+ 2.7.2
data/.test.env CHANGED
@@ -1,5 +1,5 @@
1
1
  SIX_SAFERPAY_CUSTOMER_ID='245294'
2
- SIX_SAFERPAY_TERMINAL_ID='17925560'
2
+ SIX_SAFERPAY_TERMINAL_ID='17925578'
3
3
  SIX_SAFERPAY_USERNAME='API_245294_08700063'
4
4
  SIX_SAFERPAY_PASSWORD='mei4Xoozle4doi0A'
5
5
  SIX_SAFERPAY_FAIL_URL='http://localhost:3004'
data/.travis.yml CHANGED
@@ -3,8 +3,10 @@ sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
- - 2.5.0
7
- before_install: gem install bundler -v 2.0.1
6
+ - 2.7.2
7
+
8
+ before_install:
9
+ - gem install bundler:2.2.8
8
10
 
9
11
  notifications:
10
12
  slack: fadendaten:tWoet2mtObvbwSZSyUAY93jl
data/Gemfile.lock CHANGED
@@ -1,112 +1,107 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- six_saferpay (2.1.0)
5
- activesupport (~> 5.0, >= 5.0.0.0)
4
+ six_saferpay (2.5.0)
5
+ activesupport (~> 6.1, >= 6.1.3)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (5.2.3)
10
+ activesupport (6.1.3)
11
11
  concurrent-ruby (~> 1.0, >= 1.0.2)
12
- i18n (>= 0.7, < 2)
13
- minitest (~> 5.1)
14
- tzinfo (~> 1.1)
15
- addressable (2.6.0)
16
- public_suffix (>= 2.0.2, < 4.0)
17
- coderay (1.1.2)
18
- concurrent-ruby (1.1.5)
19
- crack (0.4.3)
20
- safe_yaml (~> 1.0.0)
21
- diff-lcs (1.3)
22
- docile (1.3.1)
23
- dotenv (2.7.1)
24
- equatable (0.5.0)
25
- ffi (1.10.0-java)
26
- hashdiff (0.3.8)
27
- i18n (1.6.0)
12
+ i18n (>= 1.6, < 2)
13
+ minitest (>= 5.1)
14
+ tzinfo (~> 2.0)
15
+ zeitwerk (~> 2.3)
16
+ addressable (2.7.0)
17
+ public_suffix (>= 2.0.2, < 5.0)
18
+ coderay (1.1.3)
19
+ concurrent-ruby (1.1.8)
20
+ crack (0.4.5)
21
+ rexml
22
+ diff-lcs (1.4.4)
23
+ docile (1.3.5)
24
+ dotenv (2.7.6)
25
+ ffi (1.14.2-java)
26
+ hashdiff (1.0.1)
27
+ i18n (1.8.9)
28
28
  concurrent-ruby (~> 1.0)
29
- json (2.2.0)
30
- json (2.2.0-java)
31
- method_source (0.9.2)
32
- minitest (5.11.3)
33
- necromancer (0.4.0)
34
- pastel (0.7.2)
35
- equatable (~> 0.5.0)
36
- tty-color (~> 0.4.0)
37
- pry (0.12.2)
38
- coderay (~> 1.1.0)
39
- method_source (~> 0.9.0)
40
- pry (0.12.2-java)
41
- coderay (~> 1.1.0)
42
- method_source (~> 0.9.0)
29
+ method_source (1.0.0)
30
+ minitest (5.14.3)
31
+ pastel (0.8.0)
32
+ tty-color (~> 0.5)
33
+ pry (0.14.0)
34
+ coderay (~> 1.1)
35
+ method_source (~> 1.0)
36
+ pry (0.14.0-java)
37
+ coderay (~> 1.1)
38
+ method_source (~> 1.0)
43
39
  spoon (~> 0.0)
44
- public_suffix (3.0.3)
45
- rake (10.5.0)
46
- rspec (3.8.0)
47
- rspec-core (~> 3.8.0)
48
- rspec-expectations (~> 3.8.0)
49
- rspec-mocks (~> 3.8.0)
50
- rspec-core (3.8.0)
51
- rspec-support (~> 3.8.0)
52
- rspec-expectations (3.8.2)
40
+ public_suffix (4.0.6)
41
+ rake (13.0.3)
42
+ rexml (3.2.4)
43
+ rspec (3.10.0)
44
+ rspec-core (~> 3.10.0)
45
+ rspec-expectations (~> 3.10.0)
46
+ rspec-mocks (~> 3.10.0)
47
+ rspec-core (3.10.1)
48
+ rspec-support (~> 3.10.0)
49
+ rspec-expectations (3.10.1)
53
50
  diff-lcs (>= 1.2.0, < 2.0)
54
- rspec-support (~> 3.8.0)
55
- rspec-mocks (3.8.0)
51
+ rspec-support (~> 3.10.0)
52
+ rspec-mocks (3.10.2)
56
53
  diff-lcs (>= 1.2.0, < 2.0)
57
- rspec-support (~> 3.8.0)
58
- rspec-support (3.8.0)
59
- safe_yaml (1.0.5)
60
- simplecov (0.16.1)
54
+ rspec-support (~> 3.10.0)
55
+ rspec-support (3.10.2)
56
+ simplecov (0.21.2)
61
57
  docile (~> 1.1)
62
- json (>= 1.8, < 3)
63
- simplecov-html (~> 0.10.0)
64
- simplecov-html (0.10.2)
65
- spinning_wheel (0.2.0)
66
- activesupport (~> 5.0, >= 5.0.0.0)
58
+ simplecov-html (~> 0.11)
59
+ simplecov_json_formatter (~> 0.1)
60
+ simplecov-html (0.12.3)
61
+ simplecov_json_formatter (0.1.2)
62
+ spinning_wheel (0.2.2)
63
+ activesupport (>= 5.2.4.3)
67
64
  spoon (0.0.6)
68
65
  ffi
69
- thread_safe (0.3.6)
70
- thread_safe (0.3.6-java)
71
- timers (4.3.0)
72
- tty-color (0.4.3)
73
- tty-cursor (0.6.1)
74
- tty-prompt (0.18.1)
75
- necromancer (~> 0.4.0)
76
- pastel (~> 0.7.0)
77
- timers (~> 4.0)
78
- tty-cursor (~> 0.6.0)
79
- tty-reader (~> 0.5.0)
80
- tty-reader (0.5.0)
81
- tty-cursor (~> 0.6.0)
82
- tty-screen (~> 0.6.4)
83
- wisper (~> 2.0.0)
84
- tty-screen (0.6.5)
85
- tzinfo (1.2.5)
86
- thread_safe (~> 0.1)
66
+ thor (1.1.0)
67
+ tty-color (0.6.0)
68
+ tty-cursor (0.7.1)
69
+ tty-prompt (0.23.0)
70
+ pastel (~> 0.8)
71
+ tty-reader (~> 0.8)
72
+ tty-reader (0.9.0)
73
+ tty-cursor (~> 0.7)
74
+ tty-screen (~> 0.8)
75
+ wisper (~> 2.0)
76
+ tty-screen (0.8.1)
77
+ tzinfo (2.0.4)
78
+ concurrent-ruby (~> 1.0)
87
79
  vcr (4.0.0)
88
- webmock (3.5.1)
80
+ webmock (3.11.2)
89
81
  addressable (>= 2.3.6)
90
82
  crack (>= 0.3.2)
91
- hashdiff
92
- wisper (2.0.0)
83
+ hashdiff (>= 0.4.0, < 2.0.0)
84
+ wisper (2.0.1)
85
+ zeitwerk (2.4.2)
93
86
 
94
87
  PLATFORMS
88
+ arm64-darwin-20
95
89
  java
96
90
  ruby
97
91
 
98
92
  DEPENDENCIES
99
- bundler (~> 2.0)
93
+ bundler (~> 2.1)
100
94
  dotenv (~> 2.7, >= 2.7)
101
- pry (~> 0.12.0)
102
- rake (~> 10.0)
95
+ pry (~> 0.14)
96
+ rake (~> 13.0)
103
97
  rspec (~> 3.0)
104
- simplecov (~> 0.16)
98
+ simplecov (~> 0.19)
105
99
  six_saferpay!
106
- spinning_wheel (~> 0.1)
107
- tty-prompt (~> 0.18)
100
+ spinning_wheel (~> 0.2.2)
101
+ thor (~> 1.1.0)
102
+ tty-prompt (~> 0.22)
108
103
  vcr (~> 4.0, >= 4.0.0)
109
- webmock (~> 3.5, >= 3.5.1)
104
+ webmock (~> 3.10, >= 3.10)
110
105
 
111
106
  BUNDLED WITH
112
- 2.0.1
107
+ 2.2.8
data/README.md CHANGED
@@ -1,9 +1,13 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/six_saferpay.svg)](https://badge.fury.io/rb/six_saferpay)
2
- [![Build Status](https://travis-ci.org/fadendaten/six_saferpay.svg?branch=master)](https://travis-ci.org/fadendaten/six_saferpay)
2
+ [![Build Status](https://travis-ci.com/fadendaten/six_saferpay.svg?branch=master)](https://travis-ci.com/fadendaten/six_saferpay)
3
3
  [![Maintainability](https://api.codeclimate.com/v1/badges/76c9d1d0f261c276de96/maintainability)](https://codeclimate.com/github/fadendaten/six_saferpay/maintainability)
4
4
 
5
5
  # SixSaferpay
6
6
 
7
+ ## Current API Version
8
+
9
+ This gem is compatible with the SIX API version: `1.17`
10
+
7
11
  ## Installation
8
12
 
9
13
  Add this line to your application's Gemfile:
@@ -79,6 +83,15 @@ You will find for all the other requests an predefined object. Feel free to use
79
83
 
80
84
  TODO
81
85
 
86
+ #### SIX Secure PayGate API
87
+
88
+ If you want to use the SIX Secure PayGate API, you have to use an other Client:
89
+
90
+ ```ruby
91
+ create_offer_request = SixSaferpay::SecurePayGateOffer.new(...)
92
+ create_offer_response = SixSaferpay::SecurePayGateApi::Client.new(create_offer_request)
93
+ ```
94
+
82
95
  ## Documentation
83
96
 
84
97
  [SIX Saferpay JSON API](https://saferpay.github.io/jsonapi)
@@ -136,6 +149,11 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
136
149
  - [x] InsertAlias
137
150
  - [x] AcquireTransaction
138
151
 
152
+ #### Secure PayGate API
153
+
154
+ - [x] CreateOffer
155
+
139
156
  ## License
140
157
 
141
158
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
159
+
data/Thorfile ADDED
@@ -0,0 +1 @@
1
+ Thor::Util.load_thorfile('lib/generators/models.rb')
@@ -0,0 +1,96 @@
1
+ require "thor"
2
+ require 'active_support/inflector'
3
+
4
+ module SixSaferpay
5
+ module Generators
6
+ class Model < Thor::Group
7
+ include Thor::Actions
8
+
9
+ attr_accessor :attributes, :file_name
10
+
11
+ argument :name
12
+ argument :method_attributes, optional: true, type: :hash
13
+ class_option :test_framework, :default => :test_unit
14
+
15
+ def self.source_root
16
+ File.dirname(__FILE__)
17
+ end
18
+
19
+ def file_name
20
+ @file_name = name.underscore
21
+ end
22
+
23
+ def create_attributes_array
24
+ @attributes = []
25
+ if method_attributes
26
+ method_attributes.each do |key, value|
27
+ split = value.split(':')
28
+
29
+ name = key.underscore
30
+ type = split.first
31
+ if split.length == 2
32
+ mandatory = split.last
33
+ else
34
+ mandatory = false
35
+ end
36
+
37
+ attribute = Attribute.new(name, type, mandatory)
38
+
39
+ @attributes << attribute
40
+ end
41
+ end
42
+ end
43
+
44
+ def create_model_file
45
+ template('templates/model.erb', "lib/six_saferpay/models/#{@file_name}.rb")
46
+ end
47
+
48
+ def create_test_file
49
+ template('templates/spec.erb', "spec/six_saferpay/models/#{@file_name}_spec.rb")
50
+ end
51
+
52
+ def create_fabric_file
53
+ template('templates/fabric.erb', "spec/fabrics/six_saferpay/models/#{@file_name.pluralize}.rb")
54
+ end
55
+
56
+ end
57
+
58
+ class Attribute
59
+ attr_accessor :name, :type, :mandatory
60
+
61
+ def initialize(name, type, mandatory = false)
62
+ @name = name
63
+ @type = type
64
+ if mandatory == "true"
65
+ @mandatory = true
66
+ elsif mandatory == "false"
67
+ @mandatory = false
68
+ else
69
+ @mandatory = mandatory
70
+ end
71
+ end
72
+
73
+ def mandatory?
74
+ @mandatory
75
+ end
76
+
77
+ def string?
78
+ @type == "String"
79
+ end
80
+
81
+ def to_s
82
+ to_h
83
+ end
84
+
85
+ def to_h
86
+ hash = Hash.new
87
+ hash.merge!(name: name)
88
+ hash.merge!(type: type)
89
+ hash.merge!(mandatory: mandatory)
90
+ hash
91
+ end
92
+
93
+ end
94
+
95
+ end
96
+ end
@@ -0,0 +1,15 @@
1
+ SpinningWheel.define do
2
+ fabric name: '<%= file_name %>', class_name: 'SixSaferpay::<%= name %>' do
3
+ <%- attributes.each do |attr| -%>
4
+ <%- if attr.string? -%>
5
+ <%- if attr.mandatory? -%>
6
+ <%= "#{attr.name} { ' ' }" %>
7
+ <%- else -%>
8
+ <%= "#{attr.name} { nil }" %>
9
+ <%- end -%>
10
+ <%- else -%>
11
+ <%= "#{attr.name} { SpinningWheel.create('#{attr.name}') }" %>
12
+ <%- end -%>
13
+ <%- end -%>
14
+ end
15
+ end
@@ -0,0 +1,56 @@
1
+ module SixSaferpay
2
+ class <%= name %>
3
+
4
+ attr_accessor(
5
+ <%- attributes.each do |attr| -%>
6
+ :<%= attr.name %>,
7
+ <%- end -%>
8
+ )
9
+
10
+ def initialize(
11
+ <%- attributes.each_with_index do |attr, index| -%>
12
+ <%= "#{attr.name}:"-%>
13
+ <%- unless attr.mandatory? -%>
14
+ <%- -%><%= ' nil' -%>
15
+ <%- end -%>
16
+ <%- unless attr == attributes.last -%>
17
+ <%- -%><%= ',' %>
18
+ <%- end -%>
19
+ <%- end %>
20
+ )
21
+ <%- attributes.each_with_index do |attr, index| -%>
22
+ <%- if attr.string? -%>
23
+ <%= "@#{attr.name} = "-%><%= "#{attr.name}" %>
24
+ <%- else -%>
25
+ <%- %>
26
+ <%= "if #{attr.name}" %>
27
+ <%= "@#{attr.name} = "-%>
28
+ <%- -%><%= "SixSaferpay::#{attr.type}.new(#{attr.name}.to_h)" %>
29
+ <%= "end" %>
30
+ <%- end -%>
31
+ <%- end -%>
32
+ end
33
+
34
+ def to_hash
35
+ hash = Hash.new
36
+ <%- attributes.each do |attr| -%>
37
+ <%- if attr.string? -%>
38
+ <%- if attr.mandatory? -%>
39
+ <%= "if @#{attr.name}" %>
40
+ <%= "hash.merge!(#{attr.name}: @#{attr.name})" %>
41
+ <%= "end" %>
42
+ <%- else -%>
43
+ <%= "hash.merge!(#{attr.name}: @#{attr.name})" %>
44
+ <%- end -%>
45
+ <%- else -%>
46
+ <%= "if @#{attr.name}" %>
47
+ <%= "hash.merge!(#{attr.name}: @#{attr.name}.to_h)" %>
48
+ <%= "end" %>
49
+ <%- end -%>
50
+ <%- end -%>
51
+ hash
52
+ end
53
+ alias_method :to_h, :to_hash
54
+
55
+ end
56
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe SixSaferpay::<%= name %> do
4
+
5
+ subject { SpinningWheel.create('<%= file_name %>') }
6
+
7
+ let(:hash) {
8
+ {
9
+ <%- attributes.each do |attr| -%>
10
+ <%- if attr.string? -%>
11
+ <%= attr.name %>: subject.<%= attr.name %>,
12
+ <%- else -%>
13
+ <%= attr.name %>: subject.<%= attr.name %>.to_h,
14
+ <%- end -%>
15
+ <%- end -%>
16
+ }
17
+ }
18
+
19
+ describe 'to_hash' do
20
+ it 'returns the hash representation of the <%=name%>' do
21
+ expect(subject.to_hash).to eq(hash)
22
+ end
23
+ end
24
+ end