diff --git a/src/App.js b/src/App.js
index 0bada7f..326038f 100644
--- a/src/App.js
+++ b/src/App.js
@@ -2,14 +2,14 @@ import React from 'react';
import './App.css';
import { Nav } from './components/header';
import { Footer } from './components/footer';
-import { Landding } from './components/mainPage';
+import { Landing } from './components/mainPage';
function App() {
return (
diff --git a/src/components/mainPage/index.js b/src/components/mainPage/index.js
index a5cfa0b..0476e58 100644
--- a/src/components/mainPage/index.js
+++ b/src/components/mainPage/index.js
@@ -2,4 +2,5 @@ export {default as PayPal} from './paypal';
export {default as Purchase} from './purchase';
export {default as ShowCase} from './showCase';
export {default as Home} from './home';
-export {default as Landding} from './landing';
\ No newline at end of file
+export {default as Landing} from './landing';
+export {default as Invoice} from './invoice';
\ No newline at end of file
diff --git a/src/components/mainPage/invoice.jsx b/src/components/mainPage/invoice.jsx
new file mode 100644
index 0000000..e8f84ea
--- /dev/null
+++ b/src/components/mainPage/invoice.jsx
@@ -0,0 +1,20 @@
+import React from "react";
+
+const Invoice = (props) => {
+
+ return (
+
+ Date Purchased: {props.date}
+
+ Item: {props.itemName}
+
+ Amount Paid: ${props.itemValue}
+
+ Ship to: {props.buyerName}
+
+ Shipping address: {props.streetAddr} {props.city}, {props.state} {props.postalCode}
+
+ );
+}
+
+export default Invoice;
\ No newline at end of file
diff --git a/src/components/mainPage/paypal.jsx b/src/components/mainPage/paypal.jsx
index c6174fb..fa3b05d 100644
--- a/src/components/mainPage/paypal.jsx
+++ b/src/components/mainPage/paypal.jsx
@@ -1,15 +1,19 @@
-import React from "react";
+import React, { useState } from "react";
import { PayPalScriptProvider, PayPalButtons, FUNDING } from "@paypal/react-paypal-js";
+import { Invoice } from '.';
const initialOptions = {
"client-id": "AQBhJiIcG8lS4K5UoTo_-G5it85lbFpxEcA-WWBb1A-_Nq6YfKUdn05oyg-SgpxzXTyjfpdMceWskq7G",
currency: "USD",
intent: "capture"
}
-// buyer account: dev01.oemautomation.com, pwd: 3Deerhead
-// merchant account: biz01.oemautomation.com, pwd 3Deerhead
+// buyer account: dev01@oemautomation.com, pwd: 3Deerhead
+// merchant account: biz01@oemautomation.com, pwd 3Deerhead
const PayPal = () => {
+ const [showInvoice, setShowInvoice] = useState(false);
+ const [invoiceDetails, setInvoiceDetails] = useState({});
+
const createOrder = (data, actions) => {
return actions.order.create({
@@ -25,8 +29,8 @@ const PayPal = () => {
const onApprove = (data, actions) => {
return actions.order.capture().then(function(details) {
- console.dir(details);
- alert('Transaction completed by ' + details.payer.name.given_name);
+ setInvoiceDetails(details);
+ setShowInvoice(true);
});
}
@@ -44,6 +48,18 @@ const PayPal = () => {
+ {showInvoice &&
+
+ }
>
);
};