Add Consumables to Paymaster

This commit is contained in:
Tanner Collin 2022-01-25 04:12:22 +00:00
parent 1d84423694
commit e6aaef9bf1
2 changed files with 48 additions and 26 deletions

View File

@ -353,7 +353,7 @@ def process_paypal_ipn(data):
defaults=dict(user=user), defaults=dict(user=user),
) )
if custom_json.get('category', False) in ['Snacks', 'OnAcct', 'Donation']: if custom_json.get('category', False) in ['Snacks', 'OnAcct', 'Donation', 'Consumables']:
logger.info('IPN - Category matched') logger.info('IPN - Category matched')
update_ipn(ipn, 'Accepted, category') update_ipn(ipn, 'Accepted, category')
return create_category_tx(data, member, custom_json) return create_category_tx(data, member, custom_json)

View File

@ -11,6 +11,8 @@ export function Paymaster(props) {
const { user } = props; const { user } = props;
const [pop, setPop] = useState('20.00'); const [pop, setPop] = useState('20.00');
const [locker, setLocker] = useState('5.00'); const [locker, setLocker] = useState('5.00');
const [consumables, setConsumables] = useState('20.00');
const [consumablesMemo, setConsumablesMemo] = useState('');
const [donate, setDonate] = useState('20.00'); const [donate, setDonate] = useState('20.00');
const [memo, setMemo] = useState(''); const [memo, setMemo] = useState('');
@ -93,26 +95,44 @@ export function Paymaster(props) {
</Grid.Column> </Grid.Column>
</Grid> </Grid>
<Header size='medium'>Consumables</Header>
<p>Pay for materials you use (ie. welding gas, 3D printing, blades, etc).</p>
<Grid stackable padded columns={1}>
<Grid.Column>
Custom amount:
<div className='pay-custom'>
<Input
fluid
label={{ basic: true, content: '$' }}
labelPosition='left'
value={consumables}
onChange={(e, v) => setConsumables(v.value)}
/>
</div>
<p>
Please explain what you bought:<br/>
<Input
value={consumablesMemo}
maxLength={50}
onChange={(e, v) => setConsumablesMemo(v.value)}
/>
</p>
<PayPalPayNow
amount={consumables}
name='Protospace Consumables'
custom={JSON.stringify({ category: 'Consumables', member: user.member.id, memo: consumablesMemo })}
/>
</Grid.Column>
</Grid>
<Header size='medium'>Donate</Header> <Header size='medium'>Donate</Header>
<Grid stackable padded columns={3}>
<Grid.Column>
<p>Donate $5.00:</p>
<PayPalPayNow
amount={5}
name='Protospace Donation'
custom={JSON.stringify({ category: 'Donation', member: user.member.id, memo: memo })}
/>
</Grid.Column>
<Grid.Column>
<p>Donate $10.00:</p>
<PayPalPayNow
amount={10}
name='Protospace Donation'
custom={JSON.stringify({ category: 'Donation', member: user.member.id, memo: memo })}
/>
</Grid.Column>
<Grid stackable padded columns={1}>
<Grid.Column> <Grid.Column>
Custom amount: Custom amount:
@ -126,19 +146,21 @@ export function Paymaster(props) {
/> />
</div> </div>
<p>
Optional memo:<br/>
<Input
value={memo}
maxLength={50}
onChange={(e, v) => setMemo(v.value)}
/>
</p>
<PayPalPayNow <PayPalPayNow
amount={donate} amount={donate}
name='Protospace Donation' name='Protospace Donation'
custom={JSON.stringify({ category: 'Donation', member: user.member.id, memo: memo })} custom={JSON.stringify({ category: 'Donation', member: user.member.id, memo: memo })}
/> />
</Grid.Column> </Grid.Column>
Add an optional memo to your donation:
<Input
value={memo}
maxLength={50}
onChange={(e, v) => setMemo(v.value)}
/>
</Grid> </Grid>
<Header size='medium'>Locker Storage</Header> <Header size='medium'>Locker Storage</Header>