diff --git a/webapp/public/index.html b/webapp/public/index.html index b1f4286..3497aeb 100644 --- a/webapp/public/index.html +++ b/webapp/public/index.html @@ -39,5 +39,7 @@ To begin the development, run `npm start` or `yarn start`. To create a production bundle, use `npm run build` or `yarn build`. --> + + diff --git a/webapp/src/App.js b/webapp/src/App.js index 01b5895..e9468d2 100644 --- a/webapp/src/App.js +++ b/webapp/src/App.js @@ -1,18 +1,25 @@ -import 'bootstrap/dist/css/bootstrap.min.css'; -import './App.css'; -import AllRoutes from './routes/AllRoutes' -import { ModalProvider } from './context/ModalContext'; -import ModalComponent from './components/ModalComponent'; -import { DeviceWidthProvider } from './context/DeviceWidthContext'; -import { AuthProvider } from './context/AuthContext'; +import "bootstrap/dist/css/bootstrap.min.css"; +import "./App.css"; +import AllRoutes from "./routes/AllRoutes"; +import { ModalProvider } from "./context/ModalContext"; +import ModalComponent from "./components/ModalComponent"; +import { DeviceWidthProvider } from "./context/DeviceWidthContext"; +import { AuthProvider } from "./context/AuthContext"; function App() { return ( -
-
+
+
diff --git a/webapp/src/PaymentModal/PaymentModal.js b/webapp/src/PaymentModal/PaymentModal.js new file mode 100644 index 0000000..b0691b8 --- /dev/null +++ b/webapp/src/PaymentModal/PaymentModal.js @@ -0,0 +1,55 @@ +import React from 'react'; + +const PaymentModal = ({ orderId, name, amount }) => { + + // Put the payment variables here + var payment = { + sandbox: true, // if the account is sandbox or real + merchant_id: '1223868', // Replace your Merchant ID + return_url: 'http://localhost:3000/dashboard', + cancel_url: 'http://localhost:3000/dashboard', + notify_url: 'http://sample.com/notify', + order_id: orderId, + items: name, + amount: amount, + currency: 'LKR', + first_name: 'Saman', + last_name: 'Perera', + email: 'samanp@gmail.com', + phone: '0771234567', + address: 'No.1, Galle Road', + city: 'Colombo', + country: 'Sri Lanka', + delivery_address: 'No. 46, Galle road, Kalutara South', // optional field + delivery_city: 'Kalutara', // optional field + delivery_country: 'Sri Lanka', // optional field + custom_1: '', // optional field + custom_2: '', // optional field + }; + + // Called when user completed the payment. It can be a successful payment or failure + window.payhere.onCompleted = function onCompleted(orderId) { + console.log("Payment completed. OrderID:" + orderId); + //Note: validate the payment and show success or failure page to the customer + }; + + // Called when user closes the payment without completing + window.payhere.onDismissed = function onDismissed() { + //Note: Prompt user to pay again or show an error page + console.log("Payment dismissed"); + }; + + // Called when error happens when initializing payment such as invalid parameters + window.payhere.onError = function onError(error) { + // Note: show an error page + console.log("Error:" + error); + }; + + function pay(){ + window.payhere.startPayment(payment); + } + + return ; +}; + +export default PaymentModal; \ No newline at end of file diff --git a/webapp/src/views/PremiumView.js b/webapp/src/views/PremiumView.js index 6418965..0cdd036 100644 --- a/webapp/src/views/PremiumView.js +++ b/webapp/src/views/PremiumView.js @@ -1,56 +1,92 @@ -import '../assets/CSS/premiumStyle.css' -import React, { useState } from 'react'; -import FrameComponent from '../components/FrameComponent'; +import "../assets/CSS/premiumStyle.css"; +import React, { useState } from "react"; +import FrameComponent from "../components/FrameComponent"; +import PaymentModal from "../PaymentModal/PaymentModal"; const PremiumView = () => { const [agree, setAgree] = useState(false); + const [payment, setPayment] = useState(false); const checkboxHandler = () => { setAgree(!agree); - } + }; const btnHandler = () => { - alert('The button is clickable!'); + setPayment(true); }; return ( -
-
-
-

Unlock Your Premium Features

-
-
-
-

UPGRADE TO PREMIUM

-
Boost your learning today - go premium with a one-time payment of 400.00 LKR. - Get access to exclusive study materials, videos, and interactive quizzes!
-
අදම ඔබේ ඉගෙනීම ඉහළ නංවන්න - වාරිකය 400/= කට පමණයි. සුවිශේෂී අධ්‍යයන ද්‍රව්‍ය, - වීඩියෝ සහ අන්තර්ක්‍රියාකාරී ප්‍රශ්නාවලිය වෙත ප්‍රවේශය ලබා ගන්න!
-
இன்றே உங்கள் கற்றலை அதிகரிக்கவும் 400.00 LKR ஒரு முறை செலுத்துவதன் மூலம் பிரீமியத்திற்கு செல்லுங்கள். - பிரத்தியேக வீடியோக்கள் மற்றும் வினாடி வினாக்களுக்கான அணுகலைப் பெறுங்கள்!
+
+
+
+

Unlock Your Premium Features

-
- - -
-
- - - - {/* Unlock Tamil +
+
+

UPGRADE TO PREMIUM

+
+ Boost your learning today - go premium with a one-time payment + of 400.00 LKR. Get access to exclusive study materials, videos, + and interactive quizzes! +
+
+ අදම ඔබේ ඉගෙනීම ඉහළ නංවන්න - වාරිකය 400/= කට පමණයි. සුවිශේෂී + අධ්‍යයන ද්‍රව්‍ය, වීඩියෝ සහ අන්තර්ක්‍රියාකාරී ප්‍රශ්නාවලිය වෙත + ප්‍රවේශය ලබා ගන්න! +
+
+ இன்றே உங்கள் கற்றலை அதிகரிக்கவும் 400.00 LKR ஒரு முறை + செலுத்துவதன் மூலம் பிரீமியத்திற்கு செல்லுங்கள். பிரத்தியேக + வீடியோக்கள் மற்றும் வினாடி வினாக்களுக்கான அணுகலைப் பெறுங்கள்! +
+
+
+ + +
+
+ + + + {/* Unlock Tamil Unlock English */} -
+
+ {payment ? ( +
+ +
+ ) : null} +
-
-
+
- ) -} + ); +}; export default PremiumView;