Skip to content

Commit b54aa54

Browse files
author
Ajit Kumar
committed
fix: payment notificaiton
1 parent dc4f6a9 commit b54aa54

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@
6464
"build": "yarn config-build p && webpack --mode production",
6565
"dev": "node ./dev/start-dev",
6666
"update-schema": "node ./updateSchema",
67-
"download": "node ./server/reportsCli",
6867
"start": "node ./server/main",
69-
"sitemap": "node dev/generateSitemap.js"
68+
"sitemap": "node dev/generateSitemap.js",
69+
"reports": "node ./server/reportsCli"
7070
},
7171
"browserslist": [
7272
"> 0.25%, not dead"

server/lib/updateEarnings.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,8 @@ async function updateEarnings(year = currentYear, month = currentMonth) {
6363

6464
for (const user of users) {
6565
const { payment_method_id, email, name } = user;
66-
let { threshold } = user;
67-
68-
if (!payment_method_id) {
69-
sendEmail(email, name, 'Payment method not found', 'Please add payment method to receive payment.');
70-
}
71-
7266
const earnings = await calcEarnings.total(year, month, user, report);
67+
let { threshold } = user;
7368

7469
const [row] = await UserEarnings.get([
7570
[UserEarnings.USER_ID, user.id],
@@ -104,6 +99,10 @@ async function updateEarnings(year = currentYear, month = currentMonth) {
10499
// create integer random unique payment id
105100
const paymentId = Math.floor(Math.random() * 1000000000);
106101

102+
if (!payment_method_id) {
103+
sendEmail(email, name, 'Payment method not found', 'Please add payment method to receive payment.');
104+
}
105+
107106
await Payment.insert(
108107
[Payment.ID, paymentId],
109108
[Payment.USER_ID, user.id],

0 commit comments

Comments
 (0)