@fiado/type-kit 3.648.0 → 3.650.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/costCenter/moduleCostCenterConfig.test.ts +77 -0
- package/bin/collection/index.d.ts +0 -1
- package/bin/collection/index.js +0 -2
- package/bin/loanOfferings/dtos/requests/CreatePromotionRequest.d.ts +5 -0
- package/bin/loanOfferings/dtos/requests/CreatePromotionRequest.js +9 -0
- package/bin/loanOfferings/dtos/requests/UpdatePromotionRequest.d.ts +2 -0
- package/bin/loanOfferings/dtos/requests/UpdatePromotionRequest.js +9 -0
- package/bin/loanOfferings/dtos/responses/PromotionBonusResponse.d.ts +5 -0
- package/bin/loanOfferings/dtos/responses/PromotionResponse.d.ts +2 -0
- package/bin/retailCommission/dtos/CommissionApi.d.ts +2 -0
- package/bin/retailCommission/dtos/CommissionRule.d.ts +5 -0
- package/bin/retailPromotions/dtos/SalePromotion.d.ts +2 -0
- package/bin/retailPromotions/dtos/requests/CreateSalePromotionRequest.d.ts +6 -0
- package/bin/retailPromotions/dtos/requests/CreateSalePromotionRequest.js +9 -0
- package/bin/retailPromotions/dtos/requests/UpdateSalePromotionRequest.d.ts +2 -0
- package/bin/retailPromotions/dtos/requests/UpdateSalePromotionRequest.js +9 -0
- package/bin/retailPromotions/dtos/responses/WelcomeBonusPromotionResponse.d.ts +2 -0
- package/bin/retailPromotions/dtos/responses/WizardSalePromotionResponses.d.ts +2 -0
- package/bin/transaction/constants/costCenter.d.ts +2 -0
- package/bin/transaction/constants/costCenter.js +3 -1
- package/package.json +1 -1
- package/src/collection/index.ts +0 -3
- package/src/loanOfferings/dtos/requests/CreatePromotionRequest.ts +12 -0
- package/src/loanOfferings/dtos/requests/UpdatePromotionRequest.ts +9 -0
- package/src/loanOfferings/dtos/responses/PromotionBonusResponse.ts +5 -0
- package/src/loanOfferings/dtos/responses/PromotionResponse.ts +2 -0
- package/src/retailCommission/dtos/CommissionApi.ts +6 -1
- package/src/retailCommission/dtos/CommissionRule.ts +5 -0
- package/src/retailPromotions/dtos/SalePromotion.ts +2 -0
- package/src/retailPromotions/dtos/requests/CreateSalePromotionRequest.ts +14 -0
- package/src/retailPromotions/dtos/requests/UpdateSalePromotionRequest.ts +10 -0
- package/src/retailPromotions/dtos/responses/WelcomeBonusPromotionResponse.ts +2 -0
- package/src/retailPromotions/dtos/responses/WizardSalePromotionResponses.ts +2 -0
- package/src/transaction/constants/costCenter.ts +3 -0
- package/_test_/unit/collection/tenantCostCenters.test.ts +0 -15
- package/bin/collection/interfaces/TenantCostCenters.d.ts +0 -14
- package/bin/collection/interfaces/TenantCostCenters.js +0 -2
- package/src/collection/interfaces/TenantCostCenters.ts +0 -14
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { plainToInstance } from 'class-transformer';
|
|
3
|
+
import { validate } from 'class-validator';
|
|
4
|
+
import { CreateSalePromotionRequest, UpdateSalePromotionRequest } from '../../../src/retailPromotions/index';
|
|
5
|
+
import { CreatePromotionRequest, UpdatePromotionRequest } from '../../../src/loanOfferings/index';
|
|
6
|
+
import { COST_CENTER_ID_MAX_LENGTH } from '../../../src/transaction/index';
|
|
7
|
+
import type { WelcomeBonusPromotionResponse, SalePromotion } from '../../../src/retailPromotions/index';
|
|
8
|
+
import type { PromotionBonusResponse, PromotionResponse } from '../../../src/loanOfferings/index';
|
|
9
|
+
import type { CommissionPayoutPolicy, UpdatePoliciesRequest } from '../../../src/retailCommission/index';
|
|
10
|
+
|
|
11
|
+
type Dto = new () => object;
|
|
12
|
+
|
|
13
|
+
const errorProperties = async (dtoClass: Dto, raw: Record<string, unknown>): Promise<string[]> => {
|
|
14
|
+
const instance = plainToInstance(dtoClass, raw, { excludeExtraneousValues: true });
|
|
15
|
+
return (await validate(instance as object)).map((error) => error.property);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const salePromotion = {
|
|
19
|
+
name: 'Bono de venta',
|
|
20
|
+
customerText: 'Bono a tu wallet',
|
|
21
|
+
levers: { walletBonus: { amountCents: 10000 } },
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const creditPromotion = {
|
|
25
|
+
name: 'Bono PCF',
|
|
26
|
+
description: 'Bono al activar el crédito',
|
|
27
|
+
effect: { pcfBonusCents: 5000 },
|
|
28
|
+
segmentId: 'SEG_ALL',
|
|
29
|
+
targetLevels: ['SILVER'],
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
describe('centro de costo en la configuración de los módulos que pagan', () => {
|
|
33
|
+
const tooLong = 'X'.repeat(COST_CENTER_ID_MAX_LENGTH + 1);
|
|
34
|
+
|
|
35
|
+
it.each([
|
|
36
|
+
['CreateSalePromotionRequest', CreateSalePromotionRequest, salePromotion],
|
|
37
|
+
['UpdateSalePromotionRequest', UpdateSalePromotionRequest, {}],
|
|
38
|
+
['CreatePromotionRequest', CreatePromotionRequest, creditPromotion],
|
|
39
|
+
['UpdatePromotionRequest', UpdatePromotionRequest, {}],
|
|
40
|
+
] as const)('%s acepta el centro, ausente o null, y lo conserva al transformar', async (_name, dto, base) => {
|
|
41
|
+
const parsed = plainToInstance(dto as Dto, { ...base, costCenterId: 'CC_PROMO' }, { excludeExtraneousValues: true }) as {
|
|
42
|
+
costCenterId?: string | null;
|
|
43
|
+
};
|
|
44
|
+
expect(parsed.costCenterId).toBe('CC_PROMO');
|
|
45
|
+
expect(await errorProperties(dto as Dto, { ...base, costCenterId: 'CC_PROMO' })).not.toContain('costCenterId');
|
|
46
|
+
expect(await errorProperties(dto as Dto, { ...base })).not.toContain('costCenterId');
|
|
47
|
+
expect(await errorProperties(dto as Dto, { ...base, costCenterId: null })).not.toContain('costCenterId');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it.each([
|
|
51
|
+
['CreateSalePromotionRequest', CreateSalePromotionRequest, salePromotion],
|
|
52
|
+
['UpdateSalePromotionRequest', UpdateSalePromotionRequest, {}],
|
|
53
|
+
['CreatePromotionRequest', CreatePromotionRequest, creditPromotion],
|
|
54
|
+
['UpdatePromotionRequest', UpdatePromotionRequest, {}],
|
|
55
|
+
] as const)('%s rechaza el centro vacío, que no es texto o demasiado largo', async (_name, dto, base) => {
|
|
56
|
+
expect(await errorProperties(dto as Dto, { ...base, costCenterId: '' })).toContain('costCenterId');
|
|
57
|
+
expect(await errorProperties(dto as Dto, { ...base, costCenterId: 42 })).toContain('costCenterId');
|
|
58
|
+
expect(await errorProperties(dto as Dto, { ...base, costCenterId: tooLong })).toContain('costCenterId');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('las respuestas y la política de pagos llevan el centro opcional', () => {
|
|
62
|
+
const welcome: WelcomeBonusPromotionResponse = { promotionId: 'p', active: true, amountCents: 2500, costCenterId: 'CC_WELCOME' };
|
|
63
|
+
const bonus: Pick<PromotionBonusResponse, 'costCenterId'> = { costCenterId: 'CC_CREDIT' };
|
|
64
|
+
const credit: Pick<PromotionResponse, 'costCenterId'> = {};
|
|
65
|
+
const sale: Pick<SalePromotion, 'costCenterId'> = { costCenterId: 'CC_SALE' };
|
|
66
|
+
const payouts: Pick<CommissionPayoutPolicy, 'costCenterId'> = { costCenterId: 'CC_COMMISSION' };
|
|
67
|
+
const update: NonNullable<UpdatePoliciesRequest['payouts']>['costCenterId'] = null;
|
|
68
|
+
expect([welcome.costCenterId, bonus.costCenterId, credit.costCenterId, sale.costCenterId, payouts.costCenterId, update]).toEqual([
|
|
69
|
+
'CC_WELCOME',
|
|
70
|
+
'CC_CREDIT',
|
|
71
|
+
undefined,
|
|
72
|
+
'CC_SALE',
|
|
73
|
+
'CC_COMMISSION',
|
|
74
|
+
null,
|
|
75
|
+
]);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -13,7 +13,6 @@ export * from './enums/RedriveOutboxStatus';
|
|
|
13
13
|
export * from './enums/DisbursementType';
|
|
14
14
|
export * from './constants/CollectionResultLimits';
|
|
15
15
|
export * from './validators/IsCentPrecision';
|
|
16
|
-
export * from './interfaces/TenantCostCenters';
|
|
17
16
|
export * from './dtos/PendingChargeDto';
|
|
18
17
|
export * from './dtos/CollectRequest';
|
|
19
18
|
export * from './dtos/CollectResponse';
|
package/bin/collection/index.js
CHANGED
|
@@ -31,8 +31,6 @@ __exportStar(require("./enums/DisbursementType"), exports);
|
|
|
31
31
|
// Constantes y validadores
|
|
32
32
|
__exportStar(require("./constants/CollectionResultLimits"), exports);
|
|
33
33
|
__exportStar(require("./validators/IsCentPrecision"), exports);
|
|
34
|
-
// Interfaces
|
|
35
|
-
__exportStar(require("./interfaces/TenantCostCenters"), exports);
|
|
36
34
|
// DTOs
|
|
37
35
|
__exportStar(require("./dtos/PendingChargeDto"), exports);
|
|
38
36
|
__exportStar(require("./dtos/CollectRequest"), exports);
|
|
@@ -31,4 +31,9 @@ export declare class CreatePromotionRequest {
|
|
|
31
31
|
* presupuesto negativo es un request bien formado que el negocio rechaza.
|
|
32
32
|
*/
|
|
33
33
|
budgetMaxCents?: number | null;
|
|
34
|
+
/**
|
|
35
|
+
* Centro de costo con que el ledger imputa el bono PCF de la promoción. Ausente o `null` = sin
|
|
36
|
+
* centro: el bono se asienta como `UNASSIGNED`.
|
|
37
|
+
*/
|
|
38
|
+
costCenterId?: string | null;
|
|
34
39
|
}
|
|
@@ -14,6 +14,7 @@ const class_transformer_1 = require("class-transformer");
|
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
15
|
const offeringsInputLimits_1 = require("../../constants/offeringsInputLimits");
|
|
16
16
|
const promotionRetailerScope_1 = require("../../constants/promotionRetailerScope");
|
|
17
|
+
const costCenter_1 = require("../../../transaction/constants/costCenter");
|
|
17
18
|
const CreditPlanLevelEnum_1 = require("../../enums/CreditPlanLevelEnum");
|
|
18
19
|
const ProductCategoryEnum_1 = require("../../../retailCatalog/enums/ProductCategoryEnum");
|
|
19
20
|
const ProductTierEnum_1 = require("../../../retailCatalog/enums/ProductTierEnum");
|
|
@@ -117,3 +118,11 @@ __decorate([
|
|
|
117
118
|
(0, class_validator_1.IsInt)(),
|
|
118
119
|
__metadata("design:type", Number)
|
|
119
120
|
], CreatePromotionRequest.prototype, "budgetMaxCents", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
(0, class_transformer_1.Expose)(),
|
|
123
|
+
(0, class_validator_1.IsOptional)(),
|
|
124
|
+
(0, class_validator_1.IsString)(),
|
|
125
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
126
|
+
(0, class_validator_1.MaxLength)(costCenter_1.COST_CENTER_ID_MAX_LENGTH),
|
|
127
|
+
__metadata("design:type", String)
|
|
128
|
+
], CreatePromotionRequest.prototype, "costCenterId", void 0);
|
|
@@ -29,6 +29,8 @@ export declare class UpdatePromotionRequest {
|
|
|
29
29
|
validFrom?: string | null;
|
|
30
30
|
validUntil?: string | null;
|
|
31
31
|
budgetMaxCents?: number | null;
|
|
32
|
+
/** Centro de costo del bono PCF. Ausente = conserva el actual; `null` = lo quita. */
|
|
33
|
+
costCenterId?: string | null;
|
|
32
34
|
/** Motivo del cambio; queda en la bitácora de la promoción. */
|
|
33
35
|
reason?: string;
|
|
34
36
|
}
|
|
@@ -14,6 +14,7 @@ const class_transformer_1 = require("class-transformer");
|
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
15
|
const offeringsInputLimits_1 = require("../../constants/offeringsInputLimits");
|
|
16
16
|
const promotionRetailerScope_1 = require("../../constants/promotionRetailerScope");
|
|
17
|
+
const costCenter_1 = require("../../../transaction/constants/costCenter");
|
|
17
18
|
const CreditPlanLevelEnum_1 = require("../../enums/CreditPlanLevelEnum");
|
|
18
19
|
const ProductCategoryEnum_1 = require("../../../retailCatalog/enums/ProductCategoryEnum");
|
|
19
20
|
const ProductTierEnum_1 = require("../../../retailCatalog/enums/ProductTierEnum");
|
|
@@ -126,6 +127,14 @@ __decorate([
|
|
|
126
127
|
(0, class_validator_1.IsInt)(),
|
|
127
128
|
__metadata("design:type", Number)
|
|
128
129
|
], UpdatePromotionRequest.prototype, "budgetMaxCents", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, class_transformer_1.Expose)(),
|
|
132
|
+
(0, class_validator_1.IsOptional)(),
|
|
133
|
+
(0, class_validator_1.IsString)(),
|
|
134
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
135
|
+
(0, class_validator_1.MaxLength)(costCenter_1.COST_CENTER_ID_MAX_LENGTH),
|
|
136
|
+
__metadata("design:type", String)
|
|
137
|
+
], UpdatePromotionRequest.prototype, "costCenterId", void 0);
|
|
129
138
|
__decorate([
|
|
130
139
|
(0, class_transformer_1.Expose)(),
|
|
131
140
|
(0, class_validator_1.IsOptional)(),
|
|
@@ -11,6 +11,11 @@ export interface PromotionBonusResponse {
|
|
|
11
11
|
/** Versión de la promoción al reservar: el monto queda congelado aunque la promo se edite. */
|
|
12
12
|
promotionVersion: number;
|
|
13
13
|
amountCents: number;
|
|
14
|
+
/**
|
|
15
|
+
* Centro de costo de la promoción al reservar, congelado como el monto. Quien paga lo manda al motor
|
|
16
|
+
* de cobro; ausente = el ledger asienta el bono como `UNASSIGNED`.
|
|
17
|
+
*/
|
|
18
|
+
costCenterId?: string;
|
|
14
19
|
status: PromotionBonusStatusEnum;
|
|
15
20
|
/** Folio del processor. `null` mientras no haya cerrado, o si cerró sin darlo. */
|
|
16
21
|
transactionId: string | null;
|
|
@@ -38,6 +38,8 @@ export interface PromotionResponse {
|
|
|
38
38
|
phase: PromotionPhaseEnum | null;
|
|
39
39
|
/** Tope de presupuesto; `null` = sin tope. */
|
|
40
40
|
budgetMaxCents: number | null;
|
|
41
|
+
/** Centro de costo con que el ledger imputa el bono PCF; ausente = sin configurar. */
|
|
42
|
+
costCenterId?: string;
|
|
41
43
|
budgetConsumedCents: number;
|
|
42
44
|
creditsGenerated: number;
|
|
43
45
|
version: number;
|
|
@@ -320,6 +320,8 @@ export interface UpdatePoliciesRequest {
|
|
|
320
320
|
payouts?: {
|
|
321
321
|
walletDeposits: boolean;
|
|
322
322
|
chainBillingPeriod: CommissionBillingPeriodEnum;
|
|
323
|
+
/** Centro de costo de los depósitos de comisiones. Ausente = conserva el guardado; `null` = lo quita. */
|
|
324
|
+
costCenterId?: string | null;
|
|
323
325
|
};
|
|
324
326
|
}
|
|
325
327
|
export interface UpdatePoliciesResponse {
|
|
@@ -118,6 +118,11 @@ export interface CommissionPayoutPolicy {
|
|
|
118
118
|
walletDeposits: boolean;
|
|
119
119
|
/** Cada cuánto se le cobra a la cadena. */
|
|
120
120
|
chainBillingPeriod: CommissionBillingPeriodEnum;
|
|
121
|
+
/**
|
|
122
|
+
* Centro de costo con que el ledger imputa los depósitos de comisiones a la wallet. Ausente = sin
|
|
123
|
+
* configurar: el depósito se asienta como `UNASSIGNED`.
|
|
124
|
+
*/
|
|
125
|
+
costCenterId?: string;
|
|
121
126
|
}
|
|
122
127
|
/** Políticas de la cadena. `clawback` y `commissions` son `null` mientras la cadena no las guarda. */
|
|
123
128
|
export interface CommissionPolicies {
|
|
@@ -33,6 +33,8 @@ export interface SalePromotion {
|
|
|
33
33
|
stackable: boolean;
|
|
34
34
|
/** Solo en promos `REFERRAL`. */
|
|
35
35
|
referral?: ReferralPromotionConfig | null;
|
|
36
|
+
/** Centro de costo con que el ledger imputa lo que la promo paga a la wallet; ausente = sin configurar. */
|
|
37
|
+
costCenterId?: string;
|
|
36
38
|
status: SalePromotionStatusEnum;
|
|
37
39
|
/** Derivada; `null` cuando el estado no es `ACTIVE`. */
|
|
38
40
|
phase: SalePromotionPhaseEnum | null;
|
|
@@ -24,4 +24,10 @@ export declare class CreateSalePromotionRequest {
|
|
|
24
24
|
stackable?: boolean;
|
|
25
25
|
/** Evento, condiciones y premios de la promo de referido; ausente en las demás promos. */
|
|
26
26
|
referral?: ReferralPromotionInput | null;
|
|
27
|
+
/**
|
|
28
|
+
* Centro de costo con que el ledger imputa lo que esta promo paga a la wallet (bono de venta,
|
|
29
|
+
* premio de referido, bono de bienvenida). Ausente o `null` = sin centro: el pago se asienta como
|
|
30
|
+
* `UNASSIGNED`.
|
|
31
|
+
*/
|
|
32
|
+
costCenterId?: string | null;
|
|
27
33
|
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.CreateSalePromotionRequest = void 0;
|
|
13
13
|
const class_transformer_1 = require("class-transformer");
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
|
+
const costCenter_1 = require("../../../transaction/constants/costCenter");
|
|
15
16
|
const PromotionAppliesToEnum_1 = require("../../enums/PromotionAppliesToEnum");
|
|
16
17
|
const PromotionPaymentOptionEnum_1 = require("../../enums/PromotionPaymentOptionEnum");
|
|
17
18
|
const ReferralPromotionInput_1 = require("./ReferralPromotionInput");
|
|
@@ -103,3 +104,11 @@ __decorate([
|
|
|
103
104
|
(0, class_transformer_1.Type)(() => ReferralPromotionInput_1.ReferralPromotionInput),
|
|
104
105
|
__metadata("design:type", ReferralPromotionInput_1.ReferralPromotionInput)
|
|
105
106
|
], CreateSalePromotionRequest.prototype, "referral", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
(0, class_transformer_1.Expose)(),
|
|
109
|
+
(0, class_validator_1.IsOptional)(),
|
|
110
|
+
(0, class_validator_1.IsString)(),
|
|
111
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
112
|
+
(0, class_validator_1.MaxLength)(costCenter_1.COST_CENTER_ID_MAX_LENGTH),
|
|
113
|
+
__metadata("design:type", String)
|
|
114
|
+
], CreateSalePromotionRequest.prototype, "costCenterId", void 0);
|
|
@@ -24,4 +24,6 @@ export declare class UpdateSalePromotionRequest {
|
|
|
24
24
|
stackable?: boolean;
|
|
25
25
|
/** Evento, condiciones y premios de la promo de referido; ausente en las demás promos. */
|
|
26
26
|
referral?: ReferralPromotionInput | null;
|
|
27
|
+
/** Centro de costo de lo que la promo paga a la wallet. Ausente = conserva el actual; `null` = lo quita. */
|
|
28
|
+
costCenterId?: string | null;
|
|
27
29
|
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.UpdateSalePromotionRequest = void 0;
|
|
13
13
|
const class_transformer_1 = require("class-transformer");
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
|
+
const costCenter_1 = require("../../../transaction/constants/costCenter");
|
|
15
16
|
const PromotionAppliesToEnum_1 = require("../../enums/PromotionAppliesToEnum");
|
|
16
17
|
const PromotionPaymentOptionEnum_1 = require("../../enums/PromotionPaymentOptionEnum");
|
|
17
18
|
const ReferralPromotionInput_1 = require("./ReferralPromotionInput");
|
|
@@ -105,3 +106,11 @@ __decorate([
|
|
|
105
106
|
(0, class_transformer_1.Type)(() => ReferralPromotionInput_1.ReferralPromotionInput),
|
|
106
107
|
__metadata("design:type", ReferralPromotionInput_1.ReferralPromotionInput)
|
|
107
108
|
], UpdateSalePromotionRequest.prototype, "referral", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
(0, class_transformer_1.Expose)(),
|
|
111
|
+
(0, class_validator_1.IsOptional)(),
|
|
112
|
+
(0, class_validator_1.IsString)(),
|
|
113
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
114
|
+
(0, class_validator_1.MaxLength)(costCenter_1.COST_CENTER_ID_MAX_LENGTH),
|
|
115
|
+
__metadata("design:type", String)
|
|
116
|
+
], UpdateSalePromotionRequest.prototype, "costCenterId", void 0);
|
|
@@ -91,6 +91,8 @@ export interface EvaluatedDiscountCode {
|
|
|
91
91
|
rejectionCode: RetailPromotionsErrorCodeEnum | null;
|
|
92
92
|
lines: LinePromotionDiscount[];
|
|
93
93
|
totalDiscountCents: number;
|
|
94
|
+
/** Formas de pago con las que vale el código; null = cualquiera (o código inexistente). */
|
|
95
|
+
paymentOptions: PromotionPaymentOptionEnum[] | null;
|
|
94
96
|
}
|
|
95
97
|
/** Lo que gana el recomendado en una promo de referido vigente. */
|
|
96
98
|
export interface EvaluatedReferredReward {
|
|
@@ -3,3 +3,5 @@
|
|
|
3
3
|
* transacciones sin dueño contable quedan agrupadas aquí en lugar de perderse del índice.
|
|
4
4
|
*/
|
|
5
5
|
export declare const UNASSIGNED_COST_CENTER_ID = "UNASSIGNED";
|
|
6
|
+
/** Largo máximo de un centro de costo capturado en la configuración de un módulo que paga. */
|
|
7
|
+
export declare const COST_CENTER_ID_MAX_LENGTH = 64;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UNASSIGNED_COST_CENTER_ID = void 0;
|
|
3
|
+
exports.COST_CENTER_ID_MAX_LENGTH = exports.UNASSIGNED_COST_CENTER_ID = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Centro de costo de una transacción que llegó sin uno. El ledger lo escribe siempre, así que las
|
|
6
6
|
* transacciones sin dueño contable quedan agrupadas aquí en lugar de perderse del índice.
|
|
7
7
|
*/
|
|
8
8
|
exports.UNASSIGNED_COST_CENTER_ID = 'UNASSIGNED';
|
|
9
|
+
/** Largo máximo de un centro de costo capturado en la configuración de un módulo que paga. */
|
|
10
|
+
exports.COST_CENTER_ID_MAX_LENGTH = 64;
|
package/package.json
CHANGED
package/src/collection/index.ts
CHANGED
|
@@ -17,9 +17,6 @@ export * from './enums/DisbursementType';
|
|
|
17
17
|
export * from './constants/CollectionResultLimits';
|
|
18
18
|
export * from './validators/IsCentPrecision';
|
|
19
19
|
|
|
20
|
-
// Interfaces
|
|
21
|
-
export * from './interfaces/TenantCostCenters';
|
|
22
|
-
|
|
23
20
|
// DTOs
|
|
24
21
|
export * from './dtos/PendingChargeDto';
|
|
25
22
|
export * from './dtos/CollectRequest';
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
SCOPE_STORE_IDS_MAX_ITEMS,
|
|
20
20
|
} from '../../constants/offeringsInputLimits';
|
|
21
21
|
import { PROMOTION_RETAILER_IDS_MAX_ITEMS } from '../../constants/promotionRetailerScope';
|
|
22
|
+
import { COST_CENTER_ID_MAX_LENGTH } from '../../../transaction/constants/costCenter';
|
|
22
23
|
import { CreditPlanLevelEnum } from '../../enums/CreditPlanLevelEnum';
|
|
23
24
|
import { ProductCategoryEnum } from '../../../retailCatalog/enums/ProductCategoryEnum';
|
|
24
25
|
import { ProductTierEnum } from '../../../retailCatalog/enums/ProductTierEnum';
|
|
@@ -117,4 +118,15 @@ export class CreatePromotionRequest {
|
|
|
117
118
|
@IsOptional()
|
|
118
119
|
@IsInt()
|
|
119
120
|
budgetMaxCents?: number | null;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Centro de costo con que el ledger imputa el bono PCF de la promoción. Ausente o `null` = sin
|
|
124
|
+
* centro: el bono se asienta como `UNASSIGNED`.
|
|
125
|
+
*/
|
|
126
|
+
@Expose()
|
|
127
|
+
@IsOptional()
|
|
128
|
+
@IsString()
|
|
129
|
+
@IsNotEmpty()
|
|
130
|
+
@MaxLength(COST_CENTER_ID_MAX_LENGTH)
|
|
131
|
+
costCenterId?: string | null;
|
|
120
132
|
}
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
SCOPE_STORE_IDS_MAX_ITEMS,
|
|
21
21
|
} from '../../constants/offeringsInputLimits';
|
|
22
22
|
import { PROMOTION_RETAILER_IDS_MAX_ITEMS } from '../../constants/promotionRetailerScope';
|
|
23
|
+
import { COST_CENTER_ID_MAX_LENGTH } from '../../../transaction/constants/costCenter';
|
|
23
24
|
import { CreditPlanLevelEnum } from '../../enums/CreditPlanLevelEnum';
|
|
24
25
|
import { ProductCategoryEnum } from '../../../retailCatalog/enums/ProductCategoryEnum';
|
|
25
26
|
import { ProductTierEnum } from '../../../retailCatalog/enums/ProductTierEnum';
|
|
@@ -123,6 +124,14 @@ export class UpdatePromotionRequest {
|
|
|
123
124
|
@IsInt()
|
|
124
125
|
budgetMaxCents?: number | null;
|
|
125
126
|
|
|
127
|
+
/** Centro de costo del bono PCF. Ausente = conserva el actual; `null` = lo quita. */
|
|
128
|
+
@Expose()
|
|
129
|
+
@IsOptional()
|
|
130
|
+
@IsString()
|
|
131
|
+
@IsNotEmpty()
|
|
132
|
+
@MaxLength(COST_CENTER_ID_MAX_LENGTH)
|
|
133
|
+
costCenterId?: string | null;
|
|
134
|
+
|
|
126
135
|
/** Motivo del cambio; queda en la bitácora de la promoción. */
|
|
127
136
|
@Expose()
|
|
128
137
|
@IsOptional()
|
|
@@ -12,6 +12,11 @@ export interface PromotionBonusResponse {
|
|
|
12
12
|
/** Versión de la promoción al reservar: el monto queda congelado aunque la promo se edite. */
|
|
13
13
|
promotionVersion: number;
|
|
14
14
|
amountCents: number;
|
|
15
|
+
/**
|
|
16
|
+
* Centro de costo de la promoción al reservar, congelado como el monto. Quien paga lo manda al motor
|
|
17
|
+
* de cobro; ausente = el ledger asienta el bono como `UNASSIGNED`.
|
|
18
|
+
*/
|
|
19
|
+
costCenterId?: string;
|
|
15
20
|
status: PromotionBonusStatusEnum;
|
|
16
21
|
/** Folio del processor. `null` mientras no haya cerrado, o si cerró sin darlo. */
|
|
17
22
|
transactionId: string | null;
|
|
@@ -39,6 +39,8 @@ export interface PromotionResponse {
|
|
|
39
39
|
phase: PromotionPhaseEnum | null;
|
|
40
40
|
/** Tope de presupuesto; `null` = sin tope. */
|
|
41
41
|
budgetMaxCents: number | null;
|
|
42
|
+
/** Centro de costo con que el ledger imputa el bono PCF; ausente = sin configurar. */
|
|
43
|
+
costCenterId?: string;
|
|
42
44
|
budgetConsumedCents: number;
|
|
43
45
|
creditsGenerated: number;
|
|
44
46
|
version: number;
|
|
@@ -343,7 +343,12 @@ export interface UpdatePoliciesRequest {
|
|
|
343
343
|
clawback: { cancelacionDias: number; devolucionDias: number; npiM30Dias: number };
|
|
344
344
|
commissions: { multiplicadorMaxBps: number; ventanaDefault: CommissionWindowEnum };
|
|
345
345
|
/** Opcional para que un editor que todavía no la manda siga funcionando. */
|
|
346
|
-
payouts?: {
|
|
346
|
+
payouts?: {
|
|
347
|
+
walletDeposits: boolean;
|
|
348
|
+
chainBillingPeriod: CommissionBillingPeriodEnum;
|
|
349
|
+
/** Centro de costo de los depósitos de comisiones. Ausente = conserva el guardado; `null` = lo quita. */
|
|
350
|
+
costCenterId?: string | null;
|
|
351
|
+
};
|
|
347
352
|
}
|
|
348
353
|
|
|
349
354
|
export interface UpdatePoliciesResponse {
|
|
@@ -130,6 +130,11 @@ export interface CommissionPayoutPolicy {
|
|
|
130
130
|
walletDeposits: boolean;
|
|
131
131
|
/** Cada cuánto se le cobra a la cadena. */
|
|
132
132
|
chainBillingPeriod: CommissionBillingPeriodEnum;
|
|
133
|
+
/**
|
|
134
|
+
* Centro de costo con que el ledger imputa los depósitos de comisiones a la wallet. Ausente = sin
|
|
135
|
+
* configurar: el depósito se asienta como `UNASSIGNED`.
|
|
136
|
+
*/
|
|
137
|
+
costCenterId?: string;
|
|
133
138
|
}
|
|
134
139
|
|
|
135
140
|
/** Políticas de la cadena. `clawback` y `commissions` son `null` mientras la cadena no las guarda. */
|
|
@@ -34,6 +34,8 @@ export interface SalePromotion {
|
|
|
34
34
|
stackable: boolean;
|
|
35
35
|
/** Solo en promos `REFERRAL`. */
|
|
36
36
|
referral?: ReferralPromotionConfig | null;
|
|
37
|
+
/** Centro de costo con que el ledger imputa lo que la promo paga a la wallet; ausente = sin configurar. */
|
|
38
|
+
costCenterId?: string;
|
|
37
39
|
status: SalePromotionStatusEnum;
|
|
38
40
|
/** Derivada; `null` cuando el estado no es `ACTIVE`. */
|
|
39
41
|
phase: SalePromotionPhaseEnum | null;
|
|
@@ -9,8 +9,10 @@ import {
|
|
|
9
9
|
IsNotEmpty,
|
|
10
10
|
IsOptional,
|
|
11
11
|
IsString,
|
|
12
|
+
MaxLength,
|
|
12
13
|
ValidateNested,
|
|
13
14
|
} from 'class-validator';
|
|
15
|
+
import { COST_CENTER_ID_MAX_LENGTH } from '../../../transaction/constants/costCenter';
|
|
14
16
|
import { PromotionAppliesToEnum } from '../../enums/PromotionAppliesToEnum';
|
|
15
17
|
import { PromotionPaymentOptionEnum } from '../../enums/PromotionPaymentOptionEnum';
|
|
16
18
|
import { ReferralPromotionInput } from './ReferralPromotionInput';
|
|
@@ -93,4 +95,16 @@ export class CreateSalePromotionRequest {
|
|
|
93
95
|
@ValidateNested()
|
|
94
96
|
@Type(() => ReferralPromotionInput)
|
|
95
97
|
referral?: ReferralPromotionInput | null;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Centro de costo con que el ledger imputa lo que esta promo paga a la wallet (bono de venta,
|
|
101
|
+
* premio de referido, bono de bienvenida). Ausente o `null` = sin centro: el pago se asienta como
|
|
102
|
+
* `UNASSIGNED`.
|
|
103
|
+
*/
|
|
104
|
+
@Expose()
|
|
105
|
+
@IsOptional()
|
|
106
|
+
@IsString()
|
|
107
|
+
@IsNotEmpty()
|
|
108
|
+
@MaxLength(COST_CENTER_ID_MAX_LENGTH)
|
|
109
|
+
costCenterId?: string | null;
|
|
96
110
|
}
|
|
@@ -8,8 +8,10 @@ import {
|
|
|
8
8
|
IsNotEmpty,
|
|
9
9
|
IsOptional,
|
|
10
10
|
IsString,
|
|
11
|
+
MaxLength,
|
|
11
12
|
ValidateNested,
|
|
12
13
|
} from 'class-validator';
|
|
14
|
+
import { COST_CENTER_ID_MAX_LENGTH } from '../../../transaction/constants/costCenter';
|
|
13
15
|
import { PromotionAppliesToEnum } from '../../enums/PromotionAppliesToEnum';
|
|
14
16
|
import { PromotionPaymentOptionEnum } from '../../enums/PromotionPaymentOptionEnum';
|
|
15
17
|
import { ReferralPromotionInput } from './ReferralPromotionInput';
|
|
@@ -94,4 +96,12 @@ export class UpdateSalePromotionRequest {
|
|
|
94
96
|
@ValidateNested()
|
|
95
97
|
@Type(() => ReferralPromotionInput)
|
|
96
98
|
referral?: ReferralPromotionInput | null;
|
|
99
|
+
|
|
100
|
+
/** Centro de costo de lo que la promo paga a la wallet. Ausente = conserva el actual; `null` = lo quita. */
|
|
101
|
+
@Expose()
|
|
102
|
+
@IsOptional()
|
|
103
|
+
@IsString()
|
|
104
|
+
@IsNotEmpty()
|
|
105
|
+
@MaxLength(COST_CENTER_ID_MAX_LENGTH)
|
|
106
|
+
costCenterId?: string | null;
|
|
97
107
|
}
|
|
@@ -98,6 +98,8 @@ export interface EvaluatedDiscountCode {
|
|
|
98
98
|
rejectionCode: RetailPromotionsErrorCodeEnum | null;
|
|
99
99
|
lines: LinePromotionDiscount[];
|
|
100
100
|
totalDiscountCents: number;
|
|
101
|
+
/** Formas de pago con las que vale el código; null = cualquiera (o código inexistente). */
|
|
102
|
+
paymentOptions: PromotionPaymentOptionEnum[] | null;
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
/** Lo que gana el recomendado en una promo de referido vigente. */
|
|
@@ -3,3 +3,6 @@
|
|
|
3
3
|
* transacciones sin dueño contable quedan agrupadas aquí en lugar de perderse del índice.
|
|
4
4
|
*/
|
|
5
5
|
export const UNASSIGNED_COST_CENTER_ID = 'UNASSIGNED';
|
|
6
|
+
|
|
7
|
+
/** Largo máximo de un centro de costo capturado en la configuración de un módulo que paga. */
|
|
8
|
+
export const COST_CENTER_ID_MAX_LENGTH = 64;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { TenantCostCenters } from '../../../src/collection/index';
|
|
2
|
-
|
|
3
|
-
describe('TenantCostCenters', () => {
|
|
4
|
-
it('cada movimiento del tenant tiene su centro de costo opcional', () => {
|
|
5
|
-
const all: TenantCostCenters = {
|
|
6
|
-
welcomeBonus: 'SK-BONO-BIENVENIDA',
|
|
7
|
-
creditPromotion: 'SK-PROMO-CREDITO',
|
|
8
|
-
salePromotion: 'SK-PROMO-VENTA',
|
|
9
|
-
commission: 'SK-COMISIONES',
|
|
10
|
-
};
|
|
11
|
-
const none: TenantCostCenters = {};
|
|
12
|
-
expect(Object.keys(all)).toEqual(['welcomeBonus', 'creditPromotion', 'salePromotion', 'commission']);
|
|
13
|
-
expect(none).toEqual({});
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centros de costo de un tenant para los movimientos que paga desde su bolsa. Cada servicio que
|
|
3
|
-
* dispersa lee el suyo de la configuración del tenant; si falta, el ledger lo asienta como no asignado.
|
|
4
|
-
*/
|
|
5
|
-
export interface TenantCostCenters {
|
|
6
|
-
/** Bono de bienvenida al alta del cliente. */
|
|
7
|
-
welcomeBonus?: string;
|
|
8
|
-
/** Promociones ligadas al crédito. */
|
|
9
|
-
creditPromotion?: string;
|
|
10
|
-
/** Promociones ligadas a la venta. */
|
|
11
|
-
salePromotion?: string;
|
|
12
|
-
/** Comisiones a vendedores. */
|
|
13
|
-
commission?: string;
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centros de costo de un tenant para los movimientos que paga desde su bolsa. Cada servicio que
|
|
3
|
-
* dispersa lee el suyo de la configuración del tenant; si falta, el ledger lo asienta como no asignado.
|
|
4
|
-
*/
|
|
5
|
-
export interface TenantCostCenters {
|
|
6
|
-
/** Bono de bienvenida al alta del cliente. */
|
|
7
|
-
welcomeBonus?: string;
|
|
8
|
-
/** Promociones ligadas al crédito. */
|
|
9
|
-
creditPromotion?: string;
|
|
10
|
-
/** Promociones ligadas a la venta. */
|
|
11
|
-
salePromotion?: string;
|
|
12
|
-
/** Comisiones a vendedores. */
|
|
13
|
-
commission?: string;
|
|
14
|
-
}
|