TIM SDK
TIM API C
receipt_formatter.h File Reference

Description

Receipt formatter.

Object type receipt_formatter.

Data Structures

struct  ta_s_receipt_formatter
 Struct knowing how to format transaction receipts using receipt item fields. More...
 

Typedefs

typedef ta_e_result_code_t(* ta_cb_receipt_formatter_format_receipt) (ta_object_t terminal, ta_object_t receipt_items, ta_object_t receipts, void *user_pointer)
 Format receipt using the provided fields. More...
 
typedef struct ta_s_receipt_formatter ta_s_receipt_formatter_t
 Struct knowing how to format transaction receipts using receipt item fields. More...
 

Functions

ta_e_result_code_t ta_receipt_formatter_create (ta_object_t *formatter, const ta_s_receipt_formatter_t *configuration)
 Create receipt formatter. More...
 

Typedef Documentation

◆ ta_cb_receipt_formatter_format_receipt

typedef ta_e_result_code_t( * ta_cb_receipt_formatter_format_receipt) (ta_object_t terminal, ta_object_t receipt_items, ta_object_t receipts, void *user_pointer)

Format receipt using the provided fields.

Result is a list of receipt using "\n" as line breaks.

Parameters
[in]terminalObject instance of type terminal with terminal to retrieve certain field values from. Object instance is not retained.
[in]receipt_itemsObject instance of type receipt_items containing items used to create receipt. Object instance is not retained.
[out]receiptsObject instance of type list to fill with created receipts. Receipts have to be object instances of type receipt.
[in]user_pointerUser pointer value used while creating the formatter.
Returns
Result code from ta_e_result_code_t.

◆ ta_s_receipt_formatter_t

Struct knowing how to format transaction receipts using receipt item fields.

Use memset to clear struct to 0 then set the callback and user pointer. This struct is only used to initialize the formatter during a call to ta_receipt_formatter_create. Afterwards the callbacks can not be changed anymore as long as the formatter is alive.

Function Documentation

◆ ta_receipt_formatter_create()

ta_e_result_code_t ta_receipt_formatter_create ( ta_object_t formatter,
const ta_s_receipt_formatter_t configuration 
)

Create receipt formatter.

Caller retains a reference to the created instance. While assigning to a terminal instance the terminal instance retains the reference. The user can release the reference directly afterwards. In this case the formatter is destroyed once no terminal instance requires the formatter anymore.

Parameters
[out]formatterPointer to variable to write created object instance to. Created object instance is retained.
[in]configurationPointer to struct containinig formatter configuration.
Return values
ta_c_rc_okObject instance has been created and written to formatter.
ta_c_rc_invalid_argumentformatter is null-pointer.
ta_c_rc_invalid_argumentconfiguration is null-pointer.
ta_c_rc_out_of_memoryFailed allocating memory.