@hypernetlabs/objects
Version:
Objects and types shared by the Hypernet Protocol
57 lines • 2.12 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PaymentStatusViewModel = exports.PaymentStatusParams = void 0;
const typing_1 = require("./typing");
class PaymentStatusParams {
constructor(state) {
this.state = state;
}
}
exports.PaymentStatusParams = PaymentStatusParams;
// tslint:disable-next-line: max-classes-per-file
class PaymentStatusViewModel {
constructor(params) {
if (params.state === typing_1.EPaymentState.Proposed) {
this.state = "Proposed";
}
else if (params.state === typing_1.EPaymentState.Rejected) {
this.state = "Rejected";
}
else if (params.state === typing_1.EPaymentState.InvalidProposal) {
this.state = "Invalid Proposal";
}
else if (params.state === typing_1.EPaymentState.Staked) {
this.state = "Staked";
}
else if (params.state === typing_1.EPaymentState.InvalidStake) {
this.state = "Invalid Stake";
}
else if (params.state === typing_1.EPaymentState.Approved) {
this.state = "Approved";
}
else if (params.state === typing_1.EPaymentState.InvalidFunds) {
this.state = "Invalid Payment";
}
else if (params.state === typing_1.EPaymentState.Accepted) {
this.state = "Accepted";
}
else if (params.state === typing_1.EPaymentState.InsuranceReleased) {
this.state = "Insurance Released";
}
else if (params.state === typing_1.EPaymentState.Finalized) {
this.state = "Finalized";
}
else if (params.state === typing_1.EPaymentState.Borked) {
this.state = "Borked";
}
else if (params.state === typing_1.EPaymentState.Canceled) {
this.state = "Canceled";
}
else {
console.error(params.state);
this.state = "Unknown - update PaymentStatus.viewmodel";
}
}
}
exports.PaymentStatusViewModel = PaymentStatusViewModel;
//# sourceMappingURL=PaymentStatusViewModel.js.map