@react-pakistan/util-functions 1.23.50 → 1.23.52

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.
@@ -101,7 +101,7 @@ var postPayment = function (_a) { return __awaiter(void 0, [_a], void 0, functio
101
101
  var amount = _b.amount, attachment = _b.attachment, createdAt = _b.createdAt, currency = _b.currency, date = _b.date, description = _b.description, id = _b.id, mode = _b.mode, paymentType = _b.paymentType, prisma = _b.prisma, quoteInvoiceId = _b.quoteInvoiceId, ref = _b.ref;
102
102
  return __generator(this, function (_c) {
103
103
  switch (_c.label) {
104
- case 0: return [4 /*yield*/, prisma.invoice.findUnique({
104
+ case 0: return [4 /*yield*/, prisma.quoteInvoice.findUnique({
105
105
  where: {
106
106
  quoteInvoiceId: quoteInvoiceId,
107
107
  },
@@ -118,11 +118,11 @@ var postPayment = function (_a) { return __awaiter(void 0, [_a], void 0, functio
118
118
  })];
119
119
  case 2:
120
120
  allPaymentsForInvoice = _c.sent();
121
- balance = allPaymentsForInvoice
121
+ balance = (allPaymentsForInvoice && allPaymentsForInvoice
122
122
  .reduce(function (acc, _a) {
123
123
  var paymentAmount = _a.amount;
124
124
  return acc + paymentAmount;
125
- }, 0) - invoice.total;
125
+ }, 0) - invoice.total) || 0;
126
126
  return [4 /*yield*/, prisma.payment.upsert({
127
127
  where: {
128
128
  id: id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.23.50",
3
+ "version": "1.23.52",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {