strapi-plugin-payone-provider 1.0.1 → 1.1.1
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/admin/src/pages/App/index.js +4 -5
- package/admin/src/pluginId.js +2 -2
- package/package.json +15 -9
- package/server/bootstrap.js +1 -1
- package/server/controllers/payone.js +9 -9
- package/server/policies/index.js +2 -2
- package/server/policies/{isAuth.js → is-auth.js} +1 -1
- package/server/routes/index.js +6 -6
- package/server/services/payone.js +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from "react";
|
|
2
|
-
import { useNotification
|
|
2
|
+
import { useNotification } from "@strapi/helper-plugin";
|
|
3
3
|
import {
|
|
4
4
|
Layout,
|
|
5
5
|
HeaderLayout,
|
|
@@ -21,7 +21,6 @@ import PaymentActionsPanel from "./components/PaymentActionsPanel";
|
|
|
21
21
|
|
|
22
22
|
const App = () => {
|
|
23
23
|
const toggleNotification = useNotification();
|
|
24
|
-
const { get, put } = useFetchClient();
|
|
25
24
|
|
|
26
25
|
const [settings, setSettings] = useState({
|
|
27
26
|
aid: "",
|
|
@@ -89,8 +88,8 @@ const App = () => {
|
|
|
89
88
|
const loadSettings = async () => {
|
|
90
89
|
setIsLoading(true);
|
|
91
90
|
try {
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
91
|
+
const response = await payoneRequests.getSettings();
|
|
92
|
+
if (response?.data) setSettings(response.data);
|
|
94
93
|
} catch (error) {
|
|
95
94
|
toggleNotification({
|
|
96
95
|
type: "warning",
|
|
@@ -108,7 +107,7 @@ const App = () => {
|
|
|
108
107
|
const handleSave = async () => {
|
|
109
108
|
setIsSaving(true);
|
|
110
109
|
try {
|
|
111
|
-
await
|
|
110
|
+
await payoneRequests.updateSettings(settings);
|
|
112
111
|
toggleNotification({
|
|
113
112
|
type: "success",
|
|
114
113
|
message: "Settings saved successfully"
|
package/admin/src/pluginId.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import pluginPkg from "../../package.json";
|
|
2
2
|
|
|
3
|
-
const pluginId = pluginPkg.name.replace(
|
|
3
|
+
const pluginId = pluginPkg.name.replace(/^(@[^-,.][\w,-]+\/|strapi-)plugin-/i, '');
|
|
4
4
|
|
|
5
|
-
export default pluginId
|
|
5
|
+
export default `strapi-plugin-${pluginId.replace(/-provider$/, '')}`;
|
package/package.json
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strapi-plugin-payone-provider",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Strapi plugin for Payone payment gateway integration",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"author": {
|
|
7
|
-
"name": "Strapi Payone Provider Developer"
|
|
8
|
-
},
|
|
9
6
|
"maintainers": [
|
|
10
7
|
{
|
|
11
|
-
"name": "
|
|
8
|
+
"name": "NewProWeb Community",
|
|
9
|
+
"email": "abror.abdullaev@newproweb.com"
|
|
12
10
|
}
|
|
13
11
|
],
|
|
14
12
|
"dependencies": {
|
|
15
|
-
"@strapi/design-system": "^1.6.3",
|
|
16
|
-
"@strapi/helper-plugin": "^4.6.0",
|
|
17
|
-
"@strapi/icons": "^1.6.3",
|
|
18
13
|
"axios": "^1.6.2",
|
|
19
14
|
"prop-types": "^15.7.2"
|
|
20
15
|
},
|
|
@@ -25,15 +20,26 @@
|
|
|
25
20
|
"styled-components": "^5.3.6"
|
|
26
21
|
},
|
|
27
22
|
"peerDependencies": {
|
|
23
|
+
"@strapi/strapi": "^4.0",
|
|
28
24
|
"react": "^17.0.0 || ^18.0.0",
|
|
29
25
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
30
26
|
"react-router-dom": "^5.2.0",
|
|
31
27
|
"styled-components": "^5.2.1"
|
|
32
28
|
},
|
|
33
29
|
"engines": {
|
|
34
|
-
"node": ">=18.0.0
|
|
30
|
+
"node": ">=18.0.0",
|
|
35
31
|
"npm": ">=6.0.0"
|
|
36
32
|
},
|
|
33
|
+
"authors": [
|
|
34
|
+
{
|
|
35
|
+
"name": "NewProWeb <Aliev Davlatbek>",
|
|
36
|
+
"email": "mamurjonov.davlatbek@newproweb.com"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "Akromjon Rahimjonov",
|
|
40
|
+
"email": "akromjon.rahimjonov@newproweb.com"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
37
43
|
"strapi": {
|
|
38
44
|
"name": "strapi-plugin-payone-provider",
|
|
39
45
|
"description": "Integrates Strapi Payone payment gateway with Strapi",
|
package/server/bootstrap.js
CHANGED
|
@@ -4,7 +4,7 @@ module.exports = ({ strapi }) => ({
|
|
|
4
4
|
async getSettings(ctx) {
|
|
5
5
|
try {
|
|
6
6
|
const settings = await strapi
|
|
7
|
-
.plugin("payone
|
|
7
|
+
.plugin("strapi-plugin-payone")
|
|
8
8
|
.service("payone")
|
|
9
9
|
.getSettings();
|
|
10
10
|
|
|
@@ -23,7 +23,7 @@ module.exports = ({ strapi }) => ({
|
|
|
23
23
|
const { body } = ctx.request;
|
|
24
24
|
|
|
25
25
|
const currentSettings = await strapi
|
|
26
|
-
.plugin("payone
|
|
26
|
+
.plugin("strapi-plugin-payone")
|
|
27
27
|
.service("payone")
|
|
28
28
|
.getSettings();
|
|
29
29
|
|
|
@@ -32,7 +32,7 @@ module.exports = ({ strapi }) => ({
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const settings = await strapi
|
|
35
|
-
.plugin("payone
|
|
35
|
+
.plugin("strapi-plugin-payone")
|
|
36
36
|
.service("payone")
|
|
37
37
|
.updateSettings(body);
|
|
38
38
|
|
|
@@ -50,7 +50,7 @@ module.exports = ({ strapi }) => ({
|
|
|
50
50
|
try {
|
|
51
51
|
const params = ctx.request.body;
|
|
52
52
|
const result = await strapi
|
|
53
|
-
.plugin("payone
|
|
53
|
+
.plugin("strapi-plugin-payone")
|
|
54
54
|
.service("payone")
|
|
55
55
|
.preauthorization(params);
|
|
56
56
|
|
|
@@ -66,7 +66,7 @@ module.exports = ({ strapi }) => ({
|
|
|
66
66
|
strapi.log.info("Payone authorization controller called with:", params);
|
|
67
67
|
|
|
68
68
|
const result = await strapi
|
|
69
|
-
.plugin("payone
|
|
69
|
+
.plugin("strapi-plugin-payone")
|
|
70
70
|
.service("payone")
|
|
71
71
|
.authorization(params);
|
|
72
72
|
|
|
@@ -81,7 +81,7 @@ module.exports = ({ strapi }) => ({
|
|
|
81
81
|
try {
|
|
82
82
|
const params = ctx.request.body;
|
|
83
83
|
const result = await strapi
|
|
84
|
-
.plugin("payone
|
|
84
|
+
.plugin("strapi-plugin-payone")
|
|
85
85
|
.service("payone")
|
|
86
86
|
.capture(params);
|
|
87
87
|
|
|
@@ -95,7 +95,7 @@ module.exports = ({ strapi }) => ({
|
|
|
95
95
|
try {
|
|
96
96
|
const params = ctx.request.body;
|
|
97
97
|
const result = await strapi
|
|
98
|
-
.plugin("payone
|
|
98
|
+
.plugin("strapi-plugin-payone")
|
|
99
99
|
.service("payone")
|
|
100
100
|
.refund(params);
|
|
101
101
|
|
|
@@ -109,7 +109,7 @@ module.exports = ({ strapi }) => ({
|
|
|
109
109
|
try {
|
|
110
110
|
const filters = ctx.query || {};
|
|
111
111
|
const history = await strapi
|
|
112
|
-
.plugin("payone
|
|
112
|
+
.plugin("strapi-plugin-payone")
|
|
113
113
|
.service("payone")
|
|
114
114
|
.getTransactionHistory(filters);
|
|
115
115
|
|
|
@@ -122,7 +122,7 @@ module.exports = ({ strapi }) => ({
|
|
|
122
122
|
async testConnection(ctx) {
|
|
123
123
|
try {
|
|
124
124
|
const result = await strapi
|
|
125
|
-
.plugin("payone
|
|
125
|
+
.plugin("strapi-plugin-payone")
|
|
126
126
|
.service("payone")
|
|
127
127
|
.testConnection();
|
|
128
128
|
|
package/server/policies/index.js
CHANGED
package/server/routes/index.js
CHANGED
|
@@ -36,7 +36,6 @@ module.exports = {
|
|
|
36
36
|
policies: ["admin::isAuthenticatedAdmin"]
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
|
-
|
|
40
39
|
{
|
|
41
40
|
method: "POST",
|
|
42
41
|
path: "/preauthorization",
|
|
@@ -71,6 +70,7 @@ module.exports = {
|
|
|
71
70
|
}
|
|
72
71
|
]
|
|
73
72
|
},
|
|
73
|
+
|
|
74
74
|
"content-api": {
|
|
75
75
|
type: "content-api",
|
|
76
76
|
routes: [
|
|
@@ -79,7 +79,7 @@ module.exports = {
|
|
|
79
79
|
path: "/preauthorization",
|
|
80
80
|
handler: "payone.preauthorization",
|
|
81
81
|
config: {
|
|
82
|
-
policies: ["plugin::payone-
|
|
82
|
+
policies: ["plugin::strapi-plugin-payone.is-auth"],
|
|
83
83
|
auth: false
|
|
84
84
|
}
|
|
85
85
|
},
|
|
@@ -88,7 +88,7 @@ module.exports = {
|
|
|
88
88
|
path: "/authorization",
|
|
89
89
|
handler: "payone.authorization",
|
|
90
90
|
config: {
|
|
91
|
-
policies: ["plugin::payone-
|
|
91
|
+
policies: ["plugin::strapi-plugin-payone.is-auth"],
|
|
92
92
|
auth: false
|
|
93
93
|
}
|
|
94
94
|
},
|
|
@@ -97,7 +97,7 @@ module.exports = {
|
|
|
97
97
|
path: "/capture",
|
|
98
98
|
handler: "payone.capture",
|
|
99
99
|
config: {
|
|
100
|
-
policies: ["plugin::payone-
|
|
100
|
+
policies: ["plugin::strapi-plugin-payone.is-auth"],
|
|
101
101
|
auth: false
|
|
102
102
|
}
|
|
103
103
|
},
|
|
@@ -106,7 +106,7 @@ module.exports = {
|
|
|
106
106
|
path: "/refund",
|
|
107
107
|
handler: "payone.refund",
|
|
108
108
|
config: {
|
|
109
|
-
policies: ["plugin::payone-
|
|
109
|
+
policies: ["plugin::strapi-plugin-payone.is-auth"],
|
|
110
110
|
auth: false
|
|
111
111
|
}
|
|
112
112
|
},
|
|
@@ -115,7 +115,7 @@ module.exports = {
|
|
|
115
115
|
path: "/test-connection",
|
|
116
116
|
handler: "payone.testConnection",
|
|
117
117
|
config: {
|
|
118
|
-
policies: ["plugin::payone-
|
|
118
|
+
policies: ["plugin::strapi-plugin-payone.is-auth"],
|
|
119
119
|
auth: false
|
|
120
120
|
}
|
|
121
121
|
}
|
|
@@ -66,7 +66,7 @@ module.exports = ({ strapi }) => ({
|
|
|
66
66
|
const pluginStore = strapi.store({
|
|
67
67
|
environment: "",
|
|
68
68
|
type: "plugin",
|
|
69
|
-
name: "payone
|
|
69
|
+
name: "strapi-plugin-payone"
|
|
70
70
|
});
|
|
71
71
|
return await pluginStore.get({ key: "settings" });
|
|
72
72
|
},
|
|
@@ -75,7 +75,7 @@ module.exports = ({ strapi }) => ({
|
|
|
75
75
|
const pluginStore = strapi.store({
|
|
76
76
|
environment: "",
|
|
77
77
|
type: "plugin",
|
|
78
|
-
name: "payone
|
|
78
|
+
name: "strapi-plugin-payone"
|
|
79
79
|
});
|
|
80
80
|
await pluginStore.set({
|
|
81
81
|
key: "settings",
|
|
@@ -350,7 +350,7 @@ module.exports = ({ strapi }) => ({
|
|
|
350
350
|
const pluginStore = strapi.store({
|
|
351
351
|
environment: "",
|
|
352
352
|
type: "plugin",
|
|
353
|
-
name: "payone
|
|
353
|
+
name: "strapi-plugin-payone"
|
|
354
354
|
});
|
|
355
355
|
|
|
356
356
|
let transactionHistory =
|
|
@@ -400,7 +400,7 @@ module.exports = ({ strapi }) => ({
|
|
|
400
400
|
const pluginStore = strapi.store({
|
|
401
401
|
environment: "",
|
|
402
402
|
type: "plugin",
|
|
403
|
-
name: "payone
|
|
403
|
+
name: "strapi-plugin-payone"
|
|
404
404
|
});
|
|
405
405
|
|
|
406
406
|
let transactionHistory =
|