Has anyone ever needed to implement international credit card IOF calculation function on systems that could give me that help? I need to know the rules of how to calculate. Thanks!
Has anyone ever needed to implement international credit card IOF calculation function on systems that could give me that help? I need to know the rules of how to calculate. Thanks!
public static bool Mod10Check(string creditCardNumber)
{
//// check whether input string is null or empty
if (string.IsNullOrEmpty(creditCardNumber))
{
return false;
}
//// 1. Starting with the check digit double the value of every other digit
//// 2. If doubling of a number results in a two digits number, add up
/// the digits to get a single digit number. This will results in eight single digit numbers
//// 3. Get the sum of the digits
int sumOfDigits = creditCardNumber.Where((e) => e >= '0' && e <= '9')
.Reverse()
.Select((e, i) => ((int)e - 48) * (i % 2 == 0 ? 1 : 2))
.Sum((e) => e / 10 + e % 10);
//// If the final sum is divisible by 10, then the credit card number
// is valid. If it is not divisible by 10, the number is invalid.
return sumOfDigits % 10 == 0;
}
So I realized my answer is no longer correct so here is a correction I keep the other one for future reference.
As I realized (and I am from Portugal, we do not have IOF), the tax is currently 1.10% of the total amount.
There are two ways to calculate with aggravation or included in the total value of the purchase.
1) Worsening
var valor = 100;
var total = valor + (valor * 0.0638);
That is, 106.38.
2) No Aggravation
var valor = 100;
var total = valor - (valor * 0.0638);
That is, 100 being the amount payable without IOF is 93.62
Reference page link