Unverified Commit fed13e05 authored by andreswebs's avatar andreswebs
Browse files

add cash out and wallet to wallet methods

parent 0b4b8503
......@@ -10,4 +10,8 @@ REACT_APP_LAST_TRANSACTIONS_PATH="user/v1/last"
REACT_APP_TRANSACTIONS_PATH="user/v1/wallet/transactions"
REACT_APP_MONTH_EARNINGS_PATH="user/v1/wallet/monthearnings"
REACT_APP_EARNINGS_PATH="user/v1/wallet/earnings"
REACT_APP_CURRENCY_VALUES_PATH="exchange/v1/ticker/eur"
\ No newline at end of file
REACT_APP_CURRENCY_VALUES_PATH="exchange/v1/ticker/eur"
REACT_APP_ONE_TIME_PIN_PATH="user/v1/security/one_time_pin"
REACT_APP_CASH_OUT_PATH="methods/v1/out"
REACT_APP_WALLET_TO_WALLET_PATH="user/v1/wallet/send"
REACT_APP_WALLET_ACTIONS_FEES_PATH="user/v1/fees"
# https://create-react-app.dev/docs/adding-custom-environment-variables/
# the places where these variables are used are indicated in the comments below
# src/pages/login/constants.js
REACT_APP_CLIENT_ID="<< client id here >>"
REACT_APP_CLIENT_SECRET="<< client secret here >>"
# src/widgets/WalletActions/CashIn/methods/actions.js
# src/utils.js
REACT_APP_BACKEND_URL="<< api base url here >>"
# src/widgets/WalletActions/CashIn/methods/actions.js
REACT_APP_COMPANY_WALLET_PATH="<< wallet api path here >>"
# src/pages/login/actions.js
REACT_APP_LOGIN_PATH="<< login api path here >>"
# src/widgets/Transactions/actions.js
REACT_APP_TRANSACTIONS_PATH="<< transactions api path here >>"
# src/widgets/MonthEarnings/actions.js
REACT_APP_MONTH_EARNINGS_PATH="<< month earnings api path here >>"
# src/widgets/LastTransactions/actions.js
REACT_APP_LAST_TRANSACTIONS_PATH="<< last transactions api path here >>"
# src/widgets/Earnings/actions.js
REACT_APP_EARNINGS_PATH="<< earnings api path here >>"
# src/widgets/CurrenciesValue/actions.js
REACT_APP_CURRENCY_VALUES_PATH="<< currencies value api path here >>"
# src/widgets/WalletActions/actions.js
REACT_APP_WALLET_ACTIONS_PATH="<< wallet actions api path here >>"
# src/layouts/actions.js
REACT_APP_USER_WALLET_PATH="<< user wallet api path here >>"
REACT_APP_USER_ACCOUNT_PATH="<< user account api path here >>"
\ No newline at end of file
REACT_APP_USER_ACCOUNT_PATH="<< user account api path here >>"
REACT_APP_ONE_TIME_PIN_PATH="<< one time pin path here>>"
REACT_APP_CASH_OUT_PATH="<< cash out path here >>"
REACT_APP_WALLET_TO_WALLET_PATH="<< wallet to wallet path here >>"
REACT_APP_WALLET_ACTIONS_FEES_PATH="<< wallet actions fees >>"
......@@ -9,6 +9,7 @@
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^10.0.0",
"axios": "^0.19.2",
"big.js": "^5.2.2",
"chart.js": "^2.9.3",
"chartist": "^0.11.4",
"classnames": "^2.2.6",
......@@ -82,4 +83,4 @@
"eslint --fix"
]
}
}
\ No newline at end of file
}
......@@ -14,8 +14,8 @@ import Email from '@material-ui/icons/Email';
// core components
import GridContainer from 'components/ui/Grid/GridContainer';
import GridItem from 'components/ui/Grid/GridItem';
import CustomInput from 'components/ui/CustomInput/CustomInput';
import Button from 'components/ui/CustomButtons/Button';
import CustomInput from 'components/ui/CustomInput';
import Button from 'components/ui/Button';
import Card from 'components/ui/Card/Card';
import CardBody from 'components/ui/Card/CardBody';
import CardHeader from 'components/ui/Card/CardHeader';
......
......@@ -14,7 +14,7 @@ import MoreVert from '@material-ui/icons/MoreVert';
import ViewList from '@material-ui/icons/ViewList';
// core components
import Button from 'components/ui/CustomButtons/Button';
import Button from 'components/ui/Button';
import headerStyle from 'assets/jss/material-dashboard-react/components/headerStyle';
import HeaderLinks from './HeaderLinks';
......
......@@ -16,7 +16,7 @@ import Popper from '@material-ui/core/Popper';
// @material-ui/icons
import Person from '@material-ui/icons/Person';
import Button from 'components/ui/CustomButtons/Button';
import Button from 'components/ui/Button';
import { logOut } from 'utils';
......
......@@ -19,7 +19,7 @@ import Dashboard from '@material-ui/icons/Dashboard';
import Menu from '@material-ui/icons/Menu';
// core components
import Button from 'components/ui/CustomButtons/Button';
import Button from 'components/ui/Button';
import dashboardRoutes from 'components/routes/dashboard-routes';
......
......@@ -14,7 +14,7 @@ import MoreVert from '@material-ui/icons/MoreVert';
import ViewList from '@material-ui/icons/ViewList';
// core components
import Button from 'components/ui/CustomButtons/Button';
import Button from 'components/ui/Button';
import adminNavbarStyle from 'assets/jss/material-dashboard-react/components/adminNavbarStyle';
import AdminNavbarLinks from './AdminNavbarLinks';
......
......@@ -20,8 +20,8 @@ import Dashboard from '@material-ui/icons/Dashboard';
import Search from '@material-ui/icons/Search';
// core components
import CustomInput from 'components/ui/CustomInput/CustomInput';
import Button from 'components/ui/CustomButtons/Button';
import CustomInput from 'components/ui/CustomInput';
import Button from 'components/ui/Button';
import adminNavbarLinksStyle from 'assets/jss/material-dashboard-react/components/adminNavbarLinksStyle';
......
......@@ -22,7 +22,7 @@ import LockOpen from '@material-ui/icons/LockOpen';
import MonetizationOn from '@material-ui/icons/MonetizationOn';
// core components
import Button from 'components/ui/CustomButtons/Button';
import Button from 'components/ui/Button';
import authNavbarStyle from 'assets/jss/material-dashboard-react/components/authNavbarStyle';
......
import React, { Component } from 'react';
import CircularProgress from '@material-ui/core/CircularProgress';
import Button from '@material-ui/core/Button';
import CheckIcon from '@material-ui/icons/Check';
import Fab from '@material-ui/core/Fab';
import { fetchApi } from 'utils';
const ONE_TIME_PIN_PATH = process.env.REACT_APP_ONE_TIME_PIN_PATH;
const sendOneTimePin = () => {
return fetchApi({
method: 'PUT',
path: ONE_TIME_PIN_PATH
})
.then(response => response.data)
.catch(error => {
throw error;
});
};
class OneTimePin extends Component {
constructor(props) {
super(props);
this.state = {
loading: false,
success: false
};
}
handleButtonClick = () => {
if (!this.state.loading) {
this.setState({ success: false, loading: true });
sendOneTimePin()
.then(() => {
this.setState({ success: true, loading: false });
})
.catch(() => {
this.setState({ success: false, loading: false });
});
}
};
render() {
const { loading, success } = this.state;
const Progress = loading ? (
<CircularProgress
style={{
position: 'absolute',
top: '50%',
left: '50%',
marginTop: -12,
marginLeft: -12
}}
size={24}
/>
) : (
<div />
);
const SendButton = (
<div>
<Button
variant="contained"
style={{ backgroundColor: 'green' }}
disabled={loading}
onClick={this.handleButtonClick}
>
Send me one-time pin
</Button>
,{Progress}
</div>
);
const SuccessBadge = (
<Fab size="small" style={{ backgroundColor: 'green' }}>
<CheckIcon />
</Fab>
);
return (
<div style={{ width: '100%', textAlign: 'center', marginBottom: '12px' }}>
This transaction requires a confirmation. You don&apos;t have 2FA
enabled. Please request a one-time PIN for your withdrawal with the link
below. We will send you an email with the PIN.
<div style={{ alignText: 'right', position: 'relative' }}>
{!success ? SendButton : SuccessBadge}
</div>
</div>
);
}
}
export default OneTimePin;
......@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
// @material-ui/core components
import withStyles from '@material-ui/core/styles/withStyles';
// core components
import Button from 'components/ui/CustomButtons/Button';
import Button from 'components/ui/Button';
import Card from 'components/ui/Card/Card';
import wizardStyle from 'assets/jss/material-dashboard-react/components/wizardStyle';
......
......@@ -3,7 +3,7 @@ import { connect } from 'react-redux';
import CardHeader from 'components/ui/Card/CardHeader';
import CardBody from 'components/ui/Card/CardBody';
import Button from 'components/ui/CustomButtons/Button';
import Button from 'components/ui/Button';
import { Popover, Paper } from '@material-ui/core';
import Refresh from '@material-ui/icons/Refresh';
......
......@@ -10,7 +10,7 @@ import Close from '@material-ui/icons/Close';
import Paper from '@material-ui/core/Paper';
// core components
import Button from 'components/ui/CustomButtons/Button';
import Button from 'components/ui/Button';
import * as actions from 'store/transactions/actions';
......
......@@ -56,7 +56,7 @@ class SelectMethod extends React.Component {
}
const mapStateToProps = state => ({
methods: state.wallet_actions.cash_in
methods: state.walletActions.cash_in
});
export default connect(mapStateToProps, {})(withStyles(styles)(SelectMethod));
import React, { Component } from 'react';
import Table from 'components/ui/Table';
import Button from 'components/ui/CustomButtons/Button';
import Button from 'components/ui/Button';
import { Paper, Card } from '@material-ui/core';
import Close from '@material-ui/icons/Close';
......
import React, { Component } from 'react';
import Button from 'components/ui/CustomButtons/Button';
import Button from 'components/ui/Button';
class Sepa extends Component {
createCashInToken() {
......
import React from 'react';
// @material-ui/core components
import withStyles from '@material-ui/core/styles/withStyles';
import { Card } from '@material-ui/core';
import CashOutMethod from './methods';
const style = {
infoText: {
fontWeight: '300',
margin: '10px 0 30px',
textAlign: 'center'
},
inputAdornmentIcon: {
color: '#555'
},
inputAdornment: {
position: 'relative'
}
};
class CashOut extends React.Component {
constructor(props) {
super(props);
this.state = {};
}
sendState() {
return this.state;
}
render() {
if (!this.props.allStates.choice) {
return <div />;
}
let Component = '';
if (this.props.allStates.choice.selectedMethod) {
Component = this.props.allStates.choice.selectedMethod;
}
return (
<Card>
<div id="cash_in_method">
<CashOutMethod
method={Component}
handleClose={() => this.props.close()}
/>
</div>
</Card>
);
}
}
export default withStyles(style)(CashOut);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment