This repository has been archived by the owner on Jan 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First option mapped out, still need to print it on screen, logging for
now.
- Loading branch information
Showing
8 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
var express = require('express') | ||
, routes = require('./routes') | ||
, user = require('./routes/user') | ||
, http = require('http') | ||
, path = require('path'); | ||
|
||
var app = express(); | ||
|
||
app.configure(function(){ | ||
app.set('port', process.env.PORT || 3000); | ||
app.set('views', __dirname + '/views'); | ||
app.set('view engine', 'jade'); | ||
app.use(express.favicon()); | ||
app.use(express.logger('dev')); | ||
app.use(express.bodyParser()); | ||
app.use(express.methodOverride()); | ||
app.use(app.router); | ||
app.use(require('stylus').middleware(__dirname + '/public')); | ||
app.use(express.static(path.join(__dirname, 'public'))); | ||
}); | ||
|
||
app.configure('development', function(){ | ||
app.use(express.errorHandler()); | ||
}); | ||
|
||
app.get('/', routes.index); | ||
//app.get('/users', user.list); | ||
|
||
http.createServer(app).listen(app.get('port'), function(){ | ||
console.log("Express server listening on port " + app.get('port')); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "fee calculator", | ||
"version": "0.0.1", | ||
"private": true, | ||
"scripts": { | ||
"start": "node app" | ||
}, | ||
"dependencies": { | ||
"express": "3.0.0rc4", | ||
"jade": "*", | ||
"stylus": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
function init() { | ||
window.onkeyup = feeCalc; | ||
} | ||
|
||
init(); | ||
|
||
function feeCalc() { | ||
var el = document.getElementById('total-amount'); | ||
|
||
// option a | ||
// paypal > boa > local, chunks of $400 | ||
var paypalFee = 5.5531697938, | ||
boaPerTransFee = 5, // per $400 | ||
localBankFee = 1.50, // per $400 | ||
maximumPerWidthdraw = 400; | ||
|
||
// option b | ||
// bank to bank | ||
var intlTransFee = 33, | ||
bncrFee = 12, | ||
bacFee = 15; | ||
|
||
var amount = el.value, | ||
paypalTakes = (paypalFee * amount)/100, | ||
newAmount = amount - paypalTakes, | ||
finalAmount = 0, | ||
totalWithdrawals = 0; | ||
|
||
console.log("---"); | ||
console.log("What you see in Paypal: $" + amount); | ||
|
||
if(newAmount < 400) { | ||
finalAmount = newAmount - (boaPerTransFee + localBankFee); | ||
} else { | ||
console.log("After Paypal: $" + newAmount); | ||
console.info("Paypal took: $" + (amount - newAmount)); | ||
totalWithdrawals = Math.ceil(newAmount / maximumPerWidthdraw); | ||
finalAmount = newAmount - ((boaPerTransFee + localBankFee) * totalWithdrawals); | ||
console.log("Total in fees: $" + (amount - finalAmount) + ", after " + totalWithdrawals + "."); | ||
} | ||
|
||
console.log("What you end up with: $" + finalAmount); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
body { | ||
padding: 50px; | ||
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; | ||
} | ||
a { | ||
color: #00b7ff; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
body | ||
padding: 50px | ||
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif | ||
a | ||
color: #00B7FF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
/* | ||
* GET home page. | ||
*/ | ||
|
||
exports.index = function(req, res){ | ||
res.render('index', { title: 'Fee Calculator' }); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
extends layout | ||
|
||
block content | ||
h1= title | ||
p Welcome to #{title} | ||
|
||
form.calc-form | ||
label Monto a recibir: $ | ||
input(type='text', value='', placeholder='amount in US dollars').total-input#total-amount | ||
|
||
div#result | ||
h2 te recomendamos usar | ||
p#method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
doctype 5 | ||
html | ||
head | ||
title= title | ||
link(rel='stylesheet', href='/stylesheets/style.css') | ||
body | ||
div.container | ||
block content | ||
|
||
script(src='/javascripts/calc.js') | ||
|