salix/modules/client/front/web-payment/index.js

35 lines
1.1 KiB
JavaScript

import ngModule from '../module';
import './style.scss';
class Controller {
constructor($scope, $http, $stateParams) {
this.$scope = $scope;
this.$http = $http;
this.$stateParams = $stateParams;
}
confirm(transaction) {
const path = '/client/api/Clients/confirmTransaction';
let data = {id: transaction.id};
this.$http.post(path, data).then(res => {
this.$scope.model.refresh();
});
}
getFormattedMessage(transaction) {
const errorMessage = transaction.errorMessage ? transaction.errorMessage : '';
const separator = transaction.errorMessage && transaction.responseMessage ? '<br/>' : '';
const responseMessage = transaction.responseMessage ? transaction.responseMessage : '';
return `<strong style="font-size:13px">${errorMessage}</strong>`
+ separator
+ `<span style="font-size:13px">${responseMessage}</span>`;
}
}
Controller.$inject = ['$scope', '$http', '$stateParams'];
ngModule.component('vnClientWebPayment', {
template: require('./index.html'),
controller: Controller
});