payment-kit 1.13.52 → 1.13.53
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.
package/api/src/libs/util.ts
CHANGED
|
@@ -143,3 +143,14 @@ export function getTxMetadata(extra: Record<string, any> = {}): any {
|
|
|
143
143
|
},
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
|
+
|
|
147
|
+
export function getMetadataFromQuery(query: Record<string, any> = {}): Record<string, any> {
|
|
148
|
+
const metadata: Record<string, any> = {};
|
|
149
|
+
Object.keys(query).forEach((key) => {
|
|
150
|
+
if (key.startsWith('metadata.') && query[key]) {
|
|
151
|
+
metadata[key.replace('metadata.', '')] = query[key];
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
return metadata;
|
|
156
|
+
}
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
getSupportedPaymentMethods,
|
|
36
36
|
isLineItemAligned,
|
|
37
37
|
} from '../libs/session';
|
|
38
|
-
import { createCodeGenerator, formatMetadata } from '../libs/util';
|
|
38
|
+
import { createCodeGenerator, formatMetadata, getMetadataFromQuery } from '../libs/util';
|
|
39
39
|
import type { TPriceExpanded, TProductExpanded } from '../store/models';
|
|
40
40
|
import { CheckoutSession } from '../store/models/checkout-session';
|
|
41
41
|
import { Customer } from '../store/models/customer';
|
|
@@ -332,6 +332,7 @@ export async function startCheckoutSessionFromPaymentLink(id: string, req: Reque
|
|
|
332
332
|
} else {
|
|
333
333
|
raw.metadata = {
|
|
334
334
|
...link.metadata,
|
|
335
|
+
...getMetadataFromQuery(req.query),
|
|
335
336
|
passport: await checkPassportForPaymentLink(link),
|
|
336
337
|
preview: '1',
|
|
337
338
|
};
|
|
@@ -339,6 +340,7 @@ export async function startCheckoutSessionFromPaymentLink(id: string, req: Reque
|
|
|
339
340
|
} else {
|
|
340
341
|
raw.metadata = {
|
|
341
342
|
...link.metadata,
|
|
343
|
+
...getMetadataFromQuery(req.query),
|
|
342
344
|
passport: await checkPassportForPaymentLink(link),
|
|
343
345
|
};
|
|
344
346
|
}
|
|
@@ -9,7 +9,7 @@ import { checkPassportForPricingTable } from '../integrations/blocklet/passport'
|
|
|
9
9
|
import logger from '../libs/logger';
|
|
10
10
|
import { authenticate } from '../libs/security';
|
|
11
11
|
import { isLineItemCurrencyAligned } from '../libs/session';
|
|
12
|
-
import { formatMetadata } from '../libs/util';
|
|
12
|
+
import { formatMetadata, getMetadataFromQuery } from '../libs/util';
|
|
13
13
|
import { CheckoutSession } from '../store/models/checkout-session';
|
|
14
14
|
import { PaymentCurrency } from '../store/models/payment-currency';
|
|
15
15
|
import { Price } from '../store/models/price';
|
|
@@ -339,6 +339,7 @@ router.post('/:id/checkout/:priceId', async (req, res) => {
|
|
|
339
339
|
]),
|
|
340
340
|
metadata: {
|
|
341
341
|
...doc.metadata,
|
|
342
|
+
...getMetadataFromQuery(req.query),
|
|
342
343
|
passport: await checkPassportForPricingTable(doc),
|
|
343
344
|
pricing_table_id: doc.id,
|
|
344
345
|
},
|
package/blocklet.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.53",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev",
|
|
6
6
|
"eject": "vite eject",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@arcblock/did": "^1.18.95",
|
|
44
44
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
45
|
-
"@arcblock/did-connect": "^2.8.
|
|
45
|
+
"@arcblock/did-connect": "^2.8.11",
|
|
46
46
|
"@arcblock/did-util": "^1.18.95",
|
|
47
47
|
"@arcblock/jwt": "^1.18.95",
|
|
48
|
-
"@arcblock/ux": "^2.8.
|
|
48
|
+
"@arcblock/ux": "^2.8.11",
|
|
49
49
|
"@blocklet/logger": "1.16.17",
|
|
50
50
|
"@blocklet/sdk": "1.16.17",
|
|
51
|
-
"@blocklet/ui-react": "^2.8.
|
|
52
|
-
"@blocklet/uploader": "^0.0.
|
|
51
|
+
"@blocklet/ui-react": "^2.8.11",
|
|
52
|
+
"@blocklet/uploader": "^0.0.35",
|
|
53
53
|
"@mui/icons-material": "^5.14.16",
|
|
54
54
|
"@mui/lab": "^5.0.0-alpha.151",
|
|
55
55
|
"@mui/material": "^5.14.16",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"@abtnode/types": "1.16.17",
|
|
105
105
|
"@arcblock/eslint-config": "^0.2.4",
|
|
106
106
|
"@arcblock/eslint-config-ts": "^0.2.4",
|
|
107
|
-
"@did-pay/types": "1.13.
|
|
107
|
+
"@did-pay/types": "1.13.53",
|
|
108
108
|
"@types/cookie-parser": "^1.4.5",
|
|
109
109
|
"@types/cors": "^2.8.15",
|
|
110
110
|
"@types/dotenv-flow": "^3.3.2",
|
|
@@ -141,5 +141,5 @@
|
|
|
141
141
|
"parser": "typescript"
|
|
142
142
|
}
|
|
143
143
|
},
|
|
144
|
-
"gitHead": "
|
|
144
|
+
"gitHead": "319f8e04860c87d4d34eb9db21cf8ab3e3daba8a"
|
|
145
145
|
}
|