var paymentModel = function (data) {
    var self = this;
    self.options = ko.observable("New");
    if (data != null) {
        ko.mapping.fromJS(data, {}, self);
        self.options = ko.observable("Existing");
    }
    self.creditCardRequest = {};
    self.creditCardRequest.CardType = ko.observable();
    self.creditCardRequest.options = ko.observable("New");

    self.showCardTypeImage = function (cardType) {
        if (data == null) return false;
        return (self.CardType() == cardType);
    };
    self.showSelectedCardTypeImage = function (cardType) {
        return (self.creditCardRequest.CardType() == cardType);
    };
    self.hasCreditCard = ko.computed(function () { return data != null });
    self.isNewSelected = ko.computed(function () { return self.options() == "New"; });
};

