buckaruby 2.2.3 → 2.3.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.
- checksums.yaml +4 -4
- data/README.md +21 -3
- data/lib/buckaruby/gateway.rb +31 -15
- data/lib/buckaruby/payment_method.rb +13 -8
- data/lib/buckaruby/request.rb +53 -32
- data/lib/buckaruby/response.rb +10 -3
- data/lib/buckaruby/signature.rb +2 -8
- data/lib/buckaruby/transaction_status.rb +2 -2
- data/lib/buckaruby/transaction_type.rb +5 -2
- data/lib/buckaruby/version.rb +1 -1
- metadata +19 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 677dc8026a450e995c6a67c270683efc87a47fb67ef1777e8c9b857dcb5cd163
|
|
4
|
+
data.tar.gz: c476fdf7cabb865d6b648e1e5dfa3e10bdabe7879d70e23b44a42a53ebeedcac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 86aff95f664cdfaacc37ef542a0a0568c03bebc07d2fdf9250c3e6278e452e113849ed0ce107e2a65626fa89d00fa488a1667e986bb4819baa0facec022f3bf6
|
|
7
|
+
data.tar.gz: 74223490cd59074d914b7efb18accba88b475f772f0942a38c82e0b6baf03b41bc3c69957dd9fabf0aa8e6231423f35ab43b82361d69921f2e6badd4bf14fc88
|
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Buckaruby
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/rb/buckaruby)
|
|
4
|
-
[](https://github.com/KentaaNL/buckaruby/actions)
|
|
5
5
|
[](https://github.com/KentaaNL/buckaruby/actions/workflows/github-code-scanning/codeql)
|
|
6
6
|
|
|
7
7
|
The Buckaruby gem provides a Ruby library for communicating with the Buckaroo Payment Engine 3.0.
|
|
@@ -12,6 +12,7 @@ The Buckaruby gem provides a Ruby library for communicating with the Buckaroo Pa
|
|
|
12
12
|
- [Configuration](#configuration)
|
|
13
13
|
- [Usage](#usage)
|
|
14
14
|
- [Payment methods](#payment-methods)
|
|
15
|
+
- [Issuers](#issuers)
|
|
15
16
|
- [Start transaction](#start-transaction)
|
|
16
17
|
- [Recurrent transaction](#recurrent-transaction)
|
|
17
18
|
- [Refund transaction](#refund-transaction)
|
|
@@ -94,6 +95,17 @@ To retrieve the payment methods enabled in Buckaroo and supported by this librar
|
|
|
94
95
|
payment_methods = gateway.payment_methods
|
|
95
96
|
```
|
|
96
97
|
|
|
98
|
+
### Issuers
|
|
99
|
+
|
|
100
|
+
For Pay by Bank, you can let the consumer select their bank in your application. Use the method `issuers` to retrieve the banks (BIC code and name), optionally filtered by country (`NL` or `BE`):
|
|
101
|
+
|
|
102
|
+
```ruby
|
|
103
|
+
issuers = gateway.issuers(Buckaruby::PaymentMethod::PAY_BY_BANK, country_code: "NL")
|
|
104
|
+
# => { "ABNANL2A" => "ABN AMRO", "INGBNL2A" => "ING", ... }
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Pass the selected bank as `issuer` to `setup_transaction`, with the matching `country_code`. Both are optional: without an `issuer`, the consumer selects their bank after being redirected.
|
|
108
|
+
|
|
97
109
|
### Start transaction
|
|
98
110
|
|
|
99
111
|
To start a new transaction, use the method `setup_transaction`:
|
|
@@ -160,12 +172,18 @@ First check if the transaction is refundable, with the parameter `transaction_id
|
|
|
160
172
|
response = gateway.refundable_transaction?(transaction_id: "abcdefg")
|
|
161
173
|
```
|
|
162
174
|
|
|
163
|
-
If the
|
|
175
|
+
If the response is positive then you can refund the transaction with:
|
|
164
176
|
|
|
165
177
|
```ruby
|
|
166
178
|
response = gateway.refund_transaction(transaction_id: "abcdefg")
|
|
167
179
|
```
|
|
168
180
|
|
|
181
|
+
This refunds the maximum refundable amount. To do a partial refund, add the parameter `amount`:
|
|
182
|
+
|
|
183
|
+
```ruby
|
|
184
|
+
response = gateway.refund_transaction(transaction_id: "abcdefg", amount: 5)
|
|
185
|
+
```
|
|
186
|
+
|
|
169
187
|
The response includes a `status` to check if the refund was successful.
|
|
170
188
|
|
|
171
189
|
If you try to refund a transaction that's not refundable, then a `Buckaruby::NonRefundableTransactionException` will be raised.
|
|
@@ -218,7 +236,7 @@ See `Buckaruby::StatusResponse` for more details.
|
|
|
218
236
|
|
|
219
237
|
You can send custom variables and additional variables with each request.
|
|
220
238
|
|
|
221
|
-
Use the parameter `custom` to build a hash with custom variables and `additional` for building a hash with additional
|
|
239
|
+
Use the parameter `custom` to build a hash with custom variables and `additional` for building a hash with additional variables.
|
|
222
240
|
For example:
|
|
223
241
|
|
|
224
242
|
```ruby
|
data/lib/buckaruby/gateway.rb
CHANGED
|
@@ -15,6 +15,8 @@ module Buckaruby
|
|
|
15
15
|
|
|
16
16
|
# Returns the payment methods enabled by Buckaroo and supported by this library.
|
|
17
17
|
def payment_methods
|
|
18
|
+
logger.debug('[payment_methods]')
|
|
19
|
+
|
|
18
20
|
valid_payment_methods = PaymentMethod.all - [PaymentMethod::TRANSFER]
|
|
19
21
|
|
|
20
22
|
response = execute_request(:specify_transaction)
|
|
@@ -23,18 +25,21 @@ module Buckaruby
|
|
|
23
25
|
services & valid_payment_methods
|
|
24
26
|
end
|
|
25
27
|
|
|
26
|
-
# Get a list with payment issuers (
|
|
27
|
-
def issuers(payment_method)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
# Get a list with payment issuers (iDEAL and PayByBank).
|
|
29
|
+
def issuers(payment_method, options = {})
|
|
30
|
+
logger.debug("[issuers] payment_method=#{payment_method.inspect} options=#{options.inspect}")
|
|
31
|
+
|
|
32
|
+
validate_issuers_params!(payment_method, options)
|
|
31
33
|
|
|
32
34
|
response = execute_request(:specify_transaction, payment_method: payment_method)
|
|
33
35
|
|
|
34
36
|
service = response.services.first
|
|
35
|
-
description = service[:actiondescription].find { |action| action[:description].casecmp(Action::PAY)
|
|
36
|
-
params = description[:requestparameters].find { |param| param[:name].casecmp('issuer')
|
|
37
|
-
items = params[:listitemdescription]
|
|
37
|
+
description = service[:actiondescription].find { |action| action[:description].casecmp?(Action::PAY) } if service
|
|
38
|
+
params = description[:requestparameters].find { |param| param[:name].casecmp?('issuer') } if description
|
|
39
|
+
items = (params && params[:listitemdescription]) || []
|
|
40
|
+
|
|
41
|
+
country_code = options[:country_code]
|
|
42
|
+
items = items.select { |item| item[:groupname].to_s.casecmp?(country_code.to_s) } if country_code
|
|
38
43
|
|
|
39
44
|
items.to_h { |item| [item[:value], item[:description]] }
|
|
40
45
|
end
|
|
@@ -45,7 +50,7 @@ module Buckaruby
|
|
|
45
50
|
|
|
46
51
|
validate_setup_transaction_params!(options)
|
|
47
52
|
|
|
48
|
-
normalize_consumer_iban
|
|
53
|
+
options = normalize_consumer_iban(options) if options[:payment_method] == PaymentMethod::SEPA_DIRECT_DEBIT
|
|
49
54
|
|
|
50
55
|
execute_request(:setup_transaction, options)
|
|
51
56
|
end
|
|
@@ -88,10 +93,11 @@ module Buckaruby
|
|
|
88
93
|
end
|
|
89
94
|
|
|
90
95
|
# Pick maximum refundable amount if amount is not supplied.
|
|
91
|
-
options[:amount]
|
|
96
|
+
amount = options[:amount] || response.maximum_amount
|
|
92
97
|
|
|
93
98
|
# Fill required parameters with data from refund info request.
|
|
94
|
-
options.merge
|
|
99
|
+
options = options.merge(
|
|
100
|
+
amount: amount,
|
|
95
101
|
payment_method: response.payment_method,
|
|
96
102
|
invoicenumber: response.invoicenumber,
|
|
97
103
|
currency: response.currency
|
|
@@ -144,6 +150,17 @@ module Buckaruby
|
|
|
144
150
|
|
|
145
151
|
private
|
|
146
152
|
|
|
153
|
+
# Validate params for retrieving issuers.
|
|
154
|
+
def validate_issuers_params!(payment_method, options)
|
|
155
|
+
unless [PaymentMethod::IDEAL, PaymentMethod::IDEAL_PROCESSING, PaymentMethod::PAY_BY_BANK].include?(payment_method)
|
|
156
|
+
raise ArgumentError, 'Invalid payment method, only iDEAL and PayByBank are supported.'
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
if options[:country_code] && payment_method != PaymentMethod::PAY_BY_BANK
|
|
160
|
+
raise ArgumentError, 'Filtering issuers by country code is only supported for PayByBank.'
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
147
164
|
# Validate required parameters.
|
|
148
165
|
def validate_required_params!(params, *required)
|
|
149
166
|
required.flatten.each do |param|
|
|
@@ -220,10 +237,9 @@ module Buckaruby
|
|
|
220
237
|
end
|
|
221
238
|
|
|
222
239
|
# Strip spaces from the IBAN.
|
|
223
|
-
def normalize_consumer_iban
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
options[:consumer_iban] = iban
|
|
240
|
+
def normalize_consumer_iban(options)
|
|
241
|
+
consumer_iban = options[:consumer_iban].to_s.gsub(/\s+/, '')
|
|
242
|
+
options.merge(consumer_iban: consumer_iban)
|
|
227
243
|
end
|
|
228
244
|
|
|
229
245
|
# Build and execute a request.
|
|
@@ -3,21 +3,26 @@
|
|
|
3
3
|
module Buckaruby
|
|
4
4
|
# Supported payment methods.
|
|
5
5
|
module PaymentMethod
|
|
6
|
+
# Bank Payments
|
|
6
7
|
IDEAL = 'ideal' # iDEAL collecting
|
|
7
8
|
IDEAL_PROCESSING = 'idealprocessing' # iDEAL processing
|
|
8
|
-
|
|
9
|
-
SEPA_DIRECT_DEBIT = 'sepadirectdebit'
|
|
10
|
-
PAYPAL = 'paypal'
|
|
11
|
-
BANCONTACT = 'bancontactmrcash'
|
|
9
|
+
PAY_BY_BANK = 'paybybank'
|
|
12
10
|
SOFORT = 'sofortueberweisung'
|
|
13
11
|
GIROPAY = 'giropay'
|
|
14
12
|
TRANSFER = 'transfer'
|
|
15
13
|
|
|
16
|
-
#
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
# Direct Debit
|
|
15
|
+
SEPA_DIRECT_DEBIT = 'sepadirectdebit'
|
|
16
|
+
|
|
17
|
+
# Cards
|
|
20
18
|
AMERICAN_EXPRESS = 'amex'
|
|
19
|
+
BANCONTACT = 'bancontactmrcash'
|
|
20
|
+
MAESTRO = 'maestro'
|
|
21
|
+
MASTER_CARD = 'mastercard'
|
|
22
|
+
VISA = 'visa'
|
|
23
|
+
|
|
24
|
+
# Wallets
|
|
25
|
+
PAYPAL = 'paypal'
|
|
21
26
|
|
|
22
27
|
# Returns an array of all payment method values.
|
|
23
28
|
def all
|
data/lib/buckaruby/request.rb
CHANGED
|
@@ -53,8 +53,8 @@ module Buckaruby
|
|
|
53
53
|
|
|
54
54
|
# Try to catch some common exceptions Net::HTTP might raise
|
|
55
55
|
rescue Errno::ETIMEDOUT, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED, Errno::EHOSTUNREACH,
|
|
56
|
-
IOError, SocketError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError,
|
|
57
|
-
Net::ProtocolError, Net::ReadTimeout, OpenSSL::SSL::SSLError => e
|
|
56
|
+
Errno::ENETUNREACH, Errno::EPIPE, IOError, SocketError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError,
|
|
57
|
+
Net::OpenTimeout, Net::ProtocolError, Net::ReadTimeout, Net::WriteTimeout, OpenSSL::SSL::SSLError => e
|
|
58
58
|
raise ConnectionException, e
|
|
59
59
|
end
|
|
60
60
|
|
|
@@ -114,42 +114,63 @@ module Buckaruby
|
|
|
114
114
|
# Request for a creating a new transaction.
|
|
115
115
|
class SetupTransactionRequest < TransactionRequest
|
|
116
116
|
def build_transaction_request_params(options)
|
|
117
|
-
params =
|
|
117
|
+
params =
|
|
118
|
+
case options[:payment_method]
|
|
119
|
+
when PaymentMethod::IDEAL, PaymentMethod::IDEAL_PROCESSING
|
|
120
|
+
build_ideal_params(options)
|
|
121
|
+
when PaymentMethod::PAY_BY_BANK
|
|
122
|
+
build_pay_by_bank_params(options)
|
|
123
|
+
when PaymentMethod::SEPA_DIRECT_DEBIT
|
|
124
|
+
build_sepa_direct_debit_params(options)
|
|
125
|
+
else
|
|
126
|
+
{}
|
|
127
|
+
end
|
|
118
128
|
|
|
119
|
-
|
|
120
|
-
when PaymentMethod::IDEAL
|
|
121
|
-
params[:brq_service_ideal_action] = Action::PAY
|
|
122
|
-
params[:brq_service_ideal_issuer] = options[:issuer] if options[:issuer]
|
|
123
|
-
params[:brq_service_ideal_version] = '2'
|
|
124
|
-
when PaymentMethod::IDEAL_PROCESSING
|
|
125
|
-
params[:brq_service_idealprocessing_action] = Action::PAY
|
|
126
|
-
params[:brq_service_idealprocessing_issuer] = options[:issuer] if options[:issuer]
|
|
127
|
-
params[:brq_service_idealprocessing_version] = '2'
|
|
128
|
-
when PaymentMethod::SEPA_DIRECT_DEBIT
|
|
129
|
-
params.merge!(
|
|
130
|
-
brq_service_sepadirectdebit_action: Action::PAY,
|
|
131
|
-
brq_service_sepadirectdebit_customeriban: options[:consumer_iban],
|
|
132
|
-
brq_service_sepadirectdebit_customeraccountname: options[:consumer_name]
|
|
133
|
-
)
|
|
129
|
+
params[:brq_startrecurrent] = options[:recurring] if options[:recurring]
|
|
134
130
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
end
|
|
131
|
+
params
|
|
132
|
+
end
|
|
138
133
|
|
|
139
|
-
|
|
140
|
-
params[:brq_service_sepadirectdebit_collectdate] = options[:collect_date].strftime('%Y-%m-%d')
|
|
141
|
-
end
|
|
134
|
+
private
|
|
142
135
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
136
|
+
def build_ideal_params(options)
|
|
137
|
+
service = options[:payment_method]
|
|
138
|
+
|
|
139
|
+
params = { "brq_service_#{service}_action": Action::PAY }
|
|
140
|
+
params[:"brq_service_#{service}_issuer"] = options[:issuer] if options[:issuer]
|
|
141
|
+
params[:"brq_service_#{service}_version"] = '2'
|
|
142
|
+
params
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def build_pay_by_bank_params(options)
|
|
146
|
+
params = { brq_service_paybybank_action: Action::PAY }
|
|
147
|
+
params[:brq_service_paybybank_issuer] = options[:issuer] if options[:issuer]
|
|
148
|
+
params[:brq_service_paybybank_countrycode] = options[:country_code] if options[:country_code]
|
|
149
|
+
params
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def build_sepa_direct_debit_params(options)
|
|
153
|
+
params = {
|
|
154
|
+
brq_service_sepadirectdebit_action: Action::PAY,
|
|
155
|
+
brq_service_sepadirectdebit_customeriban: options[:consumer_iban],
|
|
156
|
+
brq_service_sepadirectdebit_customeraccountname: options[:consumer_name]
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if options[:consumer_bic]
|
|
160
|
+
params[:brq_service_sepadirectdebit_customerbic] = options[:consumer_bic]
|
|
150
161
|
end
|
|
151
162
|
|
|
152
|
-
|
|
163
|
+
if options[:collect_date]
|
|
164
|
+
params[:brq_service_sepadirectdebit_collectdate] = options[:collect_date].strftime('%Y-%m-%d')
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
if options[:mandate_reference]
|
|
168
|
+
params.merge!(
|
|
169
|
+
brq_service_sepadirectdebit_action: [Action::PAY, Action::EXTRA_INFO].join(','),
|
|
170
|
+
brq_service_sepadirectdebit_mandatereference: options[:mandate_reference],
|
|
171
|
+
brq_service_sepadirectdebit_mandatedate: Date.today.strftime('%Y-%m-%d')
|
|
172
|
+
)
|
|
173
|
+
end
|
|
153
174
|
|
|
154
175
|
params
|
|
155
176
|
end
|
data/lib/buckaruby/response.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require_relative 'support/case_insensitive_hash'
|
|
4
4
|
|
|
5
5
|
require 'date'
|
|
6
|
+
require 'time'
|
|
6
7
|
require 'uri'
|
|
7
8
|
|
|
8
9
|
module Buckaruby
|
|
@@ -82,6 +83,8 @@ module Buckaruby
|
|
|
82
83
|
params[:brq_service_ideal_consumerbic]
|
|
83
84
|
when PaymentMethod::IDEAL_PROCESSING
|
|
84
85
|
params[:brq_service_idealprocessing_consumerbic]
|
|
86
|
+
when PaymentMethod::PAY_BY_BANK
|
|
87
|
+
params[:brq_service_paybybank_consumerbic]
|
|
85
88
|
when PaymentMethod::SEPA_DIRECT_DEBIT
|
|
86
89
|
params[:brq_service_sepadirectdebit_customerbic]
|
|
87
90
|
end
|
|
@@ -93,6 +96,8 @@ module Buckaruby
|
|
|
93
96
|
params[:brq_service_ideal_consumeriban]
|
|
94
97
|
when PaymentMethod::IDEAL_PROCESSING
|
|
95
98
|
params[:brq_service_idealprocessing_consumeriban]
|
|
99
|
+
when PaymentMethod::PAY_BY_BANK
|
|
100
|
+
params[:brq_service_paybybank_consumeriban]
|
|
96
101
|
when PaymentMethod::SEPA_DIRECT_DEBIT
|
|
97
102
|
params[:brq_service_sepadirectdebit_customeriban]
|
|
98
103
|
end
|
|
@@ -104,6 +109,8 @@ module Buckaruby
|
|
|
104
109
|
params[:brq_service_ideal_consumername] || params[:brq_customer_name]
|
|
105
110
|
when PaymentMethod::IDEAL_PROCESSING
|
|
106
111
|
params[:brq_service_idealprocessing_consumername] || params[:brq_customer_name]
|
|
112
|
+
when PaymentMethod::PAY_BY_BANK
|
|
113
|
+
params[:brq_service_paybybank_consumername] || params[:brq_customer_name]
|
|
107
114
|
when PaymentMethod::SEPA_DIRECT_DEBIT
|
|
108
115
|
params[:brq_service_sepadirectdebit_customername] || params[:brq_customer_name]
|
|
109
116
|
end
|
|
@@ -161,7 +168,7 @@ module Buckaruby
|
|
|
161
168
|
def initialize(body, config)
|
|
162
169
|
super
|
|
163
170
|
|
|
164
|
-
if api_result.nil? || api_result.casecmp('fail')
|
|
171
|
+
if api_result.nil? || api_result.casecmp?('fail')
|
|
165
172
|
raise ApiException, params
|
|
166
173
|
end
|
|
167
174
|
|
|
@@ -213,7 +220,7 @@ module Buckaruby
|
|
|
213
220
|
end
|
|
214
221
|
|
|
215
222
|
def refundable?
|
|
216
|
-
|
|
223
|
+
params[:brq_refundinfo_1_isrefundable].to_s.casecmp?('true')
|
|
217
224
|
end
|
|
218
225
|
|
|
219
226
|
def maximum_amount
|
|
@@ -234,7 +241,7 @@ module Buckaruby
|
|
|
234
241
|
include TransactionResponse
|
|
235
242
|
|
|
236
243
|
def cancellable?
|
|
237
|
-
|
|
244
|
+
params[:brq_transaction_cancelable].to_s.casecmp?('true')
|
|
238
245
|
end
|
|
239
246
|
|
|
240
247
|
def refunded_transaction_id
|
data/lib/buckaruby/signature.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'digest'
|
|
4
|
+
require 'openssl'
|
|
4
5
|
|
|
5
6
|
module Buckaruby
|
|
6
7
|
# Calculate a signature based on the parameters of the payment request or response.
|
|
@@ -51,16 +52,9 @@ module Buckaruby
|
|
|
51
52
|
sent_signature = params.find { |key, _value| key.to_s.casecmp('BRQ_SIGNATURE').zero? }&.last
|
|
52
53
|
generated_signature = Signature.generate(config, params)
|
|
53
54
|
|
|
54
|
-
if sent_signature.nil? || generated_signature.nil? || !
|
|
55
|
+
if sent_signature.nil? || generated_signature.nil? || !OpenSSL.secure_compare(sent_signature, generated_signature)
|
|
55
56
|
raise SignatureException.new(sent_signature, generated_signature)
|
|
56
57
|
end
|
|
57
58
|
end
|
|
58
|
-
|
|
59
|
-
# Constant time string comparison.
|
|
60
|
-
def safe_equals?(signature, other_signature)
|
|
61
|
-
check = signature.bytesize ^ other_signature.bytesize
|
|
62
|
-
signature.bytes.zip(other_signature.bytes) { |x, y| check |= x ^ y.to_i }
|
|
63
|
-
check.zero?
|
|
64
|
-
end
|
|
65
59
|
end
|
|
66
60
|
end
|
|
@@ -11,7 +11,7 @@ module Buckaruby
|
|
|
11
11
|
|
|
12
12
|
module_function
|
|
13
13
|
|
|
14
|
-
# See https://docs.buckaroo.io/docs/status
|
|
14
|
+
# See https://docs.buckaroo.io/docs/integration-status
|
|
15
15
|
def parse(brq_statuscode)
|
|
16
16
|
case brq_statuscode
|
|
17
17
|
when '190'
|
|
@@ -20,7 +20,7 @@ module Buckaruby
|
|
|
20
20
|
TransactionStatus::FAILED
|
|
21
21
|
when '690'
|
|
22
22
|
TransactionStatus::REJECTED
|
|
23
|
-
when '790', '791', '792', '793'
|
|
23
|
+
when '790', '791', '792', '793', '794'
|
|
24
24
|
TransactionStatus::PENDING
|
|
25
25
|
when '890', '891'
|
|
26
26
|
TransactionStatus::CANCELLED
|
|
@@ -15,6 +15,7 @@ module Buckaruby
|
|
|
15
15
|
if brq_transaction_type && !brq_transaction_type.empty?
|
|
16
16
|
case brq_transaction_type
|
|
17
17
|
when 'C021', 'V021', # iDEAL
|
|
18
|
+
'C122', # PayByBank
|
|
18
19
|
'C002', 'C004', 'C005', # (SEPA) Direct Debit
|
|
19
20
|
'V010', 'V014', 'C265', 'C266', # PayPal
|
|
20
21
|
'C090', 'V090', 'C093', 'C094', # Bancontact
|
|
@@ -40,12 +41,13 @@ module Buckaruby
|
|
|
40
41
|
'V003', 'V030', 'V036', 'V042', 'C990' # American Express
|
|
41
42
|
|
|
42
43
|
# Check the recurring flag to detect a normal or recurring transaction.
|
|
43
|
-
if brq_recurring&.casecmp('true')
|
|
44
|
+
if brq_recurring&.casecmp?('true')
|
|
44
45
|
TransactionType::PAYMENT_RECURRENT
|
|
45
46
|
else
|
|
46
47
|
TransactionType::PAYMENT
|
|
47
48
|
end
|
|
48
49
|
when 'C121', # iDEAL
|
|
50
|
+
'C123', # PayByBank
|
|
49
51
|
'C102', 'C500', # (SEPA) Direct Debit
|
|
50
52
|
'V110', 'C267', # PayPal
|
|
51
53
|
'C092', 'V092', # Bancontact
|
|
@@ -69,7 +71,8 @@ module Buckaruby
|
|
|
69
71
|
|
|
70
72
|
'V066', 'V072', 'V078', 'V103', 'C992' # American Express
|
|
71
73
|
TransactionType::REFUND
|
|
72
|
-
when '
|
|
74
|
+
when 'C200', # PayByBank
|
|
75
|
+
'C501', 'C502', 'C562', # (SEPA) Direct Debit
|
|
73
76
|
'V111', 'C268', # PayPal
|
|
74
77
|
'C544', # Sofort
|
|
75
78
|
|
data/lib/buckaruby/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: buckaruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kentaa
|
|
8
8
|
- iRaiser
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: exe
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: bundler
|
|
@@ -17,14 +16,14 @@ dependencies:
|
|
|
17
16
|
requirements:
|
|
18
17
|
- - "~>"
|
|
19
18
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: '
|
|
19
|
+
version: '4.0'
|
|
21
20
|
type: :development
|
|
22
21
|
prerelease: false
|
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
23
|
requirements:
|
|
25
24
|
- - "~>"
|
|
26
25
|
- !ruby/object:Gem::Version
|
|
27
|
-
version: '
|
|
26
|
+
version: '4.0'
|
|
28
27
|
- !ruby/object:Gem::Dependency
|
|
29
28
|
name: rake
|
|
30
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -53,6 +52,20 @@ dependencies:
|
|
|
53
52
|
- - "~>"
|
|
54
53
|
- !ruby/object:Gem::Version
|
|
55
54
|
version: '3.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: simplecov
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '1.0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '1.0'
|
|
56
69
|
- !ruby/object:Gem::Dependency
|
|
57
70
|
name: webmock
|
|
58
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -128,7 +141,6 @@ licenses:
|
|
|
128
141
|
- MIT
|
|
129
142
|
metadata:
|
|
130
143
|
rubygems_mfa_required: 'true'
|
|
131
|
-
post_install_message:
|
|
132
144
|
rdoc_options: []
|
|
133
145
|
require_paths:
|
|
134
146
|
- lib
|
|
@@ -143,8 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
143
155
|
- !ruby/object:Gem::Version
|
|
144
156
|
version: '0'
|
|
145
157
|
requirements: []
|
|
146
|
-
rubygems_version:
|
|
147
|
-
signing_key:
|
|
158
|
+
rubygems_version: 4.0.24
|
|
148
159
|
specification_version: 4
|
|
149
160
|
summary: Ruby library for communicating with the Buckaroo Payment Engine 3.0.
|
|
150
161
|
test_files: []
|