buckaruby 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -3
- data/CHANGELOG.md +5 -1
- data/Gemfile.lock +13 -13
- data/lib/buckaruby/field_mapper.rb +4 -2
- data/lib/buckaruby/gateway.rb +2 -2
- data/lib/buckaruby/iban.rb +4 -2
- data/lib/buckaruby/payment_method.rb +1 -0
- data/lib/buckaruby/response.rb +3 -84
- data/lib/buckaruby/signature.rb +6 -4
- data/lib/buckaruby/transaction_status.rb +19 -0
- data/lib/buckaruby/transaction_type.rb +79 -0
- data/lib/buckaruby/version.rb +1 -1
- data/spec/buckaruby/gateway_spec.rb +26 -2
- data/spec/fixtures/responses/callback_payment_sofort.txt +1 -0
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0919fe881e55079692ccd64dc45cae08ce54073ec33e2176b0bbfada27a333de'
|
4
|
+
data.tar.gz: b4b3a163d7365c76191d6b7988d82a40f50686adb318dac85f37f2baca9cae10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9d4e71c901fccf8fcedc932e1c7c7e0086dffad4d6611dfc45343a0b62f5ce9c2f8bff764654be3e56006baccb78225fb97e03b1bb53c86b5f1bb1bc7839120
|
7
|
+
data.tar.gz: 5a54bc947866b1973a72023dcf3092850df0d9379b03eda9a3f5e4922f93418cae8be615f03d66804c9a6ea554bb110164ca59d7a57dd549b9705b1335e30b48
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
# Buckaruby changelog
|
2
2
|
|
3
|
+
## 1.5.0 (2020-11-17)
|
4
|
+
|
5
|
+
- Add payment method Sofort.
|
6
|
+
|
3
7
|
## 1.4.0 (2020-04-06)
|
4
8
|
|
5
9
|
- Add `payment_methods` to retrieve all payment methods enabled by Buckaroo and supported by this library.
|
6
10
|
- Add `specify_transaction` to get a specification for setting up a transaction.
|
7
|
-
- Fix
|
11
|
+
- Fix calculating the signature for long responses and indexed fields.
|
8
12
|
|
9
13
|
## 1.3.1 (2019-12-04)
|
10
14
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
buckaruby (1.
|
4
|
+
buckaruby (1.5.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -11,7 +11,7 @@ GEM
|
|
11
11
|
ast (2.4.0)
|
12
12
|
crack (0.4.3)
|
13
13
|
safe_yaml (~> 1.0.0)
|
14
|
-
diff-lcs (1.
|
14
|
+
diff-lcs (1.4.4)
|
15
15
|
hashdiff (1.0.0)
|
16
16
|
jaro_winkler (1.5.4)
|
17
17
|
parallel (1.19.1)
|
@@ -21,19 +21,19 @@ GEM
|
|
21
21
|
rainbow (3.0.0)
|
22
22
|
rake (12.3.3)
|
23
23
|
rexml (3.2.4)
|
24
|
-
rspec (3.
|
25
|
-
rspec-core (~> 3.
|
26
|
-
rspec-expectations (~> 3.
|
27
|
-
rspec-mocks (~> 3.
|
28
|
-
rspec-core (3.
|
29
|
-
rspec-support (~> 3.
|
30
|
-
rspec-expectations (3.
|
24
|
+
rspec (3.10.0)
|
25
|
+
rspec-core (~> 3.10.0)
|
26
|
+
rspec-expectations (~> 3.10.0)
|
27
|
+
rspec-mocks (~> 3.10.0)
|
28
|
+
rspec-core (3.10.0)
|
29
|
+
rspec-support (~> 3.10.0)
|
30
|
+
rspec-expectations (3.10.0)
|
31
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
-
rspec-support (~> 3.
|
33
|
-
rspec-mocks (3.
|
32
|
+
rspec-support (~> 3.10.0)
|
33
|
+
rspec-mocks (3.10.0)
|
34
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
-
rspec-support (~> 3.
|
36
|
-
rspec-support (3.
|
35
|
+
rspec-support (~> 3.10.0)
|
36
|
+
rspec-support (3.10.0)
|
37
37
|
rubocop (0.81.0)
|
38
38
|
jaro_winkler (~> 1.5.1)
|
39
39
|
parallel (~> 1.10)
|
@@ -4,8 +4,10 @@ require_relative 'support/case_insensitive_hash'
|
|
4
4
|
|
5
5
|
module Buckaruby
|
6
6
|
# Map NVP fields to hashes and multiple values (with index) to arrays.
|
7
|
-
|
8
|
-
|
7
|
+
module FieldMapper
|
8
|
+
module_function
|
9
|
+
|
10
|
+
def map_fields(params, prefix)
|
9
11
|
results = []
|
10
12
|
index = 1
|
11
13
|
|
data/lib/buckaruby/gateway.rb
CHANGED
@@ -22,7 +22,7 @@ module Buckaruby
|
|
22
22
|
valid_payment_methods = [
|
23
23
|
PaymentMethod::IDEAL, PaymentMethod::IDEAL_PROCESSING, PaymentMethod::VISA, PaymentMethod::MASTER_CARD,
|
24
24
|
PaymentMethod::MAESTRO, PaymentMethod::AMERICAN_EXPRESS, PaymentMethod::SEPA_DIRECT_DEBIT,
|
25
|
-
PaymentMethod::PAYPAL, PaymentMethod::BANCONTACT_MISTER_CASH
|
25
|
+
PaymentMethod::PAYPAL, PaymentMethod::BANCONTACT_MISTER_CASH, PaymentMethod::SOFORT
|
26
26
|
]
|
27
27
|
|
28
28
|
response = execute_request(:specify_transaction)
|
@@ -173,7 +173,7 @@ module Buckaruby
|
|
173
173
|
valid_payment_methods = [
|
174
174
|
PaymentMethod::IDEAL, PaymentMethod::IDEAL_PROCESSING, PaymentMethod::VISA, PaymentMethod::MASTER_CARD,
|
175
175
|
PaymentMethod::MAESTRO, PaymentMethod::AMERICAN_EXPRESS, PaymentMethod::SEPA_DIRECT_DEBIT,
|
176
|
-
PaymentMethod::PAYPAL, PaymentMethod::BANCONTACT_MISTER_CASH
|
176
|
+
PaymentMethod::PAYPAL, PaymentMethod::BANCONTACT_MISTER_CASH, PaymentMethod::SOFORT
|
177
177
|
]
|
178
178
|
validate_payment_method!(options, valid_payment_methods)
|
179
179
|
|
data/lib/buckaruby/iban.rb
CHANGED
@@ -2,8 +2,10 @@
|
|
2
2
|
|
3
3
|
module Buckaruby
|
4
4
|
# Helper for calculating the IBAN for a given account number, bank code and country code.
|
5
|
-
|
6
|
-
|
5
|
+
module Iban
|
6
|
+
module_function
|
7
|
+
|
8
|
+
def calculate_iban(account_number, bank_code, country_code = "NL")
|
7
9
|
if account_number.nil? || account_number.to_s.empty?
|
8
10
|
raise ArgumentError, "Invalid account number"
|
9
11
|
end
|
data/lib/buckaruby/response.rb
CHANGED
@@ -22,19 +22,7 @@ module Buckaruby
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def status
|
25
|
-
|
26
|
-
case params[:brq_statuscode]
|
27
|
-
when '190'
|
28
|
-
TransactionStatus::SUCCESS
|
29
|
-
when '490', '491', '492'
|
30
|
-
TransactionStatus::FAILED
|
31
|
-
when '690'
|
32
|
-
TransactionStatus::REJECTED
|
33
|
-
when '790', '791', '792', '793'
|
34
|
-
TransactionStatus::PENDING
|
35
|
-
when '890', '891'
|
36
|
-
TransactionStatus::CANCELLED
|
37
|
-
end
|
25
|
+
TransactionStatus.parse(params[:brq_statuscode])
|
38
26
|
end
|
39
27
|
|
40
28
|
def timestamp
|
@@ -85,7 +73,7 @@ module Buckaruby
|
|
85
73
|
end
|
86
74
|
|
87
75
|
def verify_signature!(response, config)
|
88
|
-
if params[:brq_apiresult].nil? ||
|
76
|
+
if params[:brq_apiresult].nil? || params[:brq_apiresult].casecmp("fail") != 0
|
89
77
|
sent_signature = params[:brq_signature]
|
90
78
|
generated_signature = Signature.generate_signature(response, config)
|
91
79
|
|
@@ -176,76 +164,7 @@ module Buckaruby
|
|
176
164
|
end
|
177
165
|
|
178
166
|
def transaction_type
|
179
|
-
|
180
|
-
# See http://support.buckaroo.nl/index.php/Transactietypes
|
181
|
-
case params[:brq_transaction_type]
|
182
|
-
when 'C021', 'V021', # iDEAL
|
183
|
-
'C002', 'C004', 'C005', # (SEPA) Direct Debit
|
184
|
-
'V010', 'V014', # PayPal
|
185
|
-
'C090', 'V090', # Bancontact
|
186
|
-
'C001', # Transfer
|
187
|
-
|
188
|
-
'C044', 'C192', 'C283', 'C293', 'C318', 'C345',
|
189
|
-
'C880', 'C963', 'V002', 'V032', 'V038', 'V044',
|
190
|
-
'V192', 'V283', 'V293', 'V313', 'V318', 'V345',
|
191
|
-
'V696', # Visa
|
192
|
-
|
193
|
-
'C043', 'C089', 'C273', 'C303', 'C328', 'C355',
|
194
|
-
'C876', 'C969', 'V001', 'V031', 'V037', 'V043',
|
195
|
-
'V089', 'V273', 'V303', 'V328', 'V355', 'V702', # MasterCard
|
196
|
-
|
197
|
-
'C046', 'C251', 'C288', 'C308', 'C333', 'C872',
|
198
|
-
'C972', 'V034', 'V040', 'V046', 'V094', 'V245',
|
199
|
-
'V288', 'V308', 'V333', 'V705', # Maestro
|
200
|
-
|
201
|
-
'V003', 'V030', 'V036', 'V042' # American Express
|
202
|
-
|
203
|
-
# Check the recurring flag to detect a normal or recurring transaction.
|
204
|
-
if params[:brq_recurring] && params[:brq_recurring].casecmp("true").zero?
|
205
|
-
TransactionType::PAYMENT_RECURRENT
|
206
|
-
else
|
207
|
-
TransactionType::PAYMENT
|
208
|
-
end
|
209
|
-
when 'C121', # iDEAL
|
210
|
-
'C102', 'C500', # (SEPA) Direct Debit
|
211
|
-
'V110', # PayPal
|
212
|
-
'C092', 'V092', # Bancontact
|
213
|
-
'C101', # Transfer
|
214
|
-
|
215
|
-
'C080', 'C194', 'C281', 'C290', 'C315', 'C342',
|
216
|
-
'C881', 'C961', 'V068', 'V074', 'V080', 'V102',
|
217
|
-
'V194', 'V281', 'V290', 'V315', 'V342', 'V694', # Visa
|
218
|
-
|
219
|
-
'C079', 'C197', 'C300', 'C325', 'C352', 'C371',
|
220
|
-
'C877', 'C967', 'V067', 'V073', 'V079', 'V101',
|
221
|
-
'V149', 'V197', 'V300', 'V325', 'V352', 'V371',
|
222
|
-
'V700', # MasterCard
|
223
|
-
|
224
|
-
'C082', 'C252', 'C286', 'C305', 'C330', 'C873',
|
225
|
-
'C970', 'V070', 'V076', 'V082', 'V246', 'V286',
|
226
|
-
'V305', 'V330', 'V703', # Maestro
|
227
|
-
|
228
|
-
'V066', 'V072', 'V078', 'V103' # American Express
|
229
|
-
TransactionType::REFUND
|
230
|
-
when 'C501', 'C502', 'C562', # (SEPA) Direct Debit
|
231
|
-
'V111', # PayPal
|
232
|
-
|
233
|
-
'C554', 'C593', 'C882', 'V132', 'V138', 'V144',
|
234
|
-
'V544', 'V592', # Visa
|
235
|
-
|
236
|
-
'C553', 'C589', 'C878', 'V131', 'V137', 'V143',
|
237
|
-
'V543', 'V589', # MasterCard
|
238
|
-
|
239
|
-
'C546', 'C551', 'C874', 'V134', 'V140', 'V146',
|
240
|
-
'V545', 'V546', # Maestro
|
241
|
-
|
242
|
-
'V130', 'V136', 'V142' # American Express
|
243
|
-
TransactionType::REVERSAL
|
244
|
-
end
|
245
|
-
else
|
246
|
-
# Fallback when transaction type is not known (cancelling credit card)
|
247
|
-
TransactionType::PAYMENT
|
248
|
-
end
|
167
|
+
TransactionType.parse(params[:brq_transaction_type], params[:brq_recurring])
|
249
168
|
end
|
250
169
|
|
251
170
|
def transaction_status
|
data/lib/buckaruby/signature.rb
CHANGED
@@ -5,8 +5,10 @@ require 'digest'
|
|
5
5
|
module Buckaruby
|
6
6
|
# Calculate a signature based on the parameters of the payment request or response.
|
7
7
|
# -> see BPE 3.0 Gateway NVP, chapter 4 'Digital Signature'
|
8
|
-
|
9
|
-
|
8
|
+
module Signature
|
9
|
+
module_function
|
10
|
+
|
11
|
+
def generate_signature(params, config)
|
10
12
|
case config.hash_method
|
11
13
|
when :sha1
|
12
14
|
Digest::SHA1.hexdigest(generate_signature_string(params, config.secret))
|
@@ -19,7 +21,7 @@ module Buckaruby
|
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
22
|
-
def
|
24
|
+
def generate_signature_string(params, secret)
|
23
25
|
sign_params = params.select { |key, _value| key.to_s.upcase.start_with?("BRQ_", "ADD_", "CUST_") && key.to_s.casecmp("BRQ_SIGNATURE").nonzero? }
|
24
26
|
sign_params = order_signature_params(sign_params)
|
25
27
|
|
@@ -36,7 +38,7 @@ module Buckaruby
|
|
36
38
|
# a_a, a0, a0a, a1a, aaA, aab, aba, aCa
|
37
39
|
CHAR_ORDER = "_01234567890abcdefghijklmnopqrstuvwxyz"
|
38
40
|
|
39
|
-
def
|
41
|
+
def order_signature_params(params)
|
40
42
|
params.sort_by do |key, _value|
|
41
43
|
key.to_s.downcase.each_char.map { |c| CHAR_ORDER.index(c) }
|
42
44
|
end
|
@@ -1,11 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Buckaruby
|
4
|
+
# Parses the transaction status code from Buckaroo.
|
4
5
|
module TransactionStatus
|
5
6
|
SUCCESS = 1
|
6
7
|
FAILED = 2
|
7
8
|
REJECTED = 3
|
8
9
|
CANCELLED = 4
|
9
10
|
PENDING = 5
|
11
|
+
|
12
|
+
module_function
|
13
|
+
|
14
|
+
# See https://support.buckaroo.nl/categorie%C3%ABn/transacties/status
|
15
|
+
def parse(brq_statuscode)
|
16
|
+
case brq_statuscode
|
17
|
+
when '190'
|
18
|
+
TransactionStatus::SUCCESS
|
19
|
+
when '490', '491', '492'
|
20
|
+
TransactionStatus::FAILED
|
21
|
+
when '690'
|
22
|
+
TransactionStatus::REJECTED
|
23
|
+
when '790', '791', '792', '793'
|
24
|
+
TransactionStatus::PENDING
|
25
|
+
when '890', '891'
|
26
|
+
TransactionStatus::CANCELLED
|
27
|
+
end
|
28
|
+
end
|
10
29
|
end
|
11
30
|
end
|
@@ -1,10 +1,89 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Buckaruby
|
4
|
+
# Parses the transaction type from Buckaroo.
|
4
5
|
module TransactionType
|
5
6
|
PAYMENT = 1
|
6
7
|
PAYMENT_RECURRENT = 2
|
7
8
|
REFUND = 3
|
8
9
|
REVERSAL = 4
|
10
|
+
|
11
|
+
module_function
|
12
|
+
|
13
|
+
# See https://support.buckaroo.nl/categorie%C3%ABn/integratie/transactietypes-overzicht
|
14
|
+
def parse(brq_transaction_type, brq_recurring)
|
15
|
+
if brq_transaction_type && !brq_transaction_type.empty?
|
16
|
+
case brq_transaction_type
|
17
|
+
when 'C021', 'V021', # iDEAL
|
18
|
+
'C002', 'C004', 'C005', # (SEPA) Direct Debit
|
19
|
+
'V010', 'V014', # PayPal
|
20
|
+
'C090', 'V090', # Bancontact
|
21
|
+
'N074', 'C075', # Sofort
|
22
|
+
'C001', # Transfer
|
23
|
+
|
24
|
+
'C044', 'C192', 'C283', 'C293', 'C318', 'C345',
|
25
|
+
'C880', 'C963', 'V002', 'V032', 'V038', 'V044',
|
26
|
+
'V192', 'V283', 'V293', 'V313', 'V318', 'V345',
|
27
|
+
'V696', # Visa
|
28
|
+
|
29
|
+
'C043', 'C089', 'C273', 'C303', 'C328', 'C355',
|
30
|
+
'C876', 'C969', 'V001', 'V031', 'V037', 'V043',
|
31
|
+
'V089', 'V273', 'V303', 'V328', 'V355', 'V702', # MasterCard
|
32
|
+
|
33
|
+
'C046', 'C251', 'C288', 'C308', 'C333', 'C872',
|
34
|
+
'C972', 'V034', 'V040', 'V046', 'V094', 'V245',
|
35
|
+
'V288', 'V308', 'V333', 'V705', # Maestro
|
36
|
+
|
37
|
+
'V003', 'V030', 'V036', 'V042' # American Express
|
38
|
+
|
39
|
+
# Check the recurring flag to detect a normal or recurring transaction.
|
40
|
+
if brq_recurring && brq_recurring.casecmp("true").zero?
|
41
|
+
TransactionType::PAYMENT_RECURRENT
|
42
|
+
else
|
43
|
+
TransactionType::PAYMENT
|
44
|
+
end
|
45
|
+
when 'C121', # iDEAL
|
46
|
+
'C102', 'C500', # (SEPA) Direct Debit
|
47
|
+
'V110', # PayPal
|
48
|
+
'C092', 'V092', # Bancontact
|
49
|
+
'N540', 'C543', # Sofort
|
50
|
+
'C101', # Transfer
|
51
|
+
|
52
|
+
'C080', 'C194', 'C281', 'C290', 'C315', 'C342',
|
53
|
+
'C881', 'C961', 'V068', 'V074', 'V080', 'V102',
|
54
|
+
'V194', 'V281', 'V290', 'V315', 'V342', 'V694', # Visa
|
55
|
+
|
56
|
+
'C079', 'C197', 'C300', 'C325', 'C352', 'C371',
|
57
|
+
'C877', 'C967', 'V067', 'V073', 'V079', 'V101',
|
58
|
+
'V149', 'V197', 'V300', 'V325', 'V352', 'V371',
|
59
|
+
'V700', # MasterCard
|
60
|
+
|
61
|
+
'C082', 'C252', 'C286', 'C305', 'C330', 'C873',
|
62
|
+
'C970', 'V070', 'V076', 'V082', 'V246', 'V286',
|
63
|
+
'V305', 'V330', 'V703', # Maestro
|
64
|
+
|
65
|
+
'V066', 'V072', 'V078', 'V103' # American Express
|
66
|
+
TransactionType::REFUND
|
67
|
+
when 'C501', 'C502', 'C562', # (SEPA) Direct Debit
|
68
|
+
'V111', # PayPal
|
69
|
+
'C544', # Sofort
|
70
|
+
|
71
|
+
'C554', 'C593', 'C882', 'V132', 'V138', 'V144',
|
72
|
+
'V544', 'V592', # Visa
|
73
|
+
|
74
|
+
'C553', 'C589', 'C878', 'V131', 'V137', 'V143',
|
75
|
+
'V543', 'V589', # MasterCard
|
76
|
+
|
77
|
+
'C546', 'C551', 'C874', 'V134', 'V140', 'V146',
|
78
|
+
'V545', 'V546', # Maestro
|
79
|
+
|
80
|
+
'V130', 'V136', 'V142' # American Express
|
81
|
+
TransactionType::REVERSAL
|
82
|
+
end
|
83
|
+
else
|
84
|
+
# Fallback when transaction type is not known (e.g. cancelling credit card)
|
85
|
+
TransactionType::PAYMENT
|
86
|
+
end
|
87
|
+
end
|
9
88
|
end
|
10
89
|
end
|
data/lib/buckaruby/version.rb
CHANGED
@@ -218,6 +218,16 @@ RSpec.describe Buckaruby::Gateway do
|
|
218
218
|
expect(response.to_h).to be_an_instance_of(Hash)
|
219
219
|
end
|
220
220
|
|
221
|
+
it 'initiates a transaction for payment method sofort' do
|
222
|
+
response = subject.setup_transaction(amount: 10, payment_method: Buckaruby::PaymentMethod::SOFORT, invoicenumber: "12345", return_url: "http://www.return.url/")
|
223
|
+
expect(response).to be_an_instance_of(Buckaruby::SetupTransactionResponse)
|
224
|
+
expect(response.transaction_id).to eq("41C48B55FA9164E123CC73B1157459E840BE5D24")
|
225
|
+
expect(response.transaction_status).to eq(Buckaruby::TransactionStatus::PENDING)
|
226
|
+
expect(response.redirect_url).not_to be nil
|
227
|
+
expect(response.timestamp).to be_an_instance_of(Time)
|
228
|
+
expect(response.to_h).to be_an_instance_of(Hash)
|
229
|
+
end
|
230
|
+
|
221
231
|
context 'with custom variables' do
|
222
232
|
it 'sends the custom variables with the request' do
|
223
233
|
response = subject.setup_transaction(amount: 10, payment_method: Buckaruby::PaymentMethod::IDEAL, payment_issuer: "ABNANL2A", invoicenumber: "12345", return_url: "http://www.return.url/", custom: { foo: :bar, quux: "42" })
|
@@ -226,7 +236,7 @@ RSpec.describe Buckaruby::Gateway do
|
|
226
236
|
expect(response.custom[:quux]).to eq("42")
|
227
237
|
|
228
238
|
expect(WebMock).to have_requested(:post, "https://testcheckout.buckaroo.nl/nvp/?op=TransactionRequest")
|
229
|
-
.with(body: "brq_websitekey=12345678&brq_payment_method=ideal&brq_culture=nl-NL&brq_currency=EUR&brq_amount=10.0&brq_invoicenumber=12345&brq_service_ideal_action=Pay&brq_service_ideal_issuer=ABNANL2A&brq_service_ideal_version=2&brq_return=http%3A%2F%2Fwww.return.url%2F&cust_foo=bar&cust_quux=42&add_buckaruby=Buckaruby+#{Buckaruby::VERSION}&brq_signature=
|
239
|
+
.with(body: "brq_websitekey=12345678&brq_payment_method=ideal&brq_culture=nl-NL&brq_currency=EUR&brq_amount=10.0&brq_invoicenumber=12345&brq_service_ideal_action=Pay&brq_service_ideal_issuer=ABNANL2A&brq_service_ideal_version=2&brq_return=http%3A%2F%2Fwww.return.url%2F&cust_foo=bar&cust_quux=42&add_buckaruby=Buckaruby+#{Buckaruby::VERSION}&brq_signature=93952aef5786f00f62e4aa33597672845b2ac8dd")
|
230
240
|
end
|
231
241
|
end
|
232
242
|
|
@@ -238,7 +248,7 @@ RSpec.describe Buckaruby::Gateway do
|
|
238
248
|
expect(response.additional[:myreference]).to eq("12345")
|
239
249
|
|
240
250
|
expect(WebMock).to have_requested(:post, "https://testcheckout.buckaroo.nl/nvp/?op=TransactionRequest")
|
241
|
-
.with(body: "brq_websitekey=12345678&brq_payment_method=ideal&brq_culture=nl-NL&brq_currency=EUR&brq_amount=10.0&brq_invoicenumber=12345&brq_service_ideal_action=Pay&brq_service_ideal_issuer=ABNANL2A&brq_service_ideal_version=2&brq_return=http%3A%2F%2Fwww.return.url%2F&add_myreference=12345&add_buckaruby=Buckaruby+#{Buckaruby::VERSION}&brq_signature=
|
251
|
+
.with(body: "brq_websitekey=12345678&brq_payment_method=ideal&brq_culture=nl-NL&brq_currency=EUR&brq_amount=10.0&brq_invoicenumber=12345&brq_service_ideal_action=Pay&brq_service_ideal_issuer=ABNANL2A&brq_service_ideal_version=2&brq_return=http%3A%2F%2Fwww.return.url%2F&add_myreference=12345&add_buckaruby=Buckaruby+#{Buckaruby::VERSION}&brq_signature=b7332fefcf5a9aeb02b9c242ef52eaad118e2da4")
|
242
252
|
end
|
243
253
|
end
|
244
254
|
end
|
@@ -642,6 +652,20 @@ RSpec.describe Buckaruby::Gateway do
|
|
642
652
|
expect(response.timestamp).to be_an_instance_of(Time)
|
643
653
|
expect(response.to_h).to be_an_instance_of(Hash)
|
644
654
|
end
|
655
|
+
|
656
|
+
it 'sets the transaction type to payment and payment method to Sofrt for sort callback' do
|
657
|
+
params = File.read("spec/fixtures/responses/callback_payment_sofort.txt")
|
658
|
+
|
659
|
+
response = subject.callback(params)
|
660
|
+
expect(response.transaction_status).to eq(Buckaruby::TransactionStatus::PENDING)
|
661
|
+
expect(response.transaction_type).to eq(Buckaruby::TransactionType::PAYMENT)
|
662
|
+
expect(response.payment_method).to eq(Buckaruby::PaymentMethod::SOFORT)
|
663
|
+
expect(response.transaction_id).to eq("41C48B55FA9164E123CC73B1157459E840BE5D24")
|
664
|
+
expect(response.payment_id).to eq("E86256B2787EE7FF0C33D0D4C6159CD922227B79")
|
665
|
+
expect(response.invoicenumber).to eq("12345")
|
666
|
+
expect(response.timestamp).to be_an_instance_of(Time)
|
667
|
+
expect(response.to_h).to be_an_instance_of(Hash)
|
668
|
+
end
|
645
669
|
end
|
646
670
|
|
647
671
|
context 'when callback is a payment recurrent response' do
|
@@ -0,0 +1 @@
|
|
1
|
+
brq_amount=10.00&brq_currency=EUR&brq_customer_name=Warnecke+Hans-Gerd&brq_description=test&brq_invoicenumber=12345&brq_mutationtype=Collecting&brq_payment=E86256B2787EE7FF0C33D0D4C6159CD922227B79&brq_service_sofortueberweisung_bankstatementid=35DRJQ5&brq_service_sofortueberweisung_customerbic=SFRTNL20XXX&brq_service_sofortueberweisung_customeriban=NL56SFRT0012345678&brq_statuscode=791&brq_statuscode_detail=P192&brq_statusmessage=Sofort+payment+request+complete%2C+payment+not+yet+received.&brq_test=true&brq_timestamp=2020-11-16+20%3A14%3A21&brq_transaction_method=sofortueberweisung&brq_transaction_type=N074&brq_transactions=41C48B55FA9164E123CC73B1157459E840BE5D24&brq_websitekey=12345678&brq_signature=3183281d1c634b656f7879293f29d3b8c6ede8b1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buckaruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kentaa
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- spec/fixtures/responses/callback_payment_pending.txt
|
118
118
|
- spec/fixtures/responses/callback_payment_rejected.txt
|
119
119
|
- spec/fixtures/responses/callback_payment_sepa.txt
|
120
|
+
- spec/fixtures/responses/callback_payment_sofort.txt
|
120
121
|
- spec/fixtures/responses/callback_payment_success.txt
|
121
122
|
- spec/fixtures/responses/callback_payment_visa.txt
|
122
123
|
- spec/fixtures/responses/callback_recurrent_sepa.txt
|
@@ -142,7 +143,7 @@ homepage: https://github.com/KentaaNL/buckaruby
|
|
142
143
|
licenses:
|
143
144
|
- MIT
|
144
145
|
metadata: {}
|
145
|
-
post_install_message:
|
146
|
+
post_install_message:
|
146
147
|
rdoc_options: []
|
147
148
|
require_paths:
|
148
149
|
- lib
|
@@ -157,8 +158,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
158
|
- !ruby/object:Gem::Version
|
158
159
|
version: '0'
|
159
160
|
requirements: []
|
160
|
-
rubygems_version: 3.0.
|
161
|
-
signing_key:
|
161
|
+
rubygems_version: 3.0.8
|
162
|
+
signing_key:
|
162
163
|
specification_version: 4
|
163
164
|
summary: Ruby library for communicating with the Buckaroo Payment Engine 3.0.
|
164
165
|
test_files:
|
@@ -176,6 +177,7 @@ test_files:
|
|
176
177
|
- spec/fixtures/responses/callback_payment_pending.txt
|
177
178
|
- spec/fixtures/responses/callback_payment_rejected.txt
|
178
179
|
- spec/fixtures/responses/callback_payment_sepa.txt
|
180
|
+
- spec/fixtures/responses/callback_payment_sofort.txt
|
179
181
|
- spec/fixtures/responses/callback_payment_success.txt
|
180
182
|
- spec/fixtures/responses/callback_payment_visa.txt
|
181
183
|
- spec/fixtures/responses/callback_recurrent_sepa.txt
|