diff --git a/package.json b/package.json index 3ab0a13c..68211463 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hawk.api", - "version": "1.4.7", + "version": "1.4.9", "main": "index.ts", "license": "BUSL-1.1", "scripts": { diff --git a/src/resolvers/billingNew.ts b/src/resolvers/billingNew.ts index 64e1537f..ee973d22 100644 --- a/src/resolvers/billingNew.ts +++ b/src/resolvers/billingNew.ts @@ -86,6 +86,7 @@ export default { currency: string; checksum: string; nextPaymentDate: Date; + cloudPaymentsPublicId: string; }> { const { workspaceId, tariffPlanId, shouldSaveCard } = input; @@ -178,6 +179,7 @@ debug: ${Boolean(workspace.isDebug)}` currency: 'RUB', checksum, nextPaymentDate, + cloudPaymentsPublicId: process.env.CLOUDPAYMENTS_PUBLIC_ID || '', }; }, }, diff --git a/src/resolvers/workspace.js b/src/resolvers/workspace.js index 2333099d..83ef92ae 100644 --- a/src/resolvers/workspace.js +++ b/src/resolvers/workspace.js @@ -436,7 +436,8 @@ module.exports = { const defaultPlan = await factories.plansFactory.getDefaultPlan(); - if (workspaceModel.tariffPlanId === defaultPlan.id) { + // Prevent re-applying the free plan if workspace is already on it. + if (workspaceModel.tariffPlanId.toString() === defaultPlan._id.toString()) { throw new UserInputError('You already use default plan'); } diff --git a/src/typeDefs/billing.ts b/src/typeDefs/billing.ts index f277fbca..7cf9197b 100644 --- a/src/typeDefs/billing.ts +++ b/src/typeDefs/billing.ts @@ -270,6 +270,11 @@ type ComposePaymentResponse { Next payment date (recurrent start) """ nextPaymentDate: DateTime! + + """ + CloudPayments public id (merchant identifier for payment widget) + """ + cloudPaymentsPublicId: String! }