@react-pakistan/util-functions 1.23.57 → 1.23.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -124,38 +124,50 @@ var postPayment = function (_a) { return __awaiter(void 0, [_a], void 0, functio
|
|
|
124
124
|
.reduce(function (acc, _a) {
|
|
125
125
|
var paymentAmount = _a.amount;
|
|
126
126
|
return acc + paymentAmount;
|
|
127
|
-
}, 0)
|
|
127
|
+
}, 0);
|
|
128
128
|
}
|
|
129
129
|
return 0;
|
|
130
130
|
};
|
|
131
|
-
return [
|
|
131
|
+
if (!(calculateBalance() === 0)) return [3 /*break*/, 4];
|
|
132
|
+
return [4 /*yield*/, prisma.invoice.upsert({
|
|
132
133
|
where: {
|
|
133
|
-
id:
|
|
134
|
+
id: quoteInvoiceId,
|
|
134
135
|
},
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
attachment: attachment,
|
|
138
|
-
date: date,
|
|
139
|
-
description: description,
|
|
140
|
-
mode: mode,
|
|
141
|
-
paymentType: paymentType,
|
|
142
|
-
quoteInvoiceId: quoteInvoiceId,
|
|
143
|
-
ref: ref,
|
|
144
|
-
},
|
|
145
|
-
create: {
|
|
146
|
-
amount: amount,
|
|
147
|
-
attachment: attachment,
|
|
148
|
-
balance: String(calculateBalance()),
|
|
149
|
-
currency: currency,
|
|
150
|
-
date: date,
|
|
151
|
-
description: description,
|
|
152
|
-
mode: mode,
|
|
153
|
-
paymentType: paymentType,
|
|
154
|
-
quoteInvoiceId: quoteInvoiceId,
|
|
155
|
-
ref: ref,
|
|
136
|
+
data: {
|
|
137
|
+
invoiceStatus: 'PAID',
|
|
156
138
|
},
|
|
157
139
|
})];
|
|
158
140
|
case 3:
|
|
141
|
+
_c.sent();
|
|
142
|
+
_c.label = 4;
|
|
143
|
+
case 4: return [4 /*yield*/, prisma.payment.upsert({
|
|
144
|
+
where: {
|
|
145
|
+
id: id,
|
|
146
|
+
},
|
|
147
|
+
update: {
|
|
148
|
+
amount: amount,
|
|
149
|
+
attachment: attachment,
|
|
150
|
+
date: date,
|
|
151
|
+
description: description,
|
|
152
|
+
mode: mode,
|
|
153
|
+
paymentType: paymentType,
|
|
154
|
+
quoteInvoiceId: quoteInvoiceId,
|
|
155
|
+
ref: ref,
|
|
156
|
+
},
|
|
157
|
+
create: {
|
|
158
|
+
amount: amount,
|
|
159
|
+
attachment: attachment,
|
|
160
|
+
balance: String(calculateBalance()),
|
|
161
|
+
currency: currency,
|
|
162
|
+
date: date,
|
|
163
|
+
description: description,
|
|
164
|
+
mode: mode,
|
|
165
|
+
paymentType: paymentType,
|
|
166
|
+
quoteInvoiceId: quoteInvoiceId,
|
|
167
|
+
ref: ref,
|
|
168
|
+
},
|
|
169
|
+
})];
|
|
170
|
+
case 5:
|
|
159
171
|
payment = _c.sent();
|
|
160
172
|
return [2 /*return*/, payment];
|
|
161
173
|
}
|