strapi-plugin-payone-provider 5.7.23 → 5.7.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-payone-provider",
3
- "version": "5.7.23",
3
+ "version": "5.7.24",
4
4
  "description": "Strapi plugin for Payone payment gateway integration",
5
5
  "license": "MIT",
6
6
  "maintainers": [
@@ -415,4 +415,37 @@ module.exports = ({ strapi }) => ({
415
415
  handleError(ctx, error);
416
416
  }
417
417
  },
418
+
419
+ async hash384(ctx) {
420
+ try {
421
+ // Get settings
422
+ const settings = await getPayoneService(strapi).getSettings();
423
+ const hmacKey = settings?.key || "";
424
+
425
+ if (!hmacKey) {
426
+ ctx.throw(400, "Payone key is not configured in plugin settings");
427
+ }
428
+
429
+ // Validate required settings
430
+ if (!settings?.aid || !settings?.mid || !settings?.portalid || !settings?.mode) {
431
+ ctx.throw(400, "Required settings (aid, mid, portalid, mode) are not configured");
432
+ }
433
+
434
+ // Construct the string from settings values
435
+ // Format: ${aid}UTF-8${mid}${mode}${portalid}creditcardcheckJSONyes
436
+ const textToHash = `${settings.aid}UTF-8${settings.mid}${settings.mode}${settings.portalid}creditcardcheckJSONyes`;
437
+
438
+ // Create HMAC SHA-384 hash
439
+ const hmac = crypto.createHmac("sha384", hmacKey);
440
+ hmac.update(textToHash);
441
+ const hash = hmac.digest("hex");
442
+
443
+ ctx.body = {
444
+ hash,
445
+ text: textToHash
446
+ };
447
+ } catch (error) {
448
+ handleError(ctx, error);
449
+ }
450
+ }
418
451
  });
@@ -100,7 +100,14 @@ module.exports = {
100
100
  policies: ["admin::isAuthenticatedAdmin"]
101
101
  }
102
102
  },
103
- // legacy hosted-iFrame endpoints removed
103
+ {
104
+ method: "POST",
105
+ path: "/hash384",
106
+ handler: "payone.hash384",
107
+ config: {
108
+ policies: ["admin::isAuthenticatedAdmin"]
109
+ }
110
+ }
104
111
  ]
105
112
  },
106
113
 
@@ -188,6 +195,15 @@ module.exports = {
188
195
  auth: false
189
196
  }
190
197
  },
198
+ {
199
+ method: "POST",
200
+ path: "/hash384",
201
+ handler: "payone.hash384",
202
+ config: {
203
+ policies: ["plugin::strapi-plugin-payone-provider.is-auth"],
204
+ auth: false
205
+ }
206
+ },
191
207
  {
192
208
  method: "POST",
193
209
  path: "/transaction-status",