From 6c25ec5bbdab5ef3e7aac2fbff12d10d49ee156b Mon Sep 17 00:00:00 2001 From: ssallam Date: Fri, 17 Jan 2020 22:24:37 +0100 Subject: [PATCH] Fix inheritance issue. --- .../contracts/templates/AgreementTemplateBase.ts | 8 ++++++-- .../templates/EscrowAccessSecretStoreTemplate.ts | 15 +++++++++++++-- .../templates/EscrowComputeExecutionTemplate.ts | 15 +++++++++++++-- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/keeper/contracts/templates/AgreementTemplateBase.ts b/src/keeper/contracts/templates/AgreementTemplateBase.ts index 6203fe7..b8b2683 100644 --- a/src/keeper/contracts/templates/AgreementTemplateBase.ts +++ b/src/keeper/contracts/templates/AgreementTemplateBase.ts @@ -59,6 +59,7 @@ export class AgreementTemplateBase { this.conditions = conditions this.logger = LoggerInstance + this.templateName = 'invalid' } public async createAgreementFromDDO( @@ -90,8 +91,12 @@ export class AgreementTemplateBase { ) } + public getName() { + return this.templateName + } + public getId() { - return this.templateManager.generateId(this.templateName) + return this.templateManager.generateId(this.getName()) } /** @@ -144,7 +149,6 @@ export class AgreementTemplateBase { return null } - // getAgreementData /** * Conditions address list. * @return {Promise} Conditions address. diff --git a/src/keeper/contracts/templates/EscrowAccessSecretStoreTemplate.ts b/src/keeper/contracts/templates/EscrowAccessSecretStoreTemplate.ts index 6acb7b5..bbcb6a5 100644 --- a/src/keeper/contracts/templates/EscrowAccessSecretStoreTemplate.ts +++ b/src/keeper/contracts/templates/EscrowAccessSecretStoreTemplate.ts @@ -1,8 +1,19 @@ -import { AgreementTemplateBase } from './AgreementTemplateBase' +import { AgreementTemplateBase, Conditions } from './AgreementTemplateBase' import { escrowAccessServiceAgreementTemplate } from './EscrowAccess.serviceAgreementTemplate' +import { AgreementStoreManager, TemplateStoreManager } from '../managers' +import DIDRegistry from '../DIDRegistry'; export class EscrowAccessSecretStoreTemplate extends AgreementTemplateBase { - public templateName: 'EscrowAccessSecretStoreTemplate' + + public constructor( + templateManager: TemplateStoreManager, + agreementStoreManager: AgreementStoreManager, + didRegistry: DIDRegistry, + conditions: Conditions + ) { + super(templateManager, agreementStoreManager, didRegistry, conditions) + this.templateName = 'EscrowAccessSecretStoreTemplate' + } public async getServiceAgreementTemplate() { return escrowAccessServiceAgreementTemplate diff --git a/src/keeper/contracts/templates/EscrowComputeExecutionTemplate.ts b/src/keeper/contracts/templates/EscrowComputeExecutionTemplate.ts index 5a82ea4..ed2585a 100644 --- a/src/keeper/contracts/templates/EscrowComputeExecutionTemplate.ts +++ b/src/keeper/contracts/templates/EscrowComputeExecutionTemplate.ts @@ -1,8 +1,19 @@ -import { AgreementTemplateBase } from './AgreementTemplateBase' +import { AgreementTemplateBase, Conditions} from './AgreementTemplateBase' import { escrowComputeServiceAgreementTemplate } from './EscrowCompute.serviceAgreementTemplate' +import { AgreementStoreManager, TemplateStoreManager } from '../managers'; +import DIDRegistry from '../DIDRegistry'; export class EscrowComputeExecutionTemplate extends AgreementTemplateBase { - public templateName: 'EscrowComputeExecutionTemplate' + + public constructor( + templateManager: TemplateStoreManager, + agreementStoreManager: AgreementStoreManager, + didRegistry: DIDRegistry, + conditions: Conditions + ) { + super(templateManager, agreementStoreManager, didRegistry, conditions) + this.templateName = 'EscrowComputeExecutionTemplate' + } public async getServiceAgreementTemplate() { return escrowComputeServiceAgreementTemplate