@merkaly/api 0.36.1 → 0.37.0
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.
- package/dist/app.schemas.d.ts +6 -11
- package/dist/finance/chargeback/chargeback.entity.d.ts +33 -8
- package/dist/finance/payment/index.d.ts +0 -1
- package/dist/finance/payment/index.js +0 -1
- package/dist/finance/payment/payment.entity.d.ts +23 -20
- package/dist/finance/payment/payment.enum.d.ts +1 -5
- package/dist/finance/payment/payment.enum.js +1 -6
- package/dist/finance/payment/payment.transition.js +2 -1
- package/dist/finance/refund/refund.entity.d.ts +26 -6
- package/dist/finance/refund/refund.enum.d.ts +7 -0
- package/dist/finance/refund/refund.enum.js +8 -0
- package/dist/finance/withdrawal/withdrawal.entity.d.ts +46 -7
- package/dist/integration/payment/account.d.ts +1 -0
- package/dist/integration/payment/charge.d.ts +1 -1
- package/dist/integration/payment/charge.enum.d.ts +7 -0
- package/dist/integration/payment/charge.enum.js +8 -0
- package/dist/integration/payment/index.d.ts +0 -2
- package/dist/integration/supplier/order.d.ts +8 -1
- package/dist/inventory/catalog/product/product.entity.d.ts +18 -6
- package/dist/inventory/catalog/product/request.validator.js +2 -2
- package/dist/inventory/catalog/variant/request.validator.js +2 -2
- package/dist/inventory/catalog/variant/variant.entity.d.ts +45 -4
- package/dist/inventory/catalog/variant/variant.option.entity.d.ts +14 -2
- package/dist/logistics/shipment/shipment.d.ts +1 -1
- package/dist/logistics/shipment/shipment.entity.d.ts +18 -9
- package/dist/logistics/shipment/shipment.enum.d.ts +0 -4
- package/dist/logistics/shipment/shipment.enum.js +0 -5
- package/dist/order/purchase/purchase.entity.d.ts +3 -3
- package/dist/order/sale/attention.d.ts +1 -1
- package/dist/order/sale/attention.enum.d.ts +1 -0
- package/dist/order/sale/attention.enum.js +2 -0
- package/dist/order/sale/delivery.request.validator.d.ts +1 -1
- package/dist/order/sale/delivery.request.validator.js +2 -2
- package/dist/order/sale/delivery.update.request.validator.d.ts +1 -1
- package/dist/order/sale/delivery.update.request.validator.js +2 -2
- package/dist/order/sale/fulfillment.d.ts +1 -1
- package/dist/order/sale/fulfillment.enum.d.ts +1 -0
- package/dist/order/sale/fulfillment.enum.js +6 -1
- package/dist/order/sale/procurement.d.ts +3 -3
- package/dist/order/sale/quote.request.validator.d.ts +1 -1
- package/dist/order/sale/quote.request.validator.js +2 -2
- package/dist/order/sale/sale.entity.d.ts +2 -18
- package/dist/order/sale/sale.enum.d.ts +2 -1
- package/dist/order/sale/sale.enum.js +6 -3
- package/dist/order/sale/sale.transition.js +2 -1
- package/dist/settings/organization/index.d.ts +2 -1
- package/dist/settings/organization/index.js +1 -0
- package/dist/settings/organization/organization.contract.d.ts +38 -9
- package/dist/settings/organization/organization.enum.d.ts +0 -10
- package/dist/settings/organization/organization.enum.js +0 -11
- package/dist/settings/organization/{organization.entity.d.ts → settings.entity.d.ts} +1 -1
- package/dist/settings/organization/settings.enum.d.ts +11 -0
- package/dist/settings/organization/settings.enum.js +12 -0
- package/dist/transaction.entity.d.ts +1 -2
- package/package.json +1 -1
- package/dist/finance/payment/request.validator.d.ts +0 -14
- package/dist/finance/payment/request.validator.js +0 -61
- package/dist/integration/payment/payment.account.entity.d.ts +0 -52
- package/dist/integration/payment/payment.entity.d.ts +0 -8
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Schema as MongoSchema } from 'mongoose';
|
|
2
2
|
import { AbstractEntity } from '../../abstract.entity.js';
|
|
3
|
-
import {
|
|
3
|
+
import { LogisticsShipmentSourceEnum, LogisticsShipmentStatusEnum, LogisticsTrackingEventCodeEnum } from './shipment.enum.js';
|
|
4
4
|
import type { OrderPurchaseEntity } from '../../order/purchase';
|
|
5
5
|
import type { OrderSaleEntity } from '../../order/sale';
|
|
6
|
-
import type { StatusEntity } from '../../status.plugin.js';
|
|
7
6
|
export declare class LogisticsShipmentEventEntity {
|
|
8
|
-
|
|
7
|
+
date: Date;
|
|
9
8
|
code: LogisticsTrackingEventCodeEnum;
|
|
10
9
|
description: string;
|
|
11
10
|
location?: string | null;
|
|
@@ -19,18 +18,28 @@ export declare const LogisticsShipmentEventSchema: MongoSchema<LogisticsShipment
|
|
|
19
18
|
} & {
|
|
20
19
|
__v: number;
|
|
21
20
|
}>;
|
|
21
|
+
export declare class LogisticsShipmentTrackingEntity {
|
|
22
|
+
number?: string | null;
|
|
23
|
+
carrier?: string | null;
|
|
24
|
+
url?: string | null;
|
|
25
|
+
}
|
|
26
|
+
export declare const LogisticsShipmentTrackingSchema: MongoSchema<LogisticsShipmentTrackingEntity, import("mongoose").Model<LogisticsShipmentTrackingEntity, any, any, any, import("mongoose").Document<unknown, any, LogisticsShipmentTrackingEntity, any, {}> & LogisticsShipmentTrackingEntity & {
|
|
27
|
+
_id: import("mongoose").Types.ObjectId;
|
|
28
|
+
} & {
|
|
29
|
+
__v: number;
|
|
30
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, LogisticsShipmentTrackingEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<LogisticsShipmentTrackingEntity>, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").FlatRecord<LogisticsShipmentTrackingEntity> & {
|
|
31
|
+
_id: import("mongoose").Types.ObjectId;
|
|
32
|
+
} & {
|
|
33
|
+
__v: number;
|
|
34
|
+
}>;
|
|
22
35
|
export declare class LogisticsShipmentEntity extends AbstractEntity {
|
|
23
|
-
|
|
36
|
+
sale: OrderSaleEntity;
|
|
24
37
|
purchase?: OrderPurchaseEntity | null;
|
|
25
|
-
direction: LogisticsShipmentDirectionEnum;
|
|
26
38
|
source: LogisticsShipmentSourceEnum;
|
|
27
|
-
|
|
28
|
-
carrier?: string | null;
|
|
29
|
-
trackingUrl?: string | null;
|
|
39
|
+
tracking?: LogisticsShipmentTrackingEntity | null;
|
|
30
40
|
shippedAt?: Date | null;
|
|
31
41
|
deliveredAt?: Date | null;
|
|
32
42
|
receivedBy?: LogisticsShipmentSourceEnum | null;
|
|
33
43
|
events: LogisticsShipmentEventEntity[];
|
|
34
44
|
status: LogisticsShipmentStatusEnum;
|
|
35
|
-
history: StatusEntity<LogisticsShipmentStatusEnum>[];
|
|
36
45
|
}
|
|
@@ -4,10 +4,6 @@ export declare enum LogisticsShipmentStatusEnum {
|
|
|
4
4
|
DELIVERED = "DELIVERED",
|
|
5
5
|
EXCEPTION = "EXCEPTION"
|
|
6
6
|
}
|
|
7
|
-
export declare enum LogisticsShipmentDirectionEnum {
|
|
8
|
-
OUTBOUND = "OUTBOUND",
|
|
9
|
-
RETURN = "RETURN"
|
|
10
|
-
}
|
|
11
7
|
export declare enum LogisticsShipmentSourceEnum {
|
|
12
8
|
SUPPLIER = "SUPPLIER",
|
|
13
9
|
MERCHANT = "MERCHANT",
|
|
@@ -5,11 +5,6 @@ export var LogisticsShipmentStatusEnum;
|
|
|
5
5
|
LogisticsShipmentStatusEnum["DELIVERED"] = "DELIVERED";
|
|
6
6
|
LogisticsShipmentStatusEnum["EXCEPTION"] = "EXCEPTION";
|
|
7
7
|
})(LogisticsShipmentStatusEnum || (LogisticsShipmentStatusEnum = {}));
|
|
8
|
-
export var LogisticsShipmentDirectionEnum;
|
|
9
|
-
(function (LogisticsShipmentDirectionEnum) {
|
|
10
|
-
LogisticsShipmentDirectionEnum["OUTBOUND"] = "OUTBOUND";
|
|
11
|
-
LogisticsShipmentDirectionEnum["RETURN"] = "RETURN";
|
|
12
|
-
})(LogisticsShipmentDirectionEnum || (LogisticsShipmentDirectionEnum = {}));
|
|
13
8
|
export var LogisticsShipmentSourceEnum;
|
|
14
9
|
(function (LogisticsShipmentSourceEnum) {
|
|
15
10
|
LogisticsShipmentSourceEnum["SUPPLIER"] = "SUPPLIER";
|
|
@@ -7,7 +7,7 @@ import { OrderPurchaseStatusEnum } from './purchase.enum.js';
|
|
|
7
7
|
import type { OrderSaleEntity } from '../sale';
|
|
8
8
|
export declare class OrderPurchaseSupplierOrderEntity {
|
|
9
9
|
provider: SupplierProviderEnum;
|
|
10
|
-
|
|
10
|
+
orderIds: string[];
|
|
11
11
|
reference?: string;
|
|
12
12
|
rawStatus?: string;
|
|
13
13
|
placedAt: Date;
|
|
@@ -26,8 +26,8 @@ export declare const OrderPurchaseSupplierOrderSchema: MongoSchema<OrderPurchase
|
|
|
26
26
|
}>;
|
|
27
27
|
export declare class OrderPurchaseEntity extends TransactionEntity<OrderPurchaseStatusEnum> {
|
|
28
28
|
vendor?: ContactVendorEntity;
|
|
29
|
-
|
|
29
|
+
sale?: OrderSaleEntity;
|
|
30
30
|
items: ItemEntity[];
|
|
31
|
-
|
|
31
|
+
shippingCost?: number;
|
|
32
32
|
supplierOrder?: OrderPurchaseSupplierOrderEntity;
|
|
33
33
|
}
|
|
@@ -8,6 +8,7 @@ export declare enum OrderSaleAttentionEnum {
|
|
|
8
8
|
SUPPLIER_ORDER_FAILED = "SUPPLIER_ORDER_FAILED",
|
|
9
9
|
SUPPLIER_PAYMENT_PENDING = "SUPPLIER_PAYMENT_PENDING",
|
|
10
10
|
SHIPMENT_EXCEPTION = "SHIPMENT_EXCEPTION",
|
|
11
|
+
SUPPLIER_CANCELLED = "SUPPLIER_CANCELLED",
|
|
11
12
|
AUTO_PROCUREMENT_FAILED = "AUTO_PROCUREMENT_FAILED",
|
|
12
13
|
TO_ORDER = "TO_ORDER",
|
|
13
14
|
SHIPMENT_DELAYED = "SHIPMENT_DELAYED",
|
|
@@ -9,6 +9,7 @@ export var OrderSaleAttentionEnum;
|
|
|
9
9
|
OrderSaleAttentionEnum["SUPPLIER_ORDER_FAILED"] = "SUPPLIER_ORDER_FAILED";
|
|
10
10
|
OrderSaleAttentionEnum["SUPPLIER_PAYMENT_PENDING"] = "SUPPLIER_PAYMENT_PENDING";
|
|
11
11
|
OrderSaleAttentionEnum["SHIPMENT_EXCEPTION"] = "SHIPMENT_EXCEPTION";
|
|
12
|
+
OrderSaleAttentionEnum["SUPPLIER_CANCELLED"] = "SUPPLIER_CANCELLED";
|
|
12
13
|
OrderSaleAttentionEnum["AUTO_PROCUREMENT_FAILED"] = "AUTO_PROCUREMENT_FAILED";
|
|
13
14
|
OrderSaleAttentionEnum["TO_ORDER"] = "TO_ORDER";
|
|
14
15
|
OrderSaleAttentionEnum["SHIPMENT_DELAYED"] = "SHIPMENT_DELAYED";
|
|
@@ -25,6 +26,7 @@ export const SALE_ACTIONABLE_ATTENTIONS = [
|
|
|
25
26
|
OrderSaleAttentionEnum.SUPPLIER_ORDER_FAILED,
|
|
26
27
|
OrderSaleAttentionEnum.SUPPLIER_PAYMENT_PENDING,
|
|
27
28
|
OrderSaleAttentionEnum.SHIPMENT_EXCEPTION,
|
|
29
|
+
OrderSaleAttentionEnum.SUPPLIER_CANCELLED,
|
|
28
30
|
OrderSaleAttentionEnum.AUTO_PROCUREMENT_FAILED,
|
|
29
31
|
OrderSaleAttentionEnum.TO_ORDER,
|
|
30
32
|
];
|
|
@@ -10,7 +10,7 @@ export declare class SaleDeliveryRecipientRequestValidator extends AbstractReque
|
|
|
10
10
|
birthday?: string;
|
|
11
11
|
}
|
|
12
12
|
export declare class SaleDeliveryAddressRequestValidator extends AbstractRequestValidator {
|
|
13
|
-
|
|
13
|
+
zipCode: string;
|
|
14
14
|
street: string;
|
|
15
15
|
number: string;
|
|
16
16
|
complement?: string;
|
|
@@ -103,7 +103,7 @@ __decorate([
|
|
|
103
103
|
__metadata("design:type", String)
|
|
104
104
|
], SaleDeliveryRecipientRequestValidator.prototype, "birthday", void 0);
|
|
105
105
|
export class SaleDeliveryAddressRequestValidator extends abstract_validator_1.AbstractRequestValidator {
|
|
106
|
-
|
|
106
|
+
zipCode;
|
|
107
107
|
street;
|
|
108
108
|
number;
|
|
109
109
|
complement;
|
|
@@ -116,7 +116,7 @@ __decorate([
|
|
|
116
116
|
(0, class_validator_1.Matches)(/^\d{8}$/, { message: '$property must be a CEP with 8 digits' }),
|
|
117
117
|
(0, class_transformer_1.Transform)(transform_validator_1.digits),
|
|
118
118
|
__metadata("design:type", String)
|
|
119
|
-
], SaleDeliveryAddressRequestValidator.prototype, "
|
|
119
|
+
], SaleDeliveryAddressRequestValidator.prototype, "zipCode", void 0);
|
|
120
120
|
__decorate([
|
|
121
121
|
(0, class_validator_1.IsString)(),
|
|
122
122
|
(0, class_validator_1.Length)(2, 200),
|
|
@@ -7,7 +7,7 @@ export declare class UpdateSaleDeliveryRecipientRequestValidator extends Abstrac
|
|
|
7
7
|
birthday?: string;
|
|
8
8
|
}
|
|
9
9
|
export declare class UpdateSaleDeliveryAddressRequestValidator extends AbstractRequestValidator {
|
|
10
|
-
|
|
10
|
+
zipCode?: string;
|
|
11
11
|
street?: string;
|
|
12
12
|
number?: string;
|
|
13
13
|
complement?: string | null;
|
|
@@ -62,7 +62,7 @@ __decorate([
|
|
|
62
62
|
__metadata("design:type", String)
|
|
63
63
|
], UpdateSaleDeliveryRecipientRequestValidator.prototype, "birthday", void 0);
|
|
64
64
|
export class UpdateSaleDeliveryAddressRequestValidator extends abstract_validator_1.AbstractRequestValidator {
|
|
65
|
-
|
|
65
|
+
zipCode;
|
|
66
66
|
street;
|
|
67
67
|
number;
|
|
68
68
|
complement;
|
|
@@ -75,7 +75,7 @@ __decorate([
|
|
|
75
75
|
(0, class_validator_1.Matches)(/^\d{8}$/, { message: '$property must be a CEP with 8 digits' }),
|
|
76
76
|
(0, class_transformer_1.Transform)(transform_validator_1.digits),
|
|
77
77
|
__metadata("design:type", String)
|
|
78
|
-
], UpdateSaleDeliveryAddressRequestValidator.prototype, "
|
|
78
|
+
], UpdateSaleDeliveryAddressRequestValidator.prototype, "zipCode", void 0);
|
|
79
79
|
__decorate([
|
|
80
80
|
Sent(),
|
|
81
81
|
(0, class_validator_1.IsString)(),
|
|
@@ -7,7 +7,7 @@ import type { OrderSaleStatusEnum } from './sale.enum.js';
|
|
|
7
7
|
import type { OrderSaleReceipt } from './receipt.js';
|
|
8
8
|
export interface OrderSaleCosts {
|
|
9
9
|
products: number;
|
|
10
|
-
|
|
10
|
+
shippingCost: number;
|
|
11
11
|
total: number;
|
|
12
12
|
}
|
|
13
13
|
export interface OrderSaleEstimate extends OrderSaleCosts {
|
|
@@ -22,6 +22,7 @@ export declare enum OrderSaleHistoryEventEnum {
|
|
|
22
22
|
CREATED = "CREATED",
|
|
23
23
|
PAYMENT_CONFIRMED = "PAYMENT_CONFIRMED",
|
|
24
24
|
PAYMENT_CANCELLED = "PAYMENT_CANCELLED",
|
|
25
|
+
PAYMENT_REFUND_PROCESSING = "PAYMENT_REFUND_PROCESSING",
|
|
25
26
|
PAYMENT_REFUNDED = "PAYMENT_REFUNDED",
|
|
26
27
|
PAYMENT_DISPUTED = "PAYMENT_DISPUTED",
|
|
27
28
|
PAYMENT_CHARGED_BACK = "PAYMENT_CHARGED_BACK",
|
|
@@ -9,7 +9,11 @@ export var OrderBuyerStageEnum;
|
|
|
9
9
|
})(OrderBuyerStageEnum || (OrderBuyerStageEnum = {}));
|
|
10
10
|
export const BUYER_STAGE_GROUPS = {
|
|
11
11
|
[OrderBuyerStageEnum.AWAITING_PAYMENT]: [sale_enum_1.OrderSaleStatusEnum.AWAITING_PAYMENT],
|
|
12
|
-
[OrderBuyerStageEnum.IN_PREPARATION]: [
|
|
12
|
+
[OrderBuyerStageEnum.IN_PREPARATION]: [
|
|
13
|
+
sale_enum_1.OrderSaleStatusEnum.TO_ORDER,
|
|
14
|
+
sale_enum_1.OrderSaleStatusEnum.ORDERED,
|
|
15
|
+
sale_enum_1.OrderSaleStatusEnum.SUPPLIER_CANCELLED,
|
|
16
|
+
],
|
|
13
17
|
[OrderBuyerStageEnum.SHIPPED]: [sale_enum_1.OrderSaleStatusEnum.SHIPPED],
|
|
14
18
|
[OrderBuyerStageEnum.DELIVERED]: [sale_enum_1.OrderSaleStatusEnum.DELIVERED],
|
|
15
19
|
[OrderBuyerStageEnum.CANCELLED]: [sale_enum_1.OrderSaleStatusEnum.CANCELLED],
|
|
@@ -32,6 +36,7 @@ export var OrderSaleHistoryEventEnum;
|
|
|
32
36
|
OrderSaleHistoryEventEnum["CREATED"] = "CREATED";
|
|
33
37
|
OrderSaleHistoryEventEnum["PAYMENT_CONFIRMED"] = "PAYMENT_CONFIRMED";
|
|
34
38
|
OrderSaleHistoryEventEnum["PAYMENT_CANCELLED"] = "PAYMENT_CANCELLED";
|
|
39
|
+
OrderSaleHistoryEventEnum["PAYMENT_REFUND_PROCESSING"] = "PAYMENT_REFUND_PROCESSING";
|
|
35
40
|
OrderSaleHistoryEventEnum["PAYMENT_REFUNDED"] = "PAYMENT_REFUNDED";
|
|
36
41
|
OrderSaleHistoryEventEnum["PAYMENT_DISPUTED"] = "PAYMENT_DISPUTED";
|
|
37
42
|
OrderSaleHistoryEventEnum["PAYMENT_CHARGED_BACK"] = "PAYMENT_CHARGED_BACK";
|
|
@@ -11,7 +11,7 @@ export interface ProcurementLine {
|
|
|
11
11
|
retailUnit: number;
|
|
12
12
|
storedUnitCost: number;
|
|
13
13
|
quotedUnitCost?: number;
|
|
14
|
-
|
|
14
|
+
shippingCost?: number;
|
|
15
15
|
quote?: SupplierQuote;
|
|
16
16
|
}
|
|
17
17
|
export interface ProcurementGroup {
|
|
@@ -26,9 +26,9 @@ export interface ProcurementGroup {
|
|
|
26
26
|
items: ProcurementLine[];
|
|
27
27
|
totals: {
|
|
28
28
|
retail: number;
|
|
29
|
-
|
|
29
|
+
shippingPrice: number;
|
|
30
30
|
cost: number;
|
|
31
|
-
|
|
31
|
+
shippingCost: number;
|
|
32
32
|
margin: number;
|
|
33
33
|
};
|
|
34
34
|
available: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AbstractRequestValidator } from '../../abstract.validator.js';
|
|
2
2
|
import { CheckoutItemRequestValidator } from './checkout.request.validator.js';
|
|
3
3
|
export declare class CheckoutQuoteDestinationRequestValidator extends AbstractRequestValidator {
|
|
4
|
-
|
|
4
|
+
zipCode: string;
|
|
5
5
|
country: string;
|
|
6
6
|
}
|
|
7
7
|
export declare class CheckoutQuoteRequestValidator extends AbstractRequestValidator {
|
|
@@ -13,14 +13,14 @@ import * as class_validator_1 from "class-validator";
|
|
|
13
13
|
import * as abstract_validator_1 from '../../abstract.validator.js';
|
|
14
14
|
import * as checkout_request_validator_1 from './checkout.request.validator.js';
|
|
15
15
|
export class CheckoutQuoteDestinationRequestValidator extends abstract_validator_1.AbstractRequestValidator {
|
|
16
|
-
|
|
16
|
+
zipCode;
|
|
17
17
|
country;
|
|
18
18
|
}
|
|
19
19
|
__decorate([
|
|
20
20
|
(0, class_validator_1.Matches)(/^\d{8}$/, { message: '$property must be a CEP with 8 digits' }),
|
|
21
21
|
(0, class_transformer_1.Transform)(({ value }) => (typeof value === 'string' ? value.replace(/\D/g, '') : value)),
|
|
22
22
|
__metadata("design:type", String)
|
|
23
|
-
], CheckoutQuoteDestinationRequestValidator.prototype, "
|
|
23
|
+
], CheckoutQuoteDestinationRequestValidator.prototype, "zipCode", void 0);
|
|
24
24
|
__decorate([
|
|
25
25
|
(0, class_validator_1.IsISO31661Alpha2)(),
|
|
26
26
|
(0, class_validator_1.IsNotEmpty)(),
|
|
@@ -21,7 +21,7 @@ export declare const OrderSaleDeliveryRecipientSchema: MongoSchema<OrderSaleDeli
|
|
|
21
21
|
__v: number;
|
|
22
22
|
}>;
|
|
23
23
|
export declare class OrderSaleDeliveryAddressEntity {
|
|
24
|
-
|
|
24
|
+
zipCode: string;
|
|
25
25
|
street: string;
|
|
26
26
|
number: string;
|
|
27
27
|
complement?: string;
|
|
@@ -70,7 +70,7 @@ export declare const OrderSaleDeliveryLineSchema: MongoSchema<OrderSaleDeliveryL
|
|
|
70
70
|
export declare class OrderSaleDeliveryEntity {
|
|
71
71
|
recipient: OrderSaleDeliveryRecipientEntity;
|
|
72
72
|
address: OrderSaleDeliveryAddressEntity;
|
|
73
|
-
|
|
73
|
+
shippingPrice?: number;
|
|
74
74
|
quotedAt?: Date;
|
|
75
75
|
lines?: OrderSaleDeliveryLineEntity[];
|
|
76
76
|
}
|
|
@@ -83,28 +83,12 @@ export declare const OrderSaleDeliverySchema: MongoSchema<OrderSaleDeliveryEntit
|
|
|
83
83
|
} & {
|
|
84
84
|
__v: number;
|
|
85
85
|
}>;
|
|
86
|
-
export declare class OrderSaleAutoProcurementEntity {
|
|
87
|
-
attemptedAt: Date;
|
|
88
|
-
error?: string | null;
|
|
89
|
-
attempts?: number;
|
|
90
|
-
retryAt?: Date | null;
|
|
91
|
-
}
|
|
92
|
-
export declare const OrderSaleAutoProcurementSchema: MongoSchema<OrderSaleAutoProcurementEntity, import("mongoose").Model<OrderSaleAutoProcurementEntity, any, any, any, import("mongoose").Document<unknown, any, OrderSaleAutoProcurementEntity, any, {}> & OrderSaleAutoProcurementEntity & {
|
|
93
|
-
_id: import("mongoose").Types.ObjectId;
|
|
94
|
-
} & {
|
|
95
|
-
__v: number;
|
|
96
|
-
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, OrderSaleAutoProcurementEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<OrderSaleAutoProcurementEntity>, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").FlatRecord<OrderSaleAutoProcurementEntity> & {
|
|
97
|
-
_id: import("mongoose").Types.ObjectId;
|
|
98
|
-
} & {
|
|
99
|
-
__v: number;
|
|
100
|
-
}>;
|
|
101
86
|
export declare class OrderSaleEntity extends TransactionEntity<OrderSaleStatusEnum> {
|
|
102
87
|
customer: ContactCustomerEntity;
|
|
103
88
|
items: ItemEntity[];
|
|
104
89
|
delivery?: OrderSaleDeliveryEntity;
|
|
105
90
|
cancelledAt?: Date | null;
|
|
106
91
|
source: OrderSaleSourceEnum;
|
|
107
|
-
autoProcurement?: OrderSaleAutoProcurementEntity | null;
|
|
108
92
|
readonly purchases: OrderPurchaseEntity[];
|
|
109
93
|
readonly cost: number | null;
|
|
110
94
|
readonly profit: number | null;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare enum OrderSaleStatusEnum {
|
|
2
2
|
AWAITING_PAYMENT = "AWAITING_PAYMENT",
|
|
3
|
-
|
|
3
|
+
TO_ORDER = "TO_ORDER",
|
|
4
4
|
ORDERED = "ORDERED",
|
|
5
|
+
SUPPLIER_CANCELLED = "SUPPLIER_CANCELLED",
|
|
5
6
|
SHIPPED = "SHIPPED",
|
|
6
7
|
DELIVERED = "DELIVERED",
|
|
7
8
|
CANCELLED = "CANCELLED"
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
export var OrderSaleStatusEnum;
|
|
2
2
|
(function (OrderSaleStatusEnum) {
|
|
3
3
|
OrderSaleStatusEnum["AWAITING_PAYMENT"] = "AWAITING_PAYMENT";
|
|
4
|
-
OrderSaleStatusEnum["
|
|
4
|
+
OrderSaleStatusEnum["TO_ORDER"] = "TO_ORDER";
|
|
5
5
|
OrderSaleStatusEnum["ORDERED"] = "ORDERED";
|
|
6
|
+
OrderSaleStatusEnum["SUPPLIER_CANCELLED"] = "SUPPLIER_CANCELLED";
|
|
6
7
|
OrderSaleStatusEnum["SHIPPED"] = "SHIPPED";
|
|
7
8
|
OrderSaleStatusEnum["DELIVERED"] = "DELIVERED";
|
|
8
9
|
OrderSaleStatusEnum["CANCELLED"] = "CANCELLED";
|
|
9
10
|
})(OrderSaleStatusEnum || (OrderSaleStatusEnum = {}));
|
|
10
11
|
export const SALE_OPEN_STATUSES = [
|
|
11
12
|
OrderSaleStatusEnum.AWAITING_PAYMENT,
|
|
12
|
-
OrderSaleStatusEnum.
|
|
13
|
+
OrderSaleStatusEnum.TO_ORDER,
|
|
13
14
|
OrderSaleStatusEnum.ORDERED,
|
|
15
|
+
OrderSaleStatusEnum.SUPPLIER_CANCELLED,
|
|
14
16
|
OrderSaleStatusEnum.SHIPPED,
|
|
15
17
|
];
|
|
16
18
|
export const SALE_CANCELLABLE_STATUSES = [
|
|
17
19
|
OrderSaleStatusEnum.AWAITING_PAYMENT,
|
|
18
|
-
OrderSaleStatusEnum.
|
|
20
|
+
OrderSaleStatusEnum.TO_ORDER,
|
|
19
21
|
OrderSaleStatusEnum.ORDERED,
|
|
22
|
+
OrderSaleStatusEnum.SUPPLIER_CANCELLED,
|
|
20
23
|
];
|
|
21
24
|
export const WITHDRAWAL_HOLD_DAYS = 7;
|
|
22
25
|
export const WITHDRAWAL_HOLD_MS = WITHDRAWAL_HOLD_DAYS * 86_400_000;
|
|
@@ -4,8 +4,9 @@ import * as sale_enum_1 from './sale.enum.js';
|
|
|
4
4
|
export class OrderSaleTransition extends AbstractTransition {
|
|
5
5
|
$states = {
|
|
6
6
|
[sale_enum_1.OrderSaleStatusEnum.AWAITING_PAYMENT]: [],
|
|
7
|
-
[sale_enum_1.OrderSaleStatusEnum.
|
|
7
|
+
[sale_enum_1.OrderSaleStatusEnum.TO_ORDER]: [],
|
|
8
8
|
[sale_enum_1.OrderSaleStatusEnum.ORDERED]: [],
|
|
9
|
+
[sale_enum_1.OrderSaleStatusEnum.SUPPLIER_CANCELLED]: [],
|
|
9
10
|
[sale_enum_1.OrderSaleStatusEnum.SHIPPED]: [],
|
|
10
11
|
[sale_enum_1.OrderSaleStatusEnum.DELIVERED]: [],
|
|
11
12
|
[sale_enum_1.OrderSaleStatusEnum.CANCELLED]: [],
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SettingsOrganizationSocialEnum } from './organization.enum.js';
|
|
2
|
+
import { SettingsKeyEnum } from './settings.enum.js';
|
|
2
3
|
import type { PaymentAccountReadinessEnum } from '../../integration/payment';
|
|
3
4
|
import type { SupplierReadinessEnum } from '../../integration/supplier';
|
|
4
5
|
export interface SettingsOrganizationLocationContract {
|
|
@@ -45,6 +46,33 @@ export interface SettingsOrganizationBrandingStoredContract extends SettingsOrga
|
|
|
45
46
|
export interface SettingsOrganizationBillingContract {
|
|
46
47
|
email?: string;
|
|
47
48
|
}
|
|
49
|
+
export interface SettingsOrganizationPaymentsContract {
|
|
50
|
+
holder: {
|
|
51
|
+
type: string;
|
|
52
|
+
name: string;
|
|
53
|
+
email: string;
|
|
54
|
+
documentLast4: string;
|
|
55
|
+
} | null;
|
|
56
|
+
pixKey: {
|
|
57
|
+
type: string;
|
|
58
|
+
value: string;
|
|
59
|
+
} | null;
|
|
60
|
+
error: string | null;
|
|
61
|
+
gateway: {
|
|
62
|
+
provider: string;
|
|
63
|
+
id: string;
|
|
64
|
+
walletId: string;
|
|
65
|
+
apiKey: string | null;
|
|
66
|
+
approval: {
|
|
67
|
+
general: string;
|
|
68
|
+
commercialInfo: string;
|
|
69
|
+
documentation: string;
|
|
70
|
+
bankAccountInfo: string;
|
|
71
|
+
} | null;
|
|
72
|
+
createdAt: Date;
|
|
73
|
+
syncedAt: Date;
|
|
74
|
+
} | null;
|
|
75
|
+
}
|
|
48
76
|
export type SettingsOrganizationSecurityContract = Record<string, unknown>;
|
|
49
77
|
export type SettingsOrganizationSequenceContract = Record<string, unknown>;
|
|
50
78
|
export interface SettingsOrganizationStoreContract {
|
|
@@ -69,13 +97,14 @@ export interface SettingsOrganizationProfileResponse extends SettingsOrganizatio
|
|
|
69
97
|
store: SettingsOrganizationStoreContract;
|
|
70
98
|
}
|
|
71
99
|
export interface SettingsOrganizationValueMap {
|
|
72
|
-
[
|
|
73
|
-
[
|
|
74
|
-
[
|
|
75
|
-
[
|
|
76
|
-
[
|
|
77
|
-
[
|
|
78
|
-
[
|
|
79
|
-
[
|
|
100
|
+
[SettingsKeyEnum.ADDRESS]: SettingsOrganizationAddressContract;
|
|
101
|
+
[SettingsKeyEnum.BILLING]: SettingsOrganizationBillingContract;
|
|
102
|
+
[SettingsKeyEnum.BRANDING]: SettingsOrganizationBrandingStoredContract;
|
|
103
|
+
[SettingsKeyEnum.CONTACT]: SettingsOrganizationContactContract;
|
|
104
|
+
[SettingsKeyEnum.IDENTITY]: SettingsOrganizationIdentityContract;
|
|
105
|
+
[SettingsKeyEnum.LOCALIZATION]: SettingsOrganizationLocalizationContract;
|
|
106
|
+
[SettingsKeyEnum.PAYMENTS]: SettingsOrganizationPaymentsContract;
|
|
107
|
+
[SettingsKeyEnum.SECURITY]: SettingsOrganizationSecurityContract;
|
|
108
|
+
[SettingsKeyEnum.SEQUENCE]: SettingsOrganizationSequenceContract;
|
|
80
109
|
}
|
|
81
110
|
export type SettingsOrganizationKey = keyof SettingsOrganizationValueMap;
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
export declare enum SettingsOrganizationEnum {
|
|
2
|
-
ORGANIZATION_ADDRESS = "organization.address",
|
|
3
|
-
ORGANIZATION_BILLING = "organization.billing",
|
|
4
|
-
ORGANIZATION_BRANDING = "organization.branding",
|
|
5
|
-
ORGANIZATION_CONTACT = "organization.contact",
|
|
6
|
-
ORGANIZATION_IDENTITY = "organization.identity",
|
|
7
|
-
ORGANIZATION_LOCALIZATION = "organization.localization",
|
|
8
|
-
ORGANIZATION_SECURITY = "organization.security",
|
|
9
|
-
ORGANIZATION_SEQUENCE = "organization.sequence"
|
|
10
|
-
}
|
|
11
1
|
export declare enum SettingsOrganizationBrandingAssetEnum {
|
|
12
2
|
FAVICON = "favicon",
|
|
13
3
|
LOGO = "logo",
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
export var SettingsOrganizationEnum;
|
|
2
|
-
(function (SettingsOrganizationEnum) {
|
|
3
|
-
SettingsOrganizationEnum["ORGANIZATION_ADDRESS"] = "organization.address";
|
|
4
|
-
SettingsOrganizationEnum["ORGANIZATION_BILLING"] = "organization.billing";
|
|
5
|
-
SettingsOrganizationEnum["ORGANIZATION_BRANDING"] = "organization.branding";
|
|
6
|
-
SettingsOrganizationEnum["ORGANIZATION_CONTACT"] = "organization.contact";
|
|
7
|
-
SettingsOrganizationEnum["ORGANIZATION_IDENTITY"] = "organization.identity";
|
|
8
|
-
SettingsOrganizationEnum["ORGANIZATION_LOCALIZATION"] = "organization.localization";
|
|
9
|
-
SettingsOrganizationEnum["ORGANIZATION_SECURITY"] = "organization.security";
|
|
10
|
-
SettingsOrganizationEnum["ORGANIZATION_SEQUENCE"] = "organization.sequence";
|
|
11
|
-
})(SettingsOrganizationEnum || (SettingsOrganizationEnum = {}));
|
|
12
1
|
export var SettingsOrganizationBrandingAssetEnum;
|
|
13
2
|
(function (SettingsOrganizationBrandingAssetEnum) {
|
|
14
3
|
SettingsOrganizationBrandingAssetEnum["FAVICON"] = "favicon";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare enum SettingsKeyEnum {
|
|
2
|
+
ADDRESS = "address",
|
|
3
|
+
BILLING = "billing",
|
|
4
|
+
BRANDING = "branding",
|
|
5
|
+
CONTACT = "contact",
|
|
6
|
+
IDENTITY = "identity",
|
|
7
|
+
LOCALIZATION = "localization",
|
|
8
|
+
PAYMENTS = "payments",
|
|
9
|
+
SECURITY = "security",
|
|
10
|
+
SEQUENCE = "sequence"
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export var SettingsKeyEnum;
|
|
2
|
+
(function (SettingsKeyEnum) {
|
|
3
|
+
SettingsKeyEnum["ADDRESS"] = "address";
|
|
4
|
+
SettingsKeyEnum["BILLING"] = "billing";
|
|
5
|
+
SettingsKeyEnum["BRANDING"] = "branding";
|
|
6
|
+
SettingsKeyEnum["CONTACT"] = "contact";
|
|
7
|
+
SettingsKeyEnum["IDENTITY"] = "identity";
|
|
8
|
+
SettingsKeyEnum["LOCALIZATION"] = "localization";
|
|
9
|
+
SettingsKeyEnum["PAYMENTS"] = "payments";
|
|
10
|
+
SettingsKeyEnum["SECURITY"] = "security";
|
|
11
|
+
SettingsKeyEnum["SEQUENCE"] = "sequence";
|
|
12
|
+
})(SettingsKeyEnum || (SettingsKeyEnum = {}));
|
|
@@ -9,9 +9,8 @@ export interface TransactionCapabilities {
|
|
|
9
9
|
editItems: boolean;
|
|
10
10
|
deleteItems: boolean;
|
|
11
11
|
}
|
|
12
|
-
export declare const SYSTEM_USER = "merkaly";
|
|
13
12
|
export declare class TransactionEntity<S extends string> extends AbstractEntity implements ITransitionable<S> {
|
|
14
|
-
user
|
|
13
|
+
user?: AccountUserEntity | null;
|
|
15
14
|
notes?: string;
|
|
16
15
|
status: S;
|
|
17
16
|
items: ItemEntity[];
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { FinancePaymentMethodEnum, FinancePaymentStatusEnum, FinancePaymentTypeEnum } from './payment.enum.js';
|
|
2
|
-
import { AbstractRequestValidator } from '../../abstract.validator.js';
|
|
3
|
-
import type { FinancePaymentEntity } from './payment.entity.js';
|
|
4
|
-
export declare class CreateFinancePaymentRequestValidator extends AbstractRequestValidator {
|
|
5
|
-
type: FinancePaymentTypeEnum;
|
|
6
|
-
order?: string;
|
|
7
|
-
method?: FinancePaymentMethodEnum;
|
|
8
|
-
total?: number;
|
|
9
|
-
status?: FinancePaymentStatusEnum;
|
|
10
|
-
constructor(payment?: FinancePaymentEntity);
|
|
11
|
-
}
|
|
12
|
-
export declare class UpdateFinancePaymentRequestValidator extends CreateFinancePaymentRequestValidator {
|
|
13
|
-
type: FinancePaymentTypeEnum;
|
|
14
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
import * as class_validator_1 from "class-validator";
|
|
12
|
-
import * as payment_enum_1 from './payment.enum.js';
|
|
13
|
-
import * as abstract_validator_1 from '../../abstract.validator.js';
|
|
14
|
-
export class CreateFinancePaymentRequestValidator extends abstract_validator_1.AbstractRequestValidator {
|
|
15
|
-
type;
|
|
16
|
-
order;
|
|
17
|
-
method;
|
|
18
|
-
total;
|
|
19
|
-
status;
|
|
20
|
-
constructor(payment) {
|
|
21
|
-
super();
|
|
22
|
-
if (!payment) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
this.type = payment.type;
|
|
26
|
-
this.order = (payment.order?._id || payment.order);
|
|
27
|
-
this.method = payment.method;
|
|
28
|
-
this.total = payment.amount;
|
|
29
|
-
this.status = payment.status;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
__decorate([
|
|
33
|
-
(0, class_validator_1.IsEnum)(payment_enum_1.FinancePaymentTypeEnum),
|
|
34
|
-
__metadata("design:type", String)
|
|
35
|
-
], CreateFinancePaymentRequestValidator.prototype, "type", void 0);
|
|
36
|
-
__decorate([
|
|
37
|
-
(0, class_validator_1.IsMongoId)(),
|
|
38
|
-
(0, class_validator_1.IsOptional)(),
|
|
39
|
-
__metadata("design:type", String)
|
|
40
|
-
], CreateFinancePaymentRequestValidator.prototype, "order", void 0);
|
|
41
|
-
__decorate([
|
|
42
|
-
(0, class_validator_1.IsEnum)(payment_enum_1.FinancePaymentMethodEnum),
|
|
43
|
-
(0, class_validator_1.IsOptional)(),
|
|
44
|
-
__metadata("design:type", String)
|
|
45
|
-
], CreateFinancePaymentRequestValidator.prototype, "method", void 0);
|
|
46
|
-
__decorate([
|
|
47
|
-
(0, class_validator_1.IsPositive)(),
|
|
48
|
-
(0, class_validator_1.IsOptional)(),
|
|
49
|
-
__metadata("design:type", Number)
|
|
50
|
-
], CreateFinancePaymentRequestValidator.prototype, "total", void 0);
|
|
51
|
-
__decorate([
|
|
52
|
-
(0, class_validator_1.IsEnum)(payment_enum_1.FinancePaymentStatusEnum),
|
|
53
|
-
(0, class_validator_1.IsOptional)(),
|
|
54
|
-
__metadata("design:type", String)
|
|
55
|
-
], CreateFinancePaymentRequestValidator.prototype, "status", void 0);
|
|
56
|
-
export class UpdateFinancePaymentRequestValidator extends CreateFinancePaymentRequestValidator {
|
|
57
|
-
}
|
|
58
|
-
__decorate([
|
|
59
|
-
(0, class_validator_1.IsOptional)(),
|
|
60
|
-
__metadata("design:type", String)
|
|
61
|
-
], UpdateFinancePaymentRequestValidator.prototype, "type", void 0);
|