import React, { useState } from 'react'; import { Link } from 'react-router-dom'; import './light.css'; import { Container, Form, Grid, Header, Input } from 'semantic-ui-react'; import { PayPalPayNow, PayPalSubscribe } from './PayPal.js'; import { MembersDropdown } from './Members.js'; import { requester } from './utils.js'; export function PayWithProtocoin(props) { const { token, user, refreshUser, amount, onSuccess, custom } = props; const member = user.member; const [error, setError] = useState({}); const [loading, setLoading] = useState(false); const [success, setSuccess] = useState(false); const handleSubmit = (e) => { if (loading) return; setSuccess(false); setLoading(true); const data = { amount: amount, ...custom, balance: member.protocoin }; requester('/protocoin/spend_request/', 'POST', token, data) .then(res => { setLoading(false); setSuccess(true); if (onSuccess) { onSuccess(); } setError({}); refreshUser(); }) .catch(err => { setLoading(false); console.log(err); setError(err.data); }); }; return (
Use these buttons to send money to Protospace.
Protocoin is used to buy things from Protospace's vending machines. No cash value.
Current balance: ₱ {user.member.protocoin.toFixed(2)}
Total circulation: ₱ {user.member.total_protocoin.toFixed(2)}
See a director to purchase Protocoin with a different payment method.
Send Protocoin:
Pay ${monthly_fees}.00 once:
Subscribe ${monthly_fees}.00 / month:
Pay ${monthly_fees * 11}.00 for a year:
...get one month for free!
Pay for materials you use (ie. welding gas, 3D printing, etc).
Custom amount:
Please explain what you bought:
setConsumablesMemo(v.value)}
/>
Donation of any amount to Protospace.
Custom amount:
Optional memo:
setMemo(v.value)}
/>
Confirm location and availability with Scott Young before subscribing.