Credit Card Swipe for PDF Contract Help

credit card , cpp , swipe , help United States
  • 6 years ago

    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; }

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“A computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match” - Bill Bryson