bankserv 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/.gitignore +6 -0
  2. data/.rvmrc +1 -0
  3. data/Gemfile +16 -0
  4. data/Rakefile +8 -0
  5. data/bankserv.gemspec +31 -0
  6. data/config.ru +7 -0
  7. data/lib/bankserv.rb +48 -0
  8. data/lib/bankserv/account_holder_verification.rb +90 -0
  9. data/lib/bankserv/bank_account.rb +19 -0
  10. data/lib/bankserv/configuration.rb +67 -0
  11. data/lib/bankserv/credit.rb +70 -0
  12. data/lib/bankserv/debit.rb +94 -0
  13. data/lib/bankserv/eft.rb +83 -0
  14. data/lib/bankserv/engine.rb +183 -0
  15. data/lib/bankserv/engine/engine_configuration.rb +12 -0
  16. data/lib/bankserv/engine/engine_process.rb +3 -0
  17. data/lib/bankserv/request.rb +27 -0
  18. data/lib/bankserv/transaction.rb +22 -0
  19. data/lib/bankserv/transmission/document.rb +43 -0
  20. data/lib/bankserv/transmission/input_document.rb +84 -0
  21. data/lib/bankserv/transmission/output_document.rb +27 -0
  22. data/lib/bankserv/transmission/record.rb +13 -0
  23. data/lib/bankserv/transmission/reply_document.rb +27 -0
  24. data/lib/bankserv/transmission/set.rb +120 -0
  25. data/lib/bankserv/transmission/set/account_holder_verification.rb +81 -0
  26. data/lib/bankserv/transmission/set/account_holder_verification_output.rb +17 -0
  27. data/lib/bankserv/transmission/set/credit.rb +44 -0
  28. data/lib/bankserv/transmission/set/debit.rb +44 -0
  29. data/lib/bankserv/transmission/set/document.rb +45 -0
  30. data/lib/bankserv/transmission/set/eft.rb +228 -0
  31. data/lib/bankserv/transmission/set/eft_output.rb +12 -0
  32. data/lib/bankserv/transmission/set/eft_redirect.rb +18 -0
  33. data/lib/bankserv/transmission/set/eft_unpaid.rb +18 -0
  34. data/lib/bankserv/transmission/set/reply.rb +47 -0
  35. data/lib/bankserv/transmission/statement.rb +46 -0
  36. data/lib/bankserv/version.rb +3 -0
  37. data/lib/config/ahv.yml +9 -0
  38. data/lib/core_extensions.rb +37 -0
  39. data/lib/generators/active_record/bankserv_generator.rb +30 -0
  40. data/lib/generators/active_record/templates/migration.rb +141 -0
  41. data/spec/examples/ahv_input_file.txt +7 -0
  42. data/spec/examples/ahv_output_file.txt +7 -0
  43. data/spec/examples/credit_eft_input.txt +166 -0
  44. data/spec/examples/debit_eft_input_file.txt +20 -0
  45. data/spec/examples/eft_input_with_2_sets.txt +8 -0
  46. data/spec/examples/eft_output_file.txt +35 -0
  47. data/spec/examples/host2host/tmp.log +1 -0
  48. data/spec/examples/reply/rejected_transmission.txt +7 -0
  49. data/spec/examples/reply/reply_file.txt +5 -0
  50. data/spec/examples/statement4_unpacked.dat +51 -0
  51. data/spec/examples/tmp/OUTPUT0412153500.txt +35 -0
  52. data/spec/examples/tmp/REPLY0412153000.txt +5 -0
  53. data/spec/factories.rb +90 -0
  54. data/spec/internal/config/database.yml.sample +3 -0
  55. data/spec/internal/config/routes.rb +3 -0
  56. data/spec/internal/db/schema.rb +138 -0
  57. data/spec/internal/log/.gitignore +1 -0
  58. data/spec/internal/public/favicon.ico +0 -0
  59. data/spec/lib/bankserv/account_holder_verification_spec.rb +104 -0
  60. data/spec/lib/bankserv/configuration_spec.rb +34 -0
  61. data/spec/lib/bankserv/core_ext_spec.rb +43 -0
  62. data/spec/lib/bankserv/credit_spec.rb +92 -0
  63. data/spec/lib/bankserv/debit_spec.rb +187 -0
  64. data/spec/lib/bankserv/engine/engine_spec.rb +142 -0
  65. data/spec/lib/bankserv/transaction_spec.rb +32 -0
  66. data/spec/lib/bankserv/transmission/input_document_spec.rb +207 -0
  67. data/spec/lib/bankserv/transmission/output_document_spec.rb +210 -0
  68. data/spec/lib/bankserv/transmission/reply_document_spec.rb +117 -0
  69. data/spec/lib/bankserv/transmission/set/account_holder_verification_spec.rb +108 -0
  70. data/spec/lib/bankserv/transmission/set/credit_spec.rb +96 -0
  71. data/spec/lib/bankserv/transmission/set/debit_spec.rb +103 -0
  72. data/spec/lib/bankserv/transmission/statement_spec.rb +109 -0
  73. data/spec/spec_helper.rb +28 -0
  74. data/spec/support/helpers.rb +207 -0
  75. metadata +223 -0
@@ -0,0 +1,20 @@
1
+ 000T2004052400010LDC USER 10 AFRICA (PTY) 000062100000
2
+ 001T0495340405240405310405240405270000010037CORPSSV
3
+ 001T5063200504053538939953400000163200501019611899100000001000040524440000ALIMITTST SPP 1040524 01 HENNIE DU TOIT 00000000000000000000 21
4
+ 001T5063200504053538939953400000263200501019801892100000002000040524440000ALIMITTST SPP 1040524 02 TYRONE DREYDEN 00000000000000000000 21
5
+ 001T5063200504053538939953400000363200501021131896100000003000040524440000ALIMITTST SPP 1040524 03 KEITH MEIKLEJOHN 00000000000000000000 21
6
+ 001T5063200504053538939953400000463200501022131890100000004000040524440000ALIMITTST SPP 1040524 04 CHRISTO SPIES 00000000000000000000 21
7
+ 001T5063200504053538939953400000563200501057401890100006005000040524440000ALIMITTST SPP 1040524 05 DENISE RETIEF 00000000000000000000 21
8
+ 001T5063200504053538939953400000663200518000010304100003006000040524440000ALIMITTST SPP 1040524 06 PETER HAUPT 00000000000000000000 21
9
+ 001T5063200504053538939953400000763200501020861726100007007000040524440000ALIMITTST SPP 1040524 07 HADLEY RAW 00000000000000000000 21
10
+ 001T5263200504053538939953400000863200504053538939100016028000040524100000ALIMITTST CONTRA1040524 08
11
+ 001T5063200501004651894953400000963200501006221897100000010000040525440000ALIMITTST SPP 2040525 01 HENNIE DU TOIT 00000000000000000000 21
12
+ 001T5063200501004651894953400001063200501006241898100000020000040525440000ALIMITTST SPP 2040525 02 TYRONE DREYDEN 00000000000000000000 21
13
+ 001T5063200501004651894953400001163200501009831891100004030000040525440000ALIMITTST SPP 2040525 03 KEITH MEIKLEJOHN 00000000000000000000 21
14
+ 001T5063200501004651894953400001263200501010000609100000040000040525440000ALIMITTST SPP 2040525 04 CHRISTO SPIES 00000000000000000000 21
15
+ 001T5063200501004651894953400001363200501019141892100000050000040525440000ALIMITTST SPP 2040525 05 DENISE RETIEF 00000000000000000000 21
16
+ 001T5063200501004651894953400001463200501019591898100000060000040525440000ALIMITTST SPP 2040525 06 PETER HAUPT 00000000000000000000 21
17
+ 001T5063200501004651894953400001563200501020861726100000070000040525440000ALIMITTST SPP 2040525 07 HADLEY RAW 00000000000000000000 21
18
+ 001T5263200501004651894953400001663200501004651894100004280000040525100000ALIMITTST CONTRA2040525 08
19
+ 001T929534000001000016040524040527000014000002000002000020308000000020308000036311034141
20
+ 999T000000020
@@ -0,0 +1,8 @@
1
+ 000T2004052400010LDC USER 10 AFRICA (PTY) 000062100000
2
+ 001T0495340405240405310405240405270000010037CORPSSV
3
+ 001T5063200504053538939953400000163200501019611899100000001000040524440000ALIMITTST SPP 1040524 01 HENNIE DU TOIT 00000000000000000000 21
4
+ 001T929534000001000016040524040527000014000002000002000020308000000020308000036311034141
5
+ 001T0495340405240405310405240405270000010038CORPSSV
6
+ 001T5063200504053538939953400000263200501019611899100000001000040524440000ALIMITTST SPP 1040524 01 HENNIE DU TOIT 00000000000000000000 21
7
+ 001T929534000001000016040524040527000014000002000002000020308000000020308000036311034141
8
+ 999T000000020
@@ -0,0 +1,35 @@
1
+ 000T2001012100000LDC CLIENT NAME 30 CHARACTERS 000010000099
2
+ 010T0429000143601
3
+ 016T042963200500000012345678900120010119
4
+ 017T5020010116000074052749000000040566359400000007627DEBIT1 000055000000040566256402000000
5
+ 017T5020010116000073052749000000040566226300000009964DEBIT2 000055000000040566329302000000
6
+ 018T0000000020000000000000000008113258570000000001759100000000000000
7
+ 011T042963200500000012345678900120001227
8
+ 013T5020001220005815250545000008200342991800000010851DEBIT3 03000000000000
9
+ 014T0000000010000000000000000820034299180000000001085100000000000000
10
+ 011T042963200500000012345678900120010116
11
+ 013T5020010111003250256005000004330201928300000031700DEBIT4 00400000000000
12
+ 013T5020010111003378270124000005309031776600000013755DEBIT5 00200000000000
13
+ 014T0000000020000000000000000963923370490000000004545500000000000000
14
+ 011T042963200500000012345678900120010119
15
+ 013T5020010116000120720026000000012072190400000022935DEBIT6 00200000000000
16
+ 013T5020010116000031045626000000025365491300000015198DEBIT7 02682502000000
17
+ 013T5020010116000053045626000000025568185800000012720DEBIT8 00200000000000
18
+ 013T5020010116000025045626000000025548681100000009345DEBIT9 00200000000000
19
+ 013T5020010116000045045626000000062591203200000013420DEBIT10 00200000000000
20
+ 013T5020010116000015045626000000062531626300000015300DEBIT11 00200000000000
21
+ 013T5020010116000023045626000000263838389700000007790DEBIT12 00200000000000
22
+ 013T5020010116000010045626000000063895811800000019698DEBIT13 01200000000000
23
+ 013T5020010116000026045626000000065745574900000005000DEBIT14 00200000000000
24
+ 013T5020010116000032045626000000065749860500000010420DEBIT15 00200000000000
25
+ 013T5020010116000029045626000000065746793400000010000DEBIT16 03281503000000
26
+ 013T5020010116000044045626000000065749227400000015000DEBIT17 00200000000000
27
+ 013T5020010116000033045626000000065749255600000010000DEBIT18 02600000000000
28
+ 013T5020010116000011045626000000067750130100000016150DEBIT19 00200000000000
29
+ 013T5020010116000027045626000000065555672200000012300DEBIT20 00200000000000
30
+ 013T5020010116000008045626000000065392702400000020000DEBIT21 00200000000000
31
+ 013T5020010116000064050621000000063771417500000006287DEBIT22 00200000000000
32
+ 013T5020010116000075052749000000013448119800000008954DEBIT23 01200000000000
33
+ 014T0000000180000000000000000114607033340000000023051700000000000000
34
+ 019T0000000230000000000000001306668061580000000030441400000000000000
35
+ 999T000000035
@@ -0,0 +1 @@
1
+ Here for git.
@@ -0,0 +1,7 @@
1
+ 000T2004052400000LCD USER 10 AFRICA (PTY) 000012300010
2
+ 900T000TRANSMISSION 00010-0000621-REJECTED
3
+ 901T000-12345-HI THIS IS ERROR
4
+ 900T001ACB USER SET 9534-0000037-000016-REJECTED
5
+ 900T001ACB USER SET 9534-0000038-000032-REJECTED
6
+ 901T001 1234/0000038/000002-12345-HI THIS IS REJECTED MESSAGE
7
+ 999T000000005
@@ -0,0 +1,5 @@
1
+ 000T2004052400000LCD USER 10 AFRICA (PTY) 000012300010
2
+ 900T000TRANSMISSION 00010-0000621-ACCEPTED
3
+ 900T001ACB USER SET 9534-0000037-000016-ACCEPTED
4
+ 900T001ACB USER SET 9534-0000038-000032-ACCEPTED
5
+ 999T000000005
@@ -0,0 +1,51 @@
1
+ 00000000000000000000P2002111903174TEST 03174 000000295
2
+ 1000000000401111180900264000012002111800000000 +000000000000000+00000000000000000 AA0A 000000295
3
+ 2000000000401111180900264000012002111820021118000000000000103899+000000002630670+00000000002630670ACB CREDIT SETTLEMENT BASGHW GP HEALTH000212608 FN71ACC +000000000 +000000000+000000000 000012533000000004000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
4
+ 2000000000401111180900264000012002111820021118000000000000056571+000000000649363+00000000003280033CREDIT TRANSFER CASHFOCUS 440151586 CF71CFAC+000000000 +000000000+000000000 000012537000000006000000000000000000000000000000000000000 0510 000000000000000 0000000000000000 0000000000000000000 0000002955158
5
+ 2000000000401111180900264000012002111820021118000000000000056572+000000000305575+00000000003585608CREDIT TRANSFER CASHFOCUS 440151579 CF71CFAC+000000000 +000000000+000000000 000012538000000008000000000000000000000000000000000000000 0510 000000000000000 0000000000000000 0000000000000000000 0000002955158
6
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000057866+00000000003643474DEPOSIT STRYDOMPAR 440144444 FN71QD +000000000 +000000000+000000000 000012539000000010000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
7
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000031699+00000000003675173DEPOSIT STRYDOMPAR 440144437 FN71QD +000000000 +000000000+000000000 000012540000000012000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
8
+ 2000000000401111180900264000012002111820021118000000000000000000+000000001141155+00000000004816328DEPOSIT KNYSNA 440102250 FN71QD +000000000 +000000000+000000000 000012542000000014000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
9
+ 2000000000401111180900264000012002111820021118000000000000000000+000000001524408+00000000006340736DEPOSIT FOURWAYS 440066010 FN71QD +000000000 +000000000+000000000 000012544000000016000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
10
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000139741+00000000006480477DEPOSIT EASTGATE 440015738 FN71QD +000000000 +000000000+000000000 000012545000000018000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
11
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000183475+00000000006663952DEPOSIT EASTGATE 440015720 FN71QD +000000000 +000000000+000000000 000012546000000020000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
12
+ 2000000000401111180900264000012002111820021118000000000000000000+000000003650595+00000000010314547DEPOSIT RSEBNK CEN 440072670 FN71QD +000000000 +000000000+000000000 000012548000000022000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
13
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000226313+00000000010540860DEPOSIT PROTEA PAR 440081667 FN71QD +000000000 +000000000+000000000 000012549000000024000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
14
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000172368+00000000010713228DEPOSIT PROTEA PAR 440086150 FN71QD +000000000 +000000000+000000000 000012550000000026000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
15
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000404852+00000000011118080DEPOSIT EST RAND M 440131727 FN71QD +000000000 +000000000+000000000 000012552000000028000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
16
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000246492+00000000011364572DEPOSIT EST RAND M 440131727 FN71QD +000000000 +000000000+000000000 000012553000000030000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
17
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000323331+00000000011687903DEPOSIT EASTGATE 440080127 FN71QD +000000000 +000000000+000000000 000012554000000032000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
18
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000128638+00000000011816541DEPOSIT HYDE PARK 440022703 FN71QD +000000000 +000000000+000000000 000012555000000034000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
19
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000190220+00000000012006761DEPOSIT HYDE PARK 440022728 FN71QD +000000000 +000000000+000000000 000012556000000002000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
20
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000054538+00000000012061299DEPOSIT HYDE PARK 440022710 FN71QD +000000000 +000000000+000000000 000012557000000004000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
21
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000016872+00000000012078171TRANSFER FROM PRIMROSE 440074532 FN71TXCR+000000000 +000000000+000000000 000012558000000006000000000000000000000000000000000000000 4240 000000000000000 0000000000000000 0000000000000000000 0000002955151
22
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000300000+00000000012378171DEPOSIT LYTTELTON 440149650 FN71QD +000000000 +000000000+000000000 000012559000000008000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
23
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000340000+00000000012718171DEPOSIT LYTTELTON 440149643 FN71QD +000000000 +000000000+000000000 000012560000000010000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
24
+ 2000000000401111180900264000022002111820021118000000000000056605+000000000150000+00000000012868171CREDIT TRANSFER CASHFOCUS 440012751 CF71CFAC+000000000 +000000000+000000000 000012561000000012000000000000000000000000000000000000000 0510 000000000000000 0000000000000000 0000000000000000000 0000002955158
25
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000123750+00000000012991921ACB CREDIT SETTLEMENT ABSA BANK 440077283 FN71ACC +000000000 +000000000+000000000 000012562000000014000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
26
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000033744+00000000013025665ACB CREDIT SETTLEMENT ABSA BANK 440077290 FN71ACC +000000000 +000000000+000000000 000012563000000016000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
27
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000107274+00000000013132939ACB CREDIT SETTLEMENT ABSA BANK 440077300 FN71ACC +000000000 +000000000+000000000 000012564000000018000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
28
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000025308+00000000013158247ACB CREDIT SETTLEMENT ABSA BANK 440077269 FN71ACC +000000000 +000000000+000000000 000012565000000020000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
29
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000130788+00000000013289035ACB CREDIT SETTLEMENT ABSA BANK 440077276 FN71ACC +000000000 +000000000+000000000 000012566000000022000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
30
+ 2000000000401111180900264000022002111820021118000000000000016406+000000000017898+00000000013306933ACB CREDIT SETTLEMENT 440085319 * FN71ACC +000000000 +000000000+000000000 000012568000000024000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
31
+ 2000000000401111180900264000022002111820021118000000000000019087+000000000118814+00000000013425747ACB CREDIT SETTLEMENT 440071299 STAND 146 KYA SAND FN71ACC +000000000 +000000000+000000000 000012569000000026000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
32
+ 2000000000401111180900264000022002111820021118000000000000019088+000000000090493+00000000013516240ACB CREDIT SETTLEMENT 440071281 STAND 146 KYA SAND FN71ACC +000000000 +000000000+000000000 000012570000000028000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
33
+ 2000000000401111180900264000022002111820021118000000000000016407+000000000064389+00000000013580629ACB CREDIT SETTLEMENT 440085326 * FN71ACC +000000000 +000000000+000000000 000012571000000030000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
34
+ 2000000000401111180900264000022002111820021118000000000000019752+000000000391562+00000000013972191ACB CREDIT SETTLEMENT 440136637-FEDBOND FN71ACC +000000000 +000000000+000000000 000012572000000032000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
35
+ 2000000000401111180900264000022002111820021118000000000000010211+000000001077862+00000000015050053ACB CREDIT SETTLEMENT 440141203 * FN71ACC +000000000 +000000000+000000000 000012573000000034000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
36
+ 2000000000401111180900264000032002111820021118000000000000019158+000000002000000+00000000017050053ACB CREDIT SETTLEMENT 440062135 * FN71ACC +000000000 +000000000+000000000 000012574000000002000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
37
+ 2000000000401111180900264000032002111820021118000000000000001492+000000001389660+00000000018439713ACB CREDIT SETTLEMENT FNBPAYMENT 440141556 FN71ACC +000000000 +000000000+000000000 000012575000000004000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
38
+ 2000000000401111180900264000032002111820021118000000000000011274+000000000012426+00000000018452139ACB CREDIT SETTLEMENT 2073913575**440176534 PRIMEGROFN71ACC +000000000 +000000000+000000000 000012576000000006000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
39
+ 2000000000401111180900264000032002111820021118000000000000006888+000000000149270+00000000018601409ACB CREDIT SETTLEMENT 2073888701COLLIERS RMS 000580FN71ACC +000000000 +000000000+000000000 000012577000000008000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
40
+ 2000000000401111180900264000032002111820021118000000000000006889+000000000788054+00000000019389463ACB CREDIT SETTLEMENT 2073888702COLLIERS RMS 000581FN71ACC +000000000 +000000000+000000000 000012578000000010000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
41
+ 2000000000401111180900264000032002111820021118000000000000011273+000000000498351+00000000019887814ACB CREDIT SETTLEMENT 2073913574**440131283 PRIMEGROFN71ACC +000000000 +000000000+000000000 000012579000000012000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
42
+ 2000000000401111180900264000032002111820021118000000000000001108+000000000259414+00000000020147228ACB CREDIT SETTLEMENT 440064559 FN71ACC +000000000 +000000000+000000000 000012580000000014000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
43
+ 2000000000401111180900264000032002111820021118000000000000004714+000000000017898+00000000020165126ACB CREDIT SETTLEMENT CRONJE 440107442 GS CRFN71ACC +000000000 +000000000+000000000 000012581000000016000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
44
+ 2000000000401111180900264000032002111820021118000000000000004713+000000000303949+00000000020469075ACB CREDIT SETTLEMENT CRONJE 440107450 GS CRFN71ACC +000000000 +000000000+000000000 000012582000000018000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
45
+ 2000000000401111180900264000032002111820021118000000000000002512+000000000085000+00000000020554075ACB CREDIT SETTLEMENT ROBINSON A/C440110004 FN71ACC +000000000 +000000000+000000000 000012583000000020000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
46
+ 2000000000401111180900264000032002111820021118081409096000000000-000000000001000+00000000020553075BANK DEBIT 81409096 HEADOFFICE FN71CHJ -000000175 -000000020+000000000 000012584000000022000000000000000000000000000000000000000 0790 000000000000000 0000000000000000 0000000000000000000 0000002950505
47
+ 2000000000401111180900264000032002111820021118081409306000000000-000000000001000+00000000020552075BANK DEBIT 81409306 HEADOFFICE FN71CHJ -000000175 -000000020+000000000 000012585000000023000000000000000000000000000000000000000 0790 000000000000000 0000000000000000 0000000000000000000 0000002950505
48
+ 2000000000401111180900264000032002111820021118000000000000000433-000000020552075+00000000000000000SWEEPING CASHFOCUS 4054394859 TR# 433 CF71FS4D+000000000 -000000020+000000000 000012586000000024000000000000000000000000000000000000000 1840 000000000000000 0000000000000000 0000000000000000000 0000002950521
49
+ 89999999999999999999 +00000000000000000 0000000048 000000295
50
+ 99999999999999999999P20021119 0000000050 000000295
51
+ 
@@ -0,0 +1,35 @@
1
+ 000T2001012100000LDC CLIENT NAME 30 CHARACTERS 000010000099
2
+ 010T0429000143601
3
+ 016T042963200500000012345678900120010119
4
+ 017T5020010116000074052749000000040566359400000007627DEBIT1 000055000000040566256402000000
5
+ 017T5020010116000073052749000000040566226300000009964DEBIT2 000055000000040566329302000000
6
+ 018T0000000020000000000000000008113258570000000001759100000000000000
7
+ 011T042963200500000012345678900120001227
8
+ 013T5020001220005815250545000008200342991800000010851DEBIT3 03000000000000
9
+ 014T0000000010000000000000000820034299180000000001085100000000000000
10
+ 011T042963200500000012345678900120010116
11
+ 013T5020010111003250256005000004330201928300000031700DEBIT4 00400000000000
12
+ 013T5020010111003378270124000005309031776600000013755DEBIT5 00200000000000
13
+ 014T0000000020000000000000000963923370490000000004545500000000000000
14
+ 011T042963200500000012345678900120010119
15
+ 013T5020010116000120720026000000012072190400000022935DEBIT6 00200000000000
16
+ 013T5020010116000031045626000000025365491300000015198DEBIT7 02682502000000
17
+ 013T5020010116000053045626000000025568185800000012720DEBIT8 00200000000000
18
+ 013T5020010116000025045626000000025548681100000009345DEBIT9 00200000000000
19
+ 013T5020010116000045045626000000062591203200000013420DEBIT10 00200000000000
20
+ 013T5020010116000015045626000000062531626300000015300DEBIT11 00200000000000
21
+ 013T5020010116000023045626000000263838389700000007790DEBIT12 00200000000000
22
+ 013T5020010116000010045626000000063895811800000019698DEBIT13 01200000000000
23
+ 013T5020010116000026045626000000065745574900000005000DEBIT14 00200000000000
24
+ 013T5020010116000032045626000000065749860500000010420DEBIT15 00200000000000
25
+ 013T5020010116000029045626000000065746793400000010000DEBIT16 03281503000000
26
+ 013T5020010116000044045626000000065749227400000015000DEBIT17 00200000000000
27
+ 013T5020010116000033045626000000065749255600000010000DEBIT18 02600000000000
28
+ 013T5020010116000011045626000000067750130100000016150DEBIT19 00200000000000
29
+ 013T5020010116000027045626000000065555672200000012300DEBIT20 00200000000000
30
+ 013T5020010116000008045626000000065392702400000020000DEBIT21 00200000000000
31
+ 013T5020010116000064050621000000063771417500000006287DEBIT22 00200000000000
32
+ 013T5020010116000075052749000000013448119800000008954DEBIT23 01200000000000
33
+ 014T0000000180000000000000000114607033340000000023051700000000000000
34
+ 019T0000000230000000000000001306668061580000000030441400000000000000
35
+ 999T000000035
@@ -0,0 +1,5 @@
1
+ 000T2004052400000LCD USER 10 AFRICA (PTY) 000012300010
2
+ 900T000TRANSMISSION 00010-0000621-ACCEPTED
3
+ 900T001ACB USER SET 9534-0000037-000016-ACCEPTED
4
+ 900T001ACB USER SET 9534-0000038-000032-ACCEPTED
5
+ 999T000000005
@@ -0,0 +1,90 @@
1
+ FactoryGirl.define do
2
+
3
+ Bankserv::Configuration.create! active: true, client_code: "234234", client_name: "RENTCONN", user_code: "054324", department_code: "A12345", user_generation_number: 10
4
+
5
+ factory :configuration, :class => "Bankserv::Configuration" do
6
+ active true
7
+ client_code { Faker::Base::numerify('#####') }
8
+ client_name { Faker::Base::letterify('???????????????') }
9
+ user_code { Faker::Base::letterify('????') }
10
+ department_code { Faker::Base::letterify('??????') }
11
+ transmission_number { Faker::Base::numerify('####')}
12
+ user_generation_number { Faker::Base::numerify('####')}
13
+ internal_branch_code '632005'
14
+ end
15
+
16
+ factory :bank_account, :class => "Bankserv::BankAccount" do
17
+ branch_code { Faker::Base::numerify('######') }
18
+ account_number { Faker::Base::numerify('############') }
19
+ account_type { 'savings' }
20
+ initials { Faker::Name::first_name[0] }
21
+ account_name { Faker::Name::last_name }
22
+ id_number { Faker::Base::numerify('#############') }
23
+
24
+ factory :external_bank_account do
25
+ branch_code { (((1..9).to_a) - [6]).shuffle.first.to_s + Faker::Base::numerify('#####') }
26
+ end
27
+
28
+ factory :internal_bank_account do
29
+ branch_code { Faker::Base::numerify('632005') }
30
+ end
31
+ end
32
+
33
+ factory :ahv, :class => "Bankserv::AccountHolderVerification" do
34
+ association :bank_account, :factory => :bank_account
35
+ user_ref { Faker::Base::letterify('????????????') }
36
+ status "new"
37
+
38
+ factory :internal_ahv do
39
+ internal true
40
+ association :bank_account, :factory => :internal_bank_account
41
+ end
42
+ end
43
+
44
+ factory :bankserv_request, :class => "Bankserv::AccountHolderVerification" do
45
+
46
+ factory :ahv_bankserv_request do
47
+ type 'ahv'
48
+ data { {user_ref: Faker::Base::letterify('????????????')} }
49
+ end
50
+
51
+ end
52
+
53
+ factory :debit, :class => "Bankserv::Debit" do
54
+
55
+ end
56
+
57
+ factory :credit, :class => "Bankserv::Credit" do
58
+
59
+ end
60
+
61
+ factory :document, :class => "Bankserv::Document" do
62
+ processed false
63
+
64
+ factory :output_document, :class => "Bankserv::OutputDocument" do
65
+ type 'output'
66
+ end
67
+
68
+ factory :input_document, :class => "Bankserv::InputDocument" do
69
+ type 'input'
70
+ end
71
+
72
+ factory :reply_document, :class => "Bankserv::ReplyDocument" do
73
+ type 'reply'
74
+ end
75
+
76
+ trait :processed do
77
+ processed true
78
+ end
79
+
80
+ trait :output do
81
+ type 'output'
82
+ end
83
+
84
+ trait :input do
85
+ type 'input'
86
+ end
87
+
88
+ end
89
+
90
+ end
@@ -0,0 +1,3 @@
1
+ test:
2
+ adapter: sqlite3
3
+ database: db/bankserv_test.sqlite
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ #
3
+ end
@@ -0,0 +1,138 @@
1
+ ActiveRecord::Schema.define do
2
+
3
+ create_table :bankserv_statements, :force => true do |t|
4
+ t.boolean :processed, :default => false
5
+ t.string :client_code
6
+ t.text :data
7
+ t.timestamps
8
+ end
9
+
10
+ create_table :bankserv_transactions, :force => true do |t|
11
+ t.boolean :processed, :default => false
12
+ t.string :client_code
13
+ t.text :data
14
+ t.references :bankserv_statement
15
+ t.timestamps
16
+ end
17
+
18
+ create_table :bankserv_configurations, :force => true do |t|
19
+ t.boolean :active, :default => false
20
+ t.string :client_code
21
+ t.string :client_name
22
+ t.string :client_abbreviated_name
23
+ t.string :user_code
24
+ t.integer :transmission_number
25
+ t.integer :user_generation_number
26
+ t.string :department_code
27
+ t.string :internal_branch_code
28
+ t.boolean :live_env, :default => false
29
+ t.timestamps
30
+ end
31
+
32
+ create_table :bankserv_requests, :force => true do |t|
33
+ t.string :type
34
+ t.text :data
35
+ t.boolean :processed, :default => false
36
+ t.string :status
37
+ t.text :response
38
+ t.boolean :test, :default => false
39
+ t.timestamps
40
+ end
41
+
42
+ create_table :bankserv_bank_accounts, :force => true do |t|
43
+ t.string :branch_code
44
+ t.string :account_number
45
+ t.string :account_type
46
+ t.string :initials
47
+ t.string :account_name
48
+ t.string :id_number
49
+ t.timestamps
50
+ end
51
+
52
+ create_table :bankserv_account_holder_verifications, :force => true do |t|
53
+ t.boolean :internal, :default => false
54
+ t.references :bankserv_bank_account
55
+ t.references :bankserv_request
56
+ t.string :status, :default => "new"
57
+ t.text :response
58
+ t.string :user_ref
59
+ t.string :internal_user_ref
60
+ t.timestamps
61
+ end
62
+
63
+ create_table :bankserv_debits, :force => true do |t|
64
+ t.string :record_type
65
+ t.decimal :amount, :precision => 10, :scale => 2
66
+ t.string :action_date
67
+ t.references :bankserv_bank_account
68
+ t.references :bankserv_request
69
+ t.integer :batch_id
70
+ t.string :status, :default => "new"
71
+ t.text :response
72
+ t.string :user_ref
73
+ t.string :internal_user_ref
74
+ t.timestamps
75
+ end
76
+
77
+ create_table :bankserv_credits, :force => true do |t|
78
+ t.string :record_type
79
+ t.decimal :amount, :precision => 10, :scale => 2
80
+ t.string :action_date
81
+ t.references :bankserv_bank_account
82
+ t.references :bankserv_request
83
+ t.integer :batch_id
84
+ t.string :status, :default => "new"
85
+ t.text :response
86
+ t.string :user_ref
87
+ t.string :internal_user_ref
88
+ t.timestamps
89
+ end
90
+
91
+ create_table :bankserv_documents, :force => true do |t|
92
+ t.string :type
93
+ t.references :set
94
+ t.boolean :processed, :default => false
95
+ t.string :transmission_status
96
+ t.string :rec_status
97
+ t.string :transmission_number
98
+ t.string :reply_status
99
+ t.text :error
100
+ t.timestamps
101
+ end
102
+
103
+ create_table :bankserv_sets, :force => true do |t|
104
+ t.references :set
105
+ t.string :type
106
+ t.string :generation_number
107
+ t.string :reply_status
108
+ t.timestamps
109
+ end
110
+
111
+ create_table :bankserv_records, :force => true do |t|
112
+ t.references :set
113
+ t.string :record_type
114
+ t.string :reference
115
+ t.text :data
116
+ t.text :error
117
+ t.timestamps
118
+ end
119
+
120
+ create_table :bankserv_engine_configurations, :force => true do |t|
121
+ t.integer :interval_in_minutes
122
+ t.string :input_directory
123
+ t.string :output_directory
124
+ t.string :archive_directory
125
+ end
126
+
127
+ create_table :bankserv_engine_processes, :force => true do |t|
128
+ t.boolean :running
129
+ t.boolean :success
130
+ t.text :response
131
+ t.timestamps
132
+
133
+ t.datetime :completed_at
134
+ end
135
+
136
+ Bankserv::EngineConfiguration.create!(interval_in_minutes: 15, input_directory: "/tmp", output_directory: "/tmp", archive_directory: "/tmp")
137
+
138
+ end
@@ -0,0 +1 @@
1
+ *.log
File without changes
@@ -0,0 +1,104 @@
1
+ require 'spec_helper'
2
+
3
+ describe Bankserv::AccountHolderVerification do
4
+ include Helpers
5
+
6
+ before(:each) do
7
+ tear_it_down
8
+ create(:configuration)
9
+
10
+ @hash = attributes_for(:ahv_bankserv_request)
11
+ @hash[:data][:bank_account] = attributes_for(:bank_account)
12
+ end
13
+
14
+ context "requesting an account holder verification" do
15
+
16
+ it "should be able to queue a request for an account holder verification" do
17
+ Bankserv::AccountHolderVerification.test_request(@hash).should be_true
18
+
19
+ request = Bankserv::Request.last
20
+ request.type.should == "ahv"
21
+ request.data.should == @hash[:data]
22
+ end
23
+
24
+ end
25
+
26
+ context "when creating a new account holder verification" do
27
+
28
+ it "should be marked as new" do
29
+ Bankserv::AccountHolderVerification.request(@hash)
30
+ Bankserv::AccountHolderVerification.last.new?.should be_true
31
+ end
32
+
33
+ it "should create an account holder verification record, with associated bank account" do
34
+ Bankserv::AccountHolderVerification.request(@hash).should be_true
35
+
36
+ ahv = Bankserv::AccountHolderVerification.for_reference(@hash[:data][:user_ref]).first
37
+ ahv.new?.should be_true
38
+
39
+ @hash[:data][:bank_account].each{|k,v| ahv.bank_account.send(k).should == v}
40
+ end
41
+
42
+ it "should mark verifications with an absa branch code as internal" do
43
+ @hash[:data][:bank_account].merge!(attributes_for(:internal_bank_account))
44
+ Bankserv::AccountHolderVerification.request(@hash).should be_true
45
+
46
+ ahv = Bankserv::AccountHolderVerification.for_reference(@hash[:data][:user_ref]).first
47
+ ahv.should be_internal
48
+ end
49
+
50
+ it "should mark verifications with a non-absa branch code as external" do
51
+ @hash[:data][:bank_account].merge!(attributes_for(:external_bank_account))
52
+ Bankserv::AccountHolderVerification.request(@hash).should be_true
53
+
54
+ ahv = Bankserv::AccountHolderVerification.for_reference(@hash[:data][:user_ref]).first
55
+ ahv.should be_external
56
+ end
57
+
58
+ it "should generate a unique internal reference" do
59
+ Bankserv::AccountHolderVerification.request(@hash)
60
+ Bankserv::AccountHolderVerification.last.internal_user_ref.should match /AHV[0-9]+/
61
+ end
62
+
63
+ end
64
+
65
+ context "when processing an account holder verification response" do
66
+
67
+ before(:all) do
68
+ @ahv = create(:ahv)
69
+ @response = {:return_code_1 => "0", :return_code_2 => "0", :return_code_3 => "0", :return_code_4 => "0"}
70
+ end
71
+
72
+ it "should be marked as completed" do
73
+ @ahv.process_response(@response)
74
+ @ahv.completed?.should be_true
75
+ end
76
+
77
+ it "should record whether the account number matched" do
78
+ @ahv.process_response(@response)
79
+
80
+ @ahv.response[:account_number].should be(:match)
81
+ end
82
+
83
+ it "should record whether the id number matched" do
84
+ @ahv.process_response(@response)
85
+
86
+ @ahv.response[:id_number].should be(:match)
87
+ end
88
+
89
+ it "should record whether the initials matched" do
90
+ @ahv.process_response(@response)
91
+
92
+ @ahv.response[:initials].should be(:match)
93
+ end
94
+
95
+ it "should record whether the surname matched" do
96
+ @ahv.process_response(@response)
97
+
98
+ @ahv.response[:surname].should be(:match)
99
+ end
100
+
101
+ end
102
+
103
+
104
+ end