six_saferpay 2.1.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) 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 +70 -85
  6. data/README.md +18 -0
  7. data/lib/six_saferpay/api.rb +1 -1
  8. data/lib/six_saferpay/api/six_payment_page/requests/initialize.rb +4 -0
  9. data/lib/six_saferpay/api/six_payment_page/responses/assert_response.rb +11 -2
  10. data/lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb +61 -0
  11. data/lib/six_saferpay/api/six_secure_pay_gate_offer/responses/create_offer_response.rb +26 -0
  12. data/lib/six_saferpay/api/six_transaction/requests/authorize_direct.rb +4 -0
  13. data/lib/six_saferpay/api/six_transaction/requests/authorize_referenced.rb +4 -0
  14. data/lib/six_saferpay/api/six_transaction/requests/capture.rb +11 -2
  15. data/lib/six_saferpay/api/six_transaction/requests/initialize.rb +4 -0
  16. data/lib/six_saferpay/api/six_transaction/responses/authorize_direct_response.rb +11 -2
  17. data/lib/six_saferpay/api/six_transaction/responses/authorize_response.rb +11 -3
  18. data/lib/six_saferpay/client.rb +8 -2
  19. data/lib/six_saferpay/clients/secure_pay_gate_api/client.rb +23 -0
  20. data/lib/six_saferpay/models/address.rb +4 -4
  21. data/lib/six_saferpay/models/authentication.rb +36 -0
  22. data/lib/six_saferpay/models/authentication_result.rb +20 -0
  23. data/lib/six_saferpay/models/check_result.rb +6 -2
  24. data/lib/six_saferpay/models/chosen_plan.rb +62 -0
  25. data/lib/six_saferpay/models/custom_plan.rb +4 -0
  26. data/lib/six_saferpay/models/first_installment_amount.rb +4 -0
  27. data/lib/six_saferpay/models/ideal.rb +18 -0
  28. data/lib/six_saferpay/models/installment_fee.rb +4 -0
  29. data/lib/six_saferpay/models/installment_plans.rb +73 -0
  30. data/lib/six_saferpay/models/mastercard_issuer_installments.rb +49 -0
  31. data/lib/six_saferpay/models/payment_methods_options.rb +4 -2
  32. data/lib/six_saferpay/models/registration_result.rb +11 -2
  33. data/lib/six_saferpay/models/request_payment_means.rb +6 -2
  34. data/lib/six_saferpay/models/saferpay_fields.rb +18 -0
  35. data/lib/six_saferpay/models/subsequent_installment_amount.rb +4 -0
  36. data/lib/six_saferpay/models/total_amont_due.rb +4 -0
  37. data/lib/six_saferpay/version.rb +1 -1
  38. data/six_saferpay.gemspec +8 -8
  39. metadata +38 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e05ed091dc5d88b814c29b9be0c9bcbb2542144cb3dea16c6b44b93229680a2
4
- data.tar.gz: 226ca16339b7a2611fc41d717fb01c9a078f28f3c8f85c1e48d16ed2c5619467
3
+ metadata.gz: a080926b5bdf943166bbcd992d4d7a0225312de53b76dc531bd7647ec8a42f1c
4
+ data.tar.gz: dbcad29d4c52294fd934f2355176b0554c24db3696ac1e24cf64912fd6faff0b
5
5
  SHA512:
6
- metadata.gz: 5eee7a8e8298d906740d1ca95716149add13b707710e9aa9803fadb79560b9167b33ea9d3d7a98898f839f9c3ba395dcb20fa5889cf869a5e091170a9b38a148
7
- data.tar.gz: 7724483ec8efbd768c110fe18e9e7fcaf17b8eaad1b6babde78250a67a5c5319b7e4b341ddeffb1c2c2318096aec63546db4ee8facc27bb9c9db03e326bb8386
6
+ metadata.gz: 3e2633d3ddd558c1efb063dea3490d37c100abb9d7fa48672d14ecab55e53fc20e24c280b1d68b5a01780d6e59c472b8ce62d7b548ae3f8b01a26d26154b9574
7
+ data.tar.gz: b67ee84408caf95044891164d762bad9ad042401d982bda0d7265bcd9993934ee0e48b8345ac3b8f22a2e0e027521e48f39078997543c7274221d04274ab0469
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,97 @@
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 (1.16.2.4.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
+ hashdiff (1.0.1)
26
+ i18n (1.8.9)
28
27
  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)
43
- 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)
28
+ method_source (1.0.0)
29
+ minitest (5.14.3)
30
+ pastel (0.8.0)
31
+ tty-color (~> 0.5)
32
+ pry (0.14.0)
33
+ coderay (~> 1.1)
34
+ method_source (~> 1.0)
35
+ public_suffix (4.0.6)
36
+ rake (13.0.3)
37
+ rexml (3.2.4)
38
+ rspec (3.10.0)
39
+ rspec-core (~> 3.10.0)
40
+ rspec-expectations (~> 3.10.0)
41
+ rspec-mocks (~> 3.10.0)
42
+ rspec-core (3.10.1)
43
+ rspec-support (~> 3.10.0)
44
+ rspec-expectations (3.10.1)
53
45
  diff-lcs (>= 1.2.0, < 2.0)
54
- rspec-support (~> 3.8.0)
55
- rspec-mocks (3.8.0)
46
+ rspec-support (~> 3.10.0)
47
+ rspec-mocks (3.10.2)
56
48
  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)
49
+ rspec-support (~> 3.10.0)
50
+ rspec-support (3.10.2)
51
+ simplecov (0.21.2)
61
52
  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)
67
- spoon (0.0.6)
68
- 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)
53
+ simplecov-html (~> 0.11)
54
+ simplecov_json_formatter (~> 0.1)
55
+ simplecov-html (0.12.3)
56
+ simplecov_json_formatter (0.1.2)
57
+ spinning_wheel (0.2.2)
58
+ activesupport (>= 5.2.4.3)
59
+ tty-color (0.6.0)
60
+ tty-cursor (0.7.1)
61
+ tty-prompt (0.23.0)
62
+ pastel (~> 0.8)
63
+ tty-reader (~> 0.8)
64
+ tty-reader (0.9.0)
65
+ tty-cursor (~> 0.7)
66
+ tty-screen (~> 0.8)
67
+ wisper (~> 2.0)
68
+ tty-screen (0.8.1)
69
+ tzinfo (2.0.4)
70
+ concurrent-ruby (~> 1.0)
87
71
  vcr (4.0.0)
88
- webmock (3.5.1)
72
+ webmock (3.11.2)
89
73
  addressable (>= 2.3.6)
90
74
  crack (>= 0.3.2)
91
- hashdiff
92
- wisper (2.0.0)
75
+ hashdiff (>= 0.4.0, < 2.0.0)
76
+ wisper (2.0.1)
77
+ zeitwerk (2.4.2)
93
78
 
94
79
  PLATFORMS
95
80
  java
96
81
  ruby
97
82
 
98
83
  DEPENDENCIES
99
- bundler (~> 2.0)
84
+ bundler (~> 2.1)
100
85
  dotenv (~> 2.7, >= 2.7)
101
- pry (~> 0.12.0)
102
- rake (~> 10.0)
86
+ pry (~> 0.13)
87
+ rake (~> 13.0)
103
88
  rspec (~> 3.0)
104
- simplecov (~> 0.16)
89
+ simplecov (~> 0.19)
105
90
  six_saferpay!
106
- spinning_wheel (~> 0.1)
107
- tty-prompt (~> 0.18)
91
+ spinning_wheel (~> 0.2.2)
92
+ tty-prompt (~> 0.22)
108
93
  vcr (~> 4.0, >= 4.0.0)
109
- webmock (~> 3.5, >= 3.5.1)
94
+ webmock (~> 3.10, >= 3.10)
110
95
 
111
96
  BUNDLED WITH
112
- 2.0.1
97
+ 2.2.8
data/README.md CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
  # SixSaferpay
6
6
 
7
+ ## Current API Version
8
+
9
+ This gem is compatible with the SIX API version: `1.16`
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
+
@@ -1,5 +1,5 @@
1
1
  module SixSaferpay
2
2
  module API
3
- VERSION = '1.13'
3
+ VERSION = '1.16'
4
4
  end
5
5
  end
@@ -9,6 +9,7 @@ module SixSaferpay
9
9
  :payment,
10
10
  :payment_methods,
11
11
  :payment_methods_options,
12
+ :authentication,
12
13
  :wallets,
13
14
  :payer,
14
15
  :register_alias,
@@ -27,6 +28,7 @@ module SixSaferpay
27
28
  payment:,
28
29
  payment_methods: nil,
29
30
  payment_methods_options: nil,
31
+ authentication: nil,
30
32
  wallets: nil,
31
33
  payer: nil,
32
34
  register_alias: nil,
@@ -44,6 +46,7 @@ module SixSaferpay
44
46
  @payment = SixSaferpay::Payment.new(payment.to_h) if payment
45
47
  @payment_methods = payment_methods
46
48
  @payment_methods_options = SixSaferpay::PaymentMethodsOptions.new(payment_methods_options.to_h) if payment_methods_options
49
+ @authentication = SixSaferpay::Authentication.new(authentication.to_h) if authentication
47
50
  @wallets = wallets
48
51
  @payer = SixSaferpay::Payer.new(payer.to_h) if payer
49
52
  @register_alias = SixSaferpay::RegisterAlias.new(register_alias.to_h) if register_alias
@@ -64,6 +67,7 @@ module SixSaferpay
64
67
  hash.merge!(payment: @payment.to_h)
65
68
  hash.merge!(payment_methods: @payment_methods) if @payment_methods
66
69
  hash.merge!(payment_methods_options: @payment_methods_options.to_h) if @payment_methods_options
70
+ hash.merge!(authentication: @authentication.to_h) if @authentication
67
71
  hash.merge!(wallets: @wallets) if @wallets
68
72
  hash.merge!(payer: @payer.to_h) if @payer
69
73
  hash.merge!(register_alias: @register_alias.to_h) if @register_alias
@@ -8,7 +8,8 @@ module SixSaferpay
8
8
  :payer,
9
9
  :registration_result,
10
10
  :liability,
11
- :dcc
11
+ :dcc,
12
+ :mastercard_issuer_installments
12
13
  )
13
14
 
14
15
  def initialize(response_header:,
@@ -17,7 +18,8 @@ module SixSaferpay
17
18
  payer: nil,
18
19
  registration_result: nil,
19
20
  liability: nil,
20
- dcc: nil
21
+ dcc: nil,
22
+ mastercard_issuer_installments: nil
21
23
  )
22
24
  @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h)
23
25
  @transaction = SixSaferpay::Transaction.new(transaction.to_h)
@@ -26,6 +28,10 @@ module SixSaferpay
26
28
  @registration_result = SixSaferpay::RegistrationResult.new(registration_result.to_h) if registration_result
27
29
  @liability = SixSaferpay::Liability.new(liability.to_h) if liability
28
30
  @dcc = SixSaferpay::Dcc.new(dcc.to_h) if dcc
31
+ if mastercard_issuer_installments
32
+ @mastercard_issuer_installments = SixSaferpay::MastercardIssuerInstallments
33
+ .new(mastercard_issuer_installments.to_h)
34
+ end
29
35
  end
30
36
 
31
37
  def to_hash
@@ -37,6 +43,9 @@ module SixSaferpay
37
43
  hash.merge!(registration_result: @registration_result.to_h) if @registration_result
38
44
  hash.merge!(liability: @liability.to_h) if @liability
39
45
  hash.merge!(dcc: @dcc.to_h) if @dcc
46
+ if @mastercard_issuer_installments
47
+ hash.merge!(mastercard_issuer_installments: mastercard_issuer_installments.to_h)
48
+ end
40
49
  hash
41
50
  end
42
51
  alias_method :to_h, :to_hash
@@ -0,0 +1,61 @@
1
+ module SixSaferpay
2
+ module SixSecurePayGateOffer
3
+ class CreateOffer
4
+
5
+ attr_accessor(:payment,
6
+ :expiration_date,
7
+ :config_set,
8
+ :payer,
9
+ :billing_address_form
10
+ )
11
+
12
+ def initialize(payment: ,
13
+ expiration_date: ,
14
+ config_set: nil,
15
+ payer: ,
16
+ billing_address_form: nil
17
+ )
18
+
19
+ @payment = SixSaferpay::Payment.new(payment.to_h) if payment
20
+ @expiration_date = expiration_date
21
+ @config_set = config_set
22
+ @payer = SixSaferpay::Payer.new(payer.to_h) if payer
23
+ @billing_address_form =
24
+ SixSaferpay::BillingAddressForm.new(billing_address_form) if billing_address_form
25
+ end
26
+
27
+ def to_hash
28
+ hash = Hash.new
29
+ hash.merge!(payment: @payment.to_h) if @payment
30
+ hash.merge!(expiration_date: @expiration_date) if @expiration_date
31
+ hash.merge!(config_set: @config_set) if @config_set
32
+ hash.merge!(payer: @payer.to_h) if @payer
33
+ hash.merge!(billing_address_form: @billing_address_form.to_h) if @billing_address_form
34
+ hash
35
+ end
36
+ alias_method :to_h, :to_hash
37
+
38
+ def to_json
39
+ to_hash.to_json
40
+ end
41
+
42
+ def url
43
+ "/rest/customers/#{customer_id}/terminals/#{terminal_id}/spg-offers"
44
+ end
45
+
46
+ def response_class
47
+ SixSaferpay::SixSecurePayGateOffer::CreateOfferResponse
48
+ end
49
+
50
+ private
51
+
52
+ def customer_id
53
+ SixSaferpay.config.customer_id
54
+ end
55
+
56
+ def terminal_id
57
+ SixSaferpay.config.terminal_id
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,26 @@
1
+ module SixSaferpay
2
+ module SixSecurePayGateOffer
3
+ class CreateOfferResponse
4
+
5
+ attr_accessor(:offer_id,
6
+ :payment_link
7
+ )
8
+
9
+ def initialize(offer_id:,
10
+ payment_link: )
11
+
12
+ @offer_id = offer_id if offer_id
13
+ @payment_link = payment_link if payment_link
14
+ end
15
+
16
+ def to_hash
17
+ hash = Hash.new
18
+ hash.merge!(offer_id: @offer_id) if @offer_id
19
+ hash.merge!(payment_link: @payment_link) if @payment_link
20
+ hash
21
+ end
22
+ alias_method :to_h, :to_hash
23
+
24
+ end
25
+ end
26
+ end
@@ -6,6 +6,7 @@ module SixSaferpay
6
6
  :terminal_id,
7
7
  :payment,
8
8
  :payment_means,
9
+ :authentication,
9
10
  :register_alias,
10
11
  :payer
11
12
  )
@@ -15,6 +16,7 @@ module SixSaferpay
15
16
  terminal_id: nil,
16
17
  payment:,
17
18
  payment_means:,
19
+ authentication: nil,
18
20
  register_alias: nil,
19
21
  payer: nil
20
22
  )
@@ -22,6 +24,7 @@ module SixSaferpay
22
24
  @terminal_id = SixSaferpay.config.terminal_id || terminal_id
23
25
  @payment = SixSaferpay::Payment.new(payment.to_h) if payment
24
26
  @payment_means = SixSaferpay::RequestPaymentMeans.new(payment_means.to_h) if payment_means
27
+ @authentication = SixSaferpay::Authentication.new(authentication.to_h) if authentication
25
28
  @register_alias = SixSaferpay::RegisterAlias.new(register_alias.to_h) if register_alias
26
29
  @payer = SixSaferpay::Payer.new(payer.to_h) if payer
27
30
  end
@@ -32,6 +35,7 @@ module SixSaferpay
32
35
  hash.merge!(terminal_id: @terminal_id) if @terminal_id
33
36
  hash.merge!(payment: @payment.to_h) if @payment
34
37
  hash.merge!(payment_means: @payment_means.to_h) if @payment_means
38
+ hash.merge!(authentication: @authentication.to_h) if @authentication
35
39
  hash.merge!(register_alias: @register_alias.to_h) if @register_alias
36
40
  hash.merge!(payer: @payer.to_h) if @payer
37
41
  hash