File tree 1 file changed +6
-4
lines changed
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({
1158
1158
1159
1159
/**
1160
1160
* Calculates total amount
1161
- * @param {Object } body
1161
+ * @param {Object } amount
1162
1162
* @returns {int } totalAmount
1163
1163
*/
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 )
1166
1167
return { totalAmount } ;
1167
1168
}
1168
1169
@@ -1172,8 +1173,9 @@ suggestMembers.schema = Joi.object().keys({
1172
1173
* @returns {string } paymentIntentToken
1173
1174
*/
1174
1175
async function createPayment ( totalAmount ) {
1176
+ const dollarToCents = ( totalAmount * 100 ) ;
1175
1177
const paymentIntent = await stripe . paymentIntents . create ( {
1176
- amount : totalAmount ,
1178
+ amount : dollarToCents ,
1177
1179
currency : config . CURRENCY ,
1178
1180
} ) ;
1179
1181
return { paymentIntentToken : paymentIntent . client_secret } ;
You can’t perform that action at this time.
0 commit comments