SynapseIX / objective-iso8583

Objective-C library for iOS and Mac OS X that implements the ISO-8583 financial transaction protocol. Build and parse standard and/or custom ISO-8583 messages using a friendly and easy to use interface.
MIT License
17 stars 10 forks source link

buildIsoMessage:nil ISO method #1

Closed diogomaximo closed 10 years ago

diogomaximo commented 10 years ago

Congratulations for the project. I'm trying to make an example comparing the output with a Java-based (jpos) solution. The ISO result message is a little different, I think because you are not formatting the content to HEXA.

Params. MIT -> 1810 Bit 03 -> 123 Bit 04 -> 12300 Bit 34 -> 1231321321

Objective-C Code [isoMessage1 setMTI:@"1810"]; isoMessage1.bitmap = [[ISOBitmap alloc] initWithGivenDataElements:@[@"DE03",@"DE04",@"DE34"] configFileName:nil]; [isoMessage1 addDataElement:@"DE03" withValue:@"123" configFileName:nil]; [isoMessage1 addDataElement:@"DE04" withValue:@"12300" configFileName:nil]; [isoMessage1 addDataElement:@"DE34" withValue:@"1231321321" configFileName:nil]; NSString *theBuiltMessage = [isoMessage1 buildIsoMessage:nil];

Output with JPOS. 1810 //MIT 3000000040000000 //BitMap 000123 //03 000000012300 //04 10 31323331333231333231 //34

Output with Objective-ISO8583 1810 //OK 3000000040000000 //OK 000123 //OK 000000012300 //OK 10 1231321321 //DIFFERENT

SynapseIX commented 10 years ago

Diogo, thank you for using my library. Exactly, as now, the library gives you the exact value for the data element. As you can see, if you need a HEX value you must convert it manually. I can add (or you can propose) an update to include a function that takes a decimal numeric value as input, and returns a HEX or BIN conversion of it. If you see the ISOHelper class, there are methods to convert from BIN to HEX and from HEX to BIN. In JPOS's case, it gives you a 10 length value but the HEX value is obviously not 10 in length (as with the original value) which is an inconsistency.