Payment Exampe
HTML
<span>Ammount to pay: $</span>
<input type="text" name="ammount" />
<div class="payment-methods"></div>
<span>Total Price: $</span><span class="total-ammount"></span>
<input type="radio" name="paymentMethod" />
JavaScript
function PaymentMethod(paymentMethodId, paymentMethodName, extraPercentage) {
this.paymentMethodId = paymentMethodId;
this.paymentMethodName = paymentMethodName;
this.extraPercentage = extraPercentage;
this.viewArray = [];
this.viewArray.push('<div class="' + this.paymentMethodId + '">');
this.viewArray.push('<input type="radio" name="paymentMethod" />');
this.viewArray.push('<span>' + this.paymentMethodName + '<span/>');
this.viewArray.push("</div>");
this.view = null;
this.init(paymentMethodId);
}
PaymentMethod.prototype.isSelected = function () {
return true;
};
PaymentMethod.prototype.getTotalFee = function (ammount) {};
PaymentMethod.prototype.getTotalFeeWithoutDiscounts = function () {};
PaymentMethod.prototype.initView = function () {};
PaymentMethod.prototype.init = function () {
};
$("[name='paymentMethod']").on("click", function() {
$(".total-ammount").text(this.val());
});