File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ async function _createSingleWorkPeriodPaymentWithWorkPeriodAndResourceBooking (w
68
68
if ( correspondingResourceBooking . memberRate <= 0 ) {
69
69
throw new errors . ConflictError ( `Can't process payment with member rate: ${ correspondingResourceBooking . memberRate } . It must be higher than 0` )
70
70
}
71
- workPeriodPayment . memberRate = correspondingResourceBooking . memberRate
71
+
72
72
const maxPossibleDays = correspondingWorkPeriod . daysWorked - correspondingWorkPeriod . daysPaid
73
73
if ( workPeriodPayment . days > maxPossibleDays ) {
74
74
throw new errors . BadRequestError ( `Days cannot be more than not paid days which is ${ maxPossibleDays } ` )
@@ -83,7 +83,8 @@ async function _createSingleWorkPeriodPaymentWithWorkPeriodAndResourceBooking (w
83
83
workPeriodPayment . days = _ . defaultTo ( workPeriodPayment . days , maxPossibleDays )
84
84
workPeriodPayment . amount = _ . round ( workPeriodPayment . memberRate * workPeriodPayment . days / 5 , 2 )
85
85
}
86
- workPeriodPayment . memberRate = _ . defaultTo ( workPeriodPayment . memberRate , 0 )
86
+ // TODO: we should allow `memberRate` to be `null` as it's not required for additional payments
87
+ workPeriodPayment . memberRate = _ . defaultTo ( correspondingResourceBooking . memberRate , 0 )
87
88
workPeriodPayment . customerRate = _ . defaultTo ( correspondingResourceBooking . customerRate , null )
88
89
workPeriodPayment . id = uuid . v4 ( )
89
90
workPeriodPayment . status = WorkPeriodPaymentStatus . SCHEDULED
You can’t perform that action at this time.
0 commit comments