@react-pakistan/util-functions 1.23.59 → 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.
@@ -128,34 +128,46 @@ var postPayment = function (_a) { return __awaiter(void 0, [_a], void 0, functio
128
128
  }
129
129
  return 0;
130
130
  };
131
- return [4 /*yield*/, prisma.payment.upsert({
131
+ if (!(calculateBalance() === 0)) return [3 /*break*/, 4];
132
+ return [4 /*yield*/, prisma.invoice.upsert({
132
133
  where: {
133
- id: id,
134
+ id: quoteInvoiceId,
134
135
  },
135
- update: {
136
- amount: amount,
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.23.59",
3
+ "version": "1.23.60",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {