six_saferpay 2.2.0 → 2.6.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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +4 -2
  4. data/Gemfile.lock +77 -82
  5. data/README.md +3 -2
  6. data/Thorfile +1 -0
  7. data/lib/generators/models.rb +100 -0
  8. data/lib/generators/templates/fabric.erb +13 -0
  9. data/lib/generators/templates/model.erb +64 -0
  10. data/lib/generators/templates/spec.erb +24 -0
  11. data/lib/six_saferpay.rb +5 -0
  12. data/lib/six_saferpay/api.rb +1 -1
  13. data/lib/six_saferpay/api/six_payment_page/requests/initialize.rb +14 -2
  14. data/lib/six_saferpay/api/six_payment_page/responses/assert_response.rb +11 -2
  15. data/lib/six_saferpay/api/six_secure_card_data/requests/insert.rb +6 -2
  16. data/lib/six_saferpay/api/six_secure_card_data/responses/insert_response.rb +9 -4
  17. data/lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb +6 -2
  18. data/lib/six_saferpay/api/six_transaction/requests/authorize_direct.rb +4 -0
  19. data/lib/six_saferpay/api/six_transaction/requests/authorize_referenced.rb +4 -0
  20. data/lib/six_saferpay/api/six_transaction/requests/capture.rb +11 -2
  21. data/lib/six_saferpay/api/six_transaction/requests/initialize.rb +14 -2
  22. data/lib/six_saferpay/api/six_transaction/responses/authorize_direct_response.rb +11 -2
  23. data/lib/six_saferpay/api/six_transaction/responses/authorize_response.rb +11 -3
  24. data/lib/six_saferpay/models/authentication.rb +36 -0
  25. data/lib/six_saferpay/models/authentication_result.rb +20 -0
  26. data/lib/six_saferpay/models/card_form.rb +11 -2
  27. data/lib/six_saferpay/models/check_result.rb +6 -2
  28. data/lib/six_saferpay/models/chosen_plan.rb +62 -0
  29. data/lib/six_saferpay/models/custom_plan.rb +4 -0
  30. data/lib/six_saferpay/models/first_installment_amount.rb +4 -0
  31. data/lib/six_saferpay/models/ideal.rb +18 -0
  32. data/lib/six_saferpay/models/installment_fee.rb +4 -0
  33. data/lib/six_saferpay/models/installment_plans.rb +73 -0
  34. data/lib/six_saferpay/models/items.rb +84 -0
  35. data/lib/six_saferpay/models/mastercard_issuer_installments.rb +49 -0
  36. data/lib/six_saferpay/models/order.rb +27 -0
  37. data/lib/six_saferpay/models/payer.rb +8 -2
  38. data/lib/six_saferpay/models/payer_profile.rb +105 -0
  39. data/lib/six_saferpay/models/payment_methods_options.rb +4 -2
  40. data/lib/six_saferpay/models/phone.rb +36 -0
  41. data/lib/six_saferpay/models/registration_result.rb +11 -2
  42. data/lib/six_saferpay/models/risk_factors.rb +39 -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 +58 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e778cad093369c363bebe5c4c0ce5242ac291ca5008bb5c59f965c3c65a4acc
4
- data.tar.gz: f34b4aad57145c97b5a401363d3121f0124a201713c58ca948a35adbb118bc5e
3
+ metadata.gz: ad6ce329906e3637162ceec4bc1f5e4e332053f36c35062d9eb3022b9c5b01b0
4
+ data.tar.gz: 6aa4715cc53630b12bb69b8ab91300eb02011edf57fa5d856199c3a5474ac531
5
5
  SHA512:
6
- metadata.gz: 0f0ec0b7c13ec5ec55a832a55875fc77bec867f93697ae5de60c59711ce5f47280a2333e4971d29dedc2a2c72e158addbaf719096a540da26a8ca63bc5e64bc0
7
- data.tar.gz: 852315203df9b3db10f95feb85aa6ee755f35a025c7c5bfbea1c2d5d904e4ef0b0290ca49fd10be5a2755a0fcda5bf8a5f0c5d4417540882645ea92b268d514a
6
+ metadata.gz: 15ff9f7bcbf264337275e4f2ee73a68d267c4e0e2bcfb0c1eaf58453bb9ae523a502d88a9c222979e04f743ea16614c8b66fe2a255fed9fdd510503f2e7f07e8
7
+ data.tar.gz: f9381e3c98e9d2ce9021873c19395cb3572c14f49e9c665cfe4dccb724059771f00bfa8b2c66cfbe9c0c1fc32a75111d97e2f0906c3334044a9d5d694b34cf1e
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.1
1
+ 2.7.2
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.1)
5
- activesupport (~> 5.0, >= 5.0.0.0)
4
+ six_saferpay (2.6.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,12 +1,12 @@
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
7
  ## Current API Version
8
8
 
9
- This gem is compatible with the SIX API version: `1.14`
9
+ This gem is compatible with the SIX API version: `1.18`
10
10
 
11
11
  ## Installation
12
12
 
@@ -156,3 +156,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
156
156
  ## License
157
157
 
158
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,100 @@
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.downcase == "string"
79
+ end
80
+
81
+ def boolean?
82
+ @type.downcase == "boolean"
83
+ end
84
+
85
+ def to_s
86
+ to_h
87
+ end
88
+
89
+ def to_h
90
+ hash = Hash.new
91
+ hash.merge!(name: name)
92
+ hash.merge!(type: type)
93
+ hash.merge!(mandatory: mandatory)
94
+ hash
95
+ end
96
+
97
+ end
98
+
99
+ end
100
+ end
@@ -0,0 +1,13 @@
1
+ SpinningWheel.define do
2
+ fabric name: '<%= file_name %>', class_name: 'SixSaferpay::<%= name %>' do
3
+ <%- attributes.each do |attr| -%>
4
+ <%- if attr.string? -%>
5
+ <%= "#{attr.name} { ' ' }" %>
6
+ <%- elsif attr.boolean? -%>
7
+ <%= "#{attr.name} { true }" %>
8
+ <%- else -%>
9
+ <%= "#{attr.name} { SpinningWheel.create('#{attr.name}') }" %>
10
+ <%- end -%>
11
+ <%- end -%>
12
+ end
13
+ end
@@ -0,0 +1,64 @@
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? || attr.boolean? -%>
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
+ <%= "hash.merge!(#{attr.name}: @#{attr.name})" %>
40
+ <%- else -%>
41
+ <%= "if @#{attr.name}" %>
42
+ <%= "hash.merge!(#{attr.name}: @#{attr.name})" %>
43
+ <%= "end" %>
44
+ <%- end -%>
45
+ <%- elsif attr.boolean? -%>
46
+ <%- if attr.mandatory? -%>
47
+ <%= "hash.merge!(#{attr.name}: @#{attr.name})" %>
48
+ <%- else -%>
49
+ <%= "if !@#{attr.name}.nil?" %>
50
+ <%= "hash.merge!(#{attr.name}: @#{attr.name})" %>
51
+ <%= "end" %>
52
+ <%- end -%>
53
+ <%- else -%>
54
+ <%= "if @#{attr.name}" %>
55
+ <%= "hash.merge!(#{attr.name}: @#{attr.name}.to_h)" %>
56
+ <%= "end" %>
57
+ <%- end -%>
58
+ <%- end -%>
59
+ hash
60
+ end
61
+ alias_method :to_h, :to_hash
62
+
63
+ end
64
+ 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? || attr.boolean? -%>
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