six_saferpay 2.3.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +4 -2
- data/Gemfile.lock +77 -82
- data/README.md +3 -2
- data/Thorfile +1 -0
- data/lib/generators/models.rb +100 -0
- data/lib/generators/templates/fabric.erb +13 -0
- data/lib/generators/templates/model.erb +64 -0
- data/lib/generators/templates/spec.erb +24 -0
- data/lib/six_saferpay.rb +5 -0
- data/lib/six_saferpay/api.rb +1 -1
- data/lib/six_saferpay/api/six_payment_page/requests/initialize.rb +14 -2
- data/lib/six_saferpay/api/six_payment_page/responses/assert_response.rb +17 -2
- data/lib/six_saferpay/api/six_secure_card_data/requests/insert.rb +6 -2
- data/lib/six_saferpay/api/six_secure_card_data/responses/insert_response.rb +9 -4
- data/lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb +6 -2
- data/lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb +11 -2
- data/lib/six_saferpay/api/six_transaction/requests/authorize_direct.rb +4 -0
- data/lib/six_saferpay/api/six_transaction/requests/authorize_referenced.rb +4 -0
- data/lib/six_saferpay/api/six_transaction/requests/capture.rb +11 -2
- data/lib/six_saferpay/api/six_transaction/requests/initialize.rb +14 -2
- data/lib/six_saferpay/api/six_transaction/responses/authorize_direct_response.rb +11 -2
- data/lib/six_saferpay/api/six_transaction/responses/authorize_response.rb +17 -3
- data/lib/six_saferpay/models/authentication.rb +36 -0
- data/lib/six_saferpay/models/authentication_result.rb +20 -0
- data/lib/six_saferpay/models/card_form.rb +11 -2
- data/lib/six_saferpay/models/check_result.rb +6 -2
- data/lib/six_saferpay/models/chosen_plan.rb +62 -0
- data/lib/six_saferpay/models/custom_plan.rb +4 -0
- data/lib/six_saferpay/models/first_installment_amount.rb +4 -0
- data/lib/six_saferpay/models/fraud_prevention.rb +24 -0
- data/lib/six_saferpay/models/installment_fee.rb +4 -0
- data/lib/six_saferpay/models/installment_plans.rb +73 -0
- data/lib/six_saferpay/models/items.rb +84 -0
- data/lib/six_saferpay/models/mastercard_issuer_installments.rb +49 -0
- data/lib/six_saferpay/models/order.rb +27 -0
- data/lib/six_saferpay/models/payer.rb +8 -2
- data/lib/six_saferpay/models/payer_profile.rb +105 -0
- data/lib/six_saferpay/models/phone.rb +36 -0
- data/lib/six_saferpay/models/registration_result.rb +11 -2
- data/lib/six_saferpay/models/risk_factors.rb +39 -0
- data/lib/six_saferpay/models/subsequent_installment_amount.rb +4 -0
- data/lib/six_saferpay/models/total_amont_due.rb +4 -0
- data/lib/six_saferpay/version.rb +1 -1
- data/six_saferpay.gemspec +9 -8
- metadata +58 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03e0eace2103ec5446da64571f30eedc0b0f4bcfbcbd74050337b93fc02edda2
|
4
|
+
data.tar.gz: 307059349c19c718f10645483f0a0eb050c518818de88652919e095fdfdbf136
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80511c7044ea2e9473d3374ca01d3c7fe59d8610ec6cf49f9d15ad8919cf9b6c19e34f385ebf4681fa33b4993f066bda92e7fa09c4cd40c817048cdbc93b1089
|
7
|
+
data.tar.gz: 55b8fc010d7fbb0ed2bd53b38aa25ae4bab302ed2977637f351688f2c9fcf0e0381f6fbb7bdb38e55028a077026a1bcf1c74f408035e0ab03cce9cbc5a38dc0b
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.2
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,112 +1,107 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
six_saferpay (2.
|
5
|
-
activesupport (~>
|
4
|
+
six_saferpay (2.7.0)
|
5
|
+
activesupport (~> 6.1, >= 6.1.3)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (
|
10
|
+
activesupport (6.1.3)
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
-
i18n (>=
|
13
|
-
minitest (
|
14
|
-
tzinfo (~>
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
ffi (1.
|
26
|
-
hashdiff (0.
|
27
|
-
i18n (1.
|
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
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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 (
|
45
|
-
rake (
|
46
|
-
|
47
|
-
|
48
|
-
rspec-
|
49
|
-
rspec-
|
50
|
-
|
51
|
-
|
52
|
-
|
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.
|
55
|
-
rspec-mocks (3.
|
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.
|
58
|
-
rspec-support (3.
|
59
|
-
|
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
|
-
|
63
|
-
|
64
|
-
simplecov-html (0.
|
65
|
-
|
66
|
-
|
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
|
-
|
70
|
-
|
71
|
-
|
72
|
-
tty-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
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.
|
80
|
+
webmock (3.11.2)
|
89
81
|
addressable (>= 2.3.6)
|
90
82
|
crack (>= 0.3.2)
|
91
|
-
hashdiff
|
92
|
-
wisper (2.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.
|
93
|
+
bundler (~> 2.1)
|
100
94
|
dotenv (~> 2.7, >= 2.7)
|
101
|
-
pry (~> 0.
|
102
|
-
rake (~>
|
95
|
+
pry (~> 0.14)
|
96
|
+
rake (~> 13.0)
|
103
97
|
rspec (~> 3.0)
|
104
|
-
simplecov (~> 0.
|
98
|
+
simplecov (~> 0.19)
|
105
99
|
six_saferpay!
|
106
|
-
spinning_wheel (~> 0.
|
107
|
-
|
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.
|
104
|
+
webmock (~> 3.10, >= 3.10)
|
110
105
|
|
111
106
|
BUNDLED WITH
|
112
|
-
2.
|
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.
|
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.
|
9
|
+
This gem is compatible with the SIX API version: `1.19`
|
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
|