Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,27 @@
"sourceMaps": true,
"cwd": "${workspaceRoot}/services/sign/pod-sign"
},
{
"name": "Debug payment",
"type": "node",
"request": "launch",
"args": ["src/index.ts"],
"env": {
"PORT": "3040",
"SECRET": "secret",
"SERVICE_ID": "payment-service",
"ACCOUNTS_URL": "http://huly.local:3000",
"FRONT_URL": "http://huly.local:8087",
"USE_SANDBOX": "true",
// "POLAR_ACCESS_TOKEN": "polar_xxx",
// "POLAR_WEBHOOK_SECRET": "whsec_xxx",
// "POLAR_SUBSCRIPTION_PLANS": "common@tier:prod_1a,prod_1b;rare@tier:prod_2;epic@tier:prod_3;legendary@tier:prod_4"
},
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
"runtimeVersion": "20",
"sourceMaps": true,
"cwd": "${workspaceRoot}/services/payment/pod-payment"
},
{
"name": "Debug rekoni",
"type": "node",
Expand Down
1,026 changes: 602 additions & 424 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions common/scripts/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ rush docker:build -p 20 \
--to @hcengineering/pod-backup \
--to @hcengineering/backup-api-pod \
--to @hcengineering/pod-billing \
--to @hcengineering/pod-process \
--to @hcengineering/pod-rating
--to @hcengineering/pod-process \
--to @hcengineering/pod-rating \
--to @hcengineering/pod-payment
1 change: 1 addition & 0 deletions desktop/src/ui/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ export async function configurePlatform (onWorkbenchConnect?: () => Promise<void
setMetadata(exportPlugin.metadata.ExportUrl, config.EXPORT_URL ?? '')

setMetadata(billingPlugin.metadata.BillingURL, config.BILLING_URL ?? '')
setMetadata(presentation.metadata.PaymentUrl, config.PAYMENT_URL ?? '')

const languages = myBranding.languages !== undefined && myBranding.languages !== '' ? myBranding.languages.split(',').map((l) => l.trim()) : ['en', 'ru', 'es', 'pt', 'zh', 'fr', 'cs', 'it', 'de', 'ja', 'tr']

Expand Down
1 change: 1 addition & 0 deletions desktop/src/ui/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export interface Config {
MAIL_URL?: string
COMMUNICATION_API_ENABLED?: string
BILLING_URL?: string
PAYMENT_URL?: string
PULSE_URL?: string
PASSWORD_STRICTNESS?: 'very_strict' | 'strict' | 'normal' | 'none'
EXCLUDED_APPLICATIONS_FOR_ANONYMOUS?: string
Expand Down
17 changes: 17 additions & 0 deletions dev/docker-compose.min.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,22 @@ services:
- PORT=4900
- SERVER_SECRET=secret
restart: unless-stopped
payment:
image: hardcoreeng/payment
extra_hosts:
- 'huly.local:host-gateway'
ports:
- 3040:3040
environment:
- SECRET=secret
- PORT=3040
- ACCOUNTS_URL=http://huly.local:3000
- FRONT_URL=http://huly.local:8087
- USE_SANDBOX=true
- POLAR_ACCESS_TOKEN=${POLAR_ACCESS_TOKEN}
- POLAR_WEBHOOK_SECRET=${POLAR_WEBHOOK_SECRET}
- POLAR_SUBSCRIPTION_PLANS=${POLAR_SUBSCRIPTION_PLANS}
restart: unless-stopped
workspace_cockroach:
image: hardcoreeng/workspace
extra_hosts:
Expand Down Expand Up @@ -203,6 +219,7 @@ services:
- DESKTOP_UPDATES_CHANNELS=dev;tracex:dev-tracex
- BRANDING_URL=http://huly.local:8087/branding.json
- STREAM_URL=http://huly.local:1080/recording
- PAYMENT_URL=http://huly.local:3040
# - DISABLE_SIGNUP=true
restart: unless-stopped
transactor_cockroach:
Expand Down
18 changes: 18 additions & 0 deletions dev/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,23 @@ services:
- SERVER_SECRET=secret
- OTEL_EXPORTER_OTLP_ENDPOINT=http://jaeger:4318/v1/traces
restart: unless-stopped
payment:
image: hardcoreeng/payment
extra_hosts:
- 'huly.local:host-gateway'
ports:
- 3040:3040
environment:
- SECRET=secret
- PORT=3040
- ACCOUNTS_URL=http://huly.local:3000
- FRONT_URL=http://huly.local:8087
- USE_SANDBOX=true
- POLAR_ACCESS_TOKEN=${POLAR_ACCESS_TOKEN}
- POLAR_WEBHOOK_SECRET=${POLAR_WEBHOOK_SECRET}
- POLAR_SUBSCRIPTION_PLANS=${POLAR_SUBSCRIPTION_PLANS}
- OTEL_EXPORTER_OTLP_ENDPOINT=http://jaeger:4318/v1/traces
restart: unless-stopped
workspace_cockroach:
image: hardcoreeng/workspace
extra_hosts:
Expand Down Expand Up @@ -279,6 +296,7 @@ services:
- DESKTOP_UPDATES_CHANNELS=dev;tracex:dev-tracex
- BRANDING_URL=http://huly.local:8087/branding.json
- STREAM_URL=http://huly.local:1080/recording
- PAYMENT_URL=http://huly.local:3040
- COMMUNICATION_API_ENABLED=true
- BACKUP_URL=http://huly.local:4039/api/backup,
- EXCLUDED_APPLICATIONS_FOR_ANONYMOUS=["chunter", "notification"]
Expand Down
1 change: 1 addition & 0 deletions dev/prod/public/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"STATS_URL": "http://huly.local:4900",
"PASSWORD_STRICTNESS": "none",
"STREAM_URL": "http://huly.local:1080/recording",
"PAYMENT_URL": "http://huly.local:3040",
"PUBLIC_SCHEDULE_URL": "http://huly.local:8060",
"CALDAV_SERVER_URL": "http://huly.local:9070",
"EXPORT_URL": "http://huly.local:4009",
Expand Down
2 changes: 2 additions & 0 deletions dev/prod/src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ export interface Config {
MAIL_URL?: string
COMMUNICATION_API_ENABLED?: string
BILLING_URL?: string
PAYMENT_URL?: string
EXCLUDED_APPLICATIONS_FOR_ANONYMOUS?: string
PULSE_URL?: string
HULYLAKE_URL?: string
Expand Down Expand Up @@ -514,6 +515,7 @@ export async function configurePlatform () {
setMetadata(exportPlugin.metadata.ExportUrl, config.EXPORT_URL ?? '')

setMetadata(billingPlugin.metadata.BillingURL, config.BILLING_URL ?? '')
setMetadata(presentation.metadata.PaymentUrl, config.PAYMENT_URL ?? '')

setMetadata(presentation.metadata.PulseUrl, config.PULSE_URL)
setMetadata(presentation.metadata.HulylakeUrl, config.HULYLAKE_URL ?? '')
Expand Down
2 changes: 1 addition & 1 deletion dev/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"test": "echo \"No test specified\""
},
"devDependencies": {
"@hcengineering/platform": "^0.7.5",
"@hcengineering/platform": "^0.7.17",
"@hcengineering/theme": "^0.7.0",
"@hcengineering/ui": "^0.7.0",
"@storybook/addon-essentials": "^7.0.6",
Expand Down
2 changes: 1 addition & 1 deletion dev/tool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"@hcengineering/model-activity": "^0.7.0",
"@hcengineering/model-lead": "^0.7.0",
"@hcengineering/postgres": "^0.7.15",
"@hcengineering/account-client": "^0.7.17",
"@hcengineering/account-client": "^0.7.18",
"@hcengineering/mongo": "^0.7.15",
"@hcengineering/platform": "^0.7.17",
"@hcengineering/recruit": "^0.7.0",
Expand Down
3 changes: 2 additions & 1 deletion models/billing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@hcengineering/model": "^0.7.17",
"@hcengineering/model-core": "^0.7.0",
"@hcengineering/setting": "^0.7.0",
"@hcengineering/billing": "^0.7.0"
"@hcengineering/billing": "^0.7.0",
"@hcengineering/platform": "^0.7.17"
}
}
91 changes: 83 additions & 8 deletions models/billing/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,98 @@
// limitations under the License.
//

import { type Builder } from '@hcengineering/model'
import core from '@hcengineering/model-core'
import { Model, UX, type Builder } from '@hcengineering/model'
import core, { TDoc } from '@hcengineering/model-core'
import { type IntlString } from '@hcengineering/platform'
import setting from '@hcengineering/setting'
import billingPlugin from '@hcengineering/billing'
import { AccountRole } from '@hcengineering/core'
import billing, { type Tier } from '@hcengineering/billing'
import { AccountRole, DOMAIN_MODEL } from '@hcengineering/core'

export { billingId } from '@hcengineering/billing'
export { billingPlugin as default }
export { billing as default }

@Model(billing.class.Tier, core.class.Doc, DOMAIN_MODEL)
@UX(billing.string.Tier)
export class TTier extends TDoc implements Tier {
label!: IntlString
description!: IntlString
storageLimitGB!: number
trafficLimitGB!: number

priceMonthly!: number
index!: number
color?: string
}

export function createModel (builder: Builder): void {
builder.createModel(TTier)

builder.createDoc(setting.class.WorkspaceSettingCategory, core.space.Model, {
name: 'billing',
label: billingPlugin.string.Billing,
icon: billingPlugin.icon.Billing,
component: billingPlugin.component.Settings,
label: billing.string.Billing,
icon: billing.icon.Billing,
component: billing.component.Settings,
group: 'settings-editor',
role: AccountRole.Owner,
order: 920
})

builder.createDoc(
billing.class.Tier,
core.space.Model,
{
label: billing.string.Common,
description: billing.string.CommonDescription,
storageLimitGB: 10,
trafficLimitGB: 10,
priceMonthly: 0,
index: 0
},
billing.tier.Common
)

builder.createDoc(
billing.class.Tier,
core.space.Model,
{
label: billing.string.Rare,
description: billing.string.RareDescription,
storageLimitGB: 100,
trafficLimitGB: 100,
priceMonthly: 19.99,
index: 1,
color: 'Sky'
},
billing.tier.Rare
)

builder.createDoc(
billing.class.Tier,
core.space.Model,
{
label: billing.string.Epic,
description: billing.string.EpicDescription,
storageLimitGB: 1000,
trafficLimitGB: 500,
priceMonthly: 99.99,
index: 2,
color: 'Orchid'
},
billing.tier.Epic
)

builder.createDoc(
billing.class.Tier,
core.space.Model,
{
label: billing.string.Legendary,
description: billing.string.LegendaryDescription,
storageLimitGB: 10000,
trafficLimitGB: 2000,
priceMonthly: 399.99,
index: 3,
color: 'Orange'
},
billing.tier.Legendary
)
}
2 changes: 1 addition & 1 deletion models/calendar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@hcengineering/model-view": "^0.7.0",
"@hcengineering/model-setting": "^0.7.0",
"@hcengineering/model-workbench": "^0.7.0",
"@hcengineering/account-client": "^0.7.17",
"@hcengineering/account-client": "^0.7.18",
"@hcengineering/activity": "^0.7.0",
"@hcengineering/workbench": "^0.7.0",
"@hcengineering/model-preference": "^0.7.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/integration-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@types/uuid": "^8.3.1"
},
"dependencies": {
"@hcengineering/account-client": "^0.7.17",
"@hcengineering/account-client": "^0.7.18",
"@hcengineering/core": "^0.7.18",
"@hcengineering/platform": "^0.7.17",
"@hcengineering/kvs-client": "^0.7.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/payment-client/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: ['./node_modules/@hcengineering/platform-rig/profiles/default/eslint.config.json'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.json'
}
}
4 changes: 4 additions & 0 deletions packages/payment-client/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!/lib/**
!CHANGELOG.md
/lib/**/__tests__/
4 changes: 4 additions & 0 deletions packages/payment-client/config/rig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
"rigPackageName": "@hcengineering/platform-rig"
}
7 changes: 7 additions & 0 deletions packages/payment-client/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'],
roots: ["./src"],
coverageReporters: ["text-summary", "html"]
}
57 changes: 57 additions & 0 deletions packages/payment-client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "@hcengineering/payment-client",
"version": "0.7.0",
"main": "lib/index.js",
"svelte": "src/index.ts",
"types": "types/index.d.ts",
"files": [
"lib/**/*",
"types/**/*",
"tsconfig.json"
],
"author": "Hardcore Engineering Inc.",
"license": "EPL-2.0",
"scripts": {
"build": "compile",
"build:watch": "compile",
"format": "format src",
"test": "jest --passWithNoTests --silent",
"_phase:build": "compile transpile src",
"_phase:test": "jest --passWithNoTests --silent",
"_phase:format": "format src",
"_phase:validate": "compile validate"
},
"devDependencies": {
"cross-env": "~7.0.3",
"@hcengineering/platform-rig": "^0.7.19",
"@types/node": "^22.15.29",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-n": "^15.4.0",
"eslint": "^8.54.0",
"esbuild": "^0.25.9",
"@typescript-eslint/parser": "^6.21.0",
"eslint-config-standard-with-typescript": "^40.0.0",
"prettier": "^3.6.2",
"typescript": "^5.9.3",
"jest": "^29.7.0",
"ts-jest": "^29.1.1",
"@types/jest": "^29.5.5"
},
"dependencies": {
"@hcengineering/core": "^0.7.18",
"@hcengineering/platform": "^0.7.17"
},
"repository": "https://github.com/hcengineering/platform",
"publishConfig": {
"access": "public"
},
"exports": {
".": {
"types": "./types/index.d.ts",
"require": "./lib/index.js",
"import": "./lib/index.js"
}
}
}
Loading
Loading