@hachther/mesomb
Version:
JS client for browser to perform mobile payment operation with MeSomb
39 lines (38 loc) • 1.32 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
var Contribution_1 = require("./Contribution");
/**
* Class representing a transaction response
*
* @property {boolean} success - Indicates if the operation was successful
* @property {string} message - The message of the response
* @property {Contribution} contribution - The contribution
* @property {'SUCCESS' | 'FAILED' | 'PENDING'} status - The status of the transaction
*/
var TransactionResponse = /** @class */ (function () {
function TransactionResponse(data) {
this.success = data.success;
this.message = data.message;
this.contribution = new Contribution_1.default(data.contribution);
this.status = data.status;
}
/**
* Check if the operation is successful
*
* @returns {boolean}
*/
TransactionResponse.prototype.isOperationSuccess = function () {
return this.success;
};
/**
* Check if the contribution is successful
*
* @returns {boolean}
*/
TransactionResponse.prototype.isContributionSuccess = function () {
var _a;
return ((_a = this.contribution) === null || _a === void 0 ? void 0 : _a.isSuccess()) === true;
};
return TransactionResponse;
}());
exports.default = TransactionResponse;
;