File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -1158,11 +1158,12 @@ suggestMembers.schema = Joi.object().keys({
11581158
11591159/**
11601160 * Calculates total amount
1161- * @param {Object } body
1161+ * @param {Object } amount
11621162 * @returns {int } totalAmount
11631163 */
1164- async function calculateAmount ( body ) {
1165- const totalAmount = body . numberOfResources * body . rates * body . durationWeeks ;
1164+ async function calculateAmount ( amount ) {
1165+ let totalAmount = 0 ;
1166+ _ . forEach ( amount , amt => totalAmount += amt . numberOfResources * amt . rate * amt . durationWeeks )
11661167 return { totalAmount } ;
11671168}
11681169
@@ -1172,8 +1173,9 @@ suggestMembers.schema = Joi.object().keys({
11721173 * @returns {string } paymentIntentToken
11731174 */
11741175async function createPayment ( totalAmount ) {
1176+ const dollarToCents = ( totalAmount * 100 ) ;
11751177 const paymentIntent = await stripe . paymentIntents . create ( {
1176- amount : totalAmount ,
1178+ amount : dollarToCents ,
11771179 currency : config . CURRENCY ,
11781180 } ) ;
11791181 return { paymentIntentToken : paymentIntent . client_secret } ;
You can’t perform that action at this time.
0 commit comments