payment-kit 1.23.2 → 1.23.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -511,8 +511,6 @@ async function handleInvoiceCredit(invoiceId: string) {
511
511
  const metadata = price.metadata || {};
512
512
  const creditConfig = metadata.credit_config || {};
513
513
  const quantity = lineItem.quantity || 1;
514
- const creditAmount: BN = new BN(creditConfig.credit_amount ?? 1).mul(new BN(quantity));
515
-
516
514
  const currency = await PaymentCurrency.findByPk(creditConfig.currency_id);
517
515
 
518
516
  if (!currency) {
@@ -520,6 +518,9 @@ async function handleInvoiceCredit(invoiceId: string) {
520
518
  throw new Error(`Currency not found: ${creditConfig.currency_id}`);
521
519
  }
522
520
 
521
+ const creditAmountPerUnit = fromTokenToUnit(creditConfig.credit_amount ?? '1', currency.decimal);
522
+ const creditAmount = new BN(creditAmountPerUnit).mul(new BN(quantity)).toString();
523
+
523
524
  let applicabilityConfig: any = {
524
525
  scope: {
525
526
  type: 'metered',
@@ -614,7 +615,7 @@ async function handleInvoiceCredit(invoiceId: string) {
614
615
  try {
615
616
  const createPromises = grantsToCreate.map(async (item) => {
616
617
  const creditGrant = await createCreditGrant({
617
- amount: fromTokenToUnit(item.creditAmount.toString(), item.currency.decimal).toString(),
618
+ amount: item.creditAmount,
618
619
  currency_id: item.currency.id,
619
620
  customer_id: invoice.customer.id,
620
621
  name: item.price.nickname || item.price.product?.name,
package/blocklet.yml CHANGED
@@ -14,7 +14,7 @@ repository:
14
14
  type: git
15
15
  url: git+https://github.com/blocklet/payment-kit.git
16
16
  specVersion: 1.2.8
17
- version: 1.23.2
17
+ version: 1.23.4
18
18
  logo: logo.png
19
19
  files:
20
20
  - dist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payment-kit",
3
- "version": "1.23.2",
3
+ "version": "1.23.4",
4
4
  "scripts": {
5
5
  "dev": "blocklet dev --open",
6
6
  "lint": "tsc --noEmit && eslint src api/src --ext .mjs,.js,.jsx,.ts,.tsx",
@@ -45,35 +45,35 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@abtnode/cron": "^1.17.5",
48
- "@arcblock/did": "^1.27.14",
49
- "@arcblock/did-connect-react": "^3.2.13",
48
+ "@arcblock/did": "^1.27.15",
49
+ "@arcblock/did-connect-react": "^3.2.19",
50
50
  "@arcblock/did-connect-storage-nedb": "^1.8.0",
51
- "@arcblock/did-util": "^1.27.14",
52
- "@arcblock/jwt": "^1.27.14",
53
- "@arcblock/react-hooks": "^3.2.13",
54
- "@arcblock/ux": "^3.2.13",
55
- "@arcblock/validator": "^1.27.14",
56
- "@arcblock/vc": "^1.27.14",
57
- "@blocklet/did-space-js": "^1.2.9",
58
- "@blocklet/error": "^0.3.4",
51
+ "@arcblock/did-util": "^1.27.15",
52
+ "@arcblock/jwt": "^1.27.15",
53
+ "@arcblock/react-hooks": "^3.2.19",
54
+ "@arcblock/ux": "^3.2.19",
55
+ "@arcblock/validator": "^1.27.15",
56
+ "@arcblock/vc": "^1.27.15",
57
+ "@blocklet/did-space-js": "^1.2.11",
58
+ "@blocklet/error": "^0.3.5",
59
59
  "@blocklet/js-sdk": "^1.17.5",
60
60
  "@blocklet/logger": "^1.17.5",
61
- "@blocklet/payment-broker-client": "1.23.2",
62
- "@blocklet/payment-react": "1.23.2",
63
- "@blocklet/payment-vendor": "1.23.2",
61
+ "@blocklet/payment-broker-client": "1.23.4",
62
+ "@blocklet/payment-react": "1.23.4",
63
+ "@blocklet/payment-vendor": "1.23.4",
64
64
  "@blocklet/sdk": "^1.17.5",
65
- "@blocklet/ui-react": "^3.2.13",
66
- "@blocklet/uploader": "^0.3.14",
67
- "@blocklet/xss": "^0.3.12",
65
+ "@blocklet/ui-react": "^3.2.19",
66
+ "@blocklet/uploader": "^0.3.16",
67
+ "@blocklet/xss": "^0.3.14",
68
68
  "@mui/icons-material": "^7.1.2",
69
69
  "@mui/lab": "7.0.0-beta.14",
70
70
  "@mui/material": "^7.1.2",
71
71
  "@mui/system": "^7.1.1",
72
- "@ocap/asset": "^1.27.14",
73
- "@ocap/client": "^1.27.14",
74
- "@ocap/mcrypto": "^1.27.14",
75
- "@ocap/util": "^1.27.14",
76
- "@ocap/wallet": "^1.27.14",
72
+ "@ocap/asset": "^1.27.15",
73
+ "@ocap/client": "^1.27.15",
74
+ "@ocap/mcrypto": "^1.27.15",
75
+ "@ocap/util": "^1.27.15",
76
+ "@ocap/wallet": "^1.27.15",
77
77
  "@stripe/react-stripe-js": "^2.9.0",
78
78
  "@stripe/stripe-js": "^2.4.0",
79
79
  "ahooks": "^3.8.5",
@@ -130,7 +130,7 @@
130
130
  "devDependencies": {
131
131
  "@abtnode/types": "^1.17.5",
132
132
  "@arcblock/eslint-config-ts": "^0.3.3",
133
- "@blocklet/payment-types": "1.23.2",
133
+ "@blocklet/payment-types": "1.23.4",
134
134
  "@types/cookie-parser": "^1.4.9",
135
135
  "@types/cors": "^2.8.19",
136
136
  "@types/debug": "^4.1.12",
@@ -161,7 +161,7 @@
161
161
  "vite": "^7.0.0",
162
162
  "vite-node": "^3.2.4",
163
163
  "vite-plugin-babel-import": "^2.0.5",
164
- "vite-plugin-blocklet": "^0.12.4",
164
+ "vite-plugin-blocklet": "^0.13.1",
165
165
  "vite-plugin-node-polyfills": "^0.23.0",
166
166
  "vite-plugin-svgr": "^4.3.0",
167
167
  "vite-tsconfig-paths": "^5.1.4",
@@ -177,5 +177,5 @@
177
177
  "parser": "typescript"
178
178
  }
179
179
  },
180
- "gitHead": "facbd56b5c169d3999f007f74602a010e6dd0da2"
180
+ "gitHead": "12cd3cecedb8aa3331a4a24fa093f62cc6630d5b"
181
181
  }
@@ -128,6 +128,7 @@ export default flat({
128
128
  },
129
129
  },
130
130
  admin: {
131
+ description: 'Manage your products, pricing, billing, and payments.',
131
132
  balances: 'Balances',
132
133
  trends: 'Trends',
133
134
  addresses: 'Addresses',
@@ -1893,6 +1894,7 @@ export default flat({
1893
1894
  },
1894
1895
  },
1895
1896
  integrations: {
1897
+ description: 'Configure and manage how Payment Kit integrates with your application.',
1896
1898
  basicFeatures: 'Basic Features',
1897
1899
  advancedFeatures: 'Advanced Features',
1898
1900
  features: {
@@ -127,6 +127,7 @@ export default flat({
127
127
  },
128
128
  },
129
129
  admin: {
130
+ description: '管理你的产品、定价、账单和支付流程。',
130
131
  balances: '余额',
131
132
  addresses: '地址',
132
133
  trends: '趋势',
@@ -1837,6 +1838,7 @@ export default flat({
1837
1838
  },
1838
1839
  },
1839
1840
  integrations: {
1841
+ description: '用于配置和管理 Payment Kit 与你应用之间的集成方式。',
1840
1842
  basicFeatures: '基础功能',
1841
1843
  advancedFeatures: '高级功能',
1842
1844
  features: {
@@ -1,4 +1,5 @@
1
1
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
2
+ import { useAppInfo } from '@blocklet/ui-react/lib/Dashboard';
2
3
  import { Switch, usePaymentContext } from '@blocklet/payment-react';
3
4
  import { Chip, Stack } from '@mui/material';
4
5
  import React, { isValidElement, useEffect } from 'react';
@@ -43,6 +44,7 @@ const renderNav = (group: string, onChange: Function, groups: { label: string; v
43
44
  function Admin() {
44
45
  const navigate = useNavigate();
45
46
  const { t } = useLocaleContext();
47
+ const { updateAppInfo } = useAppInfo();
46
48
  const settings = usePaymentContext();
47
49
  const { group = 'overview' } = useParams();
48
50
  const { isPending, startTransition } = useTransitionContext();
@@ -72,6 +74,12 @@ function Admin() {
72
74
 
73
75
  const group2 = [{ label: t('admin.developers'), value: 'developers' }];
74
76
 
77
+ useEffect(() => {
78
+ updateAppInfo({
79
+ description: t('admin.description'),
80
+ });
81
+ }, [t]);
82
+
75
83
  return (
76
84
  <>
77
85
  <ProgressBar pending={isPending} />
@@ -1,4 +1,5 @@
1
1
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
2
+ import { useAppInfo } from '@blocklet/ui-react/lib/Dashboard';
2
3
  import { Stack } from '@mui/material';
3
4
  import React, { useEffect } from 'react';
4
5
  import { useNavigate, useParams } from 'react-router-dom';
@@ -16,6 +17,7 @@ const pages = {
16
17
  function Integrations() {
17
18
  const navigate = useNavigate();
18
19
  const { t } = useLocaleContext();
20
+ const { updateAppInfo } = useAppInfo();
19
21
  const { group = 'overview' } = useParams();
20
22
  const { isPending, startTransition } = useTransitionContext();
21
23
 
@@ -32,6 +34,12 @@ function Integrations() {
32
34
  { label: t('admin.donate.title'), value: 'donations' },
33
35
  ];
34
36
 
37
+ useEffect(() => {
38
+ updateAppInfo({
39
+ description: t('integrations.description'),
40
+ });
41
+ }, [t]);
42
+
35
43
  return (
36
44
  <>
37
45
  <ProgressBar pending={isPending} />
@@ -99,15 +99,6 @@ export default function Overview() {
99
99
  sx={{
100
100
  mb: 4,
101
101
  }}>
102
- <Typography
103
- variant="h2"
104
- gutterBottom
105
- sx={{
106
- fontWeight: 'bold',
107
- mb: 1,
108
- }}>
109
- {t('common.welcome')}
110
- </Typography>
111
102
  <Typography
112
103
  variant="body2"
113
104
  sx={{
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file