Note
license: GNU Lesser General Public License v3.0 (see LICENSE)
Partial implementation of a OFX file writer.
This package is not intended to fully implement the OFX Spec. Its final purpose
is the conversion from CSB43 (norma 43 del Consejo Superior Bancario). That is,
only transaction response is (partially) implemented.
-
csb43.ofx.convertFromCsb(csb)
Convert a File file into an OFX file
>>> # OFX
>>> from csb43 import csb_43, ofx
>>> #
>>> csbFile = csb_43.File(open("movimientos.csb"), strict=False)
>>> #
>>> # print to stdout
>>> print ofx.convertFromCsb(csbFile)
-
ofx.PAYMODES = {'11': 7, '10': 10, '99': 16, '12': 8, '17': 2, '02': 0, '03': 5, '01': 10, '15': 9, '07': 15, '04': 9, '05': 3, '08': 3}
-
class csb43.ofx.File(tagName='ofx')
An OFX file
>>> from csb43.ofx import File
>>> f = File()
>>> print f
<?xml version="1.0" encoding="ASCII"?>
<?OFX OFXHEADER="200" VERSION="211" SECURITY="NONE"
OLDFILEUID="NONE" NEWFILEUID="NONE"?><OFX><BANKMSGSRSV1></BANKMSGSRSV1></OFX>
-
__str__()
Return type: | XML representation of the object |
-
add_response(value)
Add a response to the file
Parameters: | value (Response) – a response object to include in this object |
-
get_responses()
-
-
get_tag_name()
Return type: | the XML tag name |
-
set_tag_name(name)
Set a XML tag name for this object
Parameters: | name (str) – name for the XML tag |
-
class csb43.ofx.Response(tagName='stmtrs')
-
add_balance(value)
Add a complementary balance
Parameters: | value (Balance) – a complementary balance |
-
get_available_balance()
Return type: | Balance – the available balance aggregate |
-
get_balances()
Return type: | list of miscellaneous other Balance s |
-
get_bank_account_from()
-
-
get_currency()
Return type: | pycountry.dbCurrency – Default currency for the statement |
-
get_ledger_balance()
Return type: | Balance – the ledger balance aggregate |
-
get_mktginfo()
Return type: | marketing info |
-
get_tag_name()
Return type: | the XML tag name |
-
get_transaction_list()
-
-
set_available_balance(value)
Parameters: | value (Balance) – available balance |
-
set_bank_account_from(value)
-
-
set_currency(value)
Parameters: | value (pycountry.db.Currency) – currency |
-
set_ledger_balance(value)
Parameters: | value (Balance) – ledger balance |
-
set_mktginfo(value)
Parameters: | value – marketing info |
-
set_tag_name(name)
Set a XML tag name for this object
Parameters: | name (str) – name for the XML tag |
-
set_transaction_list(value)
-
-
class csb43.ofx.Balance(tagName='bal')
A balance
-
get_amount()
Return type: | the amount of the balance |
-
get_date()
Return type: | datetime – date of the balance |
-
get_tag_name()
Return type: | the XML tag name |
-
set_amount(value)
Parameters: | value – amount |
-
set_date(value)
-
-
set_tag_name(name)
Set a XML tag name for this object
Parameters: | name (str) – name for the XML tag |
-
class csb43.ofx.BankAccount(tagName='bankaccfrom')
A bank account
-
TYPE = ['CHECKING', 'SAVINGS', 'MONEYMRKT', 'CREDITLINE']
account type
-
get_bank()
Return type: | str – bank identifier (Spain: banco, entidad) |
-
get_branch()
Return type: | str – branch identifier (Spain: sucursal, oficina) |
-
get_id()
Return type: | str – account identifier |
-
get_key()
Return type: | str – checksum (Spain: digitos de control) |
-
get_tag_name()
Return type: | the XML tag name |
-
get_type()
Return type: | str – type of account. See TYPE (default ‘SAVINGS’) |
-
set_bank(value)
Parameters: | value – bank identifier |
-
set_branch(value)
Parameters: | branch – branch identifier |
-
set_id(value)
Parameters: | value – account id |
-
set_key(value)
Parameters: | value – checksum |
-
set_tag_name(name)
Set a XML tag name for this object
Parameters: | name (str) – name for the XML tag |
-
set_type(value)
Parameters: | value (str) – type of account |
-
class csb43.ofx.Transaction(tagName='stmttrn')
A OFX transaction
-
TYPE = ['CREDIT', 'DEBIT', 'INT', 'DIV', 'FEE', 'SRVCHG', 'DEP', 'ATM', 'POS', 'XFER', 'CHECK', 'PAYMENT', 'CASH', 'DIRECTDEP', 'DIRECTDEBIT', 'REPEATPMT', 'OTHER']
type of transaction
-
get_amount()
Return type: | number – amount of transaction |
-
get_bank_account_to()
Return type: | BankAccount – account the transaction is transferring to |
-
get_cc_account_to()
cc account to
-
get_check_num()
Return type: | str – check (or other reference) number |
-
get_correct_action()
correct action
-
get_correct_fit_id()
correct fit id
-
get_currency()
Return type: | pycountry.db.Currency – currency of the transaction, if different from the one in BankAccount |
-
get_date_available()
-
-
get_date_initiated()
-
-
get_date_posted()
-
-
get_extended_name()
Return type: | str – extended name of payee or description of transaction |
-
get_image_data()
image data
-
get_inv_401source()
-
get_memo()
Return type: | str – extra information |
-
get_name()
Return type: | str – name of payee or description of transaction |
-
get_origin_currency()
Return type: | pycountry.db.Currency – currency of the transaction, if different from the one in BankAccount |
-
get_payee()
-
-
get_payeeid()
Return type: | str – payee identifier |
-
get_ref_num()
Return type: | str – reference number that uniquely indentifies the transaction. |
-
get_server_tid()
server transaction id
-
get_standard_industrial_code()
standard industrial code
-
get_tag_name()
Return type: | the XML tag name |
-
get_transaction_id()
Return type: | str – transaction ID issued by financial institution |
-
get_type()
Return type: | str – transaction type. See TYPE. Default (‘OTHER’) |
-
set_amount(value)
-
set_bank_account_to(value)
-
set_cc_account_to(value)
-
set_check_num(value)
-
set_correct_action(value)
-
set_correct_fit_id(value)
-
set_currency(value)
-
set_date_available(value)
-
set_date_initialised(value)
-
set_date_posted(value)
-
set_extended_name(value)
Parameters: | value – extended name of payee or description of transaction |
-
set_image_data(value)
-
set_inv_401source(value)
-
set_memo(value)
-
set_name(value)
Parameters: | value – name of payee or description of transaction |
-
set_origin_currency(value)
-
set_payee(value)
-
set_payeeid(value)
-
set_ref_num(value)
Parameters: | value – reference number that uniquely indentifies the transaction. |
-
set_server_tid(value)
-
set_standard_industrial_code(value)
-
set_tag_name(name)
Set a XML tag name for this object
Parameters: | name (str) – name for the XML tag |
-
set_transaction_id(value)
-
set_type(value)
-
class csb43.ofx.TransactionList(tagName='banktranslist')
Transaction list aggregate
-
add_transaction(value)
Add a new transaction to the list
-
get_date_end()
-
-
get_date_start()
-
-
get_list()
-
-
get_tag_name()
Return type: | the XML tag name |
-
set_date_end(value)
-
-
set_date_start(value)
-
-
set_tag_name(name)
Set a XML tag name for this object
Parameters: | name (str) – name for the XML tag |