%%%---------------------------------------------------------------------
%%% Copyright CellTransact 2002 (c)
%%%
%%% All rights reserved. No part of this computer programs(s) may be
%%% used, reproduced,stored in any retrieval system, or transmitted,
%%% in any form or by any means, electronic, mechanical, photocopying,
%%% recording, or otherwise without prior written permission of
%%% CellTransact.
%%%---------------------------------------------------------------------

%%%---------------------------------------------------------------------
%%% Revision History
%%%---------------------------------------------------------------------
%%% Rev 1.000 Date 2002/04/28
%%% Author Danie Schutte      (daniesc@tebabank.com)
%%% Initial version of internal transaction format
%%% Fields specifications incomplete - awaiting further documentation
%%% Postillion field specification documentation used as basis - see
%%% APPENDIX A - POSTILLION FIELD SPECIFICATIONS
%%% Rev 1.001 1/11/2003 6:30PM
%%% Author Heinrich Venter
%%% consolidated the changes accorss the various versions of this file
%%%---------------------------------------------------------------------

%% File: int_trx.hrl
%%-----------------------------------------------------------
%% Data Type: Internal Transaction Format
%% where:
%%   Refer to Document: APPENDIX xxx - Internal Transaction
%%                      Format Elements
%%
%%------------------------------------------------------------


-revision('$Revision: 1.00.00.02 $ ').
-copyright('Copyright (c) 2002 CellTransact').
-author('daniesc@tebabank.com').


-record( iso_field, {
	 field_number,
	 field_data }).

-record( message_type, {
	 message_class,
	 message_function }).

-record( bitmaps, {
	 bitmap1,
	 bitmap2,
	 bitmap3 }).

-record( time_record, {
	 time_hh,
	 time_mm,
	 time_ss
	 }).

-record( date_record, {
	 date_yy,
	 date_mm,
	 date_dd
	 }).

-record( processing_code, {
   	 transaction_type,
   	 account_type_from,
   	 account_type_to
   	 }).

-record( transmission_datetime, {
	 transmission_date = #date_record{},
	 transmission_time = #time_record{}
	 }).

-record( transaction_datetime, {
	 transaction_date = #date_record{},
	 transaction_time = #time_record{}
	 }).

-record( conversion_rate, {
	 decimal_places,
	 conversion_rate
	 }).

-record( pos_entry_mode, {
	 pan_entry_mode,
	 pin_entry_capability  }).

-record( variable_length_data_record, {
	 data_length,
	 data }).

-record( signed_amount, {
	 sign,
	 amount }).

-record( track_2_data, {
	 primary_account_number
	 }).

-record( pin_data, {
	 pin_data
	 }).

-record( security_related_control_information, {
	 security_data }).

-record( additional_amount_data, {
	 account_type,
	 amount_type,
	 currency_code,
	 amount_sign,
	 amount }).

-record( additional_amounts, {
	 data_length,
	 additional_amount_data_1 = #additional_amount_data{},
	 additional_amount_data_2 = #additional_amount_data{},
	 additional_amount_data_3 = #additional_amount_data{},
	 additional_amount_data_4 = #additional_amount_data{},
	 additional_amount_data_5 = #additional_amount_data{},
	 additional_amount_data_6 = #additional_amount_data{}
	 }).

-record( origional_data_elements, {
	 message_type,
	 systems_trace_audit_number,
	 transmission_datetime,
	 acquirer_institution_id_code,
	 forwarding_institution_id_code }).

-record( replacement_amounts, {
	 actual_amount_transaction,
	 actual_amount_settlement,
	 actual_amount_transaction_fee_sign,
	 actual_amount_transaction_fee,
	 actual_amount_settlement_fee_sign,
	 actual_amount_settlement_fee }).


-record( pos_data_code, {
	 card_data_input_capability,
	 cardholder_authentication_capability,
	 card_capture_capability,
	 operating_environment,
	 cardholder_is_present,
	 card_is_present,
	 card_data_input_mode,
	 cardholder_authentication_method,
	 cardholder_authentication_entity,
	 card_data_output_capability,
	 terminal_output_capability,
	 pin_capture_capability,
	 terminal_operator,
	 terminal_type }).


-record(postbridge,
   {fld127_1_bitmap,
    fld127_2_undefined,
    fld127_3_routing_information,
    fld127_4_pos_data,
    fld127_5_service_station_data,
    fld127_6_authorization_profile,
    fld127_7_check_data,
    fld127_8_retention_data,
    fld127_9_additional_node_data,
    fld127_10_cvv2,
    fld127_11_origional_key,
    fld127_12_terminal_owner,
    fld127_13_pos_geographic_data,
    fld127_14_sponsor_bank,
    fld127_15_address_verification_data,
    fld127_16_address_verification_result,
    fld127_17_cardholder_information,
    fld127_18_validation_data,
    fld127_19_bank_details,
    fld127_20_authorizer_date_settlement,
    fld127_21_record_identification,
    fld127_22_structured_data,
    fld127_23_payee_name_address,
    fld127_24_payer_account,
    fld127_25_icc_data}).

-record(transaction_data,
   {bitmaps = #bitmaps{},
    fld02_pan,
    fld03_processing_code = #processing_code{},
    fld04_transaction_amount,
    fld05_settlement_amount,
    fld06_unknown,
    fld07_transmission_datetime = #transmission_datetime{},
    fld08_unknown,
    fld09_settlement_conversion_rate = #conversion_rate{},
    fld10_unknown,
    fld11_system_trace_audit_number,
    fld12_local_transaction_time = #time_record{},
    fld13_local_transaction_date = #date_record{},
    fld14_expiry_date = #date_record{},
    fld15_settlement_date = #date_record{},
    fld16_conversion_date = #date_record{},
    fld17_unknown,
    fld18_merchant_type,
    fld19_unknown,
    fld20_unknown,
    fld21_unknown,
    fld22_pos_entry_mode = #pos_entry_mode{},
    fld23_card_sequence_number,
    fld24_unknown,
    fld25_pos_condition_code,
    fld26_pos_pin_capture_code,
    fld27_authorization_id_response_length,
    fld28_transaction_fee_amount = #signed_amount{},
    fld29_settlement_fee_amount = #signed_amount{},
    fld30_transaction_processing_fee_amount = #signed_amount{},
    fld31_settlement_processing_fee_amount = #signed_amount{},
    fld32_acquiring_institution_id_code = #variable_length_data_record{},
    fld33_forwarding_institution_id_code = #variable_length_data_record{},
    fld34_unknown,
    fld35_track_2_data = #track_2_data{},
    fld36_unknown,
    fld37_retrieval_reference_number,
    fld38_authorization_id_response,
    fld39_response_code,
    fld40_service_restriction_code,
    fld41_card_acceptor_terminal_id,
    fld42_card_acceptor_id_code,
    fld43_card_acceptor_name_location,
    fld44_additional_response_data = #variable_length_data_record{},
    fld45_unknown,
    fld46_unknown,
    fld47_unknown,
    fld48_additional_data = #variable_length_data_record{},
    fld49_transaction_currency_code,
    fld50_settlement_currency_code,
    fld51_unknown,
    fld52_pin_data = #pin_data{},
    fld53_security_related_control_information = #security_related_control_information{},
    fld54_additional_amounts = #additional_amounts{},
    fld55_unknown,
    fld56_message_reason_code = #variable_length_data_record{},
    fld57_authorization_lifecycle_code = #variable_length_data_record{},
    fld58_authorizing_agent_id_code = #variable_length_data_record{},
    fld59_echo_data = #variable_length_data_record{},
    fld60_unknown,
    fld61_unknown,
    fld62_unknown,
    fld63_unknown,
    fld64_unknown,
    fld65_unknown,
    fld66_settlement_code,
    fld67_extended_payment_code,
    fld68_unknown,
    fld69_unknown,
    fld70_network_management_information_code,
    fld71_unknown,
    fld72_unknown,
    fld73_action_date = #date_record{},
    fld74_number_of_credits,
    fld75_number_of_credit_reversals,
    fld76_number_of_debits,
    fld77_number_of_debit_reversals,
    fld78_number_of_transfers,
    fld79_number_of_transfer_reversals,
    fld80_number_of_inquiries,
    fld81_number_of_authorizations,
    fld82_processing_fee_amount_credits,
    fld83_transaction_fee_amount_credits,
    fld84_processing_fee_amount_debits,
    fld85_transaction_fee_amount_debits,
    fld86_credit_amounts,
    fld87_credit_reversal_amounts,
    fld88_debit_amounts,
    fld89_debit_reversal_amounts,
    fld90_origional_data_elements = #origional_data_elements{},
    fld91_file_update_code,
    fld92_unknown,
    fld93_unknown,
    fld94_unknown,
    fld95_replacement_amounts = #replacement_amounts{},
    fld96_unknown,
    fld97_net_settlement_amount = #signed_amount{},
    fld98_payee,
    fld99_unknown,
    fld100_receiving_institution_id_code = #variable_length_data_record{},
    fld101_filename = #variable_length_data_record{},
    fld102_account_identification_1 = #variable_length_data_record{},
    fld103_account_identification_2 = #variable_length_data_record{},
    fld104_unknown,
    fld105_unknown,
    fld106_unknown,
    fld107_unknown,
    fld108_unknown,
    fld109_unknown,
    fld110_unknown,
    fld111_unknown,
    fld112_unknown,
    fld113_unknown,
    fld114_unknown,
    fld115_unknown,
    fld116_unknown,
    fld117_unknown,
    fld118_number_of_payments = #variable_length_data_record{},
    fld119_number_of_payment_reversals = #variable_length_data_record{},
    fld120_unknown,
    fld121_unknown,
    fld122_unknown,
    fld123_pos_data_code = #pos_data_code{},
    fld124_unknown,
    fld125_network_management_information = #variable_length_data_record{},
    fld126_unknown,
    fld127_unknown,
    fld128_unknown,

    fld300_protocol,
    fld301_protocol_type,
    fld302_guid,
    fld303_application_number,
    fld304_message_type = #message_type{},
    fld305_message_class,
    fld306_message_function,
    fld307_transaction_type,
    fld310_transaction_date = #transaction_datetime{},
    fld320_pan,
    fld321_pin,
    fld322_pan_2,
    fld323_pin_2,
    fld324_pan_3,
    fld325_pin_3,
    fld331_client_id_type,
    fld332_client_id_number,
    fld333_client_msisdn,
    fld334_reference_number,
    fld341_terminal_msisdn,
    fld342_software_version,
    fld343_sequence_number,
    fld344_cdv,
    fld350_internal_account_01,
    fld351_internal_subaccount_01,
    fld355_internal_account_02,
    fld356_internal_subaccount_02,
    fld360_internal_account_03,
    fld361_internal_subaccount_03,
    fld370_extended_response_code,
    fld371_extended_info,
    fld381_data_1,
    fld382_data_2,
    fld383_data_3,
    fld384_data_4,
    fld385_data_5,
    fld386_data_6,
    fld390_cash_amount,
    fld391_purchase_amount,
    fld400_ussd_response}).

