@react-pakistan/util-functions 1.23.63 → 1.23.65

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,8 +128,37 @@ var postPayment = function (_a) { return __awaiter(void 0, [_a], void 0, functio
128
128
  }
129
129
  return 0;
130
130
  };
131
- if (!(calculateBalance() === 0)) return [3 /*break*/, 4];
132
- return [4 /*yield*/, prisma.invoice.update({
131
+ return [4 /*yield*/, prisma.payment.upsert({
132
+ where: {
133
+ id: id,
134
+ },
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,
156
+ },
157
+ })];
158
+ case 3:
159
+ payment = _c.sent();
160
+ if (!(calculateBalance() === 0)) return [3 /*break*/, 5];
161
+ return [4 /*yield*/, prisma.quoteInvoice.update({
133
162
  where: {
134
163
  id: quoteInvoiceId,
135
164
  },
@@ -137,39 +166,10 @@ var postPayment = function (_a) { return __awaiter(void 0, [_a], void 0, functio
137
166
  invoiceStatus: 'PAID',
138
167
  },
139
168
  })];
140
- case 3:
169
+ case 4:
141
170
  _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:
171
- payment = _c.sent();
172
- return [2 /*return*/, payment];
171
+ _c.label = 5;
172
+ case 5: return [2 /*return*/, payment];
173
173
  }
174
174
  });
175
175
  }); };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.23.63",
3
+ "version": "1.23.65",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {