Last active
December 23, 2015 20:35
-
-
Save allenmichael/17bb99a0a7beea65edf6 to your computer and use it in GitHub Desktop.
Shipping Arc.js Action Exercise 7-4
This file contains hidden or 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
module.exports = function(context, callback) { | |
var rates = context.response.body.rates; | |
var shippingRate; | |
try{ | |
for(var i = 0; i < rates.length; i++) { | |
for(var j = 0; j < rates[i].shippingRates.length; j++) { | |
shippingRate = context.response.body.rates[i].shippingRates[j].amount; | |
context.response.body.rates[i].shippingRates[j].amount = Math.floor((shippingRate + (context.response.body.rates[i].shippingRates[j].amount * 0.25))); | |
} | |
} | |
} catch(err) { | |
console.error(err); | |
} | |
callback(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment