@unchainedshop/plugins 5.0.0-alpha.3 → 5.0.0-alpha.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.
@@ -18,8 +18,9 @@ const gridfsHandler = async (req, res) => {
18
18
  const directoryName = decodeURIComponent(directoryNameRaw);
19
19
  const fileName = decodeURIComponent(fileNameRaw);
20
20
  res.setHeader('Access-Control-Allow-Methods', 'GET, PUT');
21
- res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
21
+ res.setHeader('Access-Control-Allow-Headers', req.get('Access-Control-Request-Headers') || 'Content-Type');
22
22
  res.setHeader('Access-Control-Allow-Origin', '*');
23
+ res.setHeader('Vary', 'Access-Control-Request-Headers');
23
24
  if (req.method === 'OPTIONS') {
24
25
  res.status(200).end();
25
26
  return;
@@ -15,8 +15,9 @@ const gridfsHandler = async (req, reply) => {
15
15
  const { services, modules } = req.unchainedContext;
16
16
  const { directoryName, fileName } = req.params;
17
17
  reply.header('Access-Control-Allow-Methods', 'GET, PUT');
18
- reply.header('Access-Control-Allow-Headers', 'content-type');
18
+ reply.header('Access-Control-Allow-Headers', req.headers['access-control-request-headers'] || 'content-type');
19
19
  reply.header('Access-Control-Allow-Origin', '*');
20
+ reply.header('Vary', 'Access-Control-Request-Headers');
20
21
  if (req.method === 'OPTIONS') {
21
22
  reply.status(200);
22
23
  return reply.send();
@@ -22,11 +22,13 @@ export const WordlineSaferpay = {
22
22
  },
23
23
  actions: (config, context) => {
24
24
  const { modules } = context;
25
- const { SAFERPAY_BASE_URL = 'https://test.saferpay.com/api', SAFERPAY_CUSTOMER_ID, SAFERPAY_WEBHOOK_PATH = '/payment/saferpay/webhook', SAFERPAY_RETURN_PATH = '/saferpay/return', ROOT_URL = 'http://localhost:4010', EMAIL_WEBSITE_URL, SAFERPAY_USER, SAFERPAY_PW, } = process.env;
25
+ const { SAFERPAY_BASE_URL = 'https://test.saferpay.com/api', SAFERPAY_CUSTOMER_ID, SAFERPAY_WEBHOOK_PATH = '/payment/saferpay/webhook', SAFERPAY_RETURN_PATH = '/saferpay/return', ROOT_URL = 'http://localhost:4010', EMAIL_WEBSITE_URL, SAFERPAY_API_USER, SAFERPAY_API_PASSWORD, SAFERPAY_USER, SAFERPAY_PW, } = process.env;
26
+ const apiUser = SAFERPAY_API_USER || SAFERPAY_USER;
27
+ const apiPassword = SAFERPAY_API_PASSWORD || SAFERPAY_PW;
26
28
  const createSaferPayClient = () => {
27
- if (!SAFERPAY_CUSTOMER_ID || !SAFERPAY_USER || !SAFERPAY_PW)
29
+ if (!SAFERPAY_CUSTOMER_ID || !apiUser || !apiPassword)
28
30
  throw new Error('Credentials not Set');
29
- const saferpayClient = new SaferpayClient(SAFERPAY_BASE_URL, SAFERPAY_CUSTOMER_ID, SAFERPAY_USER, SAFERPAY_PW);
31
+ const saferpayClient = new SaferpayClient(SAFERPAY_BASE_URL, SAFERPAY_CUSTOMER_ID, apiUser, apiPassword);
30
32
  return saferpayClient;
31
33
  };
32
34
  const adapter = {
@@ -37,8 +39,8 @@ export const WordlineSaferpay = {
37
39
  configurationError() {
38
40
  if (!SAFERPAY_BASE_URL ||
39
41
  !SAFERPAY_CUSTOMER_ID ||
40
- !SAFERPAY_USER ||
41
- !SAFERPAY_PW ||
42
+ !apiUser ||
43
+ !apiPassword ||
42
44
  !adapter.getTerminalId()) {
43
45
  return PaymentError.INCOMPLETE_CONFIGURATION;
44
46
  }
@@ -1,5 +1,6 @@
1
1
  export const buildSignature = async (transactionId, orderPaymentId) => {
2
- const payload = [transactionId, orderPaymentId, process.env.SAFERPAY_PW].filter(Boolean).join(':');
2
+ const secret = process.env.SAFERPAY_API_PASSWORD || process.env.SAFERPAY_PW;
3
+ const payload = [transactionId, orderPaymentId, secret].filter(Boolean).join(':');
3
4
  const msgUint8 = new TextEncoder().encode(payload);
4
5
  const hashBuffer = await crypto.subtle.digest('SHA-256', msgUint8);
5
6
  const hashArray = Array.from(new Uint8Array(hashBuffer));
@@ -18,8 +18,11 @@ export const SaferpayPlugin = {
18
18
  },
19
19
  ],
20
20
  onRegister: () => {
21
- const { SAFERPAY_CUSTOMER_ID, SAFERPAY_TERMINAL_ID, SAFERPAY_API_USER, SAFERPAY_API_PASSWORD } = process.env;
22
- if (!SAFERPAY_CUSTOMER_ID || !SAFERPAY_TERMINAL_ID || !SAFERPAY_API_USER || !SAFERPAY_API_PASSWORD) {
21
+ const { SAFERPAY_CUSTOMER_ID, SAFERPAY_TERMINAL_ID, SAFERPAY_API_USER, SAFERPAY_API_PASSWORD, SAFERPAY_USER, SAFERPAY_PW, } = process.env;
22
+ if (!SAFERPAY_CUSTOMER_ID ||
23
+ !SAFERPAY_TERMINAL_ID ||
24
+ !(SAFERPAY_API_USER || SAFERPAY_USER) ||
25
+ !(SAFERPAY_API_PASSWORD || SAFERPAY_PW)) {
23
26
  throw new Error('Saferpay environment variables not fully configured');
24
27
  }
25
28
  },
@@ -7,7 +7,7 @@ if (STRIPE_SECRET) {
7
7
  try {
8
8
  const { default: Stripe } = await import('stripe');
9
9
  stripe = new Stripe(STRIPE_SECRET, {
10
- apiVersion: '2026-07-29.dahlia',
10
+ apiVersion: '2026-08-26.dahlia',
11
11
  });
12
12
  }
13
13
  catch {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unchainedshop/plugins",
3
3
  "description": "Official plugin collection for the Unchained Engine with payment, delivery, and pricing adapters",
4
- "version": "5.0.0-alpha.3",
4
+ "version": "5.0.0-alpha.4",
5
5
  "main": "lib/plugins-index.js",
6
6
  "types": "lib/plugins-index.d.ts",
7
7
  "exports": {
@@ -137,7 +137,7 @@
137
137
  "minio": "^8.0.5",
138
138
  "nodemailer": "^9.0.0",
139
139
  "stripe": "^22.5.0",
140
- "typescript": "^5.8.3",
140
+ "typescript": "^6.0.3",
141
141
  "web-push": "^3.6.7",
142
142
  "xml-js": "^1.6.11"
143
143
  }