elizabethrego / cordova-plugin-unimag-swiper Goto Github PK
View Code? Open in Web Editor NEWCordova plugin for IDTech Unimag II, Unimag Pro, and Shuttle mobile credit card swipers.
Cordova plugin for IDTech Unimag II, Unimag Pro, and Shuttle mobile credit card swipers.
Certain Credit Cards give me this error when I swipe them and crash the application.
The card I describe is a TD business card: **** *** *** ***
Sep 26 00:08:59 iPad(CoreFoundation)[759] : *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSSingleObjectArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
Have been using your excellent cordova plugin but I am having trouble getting the card to swipe correctly. I am always getting a 'swipe_error'. I see in the java file, this indicates a JSON parse error?
Here are my details:
The problem occurs on Android with the Unimag II. I haven't tried it on an apple device. Using Cordova 6.0.0
The plugin finds the unimag device and connects to it. After connecting, I then call the swipe function to get ready for the swipe. It works telling me in the logs, "Swipe Started".
When I swipe the credit card however, it always returns a "swipe_error" event. Never a swipe_success. I have tried multiple credit cards with no luck. I have used the unimag utility app on the Google Play store and it allows me to swipe cards with it. Any clues as to where I should start looking?
self.initialize = function (callback) {
//activate sdk and register notification callback
if (!self.initialized()) {
cordova.plugins.unimag.swiper.activate();
cordova.plugins.unimag.swiper.enableLogs(true);
cordova.plugins.unimag.swiper.setReaderType('unimag_ii');
cordova.plugins.unimag.swiper.on('connected', function () {
self.connected(true);
self.swipe();
});
cordova.plugins.unimag.swiper.on('disconnected', function () {
self.connected(false);
});
cordova.plugins.unimag.swiper.on('swipe_success', function (e) {
var data = JSON.parse(e.detail);
console.log('cardholder name: ' + data.first_name + ' ' + data.last_name);
console.log('card number:' + data.card_number);
console.log('expiration:' + data.expiry_month + '/' + data.expiry_year);
});
cordova.plugins.unimag.swiper.on('swipe_error', function () {
console.log('ERROR: Could not parse card data.');
self.swipe();
});
cordova.plugins.unimag.swiper.on('timeout', function (e) {
if (self.connected()) {
console.log('ERROR: Swipe timed out - ' + e.detail);
} else {
console.log('ERROR: Connection timed out - ' + e.detail);
}
});
cordova.plugins.unimag.swiper.on('xml_error', function (e) {
console.log('ERROR: Could not xml_error data.');
});
}
self.swipe = function () {
if (self.connected()) {
cordova.plugins.unimag.swiper.swipe(function successCallback() {
console.log('SUCCESS: Swipe started.');
}, function errorCallback() {
console.log('ERROR: Could not start swipe.');
});
} else console.log('ERROR: Reader is not connected.');
};
Hello Elizabethrego,
I am facing issue in Android for Unimag card swiper as new devices are available in the market now so Unimag sdk 5.0 is not able to Detect the card reader anymore in new devices. Can you suggest the best possible solution for this. Although i added Google pixel model in the supported device list and it worked. But as there are a lot of new devices available in the market for Android how can you get a updated list of supported device list for this Sdk.
Hi I know that the new unimag readers support encryption. Is that possible with the current project? It is possibly going to be part of the future road map?
I looked through the iOS code and couldn't find something in particular.
Thanks.
Hello,
I'm getting an error on Nexus7 (OS ver 5.1.1):
The xml file does not exist and the auto update disabled.
It works fine on Samsung S6 and S3.
Something is probably related to the file location res/raw for Nexus.
Any workaround is there?
Thank you in advance
I'm trying to put this plugin into an Ionic 2 project but thus far, I've been unsuccessful.
I added it using cordova plugin add https://github.com/elizabethrego/cordova-plugin-unimag-swiper/
Afterwards I try to access it using the following:
cordova.plugins.unimag.swiper.activate();
cordova.plugins.unimag.swiper.enableLogs(true);
cordova.plugins.unimag.swiper.setReaderType('unimag_ii');
I get the error "Cannot read property 'unimag' of undefined"
I tried adding the following interface to my typings folder.
interface Window {
plugins: any;
}
The error still persists. Can you point me in the right direction?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.