I have created a custom parser for ID cards, but the type is always being recognized as a generic card.
The entered value is always something like: %BOUTZAMAT&SOULAIMAN CHARLOTTEAGER 28 2 TH
I have the following parser, created from your example in the docs:
var socialSecurityCard = function (rawData) {
var pattern = new RegExp("^%B");
var match = pattern.exec(rawData);
if (!match) return null;
// Extract the data
var cardData = {
type: "socialcard",
lastName: "some firstname",
firstName: "some lastname",
idNumber: "some id number"
};
return cardData;
}
var successCallback = function (data) {
console.log(data.type);
// Is it a custom card
if (data.type == "socialSecurityCard")
return;
// Is it a payment card?
if (data.type == "generic")
return;
// Copy data fields to form
$("#idnumber").val(data.idNumber);
$("#firstname").val(data.firstName);
$("#firstname").val(data.lastName);
};
$.cardswipe({
firstLineOnly: true,
success: complete,
parsers: ["socialSecurityCard", "generic"],
debug: false
});
I have created a custom parser for ID cards, but the type is always being recognized as a generic card.
The entered value is always something like: %BOUTZAMAT&SOULAIMAN CHARLOTTEAGER 28 2 TH
I have the following parser, created from your example in the docs:
But the debug log always shows "type" of generic.