I believe this is C++ but please correct me and redirect if necessary.
I am pulling this code from a former employee. This is for a credit EFT Contract where when you swipe the card into a text field, the following values are inputted; Card Type, Card Number, and Expiration Date. I had to add Discover to our contract to which I have added successfully for the card type and card number but i cannot get the expiration date to work at all.
This is my current code for Expiration Date. CCEnter is for the card swipe.
inputex = this.getField("CCEnter");
cardex = inputex.value.toString().substr(20,35);
found = 0;
hold = 0;
i = 0;
for(i=0;i<35;i++)
{
test = cardex.toString().substr(i,1);
if((test == "^") && (test != " "))
{
found++;
if(found == 1)
{
hold = i+1;
i = 45;
}
}
}
typeOfCard = ccnumber.value.toString().substr(2,1);
newAmex = ccnumber.value.toString().substr(6,1);
if((typeOfCard == 3)&&(newAmex == " "))
{
ccEx1 = cardex.toString().substr(hold,2);
hold += 2;
ccEx2 = cardex.toString().substr(hold,2);
event.value = ccEx2 + String('/') + ccEx1;
}
else
{
ccEx1 = cardex.toString().substr(hold,2);
hold += 2;
ccEx2 = cardex.toString().substr(hold,2);
event.value = ccEx2 + String('/') + ccEx1;
}
!--removed tag-->
Enter your message below
Sign in or Join us (it's free).