%PDF- %PDF-
Direktori : /home/emergentqj/actioncivile/pre-auth/.632e77b3fb93bc8da5b589b869bc0037/static/js/components/SignUpBusiness/ |
Current File : /home/emergentqj/actioncivile/pre-auth/.632e77b3fb93bc8da5b589b869bc0037/static/js/components/SignUpBusiness/Adyen.jsx |
import React from "react"; import { string, func } from "prop-types"; import axios from "axios"; import { getUniversalCookies } from "../../utils/cookies"; function Adyen({ requestedPaymentMethod, // this.props.signUpBusinessState.requestedPaymentMethod receiveMessage, // this.receiveMessage }) { const epSsAuthToken = getUniversalCookies().get("epSsAuthToken"); axios({ method: "GET", url: requestedPaymentMethod, responseType: "blob", withCredentials: true, headers: { "X-Authorization": `Bearer ${epSsAuthToken}`, }, }) .then((res) => { window.addEventListener("message", receiveMessage, false); document.querySelector("#adyen-iframe").src = URL.createObjectURL( res.data, ); }) .catch((err) => console.error(err)); return ( <iframe id="adyen-iframe" title="adyen-iframe" width="100%" height="300" frameBorder="0" /> ); } Adyen.propTypes = { requestedPaymentMethod: string.isRequired, receiveMessage: func.isRequired, }; export default Adyen;