coop_to_ofx 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/README.rdoc +38 -0
  2. data/Rakefile +141 -0
  3. data/bin/coop_to_ofx +60 -0
  4. data/lib/coop_scraper/base.rb +8 -0
  5. data/lib/coop_scraper/credit_card.rb +94 -0
  6. data/lib/coop_scraper/current_account.rb +92 -0
  7. data/lib/coop_scraper/version.rb +12 -0
  8. data/lib/coop_scraper.rb +2 -0
  9. data/lib/ofx/statement/base.rb +53 -0
  10. data/lib/ofx/statement/credit_card.rb +15 -0
  11. data/lib/ofx/statement/current_account.rb +14 -0
  12. data/lib/ofx/statement/output/base.rb +131 -0
  13. data/lib/ofx/statement/output/builder.rb +76 -0
  14. data/lib/ofx/statement/output/credit_card.rb +31 -0
  15. data/lib/ofx/statement/output/current_account.rb +29 -0
  16. data/lib/ofx/statement/transaction.rb +52 -0
  17. data/lib/ofx/statement.rb +3 -0
  18. data/lib/ofx.rb +1 -0
  19. data/spec/coop_scraper/base_spec.rb +15 -0
  20. data/spec/coop_scraper/credit_card_spec.rb +229 -0
  21. data/spec/coop_scraper/current_account_spec.rb +154 -0
  22. data/spec/fixtures/credit_card/cc_statement_fixture.html +927 -0
  23. data/spec/fixtures/credit_card/foreign_transaction_fixture.html +447 -0
  24. data/spec/fixtures/credit_card/interest_transaction_fixture.html +438 -0
  25. data/spec/fixtures/credit_card/maybe.txt +43 -0
  26. data/spec/fixtures/credit_card/merchandise_interest_fixture.html +0 -0
  27. data/spec/fixtures/credit_card/normal_transaction_fixture.html +439 -0
  28. data/spec/fixtures/credit_card/overlimit_charge_fixture.html +446 -0
  29. data/spec/fixtures/credit_card/payment_in_transaction_fixture.html +439 -0
  30. data/spec/fixtures/credit_card/simple_cc_statement.ofx +43 -0
  31. data/spec/fixtures/credit_card/statement_with_interest_line_fixture.html +452 -0
  32. data/spec/fixtures/current_account/cash_point_transaction_fixture.html +372 -0
  33. data/spec/fixtures/current_account/current_account_fixture.html +420 -0
  34. data/spec/fixtures/current_account/current_account_fixture.ofx +83 -0
  35. data/spec/fixtures/current_account/debit_interest_transaction_fixture.html +372 -0
  36. data/spec/fixtures/current_account/no_transactions_fixture.html +364 -0
  37. data/spec/fixtures/current_account/normal_transaction_fixture.html +372 -0
  38. data/spec/fixtures/current_account/payment_in_transaction_fixture.html +372 -0
  39. data/spec/fixtures/current_account/service_charge_transaction_fixture.html +372 -0
  40. data/spec/fixtures/current_account/transfer_transaction_fixture.html +372 -0
  41. data/spec/ofx/statement/base_spec.rb +116 -0
  42. data/spec/ofx/statement/credit_card_spec.rb +20 -0
  43. data/spec/ofx/statement/current_account_spec.rb +20 -0
  44. data/spec/ofx/statement/output/base_spec.rb +249 -0
  45. data/spec/ofx/statement/output/builder_spec.rb +38 -0
  46. data/spec/ofx/statement/output/credit_card_spec.rb +84 -0
  47. data/spec/ofx/statement/output/current_account_spec.rb +81 -0
  48. data/spec/ofx/statement/transaction_spec.rb +76 -0
  49. data/spec/spec.opts +2 -0
  50. data/spec/spec_helper.rb +36 -0
  51. metadata +172 -0
@@ -0,0 +1,438 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
+
3
+
4
+
5
+ <html>
6
+ <head>
7
+ <TITLE>The Co-operative Bank p.l.c.</TITLE>
8
+ <link rel="stylesheet" href="https://welcome27.co-operativebank.co.uk/CBIBSImages/theme/Master.css" type="text/css">
9
+ <META content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
10
+ <META http-equiv="Content-Type" content="no-cache">
11
+ <META http-equiv="Pragma" content="no-cache">
12
+ <META http-equiv="Expires" content="-1">
13
+ <META http-equiv="Pragma-directive" content="no-cache">
14
+ <META http-equiv="cache-directive" content="no-cache">
15
+ </head>
16
+
17
+
18
+
19
+ <body>
20
+ <table width="100%" cellpadding="0" cellspacing="0">
21
+ <tr>
22
+ <td>
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+ <table width="100%" cellpadding="0" border="0" cellspacing="0">
31
+ <tr>
32
+ <td class="pageheader" height="0" width="50%">&nbsp;</td>
33
+ <td class="pageheader" width="20%">&nbsp;</td>
34
+ <td class="pageheader" height="10" width="30%">&nbsp;</td>
35
+ </tr>
36
+ <tr>
37
+ <td class="pageheader" valign="TOP" width="50%"><img src="https://welcome27.co-operativebank.co.uk/CBIBSImages/images/coop_logo_top.gif" align="left" alt="Top of the co-operative bank logo"></td>
38
+ <TD class="pageheader" valign="baseline" align="left" width="20%">
39
+ <table border="0" cellspacing="0" cellpadding="0" width="100%"><!--Table is used for vertical alignment-->
40
+ <tr><td>&nbsp;</td></tr>
41
+ <tr>
42
+ <TD class="pageheader" valign="BOTTOM" align="right" width="100%" height="100%">
43
+ <a href="/CBIBSWeb" title="Log Off" class="whiteLinks"><img src="https://welcome27.co-operativebank.co.uk/CBIBSImages/images/logoffbutton.gif" align="middle" alt="Log Off"></a>
44
+ </TD>
45
+ </tr>
46
+ </table>
47
+ </TD>
48
+
49
+ <TD class="pageheader" valign="baseline" align="left" width="35%">
50
+ <table border="0" cellspacing="0" cellpadding="0" width="100%"><!--Table is used for vertical alignment-->
51
+ <tr><td>&nbsp;</td></tr><!--Used for alignment-->
52
+ <tr>
53
+
54
+
55
+
56
+ <td class="pageheadernew" valign="baseline" width="22.5%"><a href="http://www.smile.co.uk/helppages/cbibs/statements/visaAccountLatestStatement.htm" target="_blank" class="whiteLinks" title="New Help Window Opened">
57
+ <img src="https://welcome27.co-operativebank.co.uk/CBIBSImages/images/helpbutton.gif" align="left" alt="Help"></a></coop:HelpLinkTag>
58
+ </td>
59
+ <td class="pageheader" align="left" valign="baseline" width="77.5%"><a href="/CBIBSWeb" title="Printer Friendly Page" class="whiteLinks"><img src="https://welcome27.co-operativebank.co.uk/CBIBSImages/images/printbutton.gif" align="left" alt="Print"></a>
60
+ </td>
61
+
62
+
63
+
64
+ </tr>
65
+ </table>
66
+ </td>
67
+ </tr>
68
+ <tr align="left">
69
+ <td>
70
+ <table width="100%" border="0">
71
+ <tr>
72
+ <td align="left">&nbsp;&nbsp;</td>
73
+ <td align="left" valign="baseline" width="40%">Friday 06 February 2009</td>
74
+ <td align="left" valign="baseline" width="60%"><span class="H4">MR M</span></td>
75
+ </tr>
76
+ <tr><td>&nbsp;</td></tr>
77
+ </table>
78
+ </td>
79
+ </tr>
80
+ </table>
81
+ </td>
82
+ </tr>
83
+ <tr valign="top" align="left">
84
+ <td class="sidebar" >
85
+ <table width="100%">
86
+ <tr valign="top" align="left">
87
+ <td width="20%" class="sidebar">
88
+
89
+
90
+
91
+
92
+
93
+
94
+ <table cellpadding="3" cellspacing="5" width="78%" border="0">
95
+ <tr>
96
+ <td valign="top" height="26"><br></td>
97
+ </tr>
98
+
99
+
100
+
101
+
102
+ <tr valign="top">
103
+ <td valign="top" class="sidebar">
104
+ <a href="/CBIBSWeb" title="Your Accounts" class="sidebar">Your Accounts</a>
105
+ </td>
106
+ </tr>
107
+
108
+
109
+
110
+
111
+ <tr valign="top">
112
+ <td valign="top" class="backgroundSelected">
113
+ <a href="/CBIBSWeb" title="Statements" class="sidebarSelected">Statements</a>
114
+ </td>
115
+ </tr>
116
+
117
+
118
+
119
+
120
+ <tr valign="top">
121
+ <td valign="top" class="sidebar">
122
+ <a href="/CBIBSWeb" title="Pay Bills" class="sidebar">Pay Bills</a>
123
+ </td>
124
+ </tr>
125
+
126
+
127
+
128
+
129
+ <tr valign="top">
130
+ <td valign="top" class="sidebar">
131
+ <a href="/CBIBSWeb" title="Standing Orders" class="sidebar">Standing Orders</a>
132
+ </td>
133
+ </tr>
134
+
135
+
136
+
137
+
138
+ <tr valign="top">
139
+ <td valign="top" class="sidebar">
140
+ <a href="/CBIBSWeb" title="Funds Transfers" class="sidebar">Funds Transfers</a>
141
+ </td>
142
+ </tr>
143
+
144
+
145
+
146
+
147
+ <tr valign="top">
148
+ <td valign="top" class="sidebar">
149
+ <a href="/CBIBSWeb" title="Direct Debits" class="sidebar">Direct Debits</a>
150
+ </td>
151
+ </tr>
152
+
153
+
154
+
155
+
156
+ <tr valign="top">
157
+ <td valign="top" class="sidebar">
158
+ <a href="/CBIBSWeb" title="Customer Services" class="sidebar">Customer Services</a>
159
+ </td>
160
+ </tr>
161
+
162
+ <tr>
163
+ <td>&nbsp;</td>
164
+ </tr>
165
+ </table>
166
+ </td>
167
+ <td width="80%" class="sidebar" >
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+ <table width="100%" border="0" cellpadding="0" cellspacing="0" >
179
+ <tr>
180
+ <td class="field"><span class="H2">Statement<br>
181
+ </span></td>
182
+ </tr>
183
+ </table>
184
+ <table cellpadding="0" cellspacing="0" border="0" width="100%">
185
+ <tr>
186
+ <td bgcolor="#000000"><img src="https://welcome27.co-operativebank.co.uk/CBIBSImages/images/spacer.gif" height="1" width="1" alt=""></td>
187
+ </tr>
188
+ </table>
189
+ <table width="100%" border="0" cellpadding="0" cellspacing="0" >
190
+ <tbody>
191
+ <tr><td><br/></td></tr>
192
+ <tr>
193
+ <td class="field">
194
+ <h4>
195
+ TRAVEL CARD
196
+ &nbsp;&nbsp;
197
+ 1234123412341234
198
+
199
+ </h4>
200
+ </td>
201
+ </tr>
202
+ </tbody>
203
+ </table>
204
+
205
+
206
+
207
+
208
+
209
+ <table width="100%" border="0" cellpadding="0" cellspacing="0" >
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+ <tr>
219
+ <td class="field">
220
+ <table width="70%" border="0" cellpadding="2" cellspacing="0" >
221
+ <tbody>
222
+
223
+ <tr>
224
+ <td class="field" width="150">Statement Date</td>
225
+ <td class="field">03/02/2009</td>
226
+ <td class="field" width="150"></td>
227
+ <td class="field"></td>
228
+ </tr>
229
+ <tr>
230
+ <td class="field">Credit Limit</td>
231
+ <td class="field">£2000.00</td>
232
+ <td class="field">Available Credit</td>
233
+
234
+
235
+ <td class="field">£1000.00</td>
236
+
237
+ </tr>
238
+ <tr>
239
+ <td class="field">Statement Balance</td>
240
+ <td class="field">£123.21 DR</td>
241
+
242
+
243
+ <td class="field">&nbsp;</td>
244
+ <td class="field">&nbsp;</td>
245
+
246
+ </tr>
247
+ <tr>
248
+ <td class="field">Minimum Due</td>
249
+ <td class="field">£5.00</td>
250
+ <td class="field">Part Payment by</td>
251
+ <td class="field">03/03/2009</td>
252
+ </tr>
253
+
254
+ </tbody>
255
+ </table>
256
+ </td>
257
+ </tr>
258
+ <tr>
259
+ <td class="field"><br>
260
+ <table cellpadding="0" cellspacing="0" border="0">
261
+
262
+ <tr>
263
+ <td class="field" align="left"> If you make only the minimum payment each month, it will take you longer and cost you more to clear your balance. </td>
264
+ </tr>
265
+ <tr><td>&nbsp;</td></tr>
266
+ <tr>
267
+ <td class="field" align="left">For details of how your outstanding balance is reduced when you make a payment please click
268
+ <a href="http://www.smile.co.uk/helppages/cbibs/allocationofpaymentsforcreditcards.html" target="_blank" class="whiteLinks" title="new help window opened"><span class="bodyhighlight"> here</span></a>.</td>
269
+ </tr>
270
+ <tr><td>&nbsp;</td></tr>
271
+
272
+ </table>
273
+ </td>
274
+ <tr>
275
+ <tr>
276
+ <td class="field"><br>
277
+ <table cellpadding="0" cellspacing="0" border="0">
278
+ <tbody>
279
+
280
+
281
+
282
+ <tr>
283
+ <td class="field">To pay this bill click <a href="/CBIBSWeb" title="Click here to pay your visa bill"><span class="bodyhighlight">here</span></a>.<br/><br/></td>
284
+ </tr>
285
+
286
+
287
+
288
+ <tr>
289
+ <td class="field">
290
+ <table align="left" cellpadding="0" cellspacing="0" border="1">
291
+ <col span="1" align="center">
292
+ <thead>
293
+ <tr>
294
+ <th>Date</th>
295
+ <th>Transaction</th>
296
+ <th>Deposits</th>
297
+ <th>Withdrawals</th>
298
+ </tr>
299
+ </thead>
300
+ <tbody class="contents">
301
+
302
+ <tr>
303
+ <td class="dataRowL">05/05/2009</td>
304
+ <td class="transData"> MERCHANDISE INTEREST AT 1.667% PER MTH </td>
305
+ <td class="moneyData"> &nbsp; </td>
306
+ <td class="moneyData"> £40.58 </td>
307
+ </tr>
308
+
309
+ </tbody>
310
+ </table>
311
+ </td>
312
+ </tr>
313
+ <tr>
314
+
315
+ <td align="right"><br>&nbsp;
316
+
317
+
318
+
319
+
320
+ &nbsp;&nbsp;&nbsp;<a href="#" title="previous"><span class="bodyhighlight">previous</span></a>
321
+
322
+
323
+
324
+
325
+ </td>
326
+ </tr>
327
+ </tbody>
328
+ </table>
329
+ </td>
330
+ </tr>
331
+ <tr>
332
+ <td class="field">
333
+ <p class="smallprint"> <STRONG> Note &#45; </STRONG> Available credit includes items in transit. <br>
334
+ <br>
335
+ Your statement balance consists of any balance showing on your previous statement, plus all transactions posted within this statement.
336
+ <br><br>
337
+ Interest is charged daily and will increase the longer payment is delayed. If your account is not fully cleared, interest will be charged on your daily balance, not just your outstanding balance. <br><br>Statements are available online for up to 3 months.
338
+ <br/><br/>
339
+
340
+ </p>
341
+ </td>
342
+ </tr>
343
+
344
+
345
+
346
+
347
+ <tr>
348
+ <td class="field" colspan="2"><br/>
349
+ To view Recent Items click <a href="/CBIBSWeb" title="Recent Items"><span class="bodyhighlight">Recent Items</span></a>.<br>
350
+ <br>
351
+ </td>
352
+ </tr>
353
+
354
+ </table>
355
+ <table width="100%" border="0" cellpadding="0" cellspacing="0" >
356
+
357
+ <tr>
358
+ <td class="field" colspan="2">
359
+ To select another service click the menu on the left. <br/><br/>
360
+ </td>
361
+ </tr>
362
+ <tr>
363
+ <td colspan="2" align="left"> To view another account, please select from the list below </td>
364
+ </tr>
365
+ </table>
366
+ <table cellpadding="0" cellspacing="0" border="0">
367
+ <tr>
368
+ <td class="error"></td>
369
+ </tr>
370
+ </table>
371
+ <B></B></td>
372
+ </tr>
373
+ <tr valign="top" align="left">
374
+ <td></td>
375
+ <td align="left">
376
+
377
+
378
+
379
+ <form name="viewAccountForm" method="post" action="/CBIBSWeb"><input type="hidden" name="org.apache.struts.taglib.html.TOKEN" value="">
380
+ <table cellpadding="0" cellspacing="0" border="0">
381
+ <tr>
382
+ <td><label for="accounts" class="nodisplay">accounts</label></td>
383
+ </tr>
384
+ <tr valign="bottom">
385
+ <td class="field" width="56%">
386
+ <select name="selectedAccount" id="accounts">
387
+ <option value ="Select Account">Select Account</option>
388
+ <option value ="%1234123412341234V">TRAVEL CARD 1234123412341234</option>
389
+
390
+ </select>
391
+ </td>
392
+ <td class="field">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
393
+ <input type="image" name="VIEW" src="https://welcome27.co-operativebank.co.uk/CBIBSImages/images/viewbutton.gif" title="view account" alt="view">
394
+ </td>
395
+ </tr>
396
+ <tr>
397
+ <td class="error" colspan="2"></td>
398
+ </tr>
399
+ <tr>
400
+ <td colspan="2">&nbsp;</td>
401
+ </tr>
402
+
403
+
404
+
405
+
406
+
407
+
408
+
409
+
410
+
411
+
412
+
413
+ <tr>
414
+ <td colspan="2" align="left">For details of charges for card transactions in any currency other than sterling click<a href="http://www.smile.co.uk/helppages/cbibs/foreigncardtransactions.html" target="_blank" class="whiteLinks" title="new help window opened">
415
+ <span class="bodyhighlight"> here</span></a>.</td>
416
+ </tr>
417
+
418
+
419
+
420
+
421
+
422
+
423
+ </table>
424
+ </form>
425
+ </td>
426
+ </tr>
427
+ </table>
428
+ </td>
429
+ </tr>
430
+ <tr>
431
+ <td align="left"><table width="100%">
432
+ <tr><td/>
433
+ </tr>
434
+ </table></td>
435
+ </tr>
436
+ </table>
437
+ </body>
438
+ </html>
@@ -0,0 +1,43 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <?OFX NEWFILEUID="NONE" OFXHEADER="200" SECURITY="NONE" VERSION="203" OLDFILEUID="NONE"?>
3
+ <OFX>
4
+ <SIGNONMSGSRSV1>
5
+ <SONRS>
6
+ <STATUS>
7
+ <CODE>0</CODE>
8
+ <SEVERITY>INFO</SEVERITY>
9
+ </STATUS>
10
+ <DTSERVER>20090206183556</DTSERVER>
11
+ <LANGUAGE>ENG</LANGUAGE>
12
+ </SONRS>
13
+ <CREDITCARDMSGSETV1>
14
+ <CCSTMTTRNRS>
15
+ <CCSTMTRS>
16
+ <CURDEF>GBP</CURDEF>
17
+ <CCACCTFROM>
18
+ <ACCTID>1234123412341234</ACCTID>
19
+ </CCACCTFROM>
20
+ <BANKTRANLIST>
21
+ <DTSTART>20090101</DTSTART>
22
+ <DTEND>20090203</DTEND>
23
+ <STMTTRN>
24
+ <TRNTYPE>DEBIT</TRNTYPE>
25
+ <DTPOSTED>20090105</DTPOSTED>
26
+ <TRNAMT>-15.00</TRNAMT>
27
+ <FITID>200901051</FITID>
28
+ <NAME>COMP HSE FILE-DOM INTERNET GB</NAME>
29
+ </STMTTRN>
30
+ </BANKTRANLIST>
31
+ <LEDGERBAL>
32
+ <BALAMT>-1551.90</BALAMT>
33
+ <DTASOF>20090203</DTASOF>
34
+ </LEDGERBAL>
35
+ <AVAILBAL>
36
+ <BALAMT>305.00</BALAMT>
37
+ <DTASOF>20090203</DTASOF>
38
+ </AVAILBAL>
39
+ </CCSTMTRS>
40
+ </CCSTMTTRNRS>
41
+ </CREDITCARDMSGSETV1>
42
+ </SIGNONMSGSRSV1>
43
+ </OFX>