Skip to content

Commit 3de42b7

Browse files
committed
Comment out accounting
1 parent 7e7b5c0 commit 3de42b7

File tree

3 files changed

+47
-43
lines changed

3 files changed

+47
-43
lines changed

src/billing/cloudpayments.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -341,36 +341,36 @@ export default class CloudPaymentsWebhooks {
341341
return;
342342
}
343343

344-
let accountId = workspace.accountId;
345-
346-
try {
347-
if (!workspace.accountId) {
348-
accountId = (await context.accounting.createAccount({
349-
name: `WORKSPACE:${workspace.name}`,
350-
type: AccountType.LIABILITY,
351-
currency: Currency.RUB,
352-
})).recordId;
353-
await workspace.setAccountId(accountId);
354-
}
355-
356-
await context.accounting.payOnce({
357-
accountId: accountId,
358-
amount: tariffPlan.monthlyCharge * PENNY_MULTIPLIER,
359-
description: `Account replenishment to pay for the tariff plan with id ${tariffPlan._id}. CloudPayments transaction ID: ${body.TransactionId}`,
360-
});
361-
362-
await context.accounting.purchase({
363-
accountId,
364-
amount: tariffPlan.monthlyCharge * PENNY_MULTIPLIER,
365-
description: `Charging for tariff plan with id ${tariffPlan._id}. CloudPayments transaction ID: ${body.TransactionId}`,
366-
});
367-
} catch (e) {
368-
const error = e as Error;
369-
370-
this.sendError(res, PayCodes.SUCCESS, `[Billing / Pay] Error while creating operations in accounting ${error.toString()}`, body);
371-
372-
return;
373-
}
344+
// let accountId = workspace.accountId;
345+
346+
// try {
347+
// if (!workspace.accountId) {
348+
// accountId = (await context.accounting.createAccount({
349+
// name: `WORKSPACE:${workspace.name}`,
350+
// type: AccountType.LIABILITY,
351+
// currency: Currency.RUB,
352+
// })).recordId;
353+
// await workspace.setAccountId(accountId);
354+
// }
355+
356+
// await context.accounting.payOnce({
357+
// accountId: accountId,
358+
// amount: tariffPlan.monthlyCharge * PENNY_MULTIPLIER,
359+
// description: `Account replenishment to pay for the tariff plan with id ${tariffPlan._id}. CloudPayments transaction ID: ${body.TransactionId}`,
360+
// });
361+
362+
// await context.accounting.purchase({
363+
// accountId,
364+
// amount: tariffPlan.monthlyCharge * PENNY_MULTIPLIER,
365+
// description: `Charging for tariff plan with id ${tariffPlan._id}. CloudPayments transaction ID: ${body.TransactionId}`,
366+
// });
367+
// } catch (e) {
368+
// const error = e as Error;
369+
370+
// this.sendError(res, PayCodes.SUCCESS, `[Billing / Pay] Error while creating operations in accounting ${error.toString()}`, body);
371+
372+
// return;
373+
// }
374374

375375
try {
376376
await publish('cron-tasks', 'cron-tasks/limiter', JSON.stringify({

src/index.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ import DataLoaders from './dataLoaders';
1414
import HawkCatcher from '@hawk.so/nodejs';
1515
// import { express as voyagerMiddleware } from 'graphql-voyager/middleware';
1616
import { initializeStrategies } from './passport.js';
17-
// @ts-ignore
18-
import Accounting from 'codex-accounting-sdk';
17+
/*
18+
* @ts-ignore
19+
* import Accounting from 'codex-accounting-sdk';
20+
*/
1921
import Billing from './billing';
2022
import bodyParser from 'body-parser';
2123
import { ApolloServerPluginLandingPageGraphQLPlayground, ApolloServerPluginLandingPageDisabled } from 'apollo-server-core';
@@ -24,7 +26,7 @@ import { NonCriticalError } from './errors';
2426
import PlansFactory from './models/plansFactory';
2527
import BusinessOperationsFactory from './models/businessOperationsFactory';
2628
import schema from './schema';
27-
import {graphqlUploadExpress} from 'graphql-upload'
29+
import { graphqlUploadExpress } from 'graphql-upload';
2830

2931
/**
3032
* Option to enable playground
@@ -206,18 +208,20 @@ class HawkAPI {
206208
};
207209
}
208210

209-
const accounting = new Accounting({
210-
baseURL: `${process.env.CODEX_ACCOUNTING_URL}`,
211-
tlsVerify,
212-
});
211+
/*
212+
* const accounting = new Accounting({
213+
* baseURL: `${process.env.CODEX_ACCOUNTING_URL}`,
214+
* tlsVerify,
215+
* });
216+
*/
213217

214218
return {
215219
factories: HawkAPI.setupFactories(dataLoader),
216220
user: {
217221
id: userId,
218222
accessTokenExpired: isAccessTokenExpired,
219223
},
220-
accounting,
224+
// accounting,
221225
};
222226
}
223227

src/types/graphql.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import UsersFactory from '../models/usersFactory';
22
import WorkspacesFactory from '../models/workspacesFactory';
33
import { GraphQLField } from 'graphql';
44
import ProjectsFactory from '../models/projectsFactory';
5-
import Accounting from 'codex-accounting-sdk';
5+
// import Accounting from 'codex-accounting-sdk';
66
import PlansFactory from '../models/plansFactory';
77
import BusinessOperationsFactory from '../models/businessOperationsFactory';
88

@@ -20,10 +20,10 @@ export interface ResolverContextBase {
2020
*/
2121
factories: ContextFactories;
2222

23-
/**
24-
* SDK for working with CodeX Accounting API
25-
*/
26-
accounting: Accounting;
23+
// /**
24+
// * SDK for working with CodeX Accounting API
25+
// */
26+
// accounting: Accounting;
2727
}
2828

2929
/**

0 commit comments

Comments
 (0)