strapi-plugin-payone-provider 1.5.6 → 1.5.8
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.
|
@@ -781,10 +781,27 @@ const ApplePayButton = ({
|
|
|
781
781
|
|
|
782
782
|
console.log("[Apple Pay] Merchant session received from backend:", {
|
|
783
783
|
hasData: !!merchantSession.data,
|
|
784
|
-
merchantIdentifier: merchantSession.data?.merchantIdentifier
|
|
784
|
+
merchantIdentifier: merchantSession.data?.merchantIdentifier,
|
|
785
|
+
hasError: !!merchantSession.error,
|
|
786
|
+
errorMessage: merchantSession.error?.message,
|
|
787
|
+
fullResponse: merchantSession
|
|
785
788
|
});
|
|
786
789
|
|
|
787
|
-
|
|
790
|
+
// Check if there's an error in the response
|
|
791
|
+
if (merchantSession.error) {
|
|
792
|
+
console.error("[Apple Pay] Backend returned error:", merchantSession.error);
|
|
793
|
+
throw new Error(merchantSession.error.message || "Apple Pay merchant validation failed");
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
// Validate merchant session
|
|
797
|
+
const session = merchantSession.data || merchantSession;
|
|
798
|
+
if (!session || !session.merchantIdentifier) {
|
|
799
|
+
console.error("[Apple Pay] Invalid merchant session - missing merchantIdentifier");
|
|
800
|
+
console.error("[Apple Pay] Session object:", JSON.stringify(session, null, 2));
|
|
801
|
+
throw new Error("Invalid merchant session: missing merchantIdentifier. Please check your Payone Apple Pay configuration in PMI.");
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
return session;
|
|
788
805
|
} catch (error) {
|
|
789
806
|
console.error("[Apple Pay] Merchant validation error:", {
|
|
790
807
|
message: error.message,
|
package/package.json
CHANGED
|
@@ -193,16 +193,37 @@ module.exports = ({ strapi }) => ({
|
|
|
193
193
|
|
|
194
194
|
strapi.log.info("[Apple Pay] Merchant validation result:", {
|
|
195
195
|
hasResult: !!result,
|
|
196
|
-
hasMerchantIdentifier: !!result.merchantIdentifier
|
|
196
|
+
hasMerchantIdentifier: !!result.merchantIdentifier,
|
|
197
|
+
merchantIdentifier: result.merchantIdentifier,
|
|
198
|
+
domainName: result.domainName,
|
|
199
|
+
displayName: result.displayName,
|
|
200
|
+
epochTimestamp: result.epochTimestamp,
|
|
201
|
+
expiresAt: result.expiresAt
|
|
197
202
|
});
|
|
198
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
|
+
|
|
199
210
|
ctx.body = { data: result };
|
|
200
211
|
} catch (error) {
|
|
201
212
|
strapi.log.error("[Apple Pay] Controller error:", {
|
|
202
213
|
message: error.message,
|
|
203
|
-
stack: error.stack
|
|
214
|
+
stack: error.stack,
|
|
215
|
+
name: error.name
|
|
204
216
|
});
|
|
205
|
-
|
|
217
|
+
|
|
218
|
+
// Return error response instead of empty object
|
|
219
|
+
// This will help frontend understand what went wrong
|
|
220
|
+
ctx.status = error.status || 500;
|
|
221
|
+
ctx.body = {
|
|
222
|
+
error: {
|
|
223
|
+
message: error.message || "Apple Pay merchant validation failed",
|
|
224
|
+
details: "Please check your Payone Apple Pay configuration in PMI (CONFIGURATION → PAYMENT PORTALS → [Your Portal] → Apple Pay)"
|
|
225
|
+
}
|
|
226
|
+
};
|
|
206
227
|
}
|
|
207
228
|
}
|
|
208
229
|
});
|
|
@@ -125,7 +125,11 @@ const initializeApplePaySession = async (strapi, params) => {
|
|
|
125
125
|
const responseData = parseResponse(response.data, strapi.log);
|
|
126
126
|
|
|
127
127
|
strapi.log.info("[Apple Pay] Session initialization response:", JSON.stringify(responseData, null, 2));
|
|
128
|
-
strapi.log.info("[Apple Pay] Response status:", responseData.status || responseData.Status);
|
|
128
|
+
strapi.log.info("[Apple Pay] Response status:", responseData.status || responseData.Status || "NOT_SET");
|
|
129
|
+
strapi.log.info("[Apple Pay] Response errorcode:", responseData.errorcode || responseData.ErrorCode || responseData.error_code || "none");
|
|
130
|
+
strapi.log.info("[Apple Pay] Response errormessage:", responseData.errormessage || responseData.ErrorMessage || responseData.errortxt || responseData.ErrorTxt || responseData.error_message || "none");
|
|
131
|
+
strapi.log.info("[Apple Pay] All response keys:", Object.keys(responseData));
|
|
132
|
+
strapi.log.info("[Apple Pay] Full response for debugging:", JSON.stringify(responseData));
|
|
129
133
|
|
|
130
134
|
if (responseData.errorcode || responseData.ErrorCode) {
|
|
131
135
|
strapi.log.warn("[Apple Pay] Response contains error:", {
|
|
@@ -205,10 +209,12 @@ const validateApplePayMerchant = async (strapi, params) => {
|
|
|
205
209
|
strapi.log.error("[Apple Pay] Failed to initialize session with Payone:", {
|
|
206
210
|
message: error.message,
|
|
207
211
|
status: error.response?.status,
|
|
208
|
-
data: error.response?.data
|
|
212
|
+
data: error.response?.data,
|
|
213
|
+
stack: error.stack
|
|
209
214
|
});
|
|
210
|
-
//
|
|
211
|
-
|
|
215
|
+
// DO NOT return empty object - throw error instead
|
|
216
|
+
// Empty object causes Apple Pay to close dialog without proper error message
|
|
217
|
+
throw new Error(`Failed to initialize Apple Pay session with Payone: ${error.message}. Please check your Payone configuration and ensure Apple Pay is properly set up in PMI.`);
|
|
212
218
|
}
|
|
213
219
|
|
|
214
220
|
strapi.log.info("[Apple Pay] Session initialization result:", {
|
|
@@ -395,9 +401,28 @@ const validateApplePayMerchant = async (strapi, params) => {
|
|
|
395
401
|
// If initialization failed, we cannot proceed
|
|
396
402
|
// Payment Request API requires a valid merchant session
|
|
397
403
|
strapi.log.error("[Apple Pay] Session initialization failed - status:", responseStatus);
|
|
404
|
+
strapi.log.error("[Apple Pay] Full Payone response:", JSON.stringify(sessionResponse, null, 2));
|
|
398
405
|
strapi.log.error("[Apple Pay] This means merchant validation will fail.");
|
|
399
|
-
strapi.log.error("[Apple Pay]
|
|
400
|
-
|
|
406
|
+
strapi.log.error("[Apple Pay] Possible causes:");
|
|
407
|
+
strapi.log.error("[Apple Pay] 1. Payone returned ERROR status - check errorcode and errormessage in response");
|
|
408
|
+
strapi.log.error("[Apple Pay] 2. Apple Pay not configured in Payone PMI");
|
|
409
|
+
strapi.log.error("[Apple Pay] 3. Domain not verified in Payone PMI");
|
|
410
|
+
strapi.log.error("[Apple Pay] 4. Merchant identifier not configured correctly");
|
|
411
|
+
strapi.log.error("[Apple Pay] 5. Apple Pay onboarding not completed");
|
|
412
|
+
|
|
413
|
+
// Extract error details from Payone response
|
|
414
|
+
const errorCode = sessionResponse.errorcode || sessionResponse.ErrorCode;
|
|
415
|
+
const errorMessage = sessionResponse.errormessage || sessionResponse.ErrorMessage || sessionResponse.errortxt || sessionResponse.ErrorTxt;
|
|
416
|
+
|
|
417
|
+
if (errorCode || errorMessage) {
|
|
418
|
+
strapi.log.error("[Apple Pay] Payone error details:", {
|
|
419
|
+
errorCode: errorCode,
|
|
420
|
+
errorMessage: errorMessage
|
|
421
|
+
});
|
|
422
|
+
throw new Error(`Payone Apple Pay initialization failed: ${errorCode ? `Error ${errorCode}` : ''} ${errorMessage || 'Unknown error'}. Please check your Payone Apple Pay configuration in PMI (CONFIGURATION → PAYMENT PORTALS → [Your Portal] → Apple Pay).`);
|
|
423
|
+
} else {
|
|
424
|
+
throw new Error(`Apple Pay session initialization failed with status: ${responseStatus || 'UNKNOWN'}. Please check your Payone Apple Pay configuration in PMI (CONFIGURATION → PAYMENT PORTALS → [Your Portal] → Apple Pay).`);
|
|
425
|
+
}
|
|
401
426
|
} catch (error) {
|
|
402
427
|
strapi.log.error("[Apple Pay] Merchant validation error:", {
|
|
403
428
|
message: error.message,
|