@zeniai/client-epic-state 5.1.29-beta0ND → 5.1.30-beta0AY

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.
Files changed (49) hide show
  1. package/lib/__testHelpers__/apiFailure.json +6 -0
  2. package/lib/entity/customer/customerPayload.js +11 -2
  3. package/lib/entity/transaction/payloadTypes/vendorTransactionPayload.js +1 -1
  4. package/lib/entity/vendor/__mocks__/vendorMock.d.ts +7 -0
  5. package/lib/entity/vendor/__mocks__/vendorMock.js +311 -0
  6. package/lib/entity/vendor/__mocks__/vendorStateMocks.d.ts +8 -0
  7. package/lib/entity/vendor/__mocks__/vendorStateMocks.js +415 -0
  8. package/lib/entity/vendor/vendorPayload.d.ts +2 -4
  9. package/lib/entity/vendor/vendorPayload.js +3 -12
  10. package/lib/entity/vendor/vendorReducer.js +0 -3
  11. package/lib/esm/__testHelpers__/apiFailure.json +6 -0
  12. package/lib/esm/entity/customer/customerPayload.js +11 -2
  13. package/lib/esm/entity/transaction/payloadTypes/vendorTransactionPayload.js +2 -2
  14. package/lib/esm/entity/vendor/__mocks__/vendorMock.js +308 -0
  15. package/lib/esm/entity/vendor/__mocks__/vendorStateMocks.js +412 -0
  16. package/lib/esm/entity/vendor/vendorPayload.js +2 -10
  17. package/lib/esm/entity/vendor/vendorReducer.js +1 -4
  18. package/lib/esm/index.js +2 -2
  19. package/lib/esm/view/accountMappingView/__mocks__/accountMappingSelectorMock.js +4650 -0
  20. package/lib/esm/view/addressView/__mocks__/addressViewMocks.js +203 -0
  21. package/lib/esm/view/addressView/__mocks__/json/createAddressResponse.json +23 -0
  22. package/lib/esm/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +258 -0
  23. package/lib/esm/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +418 -0
  24. package/lib/esm/view/addressView/__mocks__/json/fetchAddressResponse.json +24 -0
  25. package/lib/esm/view/addressView/__mocks__/json/updateAddressResponse.json +24 -0
  26. package/lib/esm/view/commonVendorView/transactionVendorView/transactionVendorViewReducer.js +0 -2
  27. package/lib/esm/view/referralView/referralReducer.js +3 -2
  28. package/lib/esm/view/transactionDetail/epics/markTransactionAsNotMiscategorizedEpic.js +2 -28
  29. package/lib/esm/view/transactionDetail/epics/transactionDetailEpic.js +9 -10
  30. package/lib/index.d.ts +2 -2
  31. package/lib/index.js +7 -6
  32. package/lib/view/accountMappingView/__mocks__/accountMappingSelectorMock.d.ts +11 -0
  33. package/lib/view/accountMappingView/__mocks__/accountMappingSelectorMock.js +4659 -0
  34. package/lib/view/addressView/__mocks__/addressViewMocks.d.ts +35 -0
  35. package/lib/view/addressView/__mocks__/addressViewMocks.js +239 -0
  36. package/lib/view/addressView/__mocks__/json/createAddressResponse.json +23 -0
  37. package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +258 -0
  38. package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +418 -0
  39. package/lib/view/addressView/__mocks__/json/fetchAddressResponse.json +24 -0
  40. package/lib/view/addressView/__mocks__/json/updateAddressResponse.json +24 -0
  41. package/lib/view/commonVendorView/transactionVendorView/transactionVendorViewReducer.js +0 -2
  42. package/lib/view/referralView/referralReducer.d.ts +1 -0
  43. package/lib/view/referralView/referralReducer.js +4 -3
  44. package/lib/view/transactionDetail/epics/markTransactionAsNotMiscategorizedEpic.js +2 -28
  45. package/lib/view/transactionDetail/epics/transactionDetailEpic.js +8 -9
  46. package/package.json +70 -38
  47. package/lib/commonPayloadTypes/payloadIdentifier.d.ts +0 -6
  48. package/lib/commonPayloadTypes/payloadIdentifier.js +0 -18
  49. package/lib/esm/commonPayloadTypes/payloadIdentifier.js +0 -14
@@ -0,0 +1,6 @@
1
+ {
2
+ "status": {
3
+ "message": "Internal server error",
4
+ "code": 500
5
+ }
6
+ }
@@ -2,14 +2,23 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toCustomer = exports.toCustomerBasePayload = exports.toCustomerBase = exports.getCustomerPayloadIdentifier = void 0;
4
4
  const urlPayload_1 = require("../../commonPayloadTypes/urlPayload");
5
- const payloadIdentifier_1 = require("../../commonPayloadTypes/payloadIdentifier");
6
5
  const zeniDayJS_1 = require("../../zeniDayJS");
7
6
  /**
8
7
  * Resolves the effective customer identifier from a payload.
9
8
  * For JE/Deposit transactions, customer_id is null at runtime — qbo_id is the
10
9
  * actual identity.
11
10
  */
12
- const getCustomerPayloadIdentifier = (customer) => (0, payloadIdentifier_1.resolvePayloadIdentifier)(customer.customer_id, customer.qbo_id);
11
+ const getCustomerPayloadIdentifier = (customer) => {
12
+ const cid = customer.customer_id;
13
+ if (cid != null && cid !== '') {
14
+ return cid;
15
+ }
16
+ const qid = customer.qbo_id;
17
+ if (qid != null && qid !== '') {
18
+ return qid;
19
+ }
20
+ return null;
21
+ };
13
22
  exports.getCustomerPayloadIdentifier = getCustomerPayloadIdentifier;
14
23
  const toCustomerBase = (payload, parseOutParentName) => {
15
24
  const id = (0, exports.getCustomerPayloadIdentifier)(payload);
@@ -15,7 +15,7 @@ function buildVendorTransactionBase(payload) {
15
15
  return {
16
16
  ...transaction,
17
17
  documentId: payload.document_id,
18
- vendor: (0, vendorPayload_1.getVendorPayloadIdentifier)(payload) != null
18
+ vendor: payload.vendor_id != null
19
19
  ? (0, vendorPayload_1.mapVendorBasePayloadToVendorBase)(payload)
20
20
  : undefined,
21
21
  paymentType: (0, paymentType_1.toPaymentTypeStrict)(payload.payment_type),
@@ -0,0 +1,7 @@
1
+ import { ID } from '../../../commonStateTypes/common';
2
+ import { VendorPayload } from '../vendorPayload';
3
+ import { VendorState } from '../vendorState';
4
+ export declare const vendorPaylod: VendorPayload[];
5
+ export declare const vendorStateWithVendors: VendorState;
6
+ export declare const vendorIdToBeRemoved: ID;
7
+ export declare const vendorStateAfterRemoval: VendorState;
@@ -0,0 +1,311 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.vendorStateAfterRemoval = exports.vendorIdToBeRemoved = exports.vendorStateWithVendors = exports.vendorPaylod = void 0;
4
+ const vendorStateMocks_1 = require("./vendorStateMocks");
5
+ exports.vendorPaylod = [
6
+ {
7
+ vendor_id: 'vendor_j12jh1g2g12jg3jh12:12',
8
+ transaction_attachments: [],
9
+ qbo_id: '12',
10
+ vendor_name: 'Sample Vendor 1',
11
+ legal_name: 'Sample Vendor 1',
12
+ title: '',
13
+ suffix: '',
14
+ first_name: 'Sample',
15
+ middle_name: '',
16
+ last_name: 'Vendor',
17
+ vendor_type: 'individual',
18
+ logo: {
19
+ url: '',
20
+ base64: '',
21
+ },
22
+ year_to_date_spend: 0,
23
+ last_30_days_spend: 0,
24
+ last_90_days_spend: 0,
25
+ last_month_spend: 0,
26
+ last_3_months_spend: 0,
27
+ last_6_months_spend: 0,
28
+ last_12_months_spend: 0,
29
+ previous_year_spend: 0,
30
+ owner: null,
31
+ balance: 0,
32
+ is_deleted: false,
33
+ qbo_create_time: '2022-01-24T05:59:37.057383',
34
+ qbo_update_time: '2022-01-24T05:59:37.057383',
35
+ create_time: '2022-01-24T05:59:37.057383',
36
+ update_time: '2022-01-24T05:59:37.057383',
37
+ sync_token: '1',
38
+ email: '',
39
+ phone: '',
40
+ website_url: '',
41
+ currency_code: 'USD',
42
+ currency_symbol: '$',
43
+ country_code: 'US',
44
+ account: {
45
+ qbo_id: '12',
46
+ coa_id: '123',
47
+ labels: [],
48
+ account_id: 'Travel Meals',
49
+ account_name: 'Travel Meals',
50
+ },
51
+ accounting_class: {
52
+ accounting_class_id: 'class_e0f33254-2651-4d5c-9d57-2611788265ca',
53
+ accounting_class_name: 'product 500',
54
+ accounting_class_number: '4011',
55
+ fully_qualified_accounting_class_name: 'product 500',
56
+ qbo_id: '5100000000000040143',
57
+ },
58
+ contacts: [
59
+ {
60
+ full_name: 'Aniket Patil',
61
+ phone: '+91-8xxxxxxxx',
62
+ email: 'aniket@personalmail.com',
63
+ contact_id: 'contacts_f3881db1-35c0-4699-891c-6cca724e75d6',
64
+ },
65
+ {
66
+ full_name: 'Ankit Singh',
67
+ phone: '+91-8xxxxxxxx',
68
+ email: 'ankit@personalmail.com',
69
+ contact_id: 'contacts_6856c987-17ff-44a4-aad3-eef4b7696554',
70
+ },
71
+ ],
72
+ address: {
73
+ address_id: 'a_e3e99a8b-d400-42ac-ae09-e655bff1af97',
74
+ city: 'Bangalore',
75
+ country: 'India',
76
+ country_code: null,
77
+ create_time: '2022-02-01T15:47:44.681429',
78
+ hash_value: '2be1de50bedd7a2dfb8094846698b2b8bc86869bf903c27b69b74ae3e2651983',
79
+ latitude: null,
80
+ longitude: null,
81
+ postal_code: '560001',
82
+ state: 'Karnataka',
83
+ street: ['2nd lane', 'Opp Peter England showroom', 'Mg Road'],
84
+ update_time: '2022-02-01T15:47:44.681439',
85
+ },
86
+ shipping_address: null,
87
+ bank_account_ids: [
88
+ 'bank_adg67-asnds-a6sad-sdfgf8',
89
+ 'bank_asghj-hags23-hgfjh-g3asfas',
90
+ ],
91
+ bank_accounts: [
92
+ {
93
+ bank_account_id: 'bank_adg67-asnds-a6sad-sdfgf8',
94
+ bank_branch_id: 'HDFC000547',
95
+ bank_branch_name: 'Khadki',
96
+ bank_account_number: '201301203012013012',
97
+ bank_account_name: 'Person/Company Name',
98
+ bank_name: 'HDFC Bank',
99
+ bank_routing_number_ach: '210000000',
100
+ bank_routing_number_wire_transfer: '210000000',
101
+ note: '',
102
+ is_deleted: false,
103
+ update_time: '2022-02-01T15:47:44.681439',
104
+ create_time: '2022-02-01T15:47:44.681439',
105
+ bank_swift_code: null,
106
+ bank_account_iban: null,
107
+ bank_account_type: null,
108
+ },
109
+ {
110
+ bank_account_id: 'bank_asghj-hags23-hgfjh-g3asfas',
111
+ bank_branch_id: 'ICICI00004',
112
+ bank_branch_name: 'Baner',
113
+ bank_account_number: '20130120301286273826',
114
+ bank_account_name: 'Person/Company Name',
115
+ bank_name: 'ICICI Bank',
116
+ bank_routing_number_ach: '110000000',
117
+ bank_routing_number_wire_transfer: '110000000',
118
+ note: '',
119
+ is_deleted: false,
120
+ update_time: '2022-02-01T15:47:44.681439',
121
+ create_time: '2022-02-01T15:47:44.681439',
122
+ bank_swift_code: null,
123
+ bank_account_iban: null,
124
+ bank_account_type: null,
125
+ },
126
+ ],
127
+ payment_instrument_ids: ['pay_inst_f3fc9b06-694a-4609-a710-b0e1d4de72d3'],
128
+ payment_instruments: [
129
+ {
130
+ account_source: 'email',
131
+ create_time: '2023-12-17T11:29:27.544391',
132
+ display_text: 'UPI ID - lgtextiles@okicici',
133
+ labels: [
134
+ {
135
+ key: 'Account Holder Name',
136
+ value: 'LG Textiles',
137
+ },
138
+ {
139
+ key: 'UPI ID',
140
+ value: 'lgtextiles@okicici',
141
+ },
142
+ {
143
+ key: 'Source',
144
+ value: 'email',
145
+ },
146
+ {
147
+ key: 'Type of account',
148
+ value: 'indian_upi',
149
+ },
150
+ ],
151
+ max_valid_amount: 100000,
152
+ min_valid_amount: 0,
153
+ pi_display_number: 'lgtextiles@okicici',
154
+ update_time: '2023-12-17T11:29:27.544396',
155
+ zeni_payment_instrument_id: 'pay_inst_f3fc9b06-694a-4609-a710-b0e1d4de72d3',
156
+ },
157
+ ],
158
+ vendor_currency_code: 'USD',
159
+ vendor_currency_symbol: '$',
160
+ vendor_1099_status: 'incomplete',
161
+ tin: { type: 'ein', value: '550258131' },
162
+ },
163
+ {
164
+ vendor_id: 'vendor_j12jh1g2g12jg3jh12:2',
165
+ transaction_attachments: [],
166
+ qbo_id: '13',
167
+ vendor_name: 'Sample Vendor 2',
168
+ legal_name: 'Sample Vendor 2',
169
+ title: '',
170
+ suffix: '',
171
+ first_name: 'Sample',
172
+ middle_name: '',
173
+ last_name: 'Vendor 3',
174
+ vendor_type: 'c_corporation',
175
+ logo: {
176
+ url: '',
177
+ base64: '',
178
+ },
179
+ last_month_spend: 0,
180
+ last_3_months_spend: 0,
181
+ last_6_months_spend: 0,
182
+ last_12_months_spend: 0,
183
+ previous_year_spend: 0,
184
+ owner: null,
185
+ balance: 0,
186
+ is_deleted: false,
187
+ qbo_create_time: '2022-01-24T05:59:37.057383',
188
+ qbo_update_time: '2022-01-24T05:59:37.057383',
189
+ create_time: '2022-01-24T05:59:37.057383',
190
+ update_time: '2022-01-24T05:59:37.057383',
191
+ sync_token: '1',
192
+ email: '',
193
+ phone: '',
194
+ website_url: '',
195
+ currency_code: 'USD',
196
+ currency_symbol: '$',
197
+ country_code: 'US',
198
+ contacts: [
199
+ {
200
+ full_name: 'Aniket Patil',
201
+ phone: '+91-8xxxxxxxx',
202
+ email: 'aniket@personalmail.com',
203
+ contact_id: 'contacts_f3881db1-35c0-4699-891c-6cca724e75d6',
204
+ },
205
+ {
206
+ full_name: 'Ankit Singh',
207
+ phone: '+91-8xxxxxxxx',
208
+ email: 'ankit@personalmail.com',
209
+ contact_id: 'contacts_6856c987-17ff-44a4-aad3-eef4b7696554',
210
+ },
211
+ ],
212
+ account: {
213
+ qbo_id: '12',
214
+ coa_id: '123',
215
+ labels: [],
216
+ account_id: 'Travel Meals',
217
+ account_name: 'Travel Meals',
218
+ },
219
+ accounting_class: {
220
+ accounting_class_id: 'class_e0f33254-2651-4d5c-9d57-2611788265ca',
221
+ accounting_class_name: 'product 500',
222
+ accounting_class_number: '4011',
223
+ fully_qualified_accounting_class_name: 'product 500',
224
+ qbo_id: '5100000000000040143',
225
+ },
226
+ shipping_address: null,
227
+ bank_accounts: [
228
+ {
229
+ bank_account_id: 'bank_asghj-hgfjh-g3asfas-hags23',
230
+ bank_branch_id: 'SBINOOOO9765',
231
+ bank_branch_name: 'Wakad',
232
+ bank_account_number: '20130120301286273826',
233
+ bank_account_name: 'Person/Company Name',
234
+ bank_name: 'SBI Bank',
235
+ bank_routing_number_ach: '410000000',
236
+ bank_routing_number_wire_transfer: '310000000',
237
+ note: '',
238
+ is_deleted: false,
239
+ update_time: '2022-02-01T15:47:44.681439',
240
+ create_time: '2022-02-01T15:47:44.681439',
241
+ bank_swift_code: null,
242
+ bank_account_iban: null,
243
+ bank_account_type: null,
244
+ },
245
+ {
246
+ bank_account_id: 'bank_g3asfas-hags23-hgfjh-asghj',
247
+ bank_branch_id: 'UBI0014267',
248
+ bank_branch_name: 'SB Road',
249
+ bank_account_number: '20130120301286273826',
250
+ bank_account_name: 'Person/Company Name',
251
+ bank_name: 'SBI Bank',
252
+ bank_routing_number_ach: '510000000',
253
+ bank_routing_number_wire_transfer: '610000000',
254
+ note: '',
255
+ is_deleted: false,
256
+ update_time: '2022-02-01T15:47:44.681439',
257
+ create_time: '2022-02-01T15:47:44.681439',
258
+ bank_swift_code: null,
259
+ bank_account_iban: null,
260
+ bank_account_type: null,
261
+ },
262
+ ],
263
+ payment_instrument_ids: ['pay_inst_f3fc9b06-694a-4609-a710-b0e1d4de72d3'],
264
+ payment_instruments: [
265
+ {
266
+ account_source: 'email',
267
+ create_time: '2023-12-17T11:29:27.544391',
268
+ display_text: 'UPI ID - lgtextiles@okicici',
269
+ labels: [
270
+ {
271
+ key: 'Account Holder Name',
272
+ value: 'LG Textiles',
273
+ },
274
+ {
275
+ key: 'UPI ID',
276
+ value: 'lgtextiles@okicici',
277
+ },
278
+ {
279
+ key: 'Source',
280
+ value: 'email',
281
+ },
282
+ {
283
+ key: 'Type of account',
284
+ value: 'indian_upi',
285
+ },
286
+ ],
287
+ max_valid_amount: 100000,
288
+ min_valid_amount: 0,
289
+ pi_display_number: 'lgtextiles@okicici',
290
+ update_time: '2023-12-17T11:29:27.544396',
291
+ zeni_payment_instrument_id: 'pay_inst_f3fc9b06-694a-4609-a710-b0e1d4de72d3',
292
+ },
293
+ ],
294
+ vendor_currency_code: 'USD',
295
+ vendor_currency_symbol: '$',
296
+ vendor_1099_status: 'incomplete',
297
+ tin: { type: 'ein', value: '550258131' },
298
+ },
299
+ ];
300
+ exports.vendorStateWithVendors = {
301
+ vendorByID: {
302
+ 'vendor_j12jh1g2g12jg3jh12:12': vendorStateMocks_1.vendorStateMock1,
303
+ 'vendor_j12jh1g2g12jg3jh12:2': vendorStateMocks_1.vendorStateMock2,
304
+ },
305
+ };
306
+ exports.vendorIdToBeRemoved = 'vendor_j12jh1g2g12jg3jh12:2';
307
+ exports.vendorStateAfterRemoval = {
308
+ vendorByID: {
309
+ 'vendor_j12jh1g2g12jg3jh12:12': vendorStateMocks_1.vendorStateMock1,
310
+ },
311
+ };
@@ -0,0 +1,8 @@
1
+ import { Vendor } from '../vendorState';
2
+ export declare const vendorStateMock1: Vendor;
3
+ export declare const vendorStateMock2: Vendor;
4
+ export declare const vendorStateMock4: Vendor;
5
+ export declare const vendorStateMock5: Vendor;
6
+ export declare const vendorStateMock6: Vendor;
7
+ export declare const vendorStateMock7: Vendor;
8
+ export declare const vendorStateMock8: Vendor;