strapi-plugin-payone-provider 1.6.6 → 1.6.7
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/.well-known/.gitkeep +3 -0
- package/.well-known/apple-developer-merchant-id-domain-association.txt +1 -0
- package/admin/src/pages/App/components/AppTabs.jsx +31 -16
- package/admin/src/pages/App/components/ApplePayBtn.jsx +63 -28
- package/admin/src/pages/App/components/ConfigurationPanel.jsx +163 -10
- package/admin/src/pages/App/components/DocsPanel.jsx +864 -194
- package/admin/src/pages/App/components/HistoryPanel.jsx +39 -34
- package/admin/src/pages/App/components/PaymentActionsPanel.jsx +8 -1
- package/admin/src/pages/App/components/paymentActions/ApplePayPanel.jsx +45 -1
- package/admin/src/pages/App/index.jsx +1 -0
- package/admin/src/pages/hooks/useSettings.js +26 -0
- package/admin/src/pages/hooks/useTransactionHistory.js +2 -3
- package/package.json +1 -1
- package/server/bootstrap.js +9 -3
- package/server/controllers/payone.js +8 -0
- package/server/services/applePayService.js +103 -93
- package/server/services/transactionService.js +35 -14
- package/server/utils/paymentMethodParams.js +67 -18
|
@@ -145,15 +145,25 @@ const addPaymentMethodParams = (params, logger) => {
|
|
|
145
145
|
try {
|
|
146
146
|
const tokenString = Buffer.from(updated.applePayToken, 'base64').toString('utf-8');
|
|
147
147
|
tokenData = JSON.parse(tokenString);
|
|
148
|
+
|
|
149
|
+
if (logger) {
|
|
150
|
+
logger.info("[Apple Pay] Token decoded from Base64 successfully");
|
|
151
|
+
}
|
|
148
152
|
} catch (e) {
|
|
149
153
|
try {
|
|
150
|
-
// Try parsing as JSON string directly
|
|
151
154
|
tokenData = typeof updated.applePayToken === 'string'
|
|
152
155
|
? JSON.parse(updated.applePayToken)
|
|
153
156
|
: updated.applePayToken;
|
|
157
|
+
|
|
158
|
+
if (logger) {
|
|
159
|
+
logger.info("[Apple Pay] Token parsed as JSON string directly");
|
|
160
|
+
}
|
|
154
161
|
} catch (e2) {
|
|
155
|
-
// If already an object, use as-is
|
|
156
162
|
tokenData = updated.applePayToken;
|
|
163
|
+
|
|
164
|
+
if (logger) {
|
|
165
|
+
logger.info("[Apple Pay] Token used as-is (already an object)");
|
|
166
|
+
}
|
|
157
167
|
}
|
|
158
168
|
}
|
|
159
169
|
|
|
@@ -162,7 +172,10 @@ const addPaymentMethodParams = (params, logger) => {
|
|
|
162
172
|
|
|
163
173
|
if (!paymentData) {
|
|
164
174
|
if (logger) {
|
|
165
|
-
logger.error("[Apple Pay] Invalid token structure: missing paymentData field"
|
|
175
|
+
logger.error("[Apple Pay] Invalid token structure: missing paymentData field", {
|
|
176
|
+
tokenKeys: Object.keys(tokenData),
|
|
177
|
+
tokenStructure: JSON.stringify(tokenData).substring(0, 500)
|
|
178
|
+
});
|
|
166
179
|
}
|
|
167
180
|
delete updated.applePayToken;
|
|
168
181
|
return updated;
|
|
@@ -171,30 +184,66 @@ const addPaymentMethodParams = (params, logger) => {
|
|
|
171
184
|
const header = paymentData.header || {};
|
|
172
185
|
|
|
173
186
|
// Payone required fields according to docs
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
187
|
+
// Extract version, data, signature from paymentData
|
|
188
|
+
const tokenVersion = paymentData.version || "EC_v1";
|
|
189
|
+
const tokenDataValue = paymentData.data || "";
|
|
190
|
+
const tokenSignature = paymentData.signature || "";
|
|
191
|
+
|
|
192
|
+
// Extract from header
|
|
193
|
+
const ephemeralPublicKey = header.ephemeralPublicKey || "";
|
|
194
|
+
const publicKeyHash = header.publicKeyHash || "";
|
|
195
|
+
const transactionId = paymentData.transactionId || header.transactionId || "";
|
|
196
|
+
|
|
197
|
+
// Set Payone required fields
|
|
198
|
+
updated["add_paydata[paymentdata_token_version]"] = tokenVersion;
|
|
199
|
+
updated["add_paydata[paymentdata_token_data]"] = tokenDataValue;
|
|
200
|
+
updated["add_paydata[paymentdata_token_signature]"] = tokenSignature;
|
|
201
|
+
updated["add_paydata[paymentdata_token_ephemeral_publickey]"] = ephemeralPublicKey;
|
|
202
|
+
updated["add_paydata[paymentdata_token_publickey_hash]"] = publicKeyHash;
|
|
179
203
|
|
|
180
204
|
// Transaction ID is optional according to Payone docs
|
|
181
|
-
if (
|
|
182
|
-
updated["add_paydata[paymentdata_token_transaction_id]"] =
|
|
205
|
+
if (transactionId) {
|
|
206
|
+
updated["add_paydata[paymentdata_token_transaction_id]"] = transactionId;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (logger) {
|
|
210
|
+
logger.info("[Apple Pay] Token extracted successfully:", {
|
|
211
|
+
hasVersion: !!tokenVersion,
|
|
212
|
+
hasData: !!tokenDataValue,
|
|
213
|
+
hasSignature: !!tokenSignature,
|
|
214
|
+
hasEphemeralPublicKey: !!ephemeralPublicKey,
|
|
215
|
+
hasPublicKeyHash: !!publicKeyHash,
|
|
216
|
+
hasTransactionId: !!transactionId,
|
|
217
|
+
dataLength: tokenDataValue.length,
|
|
218
|
+
signatureLength: tokenSignature.length,
|
|
219
|
+
ephemeralPublicKeyLength: ephemeralPublicKey.length,
|
|
220
|
+
publicKeyHashLength: publicKeyHash.length
|
|
221
|
+
});
|
|
183
222
|
}
|
|
184
223
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
!
|
|
188
|
-
!
|
|
224
|
+
// Validate required fields
|
|
225
|
+
if (!tokenDataValue ||
|
|
226
|
+
!tokenSignature ||
|
|
227
|
+
!ephemeralPublicKey ||
|
|
228
|
+
!publicKeyHash) {
|
|
189
229
|
if (logger) {
|
|
190
230
|
logger.error("[Apple Pay] Missing required token fields:", {
|
|
191
|
-
hasData: !!
|
|
192
|
-
hasSignature: !!
|
|
193
|
-
hasEphemeralPublicKey: !!
|
|
194
|
-
hasPublicKeyHash: !!
|
|
231
|
+
hasData: !!tokenDataValue,
|
|
232
|
+
hasSignature: !!tokenSignature,
|
|
233
|
+
hasEphemeralPublicKey: !!ephemeralPublicKey,
|
|
234
|
+
hasPublicKeyHash: !!publicKeyHash,
|
|
235
|
+
paymentDataKeys: Object.keys(paymentData),
|
|
236
|
+
headerKeys: Object.keys(header)
|
|
195
237
|
});
|
|
196
238
|
}
|
|
197
239
|
}
|
|
240
|
+
} else {
|
|
241
|
+
if (logger) {
|
|
242
|
+
logger.error("[Apple Pay] Token is not a valid object:", {
|
|
243
|
+
tokenType: typeof tokenData,
|
|
244
|
+
tokenValue: typeof tokenData === 'string' ? tokenData.substring(0, 200) : String(tokenData).substring(0, 200)
|
|
245
|
+
});
|
|
246
|
+
}
|
|
198
247
|
}
|
|
199
248
|
|
|
200
249
|
delete updated.applePayToken;
|