Skip to main content

Module protocol

Module protocol 

Source
Expand description

ECR17 application-message builders โ€” the bytes that go between STX and ETX.

Every field is fixed-width and validated: a value that overflows its field returns Ecr17Error::FieldOverflow so a malformed frame is never produced. Ported from the reference C++ Ecr17Protocol.

payment_type is the single request digit: '0' auto, '1' debit, '2' credit, '3' other (see crate::types::PaymentCardType).

Functionsยง

build_additional_tags
Additional data for GT / tokenization 'U' (variable).
build_card_verification
Card verification 'H' (39 bytes).
build_close_session
Close session 'C' (26 bytes).
build_enable_ecr_print
Enable/disable ECR printing 'E' (11 bytes).
build_extended_payment
Extended payment 'X' (167 bytes).
build_incremental
Incremental pre-auth 'i' (176 bytes).
build_payment
Payment 'P' (167 bytes).
build_pre_auth
Pre-auth 'p' (167 bytes).
build_pre_auth_closure
Pre-auth closure 'c' (176 bytes).
build_reprint
Reprint ticket 'R' (22 bytes).
build_reversal
Reversal 'S' (26 bytes); stan = "000000" reverses the last payment with no STAN check.
build_send_last_result
Send last result 'G' (22 bytes).
build_status
Status 's' (10 bytes; lowercase code per spec).
build_totals
Totals 'T' (26 bytes).
build_vas
VAS 'K' (variable, length-prefixed XML, max 1024 bytes).
format_tokenization_tag
Formats the TAG 5 content for tokenization (Intesa-style mapping): "0COF0TRK<contract>|0FNZ03" (unscheduled/one-click) or "0REC0TRK<contract>|0FNZ03" (recurring). recurring selects 0REC vs 0COF.