diff --git a/client/src/components/_test/card-payment-modal.component..jsx b/client/src/components/_test/card-payment-modal.component..jsx deleted file mode 100644 index 5f0d9617b..000000000 --- a/client/src/components/_test/card-payment-modal.component..jsx +++ /dev/null @@ -1,43 +0,0 @@ -import { Modal } from "antd"; -import React from "react"; -import { connect } from "react-redux"; -import { createStructuredSelector } from "reselect"; -import { toggleModalVisible } from "../../redux/modals/modals.actions"; -import { selectCardPayment } from "../../redux/modals/modals.selectors"; -import { selectBodyshop } from "../../redux/user/user.selectors"; -import IntellipayTestPage from "./intellipay-test"; - -const mapStateToProps = createStructuredSelector({ - cardPaymentModal: selectCardPayment, - bodyshop: selectBodyshop, -}); - -const mapDispatchToProps = (dispatch) => ({ - toggleModalVisible: () => dispatch(toggleModalVisible("cardPayment")), -}); - -function CardPaymentModalComponent({ - cardPaymentModal, - toggleModalVisible, - bodyshop, -}) { - const { context, visible } = cardPaymentModal; - - return ( - toggleModalVisible()} - onCancel={() => toggleModalVisible()} - cancelButtonProps={{ style: { display: "none" } }} - width="90%" - destroyOnClose - > - - - ); -} - -export default connect( - mapStateToProps, - mapDispatchToProps -)(CardPaymentModalComponent); diff --git a/client/src/components/_test/test.page.jsx b/client/src/components/_test/test.page.jsx index b750e3873..524a41a45 100644 --- a/client/src/components/_test/test.page.jsx +++ b/client/src/components/_test/test.page.jsx @@ -3,7 +3,7 @@ import React from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { setModalContext } from "../../redux/modals/modals.actions"; -import CardPaymentModalComponent from "./card-payment-modal.component."; +import CardPaymentModalContainer from "../card-payment-modal/card-payment-modal.container."; const mapStateToProps = createStructuredSelector({}); @@ -15,13 +15,11 @@ const mapDispatchToProps = (dispatch) => ({ function Test({ setCardPaymentContext }) { return (
- + - - + + + + {context.balance.toFormat()} + + + ); }; -export default IntellpayTestPage; +export default CardPaymentModalComponent; diff --git a/client/src/components/card-payment-modal/card-payment-modal.container..jsx b/client/src/components/card-payment-modal/card-payment-modal.container..jsx new file mode 100644 index 000000000..83142431d --- /dev/null +++ b/client/src/components/card-payment-modal/card-payment-modal.container..jsx @@ -0,0 +1,62 @@ +import { Button, Modal } from "antd"; +import React from "react"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { toggleModalVisible } from "../../redux/modals/modals.actions"; +import { selectCardPayment } from "../../redux/modals/modals.selectors"; +import { selectBodyshop } from "../../redux/user/user.selectors"; +import CardPaymentModalComponent from "./card-payment-modal.component."; + +const mapStateToProps = createStructuredSelector({ + cardPaymentModal: selectCardPayment, + bodyshop: selectBodyshop, +}); + +const mapDispatchToProps = (dispatch) => ({ + toggleModalVisible: () => dispatch(toggleModalVisible("cardPayment")), +}); + +function CardPaymentModalContainer({ + cardPaymentModal, + toggleModalVisible, + bodyshop, +}) { + const { context, visible, actions } = cardPaymentModal; + + const handleCancel = () => { + toggleModalVisible(); + actions.refetch(); + }; + + const handleOK = () => { + toggleModalVisible(); + actions.refetch(); + }; + + const handleNewPayment = () => {}; + + return ( + + Go Back + , + , + ]} + width="50%" + destroyOnClose + > + + + ); +} + +export default connect( + mapStateToProps, + mapDispatchToProps +)(CardPaymentModalContainer); diff --git a/client/src/components/job-payments/job-payments.component.jsx b/client/src/components/job-payments/job-payments.component.jsx index a67ed047b..f12b81bee 100644 --- a/client/src/components/job-payments/job-payments.component.jsx +++ b/client/src/components/job-payments/job-payments.component.jsx @@ -23,6 +23,8 @@ const mapStateToProps = createStructuredSelector({ const mapDispatchToProps = (dispatch) => ({ setPaymentContext: (context) => dispatch(setModalContext({ context: context, modal: "payment" })), + setCardPaymentContext: (context) => + dispatch(setModalContext({ context: context, modal: "cardPayment" })), }); export function JobPayments({ @@ -30,6 +32,7 @@ export function JobPayments({ jobRO, bodyshop, setPaymentContext, + setCardPaymentContext, refetch, }) { const { t } = useTranslation(); @@ -160,6 +163,16 @@ export function JobPayments({ > {t("menus.header.enterpayment")} + ); const JobsPage = lazy(() => import("../jobs/jobs.page")); +const CardPaymentModalContainer = lazy(() => + import("../../components/card-payment-modal/card-payment-modal.container.") +); + const JobsDetailPage = lazy(() => import("../jobs-detail/jobs-detail.page.container") ); @@ -195,6 +199,8 @@ export function Manage({ match, conflict, bodyshop }) { > + + diff --git a/server/intellipay/intellipay.js b/server/intellipay/intellipay.js index 87aec5e2c..3eadfa0b1 100644 --- a/server/intellipay/intellipay.js +++ b/server/intellipay/intellipay.js @@ -11,8 +11,11 @@ require("dotenv").config({ ), }); +const url = process.env.NODE_ENV + ? "https://secure.cpteller.com/api/custapi.cfc?method=autoterminal" + : "https://test.cpteller.com/api/custapi.cfc?method=autoterminal"; + exports.lightbox_credentials = async (req, res) => { - console.log("In API Lightbox Credential route."); try { const options = { method: "POST", @@ -21,9 +24,12 @@ exports.lightbox_credentials = async (req, res) => { data: qs.stringify({ merchantkey: "3B8068", apikey: "Oepn2B.XqRgzAqHqvOOmYUxD2VW.vGSipi", - operatingenv: "businessattended", // add these for EMV Swipe + operatingenv: + process.env.NODE_ENV === undefined + ? process.env.NODE_ENV + : "businessattended", }), - url: "https://test.cpteller.com/api/custapi.cfc?method=autoterminal", //added .test + url, }; const response = await axios(options);