@fiado/type-kit 3.553.0 → 3.555.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/_test_/unit/loanRetailAudit/loanRetailAuditContracts.test.ts +9 -0
- package/_test_/unit/retailWizard/accessorySaleRequests.test.ts +4 -3
- package/_test_/unit/retailWizard/fixtures/saleWithoutCustomer.strict.ts +3 -0
- package/_test_/unit/retailWizard/saleWithoutCustomer.test.ts +32 -0
- package/bin/loanRetailAudit/enums/RetailAuditEntityTypeEnum.d.ts +4 -0
- package/bin/loanRetailAudit/enums/RetailAuditEntityTypeEnum.js +4 -0
- package/bin/retailWizard/dtos/Sale.d.ts +2 -1
- package/bin/retailWizard/dtos/requests/CreateAccessorySaleRequest.d.ts +1 -2
- package/bin/retailWizard/dtos/requests/CreateAccessorySaleRequest.js +1 -7
- package/package.json +1 -1
- package/src/loanRetailAudit/enums/RetailAuditEntityTypeEnum.ts +4 -0
- package/src/retailWizard/dtos/Sale.ts +2 -1
- package/src/retailWizard/dtos/requests/CreateAccessorySaleRequest.ts +1 -6
|
@@ -132,6 +132,15 @@ describe('catálogos', () => {
|
|
|
132
132
|
expect(RetailAuditEntityTypeEnum.RETAIL_CUSTOMER).toBe('RETAIL_CUSTOMER');
|
|
133
133
|
});
|
|
134
134
|
|
|
135
|
+
it('incluye el saldo del libro y el depósito de comisiones y los acepta en el evento', () => {
|
|
136
|
+
for (const entityType of ['COMMISSION_LEDGER', 'COMMISSION_PAYMENT']) {
|
|
137
|
+
expect(AUDIT_TRAIL_ENTITY_TYPES).toContain(entityType);
|
|
138
|
+
expect(errorsOf(AuditTrailRecordedV1, { ...validEvent, entityType })).toEqual([]);
|
|
139
|
+
}
|
|
140
|
+
expect(RetailAuditEntityTypeEnum.COMMISSION_LEDGER).toBe('COMMISSION_LEDGER');
|
|
141
|
+
expect(RetailAuditEntityTypeEnum.COMMISSION_PAYMENT).toBe('COMMISSION_PAYMENT');
|
|
142
|
+
});
|
|
143
|
+
|
|
135
144
|
it('AUDIT_TRAIL_ENTITY_TYPES une Loan y Retail sin repetidos', () => {
|
|
136
145
|
const all = [...Object.values(LoanAuditEntityTypeEnum), ...Object.values(RetailAuditEntityTypeEnum)];
|
|
137
146
|
expect([...AUDIT_TRAIL_ENTITY_TYPES].sort()).toEqual([...all].sort());
|
|
@@ -14,7 +14,6 @@ function errorsOf<T extends object>(cls: new () => T, payload: Record<string, un
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const validSale = {
|
|
17
|
-
otpChallengeId: 'chl-1',
|
|
18
17
|
lines: [{ sku: 'ACC-1', qty: 2 }],
|
|
19
18
|
paymentMethod: SalePaymentMethodEnum.CASH,
|
|
20
19
|
amountCents: 39800,
|
|
@@ -91,8 +90,10 @@ describe('CreateAccessorySaleRequest', () => {
|
|
|
91
90
|
expect(errorsOf(CreateAccessorySaleRequest, { ...validSale, paymentMethod: SalePaymentMethodEnum.WIRE })).toEqual([]);
|
|
92
91
|
});
|
|
93
92
|
|
|
94
|
-
it('
|
|
95
|
-
|
|
93
|
+
it('ya no lleva reto OTP: otpChallengeId se descarta', () => {
|
|
94
|
+
const dto = plainToInstance(CreateAccessorySaleRequest, { ...validSale, otpChallengeId: 'chl-1' }, { excludeExtraneousValues: true });
|
|
95
|
+
expect(dto).not.toHaveProperty('otpChallengeId');
|
|
96
|
+
expect(validateSync(dto)).toEqual([]);
|
|
96
97
|
});
|
|
97
98
|
});
|
|
98
99
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as ts from 'typescript';
|
|
4
|
+
import { counterSaleCustomerId } from './fixtures/saleWithoutCustomer.strict';
|
|
5
|
+
|
|
6
|
+
const FIXTURE = path.join(__dirname, 'fixtures', 'saleWithoutCustomer.strict.ts');
|
|
7
|
+
|
|
8
|
+
// Sin strictNullChecks null cabe en string y la prueba no detecta nada.
|
|
9
|
+
function strictDiagnostics(): string[] {
|
|
10
|
+
const program = ts.createProgram([FIXTURE], {
|
|
11
|
+
strict: true,
|
|
12
|
+
noEmit: true,
|
|
13
|
+
skipLibCheck: true,
|
|
14
|
+
target: ts.ScriptTarget.ES2020,
|
|
15
|
+
module: ts.ModuleKind.CommonJS,
|
|
16
|
+
moduleResolution: ts.ModuleResolutionKind.Node10,
|
|
17
|
+
});
|
|
18
|
+
return ts
|
|
19
|
+
.getPreEmitDiagnostics(program)
|
|
20
|
+
.filter((d) => d.file?.fileName === FIXTURE)
|
|
21
|
+
.map((d) => ts.flattenDiagnosticMessageText(d.messageText, '\n'));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
describe('venta de mostrador sin cliente — retailCustomerId nullable', () => {
|
|
25
|
+
it('Sale acepta retailCustomerId null en strict', () => {
|
|
26
|
+
expect(strictDiagnostics()).toEqual([]);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('el valor viaja como null', () => {
|
|
30
|
+
expect(counterSaleCustomerId).toBeNull();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -14,6 +14,10 @@ export declare enum RetailAuditEntityTypeEnum {
|
|
|
14
14
|
COMMISSION_ADJUSTMENT = "COMMISSION_ADJUSTMENT",
|
|
15
15
|
COMMISSION_RULE = "COMMISSION_RULE",
|
|
16
16
|
COMMISSION_POLICY = "COMMISSION_POLICY",
|
|
17
|
+
/** El saldo de un vendedor en el libro de pagos de comisiones; `entityId` = `<retailerId>#<sellerId>`. */
|
|
18
|
+
COMMISSION_LEDGER = "COMMISSION_LEDGER",
|
|
19
|
+
/** Un depósito de comisiones a la wallet; `entityId` = `<retailerId>#<sellerId>#<paymentId>`. */
|
|
20
|
+
COMMISSION_PAYMENT = "COMMISSION_PAYMENT",
|
|
17
21
|
PROSPECT = "PROSPECT",
|
|
18
22
|
RETAIL_CUSTOMER = "RETAIL_CUSTOMER"
|
|
19
23
|
}
|
|
@@ -18,6 +18,10 @@ var RetailAuditEntityTypeEnum;
|
|
|
18
18
|
RetailAuditEntityTypeEnum["COMMISSION_ADJUSTMENT"] = "COMMISSION_ADJUSTMENT";
|
|
19
19
|
RetailAuditEntityTypeEnum["COMMISSION_RULE"] = "COMMISSION_RULE";
|
|
20
20
|
RetailAuditEntityTypeEnum["COMMISSION_POLICY"] = "COMMISSION_POLICY";
|
|
21
|
+
/** El saldo de un vendedor en el libro de pagos de comisiones; `entityId` = `<retailerId>#<sellerId>`. */
|
|
22
|
+
RetailAuditEntityTypeEnum["COMMISSION_LEDGER"] = "COMMISSION_LEDGER";
|
|
23
|
+
/** Un depósito de comisiones a la wallet; `entityId` = `<retailerId>#<sellerId>#<paymentId>`. */
|
|
24
|
+
RetailAuditEntityTypeEnum["COMMISSION_PAYMENT"] = "COMMISSION_PAYMENT";
|
|
21
25
|
RetailAuditEntityTypeEnum["PROSPECT"] = "PROSPECT";
|
|
22
26
|
RetailAuditEntityTypeEnum["RETAIL_CUSTOMER"] = "RETAIL_CUSTOMER";
|
|
23
27
|
})(RetailAuditEntityTypeEnum || (exports.RetailAuditEntityTypeEnum = RetailAuditEntityTypeEnum = {}));
|
|
@@ -18,7 +18,8 @@ export interface Sale {
|
|
|
18
18
|
retailerId: string;
|
|
19
19
|
storeId: string;
|
|
20
20
|
sellerRetailUserId: string;
|
|
21
|
-
|
|
21
|
+
/** `null` en la venta de mostrador sin cliente. */
|
|
22
|
+
retailCustomerId: string | null;
|
|
22
23
|
/** Sesión del wizard que cerró la venta; ausente en la venta de mostrador. */
|
|
23
24
|
wizardSessionId?: string;
|
|
24
25
|
/** Canal de la venta; ausente = `WIZARD` (ventas anteriores al campo). */
|
|
@@ -2,11 +2,10 @@ import { SalePaymentMethodEnum } from '../../enums/SalePaymentMethodEnum';
|
|
|
2
2
|
import { SalePaymentDetail } from '../SalePaymentDetail';
|
|
3
3
|
import { AccessorySaleLine } from '../AccessorySaleLine';
|
|
4
4
|
/**
|
|
5
|
-
* POST /wizard/accessory-sales — cierra la venta de mostrador
|
|
5
|
+
* POST /wizard/accessory-sales — cierra la venta de mostrador, sin cliente.
|
|
6
6
|
* `amountCents` es lo cobrado en caja y debe igualar la suma del catálogo.
|
|
7
7
|
*/
|
|
8
8
|
export declare class CreateAccessorySaleRequest {
|
|
9
|
-
otpChallengeId: string;
|
|
10
9
|
lines: AccessorySaleLine[];
|
|
11
10
|
paymentMethod: SalePaymentMethodEnum;
|
|
12
11
|
amountCents: number;
|
|
@@ -16,18 +16,12 @@ const SalePaymentMethodEnum_1 = require("../../enums/SalePaymentMethodEnum");
|
|
|
16
16
|
const SalePaymentDetail_1 = require("../SalePaymentDetail");
|
|
17
17
|
const AccessorySaleLine_1 = require("../AccessorySaleLine");
|
|
18
18
|
/**
|
|
19
|
-
* POST /wizard/accessory-sales — cierra la venta de mostrador
|
|
19
|
+
* POST /wizard/accessory-sales — cierra la venta de mostrador, sin cliente.
|
|
20
20
|
* `amountCents` es lo cobrado en caja y debe igualar la suma del catálogo.
|
|
21
21
|
*/
|
|
22
22
|
class CreateAccessorySaleRequest {
|
|
23
23
|
}
|
|
24
24
|
exports.CreateAccessorySaleRequest = CreateAccessorySaleRequest;
|
|
25
|
-
__decorate([
|
|
26
|
-
(0, class_transformer_1.Expose)(),
|
|
27
|
-
(0, class_validator_1.IsString)(),
|
|
28
|
-
(0, class_validator_1.MinLength)(1),
|
|
29
|
-
__metadata("design:type", String)
|
|
30
|
-
], CreateAccessorySaleRequest.prototype, "otpChallengeId", void 0);
|
|
31
25
|
__decorate([
|
|
32
26
|
(0, class_transformer_1.Expose)(),
|
|
33
27
|
(0, class_validator_1.IsArray)(),
|
package/package.json
CHANGED
|
@@ -14,6 +14,10 @@ export enum RetailAuditEntityTypeEnum {
|
|
|
14
14
|
COMMISSION_ADJUSTMENT = 'COMMISSION_ADJUSTMENT',
|
|
15
15
|
COMMISSION_RULE = 'COMMISSION_RULE',
|
|
16
16
|
COMMISSION_POLICY = 'COMMISSION_POLICY',
|
|
17
|
+
/** El saldo de un vendedor en el libro de pagos de comisiones; `entityId` = `<retailerId>#<sellerId>`. */
|
|
18
|
+
COMMISSION_LEDGER = 'COMMISSION_LEDGER',
|
|
19
|
+
/** Un depósito de comisiones a la wallet; `entityId` = `<retailerId>#<sellerId>#<paymentId>`. */
|
|
20
|
+
COMMISSION_PAYMENT = 'COMMISSION_PAYMENT',
|
|
17
21
|
PROSPECT = 'PROSPECT',
|
|
18
22
|
RETAIL_CUSTOMER = 'RETAIL_CUSTOMER',
|
|
19
23
|
}
|
|
@@ -19,7 +19,8 @@ export interface Sale {
|
|
|
19
19
|
retailerId: string;
|
|
20
20
|
storeId: string;
|
|
21
21
|
sellerRetailUserId: string;
|
|
22
|
-
|
|
22
|
+
/** `null` en la venta de mostrador sin cliente. */
|
|
23
|
+
retailCustomerId: string | null;
|
|
23
24
|
/** Sesión del wizard que cerró la venta; ausente en la venta de mostrador. */
|
|
24
25
|
wizardSessionId?: string;
|
|
25
26
|
/** Canal de la venta; ausente = `WIZARD` (ventas anteriores al campo). */
|
|
@@ -18,15 +18,10 @@ import { SalePaymentDetail } from '../SalePaymentDetail';
|
|
|
18
18
|
import { AccessorySaleLine } from '../AccessorySaleLine';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* POST /wizard/accessory-sales — cierra la venta de mostrador
|
|
21
|
+
* POST /wizard/accessory-sales — cierra la venta de mostrador, sin cliente.
|
|
22
22
|
* `amountCents` es lo cobrado en caja y debe igualar la suma del catálogo.
|
|
23
23
|
*/
|
|
24
24
|
export class CreateAccessorySaleRequest {
|
|
25
|
-
@Expose()
|
|
26
|
-
@IsString()
|
|
27
|
-
@MinLength(1)
|
|
28
|
-
otpChallengeId!: string;
|
|
29
|
-
|
|
30
25
|
@Expose()
|
|
31
26
|
@IsArray()
|
|
32
27
|
@ArrayMinSize(1)
|