Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions scripts/demo-payment-scheduler/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
"startDate":"2020-09-27",
"endDate":"2020-10-03",
"daysWorked":4,
"daysPaid": 3,
"paymentTotal": 0,
"memberRate":27.06,
"customerRate":13.13,
"paymentStatus":"partially-completed",
Expand All @@ -59,6 +61,8 @@
"startDate":"2020-10-18",
"endDate":"2020-10-24",
"daysWorked":4,
"daysPaid": 3,
"paymentTotal": 0,
"memberRate":4.08,
"customerRate":3.89,
"paymentStatus":"cancelled",
Expand All @@ -75,6 +79,8 @@
"startDate":"2020-10-25",
"endDate":"2020-10-31",
"daysWorked":3,
"daysPaid": 3,
"paymentTotal": 0,
"memberRate":15.61,
"customerRate":9.76,
"paymentStatus":"pending",
Expand All @@ -91,6 +97,8 @@
"startDate":"2020-10-11",
"endDate":"2020-10-17",
"daysWorked":4,
"daysPaid": 3,
"paymentTotal": 0,
"memberRate":10.82,
"customerRate":30.71,
"paymentStatus":"pending",
Expand Down
2 changes: 2 additions & 0 deletions scripts/demo-payment-scheduler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ for (let i = 0; i < 1000; i++) {
amount: _.round(_.random(1000, true), 2),
status: 'scheduled',
billingAccountId: data.ResourceBooking.billingAccountId,
memberRate: data.ResourceBooking.memberRate,
days: 4,
createdBy: '57646ff9-1cd3-4d3c-88ba-eb09a395366c',
updatedBy: null,
createdAt: `2021-05-19T21:3${i % 10}:46.507Z`,
Expand Down
2 changes: 1 addition & 1 deletion src/services/PaymentSchedulerService.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ async function processPayment (workPeriodPayment) {
await postEvent(config.TAAS_WORK_PERIOD_PAYMENT_UPDATE_TOPIC, updated.toJSON(), { oldValue })

if (paymentScheduler) {
await paymentScheduler.update({ step: PaymentSchedulerStatus.CLOSE_CHALLENGE, userId: paymentScheduler.userId, status: 'failed' })
await paymentScheduler.update({ step: _.get(err, 'step', PaymentSchedulerStatus.CLOSE_CHALLENGE), userId: paymentScheduler.userId, status: 'failed' })
}
localLogger.error(`Processed workPeriodPayment ${workPeriodPayment.id} failed`, 'processPayment')
return processResult.FAIL
Expand Down