Skip to content

Commit

Permalink
Merge pull request #183 from diraol/dro/acctid
Browse files Browse the repository at this point in the history
Change acctid type to NagString
  • Loading branch information
csingley authored Apr 13, 2024
2 parents cd280e7 + 6467e98 commit 6ad692e
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 16 deletions.
1 change: 0 additions & 1 deletion ofxtools/Types.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
(e.g. ``SubAggregate``) express parent/child relationships between ``Aggregates``.
"""


__all__ = [
"OFXTypeWarning",
"OFXTypeError",
Expand Down
1 change: 1 addition & 0 deletions ofxtools/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
examine the consequences of a failure. In this case a failure kills too many
people and kills them too automatically.
"""

__title__ = "ofxtools"
__description__ = "Library for working with Open Financial Exchange (OFX) data"
__url__ = "https://github.com/csingley/ofxtools"
Expand Down
8 changes: 4 additions & 4 deletions ofxtools/models/bank/stmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class BANKACCTFROM(Aggregate):

bankid = String(9, required=True)
branchid = String(22)
acctid = String(22, required=True)
acctid = NagString(22, required=True)
accttype = OneOf(*ACCTTYPES, required=True)
acctkey = String(22)

Expand All @@ -106,7 +106,7 @@ class BANKACCTTO(Aggregate):

bankid = String(9, required=True)
branchid = String(22)
acctid = String(22, required=True)
acctid = NagString(22, required=True)
accttype = OneOf(*ACCTTYPES, required=True)
acctkey = String(22)

Expand All @@ -124,14 +124,14 @@ class BANKACCTINFO(Aggregate):
class CCACCTFROM(Aggregate):
"""OFX section 11.3.2"""

acctid = String(22, required=True)
acctid = NagString(22, required=True)
acctkey = String(22)


class CCACCTTO(Aggregate):
"""OFX section 11.3.2"""

acctid = String(22, required=True)
acctid = NagString(22, required=True)
acctkey = String(22)


Expand Down
6 changes: 3 additions & 3 deletions ofxtools/models/invest/acct.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


# Local imports
from ofxtools.Types import Bool, String, OneOf, SubAggregate
from ofxtools.Types import Bool, String, NagString, OneOf, SubAggregate
from ofxtools.models.base import Aggregate
from ofxtools.models.common import SVCSTATUSES

Expand Down Expand Up @@ -43,14 +43,14 @@ class INVACCTFROM(Aggregate):
"""OFX section 13.6.1"""

brokerid = String(22, required=True)
acctid = String(22, required=True)
acctid = NagString(22, required=True)


class INVACCTTO(Aggregate):
"""OFX section 13.6.1"""

brokerid = String(22, required=True)
acctid = String(22, required=True)
acctid = NagString(22, required=True)


class INVACCTINFO(Aggregate):
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
11. `make clean`
12. Change download_url back to master; commit & push
"""

# stdlib imports
import os.path
from setuptools import setup, find_packages
Expand Down
95 changes: 95 additions & 0 deletions tests/data/br_nubank_cc.ofx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:NONE
<OFX>
<SIGNONMSGSRSV1>
<SONRS>
<STATUS>
<CODE>0
<SEVERITY>INFO
</STATUS>

<DTSERVER>20240402000000[-3:GMT]
<LANGUAGE>POR
</SONRS>
</SIGNONMSGSRSV1>

<CREDITCARDMSGSRSV1>
<CCSTMTTRNRS>
<TRNUID>1001
<STATUS>
<CODE>0
<SEVERITY>INFO
</STATUS>

<CCSTMTRS>
<CURDEF>BRL
<CCACCTFROM>
<ACCTID>11111111-UUID-UUID-UUID-111111111111
</CCACCTFROM>

<BANKTRANLIST>
<DTSTART>20240224000000[-3:GMT]
<DTEND>20240326000000[-3:GMT]
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20240323000000[-3:GMT]
<TRNAMT>-13.00
<FITID>11111111-UUID-4747-8883-111111111111
<MEMO>-memo-message-
</STMTTRN>

<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20240323000000[-3:GMT]
<TRNAMT>-162.90
<FITID>11111111-UUID-44dc-b153-111111111111
<MEMO>-memo-message-
</STMTTRN>

<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20240323000000[-3:GMT]
<TRNAMT>-33.46
<FITID>11111111-UUID-4ec7-a011-111111111111
<MEMO>-memo-message-
</STMTTRN>

<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20240322000000[-3:GMT]
<TRNAMT>-9.02
<FITID>11111111-UUID-4ca3-8d84-111111111111
<MEMO>-memo-message-
</STMTTRN>

<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20240322000000[-3:GMT]
<TRNAMT>-103.53
<FITID>11111111-UUID-4b37-972f-111111111111
<MEMO>-memo-message-
</STMTTRN>

<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20240322000000[-3:GMT]
<TRNAMT>-959.00
<FITID>11111111-UUID-427c-8fc0-111111111111
<MEMO>-memo-message-
</STMTTRN>

<LEDGERBAL>
<BALAMT>-1280.91
<DTASOF>20240325000000[-3:GMT]
</LEDGERBAL>
</CCSTMTRS>
</CCSTMTTRNRS>
</CREDITCARDMSGSRSV1>
</OFX>
6 changes: 3 additions & 3 deletions tests/test_models_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ def msgsetlist(cls):
signonmsgsetv1 = SubElement(signonmsgset, "SIGNONMSGSETV1")
msgsetcore = SubElement(signonmsgsetv1, "MSGSETCORE")
SubElement(msgsetcore, "VER").text = "1"
SubElement(
msgsetcore, "URL"
).text = "https://ofxs.ameritrade.com/cgi-bin/apps/OFX"
SubElement(msgsetcore, "URL").text = (
"https://ofxs.ameritrade.com/cgi-bin/apps/OFX"
)
SubElement(msgsetcore, "OFXSEC").text = "NONE"
SubElement(msgsetcore, "TRANSPSEC").text = "Y"
SubElement(msgsetcore, "SIGNONREALM").text = "AMERITRADE"
Expand Down
6 changes: 3 additions & 3 deletions tests/test_models_signon.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ class MfachallengeTestCase(unittest.TestCase, base.TestAggregate):
def etree(cls):
root = Element("MFACHALLENGE")
SubElement(root, "MFAPHRASEID").text = "MFA13"
SubElement(
root, "MFAPHRASELABEL"
).text = "Please enter the last four digits of your social security number"
SubElement(root, "MFAPHRASELABEL").text = (
"Please enter the last four digits of your social security number"
)
return root

@classproperty
Expand Down
3 changes: 1 addition & 2 deletions tests/test_ofxget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1388,8 +1388,7 @@ def test_extract_acctinfos(self):
# our results are the same as the children of
# test_models_signup.AcctinfoTestCase, which was used to construct
# self.ofx
class Foo(unittest.TestCase, base.OfxTestCase):
...
class Foo(unittest.TestCase, base.OfxTestCase): ...

tc = Foo()

Expand Down

0 comments on commit 6ad692e

Please sign in to comment.