TIM SDK
TIM API C
|
|
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 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.
[in] | terminal | Object instance of type terminal with terminal to retrieve certain field values from. Object instance is not retained. |
[in] | receipt_items | Object instance of type receipt_items containing items used to create receipt. Object instance is not retained. |
[out] | receipts | Object instance of type list to fill with created receipts. Receipts have to be object instances of type receipt. |
[in] | user_pointer | User pointer value used while creating the formatter. |
typedef struct ta_s_receipt_formatter 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.
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.
[out] | formatter | Pointer to variable to write created object instance to. Created object instance is retained. |
[in] | configuration | Pointer to struct containinig formatter configuration. |
ta_c_rc_ok | Object instance has been created and written to formatter. |
ta_c_rc_invalid_argument | formatter is null-pointer. |
ta_c_rc_invalid_argument | configuration is null-pointer. |
ta_c_rc_out_of_memory | Failed allocating memory. |