chopmo-ofx 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,308 @@
1
+
2
+
3
+ OFXHEADER:100
4
+ DATA:OFXSGML
5
+ VERSION:102
6
+ SECURITY:NONE
7
+ ENCODING:USASCII
8
+ CHARSET:1252
9
+ COMPRESSION:NONE
10
+ OLDFILEUID:NONE
11
+ NEWFILEUID:NONE
12
+
13
+ <OFX>
14
+ <SIGNONMSGSRSV1>
15
+ <SONRS>
16
+ <STATUS>
17
+ <CODE>0
18
+ <SEVERITY>INFO
19
+ </STATUS>
20
+ <DTSERVER>20091101192253
21
+ <LANGUAGE>POR
22
+ </SONRS>
23
+ </SIGNONMSGSRSV1>
24
+ <BANKMSGSRSV1>
25
+ <STMTTRNRS>
26
+ <TRNUID>1
27
+ <STATUS>
28
+ <CODE>0
29
+ <SEVERITY>INFO
30
+ </STATUS>
31
+ <STMTRS>
32
+ <CURDEF>BRL
33
+ <BANKACCTFROM>
34
+ <BANKID>0356
35
+ <ACCTID>03227113109
36
+ <ACCTTYPE>CHECKING
37
+ </BANKACCTFROM>
38
+ <BANKTRANLIST>
39
+ <DTSTART>20091009080000
40
+ <DTEND>20091103080000
41
+ <STMTTRN>
42
+ <TRNTYPE>DEBIT
43
+ <DTPOSTED>20091009080000
44
+ <TRNAMT>-35.34
45
+ <FITID>200910091
46
+ <CHECKNUM>0001223
47
+ <MEMO>COMPRA VISA ELECTRON
48
+ </STMTTRN><STMTTRN>
49
+ <TRNTYPE>CREDIT
50
+ <DTPOSTED>20091016080000
51
+ <TRNAMT>60.39
52
+ <FITID>200910162
53
+ <CHECKNUM>0880136
54
+ <MEMO>DEPOSITO POUP.CORRENTE
55
+ </STMTTRN>
56
+
57
+ <STMTTRN>
58
+ <TRNTYPE>OTHER</TRNTYPE>
59
+ <DTPOSTED>20091019120000[-3:BRT]</DTPOSTED>
60
+ <TRNAMT>-148.40</TRNAMT>
61
+ <FITID>200910191148400</FITID>
62
+ <CHECKNUM>000000101901</CHECKNUM>
63
+ <REFNUM>101.901</REFNUM>
64
+ <PAYEE>Pagto conta telefone</PAYEE>
65
+ <MEMO>Pagto conta telefone</MEMO>
66
+ </STMTTRN>
67
+
68
+ <STMTTRN>
69
+ <TRNTYPE>DEBIT
70
+ <DTPOSTED>20091013080000
71
+ <TRNAMT>-126.13
72
+ <FITID>200910131
73
+ <CHECKNUM>0001511
74
+ <MEMO>TÍTULO COBRANÇA-IB
75
+ </STMTTRN><STMTTRN>
76
+ <TRNTYPE>DEBIT
77
+ <DTPOSTED>20091013080000
78
+ <TRNAMT>-232.23
79
+ <FITID>200910132
80
+ <CHECKNUM>0001511
81
+ <MEMO>TÍTULO COBRANÇA-IB
82
+ </STMTTRN><STMTTRN>
83
+ <TRNTYPE>DEBIT
84
+ <DTPOSTED>20091013080000
85
+ <TRNAMT>-501.24
86
+ <FITID>200910133
87
+ <CHECKNUM>0001511
88
+ <MEMO>TÍTULO COBRANÇA-IB
89
+ </STMTTRN><STMTTRN>
90
+ <TRNTYPE>DEBIT
91
+ <DTPOSTED>20091013080000
92
+ <TRNAMT>-719.03
93
+ <FITID>200910134
94
+ <CHECKNUM>0001511
95
+ <MEMO>TÍTULO COBRANÇA-IB
96
+ </STMTTRN><STMTTRN>
97
+ <TRNTYPE>DEBIT
98
+ <DTPOSTED>20091013080000
99
+ <TRNAMT>-90.75
100
+ <FITID>200910135
101
+ <CHECKNUM>0001223
102
+ <MEMO>COMPRA VISA ELECTRON
103
+ </STMTTRN><STMTTRN>
104
+ <TRNTYPE>DEBIT
105
+ <DTPOSTED>20091013080000
106
+ <TRNAMT>-49.80
107
+ <FITID>200910136
108
+ <CHECKNUM>0001223
109
+ <MEMO>COMPRA VISA ELECTRON
110
+ </STMTTRN><STMTTRN>
111
+ <TRNTYPE>DEBIT
112
+ <DTPOSTED>20091013080000
113
+ <TRNAMT>-219.90
114
+ <FITID>200910137
115
+ <CHECKNUM>0001223
116
+ <MEMO>COMPRA VISA ELECTRON
117
+ </STMTTRN><STMTTRN>
118
+ <TRNTYPE>DEBIT
119
+ <DTPOSTED>20091013080000
120
+ <TRNAMT>-54.61
121
+ <FITID>200910138
122
+ <CHECKNUM>0001223
123
+ <MEMO>COMPRA VISA ELECTRON
124
+ </STMTTRN><STMTTRN>
125
+ <TRNTYPE>DEBIT
126
+ <DTPOSTED>20091013080000
127
+ <TRNAMT>-38.57
128
+ <FITID>200910139
129
+ <CHECKNUM>0002208
130
+ <MEMO>PAGTO CONTA TELEFONE -RIB
131
+ </STMTTRN><STMTTRN>
132
+ <TRNTYPE>DEBIT
133
+ <DTPOSTED>20091013080000
134
+ <TRNAMT>-119.40
135
+ <FITID>2009101310
136
+ <CHECKNUM>0002209
137
+ <MEMO>CONTA DE LUZ -RIB
138
+ </STMTTRN><STMTTRN>
139
+ <TRNTYPE>DEBIT
140
+ <DTPOSTED>20091013080000
141
+ <TRNAMT>-34.69
142
+ <FITID>2009101311
143
+ <CHECKNUM>0002208
144
+ <MEMO>PAGTO CONTA TELEFONE -RIB
145
+ </STMTTRN><STMTTRN>
146
+ <TRNTYPE>DEBIT
147
+ <DTPOSTED>20091013080000
148
+ <TRNAMT>-35.07
149
+ <FITID>2009101312
150
+ <CHECKNUM>0002231
151
+ <MEMO>IPTU / TAXAS SP -RIB
152
+ </STMTTRN><STMTTRN>
153
+ <TRNTYPE>DEBIT
154
+ <DTPOSTED>20091013080000
155
+ <TRNAMT>-259.10
156
+ <FITID>2009101313
157
+ <CHECKNUM>0001085
158
+ <MEMO>PGTO NET
159
+ </STMTTRN><STMTTRN>
160
+ <TRNTYPE>DEBIT
161
+ <DTPOSTED>20091013080000
162
+ <TRNAMT>-202.84
163
+ <FITID>2009101314
164
+ <CHECKNUM>0002606
165
+ <MEMO>PARC RC EXCLUSIVO 12
166
+ </STMTTRN><STMTTRN>
167
+ <TRNTYPE>DEBIT
168
+ <DTPOSTED>20091013080000
169
+ <TRNAMT>-272.77
170
+ <FITID>2009101315
171
+ <CHECKNUM>0002606
172
+ <MEMO>PARC RC EXCLUSIVO 08
173
+ </STMTTRN><STMTTRN>
174
+ <TRNTYPE>DEBIT
175
+ <DTPOSTED>20091014080000
176
+ <TRNAMT>-80.00
177
+ <FITID>200910141
178
+ <CHECKNUM>0010991
179
+ <MEMO>CHEQUE COMPENSADO
180
+ </STMTTRN><STMTTRN>
181
+ <TRNTYPE>DEBIT
182
+ <DTPOSTED>20091014080000
183
+ <TRNAMT>-177.00
184
+ <FITID>200910142
185
+ <CHECKNUM>0010986
186
+ <MEMO>CHEQUE COMPENSADO
187
+ </STMTTRN><STMTTRN>
188
+ <TRNTYPE>DEBIT
189
+ <DTPOSTED>20091014080000
190
+ <TRNAMT>-386.00
191
+ <FITID>200910143
192
+ <CHECKNUM>0011063
193
+ <MEMO>CHEQUE COMPENSADO
194
+ </STMTTRN><STMTTRN>
195
+ <TRNTYPE>DEBIT
196
+ <DTPOSTED>20091014080000
197
+ <TRNAMT>-12.19
198
+ <FITID>200910144
199
+ <CHECKNUM>0001223
200
+ <MEMO>COMPRA VISA ELECTRON
201
+ </STMTTRN><STMTTRN>
202
+ <TRNTYPE>DEBIT
203
+ <DTPOSTED>20091015080000
204
+ <TRNAMT>-41.00
205
+ <FITID>200910151
206
+ <CHECKNUM>0011064
207
+ <MEMO>CHEQUE COMPENSADO
208
+ </STMTTRN><STMTTRN>
209
+ <TRNTYPE>DEBIT
210
+ <DTPOSTED>20091016080000
211
+ <TRNAMT>-63.00
212
+ <FITID>200910161
213
+ <CHECKNUM>0010856
214
+ <MEMO>CHEQUE COMPENSADO
215
+ </STMTTRN><STMTTRN>
216
+ <TRNTYPE>DEBIT
217
+ <DTPOSTED>20091019080000
218
+ <TRNAMT>-51.00
219
+ <FITID>200910191
220
+ <CHECKNUM>0011065
221
+ <MEMO>CHEQUE COMPENSADO
222
+ </STMTTRN><STMTTRN>
223
+ <TRNTYPE>DEBIT
224
+ <DTPOSTED>20091019080000
225
+ <TRNAMT>-23.81
226
+ <FITID>200910192
227
+ <CHECKNUM>0001203
228
+ <MEMO>ASSINATURA ABRIL
229
+ </STMTTRN><STMTTRN>
230
+ <TRNTYPE>DEBIT
231
+ <DTPOSTED>20091020080000
232
+ <TRNAMT>-15.50
233
+ <FITID>200910201
234
+ <CHECKNUM>0001223
235
+ <MEMO>COMPRA VISA ELECTRON
236
+ </STMTTRN><STMTTRN>
237
+ <TRNTYPE>DEBIT
238
+ <DTPOSTED>20091021080000
239
+ <TRNAMT>-132.00
240
+ <FITID>200910211
241
+ <CHECKNUM>0011023
242
+ <MEMO>CHEQUE COMPENSADO
243
+ </STMTTRN><STMTTRN>
244
+ <TRNTYPE>CREDIT
245
+ <DTPOSTED>20091022080000
246
+ <TRNAMT>600.00
247
+ <FITID>200910221
248
+ <CHECKNUM>0001433
249
+ <MEMO>DOC REM 216.397.168-66
250
+ </STMTTRN><STMTTRN>
251
+ <TRNTYPE>DEBIT
252
+ <DTPOSTED>20091022080000
253
+ <TRNAMT>-22.40
254
+ <FITID>200910222
255
+ <CHECKNUM>0001223
256
+ <MEMO>COMPRA VISA ELECTRON
257
+ </STMTTRN><STMTTRN>
258
+ <TRNTYPE>DEBIT
259
+ <DTPOSTED>20091022080000
260
+ <TRNAMT>-73.16
261
+ <FITID>200910223
262
+ <CHECKNUM>0001223
263
+ <MEMO>COMPRA VISA ELECTRON
264
+ </STMTTRN><STMTTRN>
265
+ <TRNTYPE>DEBIT
266
+ <DTPOSTED>20091023080000
267
+ <TRNAMT>-61.36
268
+ <FITID>200910231
269
+ <CHECKNUM>0000292
270
+ <MEMO>CONTA ÁGUA/ESGOTO
271
+ </STMTTRN><STMTTRN>
272
+ <TRNTYPE>DEBIT
273
+ <DTPOSTED>20091026080000
274
+ <TRNAMT>-96.00
275
+ <FITID>200910261
276
+ <CHECKNUM>0002212
277
+ <MEMO>PAGTO FATURA REALVISA-RIB
278
+ </STMTTRN><STMTTRN>
279
+ <TRNTYPE>DEBIT
280
+ <DTPOSTED>20091030080000
281
+ <TRNAMT>-67.75
282
+ <FITID>200910301
283
+ <CHECKNUM>0011061
284
+ <MEMO>CHEQUE COMPENSADO
285
+ </STMTTRN><STMTTRN>
286
+ <TRNTYPE>DEBIT
287
+ <DTPOSTED>20091030080000
288
+ <TRNAMT>-25.88
289
+ <FITID>200910302
290
+ <CHECKNUM>0001223
291
+ <MEMO>COMPRA VISA ELECTRON
292
+ </STMTTRN><STMTTRN>
293
+ <TRNTYPE>DEBIT
294
+ <DTPOSTED>20091103080000
295
+ <TRNAMT>-89.03
296
+ <FITID>200911031
297
+ <CHECKNUM>0001223
298
+ <MEMO>COMPRA VISA ELECTRON
299
+ </STMTTRN>
300
+ </BANKTRANLIST>
301
+ <LEDGERBAL>
302
+ <BALAMT>598.44
303
+ <DTASOF>20091101
304
+ </LEDGERBAL>
305
+ </STMTRS>
306
+ </STMTTRNRS>
307
+ </BANKMSGSRSV1>
308
+ </OFX>
@@ -0,0 +1,85 @@
1
+ <?xml version="1.0" encoding="US-ASCII"?>
2
+
3
+ <!-- This example is taken from the 2.1.1 specification, pages 610-612 -->
4
+ <?OFX OFXHEADER="200" VERSION="211" SECURITY="NONE" OLDFILEUID="NONE" NEWFILEUID="NONE"?>
5
+ <OFX>
6
+ <SIGNONMSGSRSV1>
7
+ <SONRS>
8
+ <STATUS>
9
+ <CODE>0</CODE>
10
+ <SEVERITY>INFO</SEVERITY>
11
+ </STATUS>
12
+ <DTSERVER>20050831165153.000[-8:PST]</DTSERVER>
13
+ <LANGUAGE>ENG</LANGUAGE>
14
+ </SONRS>
15
+ </SIGNONMSGSRSV1>
16
+ <BANKMSGSRSV1>
17
+ <STMTTRNRS>
18
+ <TRNUID>0</TRNUID>
19
+ <STATUS>
20
+ <CODE>0</CODE>
21
+ <SEVERITY>INFO</SEVERITY>
22
+ </STATUS>
23
+ <STMTRS>
24
+ <CURDEF>USD</CURDEF>
25
+ <BANKACCTFROM>
26
+ <BANKID>000000123</BANKID>
27
+ <ACCTID>123456</ACCTID>
28
+ <ACCTTYPE>CHECKING</ACCTTYPE>
29
+ </BANKACCTFROM>
30
+ <BANKTRANLIST>
31
+ <DTSTART>20040801</DTSTART>
32
+ <DTEND>20050831165153.000[-8:PST]</DTEND>
33
+ <STMTTRN>
34
+ <TRNTYPE>POS</TRNTYPE>
35
+ <DTPOSTED>20050824080000</DTPOSTED>
36
+ <TRNAMT>-80</TRNAMT>
37
+ <FITID>219378</FITID>
38
+ <NAME>FrogKick Scuba Gear</NAME>
39
+ </STMTTRN>
40
+ </BANKTRANLIST>
41
+ <LEDGERBAL>
42
+ <BALAMT>2156.56</BALAMT>
43
+ <DTASOF>20050831165153</DTASOF>
44
+ </LEDGERBAL>
45
+ </STMTRS>
46
+ </STMTTRNRS>
47
+ </BANKMSGSRSV1>
48
+ <CREDITCARDMSGSRSV1>
49
+ <CCSTMTTRNRS>
50
+ <TRNUID>0</TRNUID>
51
+ <STATUS>
52
+ <CODE>0</CODE>
53
+ <SEVERITY>INFO</SEVERITY>
54
+ </STATUS>
55
+ <CCSTMTRS>
56
+ <CURDEF>USD</CURDEF>
57
+ <CCACCTFROM>
58
+ <ACCTID>123412341234</ACCTID>
59
+ </CCACCTFROM>
60
+ <BANKTRANLIST>
61
+ <DTSTART>20050801</DTSTART>
62
+ <DTEND>20050831165153.000[-8:PST]</DTEND>
63
+ <STMTTRN>
64
+ <TRNTYPE>INT</TRNTYPE>
65
+ <DTPOSTED>20050811080000</DTPOSTED>
66
+ <TRNAMT>-23.00</TRNAMT>
67
+ <FITID>219867</FITID>
68
+ <NAME>Interest Charge</NAME>
69
+ </STMTTRN>
70
+ <STMTTRN>
71
+ <TRNTYPE>CREDIT</TRNTYPE>
72
+ <DTPOSTED>20050811080000</DTPOSTED>
73
+ <TRNAMT>350.00</TRNAMT>
74
+ <FITID>219868</FITID>
75
+ <NAME>Payment - Thank You</NAME>
76
+ </STMTTRN>
77
+ </BANKTRANLIST>
78
+ <LEDGERBAL>
79
+ <BALAMT>-562.00</BALAMT>
80
+ <DTASOF>20050831165153</DTASOF>
81
+ </LEDGERBAL>
82
+ </CCSTMTRS>
83
+ </CCSTMTTRNRS>
84
+ </CREDITCARDMSGSRSV1>
85
+ </OFX>
@@ -0,0 +1,44 @@
1
+ require "spec_helper"
2
+
3
+ describe OFX::Account do
4
+ before do
5
+ @ofx = OFX::Parser::Base.new("spec/fixtures/sample.ofx")
6
+ @parser = @ofx.parser
7
+ @account = @parser.account
8
+ end
9
+
10
+ describe "account" do
11
+ it "should return currency" do
12
+ @account.currency.should == "BRL"
13
+ end
14
+
15
+ it "should return bank id" do
16
+ @account.bank_id.should == "0356"
17
+ end
18
+
19
+ it "should return id" do
20
+ @account.id.should == "03227113109"
21
+ end
22
+
23
+ it "should return type" do
24
+ @account.type.should == :checking
25
+ end
26
+
27
+ it "should return transactions" do
28
+ @account.transactions.should be_a_kind_of(Array)
29
+ @account.transactions.size.should == 36
30
+ end
31
+
32
+ it "should return balance" do
33
+ @account.balance.amount.should == 598.44
34
+ end
35
+
36
+ it "should return balance in pennies" do
37
+ @account.balance.amount_in_pennies.should == 59844
38
+ end
39
+
40
+ it "should return balance date" do
41
+ @account.balance.posted_at.should == Time.parse("2009-11-01")
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,29 @@
1
+ require "spec_helper"
2
+
3
+ describe OFX::Parser::OFX102 do
4
+ before do
5
+ @ofx = OFX::Parser::Base.new("spec/fixtures/sample.ofx")
6
+ @parser = @ofx.parser
7
+ end
8
+
9
+ it "should have a version" do
10
+ OFX::Parser::OFX102::VERSION.should == "1.0.2"
11
+ end
12
+
13
+ it "should set headers" do
14
+ @parser.headers.should == @ofx.headers
15
+ end
16
+
17
+ it "should trim trailing whitespace from headers" do
18
+ headers = OFX::Parser::OFX102.parse_headers("VERSION:102 ")
19
+ headers["VERSION"].should == "102"
20
+ end
21
+
22
+ it "should set body" do
23
+ @parser.body.should == @ofx.body
24
+ end
25
+
26
+ it "should set account" do
27
+ @parser.account.should be_a_kind_of(OFX::Account)
28
+ end
29
+ end