gpt4 book ai didi

javascript - 卡 IO PhoneGap 插件不起作用

转载 作者:行者123 更新时间:2023-11-27 23:40:59 26 4
gpt4 key购买 nike

  .controller('paymentsController', function ($scope, $localStorage, $log, $state, $window, $ionicModal, Payment, ItemList, SweetAlert) {

$scope.scanCard = function(){

var cardIOResponseFields = [
"card_type",
"redacted_card_number",
"card_number",
"expiry_month",
"expiry_year",
"cvv",
"zip"
];

var onCardIOComplete = function(response) {
for (var i = 0, len = cardIOResponseFields.length; i < len; i++) {
var field = cardIOResponseFields[i];
console.log(field + ": " + response[field]);
}
};

var onCardIOCancel = function() {
console.log("card.io scan cancelled");
};

var onCardIOCheck = function (canScan) {
console.log("card.io canScan? " + canScan);
var scanBtn = angular.element($("#scanBtn")).scope();
//var scanBtn = document.getElementById("scanBtn");
if (!canScan) {
scanBtn.innerHTML = "Manual entry";
}
};

CardIO.scan({
"collect_expiry": true,
"collect_cvv": false,
"collect_zip": false,
"shows_first_use_alert": true,
"disable_manual_entry_buttons": false
},
onCardIOComplete,
onCardIOCancel
);

CardIO.canScan(onCardIOCheck);
};

}我在我的phonegap中安装了一个读卡器插件(我使用ionic作为框架),我遇到的问题是该插件不起作用。这是我正在使用的插件 https://github.com/card-io/card.io-iOS-SDK-PhoneGap

这是我的观点。

<button id="scanBtn" ng-click="scanCard()" class="button button-large button-block button-light">Scan Card</button>

当用户单击#scanBtn 时,它会加载此脚本。

      var cardIOResponseFields = [
"card_type",
"redacted_card_number",
"card_number",
"expiry_month",
"expiry_year",
"cvv",
"zip"
];

var onCardIOComplete = function(response) {
for (var i = 0, len = cardIOResponseFields.length; i < len; i++) {
var field = cardIOResponseFields[i];
console.log(field + ": " + response[field]);
}
};

var onCardIOCancel = function() {
console.log("card.io scan cancelled");
};

var onCardIOCheck = function (canScan) {
console.log("card.io canScan? " + canScan);
var scanBtn = angular.element($("#scanBtn")).scope();
//var scanBtn = document.getElementById("scanBtn");
if (!canScan) {
scanBtn.innerHTML = "Manual entry";
}
};

CardIO.scan({
"collect_expiry": true,
"collect_cvv": false,
"collect_zip": false,
"shows_first_use_alert": true,
"disable_manual_entry_buttons": false
},
onCardIOComplete,
onCardIOCancel
);

CardIO.canScan(onCardIOCheck);
};

我的应用程序无法在浏览器中运行或使用phonegap应用程序,但是当我启动 ionic 模拟器时,仅显示输入卡表单的条目,并且没有相机加载来扫描卡,这让我相信相机执行失败。

当在我的浏览器上加载有氧运动时,我收到以下控制台错误:ReferenceError:CardIO 未定义。

最佳答案

在设备上尝试相同的操作。

我在浏览器上遇到了同样的错误,但它在设备上运行良好。您可以将其视为相机/或联系人选择器插件 - 只能在设备上运行 - 而不能在 sim 或浏览器上运行。

关于javascript - 卡 IO PhoneGap 插件不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33657829/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com