paybox_direct 0.2.2 → 0.2.3

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/paybox_direct.rb +20 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4df2da7d7c8afeef4c54db857c9d8d0605722a4d
4
- data.tar.gz: e1ba1979d9f90e90797c6d541e241a9ada88ecc5
3
+ metadata.gz: 588178b99e4c91a043a6ced5dab09b3649bbca67
4
+ data.tar.gz: 8678d1740fe07972c6f5a70779b9899af3ac4ef9
5
5
  SHA512:
6
- metadata.gz: 289343c6722ad3850ff64aa2c1ba35d4ef756ad1a2ee9f49e68e7146f00c4c5b941d263527df77c460d60a0e48d1ee937b880d72519535f6011a7dedba80cec1
7
- data.tar.gz: 66268de49aaa502702d1c15a02f5b43bcaec166ca3fc522c68f515637d24974b7db29c8d0d27db780da9c32cde322ae76ac1d7d8dd8b86ff3fd875d557d04ddf
6
+ metadata.gz: 54ad13445bf9c690fab41a3bb9713ee43af58941f9d56b2ddcd29b4449e57cc25623cbaaf1a078413c1a9b569d83835349468c528c199fbe53a1eca6dc7f6863
7
+ data.tar.gz: 188e387e6b4b8626fd2c06244f5706874c03e9f99e48103a6ab9519b2fe6cb1f11083dc9337814bf9b5966052a7eccd221150a190fd8f86c8e22e11055eb7e02
data/lib/paybox_direct.rb CHANGED
@@ -51,6 +51,7 @@ module PayboxDirect
51
51
  # * cc_cvv: The credit card CVV, e.g. "123"
52
52
  # * subscriber: (optional) A subscriber ID
53
53
  # * debit: (Bool) if true, will debit (default false)
54
+ # * connection: (optional) A specific Net::HTTP connection
54
55
  #
55
56
  # If a subscriber ID is provided:
56
57
  # * and `wallet` is provided, will execute a #51 operation (#53 if debit);
@@ -73,7 +74,8 @@ module PayboxDirect
73
74
  cc_expire:,
74
75
  cc_cvv:,
75
76
  subscriber: nil,
76
- debit: false)
77
+ debit: false,
78
+ connection: nil)
77
79
  raise ArgumentError, "amount: Expecting Numeric" unless amount.is_a? Numeric
78
80
  raise ArgumentError, "currency: Not supported" unless CURRENCIES.has_key? currency
79
81
  raise ArgumentError, "cc_expire: Expecting Date" unless cc_expire.is_a? Date
@@ -105,6 +107,7 @@ module PayboxDirect
105
107
  vars["REFABONNE"] = @@config.ref_prefix + subscriber
106
108
  end
107
109
  req = Request.new(vars)
110
+ req.http_connection = connection
108
111
  req.execute!
109
112
 
110
113
  if req.failed?
@@ -146,6 +149,7 @@ module PayboxDirect
146
149
  # * currency: The currency code, e.g. :EUR
147
150
  # * request_id: The Paybox request ID (NUMAPPEL)
148
151
  # * transaction_id: The Paybox transaction ID (NUMTRANS)
152
+ # * connection: (optional) A specific Net::HTTP connection
149
153
  #
150
154
  # This will execute a #2 operation.
151
155
  #
@@ -158,7 +162,8 @@ module PayboxDirect
158
162
  def self.debit_authorization(amount:,
159
163
  currency:,
160
164
  request_id:,
161
- transaction_id:)
165
+ transaction_id:,
166
+ connection: nil)
162
167
  raise ArgumentError, "amount: Expecting Numeric" unless amount.is_a? Numeric
163
168
  raise ArgumentError, "currency: Not supported" unless CURRENCIES.has_key? currency
164
169
  raise ArgumentError, "request_id: Expecting Fixnum" unless request_id.is_a? Fixnum
@@ -171,6 +176,7 @@ module PayboxDirect
171
176
  "NUMAPPEL" => request_id.to_s.rjust(10, "0"),
172
177
  "NUMTRANS" => transaction_id.to_s.rjust(10, "0")
173
178
  })
179
+ req.http_connection = connection
174
180
  req.execute!
175
181
 
176
182
  if req.failed?
@@ -191,6 +197,7 @@ module PayboxDirect
191
197
  # * subscriber: (optional) A subscriber ID
192
198
  # * request_id: The request ID (NUMAPPEL)
193
199
  # * transaction_id: The transaction ID (NUMTRANS)
200
+ # * connection: (optional) A specific Net::HTTP connection
194
201
  #
195
202
  # This will execute a #55 operation if a subscriber is specified, otherwise
196
203
  # a #5 operation.
@@ -209,7 +216,8 @@ module PayboxDirect
209
216
  cc_cvv:,
210
217
  subscriber: nil,
211
218
  request_id:,
212
- transaction_id:)
219
+ transaction_id:,
220
+ connection: nil)
213
221
  raise ArgumentError, "amount: Expecting Numeric" unless amount.is_a? Numeric
214
222
  raise ArgumentError, "currency: Not supported" unless CURRENCIES.has_key? currency
215
223
  raise ArgumentError, "cc_expire: Expecting Date" unless cc_expire.is_a? Date
@@ -240,6 +248,7 @@ module PayboxDirect
240
248
  vars["REFABONNE"] = @@config.ref_prefix + subscriber
241
249
  end
242
250
  req = Request.new(vars)
251
+ req.http_connection = connection
243
252
  req.execute!
244
253
 
245
254
  if req.failed?
@@ -255,6 +264,7 @@ module PayboxDirect
255
264
  # * currency: The currency code, e.g. :EUR
256
265
  # * request_id: The request ID (NUMAPPEL)
257
266
  # * transaction_id: The transaction ID (NUMTRANS)
267
+ # * connection: (optional) A specific Net::HTTP connection
258
268
  #
259
269
  # This will execute a #14 operation.
260
270
  #
@@ -267,7 +277,8 @@ module PayboxDirect
267
277
  def self.refund(amount:,
268
278
  currency:,
269
279
  request_id:,
270
- transaction_id:)
280
+ transaction_id:,
281
+ connection: nil)
271
282
  raise ArgumentError, "amount: Expecting Numeric" unless amount.is_a? Numeric
272
283
  raise ArgumentError, "currency: Not supported" unless CURRENCIES.has_key? currency
273
284
  raise ArgumentError, "request_id: Expecting Numeric" unless request_id.is_a? Numeric
@@ -280,6 +291,7 @@ module PayboxDirect
280
291
  "NUMAPPEL" => request_id.to_s.rjust(10, "0"),
281
292
  "NUMTRANS" => transaction_id.to_s.rjust(10, "0")
282
293
  })
294
+ req.http_connection = connection
283
295
  req.execute!
284
296
 
285
297
  if req.failed?
@@ -299,6 +311,7 @@ module PayboxDirect
299
311
  # * cc_expire: The credit card expiration date, e.g. Date.new(2015, 10, 1)
300
312
  # * cc_cvv: The credit card CVV, e.g. "123"
301
313
  # * subscriber: (optional) A subscriber ID
314
+ # * connection: (optional) A specific Net::HTTP connection
302
315
  #
303
316
  # This will execute a #54 operation if a subscriber is specified, otherwise
304
317
  # a #4 operation.
@@ -316,7 +329,8 @@ module PayboxDirect
316
329
  wallet: nil,
317
330
  cc_expire:,
318
331
  cc_cvv:,
319
- subscriber: nil)
332
+ subscriber: nil,
333
+ connection: nil)
320
334
  raise ArgumentError, "amount: Expecting Numeric" unless amount.is_a? Numeric
321
335
  raise ArgumentError, "currency: Not supported" unless CURRENCIES.has_key? currency
322
336
  raise ArgumentError, "cc_expire: Expecting Date" unless cc_expire.is_a? Date
@@ -344,6 +358,7 @@ module PayboxDirect
344
358
  vars["REFABONNE"] = @@config.ref_prefix + subscriber
345
359
  end
346
360
  req = Request.new(vars)
361
+ req.http_connection = connection
347
362
  req.execute!
348
363
 
349
364
  if req.failed?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paybox_direct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kévin Lesénéchal