diff --git a/app/consumer/payment-queue.consumer.ts b/app/consumer/payment-queue.consumer.ts index 5b947e2..8993eec 100644 --- a/app/consumer/payment-queue.consumer.ts +++ b/app/consumer/payment-queue.consumer.ts @@ -5,11 +5,10 @@ import { } from '@open-template-hub/common'; export class PaymentQueueConsumer implements QueueConsumer { + private channel: any; private ctxArgs: ContextArgs = {} as ContextArgs; - constructor() {} - init = (channel: string, ctxArgs: ContextArgs) => { this.channel = channel; this.ctxArgs = ctxArgs; @@ -27,7 +26,7 @@ export class PaymentQueueConsumer implements QueueConsumer { let requeue = false; if (message.example) { - var exampleHook = async () => { + const exampleHook = async () => { console.log('Payment server example'); }; diff --git a/app/controller/payment.controller.ts b/app/controller/payment.controller.ts index d75b8cd..6db7919 100644 --- a/app/controller/payment.controller.ts +++ b/app/controller/payment.controller.ts @@ -20,10 +20,11 @@ import { TransactionHistoryRepository } from '../repository/transaction-history. import { PaymentWrapper } from '../wrapper/payment.wrapper'; export class PaymentController { - constructor( - private environment = new Environment() - ) { - // intentionally blank + + environment: Environment; + + constructor() { + this.environment = new Environment(); } /** @@ -292,11 +293,11 @@ export class PaymentController { ); if ( status && ReceiptStatus.SUCCESS === status ) { - await this.sendPaymentSuccessNotificationToQueue(message_queue_provider, { + await this.sendPaymentSuccessNotificationToQueue( message_queue_provider, { timestamp: new Date().getTime(), username: updated_transaction_history.username, message: 'Product paid successfully' - }); + } ); } } catch ( error ) { diff --git a/app/controller/receipt.controller.ts b/app/controller/receipt.controller.ts index 60a827d..28ea02c 100644 --- a/app/controller/receipt.controller.ts +++ b/app/controller/receipt.controller.ts @@ -23,5 +23,5 @@ export class ReceiptController { username, product_id ); - }; + } } diff --git a/app/interface/payment-method.interface.ts b/app/interface/payment-method.interface.ts index 154503d..b1dd3a7 100644 --- a/app/interface/payment-method.interface.ts +++ b/app/interface/payment-method.interface.ts @@ -6,12 +6,14 @@ import { PaymentConfig } from './payment-config.interface'; import { Product } from './product.interface'; export interface PaymentMethod { + /** * initializes payment method * @param dbConn db connection * @param paymentConfig payment config * @param product product * @param quantity quantity + * @param transaction_id transaction_id */ init( dbConn: any, diff --git a/app/provider/coinbase-payment.provider.ts b/app/provider/coinbase-payment.provider.ts index cf72aa5..173e26f 100644 --- a/app/provider/coinbase-payment.provider.ts +++ b/app/provider/coinbase-payment.provider.ts @@ -14,13 +14,6 @@ import { PaymentMethodEnum } from '../wrapper/payment.wrapper'; export class CoinbasePayment implements PaymentMethod { private readonly SUCCESS_STATUS = 'CONFIRMED'; - /** - * initializes coinbase payment provider - * @param dbConn db connection - * @param paymentConfig payment config - * @param product product - * @param quantity quantity - */ init = async ( dbConn: any, paymentConfig: PaymentConfig, diff --git a/app/provider/google-payment.provider.ts b/app/provider/google-payment.provider.ts index 52da1bc..c43ce03 100644 --- a/app/provider/google-payment.provider.ts +++ b/app/provider/google-payment.provider.ts @@ -9,13 +9,6 @@ import { Product } from '../interface/product.interface'; export class GooglePayment implements PaymentMethod { private readonly SUCCESS_STATUS = 'succeeded'; - /** - * initializes google payment provider - * @param dbConn db connection - * @param paymentConfig payment config - * @param product product - * @param quantity quantity - */ init = async ( dbConn: any, paymentConfig: PaymentConfig, diff --git a/app/provider/stripe-payment.provider.ts b/app/provider/stripe-payment.provider.ts index d1e5580..1459708 100644 --- a/app/provider/stripe-payment.provider.ts +++ b/app/provider/stripe-payment.provider.ts @@ -15,13 +15,6 @@ import { PaymentMethodEnum } from '../wrapper/payment.wrapper'; export class StripePayment implements PaymentMethod { private readonly SUCCESS_STATUS = 'succeeded'; - /** - * initializes stripe payment provider - * @param dbConn db connection - * @param paymentConfig payment config - * @param product product - * @param quantity quantity - */ init = async ( dbConn: any, paymentConfig: PaymentConfig, diff --git a/app/repository/transaction-history.repository.ts b/app/repository/transaction-history.repository.ts index 8d7867b..ca221fb 100644 --- a/app/repository/transaction-history.repository.ts +++ b/app/repository/transaction-history.repository.ts @@ -64,12 +64,12 @@ export class TransactionHistoryRepository { return await this.dataModel.findOneAndUpdate( { _id: id }, { external_transaction_id, payload: { transaction_history } } - ) + ); } catch ( error ) { console.error( '> updateTransactionHistoryWithId error: ', error ); throw error; } - } + }; /** * updates transaction history with external transaction id @@ -102,8 +102,8 @@ export class TransactionHistoryRepository { findTransactionHistory = async ( _id: string ) => { - return await this.dataModel.findOne( + return this.dataModel.findOne( { _id } - ) - } + ); + }; } diff --git a/app/route/index.route.ts b/app/route/index.route.ts index 96cd3e9..8cf7b39 100644 --- a/app/route/index.route.ts +++ b/app/route/index.route.ts @@ -44,7 +44,7 @@ export namespace Routes { applicationName: 'PaymentServer', } as MountAssets; - var routes: Array = []; + const routes: Array = []; routes.push({ name: subRoutes.monitor, router: monitorRouter }); routes.push({ name: subRoutes.payment, router: paymentRouter }); diff --git a/app/route/monitor.route.ts b/app/route/monitor.route.ts index 593aaf4..e897899 100644 --- a/app/route/monitor.route.ts +++ b/app/route/monitor.route.ts @@ -9,7 +9,7 @@ const subRoutes = { export const router = Router(); -router.get(subRoutes.alive, async (req: Request, res: Response) => { +router.get(subRoutes.alive, async (_req: Request, res: Response) => { // checks is alive res.status(ResponseCode.OK).send(); }); diff --git a/app/route/subscription.route.ts b/app/route/subscription.route.ts index 1187aae..408f441 100644 --- a/app/route/subscription.route.ts +++ b/app/route/subscription.route.ts @@ -55,7 +55,7 @@ router.get( router.get( subRoutes.me, authorizedBy([UserRole.ADMIN, UserRole.DEFAULT]), - async (req: Request, res: Response) => { + async (_req: Request, res: Response) => { // Get subscription with username const context = res.locals.ctx; diff --git a/app/wrapper/payment.wrapper.ts b/app/wrapper/payment.wrapper.ts index fe90acb..1246e12 100644 --- a/app/wrapper/payment.wrapper.ts +++ b/app/wrapper/payment.wrapper.ts @@ -108,7 +108,7 @@ export class PaymentWrapper implements PaymentMethod { if ( this.paymentMethod === undefined ) { return ''; } - return await this.paymentMethod.receiptStatusUpdate( + return this.paymentMethod.receiptStatusUpdate( dbConn, paymentConfig, external_transaction_id, diff --git a/dependency-checker.ts b/dependency-checker.ts index 692c2ee..54417de 100644 --- a/dependency-checker.ts +++ b/dependency-checker.ts @@ -5,6 +5,8 @@ const lines = outdatedCmd.stdout.toString().split( '\n' ); const columnIndexes = [ 0, 0, 0, 0 ]; +let indexOfDependedBy = -1; + console.log( '

\n' + ' \n' + @@ -41,7 +43,17 @@ for ( const line of lines ) { modifiedLine += '| '; - for ( let part of stringParts ) { + for ( let i = 0; i < stringParts.length; ++i ) { + const part = stringParts[ i ]; + + if ( lines.indexOf( line ) === 0 && i < stringParts.length - 1 && stringParts[ i + 1 ] === 'Depended' ) { + indexOfDependedBy = i; + } + + if ( indexOfDependedBy !== -1 && i >= indexOfDependedBy ) { + continue; + } + if ( part.match( /\s+/ ) ) { modifiedLine += ' | '; } else {