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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.test.env +1 -1
- data/.travis.yml +4 -2
- data/Gemfile.lock +77 -82
- data/README.md +19 -1
- data/Thorfile +1 -0
- data/lib/generators/models.rb +96 -0
- data/lib/generators/templates/fabric.erb +15 -0
- data/lib/generators/templates/model.erb +56 -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 +4 -0
- data/lib/six_saferpay/api/six_payment_page/responses/assert_response.rb +11 -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 +61 -0
- data/lib/six_saferpay/api/six_secure_pay_gate_offer/responses/create_offer_response.rb +26 -0
- 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 +4 -0
- 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 +11 -3
- data/lib/six_saferpay/client.rb +8 -2
- data/lib/six_saferpay/clients/secure_pay_gate_api/client.rb +23 -0
- 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/ideal.rb +18 -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/mastercard_issuer_installments.rb +49 -0
- data/lib/six_saferpay/models/payment_methods_options.rb +4 -2
- data/lib/six_saferpay/models/registration_result.rb +11 -2
- data/lib/six_saferpay/models/request_payment_means.rb +6 -2
- data/lib/six_saferpay/models/saferpay_fields.rb +18 -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 +57 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccc4e59b09497c4bd69e43e3c83f144e0b77ed3b5fa3ab3c1a9ece66540f4b07
|
4
|
+
data.tar.gz: 5eb1be3135c3aa1eb253e8d0af0b0b5f9cda983466c5f861e3d4c01d05ad5b8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dc5c3e36ea120537bd0340e8d1b5228b795cadde23f6bdcfc6ab1da0ec5377f4ba85ab6f2cf877bace1e5a40511150b66c7ddb54d6fbb9ec604486ba316eb98
|
7
|
+
data.tar.gz: 20b80970bc27a450d1ecf2fb5569d11a68f0b9ae9e688c6c934d9cfa60c15379efe725d08f1555bbe43a0e76c8c275638ebeb3deaacb963e04ee091ef5481c59
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.2
|
data/.test.env
CHANGED
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.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 (
|
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,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.
|
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
|