oak-pay-business/lib/context/BackendRuntimeContext.js

39 lines
1.6 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BackendRuntimeContext = void 0;
const DependentContext_1 = require("./DependentContext");
const lodash_1 = require("oak-domain/lib/utils/lodash");
class BackendRuntimeContext extends DependentContext_1.BackendRuntimeContext {
async toString() {
const data = await this.getSerializedData();
return JSON.stringify(data);
}
async refineOpRecords() {
await super.refineOpRecords();
for (const opRecord of this.opRecords) {
if (opRecord.a === 's') {
const { d } = opRecord;
for (const entity in d) {
if (['application', 'system'].includes(entity)) {
// todo 删除掉config中的敏感返回信息
const rowDict = d[entity];
for (const id in rowDict) {
const { payConfig } = rowDict[id];
if (payConfig) {
payConfig.forEach((config) => {
(0, lodash_1.unset)(config, 'publicKeyFilePath');
(0, lodash_1.unset)(config, 'privateKeyFilePath');
(0, lodash_1.unset)(config, 'apiV3Key');
});
}
}
}
}
}
}
}
}
exports.BackendRuntimeContext = BackendRuntimeContext;
;
exports.default = BackendRuntimeContext;