@school24/paymentjs-rn 1.7.0 → 1.9.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.
- package/dist/PaymentJS.js +15 -5
- package/package.json +1 -1
package/dist/PaymentJS.js
CHANGED
|
@@ -52,7 +52,7 @@ function normalizeBase(url) {
|
|
|
52
52
|
}
|
|
53
53
|
function PaymentJS(props) {
|
|
54
54
|
const {
|
|
55
|
-
// These default to internal constants if not provided
|
|
55
|
+
// These default to internal constants if not provided
|
|
56
56
|
pageUrl = DEFAULT_PAGE_URL, lambdaUrl = DEFAULT_LAMBDA_URL, environment = "test",
|
|
57
57
|
// Auto-select store based on environment if store prop is missing
|
|
58
58
|
store = STORE_IDS[environment],
|
|
@@ -111,13 +111,21 @@ function PaymentJS(props) {
|
|
|
111
111
|
onDebug === null || onDebug === void 0 ? void 0 : onDebug(message.payload);
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
|
+
// Check for our custom S24 Internal Error format within the payload
|
|
115
|
+
const isInternalError = message.payload && message.payload.ok === false;
|
|
114
116
|
switch (message.event) {
|
|
115
117
|
case "PAYMENT_SUCCESS":
|
|
116
|
-
|
|
118
|
+
// If the payload itself contains ok: false, treat as failure (S24 Standard)
|
|
119
|
+
if (isInternalError) {
|
|
120
|
+
onPaymentFailure === null || onPaymentFailure === void 0 ? void 0 : onPaymentFailure(message.payload);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess(message.payload);
|
|
124
|
+
}
|
|
117
125
|
break;
|
|
118
126
|
case "PAYMENT_ERROR":
|
|
119
127
|
case "CONFIG_ERROR":
|
|
120
|
-
//
|
|
128
|
+
// Pass the mapped S24 message directly to the failure callback
|
|
121
129
|
onPaymentFailure === null || onPaymentFailure === void 0 ? void 0 : onPaymentFailure(message.payload);
|
|
122
130
|
break;
|
|
123
131
|
case "ENCRYPT_SUCCESS":
|
|
@@ -136,7 +144,9 @@ function PaymentJS(props) {
|
|
|
136
144
|
if (debug)
|
|
137
145
|
console.error("Failed to parse WebView message:", err);
|
|
138
146
|
onPaymentFailure === null || onPaymentFailure === void 0 ? void 0 : onPaymentFailure({
|
|
139
|
-
|
|
147
|
+
ok: false,
|
|
148
|
+
message: "Communication Error",
|
|
149
|
+
internalCode: "S24_PAY_ERR_SYSTEM",
|
|
140
150
|
error: String(err),
|
|
141
151
|
});
|
|
142
152
|
}
|
|
@@ -156,5 +166,5 @@ function PaymentJS(props) {
|
|
|
156
166
|
react_1.default.createElement(react_native_1.Text, { style: { color: "red", textAlign: "center", fontWeight: "600" } }, configError)));
|
|
157
167
|
}
|
|
158
168
|
return (react_1.default.createElement(react_native_1.View, { style: [{ flex: 1, backgroundColor: "#fff" }, style] },
|
|
159
|
-
react_1.default.createElement(react_native_webview_1.WebView, { source: { uri: finalUri }, javaScriptEnabled: true, domStorageEnabled: true, originWhitelist: ["*"], onMessage: handleMessage, allowsBackForwardNavigationGestures: true, setSupportMultipleWindows: false })));
|
|
169
|
+
react_1.default.createElement(react_native_webview_1.WebView, { key: environment, source: { uri: finalUri }, javaScriptEnabled: true, domStorageEnabled: true, originWhitelist: ["*"], onMessage: handleMessage, allowsBackForwardNavigationGestures: true, setSupportMultipleWindows: false })));
|
|
160
170
|
}
|