-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
527 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
const API_PAYMENT = { | ||
//* TOTAL PAYMENT | ||
API_TOTAL_PAYMENT: "/api/payment/total", | ||
|
||
//* CHECK STOCK PRODUCT | ||
API_CHECK_STOCK_PRODUCT: "/api/payment/check/stock", | ||
|
||
// * TRANSACTION PAYPAL | ||
API_TRANSACTION_PAYMENT: "/api/payment/paypal", | ||
|
||
//* CHECK TOTAL PAYMENT | ||
API_TOTAL_PAYMENT: "/api/payment/total" | ||
}; | ||
export default API_PAYMENT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
frontend/src/v1/styles/Transaction_Style/CartBuySuccessStyle.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import { createGlobalStyle } from "styled-components"; | ||
|
||
export const CartBuySuccessStyle = createGlobalStyle` | ||
.success-wrapper, .cancel-wrapper{ | ||
background-color: white; | ||
min-height: 60vh; | ||
} | ||
.success, .cancel{ | ||
width: 1000px; | ||
margin: auto; | ||
margin-top: 100px; | ||
background-color: #dcdcdc; | ||
padding: 50px; | ||
border-radius: 15px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
flex-direction: column; | ||
padding-bottom:2rem; | ||
} | ||
.success .icon { | ||
color: green; | ||
font-size: 40px; | ||
} | ||
.success h2{ | ||
text-transform: capitalize; | ||
margin-top: 15px 0px; | ||
font-weight: 900; | ||
font-size: 40px; | ||
color:#324d67; | ||
} | ||
.success .email-msg{ | ||
font-size: 16px; | ||
font-weight: 600; | ||
text-align: center; | ||
} | ||
.cancel p{ | ||
font-size: 20px; | ||
font-weight: 600; | ||
} | ||
.success .description{ | ||
font-size: 16px; | ||
font-weight: 600; | ||
text-align: center; | ||
margin: 10px; | ||
margin-top: 30px; | ||
} | ||
.success .description .email{ | ||
margin-left: 5px; | ||
color: #f02d34; | ||
} | ||
.btn{ | ||
width: 100%; | ||
max-width: 400px; | ||
padding: 10px 12px; | ||
border-radius: 15px; | ||
border: none; | ||
font-size: 20px; | ||
margin-top: 10px; | ||
margin-top: 40px; | ||
text-transform: uppercase; | ||
background-color: #f02d34; | ||
color: #fff; | ||
cursor: pointer; | ||
transform: scale(1, 1); | ||
transition: transform 0.5s ease; | ||
} | ||
.btn:hover{ | ||
transform: scale(1.1,1.1); | ||
color: #fff; | ||
} | ||
@media screen and (max-width:800px) { | ||
.success-wrapper, .cancel-wrapper{ | ||
min-height: 69vh; | ||
} | ||
.success, .cancel { | ||
width: 370px; | ||
margin-top: 100px; | ||
padding: 20px; | ||
} | ||
.success{ | ||
height: 350px; | ||
} | ||
.success h2{ | ||
font-size: 17px; | ||
} | ||
.btn-container{ | ||
width: 300px; | ||
margin: auto; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
frontend/src/v1/user_ui/components/Cart_Component/totals/components/Check_Stock.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React, { useEffect } from 'react' | ||
import { useDispatch, useSelector } from "react-redux" | ||
import { Check_Stock_Product_Initial, Check_Total_Cart_Initial } from '../../../../../redux/payment_slice/Api_Redux_Thunk_Payment'; | ||
import STORAGES from '../../../../../utils/storage'; | ||
const Check_Stock = () => { | ||
const { total_user, stock_transaction } = useSelector((state) => ({ ...state.payment_user })); | ||
|
||
const dispatch = useDispatch(); | ||
const accessToken = STORAGES.getLocalStorage("accessToken"); | ||
|
||
const checkCountInStock = async () => { | ||
dispatch(Check_Stock_Product_Initial(accessToken)) | ||
}; | ||
return ( | ||
<React.Fragment> | ||
<button className="paypal" onClick={checkCountInStock}> | ||
Check Count In Stock | ||
</button> | ||
</React.Fragment> | ||
) | ||
} | ||
|
||
export default Check_Stock |
45 changes: 45 additions & 0 deletions
45
frontend/src/v1/user_ui/components/Cart_Component/totals/components/Transaction_Paypal.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React, { useEffect } from 'react' | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import { Link, useNavigate } from 'react-router-dom' | ||
import { Transaction_Payment_Initial } from '../../../../../redux/payment_slice/Api_Redux_Thunk_Payment'; | ||
import STORAGES from '../../../../../utils/storage'; | ||
import { Paypal, Check_Stock } from '../../../../imports/General_Global_Import' | ||
const Transaction_Paypal = () => { | ||
const { stock_transaction, total_payment, transaction } = useSelector((state) => ({ ...state.payment_user })); | ||
|
||
const dispatch = useDispatch(); | ||
const navigate = useNavigate(); | ||
const accessToken = STORAGES.getLocalStorage("accessToken"); | ||
|
||
const tranSuccess = async (payment) => { | ||
const { paymentID, address } = payment; | ||
dispatch(Transaction_Payment_Initial({ accessToken, paymentID, address })) | ||
}; | ||
useEffect(() => { | ||
if (transaction) { | ||
navigate("/transaction/success") | ||
} | ||
}, [transaction]) | ||
|
||
return ( | ||
<React.Fragment> | ||
<div className="cart-buttons d-flex align-items-center row"> | ||
<Link to="/" className="col-md-6 "> | ||
<button>Continue To Shopping.</button> | ||
</Link> | ||
<div className="col-md-6 d-flex justify-content-md-end mt-3 mt-md-0"> | ||
{stock_transaction && total_payment ? ( | ||
<button className="paypal"> | ||
<Paypal total={total_payment.total} tranSuccess={tranSuccess} /> | ||
</button> | ||
) : ( | ||
<Check_Stock /> | ||
)} | ||
</div> | ||
|
||
</div> | ||
</React.Fragment> | ||
) | ||
} | ||
|
||
export default Transaction_Paypal |
Oops, something went wrong.