|
|
|
@ -3,8 +3,11 @@ $(function () {
|
|
|
|
|
let ctrl = {ready: false, pending: false}
|
|
|
|
|
let cardFrame = window.channel_account_id ? new TokenInputFrame($container, window.channel_account_id) : new CardInputFrame($container);
|
|
|
|
|
let $errorMsgBox = $('#errorMsgBox');
|
|
|
|
|
let loading = $('.loading-container');
|
|
|
|
|
cardFrame.onSuccess = function (secretData) {
|
|
|
|
|
ctrl.pending = true;
|
|
|
|
|
loading.find('.loading-text').text('Paying...');
|
|
|
|
|
loading.removeClass('hide');
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: 'commit',
|
|
|
|
|
data: JSON.stringify(secretData),
|
|
|
|
@ -15,6 +18,7 @@ $(function () {
|
|
|
|
|
},
|
|
|
|
|
error: function (jqXHR) {
|
|
|
|
|
ctrl.pending = false;
|
|
|
|
|
loading.addClass('hide')
|
|
|
|
|
let errorText = jqXHR.responseText;
|
|
|
|
|
let err = JSON.parse(errorText);
|
|
|
|
|
if (err) {
|
|
|
|
@ -33,6 +37,7 @@ $(function () {
|
|
|
|
|
$('#readyModal').hide();
|
|
|
|
|
$('#payBtn').removeAttr('disabled');
|
|
|
|
|
ctrl.ready = true;
|
|
|
|
|
loading.addClass('hide');
|
|
|
|
|
};
|
|
|
|
|
cardFrame.onError = function (msg) {
|
|
|
|
|
$errorMsgBox.text(msg).show();
|
|
|
|
|