rerobe-js-orm 3.4.5 → 3.4.7

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.
@@ -14,3 +14,91 @@ export namespace CUSTOMER_CREDIT_REASONS {
14
14
  const customerCompensation: string;
15
15
  const refund: string;
16
16
  }
17
+ export const SellerProductLedgerStatusStatusDescriptionsActions: {
18
+ Pending: {
19
+ description: string;
20
+ action: string;
21
+ };
22
+ "To Pay": {
23
+ description: string;
24
+ action: string;
25
+ };
26
+ Paid: {
27
+ description: string;
28
+ action: string;
29
+ };
30
+ Disputed: {
31
+ description: string;
32
+ action: string;
33
+ };
34
+ Resolved: {
35
+ description: string;
36
+ action: string;
37
+ };
38
+ Refunded: {
39
+ description: string;
40
+ action: string;
41
+ };
42
+ Cancelled: {
43
+ description: string;
44
+ action: string;
45
+ };
46
+ "In Progress": {
47
+ description: string;
48
+ action: string;
49
+ };
50
+ };
51
+ export namespace SellerLedgerActivityLogActionsDescriptions {
52
+ namespace ITEM_SOLD {
53
+ const description: string;
54
+ const action: string;
55
+ }
56
+ namespace ITEM_RETURNED {
57
+ const description_1: string;
58
+ export { description_1 as description };
59
+ const action_1: string;
60
+ export { action_1 as action };
61
+ }
62
+ namespace PAYMENT_INITIATED {
63
+ const description_2: string;
64
+ export { description_2 as description };
65
+ const action_2: string;
66
+ export { action_2 as action };
67
+ }
68
+ namespace PAYMENT_COMPLETED {
69
+ const description_3: string;
70
+ export { description_3 as description };
71
+ const action_3: string;
72
+ export { action_3 as action };
73
+ }
74
+ namespace PAYMENT_FAILED {
75
+ const description_4: string;
76
+ export { description_4 as description };
77
+ const action_4: string;
78
+ export { action_4 as action };
79
+ }
80
+ namespace DISPUTE_RAISED {
81
+ const description_5: string;
82
+ export { description_5 as description };
83
+ const action_5: string;
84
+ export { action_5 as action };
85
+ }
86
+ namespace DISPUTE_RESOLVED {
87
+ const description_6: string;
88
+ export { description_6 as description };
89
+ const action_6: string;
90
+ export { action_6 as action };
91
+ }
92
+ namespace REFUND_ISSUED {
93
+ const description_7: string;
94
+ export { description_7 as description };
95
+ const action_7: string;
96
+ export { action_7 as action };
97
+ }
98
+ namespace TRANSACTION_CANCELLED {
99
+ const description_8: string;
100
+ export { description_8 as description };
101
+ const action_8: string;
102
+ export { action_8 as action };
103
+ }
104
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CUSTOMER_CREDIT_REASONS = exports.TRANSACTION_TYPES = void 0;
3
+ exports.SellerLedgerActivityLogActionsDescriptions = exports.SellerProductLedgerStatusStatusDescriptionsActions = exports.CUSTOMER_CREDIT_REASONS = exports.TRANSACTION_TYPES = void 0;
4
4
  exports.TRANSACTION_TYPES = {
5
5
  merchantCredit: 'MERCHANT_CREDIT',
6
6
  merchantDebit: 'MERCHANT_DEBIT',
@@ -17,3 +17,75 @@ exports.CUSTOMER_CREDIT_REASONS = {
17
17
  customerCompensation: 'CUSTOMER_COMPENSATION',
18
18
  refund: 'REFUND',
19
19
  };
20
+ exports.SellerProductLedgerStatusStatusDescriptionsActions = {
21
+ [SellerProductLedgerStatus.PENDING]: {
22
+ description: 'This status is assigned when an item is sold but is still within the return or refund period. The transaction is recorded but not finalized.',
23
+ action: 'Monitor for returns or disputes.',
24
+ },
25
+ [SellerProductLedgerStatus.TO_PAY]: {
26
+ description: 'Once the return period has expired without a return or dispute, the transaction status updates to indicate the merchant owes payment to the seller.',
27
+ action: 'Prepare to disburse payment to the seller.',
28
+ },
29
+ [SellerProductLedgerStatus.PAID]: {
30
+ description: 'This status indicates that payment has been disbursed to the seller.',
31
+ action: 'Archive the transaction for record-keeping and financial reconciliation.',
32
+ },
33
+ [SellerProductLedgerStatus.DISPUTED]: {
34
+ description: 'If the buyer raises a dispute within the return period (or possibly slightly beyond, depending on policy), this status is used.',
35
+ action: "Hold the transaction from proceeding to 'To Pay' until the dispute is resolved.",
36
+ },
37
+ [SellerProductLedgerStatus.RESOLVED]: {
38
+ description: 'Post-dispute, whether the dispute is resolved in favor of the seller or the buyer, this status indicates a conclusion has been reached.',
39
+ action: "If resolved in favor of the seller, move to 'To Pay' or 'Paid' as appropriate. If in favor of the buyer, adjust the ledger to reflect the return/refund.",
40
+ },
41
+ [SellerProductLedgerStatus.REFUNDED]: {
42
+ description: 'Indicates that a return was processed, and the buyer was refunded, canceling the obligation to pay the seller.',
43
+ action: 'Adjust the ledger to remove the obligation for payment to the seller.',
44
+ },
45
+ [SellerProductLedgerStatus.CANCELLED]: {
46
+ description: 'The transaction was cancelled before completion due to various reasons (e.g., item out of stock, order error).',
47
+ action: 'No payment obligation; adjust ledger to reflect cancellation.',
48
+ },
49
+ [SellerProductLedgerStatus.IN_PROGRESS]: {
50
+ description: "For use in cases where payment is being processed but hasn't been finalized yet (e.g., bank transfers).",
51
+ action: "Monitor until payment is completed, then change to 'Paid'.",
52
+ },
53
+ };
54
+ exports.SellerLedgerActivityLogActionsDescriptions = {
55
+ [SellerLedgerActivityLogAction.ITEM_SOLD]: {
56
+ description: 'A product has been sold.',
57
+ action: 'Record the sale and monitor the return period.',
58
+ },
59
+ [SellerLedgerActivityLogAction.ITEM_RETURNED]: {
60
+ description: 'A sold product has been returned.',
61
+ action: 'Process the return and update the ledger accordingly.',
62
+ },
63
+ [SellerLedgerActivityLogAction.PAYMENT_INITIATED]: {
64
+ description: 'Payment to the seller has been initiated.',
65
+ action: 'Monitor the payment process until completion.',
66
+ },
67
+ [SellerLedgerActivityLogAction.PAYMENT_COMPLETED]: {
68
+ description: 'Payment to the seller has been successfully completed.',
69
+ action: "Update the ledger to reflect the payment status as 'Paid'.",
70
+ },
71
+ [SellerLedgerActivityLogAction.PAYMENT_FAILED]: {
72
+ description: 'Payment to the seller has failed.',
73
+ action: 'Investigate the failure reason and attempt to reprocess the payment.',
74
+ },
75
+ [SellerLedgerActivityLogAction.DISPUTE_RAISED]: {
76
+ description: 'A dispute has been raised regarding a transaction.',
77
+ action: 'Hold the transaction and engage in dispute resolution processes.',
78
+ },
79
+ [SellerLedgerActivityLogAction.DISPUTE_RESOLVED]: {
80
+ description: 'The dispute has been resolved.',
81
+ action: 'Update the transaction status based on the resolution outcome.',
82
+ },
83
+ [SellerLedgerActivityLogAction.REFUND_ISSUED]: {
84
+ description: 'A refund has been issued for a transaction.',
85
+ action: 'Adjust the ledger to reflect the refunded transaction.',
86
+ },
87
+ [SellerLedgerActivityLogAction.TRANSACTION_CANCELLED]: {
88
+ description: 'The transaction has been cancelled.',
89
+ action: 'Update the ledger to cancel the transaction and adjust any related financial records.',
90
+ },
91
+ };
@@ -185,6 +185,14 @@ class Utilities {
185
185
  'Suit Jacket': '',
186
186
  'Shirts & Blouses': '',
187
187
  Outerwear: '',
188
+ Klänningar: 'Klänning',
189
+ Kavajer: 'Kavaj',
190
+ Ytterplagg: '',
191
+ Klockor: 'Klocka',
192
+ Träning: '',
193
+ 'Skjortor & Blusar': '',
194
+ Kjolar: 'Kjol',
195
+ Toppar: 'Topp',
188
196
  // ... potentially more irregulars
189
197
  };
190
198
  if (irregulars.hasOwnProperty(word)) {
@@ -0,0 +1,36 @@
1
+ import Base from '../Base';
2
+ export default class SellerProductLedger extends Base {
3
+ documentId: string;
4
+ createdAtTimestamp: number;
5
+ updatedAtTimestamp: number;
6
+ merchantId: string;
7
+ merchantCurrency: string;
8
+ sellerId: string;
9
+ sellerFirstName: string;
10
+ sellerLastName: string;
11
+ sellerEmail: string;
12
+ productId: string;
13
+ orderId: string;
14
+ productTitle: string;
15
+ productImgUrl: string;
16
+ merchantCommission: string | number;
17
+ priceSold: string | number;
18
+ amountOwedToSeller: string | number;
19
+ status: SellerProductLedgerStatus;
20
+ feesForSeller: Fee[];
21
+ activityLog: ActivityLog[];
22
+ constructor(props?: any);
23
+ toObj(): SellerProductLedgerType;
24
+ generateSchemaForTypesense(name?: string): {
25
+ default_sorting_field: string;
26
+ fields: {
27
+ name: string;
28
+ type: string;
29
+ facet: boolean;
30
+ }[];
31
+ name: string;
32
+ };
33
+ toObjForTypesense(): TypesenseSellerProductLedgerObj;
34
+ addActivityLogEntry(logEntry: ActivityLog): void;
35
+ addFeeEntry(feeEntry: Fee): void;
36
+ }
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const Base_1 = require("../Base");
4
+ class SellerProductLedger extends Base_1.default {
5
+ constructor(props) {
6
+ super();
7
+ this.documentId = this.utilities.sanitizeString(props === null || props === void 0 ? void 0 : props.documentId) || this.utilities.makeRandId(28);
8
+ this.createdAtTimestamp = this.utilities.sanitizeMillisTimeStamp(props === null || props === void 0 ? void 0 : props.createdAtTimestamp);
9
+ this.updatedAtTimestamp = this.utilities.sanitizeMillisTimeStamp(props === null || props === void 0 ? void 0 : props.createdAtTimestamp);
10
+ this.merchantId = this.utilities.sanitizeString(props === null || props === void 0 ? void 0 : props.merchantId);
11
+ this.merchantCurrency = this.utilities.sanitizeString(props === null || props === void 0 ? void 0 : props.merchantCurrency);
12
+ this.sellerId = this.utilities.sanitizeString(props === null || props === void 0 ? void 0 : props.sellerId);
13
+ this.orderId = this.utilities.sanitizeString(props === null || props === void 0 ? void 0 : props.orderId);
14
+ this.sellerFirstName = this.utilities.sanitizeString(props === null || props === void 0 ? void 0 : props.sellerFirstName);
15
+ this.sellerLastName = this.utilities.sanitizeString(props === null || props === void 0 ? void 0 : props.sellerLastName);
16
+ this.sellerEmail = this.utilities.sanitizeString(props === null || props === void 0 ? void 0 : props.sellerEmail);
17
+ this.productId = this.utilities.sanitizeString(props === null || props === void 0 ? void 0 : props.productId);
18
+ this.productTitle = this.utilities.sanitizeString(props === null || props === void 0 ? void 0 : props.productTitle);
19
+ this.productImgUrl = this.utilities.sanitizeString(props === null || props === void 0 ? void 0 : props.productImgUrl);
20
+ this.merchantCommission = this.utilities.sanitizeNumber(props === null || props === void 0 ? void 0 : props.merchantCommission);
21
+ this.priceSold = this.utilities.sanitizeNumber(props === null || props === void 0 ? void 0 : props.priceSold);
22
+ this.amountOwedToSeller = this.utilities.sanitizeNumber(props === null || props === void 0 ? void 0 : props.amountOwedToSeller);
23
+ this.status = this.utilities.sanitizeString((props === null || props === void 0 ? void 0 : props.status) || SellerProductLedgerStatus.PENDING);
24
+ this.feesForSeller = Array.isArray(props === null || props === void 0 ? void 0 : props.feesForSeller) ? props === null || props === void 0 ? void 0 : props.feesForSeller : [];
25
+ this.activityLog = Array.isArray(props === null || props === void 0 ? void 0 : props.activityLog) ? props === null || props === void 0 ? void 0 : props.activityLog : [];
26
+ }
27
+ toObj() {
28
+ const ledgerObj = {
29
+ documentId: this.documentId,
30
+ createdAtTimestamp: this.createdAtTimestamp,
31
+ updatedAtTimestamp: this.updatedAtTimestamp,
32
+ merchantId: this.merchantId,
33
+ merchantCurrency: this.merchantCurrency,
34
+ sellerId: this.sellerId,
35
+ sellerFirstName: this.sellerFirstName,
36
+ sellerLastName: this.sellerLastName,
37
+ sellerEmail: this.sellerEmail,
38
+ orderId: this.orderId,
39
+ productId: this.productId,
40
+ productTitle: this.productTitle,
41
+ productImgUrl: this.productImgUrl,
42
+ merchantCommission: this.merchantCommission,
43
+ priceSold: this.priceSold,
44
+ amountOwedToSeller: this.amountOwedToSeller,
45
+ status: this.status,
46
+ feesForSeller: this.feesForSeller,
47
+ activityLog: this.activityLog,
48
+ };
49
+ return ledgerObj;
50
+ }
51
+ generateSchemaForTypesense(name = 'prod_sellerProductLedger_20240223') {
52
+ return {
53
+ default_sorting_field: 'createdAtTimestamp',
54
+ fields: [
55
+ { name: 'documentId', type: 'string', facet: false },
56
+ { name: 'createdAtTimestamp', type: 'int64', facet: true },
57
+ { name: 'updatedAtTimestamp', type: 'int64', facet: true },
58
+ { name: 'merchantId', type: 'string', facet: true },
59
+ { name: 'merchantCurrency', type: 'string', facet: true },
60
+ { name: 'sellerId', type: 'string', facet: true },
61
+ { name: 'sellerFirstName', type: 'string', facet: false },
62
+ { name: 'sellerLastName', type: 'string', facet: false },
63
+ { name: 'sellerEmail', type: 'string', facet: true },
64
+ { name: 'productId', type: 'string', facet: true },
65
+ { name: 'orderId', type: 'string', facet: true },
66
+ { name: 'productTitle', type: 'string', facet: true },
67
+ { name: 'productImgUrl', type: 'string', facet: false },
68
+ { name: 'merchantCommission', type: 'float', facet: true },
69
+ { name: 'priceSold', type: 'float', facet: true },
70
+ { name: 'amountOwedToSeller', type: 'float', facet: true },
71
+ { name: 'status', type: 'string', facet: true },
72
+ { name: 'feesForSeller', type: 'object[]', facet: false },
73
+ { name: 'activityLog', type: 'object[]', facet: false },
74
+ ],
75
+ name,
76
+ };
77
+ }
78
+ toObjForTypesense() {
79
+ const stagedObj = {
80
+ documentId: this.utilities.sanitizeString(this.documentId),
81
+ createdAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.createdAtTimestamp),
82
+ updatedAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.updatedAtTimestamp),
83
+ merchantId: this.utilities.sanitizeString(this.merchantId),
84
+ merchantCurrency: this.utilities.sanitizeString(this.merchantCurrency),
85
+ sellerId: this.utilities.sanitizeString(this.sellerId),
86
+ sellerFirstName: this.utilities.sanitizeString(this.sellerFirstName),
87
+ sellerLastName: this.utilities.sanitizeString(this.sellerLastName),
88
+ sellerEmail: this.utilities.sanitizeString(this.sellerEmail),
89
+ productId: this.utilities.sanitizeString(this.productId),
90
+ orderId: this.utilities.sanitizeString(this.orderId),
91
+ productTitle: this.utilities.sanitizeString(this.productTitle),
92
+ productImgUrl: this.utilities.sanitizeString(this.productImgUrl),
93
+ merchantCommission: this.utilities.sanitizeNumber(this.merchantCommission),
94
+ priceSold: this.utilities.sanitizeNumber(this.priceSold),
95
+ amountOwedToSeller: this.utilities.sanitizeNumber(this.amountOwedToSeller),
96
+ status: this.utilities.sanitizeString(this.status),
97
+ feesForSeller: this.feesForSeller.map((fee) => ({
98
+ name: this.utilities.sanitizeString(fee.name),
99
+ amount: this.utilities.sanitizeNumber(fee.amount),
100
+ })),
101
+ activityLog: this.activityLog.map((log) => ({
102
+ logId: this.utilities.sanitizeString(log.logId),
103
+ timestamp: this.utilities.sanitizeMillisTimeStamp(log.timestamp),
104
+ action: this.utilities.sanitizeString(log.action),
105
+ details: this.utilities.sanitizeString(log.details),
106
+ actorId: this.utilities.sanitizeString(log.actorId),
107
+ actorType: this.utilities.sanitizeString(log.actorType),
108
+ data: (log === null || log === void 0 ? void 0 : log.data) && Object.keys(log === null || log === void 0 ? void 0 : log.data).length ? log === null || log === void 0 ? void 0 : log.data : {},
109
+ })),
110
+ };
111
+ return stagedObj;
112
+ }
113
+ addActivityLogEntry(logEntry) {
114
+ this.activityLog.push(logEntry);
115
+ }
116
+ addFeeEntry(feeEntry) {
117
+ this.feesForSeller.push(feeEntry);
118
+ }
119
+ }
120
+ exports.default = SellerProductLedger;
@@ -85,3 +85,79 @@ declare type TypesenseCustomerLedgerTransactionObj = {
85
85
  description: string;
86
86
  reason: string;
87
87
  };
88
+ declare type SellerProductLedgerType = {
89
+ documentId: string;
90
+ createdAtTimestamp: number;
91
+ updatedAtTimestamp: number;
92
+ merchantId: string;
93
+ merchantCurrency: string;
94
+ sellerId: string;
95
+ sellerFirstName: string;
96
+ sellerLastName: string;
97
+ sellerEmail: string;
98
+ orderId: string;
99
+ productId: string;
100
+ productTitle: string;
101
+ productImgUrl: string;
102
+ merchantCommission: string | number;
103
+ priceSold: string | number;
104
+ amountOwedToSeller: string | number;
105
+ status: SellerProductLedgerStatus;
106
+ feesForSeller: Fee[];
107
+ activityLog: ActivityLog[];
108
+ };
109
+ declare type TypesenseSellerProductLedgerObj = {
110
+ documentId: string;
111
+ createdAtTimestamp: number;
112
+ updatedAtTimestamp: number;
113
+ merchantId: string;
114
+ merchantCurrency: string;
115
+ sellerId: string;
116
+ sellerFirstName: string;
117
+ sellerLastName: string;
118
+ sellerEmail: string;
119
+ productId: string;
120
+ orderId: string;
121
+ productTitle: string;
122
+ productImgUrl: string;
123
+ merchantCommission: string | number;
124
+ priceSold: string | number;
125
+ amountOwedToSeller: string | number;
126
+ status: string;
127
+ feesForSeller: Fee[];
128
+ activityLog: ActivityLog[];
129
+ };
130
+ interface Fee {
131
+ name: string;
132
+ amount: number;
133
+ }
134
+ declare enum SellerProductLedgerStatus {
135
+ PENDING = "Pending",
136
+ TO_PAY = "To Pay",
137
+ PAID = "Paid",
138
+ DISPUTED = "Disputed",
139
+ RESOLVED = "Resolved",
140
+ REFUNDED = "Refunded",
141
+ CANCELLED = "Cancelled",
142
+ IN_PROGRESS = "In Progress"
143
+ }
144
+ declare enum SellerLedgerActivityLogAction {
145
+ ITEM_SOLD = "ITEM_SOLD",
146
+ ITEM_RETURNED = "ITEM_RETURNED",
147
+ PAYMENT_INITIATED = "PAYMENT_INITIATED",
148
+ PAYMENT_COMPLETED = "PAYMENT_COMPLETED",
149
+ PAYMENT_FAILED = "PAYMENT_FAILED",
150
+ DISPUTE_RAISED = "DISPUTE_RAISED",
151
+ DISPUTE_RESOLVED = "DISPUTE_RESOLVED",
152
+ REFUND_ISSUED = "REFUND_ISSUED",
153
+ TRANSACTION_CANCELLED = "TRANSACTION_CANCELLED"
154
+ }
155
+ interface ActivityLog {
156
+ logId: string;
157
+ timestamp: number;
158
+ action: SellerLedgerActivityLogAction;
159
+ details: string;
160
+ actorId: string;
161
+ actorType: string;
162
+ data?: any;
163
+ }
@@ -1 +1,24 @@
1
1
  "use strict";
2
+ var SellerProductLedgerStatus;
3
+ (function (SellerProductLedgerStatus) {
4
+ SellerProductLedgerStatus["PENDING"] = "Pending";
5
+ SellerProductLedgerStatus["TO_PAY"] = "To Pay";
6
+ SellerProductLedgerStatus["PAID"] = "Paid";
7
+ SellerProductLedgerStatus["DISPUTED"] = "Disputed";
8
+ SellerProductLedgerStatus["RESOLVED"] = "Resolved";
9
+ SellerProductLedgerStatus["REFUNDED"] = "Refunded";
10
+ SellerProductLedgerStatus["CANCELLED"] = "Cancelled";
11
+ SellerProductLedgerStatus["IN_PROGRESS"] = "In Progress";
12
+ })(SellerProductLedgerStatus || (SellerProductLedgerStatus = {}));
13
+ var SellerLedgerActivityLogAction;
14
+ (function (SellerLedgerActivityLogAction) {
15
+ SellerLedgerActivityLogAction["ITEM_SOLD"] = "ITEM_SOLD";
16
+ SellerLedgerActivityLogAction["ITEM_RETURNED"] = "ITEM_RETURNED";
17
+ SellerLedgerActivityLogAction["PAYMENT_INITIATED"] = "PAYMENT_INITIATED";
18
+ SellerLedgerActivityLogAction["PAYMENT_COMPLETED"] = "PAYMENT_COMPLETED";
19
+ SellerLedgerActivityLogAction["PAYMENT_FAILED"] = "PAYMENT_FAILED";
20
+ SellerLedgerActivityLogAction["DISPUTE_RAISED"] = "DISPUTE_RAISED";
21
+ SellerLedgerActivityLogAction["DISPUTE_RESOLVED"] = "DISPUTE_RESOLVED";
22
+ SellerLedgerActivityLogAction["REFUND_ISSUED"] = "REFUND_ISSUED";
23
+ SellerLedgerActivityLogAction["TRANSACTION_CANCELLED"] = "TRANSACTION_CANCELLED";
24
+ })(SellerLedgerActivityLogAction || (SellerLedgerActivityLogAction = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "3.4.5",
3
+ "version": "3.4.7",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",