Skip to content

Commit

Permalink
Updated AMEX Parser to send actual transaction_id in external_id (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
modernwarfareuplink authored Jan 5, 2022
1 parent 0f84a0c commit 9bbcfaa
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## [0.6.0]

### Changed

- Added AMEX transaction_id as `transaction_id` in AMEX Parser.

## [0.5.0]

### Changed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Check implemented parsers for examples.
### Run tests

```
chmod +x text.sh
chmod +x test.sh
./test.sh
```
Expand Down
1 change: 1 addition & 0 deletions card_data_parsers/models/amex_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ class AmexTransaction(Transaction):
airline_travel_agency_name: str = None
airline_ticket_number: str = None
airline_type: str = None
transaction_id: str = None
3 changes: 3 additions & 0 deletions card_data_parsers/parsers/amex_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ def __extract_transactions(txn_lines, account_number_mask_begin, account_number_
txn.account_number = mask_card_number(txn.account_number, account_number_mask_begin,
account_number_mask_end)

# adding actual AMEX transaction_id before modifying it
txn.transaction_id = txn.external_id

external_id = str(txn.external_id + txn.account_number + txn.transaction_dt + txn.description + txn.currency + txn.amount)
if txn.foreign_currency is not None and txn.foreign_amount is not None:
external_id = str(external_id + txn.foreign_currency + txn.foreign_amount)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name='card_data_parsers',
version='0.5.0',
version='0.6.0',
author='Siva Narayanan',
author_email='[email protected]',
url='https://www.fylehq.com',
Expand Down
3 changes: 2 additions & 1 deletion tests/card_data_parsers/amex/p1/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"external_id": "0d3eaafa0c8f934f362c53bb2d3ccd67",
"merchant_category_code": "10",
"vendor": "5",
"bank_name": "Test Bank"
"bank_name": "Test Bank",
"transaction_id": "0914600172007637906017110005010001521"
}
]

0 comments on commit 9bbcfaa

Please sign in to comment.