@merkaly/api 0.33.2 → 0.35.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/finance/payment/payment.entity.d.ts +0 -18
- package/dist/finance/payment/payment.enum.d.ts +0 -1
- package/dist/finance/payment/payment.enum.js +0 -1
- package/dist/finance/payment/report.d.ts +0 -7
- package/dist/integration/payment/account.d.ts +11 -4
- package/dist/integration/payment/account.enum.d.ts +1 -1
- package/dist/integration/payment/account.enum.js +5 -5
- package/dist/integration/payment/charge.d.ts +1 -7
- package/dist/integration/payment/charge.enum.d.ts +0 -1
- package/dist/integration/payment/charge.enum.js +0 -1
- package/dist/integration/payment/charge.request.validator.d.ts +0 -11
- package/dist/integration/payment/charge.request.validator.js +1 -100
- package/dist/integration/payment/payment.account.entity.d.ts +3 -18
- package/dist/integration/payment/request.validator.d.ts +2 -2
- package/dist/integration/payment/request.validator.js +5 -5
- package/dist/order/purchase/purchase.entity.d.ts +1 -0
- package/dist/order/purchase/purchase.enum.d.ts +1 -0
- package/dist/order/purchase/purchase.enum.js +6 -0
- package/dist/order/sale/attention.enum.d.ts +2 -0
- package/dist/order/sale/attention.enum.js +4 -0
- package/dist/order/sale/checkout.request.validator.js +1 -1
- package/dist/order/sale/sale.entity.d.ts +14 -0
- package/dist/transaction.entity.d.ts +1 -0
- package/package.json +1 -1
|
@@ -21,31 +21,15 @@ export declare const FinancePaymentGatewayPixSchema: MongoSchema<FinancePaymentG
|
|
|
21
21
|
} & {
|
|
22
22
|
__v: number;
|
|
23
23
|
}>;
|
|
24
|
-
export declare class FinancePaymentGatewayCardEntity {
|
|
25
|
-
brand?: string | null;
|
|
26
|
-
last4?: string | null;
|
|
27
|
-
}
|
|
28
|
-
export declare const FinancePaymentGatewayCardSchema: MongoSchema<FinancePaymentGatewayCardEntity, import("mongoose").Model<FinancePaymentGatewayCardEntity, any, any, any, import("mongoose").Document<unknown, any, FinancePaymentGatewayCardEntity, any, {}> & FinancePaymentGatewayCardEntity & {
|
|
29
|
-
_id: import("mongoose").Types.ObjectId;
|
|
30
|
-
} & {
|
|
31
|
-
__v: number;
|
|
32
|
-
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, FinancePaymentGatewayCardEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<FinancePaymentGatewayCardEntity>, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").FlatRecord<FinancePaymentGatewayCardEntity> & {
|
|
33
|
-
_id: import("mongoose").Types.ObjectId;
|
|
34
|
-
} & {
|
|
35
|
-
__v: number;
|
|
36
|
-
}>;
|
|
37
24
|
export declare class FinancePaymentGatewayEntity {
|
|
38
25
|
provider: string;
|
|
39
26
|
reference?: string | null;
|
|
40
27
|
account?: PaymentChargeAccountEnum | null;
|
|
41
28
|
method: FinancePaymentMethodEnum;
|
|
42
29
|
status: string;
|
|
43
|
-
message?: string | null;
|
|
44
30
|
attempt: number;
|
|
45
|
-
cardAttempts: number;
|
|
46
31
|
amount: number;
|
|
47
32
|
pix?: FinancePaymentGatewayPixEntity | null;
|
|
48
|
-
card?: FinancePaymentGatewayCardEntity | null;
|
|
49
33
|
expiresAt?: Date | null;
|
|
50
34
|
syncedAt: Date;
|
|
51
35
|
}
|
|
@@ -65,8 +49,6 @@ export declare class FinancePaymentAttemptEntity {
|
|
|
65
49
|
status: FinancePaymentAttemptStatus;
|
|
66
50
|
rawStatus: string;
|
|
67
51
|
amount: number;
|
|
68
|
-
message?: string | null;
|
|
69
|
-
card?: FinancePaymentGatewayCardEntity | null;
|
|
70
52
|
expiresAt?: Date | null;
|
|
71
53
|
createdAt: Date;
|
|
72
54
|
syncedAt: Date;
|
|
@@ -8,7 +8,6 @@ export declare enum FinancePaymentStatusEnum {
|
|
|
8
8
|
}
|
|
9
9
|
export declare const FINANCE_PAYMENT_PAID_STATUSES: readonly FinancePaymentStatusEnum[];
|
|
10
10
|
export declare enum FinancePaymentMethodEnum {
|
|
11
|
-
CARD = "CARD",
|
|
12
11
|
PIX = "PIX",
|
|
13
12
|
TRANSFER = "TRANSFER",
|
|
14
13
|
CASH = "CASH",
|
|
@@ -13,7 +13,6 @@ export const FINANCE_PAYMENT_PAID_STATUSES = [
|
|
|
13
13
|
];
|
|
14
14
|
export var FinancePaymentMethodEnum;
|
|
15
15
|
(function (FinancePaymentMethodEnum) {
|
|
16
|
-
FinancePaymentMethodEnum["CARD"] = "CARD";
|
|
17
16
|
FinancePaymentMethodEnum["PIX"] = "PIX";
|
|
18
17
|
FinancePaymentMethodEnum["TRANSFER"] = "TRANSFER";
|
|
19
18
|
FinancePaymentMethodEnum["CASH"] = "CASH";
|
|
@@ -18,7 +18,6 @@ export interface FinancePaymentReportStore {
|
|
|
18
18
|
orgName: string;
|
|
19
19
|
paidAmount: number;
|
|
20
20
|
paidCount: number;
|
|
21
|
-
rejectedCount: number;
|
|
22
21
|
splitProblemCount: number;
|
|
23
22
|
}
|
|
24
23
|
export interface FinancePaymentReportSummary {
|
|
@@ -34,16 +33,10 @@ export interface FinancePaymentReportSummary {
|
|
|
34
33
|
stores: FinancePaymentReportStore[];
|
|
35
34
|
to: Date;
|
|
36
35
|
}
|
|
37
|
-
export interface FinancePaymentReportCard {
|
|
38
|
-
brand: string | null;
|
|
39
|
-
last4: string | null;
|
|
40
|
-
}
|
|
41
36
|
export interface FinancePaymentReportItem {
|
|
42
37
|
amount: number;
|
|
43
38
|
attempt: number;
|
|
44
|
-
card: FinancePaymentReportCard | null;
|
|
45
39
|
createdAt: Date;
|
|
46
|
-
message: string | null;
|
|
47
40
|
method: FinancePaymentMethodEnum;
|
|
48
41
|
orgId: string;
|
|
49
42
|
orgName: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PaymentAccountApprovalEnum, PaymentAccountCompanyTypeEnum, PaymentAccountDocumentStatusEnum,
|
|
1
|
+
import type { PaymentAccountApprovalEnum, PaymentAccountCompanyTypeEnum, PaymentAccountDocumentStatusEnum, PaymentAccountTypeEnum, PaymentPixKeyTypeEnum } from './account.enum.js';
|
|
2
2
|
import type { PaymentProviderEnum } from './provider.enum.js';
|
|
3
3
|
export interface PaymentAccountApproval {
|
|
4
4
|
general: PaymentAccountApprovalEnum;
|
|
@@ -13,8 +13,8 @@ export interface PaymentAccountWithdrawal {
|
|
|
13
13
|
export interface PaymentAccountSummary {
|
|
14
14
|
accountId: string;
|
|
15
15
|
walletId: string;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
accountType: PaymentAccountTypeEnum;
|
|
17
|
+
document: string;
|
|
18
18
|
name: string;
|
|
19
19
|
email: string;
|
|
20
20
|
approval: PaymentAccountApproval | null;
|
|
@@ -55,6 +55,13 @@ export interface PaymentAccountPending {
|
|
|
55
55
|
export interface PaymentAccountBalance {
|
|
56
56
|
balance: number;
|
|
57
57
|
pending: PaymentAccountPending | null;
|
|
58
|
+
withdrawable: number;
|
|
59
|
+
retained: number;
|
|
60
|
+
}
|
|
61
|
+
export interface PaymentWithdrawableLedger {
|
|
62
|
+
released: number;
|
|
63
|
+
retained: number;
|
|
64
|
+
withdrawn: number;
|
|
58
65
|
}
|
|
59
66
|
export interface PaymentAccountTransfer {
|
|
60
67
|
id: string;
|
|
@@ -72,7 +79,7 @@ export type PaymentWithdrawalAuthorization = {
|
|
|
72
79
|
refuseReason: string;
|
|
73
80
|
};
|
|
74
81
|
export interface PaymentAccountCommercialInfo {
|
|
75
|
-
|
|
82
|
+
accountType: PaymentAccountTypeEnum;
|
|
76
83
|
cpfCnpj: string;
|
|
77
84
|
name: string | null;
|
|
78
85
|
companyName: string | null;
|
|
@@ -5,11 +5,11 @@ export var PaymentAccountApprovalEnum;
|
|
|
5
5
|
PaymentAccountApprovalEnum["APPROVED"] = "APPROVED";
|
|
6
6
|
PaymentAccountApprovalEnum["REJECTED"] = "REJECTED";
|
|
7
7
|
})(PaymentAccountApprovalEnum || (PaymentAccountApprovalEnum = {}));
|
|
8
|
-
export var
|
|
9
|
-
(function (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
})(
|
|
8
|
+
export var PaymentAccountTypeEnum;
|
|
9
|
+
(function (PaymentAccountTypeEnum) {
|
|
10
|
+
PaymentAccountTypeEnum["INDIVIDUAL"] = "INDIVIDUAL";
|
|
11
|
+
PaymentAccountTypeEnum["COMPANY"] = "COMPANY";
|
|
12
|
+
})(PaymentAccountTypeEnum || (PaymentAccountTypeEnum = {}));
|
|
13
13
|
export var PaymentAccountCompanyTypeEnum;
|
|
14
14
|
(function (PaymentAccountCompanyTypeEnum) {
|
|
15
15
|
PaymentAccountCompanyTypeEnum["MEI"] = "MEI";
|
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
import type { PaymentChargeStatusEnum } from './charge.enum.js';
|
|
2
2
|
import type { PaymentProviderEnum } from './provider.enum.js';
|
|
3
3
|
import type { FinancePaymentMethodEnum } from '../../finance/payment';
|
|
4
|
-
export type StorePaymentMethod = FinancePaymentMethodEnum.PIX
|
|
4
|
+
export type StorePaymentMethod = FinancePaymentMethodEnum.PIX;
|
|
5
5
|
export interface StorePaymentConfig {
|
|
6
6
|
methods: StorePaymentMethod[];
|
|
7
7
|
provider: PaymentProviderEnum | null;
|
|
8
8
|
}
|
|
9
|
-
export interface PaymentChargeCard {
|
|
10
|
-
brand: string | null;
|
|
11
|
-
last4: string | null;
|
|
12
|
-
}
|
|
13
9
|
export interface PaymentCharge {
|
|
14
10
|
amount: number;
|
|
15
11
|
attempt: number;
|
|
16
|
-
card: PaymentChargeCard | null;
|
|
17
12
|
expiresAt: Date | null;
|
|
18
13
|
method: StorePaymentMethod;
|
|
19
|
-
message: string | null;
|
|
20
14
|
paid: boolean;
|
|
21
15
|
qrCode: string | null;
|
|
22
16
|
qrCodeImage: string | null;
|
|
@@ -3,7 +3,6 @@ export var PaymentChargeStatusEnum;
|
|
|
3
3
|
PaymentChargeStatusEnum["PENDING"] = "PENDING";
|
|
4
4
|
PaymentChargeStatusEnum["IN_PROCESS"] = "IN_PROCESS";
|
|
5
5
|
PaymentChargeStatusEnum["APPROVED"] = "APPROVED";
|
|
6
|
-
PaymentChargeStatusEnum["REJECTED"] = "REJECTED";
|
|
7
6
|
PaymentChargeStatusEnum["CANCELLED"] = "CANCELLED";
|
|
8
7
|
PaymentChargeStatusEnum["EXPIRED"] = "EXPIRED";
|
|
9
8
|
PaymentChargeStatusEnum["REFUNDED"] = "REFUNDED";
|
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import { AbstractRequestValidator } from '../../abstract.validator.js';
|
|
2
2
|
import type { StorePaymentMethod } from './charge.js';
|
|
3
|
-
export declare function isCardNumber(value: unknown): boolean;
|
|
4
|
-
export declare function isCardExpiry(month: unknown, year: unknown): boolean;
|
|
5
|
-
export declare class PaymentCardRequestValidator extends AbstractRequestValidator {
|
|
6
|
-
holderName: string;
|
|
7
|
-
number: string;
|
|
8
|
-
expiryMonth: string;
|
|
9
|
-
expiryYear: string;
|
|
10
|
-
ccv: string;
|
|
11
|
-
holderDocument?: string;
|
|
12
|
-
}
|
|
13
3
|
export declare class CreatePaymentChargeRequestValidator extends AbstractRequestValidator {
|
|
14
4
|
method: StorePaymentMethod;
|
|
15
|
-
card?: PaymentCardRequestValidator;
|
|
16
5
|
}
|
|
@@ -8,112 +8,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
const card_validator_1 = __importDefault(require("card-validator"));
|
|
15
|
-
import * as class_transformer_1 from "class-transformer";
|
|
16
11
|
import * as class_validator_1 from "class-validator";
|
|
17
12
|
import * as payment_enum_1 from '../../finance/payment/index.js';
|
|
18
13
|
import * as abstract_validator_1 from '../../abstract.validator.js';
|
|
19
|
-
import * as person_validator_1 from '../../person.validator.js';
|
|
20
|
-
import * as transform_validator_1 from '../../transform.validator.js';
|
|
21
|
-
import * as request_validator_1 from './request.validator.js';
|
|
22
|
-
export function isCardNumber(value) {
|
|
23
|
-
return (typeof value === 'string' && /^\d{13,19}$/.test(value) && card_validator_1.default.number(value).isValid);
|
|
24
|
-
}
|
|
25
|
-
export function isCardExpiry(month, year) {
|
|
26
|
-
if (typeof month !== 'string' || typeof year !== 'string')
|
|
27
|
-
return false;
|
|
28
|
-
return (/^(0[1-9]|1[0-2])$/.test(month) &&
|
|
29
|
-
/^\d{4}$/.test(year) &&
|
|
30
|
-
card_validator_1.default.expirationDate({ month, year }).isValid);
|
|
31
|
-
}
|
|
32
|
-
function IsCardNumber() {
|
|
33
|
-
return (0, class_validator_1.ValidateBy)({
|
|
34
|
-
name: 'isCardNumber',
|
|
35
|
-
validator: {
|
|
36
|
-
defaultMessage: () => 'card.number is not a valid card number',
|
|
37
|
-
validate: isCardNumber,
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
function IsCardExpiry() {
|
|
42
|
-
return (0, class_validator_1.ValidateBy)({
|
|
43
|
-
name: 'isCardExpiry',
|
|
44
|
-
validator: {
|
|
45
|
-
defaultMessage: () => 'card expiry must be a valid future month (MM and YYYY)',
|
|
46
|
-
validate: (year, args) => isCardExpiry(args.object.expiryMonth, year),
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
function IsCpfOrCnpj() {
|
|
51
|
-
return (0, class_validator_1.ValidateBy)({
|
|
52
|
-
name: 'isCpfOrCnpj',
|
|
53
|
-
validator: {
|
|
54
|
-
defaultMessage: () => '$property must be a valid CPF or CNPJ',
|
|
55
|
-
validate: (value) => (0, person_validator_1.isCpf)(value) || (0, request_validator_1.isCnpj)(value),
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
const twoDigits = ({ value }) => typeof value === 'number' ? String(value).padStart(2, '0') : (0, transform_validator_1.digits)({ value });
|
|
60
|
-
const fourDigits = ({ value }) => {
|
|
61
|
-
const year = typeof value === 'number' ? String(value) : (0, transform_validator_1.digits)({ value });
|
|
62
|
-
return typeof year === 'string' && year.length === 2 ? `20${year}` : year;
|
|
63
|
-
};
|
|
64
|
-
export class PaymentCardRequestValidator extends abstract_validator_1.AbstractRequestValidator {
|
|
65
|
-
holderName;
|
|
66
|
-
number;
|
|
67
|
-
expiryMonth;
|
|
68
|
-
expiryYear;
|
|
69
|
-
ccv;
|
|
70
|
-
holderDocument;
|
|
71
|
-
}
|
|
72
|
-
__decorate([
|
|
73
|
-
(0, class_validator_1.IsString)(),
|
|
74
|
-
(0, class_validator_1.Length)(2, 100, { message: 'card.holderName must have 2 to 100 characters' }),
|
|
75
|
-
(0, class_transformer_1.Transform)(transform_validator_1.trim),
|
|
76
|
-
__metadata("design:type", String)
|
|
77
|
-
], PaymentCardRequestValidator.prototype, "holderName", void 0);
|
|
78
|
-
__decorate([
|
|
79
|
-
IsCardNumber(),
|
|
80
|
-
(0, class_transformer_1.Transform)(transform_validator_1.digits),
|
|
81
|
-
__metadata("design:type", String)
|
|
82
|
-
], PaymentCardRequestValidator.prototype, "number", void 0);
|
|
83
|
-
__decorate([
|
|
84
|
-
(0, class_validator_1.Matches)(/^(0[1-9]|1[0-2])$/, { message: 'card.expiryMonth must be MM (01 to 12)' }),
|
|
85
|
-
(0, class_transformer_1.Transform)(twoDigits),
|
|
86
|
-
__metadata("design:type", String)
|
|
87
|
-
], PaymentCardRequestValidator.prototype, "expiryMonth", void 0);
|
|
88
|
-
__decorate([
|
|
89
|
-
IsCardExpiry(),
|
|
90
|
-
(0, class_transformer_1.Transform)(fourDigits),
|
|
91
|
-
__metadata("design:type", String)
|
|
92
|
-
], PaymentCardRequestValidator.prototype, "expiryYear", void 0);
|
|
93
|
-
__decorate([
|
|
94
|
-
(0, class_validator_1.Matches)(/^\d{3,4}$/, { message: 'card.ccv must have 3 or 4 digits' }),
|
|
95
|
-
(0, class_transformer_1.Transform)(transform_validator_1.digits),
|
|
96
|
-
__metadata("design:type", String)
|
|
97
|
-
], PaymentCardRequestValidator.prototype, "ccv", void 0);
|
|
98
|
-
__decorate([
|
|
99
|
-
IsCpfOrCnpj(),
|
|
100
|
-
(0, class_validator_1.IsOptional)(),
|
|
101
|
-
(0, class_transformer_1.Transform)(transform_validator_1.digits),
|
|
102
|
-
__metadata("design:type", String)
|
|
103
|
-
], PaymentCardRequestValidator.prototype, "holderDocument", void 0);
|
|
104
|
-
const isCard = (body) => body.method === payment_enum_1.FinancePaymentMethodEnum.CARD;
|
|
105
14
|
export class CreatePaymentChargeRequestValidator extends abstract_validator_1.AbstractRequestValidator {
|
|
106
15
|
method;
|
|
107
|
-
card;
|
|
108
16
|
}
|
|
109
17
|
__decorate([
|
|
110
|
-
(0, class_validator_1.IsIn)([payment_enum_1.FinancePaymentMethodEnum.PIX
|
|
18
|
+
(0, class_validator_1.IsIn)([payment_enum_1.FinancePaymentMethodEnum.PIX]),
|
|
111
19
|
__metadata("design:type", String)
|
|
112
20
|
], CreatePaymentChargeRequestValidator.prototype, "method", void 0);
|
|
113
|
-
__decorate([
|
|
114
|
-
(0, class_validator_1.ValidateIf)(isCard),
|
|
115
|
-
(0, class_validator_1.IsDefined)(),
|
|
116
|
-
(0, class_validator_1.ValidateNested)(),
|
|
117
|
-
(0, class_transformer_1.Type)(() => PaymentCardRequestValidator),
|
|
118
|
-
__metadata("design:type", PaymentCardRequestValidator)
|
|
119
|
-
], CreatePaymentChargeRequestValidator.prototype, "card", void 0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema as MongoSchema } from 'mongoose';
|
|
2
|
-
import { PaymentAccountApprovalEnum,
|
|
2
|
+
import { PaymentAccountApprovalEnum, PaymentAccountTypeEnum, PaymentPixKeyTypeEnum } from './account.enum.js';
|
|
3
3
|
export declare class IntegrationPaymentAccountApprovalEntity {
|
|
4
4
|
general: PaymentAccountApprovalEnum;
|
|
5
5
|
commercialInfo: PaymentAccountApprovalEnum;
|
|
@@ -28,30 +28,15 @@ export declare const IntegrationPaymentAccountWithdrawalSchema: MongoSchema<Inte
|
|
|
28
28
|
} & {
|
|
29
29
|
__v: number;
|
|
30
30
|
}>;
|
|
31
|
-
export declare class IntegrationPaymentAccountPixEntity {
|
|
32
|
-
ready: boolean;
|
|
33
|
-
error?: string | null;
|
|
34
|
-
checkedAt: Date;
|
|
35
|
-
}
|
|
36
|
-
export declare const IntegrationPaymentAccountPixSchema: MongoSchema<IntegrationPaymentAccountPixEntity, import("mongoose").Model<IntegrationPaymentAccountPixEntity, any, any, any, import("mongoose").Document<unknown, any, IntegrationPaymentAccountPixEntity, any, {}> & IntegrationPaymentAccountPixEntity & {
|
|
37
|
-
_id: import("mongoose").Types.ObjectId;
|
|
38
|
-
} & {
|
|
39
|
-
__v: number;
|
|
40
|
-
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, IntegrationPaymentAccountPixEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<IntegrationPaymentAccountPixEntity>, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").FlatRecord<IntegrationPaymentAccountPixEntity> & {
|
|
41
|
-
_id: import("mongoose").Types.ObjectId;
|
|
42
|
-
} & {
|
|
43
|
-
__v: number;
|
|
44
|
-
}>;
|
|
45
31
|
export declare class IntegrationPaymentAccountEntity {
|
|
46
32
|
accountId: string;
|
|
47
33
|
walletId: string;
|
|
48
34
|
apiKey?: string | null;
|
|
49
|
-
|
|
50
|
-
|
|
35
|
+
accountType: PaymentAccountTypeEnum;
|
|
36
|
+
document: string;
|
|
51
37
|
name: string;
|
|
52
38
|
email: string;
|
|
53
39
|
approval?: IntegrationPaymentAccountApprovalEntity | null;
|
|
54
|
-
pix?: IntegrationPaymentAccountPixEntity | null;
|
|
55
40
|
withdrawal?: IntegrationPaymentAccountWithdrawalEntity | null;
|
|
56
41
|
createdAt: Date;
|
|
57
42
|
syncedAt: Date;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractRequestValidator } from '../../abstract.validator.js';
|
|
2
|
-
import { PaymentAccountCompanyTypeEnum,
|
|
2
|
+
import { PaymentAccountCompanyTypeEnum, PaymentAccountTypeEnum, PaymentPixKeyTypeEnum } from './account.enum.js';
|
|
3
3
|
export declare function isCnpj(value: unknown): boolean;
|
|
4
4
|
export declare function IsCnpj(): PropertyDecorator;
|
|
5
5
|
export declare function isPixKey(type: unknown, key: unknown): boolean;
|
|
@@ -17,7 +17,7 @@ declare abstract class PaymentAccountContactRequestValidator extends AbstractReq
|
|
|
17
17
|
address: PaymentAccountAddressRequestValidator;
|
|
18
18
|
}
|
|
19
19
|
export declare class CreatePaymentAccountRequestValidator extends PaymentAccountContactRequestValidator {
|
|
20
|
-
|
|
20
|
+
accountType: PaymentAccountTypeEnum;
|
|
21
21
|
name?: string;
|
|
22
22
|
cpfCnpj?: string;
|
|
23
23
|
birthDate?: string;
|
|
@@ -66,7 +66,7 @@ const pixKey = ({ value, obj }) => {
|
|
|
66
66
|
}
|
|
67
67
|
return type === account_enum_1.PaymentPixKeyTypeEnum.EMAIL ? value.trim().toLowerCase() : value.trim();
|
|
68
68
|
};
|
|
69
|
-
const isCompany = (body) => body.
|
|
69
|
+
const isCompany = (body) => body.accountType === account_enum_1.PaymentAccountTypeEnum.COMPANY;
|
|
70
70
|
export class PaymentAccountAddressRequestValidator extends abstract_validator_1.AbstractRequestValidator {
|
|
71
71
|
postalCode;
|
|
72
72
|
street;
|
|
@@ -133,21 +133,21 @@ __decorate([
|
|
|
133
133
|
__metadata("design:type", PaymentAccountAddressRequestValidator)
|
|
134
134
|
], PaymentAccountContactRequestValidator.prototype, "address", void 0);
|
|
135
135
|
export class CreatePaymentAccountRequestValidator extends PaymentAccountContactRequestValidator {
|
|
136
|
-
|
|
136
|
+
accountType;
|
|
137
137
|
name;
|
|
138
138
|
cpfCnpj;
|
|
139
139
|
birthDate;
|
|
140
140
|
companyType;
|
|
141
141
|
constructor() {
|
|
142
142
|
super();
|
|
143
|
-
this.
|
|
143
|
+
this.accountType = account_enum_1.PaymentAccountTypeEnum.INDIVIDUAL;
|
|
144
144
|
this.address = new PaymentAccountAddressRequestValidator();
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
__decorate([
|
|
148
|
-
(0, class_validator_1.IsEnum)(account_enum_1.
|
|
148
|
+
(0, class_validator_1.IsEnum)(account_enum_1.PaymentAccountTypeEnum),
|
|
149
149
|
__metadata("design:type", String)
|
|
150
|
-
], CreatePaymentAccountRequestValidator.prototype, "
|
|
150
|
+
], CreatePaymentAccountRequestValidator.prototype, "accountType", void 0);
|
|
151
151
|
__decorate([
|
|
152
152
|
(0, class_validator_1.ValidateIf)(isCompany),
|
|
153
153
|
(0, class_validator_1.IsString)(),
|
|
@@ -13,6 +13,7 @@ export declare class OrderPurchaseSupplierOrderEntity {
|
|
|
13
13
|
placedAt: Date;
|
|
14
14
|
syncedAt?: Date;
|
|
15
15
|
error?: string;
|
|
16
|
+
paidAfterCancelAt?: Date;
|
|
16
17
|
}
|
|
17
18
|
export declare const OrderPurchaseSupplierOrderSchema: MongoSchema<OrderPurchaseSupplierOrderEntity, import("mongoose").Model<OrderPurchaseSupplierOrderEntity, any, any, any, import("mongoose").Document<unknown, any, OrderPurchaseSupplierOrderEntity, any, {}> & OrderPurchaseSupplierOrderEntity & {
|
|
18
19
|
_id: import("mongoose").Types.ObjectId;
|
|
@@ -9,5 +9,6 @@ export declare enum OrderPurchaseStatusEnum {
|
|
|
9
9
|
}
|
|
10
10
|
export declare const PURCHASE_PLACEABLE_STATUSES: readonly OrderPurchaseStatusEnum[];
|
|
11
11
|
export declare const PURCHASE_CANCEL_BLOCKING_STATUSES: readonly OrderPurchaseStatusEnum[];
|
|
12
|
+
export declare const PURCHASE_CANCELLABLE_WITH_SALE_STATUSES: readonly OrderPurchaseStatusEnum[];
|
|
12
13
|
export declare const PURCHASE_SYNCABLE_STATUSES: readonly OrderPurchaseStatusEnum[];
|
|
13
14
|
export declare const PURCHASE_PROGRESS: readonly OrderPurchaseStatusEnum[];
|
|
@@ -16,6 +16,12 @@ export const PURCHASE_CANCEL_BLOCKING_STATUSES = [
|
|
|
16
16
|
OrderPurchaseStatusEnum.PAID,
|
|
17
17
|
OrderPurchaseStatusEnum.SHIPPED,
|
|
18
18
|
];
|
|
19
|
+
export const PURCHASE_CANCELLABLE_WITH_SALE_STATUSES = [
|
|
20
|
+
OrderPurchaseStatusEnum.TO_PLACE,
|
|
21
|
+
OrderPurchaseStatusEnum.PLACED,
|
|
22
|
+
OrderPurchaseStatusEnum.AWAITING_PAYMENT,
|
|
23
|
+
OrderPurchaseStatusEnum.FAILED,
|
|
24
|
+
];
|
|
19
25
|
export const PURCHASE_SYNCABLE_STATUSES = [
|
|
20
26
|
OrderPurchaseStatusEnum.PLACED,
|
|
21
27
|
OrderPurchaseStatusEnum.AWAITING_PAYMENT,
|
|
@@ -3,9 +3,11 @@ export declare enum OrderSaleAttentionEnum {
|
|
|
3
3
|
PAYMENT_DISPUTED = "PAYMENT_DISPUTED",
|
|
4
4
|
CHARGED_BACK_WITH_SUPPLIER_ORDER = "CHARGED_BACK_WITH_SUPPLIER_ORDER",
|
|
5
5
|
REFUNDED_OUTSIDE_WITH_SUPPLIER_ORDER = "REFUNDED_OUTSIDE_WITH_SUPPLIER_ORDER",
|
|
6
|
+
SUPPLIER_PAID_AFTER_CANCEL = "SUPPLIER_PAID_AFTER_CANCEL",
|
|
6
7
|
SUPPLIER_ORDER_FAILED = "SUPPLIER_ORDER_FAILED",
|
|
7
8
|
SUPPLIER_PAYMENT_PENDING = "SUPPLIER_PAYMENT_PENDING",
|
|
8
9
|
SHIPMENT_EXCEPTION = "SHIPMENT_EXCEPTION",
|
|
10
|
+
AUTO_PROCUREMENT_FAILED = "AUTO_PROCUREMENT_FAILED",
|
|
9
11
|
TO_ORDER = "TO_ORDER",
|
|
10
12
|
SHIPMENT_DELAYED = "SHIPMENT_DELAYED",
|
|
11
13
|
PARTIAL_REFUND_OUTSIDE = "PARTIAL_REFUND_OUTSIDE",
|
|
@@ -4,9 +4,11 @@ export var OrderSaleAttentionEnum;
|
|
|
4
4
|
OrderSaleAttentionEnum["PAYMENT_DISPUTED"] = "PAYMENT_DISPUTED";
|
|
5
5
|
OrderSaleAttentionEnum["CHARGED_BACK_WITH_SUPPLIER_ORDER"] = "CHARGED_BACK_WITH_SUPPLIER_ORDER";
|
|
6
6
|
OrderSaleAttentionEnum["REFUNDED_OUTSIDE_WITH_SUPPLIER_ORDER"] = "REFUNDED_OUTSIDE_WITH_SUPPLIER_ORDER";
|
|
7
|
+
OrderSaleAttentionEnum["SUPPLIER_PAID_AFTER_CANCEL"] = "SUPPLIER_PAID_AFTER_CANCEL";
|
|
7
8
|
OrderSaleAttentionEnum["SUPPLIER_ORDER_FAILED"] = "SUPPLIER_ORDER_FAILED";
|
|
8
9
|
OrderSaleAttentionEnum["SUPPLIER_PAYMENT_PENDING"] = "SUPPLIER_PAYMENT_PENDING";
|
|
9
10
|
OrderSaleAttentionEnum["SHIPMENT_EXCEPTION"] = "SHIPMENT_EXCEPTION";
|
|
11
|
+
OrderSaleAttentionEnum["AUTO_PROCUREMENT_FAILED"] = "AUTO_PROCUREMENT_FAILED";
|
|
10
12
|
OrderSaleAttentionEnum["TO_ORDER"] = "TO_ORDER";
|
|
11
13
|
OrderSaleAttentionEnum["SHIPMENT_DELAYED"] = "SHIPMENT_DELAYED";
|
|
12
14
|
OrderSaleAttentionEnum["PARTIAL_REFUND_OUTSIDE"] = "PARTIAL_REFUND_OUTSIDE";
|
|
@@ -17,9 +19,11 @@ export const SALE_ACTIONABLE_ATTENTIONS = [
|
|
|
17
19
|
OrderSaleAttentionEnum.PAYMENT_DISPUTED,
|
|
18
20
|
OrderSaleAttentionEnum.CHARGED_BACK_WITH_SUPPLIER_ORDER,
|
|
19
21
|
OrderSaleAttentionEnum.REFUNDED_OUTSIDE_WITH_SUPPLIER_ORDER,
|
|
22
|
+
OrderSaleAttentionEnum.SUPPLIER_PAID_AFTER_CANCEL,
|
|
20
23
|
OrderSaleAttentionEnum.SUPPLIER_ORDER_FAILED,
|
|
21
24
|
OrderSaleAttentionEnum.SUPPLIER_PAYMENT_PENDING,
|
|
22
25
|
OrderSaleAttentionEnum.SHIPMENT_EXCEPTION,
|
|
26
|
+
OrderSaleAttentionEnum.AUTO_PROCUREMENT_FAILED,
|
|
23
27
|
OrderSaleAttentionEnum.TO_ORDER,
|
|
24
28
|
];
|
|
25
29
|
export const SALE_SHIPMENT_DELAY_DAYS = 7;
|
|
@@ -59,7 +59,7 @@ __decorate([
|
|
|
59
59
|
__metadata("design:type", String)
|
|
60
60
|
], CreateCheckoutRequestValidator.prototype, "notes", void 0);
|
|
61
61
|
__decorate([
|
|
62
|
-
(0, class_validator_1.IsIn)([payment_enum_1.FinancePaymentMethodEnum.PIX
|
|
62
|
+
(0, class_validator_1.IsIn)([payment_enum_1.FinancePaymentMethodEnum.PIX]),
|
|
63
63
|
(0, class_validator_1.IsOptional)(),
|
|
64
64
|
__metadata("design:type", String)
|
|
65
65
|
], CreateCheckoutRequestValidator.prototype, "method", void 0);
|
|
@@ -83,12 +83,26 @@ 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
|
+
}
|
|
90
|
+
export declare const OrderSaleAutoProcurementSchema: MongoSchema<OrderSaleAutoProcurementEntity, import("mongoose").Model<OrderSaleAutoProcurementEntity, any, any, any, import("mongoose").Document<unknown, any, OrderSaleAutoProcurementEntity, any, {}> & OrderSaleAutoProcurementEntity & {
|
|
91
|
+
_id: import("mongoose").Types.ObjectId;
|
|
92
|
+
} & {
|
|
93
|
+
__v: number;
|
|
94
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, OrderSaleAutoProcurementEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<OrderSaleAutoProcurementEntity>, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").FlatRecord<OrderSaleAutoProcurementEntity> & {
|
|
95
|
+
_id: import("mongoose").Types.ObjectId;
|
|
96
|
+
} & {
|
|
97
|
+
__v: number;
|
|
98
|
+
}>;
|
|
86
99
|
export declare class OrderSaleEntity extends TransactionEntity<OrderSaleStatusEnum> {
|
|
87
100
|
customer: ContactCustomerEntity;
|
|
88
101
|
items: ItemEntity[];
|
|
89
102
|
delivery?: OrderSaleDeliveryEntity;
|
|
90
103
|
cancelledAt?: Date | null;
|
|
91
104
|
source: OrderSaleSourceEnum;
|
|
105
|
+
autoProcurement?: OrderSaleAutoProcurementEntity | null;
|
|
92
106
|
readonly purchases: OrderPurchaseEntity[];
|
|
93
107
|
readonly cost: number | null;
|
|
94
108
|
readonly profit: number | null;
|
|
@@ -9,6 +9,7 @@ export interface TransactionCapabilities {
|
|
|
9
9
|
editItems: boolean;
|
|
10
10
|
deleteItems: boolean;
|
|
11
11
|
}
|
|
12
|
+
export declare const SYSTEM_USER = "merkaly";
|
|
12
13
|
export declare class TransactionEntity<S extends string> extends AbstractEntity implements ITransitionable<S> {
|
|
13
14
|
user: AccountUserEntity;
|
|
14
15
|
notes?: string;
|