TIM SDK
TIM API C
loyalty_discount.h File Reference

Description

Loalty discount amount.

Object type loyalty_discount.

Functions

ta_e_result_code_t ta_loyalty_discount_get_value (ta_object_t amount, int64_t *value)
 Discount amount in minor units. More...
 
ta_e_result_code_t ta_loyalty_discount_get_decimal_value (ta_object_t amount, double *value)
 Discount amount in major units as double precision floating point value. More...
 
ta_e_result_code_t ta_loyalty_discount_get_currency (ta_object_t amount, ta_e_currency_t *currency)
 Discount currency. More...
 
ta_e_result_code_t ta_loyalty_discount_get_exponent (ta_object_t amount, int *exponent)
 Discount exponent. More...
 
ta_e_result_code_t ta_loyalty_discount_get_discount_description (ta_object_t amount, ta_object_t *identifier)
 Discount identifier. More...
 

Function Documentation

◆ ta_loyalty_discount_get_currency()

ta_e_result_code_t ta_loyalty_discount_get_currency ( ta_object_t  amount,
ta_e_currency_t currency 
)

Discount currency.

Parameters
[in]amountObject instance of type loyalty_discount.
[out]currencyPointer to variable to write currency to.
Return values
ta_c_rc_okValue written to currency.
ta_c_rc_invalid_argumentamount is ta_invalid_object.
ta_c_rc_invalid_argumentamount is not of type loyalty_discount.
ta_c_rc_invalid_argumentcurrency is null-pointer.

◆ ta_loyalty_discount_get_decimal_value()

ta_e_result_code_t ta_loyalty_discount_get_decimal_value ( ta_object_t  amount,
double *  value 
)

Discount amount in major units as double precision floating point value.

Note
Double precision floating point values can not provide the same level of numerical accuracy as int64_t. It is recommended to use the integer based methods.
Parameters
[in]amountObject instance of type loyalty_discount.
[out]valuePointer to variable to write value to.
Return values
ta_c_rc_okValue written to value.
ta_c_rc_invalid_argumentamount is ta_invalid_object.
ta_c_rc_invalid_argumentamount is not of type loyalty_discount.
ta_c_rc_invalid_argumentvalue is null-pointer.

◆ ta_loyalty_discount_get_discount_description()

ta_e_result_code_t ta_loyalty_discount_get_discount_description ( ta_object_t  amount,
ta_object_t identifier 
)

Discount identifier.

Parameters
[in]amountObject instance of type loyalty_discount.
[out]identifierPointer to variable to write object instance to. Object instance is of type string and is not retained. Object instance is ta_invalid_object if identifier is not set in loyalty_discount.
Return values
ta_c_rc_okObject instance written to identifier.
ta_c_rc_invalid_argumentamount is ta_invalid_object.
ta_c_rc_invalid_argumentamount is not of type loyalty_discount.
ta_c_rc_invalid_argumentidentifier is null-pointer.

◆ ta_loyalty_discount_get_exponent()

ta_e_result_code_t ta_loyalty_discount_get_exponent ( ta_object_t  amount,
int *  exponent 
)

Discount exponent.

Parameters
[in]amountObject instance of type loyalty_discount.
[out]exponentPointer to variable to write exponent to.
Return values
ta_c_rc_okValue written to exponent.
ta_c_rc_invalid_argumentamount is ta_invalid_object.
ta_c_rc_invalid_argumentamount is not of type loyalty_discount.
ta_c_rc_invalid_argumentexponent is null-pointer.

◆ ta_loyalty_discount_get_value()

ta_e_result_code_t ta_loyalty_discount_get_value ( ta_object_t  amount,
int64_t *  value 
)

Discount amount in minor units.

Parameters
[in]amountObject instance of type loyalty_discount.
[out]valuePointer to variable to write value to. Use ta_loyalty_discount_get_exponent to get the used exponent. This can be a different exponent than the one defined by the used currency.
Return values
ta_c_rc_okValue written to value.
ta_c_rc_invalid_argumentamount is ta_invalid_object.
ta_c_rc_invalid_argumentamount is not of type loyalty_discount.
ta_c_rc_invalid_argumentvalue is null-pointer.