UNPKG

@tomei/finance

Version:

NestJS package for finance module

66 lines 2.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const general_1 = require("@tomei/general"); const record_not_found_error_1 = require("@tomei/general/dist/class/exceptions/record-not-found.error"); const payment_method_type_repository_1 = require("./payment-method-type.repository"); class PaymentMethodType extends general_1.ObjectBase { get ObjectType() { return this._ObjectType; } constructor(dbTransaction, methodTypeId) { super(); this.MethodTypeId = 'New'; this.MethodId = ''; this.Name = ''; this.AccountNo = ''; this.ProcessingFeeRate = 0.0; this.ProcessingFeeAccountNo = ''; this._ObjectType = 'PaymentMethodType'; if (dbTransaction) { this._DbTransaction = dbTransaction; } if (methodTypeId) { this.MethodTypeId = methodTypeId; } } static async initMethodType(dbTransaction, methodTypeId) { try { const paymentMethodTypeData = await this._RepositoryBase.findOne({ where: { MethodTypeId: methodTypeId, }, transaction: dbTransaction, }); if (paymentMethodTypeData) { const paymentMethodType = new PaymentMethodType(dbTransaction, methodTypeId); paymentMethodType.MethodId = paymentMethodTypeData.MethodId; paymentMethodType.Name = paymentMethodTypeData.Name; paymentMethodType.AccountNo = paymentMethodTypeData.AccountNo; paymentMethodType.ProcessingFeeRate = paymentMethodTypeData.ProcessingFeeRate; paymentMethodType.ProcessingFeeAccountNo = paymentMethodTypeData.ProcessingFeeAccountNo; return paymentMethodType; } else { const notFoundError = new record_not_found_error_1.RecordNotFoundError('PaymentMethodTypeErrMsg', 'No Record Found.'); throw notFoundError; } } catch (error) { console.log('Payment method type constructor err: ', error); } } get ObjectId() { return this.MethodTypeId; } get ObjectName() { return this.Name; } get TableName() { return 'finance_PaymentMethodType'; } } PaymentMethodType._RepositoryBase = new payment_method_type_repository_1.PaymentMethodTypeRepository(); exports.default = PaymentMethodType; //# sourceMappingURL=payment-method-type.js.map