CnpOnline 12.3.0 → 12.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +12 -0
- data/Rakefile +1 -1
- data/lib/CnpBatchRequest.rb +17 -8
- data/lib/CnpOnline.rb +2 -0
- data/lib/CnpOnlineRequest.rb +30 -2
- data/lib/CnpRequest.rb +24 -4
- data/lib/CnpTransaction.rb +70 -7
- data/lib/CommManager.rb +185 -0
- data/lib/Communications.rb +7 -3
- data/lib/EnvironmentVariables.rb +8 -0
- data/lib/RequestTarget.rb +10 -0
- data/lib/XMLFields.rb +148 -11
- data/out/production/cnp-sdk-for-ruby/CnpBatchRequest.rb +787 -0
- data/out/production/cnp-sdk-for-ruby/CnpListeners.rb +265 -0
- data/out/production/cnp-sdk-for-ruby/CnpOnline.rb +65 -0
- data/out/production/cnp-sdk-for-ruby/CnpOnlineRequest.rb +370 -0
- data/out/production/cnp-sdk-for-ruby/CnpRequest.rb +670 -0
- data/out/production/cnp-sdk-for-ruby/CnpTransaction.rb +831 -0
- data/out/production/cnp-sdk-for-ruby/CnpXmlMapper.rb +71 -0
- data/out/production/cnp-sdk-for-ruby/CommManager.rb +185 -0
- data/out/production/cnp-sdk-for-ruby/Communications.rb +90 -0
- data/out/production/cnp-sdk-for-ruby/Configuration.rb +75 -0
- data/out/production/cnp-sdk-for-ruby/EnvironmentVariables.rb +33 -0
- data/out/production/cnp-sdk-for-ruby/RequestTarget.rb +10 -0
- data/out/production/cnp-sdk-for-ruby/Setup.rb +147 -0
- data/out/production/cnp-sdk-for-ruby/XMLFields.rb +2638 -0
- data/out/production/cnp-sdk-for-ruby/cacert.pem +3331 -0
- data/out/production/cnp-sdk-for-ruby/sample_batch_driver.rb +123 -0
- data/out/production/cnp-sdk-for-ruby/sample_driver.rb +49 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest1_base.rb +948 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest2_authenhanced.rb +577 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest3_authreversal.rb +190 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest4_echeck.rb +288 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest5_token.rb +209 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest_batchAll.rb +610 -0
- data/out/test/cnp-sdk-for-ruby/certification/ts_all.rb +33 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_activate.rb +133 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_activateReversal.rb +73 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_auth.rb +478 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_authReversal.rb +74 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_balanceInquiry.rb +107 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_batch.rb +264 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_batchStream.rb +154 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_cancelSubscription.rb +57 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_capture.rb +147 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_captureGivenAuth.rb +352 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_commManager.rb +302 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_configuration.rb +89 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_createPlan.rb +87 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_credit.rb +222 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_ctx.rb +124 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_deactivate.rb +105 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_deactivateReversal.rb +71 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_depositReversal.rb +70 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_echeckCredit.rb +179 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_echeckRedeposit.rb +117 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_echeckSale.rb +255 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_echeckVerification.rb +160 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_echeckVoid.rb +42 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_fastAccessFunding.rb +177 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_forceCapture.rb +272 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_fraudCheck.rb +76 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_giftCardAuthReversal.rb +72 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_giftCardCapture.rb +72 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_giftCardCredit.rb +69 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_litle_requests.rb +355 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_load.rb +108 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_loadReversal.rb +71 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_override.rb +68 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_pgp_cnp_requests.rb +295 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_queryTransaction.rb +154 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_refundReversal.rb +71 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_sale.rb +459 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_token.rb +137 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_translateToken.rb +203 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_unload.rb +108 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_unloadReversal.rb +71 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_updateCardValidationNumOnToken.rb +44 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_updatePlan.rb +61 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_updateSubscription.rb +80 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_wallet.rb +74 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_xmlfields.rb +429 -0
- data/out/test/cnp-sdk-for-ruby/functional/ts_all.rb +69 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleAUBatch.rb +244 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleBatchRequest.rb +791 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleOnlineRequest.rb +253 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleRequest.rb +317 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleTransaction.rb +426 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleXmlMapper.rb +139 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_activate.rb +92 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_activateReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_auth.rb +463 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_authReversal.rb +82 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_balanceInquiry.rb +52 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_cancelSubscription.rb +43 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_capture.rb +99 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_captureGivenAuth.rb +234 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_createPlan.rb +52 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_credit.rb +355 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_deactivate.rb +71 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_deactivateReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_depositReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_echeckCredit.rb +103 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_echeckRedeposit.rb +109 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_echeckSale.rb +107 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_echeckVerification.rb +74 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_echeckVoid.rb +54 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_forceCapture.rb +163 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_fraudCheck.rb +45 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_giftCardAuthReversal.rb +58 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_giftCardCapture.rb +57 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_giftCardCredit.rb +57 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_load.rb +53 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_loadReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_pgp_CnpRequest.rb +139 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_queryTransaction.rb +106 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_refundReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_sale.rb +551 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_token.rb +159 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_unload.rb +53 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_unloadReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_updateCardValidationNumOnToken.rb +80 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_updatePlan.rb +45 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_updateSubscription.rb +172 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_wallet.rb +262 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_xmlfields.rb +2930 -0
- data/out/test/cnp-sdk-for-ruby/unit/ts_unit.rb +67 -0
- data/test/certification/certTest2_authenhanced.rb +28 -27
- data/test/functional/test_batch.rb +106 -1
- data/test/functional/test_batchStream.rb +3 -2
- data/test/functional/test_captureGivenAuth.rb +24 -0
- data/test/functional/test_commManager.rb +302 -0
- data/test/functional/test_ctx.rb +124 -0
- data/test/functional/test_fastAccessFunding.rb +21 -0
- data/test/functional/test_forceCapture.rb +21 -0
- data/test/functional/test_xmlfields.rb +20 -1
- metadata +122 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d0c5b65177dba187096e279852c2b9e6d3b0dce579078a9753dec101b2cbe45
|
4
|
+
data.tar.gz: e3ac1e9a6d6885938c1edca85c7078a58ed4101fe4ad2b3d4c6f9c901141bb08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e7a5e5960163256e9130ae3c0750b62c1c05e7f62fa1baf103e9c9a4535d8dec3b1dbeca11aa8f1358f85ddde950ae548c99e1f0451399b61a875101193f057
|
7
|
+
data.tar.gz: fd4220cd5c0032a1f465af9606639c7d69549587d0fd045ed7bbeb36c80abedb7e229eb268c9aceff046f38c1bc475915dcd7ba03465ae5b08d3658b9f769f9d
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
==Version 12.8.0 (June 19, 2019)
|
2
|
+
* Feature: Full functions for XML v12.8
|
3
|
+
* Feature: added support for new type: tokenUrl
|
4
|
+
* Feature: add support for new type: echeckTypeCtx
|
5
|
+
* Feature: add 4 new types in cnpBatch: vendorCreditCtx, vendorDebitCtx, submerchantCreditCtx, submerchantDebitCtx
|
6
|
+
* Feature: add support for multiSite functionality
|
7
|
+
* Feature: add a new type: encryptedCcAccountNumberType
|
8
|
+
* Feature: add support for encryption on registerTokenRequestType
|
9
|
+
* Feature: add paymentAccountReferenceNumber in authorizationResponse and saleResponse
|
10
|
+
* Feature: add disbursementTypeEnum in fastAccessFunding
|
11
|
+
|
12
|
+
|
1
13
|
==Version 12.3.0 (May 10, 2018)
|
2
14
|
*Feature: Added LodgingInfo support
|
3
15
|
*Feature: Added TranslateToLowTokenValue support
|
data/Rakefile
CHANGED
@@ -32,7 +32,7 @@ spec = Gem::Specification.new do |s|
|
|
32
32
|
s.description = File.read(File.join(File.dirname(__FILE__), 'DESCRIPTION'))
|
33
33
|
s.requirements =
|
34
34
|
['Contact sdksupport@vantiv.com for more information']
|
35
|
-
s.version = '12.
|
35
|
+
s.version = '12.8.0'
|
36
36
|
s.author = 'Vantiv - eCommerce'
|
37
37
|
s.email = 'sdksupport@vantiv.com'
|
38
38
|
s.homepage = 'https://developer.vantiv.com/community/ecommerce/pages/sdks#jive_content_id_Ruby_SDK'
|
data/lib/CnpBatchRequest.rb
CHANGED
@@ -397,11 +397,11 @@ module CnpOnline
|
|
397
397
|
end
|
398
398
|
|
399
399
|
def submerchant_credit(options)
|
400
|
-
transaction = @cnp_txn.
|
400
|
+
transaction = @cnp_txn.submerchant_credit_ctx(options)
|
401
401
|
@txn_counts[:submerchantCredit][:numSubmerchantCredit] += 1
|
402
402
|
@txn_counts[:submerchantCredit][:submerchantCreditAmount] += options['amount'].to_i
|
403
403
|
|
404
|
-
add_txn_to_batch(transaction, :
|
404
|
+
add_txn_to_batch(transaction, :submerchantCreditCtx, options)
|
405
405
|
end
|
406
406
|
|
407
407
|
def reserve_credit(options)
|
@@ -413,11 +413,11 @@ module CnpOnline
|
|
413
413
|
end
|
414
414
|
|
415
415
|
def vendor_credit(options)
|
416
|
-
transaction = @cnp_txn.
|
416
|
+
transaction = @cnp_txn.vendor_credit_ctx(options)
|
417
417
|
@txn_counts[:vendorCredit][:numVendorCredit] += 1
|
418
418
|
@txn_counts[:vendorCredit][:vendorCreditAmount] += options['amount'].to_i
|
419
419
|
|
420
|
-
add_txn_to_batch(transaction, :
|
420
|
+
add_txn_to_batch(transaction, :vendorCreditCtx, options)
|
421
421
|
end
|
422
422
|
|
423
423
|
def physical_check_credit(options)
|
@@ -450,11 +450,11 @@ module CnpOnline
|
|
450
450
|
end
|
451
451
|
|
452
452
|
def submerchant_debit(options)
|
453
|
-
transaction = @cnp_txn.
|
453
|
+
transaction = @cnp_txn.submerchant_debit_ctx(options)
|
454
454
|
@txn_counts[:submerchantDebit][:numSubmerchantDebit] += 1
|
455
455
|
@txn_counts[:submerchantDebit][:submerchantDebitAmount] += options['amount'].to_i
|
456
456
|
|
457
|
-
add_txn_to_batch(transaction, :
|
457
|
+
add_txn_to_batch(transaction, :submerchantDebitCtx, options)
|
458
458
|
end
|
459
459
|
|
460
460
|
def reserve_debit(options)
|
@@ -466,11 +466,11 @@ module CnpOnline
|
|
466
466
|
end
|
467
467
|
|
468
468
|
def vendor_debit(options)
|
469
|
-
transaction = @cnp_txn.
|
469
|
+
transaction = @cnp_txn.vendor_debit_ctx(options)
|
470
470
|
@txn_counts[:vendorDebit][:numVendorDebit] += 1
|
471
471
|
@txn_counts[:vendorDebit][:vendorDebitAmount] += options['amount'].to_i
|
472
472
|
|
473
|
-
add_txn_to_batch(transaction, :
|
473
|
+
add_txn_to_batch(transaction, :vendorDebitCtx, options)
|
474
474
|
end
|
475
475
|
|
476
476
|
def physical_check_debit(options)
|
@@ -502,6 +502,10 @@ module CnpOnline
|
|
502
502
|
return @txn_counts
|
503
503
|
end
|
504
504
|
|
505
|
+
def get_num_transactions
|
506
|
+
return @txn_counts[:total]
|
507
|
+
end
|
508
|
+
|
505
509
|
def get_batch_name
|
506
510
|
return @path_to_batch
|
507
511
|
end
|
@@ -515,6 +519,7 @@ module CnpOnline
|
|
515
519
|
def add_txn_to_batch(transaction, type, options)
|
516
520
|
@txn_counts[:total] += 1
|
517
521
|
xml = transaction.save_to_xml.to_s
|
522
|
+
|
518
523
|
File.open(@txn_file, 'a+') do |file|
|
519
524
|
file.write(xml)
|
520
525
|
end
|
@@ -730,6 +735,10 @@ module CnpOnline
|
|
730
735
|
return @txn_counts
|
731
736
|
end
|
732
737
|
|
738
|
+
def get_num_transactions
|
739
|
+
return @txn_counts[:total]
|
740
|
+
end
|
741
|
+
|
733
742
|
def get_batch_name
|
734
743
|
return @path_to_batch
|
735
744
|
end
|
data/lib/CnpOnline.rb
CHANGED
@@ -54,6 +54,8 @@ require_relative 'CnpOnlineRequest'
|
|
54
54
|
require_relative 'CnpRequest'
|
55
55
|
require_relative 'CnpListeners'
|
56
56
|
require_relative 'Configuration'
|
57
|
+
require_relative 'CommManager'
|
58
|
+
require_relative 'RequestTarget'
|
57
59
|
|
58
60
|
#allows attribute values to be in double quotes, required by Cnp Server
|
59
61
|
REXML::Attribute.class_eval( %q^
|
data/lib/CnpOnlineRequest.rb
CHANGED
@@ -272,6 +272,31 @@ module CnpOnline
|
|
272
272
|
commit(transaction, :fraudCheck, options)
|
273
273
|
end
|
274
274
|
|
275
|
+
def vendor_credit(options)
|
276
|
+
transaction = @cnp_transaction.vendor_credit(options)
|
277
|
+
|
278
|
+
commit(transaction, :vendorCredit, options)
|
279
|
+
end
|
280
|
+
|
281
|
+
def vendor_debit(options)
|
282
|
+
transaction = @cnp_transaction.vendor_debit(options)
|
283
|
+
|
284
|
+
commit(transaction, :vendorDebit, options)
|
285
|
+
end
|
286
|
+
|
287
|
+
def submerchant_credit(options)
|
288
|
+
transaction = @cnp_transaction.submerchant_credit(options)
|
289
|
+
|
290
|
+
commit(transaction, :submerchantCredit, options)
|
291
|
+
end
|
292
|
+
|
293
|
+
def submerchant_debit(options)
|
294
|
+
transaction = @cnp_transaction.submerchant_debit(options)
|
295
|
+
|
296
|
+
commit(transaction, :submerchantDebit, options)
|
297
|
+
end
|
298
|
+
|
299
|
+
|
275
300
|
private
|
276
301
|
|
277
302
|
def add_account_info(transaction, options)
|
@@ -295,7 +320,7 @@ module CnpOnline
|
|
295
320
|
|
296
321
|
request.authentication = authentication
|
297
322
|
request.merchantId = get_merchant_id(options)
|
298
|
-
request.version = '12.
|
323
|
+
request.version = '12.8'
|
299
324
|
request.loggedInUser = get_logged_in_user(options)
|
300
325
|
request.xmlns = "http://www.vantivcnp.com/schema"
|
301
326
|
request.merchantSdk = get_merchant_sdk(options)
|
@@ -310,6 +335,7 @@ module CnpOnline
|
|
310
335
|
add_account_info(transaction, options)
|
311
336
|
request.send(:"#{type}=", transaction)
|
312
337
|
|
338
|
+
|
313
339
|
xml = request.save_to_xml.to_s
|
314
340
|
CnpXmlMapper.request(xml, @config_hash)
|
315
341
|
end
|
@@ -318,6 +344,7 @@ module CnpOnline
|
|
318
344
|
@config_hash['proxy_addr'] = options['proxy_addr'] unless options['proxy_addr'].nil?
|
319
345
|
@config_hash['proxy_port'] = options['proxy_port'] unless options['proxy_port'].nil?
|
320
346
|
@config_hash['url'] = options['url'] unless options['url'].nil?
|
347
|
+
@config_hash['multiSite'] = options['multiSite'] unless options['multiSite'].nil?
|
321
348
|
end
|
322
349
|
|
323
350
|
def get_merchant_id(options)
|
@@ -325,7 +352,7 @@ module CnpOnline
|
|
325
352
|
end
|
326
353
|
|
327
354
|
def get_merchant_sdk(options)
|
328
|
-
options['merchantSdk'] || 'Ruby;12.
|
355
|
+
options['merchantSdk'] || 'Ruby;12.8'
|
329
356
|
end
|
330
357
|
|
331
358
|
def get_report_group(options)
|
@@ -339,5 +366,6 @@ module CnpOnline
|
|
339
366
|
def get_logged_in_user(options)
|
340
367
|
options['loggedInUser'] || nil
|
341
368
|
end
|
369
|
+
|
342
370
|
end
|
343
371
|
end
|
data/lib/CnpRequest.rb
CHANGED
@@ -207,7 +207,7 @@ module CnpOnline
|
|
207
207
|
cnpRequest.authentication = authentication
|
208
208
|
cnpRequest.numBatchRequests = "0"
|
209
209
|
|
210
|
-
cnpRequest.version = '12.
|
210
|
+
cnpRequest.version = '12.8'
|
211
211
|
cnpRequest.xmlns = "http://www.vantivcnp.com/schema"
|
212
212
|
|
213
213
|
|
@@ -248,24 +248,31 @@ module CnpOnline
|
|
248
248
|
# +options+:: An (option) +Hash+ containing the username, password, and URL to attempt to sFTP to.
|
249
249
|
# If not provided, the values will be populated from the configuration file.
|
250
250
|
def send_to_cnp(path = (File.dirname(@path_to_batches)), options = {})
|
251
|
+
|
251
252
|
use_encryption = get_config(SFTP_USE_ENCRYPTION_CONFIG_NAME, options)
|
252
253
|
username = get_config(SFTP_USERNAME_CONFIG_NAME, options)
|
253
254
|
password = get_config(SFTP_PASSWORD_CONFIG_NAME, options)
|
254
255
|
delete_batch_files = get_config(SFTP_DELETE_BATCH_FILES_CONFIG_NAME, options)
|
255
256
|
url = get_config(SFTP_URL_CONFIG_NAME, options)
|
256
257
|
|
258
|
+
|
259
|
+
|
257
260
|
if(username == nil or password == nil or url == nil) then
|
258
261
|
raise ArgumentError, "You are not configured to use sFTP for batch processing. Please run /bin/Setup.rb again!"
|
259
262
|
end
|
260
263
|
path = path_to_requests = prepare_for_sftp(path, use_encryption)
|
261
264
|
|
265
|
+
|
262
266
|
if use_encryption
|
263
267
|
encrypted_path = path_to_requests + ENCRYPTED_PATH_DIR
|
264
268
|
encrypt_request_files(path, encrypted_path, options)
|
265
269
|
path_to_requests = encrypted_path
|
266
270
|
end
|
267
271
|
|
272
|
+
|
273
|
+
|
268
274
|
@responses_expected = upload_to_sftp(path_to_requests, url, username, password, use_encryption)
|
275
|
+
|
269
276
|
if delete_batch_files
|
270
277
|
delete_files_in_path(path_to_requests, /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}#{ENCRYPTED_FILE_SUFFIX}?#{SENT_FILE_SUFFIX}\z/)
|
271
278
|
if use_encryption
|
@@ -300,7 +307,7 @@ module CnpOnline
|
|
300
307
|
|
301
308
|
Dir.foreach(path) do |filename|
|
302
309
|
if((filename =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}\z/) != nil) then
|
303
|
-
begin
|
310
|
+
begin
|
304
311
|
socket = TCPSocket.open(url,port.to_i)
|
305
312
|
ssl_context = OpenSSL::SSL::SSLContext.new()
|
306
313
|
ssl_context.ssl_version = :SSLv23
|
@@ -349,6 +356,7 @@ module CnpOnline
|
|
349
356
|
response_path += ENCRYPTED_PATH_DIR
|
350
357
|
end
|
351
358
|
|
359
|
+
|
352
360
|
download_from_sftp(response_path, url, username, password)
|
353
361
|
|
354
362
|
if use_encryption
|
@@ -361,6 +369,7 @@ module CnpOnline
|
|
361
369
|
# for a transaction listener (see +DefaultCnpListener+). It may also include a batch listener and a
|
362
370
|
# custom path where response files from the server are located (if it is not provided, we'll guess the position)
|
363
371
|
def process_responses(args)
|
372
|
+
|
364
373
|
#the transaction listener is required
|
365
374
|
if(!args.has_key?(:transaction_listener)) then
|
366
375
|
raise ArgumentError, "The arguments hash must contain an entry for transaction listener!"
|
@@ -371,7 +380,7 @@ module CnpOnline
|
|
371
380
|
path_to_responses = args[:path_to_responses] ||= (File.dirname(@path_to_batches) + '/' + RESPONSE_PATH_DIR)
|
372
381
|
delete_batch_files = args[:deleteBatchFiles] ||= get_config(:deleteBatchFiles, args)
|
373
382
|
#deleteBatchFiles = get_config(:deleteBatchFiles, args)
|
374
|
-
|
383
|
+
|
375
384
|
Dir.foreach(path_to_responses) do |filename|
|
376
385
|
if ((filename =~ /#{RESPONSE_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}.asc#{RECEIVED_FILE_SUFFIX}\z/) != nil) then
|
377
386
|
process_response(path_to_responses + filename, transaction_listener, batch_listener)
|
@@ -392,6 +401,7 @@ module CnpOnline
|
|
392
401
|
# Note that this will om-nom-nom quite a bit of memory
|
393
402
|
def process_response(path_to_response, transaction_listener, batch_listener = nil)
|
394
403
|
reader = LibXML::XML::Reader.file(path_to_response)
|
404
|
+
|
395
405
|
reader.read # read into the root node
|
396
406
|
#if the response attribute is nil, we're dealing with an RFR and everything is a-okay
|
397
407
|
if reader.get_attribute('response') != "0" and reader.get_attribute('response') != nil then
|
@@ -459,7 +469,7 @@ module CnpOnline
|
|
459
469
|
authentication.password = get_config(:password, options)
|
460
470
|
|
461
471
|
cnp_request.authentication = authentication
|
462
|
-
cnp_request.version = '12.
|
472
|
+
cnp_request.version = '12.8'
|
463
473
|
cnp_request.xmlns = "http://www.vantivcnp.com/schema"
|
464
474
|
# cnp_request.id = options['sessionId'] #grab from options; okay if nil
|
465
475
|
cnp_request.numBatchRequests = @num_batch_requests
|
@@ -535,10 +545,14 @@ module CnpOnline
|
|
535
545
|
def upload_to_sftp(path_to_requests, url, username, password, use_encryption)
|
536
546
|
begin
|
537
547
|
responses_expected = 0
|
548
|
+
|
538
549
|
Net::SFTP.start(url, username, :password => password) do |sftp|
|
550
|
+
|
539
551
|
Dir.foreach(path_to_requests) do |filename|
|
540
552
|
if (filename =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}((#{ENCRYPTED_FILE_SUFFIX})?)\z/) != nil
|
553
|
+
|
541
554
|
new_filename = filename + '.prg'
|
555
|
+
|
542
556
|
File.rename(path_to_requests + filename, path_to_requests + new_filename)
|
543
557
|
# upload the file
|
544
558
|
sftp.upload!(path_to_requests + new_filename, '/inbound/' + new_filename)
|
@@ -554,6 +568,7 @@ module CnpOnline
|
|
554
568
|
end
|
555
569
|
end
|
556
570
|
end
|
571
|
+
|
557
572
|
return responses_expected
|
558
573
|
rescue Net::SSH::AuthenticationFailed
|
559
574
|
raise ArgumentError, "The sFTP credentials provided were incorrect. Try again!"
|
@@ -564,13 +579,18 @@ module CnpOnline
|
|
564
579
|
responses_grabbed = 0
|
565
580
|
begin
|
566
581
|
#wait until a response has a possibility of being there?
|
582
|
+
|
567
583
|
sleep(@POLL_DELAY)
|
584
|
+
|
568
585
|
time_begin = Time.now
|
569
586
|
Net::SFTP.start(url, username, :password => password) do |sftp|
|
570
587
|
while((Time.now - time_begin) < @RESPONSE_TIME_OUT && responses_grabbed < @responses_expected)
|
571
588
|
#sleep for 60 seconds, ¿no es bueno?
|
572
589
|
sleep(60)
|
590
|
+
|
591
|
+
|
573
592
|
sftp.dir.foreach('/outbound/') do |entry|
|
593
|
+
|
574
594
|
if (entry.name =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}((#{ENCRYPTED_FILE_SUFFIX})?).asc\z/) != nil then
|
575
595
|
response_filename = response_path + entry.name.gsub(REQUEST_FILE_PREFIX, RESPONSE_FILE_PREFIX) + RECEIVED_FILE_SUFFIX
|
576
596
|
sftp.download!('/outbound/' + entry.name, response_filename)
|
data/lib/CnpTransaction.rb
CHANGED
@@ -38,6 +38,11 @@ module CnpOnline
|
|
38
38
|
transaction.submerchantName = options['submerchantName']
|
39
39
|
transaction.fundsTransferId = options['fundsTransferId']
|
40
40
|
transaction.amount = options['amount']
|
41
|
+
if(options['disbursementType'])
|
42
|
+
transaction.disbursementType = options['disbursementType']
|
43
|
+
else
|
44
|
+
transaction.disbursementType = "VMD"
|
45
|
+
end
|
41
46
|
if(options['card'])
|
42
47
|
transaction.card = Card.from_hash(options)
|
43
48
|
end
|
@@ -372,11 +377,16 @@ module CnpOnline
|
|
372
377
|
def register_token_request(options)
|
373
378
|
transaction = RegisterTokenRequest.new
|
374
379
|
|
375
|
-
transaction.
|
376
|
-
transaction.
|
377
|
-
transaction.
|
378
|
-
transaction.
|
379
|
-
transaction.
|
380
|
+
transaction.encryptionKeyId = options['encryptionKeyId']
|
381
|
+
transaction.orderId = options['orderId']
|
382
|
+
transaction.mpos = Mpos.from_hash(options,'mpos')
|
383
|
+
transaction.accountNumber = options['accountNumber']
|
384
|
+
transaction.echeckForToken = EcheckForToken.from_hash(options)
|
385
|
+
transaction.paypageRegistrationId = options['paypageRegistrationId']
|
386
|
+
transaction.applepay = Applepay.from_hash(options,'applepay')
|
387
|
+
transaction.encryptedAccountNumber = options['encryptedAccountNumber']
|
388
|
+
transaction.cardValidationNum = options['cardValidationNum']
|
389
|
+
transaction.encryptedCardValidationNum = options['encryptedCardValidationNum']
|
380
390
|
add_account_info(transaction, options)
|
381
391
|
return transaction
|
382
392
|
end
|
@@ -507,19 +517,45 @@ module CnpOnline
|
|
507
517
|
return transaction
|
508
518
|
end
|
509
519
|
|
520
|
+
def submerchant_credit_ctx(options)
|
521
|
+
transaction = SubmerchantCredit.new
|
522
|
+
transaction.fundingSubmerchantId = options['fundingSubmerchantId']
|
523
|
+
transaction.submerchantName = options['submerchantName']
|
524
|
+
transaction.fundsTransferId = options['fundsTransferId']
|
525
|
+
transaction.amount = options['amount']
|
526
|
+
transaction.customIdentifier = options['customIdentifier']
|
527
|
+
transaction.accountInfo = EcheckCtx.from_hash(options,'accountInfo')
|
528
|
+
add_account_info(transaction, options)
|
529
|
+
|
530
|
+
return transaction
|
531
|
+
end
|
532
|
+
|
510
533
|
def vendor_credit(options)
|
511
534
|
transaction = VendorCredit.new
|
512
535
|
transaction.fundingSubmerchantId = options['fundingSubmerchantId']
|
513
536
|
transaction.vendorName = options['vendorName']
|
514
537
|
transaction.fundsTransferId = options['fundsTransferId']
|
515
538
|
transaction.amount = options['amount']
|
516
|
-
|
539
|
+
|
517
540
|
transaction.accountInfo = Echeck.from_hash(options,'accountInfo')
|
518
541
|
add_account_info(transaction, options)
|
519
542
|
|
520
543
|
return transaction
|
521
544
|
end
|
522
545
|
|
546
|
+
def vendor_credit_ctx(options)
|
547
|
+
transaction = VendorCreditCtx.new
|
548
|
+
transaction.fundingSubmerchantId = options['fundingSubmerchantId']
|
549
|
+
transaction.vendorName = options['vendorName']
|
550
|
+
transaction.fundsTransferId = options['fundsTransferId']
|
551
|
+
transaction.amount = options['amount']
|
552
|
+
|
553
|
+
transaction.accountInfo = EcheckCtx.from_hash(options,'accountInfo')
|
554
|
+
add_account_info(transaction, options)
|
555
|
+
|
556
|
+
return transaction
|
557
|
+
end
|
558
|
+
|
523
559
|
def payFac_credit(options)
|
524
560
|
transaction = PayFacCredit.new
|
525
561
|
transaction.fundingSubmerchantId = options['fundingSubmerchantId']
|
@@ -579,7 +615,7 @@ module CnpOnline
|
|
579
615
|
|
580
616
|
|
581
617
|
def submerchant_debit(options)
|
582
|
-
transaction =
|
618
|
+
transaction = SubmerchantDebitCtx.new
|
583
619
|
transaction.fundingSubmerchantId = options['fundingSubmerchantId']
|
584
620
|
transaction.submerchantName = options['submerchantName']
|
585
621
|
transaction.fundsTransferId = options['fundsTransferId']
|
@@ -591,6 +627,19 @@ module CnpOnline
|
|
591
627
|
return transaction
|
592
628
|
end
|
593
629
|
|
630
|
+
def submerchant_debit_ctx(options)
|
631
|
+
transaction = SubmerchantDebitCtx.new
|
632
|
+
transaction.fundingSubmerchantId = options['fundingSubmerchantId']
|
633
|
+
transaction.submerchantName = options['submerchantName']
|
634
|
+
transaction.fundsTransferId = options['fundsTransferId']
|
635
|
+
transaction.amount = options['amount']
|
636
|
+
transaction.customIdentifier = options['customIdentifier']
|
637
|
+
transaction.accountInfo = EcheckCtx.from_hash(options,'accountInfo')
|
638
|
+
add_account_info(transaction, options)
|
639
|
+
|
640
|
+
return transaction
|
641
|
+
end
|
642
|
+
|
594
643
|
def vendor_debit(options)
|
595
644
|
transaction = VendorDebit.new
|
596
645
|
transaction.fundingSubmerchantId = options['fundingSubmerchantId']
|
@@ -604,6 +653,19 @@ module CnpOnline
|
|
604
653
|
return transaction
|
605
654
|
end
|
606
655
|
|
656
|
+
def vendor_debit_ctx(options)
|
657
|
+
transaction = VendorDebitCtx.new
|
658
|
+
transaction.fundingSubmerchantId = options['fundingSubmerchantId']
|
659
|
+
transaction.vendorName = options['vendorName']
|
660
|
+
transaction.fundsTransferId = options['fundsTransferId']
|
661
|
+
transaction.amount = options['amount']
|
662
|
+
|
663
|
+
transaction.accountInfo = EcheckCtx.from_hash(options,'accountInfo')
|
664
|
+
add_account_info(transaction, options)
|
665
|
+
|
666
|
+
return transaction
|
667
|
+
end
|
668
|
+
|
607
669
|
def payFac_debit(options)
|
608
670
|
transaction = PayFacDebit.new
|
609
671
|
transaction.fundingSubmerchantId = options['fundingSubmerchantId']
|
@@ -764,5 +826,6 @@ module CnpOnline
|
|
764
826
|
#options['reportGroup'] || @config_hash['default_report_group']
|
765
827
|
options['reportGroup']
|
766
828
|
end
|
829
|
+
|
767
830
|
end
|
768
831
|
end
|