Support for Mastercard T5G2/T5G4 Enhanced Reconciliation Report
Hello, in some way support could be generated for the T5G2 mastercard file, if possible I can provide sample files to generate the support
Please attach details of the file format and sample files here so I can review.
Hello, sorry for the delay in my response, I am attaching the Mastercard documentation of the file as well as a test file, for your review.
Apologies for my delay.. I've had a look at this file format. Cardutil could be enhanced to support this and I would be happy to accept a pull request with this enhancement.
Its not something I would look at looking at developing - if you are interested in a commercial engagement to develop this functionality, send me an email.
If you want to give it a go yourself. I would have a look at cli.mci_ipm_param_to_csv for a similar file reader. IPM parameters files use VBS but have a flat file structure for storing data rather than ISO8583 based like IPM files. This has a file describing header that could be used to decode the file which is nice.
Here is a quick script I wrote to read the contents of your file. It does have a very long record length which causes an issue with the existing Cardutil version as I throw an exception if a record is more than 3000 bytes (the record was over 5000 bytes). I will add a fix for this in the next version of cardutil that I release.
import binascii
import cardutil.mciipm as ipm
with open('T5G20947528102.ipm', 'rb') as ipm_file:
vbs_reader = ipm.VbsReader(ipm_file)
try:
for record in vbs_reader:
print(binascii.hexlify(record))
print(record.decode("cp500"))
except ipm.MciIpmDataError as ex:
print(ex.record_number)
print(ex.binary_context_data)
print(ex)
And the output
'd9858396958389938981a389969540d985979699a340e5f2'
Reconciliation Report V2
b'f2f0f2f460f1f060f0f640f2f37af4f27af5f740c3e2e3'
2024-10-06 23:42:57 CST
b'c689938540...omitted...'
File ID:ul0025, Message Number:nr0008, Claim ID:nr0019, Event ID:nr0019, Card Issuer Reference Data:nr0010, Acquirer Reference Number:nr0023, MTI:nr0004, Primary Account Number:al0019, Processing Code:nr0006, Function Code:nr0003, Message Reason Code:nr0004, Amount Transaction:nr0012, Transaction Currency Code:nr0003, Transaction Currency Exponent:ul0001, Amount Sender¬s DE 05 without fees:nr0012, Reconciliation Currency Code:nr0003, Reconciliation Currency Exponent:ul0001, Amount Cardholder Billing:nr0012, Cardholder Billing Currency Code:nr0003, Cardholder Billing Currency Exponent:ul0001, Retrieval Reference Number:ul0012, Card Acceptor Business Code:nr0004, Card Acceptor ID:ul0015, Card Acceptor Name:ul0022, Date Time of Transaction:ul0012, Transaction Originator Institution ID Code:nr0011, Transaction Destination Institution ID Code:nr0011, Reversal Flag:al0001, Conversion Rate Reconciliation:nr0008, Amounts Original:nr0012, Original Amount Currency code:nr0003, Original Amount Currency Exponent:ul0001, Amount Transaction fee:ul432, Clearing Date:nr0006, Clearing cycle ID:nl0001, Transaction Status:al0007, Amount Reconciliation with fees:nr0012, Reconciliation Currency Code:nr0003, Reconciliation Currency Exponent:ul0001, Reason for Rejection:ul5000, Transaction Life Cycle ID:ul0016, Currency Conversion Assessment Amount:nr0012, Currency Conversion Assessment Currency Code:nr0003, Currency Conversion Assessment Currency Exponent:ul0001, GCMS Product Identifier:ul0003, Licensed Product Identifier:ul0003, Flex Code:ul0003
b'd98583969984c396a495a37a40f0f0f0f0f0f1'
RecordCount: 000001
b'f9f0f6f2f4f1f0.. omitted...'
9062410060000001906601895000051930000002010021263982000000301002126420592559380505265384425808878740125214425155070109677950 000000450483700000001000084020000000100008402000000000000 0 5812526186080887 WINGSTOP 2214 2409141336230000003197200000020307 61000000000000010000840200DR01840000000000160840000000000160 2410072SUCCESS0000000098408402 MCST8IRLB0913 000000000000 MCSMCS