IO-3099 check for intellipay initialization before calling. rename files to remove erroneous period.
This commit is contained in:
@@ -133,15 +133,19 @@ const CardPaymentModalComponent = ({
|
|||||||
if (window.intellipay) {
|
if (window.intellipay) {
|
||||||
// eslint-disable-next-line no-eval
|
// eslint-disable-next-line no-eval
|
||||||
eval(response.data);
|
eval(response.data);
|
||||||
SetIntellipayCallbackFunctions();
|
pollForIntelliPay(() => {
|
||||||
window.intellipay.autoOpen();
|
SetIntellipayCallbackFunctions();
|
||||||
|
window.intellipay.autoOpen();
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
const rg = document.createRange();
|
const rg = document.createRange();
|
||||||
const node = rg.createContextualFragment(response.data);
|
const node = rg.createContextualFragment(response.data);
|
||||||
document.documentElement.appendChild(node);
|
document.documentElement.appendChild(node);
|
||||||
SetIntellipayCallbackFunctions();
|
pollForIntelliPay(() => {
|
||||||
window.intellipay.isAutoOpen = true;
|
SetIntellipayCallbackFunctions();
|
||||||
window.intellipay.initialize();
|
window.intellipay.isAutoOpen = true;
|
||||||
|
window.intellipay.initialize();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notification.open({
|
notification.open({
|
||||||
@@ -345,3 +349,27 @@ const CardPaymentModalComponent = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(CardPaymentModalComponent);
|
export default connect(mapStateToProps, mapDispatchToProps)(CardPaymentModalComponent);
|
||||||
|
|
||||||
|
//Poll for window.IntelliPay.fixAmount for 5 seconds. If it doesn't come up, just try anyways to force the possible error.
|
||||||
|
function pollForIntelliPay(callbackFunction) {
|
||||||
|
const timeout = 5000;
|
||||||
|
const interval = 150; // Poll every 100 milliseconds
|
||||||
|
const startTime = Date.now();
|
||||||
|
|
||||||
|
function checkFixAmount() {
|
||||||
|
if (window.intellipay && window.intellipay.fixAmount !== undefined) {
|
||||||
|
callbackFunction();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Date.now() - startTime >= timeout) {
|
||||||
|
console.log("Stopped polling IntelliPay after 10 seconds. Attemping to set functions anyways.");
|
||||||
|
callbackFunction();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(checkFixAmount, interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkFixAmount();
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ import { createStructuredSelector } from "reselect";
|
|||||||
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
||||||
import { selectCardPayment } from "../../redux/modals/modals.selectors";
|
import { selectCardPayment } from "../../redux/modals/modals.selectors";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import CardPaymentModalComponent from "./card-payment-modal.component.";
|
import CardPaymentModalComponent from "./card-payment-modal.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
cardPaymentModal: selectCardPayment,
|
cardPaymentModal: selectCardPayment,
|
||||||
@@ -31,7 +31,7 @@ import { addAlerts } from "../../redux/application/application.actions.js";
|
|||||||
const JobsPage = lazy(() => import("../jobs/jobs.page"));
|
const JobsPage = lazy(() => import("../jobs/jobs.page"));
|
||||||
|
|
||||||
const CardPaymentModalContainer = lazy(
|
const CardPaymentModalContainer = lazy(
|
||||||
() => import("../../components/card-payment-modal/card-payment-modal.container.")
|
() => import("../../components/card-payment-modal/card-payment-modal.container.jsx")
|
||||||
);
|
);
|
||||||
|
|
||||||
const JobsDetailPage = lazy(() => import("../jobs-detail/jobs-detail.page.container"));
|
const JobsDetailPage = lazy(() => import("../jobs-detail/jobs-detail.page.container"));
|
||||||
|
|||||||
Reference in New Issue
Block a user