strapi-plugin-payone-provider 1.5.8 → 1.6.0

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.
Files changed (53) hide show
  1. package/admin/src/index.js +3 -3
  2. package/admin/src/pages/App/components/ApplePayBtn.jsx +304 -0
  3. package/admin/src/pages/App/components/{ApplePayButton.js → ApplePayButton.jsx} +141 -137
  4. package/admin/src/pages/App/components/{ApplePayConfig.js → ApplePayConfig.jsx} +64 -130
  5. package/admin/src/pages/App/components/{PaymentActionsPanel.js → PaymentActionsPanel.jsx} +62 -14
  6. package/admin/src/pages/App/components/icons/index.jsx +11 -0
  7. package/admin/src/pages/App/components/paymentActions/{AuthorizationForm.js → AuthorizationForm.jsx} +45 -35
  8. package/admin/src/pages/App/components/paymentActions/{PaymentMethodSelector.js → PaymentMethodSelector.jsx} +111 -31
  9. package/admin/src/pages/App/components/paymentActions/{PreauthorizationForm.js → PreauthorizationForm.jsx} +3 -70
  10. package/admin/src/pages/constants/paymentConstants.js +1 -2
  11. package/admin/src/pages/hooks/usePaymentActions.js +1 -76
  12. package/package.json +49 -49
  13. package/server/bootstrap.js +59 -1
  14. package/server/controllers/payone.js +6 -48
  15. package/server/routes/index.js +1 -1
  16. package/server/services/applePayService.js +51 -407
  17. package/server/services/paymentService.js +0 -68
  18. package/server/services/payone.js +0 -3
  19. package/server/services/settingsService.js +0 -21
  20. package/server/services/testConnectionService.js +0 -14
  21. package/server/services/transactionService.js +2 -16
  22. package/server/utils/paymentMethodParams.js +60 -21
  23. package/server/utils/requestBuilder.js +0 -22
  24. package/admin/src/pages/App/components/icons/index.js +0 -11
  25. /package/admin/src/components/Initializer/{index.js → index.jsx} +0 -0
  26. /package/admin/src/components/PluginIcon/{index.js → index.jsx} +0 -0
  27. /package/admin/src/pages/App/components/{AppHeader.js → AppHeader.jsx} +0 -0
  28. /package/admin/src/pages/App/components/{AppTabs.js → AppTabs.jsx} +0 -0
  29. /package/admin/src/pages/App/components/{ApplePayConfigPanel.js → ApplePayConfigPanel.jsx} +0 -0
  30. /package/admin/src/pages/App/components/{ConfigurationPanel.js → ConfigurationPanel.jsx} +0 -0
  31. /package/admin/src/pages/App/components/{DocsPanel.js → DocsPanel.jsx} +0 -0
  32. /package/admin/src/pages/App/components/{GooglePayConfig.js → GooglePayConfig.jsx} +0 -0
  33. /package/admin/src/pages/App/components/{GooglePayConfigPanel.js → GooglePayConfigPanel.jsx} +0 -0
  34. /package/admin/src/pages/App/components/{GooglePaybutton.js → GooglePaybutton.jsx} +0 -0
  35. /package/admin/src/pages/App/components/{HistoryPanel.js → HistoryPanel.jsx} +0 -0
  36. /package/admin/src/pages/App/components/{StatusBadge.js → StatusBadge.jsx} +0 -0
  37. /package/admin/src/pages/App/components/{TransactionHistoryItem.js → TransactionHistoryItem.jsx} +0 -0
  38. /package/admin/src/pages/App/components/icons/{BankIcon.js → BankIcon.jsx} +0 -0
  39. /package/admin/src/pages/App/components/icons/{ChevronDownIcon.js → ChevronDownIcon.jsx} +0 -0
  40. /package/admin/src/pages/App/components/icons/{ChevronUpIcon.js → ChevronUpIcon.jsx} +0 -0
  41. /package/admin/src/pages/App/components/icons/{CreditCardIcon.js → CreditCardIcon.jsx} +0 -0
  42. /package/admin/src/pages/App/components/icons/{ErrorIcon.js → ErrorIcon.jsx} +0 -0
  43. /package/admin/src/pages/App/components/icons/{InfoIcon.js → InfoIcon.jsx} +0 -0
  44. /package/admin/src/pages/App/components/icons/{PaymentIcon.js → PaymentIcon.jsx} +0 -0
  45. /package/admin/src/pages/App/components/icons/{PendingIcon.js → PendingIcon.jsx} +0 -0
  46. /package/admin/src/pages/App/components/icons/{PersonIcon.js → PersonIcon.jsx} +0 -0
  47. /package/admin/src/pages/App/components/icons/{SuccessIcon.js → SuccessIcon.jsx} +0 -0
  48. /package/admin/src/pages/App/components/icons/{WalletIcon.js → WalletIcon.jsx} +0 -0
  49. /package/admin/src/pages/App/components/paymentActions/{CaptureForm.js → CaptureForm.jsx} +0 -0
  50. /package/admin/src/pages/App/components/paymentActions/{CardDetailsInput.js → CardDetailsInput.jsx} +0 -0
  51. /package/admin/src/pages/App/components/paymentActions/{PaymentResult.js → PaymentResult.jsx} +0 -0
  52. /package/admin/src/pages/App/components/paymentActions/{RefundForm.js → RefundForm.jsx} +0 -0
  53. /package/admin/src/pages/App/{index.js → index.jsx} +0 -0
package/package.json CHANGED
@@ -1,49 +1,49 @@
1
- {
2
- "name": "strapi-plugin-payone-provider",
3
- "version": "1.5.8",
4
- "description": "Strapi plugin for Payone payment gateway integration",
5
- "license": "MIT",
6
- "maintainers": [
7
- {
8
- "name": "NewProWeb Community",
9
- "email": "abror.abdullaev@newproweb.com"
10
- }
11
- ],
12
- "dependencies": {
13
- "axios": "^1.6.2",
14
- "prop-types": "^15.7.2"
15
- },
16
- "devDependencies": {
17
- "react": "^18.2.0",
18
- "react-dom": "^18.2.0",
19
- "react-router-dom": "^5.3.4",
20
- "styled-components": "^5.3.6"
21
- },
22
- "peerDependencies": {
23
- "@strapi/strapi": "^4.0",
24
- "react": "^17.0.0 || ^18.0.0",
25
- "react-dom": "^17.0.0 || ^18.0.0",
26
- "react-router-dom": "^5.2.0",
27
- "styled-components": "^5.2.1"
28
- },
29
- "engines": {
30
- "node": ">=18.0.0",
31
- "npm": ">=6.0.0"
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
- ],
43
- "strapi": {
44
- "name": "strapi-plugin-payone-provider",
45
- "description": "Integrates Strapi Payone payment gateway with Strapi",
46
- "kind": "plugin",
47
- "displayName": "Strapi Payone Provider"
48
- }
49
- }
1
+ {
2
+ "name": "strapi-plugin-payone-provider",
3
+ "version": "1.6.0",
4
+ "description": "Strapi plugin for Payone payment gateway integration",
5
+ "license": "MIT",
6
+ "maintainers": [
7
+ {
8
+ "name": "NewProWeb Community",
9
+ "email": "abror.abdullaev@newproweb.com"
10
+ }
11
+ ],
12
+ "dependencies": {
13
+ "axios": "^1.6.3",
14
+ "prop-types": "^15.7.2"
15
+ },
16
+ "devDependencies": {
17
+ "react": "^18.2.0",
18
+ "react-dom": "^18.2.0",
19
+ "react-router-dom": "^5.3.4",
20
+ "styled-components": "^5.3.6"
21
+ },
22
+ "peerDependencies": {
23
+ "@strapi/strapi": "^4.0",
24
+ "react": "^17.0.0 || ^18.0.0",
25
+ "react-dom": "^17.0.0 || ^18.0.0",
26
+ "react-router-dom": "^5.2.0",
27
+ "styled-components": "^5.2.1"
28
+ },
29
+ "engines": {
30
+ "node": ">=18.0.0",
31
+ "npm": ">=6.0.0"
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
+ ],
43
+ "strapi": {
44
+ "name": "strapi-plugin-payone-provider",
45
+ "description": "Integrates Strapi Payone payment gateway with Strapi",
46
+ "kind": "plugin",
47
+ "displayName": "Strapi Payone Provider"
48
+ }
49
+ }
@@ -53,6 +53,8 @@ module.exports = async ({ strapi }) => {
53
53
  try {
54
54
  const Router = require('@koa/router');
55
55
  const router = new Router();
56
+ const fs = require('fs');
57
+ const path = require('path');
56
58
 
57
59
  routes.forEach(route => {
58
60
  router.get(route, async (ctx) => {
@@ -61,7 +63,63 @@ module.exports = async ({ strapi }) => {
61
63
  });
62
64
  });
63
65
 
64
- // Add router to the server app
66
+ // Register route for Apple Pay .well-known file
67
+ router.get('/.well-known/apple-developer-merchantid-domain-association', async (ctx) => {
68
+ try {
69
+ const publicPath = path.join(process.cwd(), 'public');
70
+ const wellKnownPath = path.join(publicPath, '.well-known');
71
+ const filePath = path.join(wellKnownPath, 'apple-developer-merchantid-domain-association');
72
+ const filePathTxt = path.join(wellKnownPath, 'apple-developer-merchant-id-domain-association.txt');
73
+
74
+ let fileContent = null;
75
+ let filePathFound = null;
76
+
77
+ // Try main file first
78
+ if (fs.existsSync(filePath)) {
79
+ filePathFound = filePath;
80
+ fileContent = fs.readFileSync(filePath, 'utf8');
81
+ }
82
+ // Try alternative file name
83
+ else if (fs.existsSync(filePathTxt)) {
84
+ filePathFound = filePathTxt;
85
+ fileContent = fs.readFileSync(filePathTxt, 'utf8');
86
+ }
87
+
88
+ if (fileContent) {
89
+ ctx.type = 'text/plain';
90
+ ctx.body = fileContent;
91
+ strapi.log.info(`[Apple Pay] Served well-known file from: ${filePathFound}`);
92
+ } else {
93
+ strapi.log.warn(`[Apple Pay] Well-known file not found. Tried: ${filePath} and ${filePathTxt}`);
94
+ ctx.status = 404;
95
+ ctx.body = {
96
+ error: {
97
+ status: 404,
98
+ name: "NotFoundError",
99
+ message: "Apple Pay domain verification file not found",
100
+ details: {
101
+ expectedPaths: [
102
+ filePath,
103
+ filePathTxt
104
+ ]
105
+ }
106
+ }
107
+ };
108
+ }
109
+ } catch (error) {
110
+ strapi.log.error("[Apple Pay] Serve well-known file error:", error);
111
+ ctx.status = 500;
112
+ ctx.body = {
113
+ error: {
114
+ status: 500,
115
+ name: "InternalServerError",
116
+ message: error.message || "Failed to serve well-known file",
117
+ details: error.stack
118
+ }
119
+ };
120
+ }
121
+ });
122
+
65
123
  if (strapi.server.app && typeof strapi.server.app.use === 'function') {
66
124
  strapi.server.app.use(router.routes());
67
125
  strapi.server.app.use(router.allowedMethods());
@@ -2,30 +2,17 @@
2
2
 
3
3
  const PLUGIN_NAME = "strapi-plugin-payone-provider";
4
4
 
5
- /**
6
- * Get Payone service
7
- * @param {Object} strapi - Strapi instance
8
- * @returns {Object} Payone service
9
- */
10
5
  const getPayoneService = (strapi) => {
11
6
  return strapi.plugin(PLUGIN_NAME).service("payone");
12
7
  };
13
8
 
14
- /**
15
- * Handle error response
16
- * @param {Object} ctx - Koa context
17
- * @param {Error} error - Error object
18
- */
9
+
19
10
  const handleError = (ctx, error) => {
20
11
  ctx.strapi.log.error("Payone controller error:", error);
21
12
  ctx.throw(500, error);
22
13
  };
23
14
 
24
- /**
25
- * Hide sensitive key in settings
26
- * @param {Object} settings - Settings object
27
- * @returns {Object} Settings with hidden key
28
- */
15
+
29
16
  const hideKey = (settings) => {
30
17
  if (settings && settings.key) {
31
18
  settings.key = "***HIDDEN***";
@@ -134,11 +121,6 @@ module.exports = ({ strapi }) => ({
134
121
  }
135
122
  },
136
123
 
137
- /**
138
- * Handle 3D Secure callback from Payone
139
- * This endpoint receives the callback after customer completes 3DS authentication
140
- * Works with both /admin/ and /content-ui/ paths
141
- */
142
124
  async handle3DSCallback(ctx) {
143
125
  try {
144
126
  const isGetRequest = ctx.request.method === "GET";
@@ -180,33 +162,11 @@ module.exports = ({ strapi }) => ({
180
162
 
181
163
  async validateApplePayMerchant(ctx) {
182
164
  try {
183
- strapi.log.info("[Apple Pay] Merchant validation request received");
184
165
  strapi.log.info("[Apple Pay] Request body:", JSON.stringify(ctx.request.body, null, 2));
185
- strapi.log.info("[Apple Pay] User:", ctx.state.user ? {
186
- id: ctx.state.user.id,
187
- email: ctx.state.user.email,
188
- roles: ctx.state.user.roles?.map(r => r.code)
189
- } : "No user");
190
166
 
191
167
  const params = ctx.request.body;
192
- const result = await getPayoneService(strapi).validateApplePayMerchant(params);
193
-
194
- strapi.log.info("[Apple Pay] Merchant validation result:", {
195
- hasResult: !!result,
196
- hasMerchantIdentifier: !!result.merchantIdentifier,
197
- merchantIdentifier: result.merchantIdentifier,
198
- domainName: result.domainName,
199
- displayName: result.displayName,
200
- epochTimestamp: result.epochTimestamp,
201
- expiresAt: result.expiresAt
202
- });
203
-
204
- // Validate result before sending
205
- if (!result || !result.merchantIdentifier) {
206
- strapi.log.error("[Apple Pay] Invalid merchant session returned - missing merchantIdentifier");
207
- ctx.throw(500, "Apple Pay merchant validation failed: Invalid merchant session. Please check your Payone Apple Pay configuration in PMI.");
208
- }
209
-
168
+ let result = await getPayoneService(strapi).validateApplePayMerchant(params);
169
+ strapi.log.info("[Apple Pay] Merchant validation result:", JSON.stringify(result, null, 2));
210
170
  ctx.body = { data: result };
211
171
  } catch (error) {
212
172
  strapi.log.error("[Apple Pay] Controller error:", {
@@ -214,11 +174,9 @@ module.exports = ({ strapi }) => ({
214
174
  stack: error.stack,
215
175
  name: error.name
216
176
  });
217
-
218
- // Return error response instead of empty object
219
- // This will help frontend understand what went wrong
177
+
220
178
  ctx.status = error.status || 500;
221
- ctx.body = {
179
+ ctx.body = {
222
180
  error: {
223
181
  message: error.message || "Apple Pay merchant validation failed",
224
182
  details: "Please check your Payone Apple Pay configuration in PMI (CONFIGURATION → PAYMENT PORTALS → [Your Portal] → Apple Pay)"
@@ -161,7 +161,7 @@ module.exports = {
161
161
  policies: ["plugin::strapi-plugin-payone-provider.is-auth"],
162
162
  auth: false
163
163
  }
164
- }
164
+ },
165
165
  ]
166
166
  }
167
167
  };