Add nonprofit discount logic

This commit is contained in:
Berkeley Martinez
2015-10-21 20:38:11 -07:00
parent dc2df4537d
commit cfdf95cc70
2 changed files with 30 additions and 5 deletions

View File

@ -2,6 +2,27 @@ import React, { PropTypes } from 'react';
import { Button, Col, Panel, Row } from 'react-bootstrap'; import { Button, Col, Panel, Row } from 'react-bootstrap';
import { contain } from 'thundercats-react'; import { contain } from 'thundercats-react';
const paypalIds = {
regular: 'ZVU498PLMPHKU',
regularDiscount: '58U7P36W3L2GQ',
highlighted: '3YYSTBAMJYTUW',
highlightedDiscount: 'QGWTUZ9XEE6EL'
};
function getPaypalButton(isHighlighted, isNonprofit) {
if (isHighlighted) {
return isNonprofit ? paypalIds.highlightedDiscount : paypalIds.highlighted;
}
return isNonprofit ? paypalIds.regularDiscount : paypalIds.regular;
}
function getPrice(isHighlighted, isNonprofit) {
if (isHighlighted) {
return isNonprofit ? 150 : 250;
}
return isNonprofit ? 100 : 200;
}
export default contain( export default contain(
{ {
store: 'JobsStore', store: 'JobsStore',
@ -42,6 +63,13 @@ export default contain(
Clicking on the link below will redirect to paypal. Clicking on the link below will redirect to paypal.
</Col> </Col>
</Row> </Row>
<Row>
<Col
md={ 6 }
mdOffset={ 3 }>
{ getPrice(isHighlighted, true) }
</Col>
</Row>
<div className='spacer' /> <div className='spacer' />
<Row> <Row>
<Col <Col
@ -58,10 +86,7 @@ export default contain(
<input <input
name='hosted_button_id' name='hosted_button_id'
type='hidden' type='hidden'
value={ isHighlighted ? value={ getPaypalButton(isHighlighted, true) } />
'' :
'ZVU498PLMPHKU'
} />
<input <input
name='custom' name='custom'
type='hidden' type='hidden'

View File

@ -53,7 +53,7 @@ export default contain(
block={ true } block={ true }
className='signup-btn' className='signup-btn'
onClick={ () => { onClick={ () => {
jobActions.clearSavedForm(); // jobActions.clearSavedForm();
jobActions.saveJobToDb({ jobActions.saveJobToDb({
goTo: '/jobs/new/check-out', goTo: '/jobs/new/check-out',
job job