Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Xziy committed Aug 3, 2023
1 parent e44803b commit f1d0150
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions adapters/bonusprogram/BonusProgramAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default abstract class BonusProgramAdapter {
/**
* A method for creating and obtaining an existing Bonus Adapter
* @param params - Parameters for initialization
* @deprecated
*/
static getInstance(...params): BonusProgramAdapter {
return BonusProgramAdapter.prototype;
Expand Down
3 changes: 2 additions & 1 deletion adapters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as fs from "fs";
import { DiscountAdapter } from "./discount/default/discountAdapter";
import BonusProgramAdapter from "./bonusprogram/BonusProgramAdapter";
import path = require("path");
import { Config } from "../interfaces/Config";
// import DiscountAdapter from "./discount/AbstractDiscountAdapter";
const WEBRESTO_MODULES_PATH = process.env.WEBRESTO_MODULES_PATH === undefined ? "@webresto" : process.env.WEBRESTO_MODULES_PATH;

Expand Down Expand Up @@ -238,7 +239,7 @@ export class Adapter {
/**
* retruns PaymentAdapter-adapter
*/
public static async getPaymentAdapter(adapterName?: string, initParams?: {[key: string]:string | number | boolean}): Promise<PaymentAdapter> {
public static async getPaymentAdapter(adapterName?: string, initParams?: Config): Promise<PaymentAdapter> {
if(!adapterName) {
let defaultAdapterName = await Settings.get("DEFAULT_BONUS_ADAPTER") as string;
if (!defaultAdapterName) throw 'BonusProgramAdapter is not set '
Expand Down
9 changes: 3 additions & 6 deletions adapters/payment/PaymentAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { Payment, PaymentResponse } from "../../interfaces/Payment";
import PaymentDocument from "../../models/PaymentDocument";
import { PaymentMethodType } from "../../libs/enums/PaymentMethodTypes";
/**
* The abstract class of the Payment adapter. Used to create new payment system adapters.
*/
export type Config = {
[key: string]: Config | number | boolean | string | null | undefined;
};
import { Config } from "../../interfaces/Config";


export interface InitPaymentAdapter {
title: string;
Expand Down Expand Up @@ -42,6 +38,7 @@ export default abstract class PaymentAdapter {
/**
* Метод для создания и получения уже существующего Payment adapterа
* @param params - параметры для инициализации
* @deprecated
*/
static getInstance(...params: any[]): PaymentAdapter {
return PaymentAdapter.prototype;
Expand Down
3 changes: 3 additions & 0 deletions interfaces/Config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type Config = {
[key: string]: Config | number | boolean | string | null | undefined;
};

0 comments on commit f1d0150

Please sign in to comment.