@fiado/type-kit 3.647.0 → 3.649.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/collection/costCenter.test.ts +23 -4
- package/_test_/unit/costCenter/moduleCostCenterConfig.test.ts +77 -0
- package/bin/collection/dtos/CollectRequest.d.ts +6 -0
- package/bin/collection/dtos/CollectRequest.js +6 -0
- package/bin/collection/dtos/CollectionProductConfigDto.d.ts +0 -2
- package/bin/collection/dtos/CollectionProductConfigDto.js +0 -6
- package/bin/collection/dtos/RegisterCollectibleRequest.d.ts +6 -0
- package/bin/collection/dtos/RegisterCollectibleRequest.js +6 -0
- package/bin/collection/dtos/UpsertProductConfigRequest.d.ts +0 -2
- package/bin/collection/dtos/UpsertProductConfigRequest.js +0 -6
- 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/transaction/constants/costCenter.d.ts +2 -0
- package/bin/transaction/constants/costCenter.js +3 -1
- package/bin/transactionProcessor/dtos/AuthorizeAdjustmentTransactionRequest.d.ts +2 -0
- package/bin/transactionProcessor/dtos/AuthorizeRewardTopupRequest.d.ts +2 -0
- package/bin/transactionProcessor/dtos/AuthorizeRewardTopupRequest.js +6 -0
- package/package.json +1 -1
- package/src/collection/dtos/CollectRequest.ts +8 -1
- package/src/collection/dtos/CollectionProductConfigDto.ts +1 -3
- package/src/collection/dtos/RegisterCollectibleRequest.ts +8 -1
- package/src/collection/dtos/UpsertProductConfigRequest.ts +1 -3
- 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/transaction/constants/costCenter.ts +3 -0
- package/src/transactionProcessor/dtos/AuthorizeAdjustmentTransactionRequest.ts +2 -0
- package/src/transactionProcessor/dtos/AuthorizeRewardTopupRequest.ts +7 -1
- 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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import { plainToInstance } from 'class-transformer';
|
|
3
3
|
import { validate } from 'class-validator';
|
|
4
|
-
import { CollectionProductConfigDto, UpsertProductConfigRequest } from '../../../src/collection/index';
|
|
5
|
-
import { AuthorizeBonusRequest } from '../../../src/transactionProcessor/index';
|
|
4
|
+
import { CollectRequest, CollectionProductConfigDto, RegisterCollectibleRequest, UpsertProductConfigRequest } from '../../../src/collection/index';
|
|
5
|
+
import { AuthorizeBonusRequest, AuthorizeRewardTopupRequest } from '../../../src/transactionProcessor/index';
|
|
6
6
|
|
|
7
7
|
async function invalidProperties<T extends object>(cls: new () => T, body: Record<string, unknown>): Promise<string[]> {
|
|
8
8
|
return (await validate(plainToInstance(cls, body) as object)).map((e) => e.property);
|
|
@@ -24,6 +24,13 @@ const CONFIG = {
|
|
|
24
24
|
updatedBy: 'system',
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
const REGISTER = { directoryId: 'dir-1', tenantId: 'surekeep', domain: 'loan-credit', productId: 'loan', chargeId: 'c-1' };
|
|
28
|
+
const COLLECT = { ...REGISTER, amount: 150.25 };
|
|
29
|
+
const TOPUP = {
|
|
30
|
+
idempotencyKey: 'RW-1', directoryId: 'dir-1', phone: '5512345678', moduleName: 'm', benefitId: 'b1', leafId: 'l1',
|
|
31
|
+
productId: 'p1', amount: 15, concept: 'Recarga',
|
|
32
|
+
};
|
|
33
|
+
|
|
27
34
|
const BONUS = {
|
|
28
35
|
idempotencyKey: 'bonus-1',
|
|
29
36
|
productCatalogId: 'cat-1',
|
|
@@ -33,9 +40,10 @@ const BONUS = {
|
|
|
33
40
|
};
|
|
34
41
|
|
|
35
42
|
describe.each([
|
|
36
|
-
['
|
|
37
|
-
['
|
|
43
|
+
['RegisterCollectibleRequest', RegisterCollectibleRequest, REGISTER],
|
|
44
|
+
['CollectRequest', CollectRequest, COLLECT],
|
|
38
45
|
['AuthorizeBonusRequest', AuthorizeBonusRequest, BONUS],
|
|
46
|
+
['AuthorizeRewardTopupRequest', AuthorizeRewardTopupRequest, TOPUP],
|
|
39
47
|
] as const)('%s.costCenterId', (_name, cls, valid) => {
|
|
40
48
|
const klass = cls as unknown as new () => object;
|
|
41
49
|
|
|
@@ -52,3 +60,14 @@ describe.each([
|
|
|
52
60
|
expect(await invalidProperties(klass, { ...valid, costCenterId: 3 })).toEqual(['costCenterId']);
|
|
53
61
|
});
|
|
54
62
|
});
|
|
63
|
+
|
|
64
|
+
describe.each([
|
|
65
|
+
['CollectionProductConfigDto', CollectionProductConfigDto, CONFIG],
|
|
66
|
+
['UpsertProductConfigRequest', UpsertProductConfigRequest, UPSERT],
|
|
67
|
+
] as const)('%s sin centro de costo', (_name, cls, valid) => {
|
|
68
|
+
it('el centro de costo lo manda el originador en cada cobro, no la configuración del producto', async () => {
|
|
69
|
+
const dto = plainToInstance(cls as unknown as new () => object, { ...valid, costCenterId: 'SK-COBRANZA' });
|
|
70
|
+
const errors = await validate(dto as object, { whitelist: true, forbidNonWhitelisted: true });
|
|
71
|
+
expect(errors.map((e) => e.property)).toEqual(['costCenterId']);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -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
|
+
});
|
|
@@ -20,4 +20,10 @@ export declare class CollectRequest {
|
|
|
20
20
|
* lo normal; se manda sólo cuando este cobro tiene condiciones propias.
|
|
21
21
|
*/
|
|
22
22
|
pricing?: CollectionPricingDto;
|
|
23
|
+
/**
|
|
24
|
+
* Centro de costo con que el ledger asienta el cobro; lo decide la plataforma originadora por tipo de
|
|
25
|
+
* transacción. El motor lo guarda en la intención y lo reenvía al processor en cada intento. Ausente,
|
|
26
|
+
* el ledger lo asienta como `UNASSIGNED`.
|
|
27
|
+
*/
|
|
28
|
+
costCenterId?: string;
|
|
23
29
|
}
|
|
@@ -55,3 +55,9 @@ __decorate([
|
|
|
55
55
|
(0, class_transformer_1.Type)(() => CollectionPricingDto_1.CollectionPricingDto),
|
|
56
56
|
__metadata("design:type", CollectionPricingDto_1.CollectionPricingDto)
|
|
57
57
|
], CollectRequest.prototype, "pricing", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, class_validator_1.IsOptional)(),
|
|
60
|
+
(0, class_validator_1.IsString)(),
|
|
61
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], CollectRequest.prototype, "costCenterId", void 0);
|
|
@@ -17,8 +17,6 @@ export declare class CollectionProductConfigDto {
|
|
|
17
17
|
allowPartial: boolean;
|
|
18
18
|
retryPolicy: RetryPolicyDto;
|
|
19
19
|
reportTargets: string[];
|
|
20
|
-
/** Centro de costo con el que el ledger registra los cobros de este producto. */
|
|
21
|
-
costCenterId?: string;
|
|
22
20
|
createdBy: string;
|
|
23
21
|
updatedBy: string;
|
|
24
22
|
}
|
|
@@ -58,12 +58,6 @@ __decorate([
|
|
|
58
58
|
(0, class_validator_1.IsString)({ each: true }),
|
|
59
59
|
__metadata("design:type", Array)
|
|
60
60
|
], CollectionProductConfigDto.prototype, "reportTargets", void 0);
|
|
61
|
-
__decorate([
|
|
62
|
-
(0, class_validator_1.IsOptional)(),
|
|
63
|
-
(0, class_validator_1.IsString)(),
|
|
64
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
65
|
-
__metadata("design:type", String)
|
|
66
|
-
], CollectionProductConfigDto.prototype, "costCenterId", void 0);
|
|
67
61
|
__decorate([
|
|
68
62
|
(0, class_validator_1.IsString)(),
|
|
69
63
|
__metadata("design:type", String)
|
|
@@ -23,4 +23,10 @@ export declare class RegisterCollectibleRequest {
|
|
|
23
23
|
* cobro. Si un cargo se puede cobrar más de una vez, el ciclo va codificado aquí dentro.
|
|
24
24
|
*/
|
|
25
25
|
chargeId: string;
|
|
26
|
+
/**
|
|
27
|
+
* Centro de costo con que el ledger asienta el cobro; lo decide la plataforma originadora por tipo de
|
|
28
|
+
* transacción. El motor lo guarda en la intención y lo reenvía al processor en cada intento. Ausente,
|
|
29
|
+
* el ledger lo asienta como `UNASSIGNED`.
|
|
30
|
+
*/
|
|
31
|
+
costCenterId?: string;
|
|
26
32
|
}
|
|
@@ -41,3 +41,9 @@ __decorate([
|
|
|
41
41
|
(0, class_validator_1.IsString)(),
|
|
42
42
|
__metadata("design:type", String)
|
|
43
43
|
], RegisterCollectibleRequest.prototype, "chargeId", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, class_validator_1.IsOptional)(),
|
|
46
|
+
(0, class_validator_1.IsString)(),
|
|
47
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], RegisterCollectibleRequest.prototype, "costCenterId", void 0);
|
|
@@ -41,9 +41,3 @@ __decorate([
|
|
|
41
41
|
(0, class_validator_1.IsString)({ each: true }),
|
|
42
42
|
__metadata("design:type", Array)
|
|
43
43
|
], UpsertProductConfigRequest.prototype, "reportTargets", void 0);
|
|
44
|
-
__decorate([
|
|
45
|
-
(0, class_validator_1.IsOptional)(),
|
|
46
|
-
(0, class_validator_1.IsString)(),
|
|
47
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
48
|
-
__metadata("design:type", String)
|
|
49
|
-
], UpsertProductConfigRequest.prototype, "costCenterId", void 0);
|
|
@@ -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);
|
|
@@ -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;
|
|
@@ -11,4 +11,6 @@ export declare class AuthorizeAdjustmentTransactionRequest {
|
|
|
11
11
|
relatedTransactionNumber: string;
|
|
12
12
|
operation: OperationEnum;
|
|
13
13
|
concept: string;
|
|
14
|
+
/** Centro de costo del asiento del ajuste en el ledger; ausente, el ledger escribe `UNASSIGNED`. */
|
|
15
|
+
costCenterId?: string;
|
|
14
16
|
}
|
|
@@ -17,5 +17,7 @@ export declare class AuthorizeRewardTopupRequest {
|
|
|
17
17
|
/** En PESOS, no centavos. */
|
|
18
18
|
amount: number;
|
|
19
19
|
concept: string;
|
|
20
|
+
/** Centro de costo del asiento de la recarga en el ledger; ausente, el processor escribe `UNASSIGNED`. */
|
|
21
|
+
costCenterId?: string;
|
|
20
22
|
}
|
|
21
23
|
export default AuthorizeRewardTopupRequest;
|
|
@@ -71,4 +71,10 @@ __decorate([
|
|
|
71
71
|
(0, class_validator_1.MaxLength)(120),
|
|
72
72
|
__metadata("design:type", String)
|
|
73
73
|
], AuthorizeRewardTopupRequest.prototype, "concept", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, class_validator_1.IsOptional)(),
|
|
76
|
+
(0, class_validator_1.IsString)(),
|
|
77
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
78
|
+
__metadata("design:type", String)
|
|
79
|
+
], AuthorizeRewardTopupRequest.prototype, "costCenterId", void 0);
|
|
74
80
|
exports.default = AuthorizeRewardTopupRequest;
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IsString, IsNumber, IsOptional, ValidateNested } from 'class-validator';
|
|
1
|
+
import { IsNotEmpty, IsString, IsNumber, IsOptional, ValidateNested } from 'class-validator';
|
|
2
2
|
import { Type } from 'class-transformer';
|
|
3
3
|
import { CollectionPricingDto } from './CollectionPricingDto';
|
|
4
4
|
|
|
@@ -24,4 +24,11 @@ export class CollectRequest {
|
|
|
24
24
|
* lo normal; se manda sólo cuando este cobro tiene condiciones propias.
|
|
25
25
|
*/
|
|
26
26
|
@IsOptional() @ValidateNested() @Type(() => CollectionPricingDto) pricing?: CollectionPricingDto;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Centro de costo con que el ledger asienta el cobro; lo decide la plataforma originadora por tipo de
|
|
30
|
+
* transacción. El motor lo guarda en la intención y lo reenvía al processor en cada intento. Ausente,
|
|
31
|
+
* el ledger lo asienta como `UNASSIGNED`.
|
|
32
|
+
*/
|
|
33
|
+
@IsOptional() @IsString() @IsNotEmpty() costCenterId?: string;
|
|
27
34
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IsString, IsInt, IsArray, IsBoolean,
|
|
1
|
+
import { IsString, IsInt, IsArray, IsBoolean, ValidateNested } from 'class-validator';
|
|
2
2
|
import { Type } from 'class-transformer';
|
|
3
3
|
import { CollectionSourceDto } from './CollectionSourceDto';
|
|
4
4
|
import { RetryPolicyDto } from './RetryPolicyDto';
|
|
@@ -20,8 +20,6 @@ export class CollectionProductConfigDto {
|
|
|
20
20
|
@IsBoolean() allowPartial!: boolean;
|
|
21
21
|
@ValidateNested() @Type(() => RetryPolicyDto) retryPolicy!: RetryPolicyDto;
|
|
22
22
|
@IsArray() @IsString({ each: true }) reportTargets!: string[];
|
|
23
|
-
/** Centro de costo con el que el ledger registra los cobros de este producto. */
|
|
24
|
-
@IsOptional() @IsString() @IsNotEmpty() costCenterId?: string;
|
|
25
23
|
@IsString() createdBy!: string;
|
|
26
24
|
@IsString() updatedBy!: string;
|
|
27
25
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IsString } from 'class-validator';
|
|
1
|
+
import { IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Alta de un cargo cobrable: el dominio avisa de que hay algo que cobrar y el motor se encarga de
|
|
@@ -29,4 +29,11 @@ export class RegisterCollectibleRequest {
|
|
|
29
29
|
* cobro. Si un cargo se puede cobrar más de una vez, el ciclo va codificado aquí dentro.
|
|
30
30
|
*/
|
|
31
31
|
@IsString() chargeId!: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Centro de costo con que el ledger asienta el cobro; lo decide la plataforma originadora por tipo de
|
|
35
|
+
* transacción. El motor lo guarda en la intención y lo reenvía al processor en cada intento. Ausente,
|
|
36
|
+
* el ledger lo asienta como `UNASSIGNED`.
|
|
37
|
+
*/
|
|
38
|
+
@IsOptional() @IsString() @IsNotEmpty() costCenterId?: string;
|
|
32
39
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IsString, IsArray, IsBoolean,
|
|
1
|
+
import { IsString, IsArray, IsBoolean, ValidateNested } from 'class-validator';
|
|
2
2
|
import { Type } from 'class-transformer';
|
|
3
3
|
import { CollectionSourceDto } from './CollectionSourceDto';
|
|
4
4
|
import { RetryPolicyDto } from './RetryPolicyDto';
|
|
@@ -12,6 +12,4 @@ export class UpsertProductConfigRequest {
|
|
|
12
12
|
@IsBoolean() allowPartial!: boolean;
|
|
13
13
|
@ValidateNested() @Type(() => RetryPolicyDto) retryPolicy!: RetryPolicyDto;
|
|
14
14
|
@IsArray() @IsString({ each: true }) reportTargets!: string[];
|
|
15
|
-
/** Centro de costo con el que el ledger registra los cobros de este producto. */
|
|
16
|
-
@IsOptional() @IsString() @IsNotEmpty() costCenterId?: string;
|
|
17
15
|
}
|
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
|
}
|
|
@@ -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;
|
|
@@ -12,4 +12,6 @@ export class AuthorizeAdjustmentTransactionRequest {
|
|
|
12
12
|
relatedTransactionNumber: string;
|
|
13
13
|
operation: OperationEnum;
|
|
14
14
|
concept: string;
|
|
15
|
+
/** Centro de costo del asiento del ajuste en el ledger; ausente, el ledger escribe `UNASSIGNED`. */
|
|
16
|
+
costCenterId?: string;
|
|
15
17
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IsNotEmpty, IsNumber, IsPositive, IsString, Matches, MaxLength } from 'class-validator';
|
|
1
|
+
import { IsNotEmpty, IsNumber, IsOptional, IsPositive, IsString, Matches, MaxLength } from 'class-validator';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Pago de una recarga Bait de recompensa (`MEX_REWARD_TOPUP`). No toca ninguna wallet.
|
|
@@ -39,6 +39,12 @@ export class AuthorizeRewardTopupRequest {
|
|
|
39
39
|
@IsString()
|
|
40
40
|
@MaxLength(120)
|
|
41
41
|
concept: string;
|
|
42
|
+
|
|
43
|
+
/** Centro de costo del asiento de la recarga en el ledger; ausente, el processor escribe `UNASSIGNED`. */
|
|
44
|
+
@IsOptional()
|
|
45
|
+
@IsString()
|
|
46
|
+
@IsNotEmpty()
|
|
47
|
+
costCenterId?: string;
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
export default AuthorizeRewardTopupRequest;
|
|
@@ -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
|
-
}
|