From cfdf95cc70913e33652166cfd1766c1be6a63ce0 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Wed, 21 Oct 2015 20:38:11 -0700 Subject: [PATCH] Add nonprofit discount logic --- .../app/routes/Jobs/components/GoToPayPal.jsx | 33 ++++++++++++++++--- common/app/routes/Jobs/components/Preview.jsx | 2 +- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/common/app/routes/Jobs/components/GoToPayPal.jsx b/common/app/routes/Jobs/components/GoToPayPal.jsx index 229c86ddb4..cba6075c81 100644 --- a/common/app/routes/Jobs/components/GoToPayPal.jsx +++ b/common/app/routes/Jobs/components/GoToPayPal.jsx @@ -2,6 +2,27 @@ import React, { PropTypes } from 'react'; import { Button, Col, Panel, Row } from 'react-bootstrap'; 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( { store: 'JobsStore', @@ -42,6 +63,13 @@ export default contain( Clicking on the link below will redirect to paypal. + + + { getPrice(isHighlighted, true) } + +
+ value={ getPaypalButton(isHighlighted, true) } /> { - jobActions.clearSavedForm(); + // jobActions.clearSavedForm(); jobActions.saveJobToDb({ goTo: '/jobs/new/check-out', job