@zeniai/client-epic-state 5.3.2-beta0KB → 5.3.3-beta0KB

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.
@@ -4,6 +4,10 @@ import { getClassById } from '../../../entity/class/classSelector';
4
4
  import { toProjectBasePayload, } from '../../../entity/project/projectPayload';
5
5
  import { getProjectById } from '../../../entity/project/projectSelector';
6
6
  import { getVendorByQboId, getVendorByVendorId, } from '../../../entity/vendor/vendorSelector';
7
+ const POSTING_TYPE_NAME = {
8
+ credit: 'Credit',
9
+ debit: 'Debit',
10
+ };
7
11
  const toRemitToAddressPayload = (address) => {
8
12
  if (address == null) {
9
13
  return undefined;
@@ -35,10 +39,12 @@ const toLinePayload = (state, line, transactionType) => {
35
39
  });
36
40
  }
37
41
  if (transactionType === 'journal_entry') {
38
- lineDetail.posting_type = line.postingType;
42
+ if (line.postingType != null) {
43
+ lineDetail.posting_type_name = POSTING_TYPE_NAME[line.postingType];
44
+ }
39
45
  const vendorQboId = toQboLineVendorId(state, line.vendorQboId);
40
46
  if (vendorQboId != null) {
41
- lineDetail.vendor = { qbo_id: vendorQboId };
47
+ lineDetail.vendor = { vendor_id: vendorQboId };
42
48
  }
43
49
  }
44
50
  return {
@@ -25,14 +25,15 @@ export interface CreateTransactionLineDetailPayload {
25
25
  qbo_id: ID;
26
26
  };
27
27
  /**
28
- * journal_entry only, and it MUST sit inside line_detail. The write validator's docstring
29
- * warns that a misplaced posting_type is silently dropped and then rejected by QBO.
28
+ * journal_entry only, inside line_detail. QBOJournalEntry reads only posting_type_name; a
29
+ * lowercase posting_type is dropped and QBO then rejects the line.
30
30
  */
31
- posting_type?: 'credit' | 'debit';
31
+ posting_type_name?: 'Credit' | 'Debit';
32
32
  /** Same shape the transaction update sends on a vendor line. */
33
33
  project?: ProjectBasePayload;
34
+ /** journal_entry only. The backend reads the QBO vendor id from `vendor_id`, not `qbo_id`. */
34
35
  vendor?: {
35
- qbo_id: ID;
36
+ vendor_id: ID;
36
37
  };
37
38
  }
38
39
  export interface CreateTransactionLinePayload {
@@ -7,6 +7,10 @@ const classSelector_1 = require("../../../entity/class/classSelector");
7
7
  const projectPayload_1 = require("../../../entity/project/projectPayload");
8
8
  const projectSelector_1 = require("../../../entity/project/projectSelector");
9
9
  const vendorSelector_1 = require("../../../entity/vendor/vendorSelector");
10
+ const POSTING_TYPE_NAME = {
11
+ credit: 'Credit',
12
+ debit: 'Debit',
13
+ };
10
14
  const toRemitToAddressPayload = (address) => {
11
15
  if (address == null) {
12
16
  return undefined;
@@ -38,10 +42,12 @@ const toLinePayload = (state, line, transactionType) => {
38
42
  });
39
43
  }
40
44
  if (transactionType === 'journal_entry') {
41
- lineDetail.posting_type = line.postingType;
45
+ if (line.postingType != null) {
46
+ lineDetail.posting_type_name = POSTING_TYPE_NAME[line.postingType];
47
+ }
42
48
  const vendorQboId = toQboLineVendorId(state, line.vendorQboId);
43
49
  if (vendorQboId != null) {
44
- lineDetail.vendor = { qbo_id: vendorQboId };
50
+ lineDetail.vendor = { vendor_id: vendorQboId };
45
51
  }
46
52
  }
47
53
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.3.2-beta0KB",
3
+ "version": "5.3.3-beta0KB",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",