TIM SDK
TIM API C
|
|
Discount Amount.
Object type amount_discount.
ta_e_result_code_t ta_amount_discount_create | ( | ta_object_t * | amount, |
int64_t | value, | ||
ta_e_currency_t | currency, | ||
ta_object_t | discount_id | ||
) |
Create object of type amount_discount.
[out] | amount | Pointer to variable to write created object instance to. Created object instance is retained. |
[in] | value | Value of amount in minor units. The currency selected by currency defines the used exponent. For example with ta_c_currency_chf the exponent is 2. To create an amount equal to 1 CHF use a value of 100. |
[in] | currency | Currency of amount. |
[in] | discount_id | Discount identifier as object of type string. |
ta_c_rc_ok | Object instance has been created and written to amount. |
ta_c_rc_invalid_argument | amount is null-pointer. |
ta_c_rc_invalid_argument | currency is not a valid value from ta_e_currency_t. |
ta_c_rc_invalid_argument | value is less than 0. |
ta_c_rc_invalid_argument | discount_id is ta_invalid_object. |
ta_c_rc_invalid_argument | discount_id is not of type string. |
ta_c_rc_out_of_memory | Failed allocating memory. |
ta_e_result_code_t ta_amount_discount_create_decimal | ( | ta_object_t * | amount, |
double | value, | ||
ta_e_currency_t | currency, | ||
ta_object_t | discount_id | ||
) |
Create object of type amount_discount using double precision floating point value.
[out] | amount | Pointer to variable to write created object instance to. Created object instance is retained. |
[in] | value | Value of amount in major units. The currency selected by currency defines the used exponent. For example with ta_c_currency_chf the exponent is 2. Values with more than 2 digits after the period will be rounded according to regular mathematical rounding rules. |
[in] | currency | Currency of amount. |
[in] | discount_id | Discount identifier as object of type string. |
ta_c_rc_ok | Object instance has been created and written to amount. |
ta_c_rc_invalid_argument | amount is null-pointer. |
ta_c_rc_invalid_argument | currency is not a valid value from ta_e_currency_t. |
ta_c_rc_invalid_argument | value is less than 0. |
ta_c_rc_invalid_argument | discount_id is ta_invalid_object. |
ta_c_rc_invalid_argument | discount_id is not of type string. |
ta_c_rc_out_of_memory | Failed allocating memory. |
ta_e_result_code_t ta_amount_discount_create_decimal_exponent | ( | ta_object_t * | amount, |
double | value, | ||
ta_e_currency_t | currency, | ||
int | exponent, | ||
ta_object_t | discount_id | ||
) |
Create object of type amount_discount using custom exponent and double precision value.
[out] | amount | Pointer to variable to write created object instance to. Created object instance is retained. |
[in] | value | Value of amount in minor units. The value of exponent overrides the exponent defined by the currency selected by currency. For example with an exponent of 3 values with more than 3 digits after the period will be rounded according to regular mathematical rounding rules. |
[in] | currency | Currency of amount. |
[in] | exponent | Exponent to use instead of the exponent defined by the currency. |
[in] | discount_id | Discount identifier as object of type string. |
ta_c_rc_ok | Object instance has been created and written to amount. |
ta_c_rc_invalid_argument | amount is null-pointer. |
ta_c_rc_invalid_argument | currency is not a valid value from ta_e_currency_t. |
ta_c_rc_invalid_argument | value is less than 0. |
ta_c_rc_invalid_argument | exponent is less than 0. |
ta_c_rc_invalid_argument | discount_id is ta_invalid_object. |
ta_c_rc_invalid_argument | discount_id is not of type string. |
ta_c_rc_out_of_memory | Failed allocating memory. |
ta_e_result_code_t ta_amount_discount_create_exponent | ( | ta_object_t * | amount, |
int64_t | value, | ||
ta_e_currency_t | currency, | ||
int | exponent, | ||
ta_object_t | discount_id | ||
) |
Create object of type amount_discount using custom exponent.
[out] | amount | Pointer to variable to write created object instance to. Created object instance is retained. |
[in] | value | Value of amount in minor units. The value of exponent overrides the exponent defined by the currency selected by currency. For example with an exponent of 3 to create an amount equal to 1 CHF use a value of 1000. |
[in] | currency | Currency of amount. |
[in] | exponent | Exponent to use instead of the exponent defined by the currency. |
[in] | discount_id | Discount identifier as object of type string. |
ta_c_rc_ok | Object instance has been created and written to amount. |
ta_c_rc_invalid_argument | amount is null-pointer. |
ta_c_rc_invalid_argument | currency is not a valid value from ta_e_currency_t. |
ta_c_rc_invalid_argument | value is less than 0. |
ta_c_rc_invalid_argument | exponent is less than 0. |
ta_c_rc_invalid_argument | discount_id is ta_invalid_object. |
ta_c_rc_invalid_argument | discount_id is not of type string. |
ta_c_rc_out_of_memory | Failed allocating memory. |
ta_e_result_code_t ta_amount_discount_get_currency | ( | ta_object_t | amount, |
ta_e_currency_t * | currency | ||
) |
Discount currency.
[in] | amount | Object instance of type amount_discount. |
[out] | currency | Pointer to variable to write currency to. |
ta_c_rc_ok | Value written to currency. |
ta_c_rc_invalid_argument | amount is ta_invalid_object. |
ta_c_rc_invalid_argument | amount is not of type amount_discount. |
ta_c_rc_invalid_argument | currency is null-pointer. |
ta_e_result_code_t ta_amount_discount_get_decimal_value | ( | ta_object_t | amount, |
double * | value | ||
) |
Discount amount in major units as double precision floating point value.
[in] | amount | Object instance of type amount_discount. |
[out] | value | Pointer to variable to write value to. |
ta_c_rc_ok | Value written to value. |
ta_c_rc_invalid_argument | amount is ta_invalid_object. |
ta_c_rc_invalid_argument | amount is not of type amount_discount. |
ta_c_rc_invalid_argument | value is null-pointer. |
ta_e_result_code_t ta_amount_discount_get_discount_id | ( | ta_object_t | amount, |
ta_object_t * | identifier | ||
) |
Discount identifier.
[in] | amount | Object instance of type amount_discount. |
[out] | identifier | Pointer 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 amount_discount. |
ta_c_rc_ok | Object instance written to identifier. |
ta_c_rc_invalid_argument | amount is ta_invalid_object. |
ta_c_rc_invalid_argument | amount is not of type amount_discount. |
ta_c_rc_invalid_argument | identifier is null-pointer. |
ta_e_result_code_t ta_amount_discount_get_exponent | ( | ta_object_t | amount, |
int * | exponent | ||
) |
Discount exponent.
[in] | amount | Object instance of type amount_discount. |
[out] | exponent | Pointer to variable to write exponent to. |
ta_c_rc_ok | Value written to exponent. |
ta_c_rc_invalid_argument | amount is ta_invalid_object. |
ta_c_rc_invalid_argument | amount is not of type amount_discount. |
ta_c_rc_invalid_argument | exponent is null-pointer. |
ta_e_result_code_t ta_amount_discount_get_value | ( | ta_object_t | amount, |
int64_t * | value | ||
) |
Discount amount in minor units.
[in] | amount | Object instance of type amount_discount. |
[out] | value | Pointer to variable to write value to. Use ta_amount_discount_get_exponent to get the used exponent. This can be a different exponent than the one defined by the used currency. |
ta_c_rc_ok | Value written to value. |
ta_c_rc_invalid_argument | amount is ta_invalid_object. |
ta_c_rc_invalid_argument | amount is not of type amount_discount. |
ta_c_rc_invalid_argument | value is null-pointer. |
ta_e_result_code_t ta_amount_discount_set_currency | ( | ta_object_t | amount, |
ta_e_currency_t | currency | ||
) |
Set currency.
[in] | amount | Object instance of type amount_discount. |
[in] | currency | Currency to set. |
ta_c_rc_ok | Value assigned to amount. |
ta_c_rc_invalid_argument | amount is ta_invalid_object. |
ta_c_rc_invalid_argument | amount is not of type amount_discount. |
ta_c_rc_invalid_argument | currency is not a valid value from ta_e_currency_t. |
ta_e_result_code_t ta_amount_discount_set_decimal_value | ( | ta_object_t | amount, |
double | value | ||
) |
Set amount in major units as double precision floating point value.
[in] | amount | Object instance of type amount_discount. |
[in] | value | Value to set. Use ta_amount_get_exponent to get the used exponent. For example with an exponent of 2 values with more than 2 digits after the period will be rounded according to regular mathematical rounding rules. |
ta_c_rc_ok | Value written to value. |
ta_c_rc_invalid_argument | amount is ta_invalid_object. |
ta_c_rc_invalid_argument | amount is not of type amount_discount. |
ta_c_rc_out_of_memory | Memory allocation required but failed. |
ta_e_result_code_t ta_amount_discount_set_discount_id | ( | ta_object_t | amount, |
ta_object_t | identifier | ||
) |
Set discount identifier.
[in] | amount | Object instance of type amount_discount. |
[in] | discount_id | Discount identifier as object of type string. Object instance will be retained. |
ta_c_rc_ok | Value assigned to amount and retained. |
ta_c_rc_invalid_argument | amount is ta_invalid_object. |
ta_c_rc_invalid_argument | amount is not of type amount_discount. |
ta_c_rc_invalid_argument | discount_id is ta_invalid_object. |
ta_c_rc_invalid_argument | discount_id is not of type string. |
ta_e_result_code_t ta_amount_discount_set_exponent | ( | ta_object_t | amount, |
int | exponent | ||
) |
Set exponent.
[in] | amount | Object instance of type amount_discount. |
[in] | exponent | Exponent to set. |
ta_c_rc_ok | Value assigned to amount. |
ta_c_rc_invalid_argument | amount is ta_invalid_object. |
ta_c_rc_invalid_argument | amount is not of type amount_discount. |
ta_c_rc_invalid_argument | exponent is less than 0. |
ta_e_result_code_t ta_amount_discount_set_value | ( | ta_object_t | amount, |
int64_t | value | ||
) |
Set amount in minor units.
[in] | amount | Object instance of type amount_discount. |
[in] | value | Value to set. Use ta_amount_get_exponent to get the used exponent. This can be a different exponent than the one defined by the used currency. For example with an exponent of 2 to set an amount equal to 1 CHF you have to use a value of 100. |
ta_c_rc_ok | Value assigned to amount. |
ta_c_rc_invalid_argument | amount is ta_invalid_object. |
ta_c_rc_invalid_argument | amount is not of type amount_discount. |
ta_c_rc_invalid_argument | value is less than 0. |