@merkaly/api 0.23.0 → 0.24.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/index.d.ts +1 -0
- package/dist/finance/payment/payment.entity.d.ts +2 -0
- package/dist/finance/payment/payment.gateway.entity.d.ts +51 -0
- package/dist/integration/payment/account.d.ts +85 -0
- package/dist/integration/payment/account.enum.d.ts +30 -0
- package/dist/integration/payment/account.enum.js +35 -0
- package/dist/integration/payment/charge.d.ts +25 -0
- package/dist/integration/payment/charge.enum.d.ts +9 -0
- package/dist/integration/payment/charge.enum.js +10 -0
- package/dist/integration/payment/charge.request.validator.d.ts +16 -0
- package/dist/integration/payment/charge.request.validator.js +118 -0
- package/dist/integration/payment/index.d.ts +6 -3
- package/dist/integration/payment/index.js +3 -1
- package/dist/integration/payment/payment.account.entity.d.ts +68 -0
- package/dist/integration/payment/payment.entity.d.ts +3 -2
- package/dist/integration/payment/provider.enum.d.ts +1 -1
- package/dist/integration/payment/provider.enum.js +1 -1
- package/dist/integration/payment/request.validator.d.ts +37 -69
- package/dist/integration/payment/request.validator.js +145 -303
- package/dist/order/sale/attention.d.ts +8 -0
- package/dist/order/sale/attention.enum.d.ts +9 -0
- package/dist/order/sale/attention.enum.js +10 -0
- package/dist/order/sale/index.d.ts +2 -0
- package/dist/order/sale/index.js +1 -0
- package/dist/order/sale/shipping.request.validator.js +2 -11
- package/package.json +3 -1
- package/dist/integration/payment/payment.recipient.entity.d.ts +0 -53
- package/dist/integration/payment/recipient.d.ts +0 -40
- package/dist/integration/payment/recipient.enum.d.ts +0 -22
- package/dist/integration/payment/recipient.enum.js +0 -26
|
@@ -4,6 +4,7 @@ import { AbstractEntity } from '../../abstract.entity.js';
|
|
|
4
4
|
import { StatusEntity } from '../../status.plugin.js';
|
|
5
5
|
import { ITransitionable } from '../../transitionable.interface.js';
|
|
6
6
|
import { FinancePaymentMethodEnum, FinancePaymentStatusEnum, FinancePaymentTypeEnum } from './payment.enum.js';
|
|
7
|
+
import { FinancePaymentGatewayEntity } from './payment.gateway.entity.js';
|
|
7
8
|
export type OrderEntity = OrderSaleEntity | OrderPurchaseEntity;
|
|
8
9
|
export declare class FinancePaymentEntity extends AbstractEntity implements ITransitionable<FinancePaymentStatusEnum> {
|
|
9
10
|
type: FinancePaymentTypeEnum;
|
|
@@ -12,6 +13,7 @@ export declare class FinancePaymentEntity extends AbstractEntity implements ITra
|
|
|
12
13
|
amount: number;
|
|
13
14
|
fee: number;
|
|
14
15
|
method?: FinancePaymentMethodEnum | null;
|
|
16
|
+
gateway?: FinancePaymentGatewayEntity | null;
|
|
15
17
|
status: FinancePaymentStatusEnum;
|
|
16
18
|
history: StatusEntity<FinancePaymentStatusEnum>[];
|
|
17
19
|
readonly number: string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Schema as MongoSchema } from 'mongoose';
|
|
2
|
+
import { FinancePaymentMethodEnum } from './payment.enum.js';
|
|
3
|
+
export declare class FinancePaymentGatewayPixEntity {
|
|
4
|
+
qrCode?: string | null;
|
|
5
|
+
qrCodeImage?: string | null;
|
|
6
|
+
}
|
|
7
|
+
export declare const FinancePaymentGatewayPixSchema: MongoSchema<FinancePaymentGatewayPixEntity, import("mongoose").Model<FinancePaymentGatewayPixEntity, any, any, any, import("mongoose").Document<unknown, any, FinancePaymentGatewayPixEntity, any, {}> & FinancePaymentGatewayPixEntity & {
|
|
8
|
+
_id: import("mongoose").Types.ObjectId;
|
|
9
|
+
} & {
|
|
10
|
+
__v: number;
|
|
11
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, FinancePaymentGatewayPixEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<FinancePaymentGatewayPixEntity>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<FinancePaymentGatewayPixEntity> & {
|
|
12
|
+
_id: import("mongoose").Types.ObjectId;
|
|
13
|
+
} & {
|
|
14
|
+
__v: number;
|
|
15
|
+
}>;
|
|
16
|
+
export declare class FinancePaymentGatewayCardEntity {
|
|
17
|
+
brand?: string | null;
|
|
18
|
+
last4?: string | null;
|
|
19
|
+
}
|
|
20
|
+
export declare const FinancePaymentGatewayCardSchema: MongoSchema<FinancePaymentGatewayCardEntity, import("mongoose").Model<FinancePaymentGatewayCardEntity, any, any, any, import("mongoose").Document<unknown, any, FinancePaymentGatewayCardEntity, any, {}> & FinancePaymentGatewayCardEntity & {
|
|
21
|
+
_id: import("mongoose").Types.ObjectId;
|
|
22
|
+
} & {
|
|
23
|
+
__v: number;
|
|
24
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, FinancePaymentGatewayCardEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<FinancePaymentGatewayCardEntity>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<FinancePaymentGatewayCardEntity> & {
|
|
25
|
+
_id: import("mongoose").Types.ObjectId;
|
|
26
|
+
} & {
|
|
27
|
+
__v: number;
|
|
28
|
+
}>;
|
|
29
|
+
export declare class FinancePaymentGatewayEntity {
|
|
30
|
+
provider: string;
|
|
31
|
+
reference?: string | null;
|
|
32
|
+
method: FinancePaymentMethodEnum;
|
|
33
|
+
status: string;
|
|
34
|
+
message?: string | null;
|
|
35
|
+
attempt: number;
|
|
36
|
+
cardAttempts: number;
|
|
37
|
+
amount: number;
|
|
38
|
+
pix?: FinancePaymentGatewayPixEntity | null;
|
|
39
|
+
card?: FinancePaymentGatewayCardEntity | null;
|
|
40
|
+
expiresAt?: Date | null;
|
|
41
|
+
syncedAt: Date;
|
|
42
|
+
}
|
|
43
|
+
export declare const FinancePaymentGatewaySchema: MongoSchema<FinancePaymentGatewayEntity, import("mongoose").Model<FinancePaymentGatewayEntity, any, any, any, import("mongoose").Document<unknown, any, FinancePaymentGatewayEntity, any, {}> & FinancePaymentGatewayEntity & {
|
|
44
|
+
_id: import("mongoose").Types.ObjectId;
|
|
45
|
+
} & {
|
|
46
|
+
__v: number;
|
|
47
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, FinancePaymentGatewayEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<FinancePaymentGatewayEntity>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<FinancePaymentGatewayEntity> & {
|
|
48
|
+
_id: import("mongoose").Types.ObjectId;
|
|
49
|
+
} & {
|
|
50
|
+
__v: number;
|
|
51
|
+
}>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { PaymentAccountApprovalEnum, PaymentAccountCompanyTypeEnum, PaymentAccountDocumentStatusEnum, PaymentAccountPersonTypeEnum, PaymentPixKeyTypeEnum } from './account.enum.js';
|
|
2
|
+
import type { PaymentProviderEnum } from './provider.enum.js';
|
|
3
|
+
export interface PaymentAccountApproval {
|
|
4
|
+
general: PaymentAccountApprovalEnum;
|
|
5
|
+
commercialInfo: PaymentAccountApprovalEnum;
|
|
6
|
+
documentation: PaymentAccountApprovalEnum;
|
|
7
|
+
bankAccountInfo: PaymentAccountApprovalEnum;
|
|
8
|
+
}
|
|
9
|
+
export interface PaymentAccountWithdrawal {
|
|
10
|
+
pixKeyType: PaymentPixKeyTypeEnum;
|
|
11
|
+
pixKeyMasked: string;
|
|
12
|
+
automatic: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface PaymentAccountSummary {
|
|
15
|
+
accountId: string;
|
|
16
|
+
walletId: string;
|
|
17
|
+
personType: PaymentAccountPersonTypeEnum;
|
|
18
|
+
documentMasked: string;
|
|
19
|
+
name: string;
|
|
20
|
+
email: string;
|
|
21
|
+
approval: PaymentAccountApproval | null;
|
|
22
|
+
withdrawal: PaymentAccountWithdrawal | null;
|
|
23
|
+
createdAt: Date;
|
|
24
|
+
syncedAt: Date;
|
|
25
|
+
}
|
|
26
|
+
export interface PaymentAccountStatus {
|
|
27
|
+
configured: boolean;
|
|
28
|
+
connected: boolean;
|
|
29
|
+
provider: PaymentProviderEnum;
|
|
30
|
+
account: PaymentAccountSummary | null;
|
|
31
|
+
canSell: boolean;
|
|
32
|
+
canWithdraw: boolean;
|
|
33
|
+
kycAction: boolean;
|
|
34
|
+
pixReady: boolean;
|
|
35
|
+
warnings: string[];
|
|
36
|
+
accountError: string | null;
|
|
37
|
+
}
|
|
38
|
+
export interface PaymentAccountDocument {
|
|
39
|
+
id: string;
|
|
40
|
+
type: string | null;
|
|
41
|
+
title: string | null;
|
|
42
|
+
description: string | null;
|
|
43
|
+
status: PaymentAccountDocumentStatusEnum;
|
|
44
|
+
onboardingUrl: string | null;
|
|
45
|
+
onboardingUrlExpiresAt: Date | null;
|
|
46
|
+
}
|
|
47
|
+
export interface PaymentAccountOnboarding {
|
|
48
|
+
documents: PaymentAccountDocument[];
|
|
49
|
+
rejectReasons: string | null;
|
|
50
|
+
}
|
|
51
|
+
export interface PaymentAccountBalance {
|
|
52
|
+
balance: number;
|
|
53
|
+
}
|
|
54
|
+
export interface PaymentAccountTransfer {
|
|
55
|
+
id: string;
|
|
56
|
+
amount: number;
|
|
57
|
+
fee: number | null;
|
|
58
|
+
status: string;
|
|
59
|
+
failReason: string | null;
|
|
60
|
+
createdAt: Date | null;
|
|
61
|
+
}
|
|
62
|
+
export interface PaymentAccountCommercialInfo {
|
|
63
|
+
personType: PaymentAccountPersonTypeEnum;
|
|
64
|
+
cpfCnpj: string;
|
|
65
|
+
name: string | null;
|
|
66
|
+
companyName: string | null;
|
|
67
|
+
companyType: PaymentAccountCompanyTypeEnum | null;
|
|
68
|
+
birthDate: string | null;
|
|
69
|
+
email: string | null;
|
|
70
|
+
mobilePhone: string | null;
|
|
71
|
+
phone: string | null;
|
|
72
|
+
incomeValue: number | null;
|
|
73
|
+
site: string | null;
|
|
74
|
+
address: {
|
|
75
|
+
postalCode: string | null;
|
|
76
|
+
street: string | null;
|
|
77
|
+
number: string | null;
|
|
78
|
+
complement: string | null;
|
|
79
|
+
district: string | null;
|
|
80
|
+
city: string | null;
|
|
81
|
+
state: string | null;
|
|
82
|
+
};
|
|
83
|
+
status: PaymentAccountApprovalEnum | null;
|
|
84
|
+
denialReason: string | null;
|
|
85
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare enum PaymentAccountApprovalEnum {
|
|
2
|
+
PENDING = "PENDING",
|
|
3
|
+
AWAITING_APPROVAL = "AWAITING_APPROVAL",
|
|
4
|
+
APPROVED = "APPROVED",
|
|
5
|
+
REJECTED = "REJECTED"
|
|
6
|
+
}
|
|
7
|
+
export declare enum PaymentAccountPersonTypeEnum {
|
|
8
|
+
INDIVIDUAL = "INDIVIDUAL",
|
|
9
|
+
COMPANY = "COMPANY"
|
|
10
|
+
}
|
|
11
|
+
export declare enum PaymentAccountCompanyTypeEnum {
|
|
12
|
+
MEI = "MEI",
|
|
13
|
+
LIMITED = "LIMITED",
|
|
14
|
+
INDIVIDUAL = "INDIVIDUAL",
|
|
15
|
+
ASSOCIATION = "ASSOCIATION"
|
|
16
|
+
}
|
|
17
|
+
export declare enum PaymentAccountDocumentStatusEnum {
|
|
18
|
+
NOT_SENT = "NOT_SENT",
|
|
19
|
+
PENDING = "PENDING",
|
|
20
|
+
APPROVED = "APPROVED",
|
|
21
|
+
REJECTED = "REJECTED",
|
|
22
|
+
IGNORED = "IGNORED"
|
|
23
|
+
}
|
|
24
|
+
export declare enum PaymentPixKeyTypeEnum {
|
|
25
|
+
CPF = "CPF",
|
|
26
|
+
CNPJ = "CNPJ",
|
|
27
|
+
EMAIL = "EMAIL",
|
|
28
|
+
PHONE = "PHONE",
|
|
29
|
+
EVP = "EVP"
|
|
30
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export var PaymentAccountApprovalEnum;
|
|
2
|
+
(function (PaymentAccountApprovalEnum) {
|
|
3
|
+
PaymentAccountApprovalEnum["PENDING"] = "PENDING";
|
|
4
|
+
PaymentAccountApprovalEnum["AWAITING_APPROVAL"] = "AWAITING_APPROVAL";
|
|
5
|
+
PaymentAccountApprovalEnum["APPROVED"] = "APPROVED";
|
|
6
|
+
PaymentAccountApprovalEnum["REJECTED"] = "REJECTED";
|
|
7
|
+
})(PaymentAccountApprovalEnum || (PaymentAccountApprovalEnum = {}));
|
|
8
|
+
export var PaymentAccountPersonTypeEnum;
|
|
9
|
+
(function (PaymentAccountPersonTypeEnum) {
|
|
10
|
+
PaymentAccountPersonTypeEnum["INDIVIDUAL"] = "INDIVIDUAL";
|
|
11
|
+
PaymentAccountPersonTypeEnum["COMPANY"] = "COMPANY";
|
|
12
|
+
})(PaymentAccountPersonTypeEnum || (PaymentAccountPersonTypeEnum = {}));
|
|
13
|
+
export var PaymentAccountCompanyTypeEnum;
|
|
14
|
+
(function (PaymentAccountCompanyTypeEnum) {
|
|
15
|
+
PaymentAccountCompanyTypeEnum["MEI"] = "MEI";
|
|
16
|
+
PaymentAccountCompanyTypeEnum["LIMITED"] = "LIMITED";
|
|
17
|
+
PaymentAccountCompanyTypeEnum["INDIVIDUAL"] = "INDIVIDUAL";
|
|
18
|
+
PaymentAccountCompanyTypeEnum["ASSOCIATION"] = "ASSOCIATION";
|
|
19
|
+
})(PaymentAccountCompanyTypeEnum || (PaymentAccountCompanyTypeEnum = {}));
|
|
20
|
+
export var PaymentAccountDocumentStatusEnum;
|
|
21
|
+
(function (PaymentAccountDocumentStatusEnum) {
|
|
22
|
+
PaymentAccountDocumentStatusEnum["NOT_SENT"] = "NOT_SENT";
|
|
23
|
+
PaymentAccountDocumentStatusEnum["PENDING"] = "PENDING";
|
|
24
|
+
PaymentAccountDocumentStatusEnum["APPROVED"] = "APPROVED";
|
|
25
|
+
PaymentAccountDocumentStatusEnum["REJECTED"] = "REJECTED";
|
|
26
|
+
PaymentAccountDocumentStatusEnum["IGNORED"] = "IGNORED";
|
|
27
|
+
})(PaymentAccountDocumentStatusEnum || (PaymentAccountDocumentStatusEnum = {}));
|
|
28
|
+
export var PaymentPixKeyTypeEnum;
|
|
29
|
+
(function (PaymentPixKeyTypeEnum) {
|
|
30
|
+
PaymentPixKeyTypeEnum["CPF"] = "CPF";
|
|
31
|
+
PaymentPixKeyTypeEnum["CNPJ"] = "CNPJ";
|
|
32
|
+
PaymentPixKeyTypeEnum["EMAIL"] = "EMAIL";
|
|
33
|
+
PaymentPixKeyTypeEnum["PHONE"] = "PHONE";
|
|
34
|
+
PaymentPixKeyTypeEnum["EVP"] = "EVP";
|
|
35
|
+
})(PaymentPixKeyTypeEnum || (PaymentPixKeyTypeEnum = {}));
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { PaymentChargeStatusEnum } from './charge.enum.js';
|
|
2
|
+
import type { PaymentProviderEnum } from './provider.enum.js';
|
|
3
|
+
import type { FinancePaymentMethodEnum } from '../../finance/payment';
|
|
4
|
+
export type StorePaymentMethod = FinancePaymentMethodEnum.PIX | FinancePaymentMethodEnum.CARD;
|
|
5
|
+
export interface StorePaymentConfig {
|
|
6
|
+
methods: StorePaymentMethod[];
|
|
7
|
+
provider: PaymentProviderEnum | null;
|
|
8
|
+
}
|
|
9
|
+
export interface PaymentChargeCard {
|
|
10
|
+
brand: string | null;
|
|
11
|
+
last4: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface PaymentCharge {
|
|
14
|
+
amount: number;
|
|
15
|
+
attempt: number;
|
|
16
|
+
card: PaymentChargeCard | null;
|
|
17
|
+
expiresAt: Date | null;
|
|
18
|
+
method: StorePaymentMethod;
|
|
19
|
+
message: string | null;
|
|
20
|
+
paid: boolean;
|
|
21
|
+
qrCode: string | null;
|
|
22
|
+
qrCodeImage: string | null;
|
|
23
|
+
status: PaymentChargeStatusEnum;
|
|
24
|
+
statusDetail: string | null;
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var PaymentChargeStatusEnum;
|
|
2
|
+
(function (PaymentChargeStatusEnum) {
|
|
3
|
+
PaymentChargeStatusEnum["PENDING"] = "PENDING";
|
|
4
|
+
PaymentChargeStatusEnum["IN_PROCESS"] = "IN_PROCESS";
|
|
5
|
+
PaymentChargeStatusEnum["APPROVED"] = "APPROVED";
|
|
6
|
+
PaymentChargeStatusEnum["REJECTED"] = "REJECTED";
|
|
7
|
+
PaymentChargeStatusEnum["CANCELLED"] = "CANCELLED";
|
|
8
|
+
PaymentChargeStatusEnum["EXPIRED"] = "EXPIRED";
|
|
9
|
+
PaymentChargeStatusEnum["REFUNDED"] = "REFUNDED";
|
|
10
|
+
})(PaymentChargeStatusEnum || (PaymentChargeStatusEnum = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AbstractRequestValidator } from '../../abstract.validator.js';
|
|
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
|
+
export declare class CreatePaymentChargeRequestValidator extends AbstractRequestValidator {
|
|
14
|
+
method: StorePaymentMethod;
|
|
15
|
+
card?: PaymentCardRequestValidator;
|
|
16
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
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
|
+
import * as class_validator_1 from "class-validator";
|
|
17
|
+
import * as payment_enum_1 from '../../finance/payment/index.js';
|
|
18
|
+
import * as shipping_request_validator_1 from '../../order/sale/index.js';
|
|
19
|
+
import * as abstract_validator_1 from '../../abstract.validator.js';
|
|
20
|
+
import * as request_validator_1 from './request.validator.js';
|
|
21
|
+
export function isCardNumber(value) {
|
|
22
|
+
return (typeof value === 'string' && /^\d{13,19}$/.test(value) && card_validator_1.default.number(value).isValid);
|
|
23
|
+
}
|
|
24
|
+
export function isCardExpiry(month, year) {
|
|
25
|
+
if (typeof month !== 'string' || typeof year !== 'string')
|
|
26
|
+
return false;
|
|
27
|
+
return (/^(0[1-9]|1[0-2])$/.test(month) &&
|
|
28
|
+
/^\d{4}$/.test(year) &&
|
|
29
|
+
card_validator_1.default.expirationDate({ month, year }).isValid);
|
|
30
|
+
}
|
|
31
|
+
function IsCardNumber() {
|
|
32
|
+
return (0, class_validator_1.ValidateBy)({
|
|
33
|
+
name: 'isCardNumber',
|
|
34
|
+
validator: {
|
|
35
|
+
defaultMessage: () => 'card.number is not a valid card number',
|
|
36
|
+
validate: isCardNumber,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function IsCardExpiry() {
|
|
41
|
+
return (0, class_validator_1.ValidateBy)({
|
|
42
|
+
name: 'isCardExpiry',
|
|
43
|
+
validator: {
|
|
44
|
+
defaultMessage: () => 'card expiry must be a valid future month (MM and YYYY)',
|
|
45
|
+
validate: (year, args) => isCardExpiry(args.object.expiryMonth, year),
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function IsCpfOrCnpj() {
|
|
50
|
+
return (0, class_validator_1.ValidateBy)({
|
|
51
|
+
name: 'isCpfOrCnpj',
|
|
52
|
+
validator: {
|
|
53
|
+
defaultMessage: () => '$property must be a valid CPF or CNPJ',
|
|
54
|
+
validate: (value) => (0, shipping_request_validator_1.isCpf)(value) || (0, request_validator_1.isCnpj)(value),
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const twoDigits = ({ value }) => typeof value === 'number' ? String(value).padStart(2, '0') : (0, shipping_request_validator_1.digits)({ value });
|
|
59
|
+
const fourDigits = ({ value }) => {
|
|
60
|
+
const year = typeof value === 'number' ? String(value) : (0, shipping_request_validator_1.digits)({ value });
|
|
61
|
+
return typeof year === 'string' && year.length === 2 ? `20${year}` : year;
|
|
62
|
+
};
|
|
63
|
+
export class PaymentCardRequestValidator extends abstract_validator_1.AbstractRequestValidator {
|
|
64
|
+
holderName;
|
|
65
|
+
number;
|
|
66
|
+
expiryMonth;
|
|
67
|
+
expiryYear;
|
|
68
|
+
ccv;
|
|
69
|
+
holderDocument;
|
|
70
|
+
}
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, class_validator_1.IsString)(),
|
|
73
|
+
(0, class_validator_1.Length)(2, 100, { message: 'card.holderName must have 2 to 100 characters' }),
|
|
74
|
+
(0, class_transformer_1.Transform)(shipping_request_validator_1.trim),
|
|
75
|
+
__metadata("design:type", String)
|
|
76
|
+
], PaymentCardRequestValidator.prototype, "holderName", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
IsCardNumber(),
|
|
79
|
+
(0, class_transformer_1.Transform)(shipping_request_validator_1.digits),
|
|
80
|
+
__metadata("design:type", String)
|
|
81
|
+
], PaymentCardRequestValidator.prototype, "number", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, class_validator_1.Matches)(/^(0[1-9]|1[0-2])$/, { message: 'card.expiryMonth must be MM (01 to 12)' }),
|
|
84
|
+
(0, class_transformer_1.Transform)(twoDigits),
|
|
85
|
+
__metadata("design:type", String)
|
|
86
|
+
], PaymentCardRequestValidator.prototype, "expiryMonth", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
IsCardExpiry(),
|
|
89
|
+
(0, class_transformer_1.Transform)(fourDigits),
|
|
90
|
+
__metadata("design:type", String)
|
|
91
|
+
], PaymentCardRequestValidator.prototype, "expiryYear", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, class_validator_1.Matches)(/^\d{3,4}$/, { message: 'card.ccv must have 3 or 4 digits' }),
|
|
94
|
+
(0, class_transformer_1.Transform)(shipping_request_validator_1.digits),
|
|
95
|
+
__metadata("design:type", String)
|
|
96
|
+
], PaymentCardRequestValidator.prototype, "ccv", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
IsCpfOrCnpj(),
|
|
99
|
+
(0, class_validator_1.IsOptional)(),
|
|
100
|
+
(0, class_transformer_1.Transform)(shipping_request_validator_1.digits),
|
|
101
|
+
__metadata("design:type", String)
|
|
102
|
+
], PaymentCardRequestValidator.prototype, "holderDocument", void 0);
|
|
103
|
+
const isCard = (body) => body.method === payment_enum_1.FinancePaymentMethodEnum.CARD;
|
|
104
|
+
export class CreatePaymentChargeRequestValidator extends abstract_validator_1.AbstractRequestValidator {
|
|
105
|
+
method;
|
|
106
|
+
card;
|
|
107
|
+
}
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, class_validator_1.IsIn)([payment_enum_1.FinancePaymentMethodEnum.PIX, payment_enum_1.FinancePaymentMethodEnum.CARD]),
|
|
110
|
+
__metadata("design:type", String)
|
|
111
|
+
], CreatePaymentChargeRequestValidator.prototype, "method", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
(0, class_validator_1.ValidateIf)(isCard),
|
|
114
|
+
(0, class_validator_1.IsDefined)(),
|
|
115
|
+
(0, class_validator_1.ValidateNested)(),
|
|
116
|
+
(0, class_transformer_1.Type)(() => PaymentCardRequestValidator),
|
|
117
|
+
__metadata("design:type", PaymentCardRequestValidator)
|
|
118
|
+
], CreatePaymentChargeRequestValidator.prototype, "card", void 0);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from './payment.entity';
|
|
2
|
-
export * from './payment.
|
|
2
|
+
export * from './payment.account.entity';
|
|
3
3
|
export * from './provider.enum';
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
4
|
+
export * from './account.enum';
|
|
5
|
+
export * from './charge.enum';
|
|
6
|
+
export * from './account';
|
|
7
|
+
export * from './charge';
|
|
6
8
|
export * from './request.validator';
|
|
9
|
+
export * from './charge.request.validator';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Schema as MongoSchema } from 'mongoose';
|
|
2
|
+
import { PaymentAccountApprovalEnum, PaymentAccountPersonTypeEnum, PaymentPixKeyTypeEnum } from './account.enum.js';
|
|
3
|
+
export declare class IntegrationPaymentAccountApprovalEntity {
|
|
4
|
+
general: PaymentAccountApprovalEnum;
|
|
5
|
+
commercialInfo: PaymentAccountApprovalEnum;
|
|
6
|
+
documentation: PaymentAccountApprovalEnum;
|
|
7
|
+
bankAccountInfo: PaymentAccountApprovalEnum;
|
|
8
|
+
}
|
|
9
|
+
export declare const IntegrationPaymentAccountApprovalSchema: MongoSchema<IntegrationPaymentAccountApprovalEntity, import("mongoose").Model<IntegrationPaymentAccountApprovalEntity, any, any, any, import("mongoose").Document<unknown, any, IntegrationPaymentAccountApprovalEntity, any, {}> & IntegrationPaymentAccountApprovalEntity & {
|
|
10
|
+
_id: import("mongoose").Types.ObjectId;
|
|
11
|
+
} & {
|
|
12
|
+
__v: number;
|
|
13
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, IntegrationPaymentAccountApprovalEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<IntegrationPaymentAccountApprovalEntity>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<IntegrationPaymentAccountApprovalEntity> & {
|
|
14
|
+
_id: import("mongoose").Types.ObjectId;
|
|
15
|
+
} & {
|
|
16
|
+
__v: number;
|
|
17
|
+
}>;
|
|
18
|
+
export declare class IntegrationPaymentAccountWithdrawalEntity {
|
|
19
|
+
pixKeyType: PaymentPixKeyTypeEnum;
|
|
20
|
+
pixKey: string;
|
|
21
|
+
automatic: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const IntegrationPaymentAccountWithdrawalSchema: MongoSchema<IntegrationPaymentAccountWithdrawalEntity, import("mongoose").Model<IntegrationPaymentAccountWithdrawalEntity, any, any, any, import("mongoose").Document<unknown, any, IntegrationPaymentAccountWithdrawalEntity, any, {}> & IntegrationPaymentAccountWithdrawalEntity & {
|
|
24
|
+
_id: import("mongoose").Types.ObjectId;
|
|
25
|
+
} & {
|
|
26
|
+
__v: number;
|
|
27
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, IntegrationPaymentAccountWithdrawalEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<IntegrationPaymentAccountWithdrawalEntity>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<IntegrationPaymentAccountWithdrawalEntity> & {
|
|
28
|
+
_id: import("mongoose").Types.ObjectId;
|
|
29
|
+
} & {
|
|
30
|
+
__v: number;
|
|
31
|
+
}>;
|
|
32
|
+
export declare class IntegrationPaymentAccountPixEntity {
|
|
33
|
+
ready: boolean;
|
|
34
|
+
error?: string | null;
|
|
35
|
+
checkedAt: Date;
|
|
36
|
+
}
|
|
37
|
+
export declare const IntegrationPaymentAccountPixSchema: MongoSchema<IntegrationPaymentAccountPixEntity, import("mongoose").Model<IntegrationPaymentAccountPixEntity, any, any, any, import("mongoose").Document<unknown, any, IntegrationPaymentAccountPixEntity, any, {}> & IntegrationPaymentAccountPixEntity & {
|
|
38
|
+
_id: import("mongoose").Types.ObjectId;
|
|
39
|
+
} & {
|
|
40
|
+
__v: number;
|
|
41
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, IntegrationPaymentAccountPixEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<IntegrationPaymentAccountPixEntity>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<IntegrationPaymentAccountPixEntity> & {
|
|
42
|
+
_id: import("mongoose").Types.ObjectId;
|
|
43
|
+
} & {
|
|
44
|
+
__v: number;
|
|
45
|
+
}>;
|
|
46
|
+
export declare class IntegrationPaymentAccountEntity {
|
|
47
|
+
accountId: string;
|
|
48
|
+
walletId: string;
|
|
49
|
+
apiKey?: string | null;
|
|
50
|
+
personType: PaymentAccountPersonTypeEnum;
|
|
51
|
+
documentMasked: string;
|
|
52
|
+
name: string;
|
|
53
|
+
email: string;
|
|
54
|
+
approval?: IntegrationPaymentAccountApprovalEntity | null;
|
|
55
|
+
pix?: IntegrationPaymentAccountPixEntity | null;
|
|
56
|
+
withdrawal?: IntegrationPaymentAccountWithdrawalEntity | null;
|
|
57
|
+
createdAt: Date;
|
|
58
|
+
syncedAt: Date;
|
|
59
|
+
}
|
|
60
|
+
export declare const IntegrationPaymentAccountSchema: MongoSchema<IntegrationPaymentAccountEntity, import("mongoose").Model<IntegrationPaymentAccountEntity, any, any, any, import("mongoose").Document<unknown, any, IntegrationPaymentAccountEntity, any, {}> & IntegrationPaymentAccountEntity & {
|
|
61
|
+
_id: import("mongoose").Types.ObjectId;
|
|
62
|
+
} & {
|
|
63
|
+
__v: number;
|
|
64
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, IntegrationPaymentAccountEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<IntegrationPaymentAccountEntity>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<IntegrationPaymentAccountEntity> & {
|
|
65
|
+
_id: import("mongoose").Types.ObjectId;
|
|
66
|
+
} & {
|
|
67
|
+
__v: number;
|
|
68
|
+
}>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AbstractEntity } from '../../abstract.entity.js';
|
|
2
2
|
import { PaymentProviderEnum } from './provider.enum.js';
|
|
3
|
-
import {
|
|
3
|
+
import { IntegrationPaymentAccountEntity } from './payment.account.entity.js';
|
|
4
4
|
export declare class IntegrationPaymentEntity extends AbstractEntity {
|
|
5
5
|
provider: PaymentProviderEnum;
|
|
6
|
-
|
|
6
|
+
account?: IntegrationPaymentAccountEntity | null;
|
|
7
|
+
accountError?: string | null;
|
|
7
8
|
}
|
|
@@ -1,79 +1,47 @@
|
|
|
1
1
|
import { AbstractRequestValidator } from '../../abstract.validator.js';
|
|
2
|
-
import {
|
|
2
|
+
import { PaymentAccountCompanyTypeEnum, PaymentAccountPersonTypeEnum, PaymentPixKeyTypeEnum } from './account.enum.js';
|
|
3
3
|
export declare function isCnpj(value: unknown): boolean;
|
|
4
4
|
export declare function IsCnpj(): PropertyDecorator;
|
|
5
|
-
export declare function
|
|
6
|
-
export declare
|
|
7
|
-
|
|
8
|
-
zipCode: string;
|
|
5
|
+
export declare function isPixKey(type: unknown, key: unknown): boolean;
|
|
6
|
+
export declare class PaymentAccountAddressRequestValidator extends AbstractRequestValidator {
|
|
7
|
+
postalCode: string;
|
|
9
8
|
street: string;
|
|
10
9
|
number: string;
|
|
11
|
-
complement
|
|
12
|
-
|
|
13
|
-
city: string;
|
|
14
|
-
state: string;
|
|
15
|
-
referencePoint: string;
|
|
10
|
+
complement?: string;
|
|
11
|
+
district: string;
|
|
16
12
|
}
|
|
17
|
-
|
|
18
|
-
ddd: string;
|
|
19
|
-
number: string;
|
|
20
|
-
}
|
|
21
|
-
export declare abstract class PaymentRecipientPersonBaseRequestValidator extends AbstractRequestValidator {
|
|
22
|
-
name: string;
|
|
23
|
-
email: string;
|
|
24
|
-
document: string;
|
|
25
|
-
birthdate: string;
|
|
26
|
-
monthlyIncome: number;
|
|
27
|
-
professionalOccupation: string;
|
|
28
|
-
motherName?: string;
|
|
29
|
-
}
|
|
30
|
-
export declare class PaymentRecipientIndividualRequestValidator extends PaymentRecipientPersonBaseRequestValidator {
|
|
31
|
-
siteUrl?: string;
|
|
32
|
-
}
|
|
33
|
-
export declare class PaymentRecipientPartnerRequestValidator extends PaymentRecipientPersonBaseRequestValidator {
|
|
34
|
-
address: PaymentRecipientAddressRequestValidator;
|
|
35
|
-
phone: PaymentRecipientPhoneRequestValidator;
|
|
36
|
-
constructor();
|
|
37
|
-
}
|
|
38
|
-
export declare class PaymentRecipientCorporationRequestValidator extends AbstractRequestValidator {
|
|
39
|
-
companyName: string;
|
|
40
|
-
tradingName: string;
|
|
13
|
+
declare abstract class PaymentAccountContactRequestValidator extends AbstractRequestValidator {
|
|
41
14
|
email: string;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
accountNumber: string;
|
|
55
|
-
accountCheckDigit: string;
|
|
56
|
-
type: PaymentBankAccountTypeEnum;
|
|
57
|
-
}
|
|
58
|
-
export declare class PaymentRecipientTransferSettingsRequestValidator extends AbstractRequestValidator {
|
|
59
|
-
interval: PaymentTransferIntervalEnum;
|
|
60
|
-
day: number;
|
|
61
|
-
constructor();
|
|
62
|
-
}
|
|
63
|
-
export declare class CreatePaymentRecipientRequestValidator extends AbstractRequestValidator {
|
|
64
|
-
type: PaymentRecipientTypeEnum;
|
|
65
|
-
individual?: PaymentRecipientIndividualRequestValidator;
|
|
66
|
-
corporation?: PaymentRecipientCorporationRequestValidator;
|
|
67
|
-
address: PaymentRecipientAddressRequestValidator;
|
|
68
|
-
phone: PaymentRecipientPhoneRequestValidator;
|
|
69
|
-
bankAccount: PaymentRecipientBankAccountRequestValidator;
|
|
70
|
-
transferSettings: PaymentRecipientTransferSettingsRequestValidator;
|
|
15
|
+
mobilePhone: string;
|
|
16
|
+
phone?: string;
|
|
17
|
+
incomeValue: number;
|
|
18
|
+
site?: string;
|
|
19
|
+
address: PaymentAccountAddressRequestValidator;
|
|
20
|
+
}
|
|
21
|
+
export declare class CreatePaymentAccountRequestValidator extends PaymentAccountContactRequestValidator {
|
|
22
|
+
personType: PaymentAccountPersonTypeEnum;
|
|
23
|
+
name: string;
|
|
24
|
+
cpfCnpj: string;
|
|
25
|
+
birthDate?: string;
|
|
26
|
+
companyType?: PaymentAccountCompanyTypeEnum;
|
|
71
27
|
constructor();
|
|
72
28
|
}
|
|
73
|
-
export declare class
|
|
74
|
-
name?: string;
|
|
29
|
+
export declare class UpdatePaymentAccountRequestValidator extends AbstractRequestValidator {
|
|
75
30
|
email?: string;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
31
|
+
mobilePhone?: string;
|
|
32
|
+
phone?: string;
|
|
33
|
+
incomeValue?: number;
|
|
34
|
+
site?: string;
|
|
35
|
+
birthDate?: string;
|
|
36
|
+
companyType?: PaymentAccountCompanyTypeEnum;
|
|
37
|
+
address?: PaymentAccountAddressRequestValidator;
|
|
38
|
+
}
|
|
39
|
+
export declare class UpdatePaymentWithdrawalRequestValidator extends AbstractRequestValidator {
|
|
40
|
+
pixKeyType: PaymentPixKeyTypeEnum;
|
|
41
|
+
pixKey: string;
|
|
42
|
+
automatic?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare class CreatePaymentWithdrawalRequestValidator extends AbstractRequestValidator {
|
|
45
|
+
amount?: number;
|
|
46
|
+
}
|
|
47
|
+
export {};
|