strapi-plugin-payone-provider 1.5.7 → 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
- return merchantSession.data || merchantSession;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-payone-provider",
3
- "version": "1.5.7",
3
+ "version": "1.5.8",
4
4
  "description": "Strapi plugin for Payone payment gateway integration",
5
5
  "license": "MIT",
6
6
  "maintainers": [
@@ -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
- handleError(ctx, error);
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,10 +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);
129
- strapi.log.info("[Apple Pay] Response errorcode:", responseData.errorcode || responseData.ErrorCode || "none");
130
- strapi.log.info("[Apple Pay] Response errormessage:", responseData.errormessage || responseData.ErrorMessage || responseData.errortxt || responseData.ErrorTxt || "none");
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
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));
132
133
 
133
134
  if (responseData.errorcode || responseData.ErrorCode) {
134
135
  strapi.log.warn("[Apple Pay] Response contains error:", {
@@ -408,11 +409,11 @@ const validateApplePayMerchant = async (strapi, params) => {
408
409
  strapi.log.error("[Apple Pay] 3. Domain not verified in Payone PMI");
409
410
  strapi.log.error("[Apple Pay] 4. Merchant identifier not configured correctly");
410
411
  strapi.log.error("[Apple Pay] 5. Apple Pay onboarding not completed");
411
-
412
+
412
413
  // Extract error details from Payone response
413
414
  const errorCode = sessionResponse.errorcode || sessionResponse.ErrorCode;
414
415
  const errorMessage = sessionResponse.errormessage || sessionResponse.ErrorMessage || sessionResponse.errortxt || sessionResponse.ErrorTxt;
415
-
416
+
416
417
  if (errorCode || errorMessage) {
417
418
  strapi.log.error("[Apple Pay] Payone error details:", {
418
419
  errorCode: errorCode,