@postpaybr/contracts 1.0.1

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.
Files changed (45) hide show
  1. package/enums/account-entry.enum.ts +4 -0
  2. package/enums/anticipation.enum.ts +7 -0
  3. package/enums/bank-account.enum.ts +12 -0
  4. package/enums/charge-status.enum.ts +28 -0
  5. package/enums/customer.enum.ts +40 -0
  6. package/enums/email.enum.ts +11 -0
  7. package/enums/failure-reason.enum.ts +7 -0
  8. package/enums/gateway-identification.enum.ts +7 -0
  9. package/enums/index.ts +16 -0
  10. package/enums/notification.enum.ts +14 -0
  11. package/enums/orders-status.enum.ts +10 -0
  12. package/enums/payable-status.enum.ts +7 -0
  13. package/enums/payment.enum.ts +11 -0
  14. package/enums/recipient.enum.ts +32 -0
  15. package/enums/role.enum.ts +44 -0
  16. package/enums/tax.enum.ts +23 -0
  17. package/enums/user-status.enum.ts +9 -0
  18. package/package.json +19 -0
  19. package/types/account-entry.type.ts +3 -0
  20. package/types/address.type.ts +11 -0
  21. package/types/anticipation.type.ts +3 -0
  22. package/types/card.type.ts +14 -0
  23. package/types/charge-metadata.type.ts +43 -0
  24. package/types/charge-schedule.type.ts +11 -0
  25. package/types/charge.type.ts +11 -0
  26. package/types/core.type.ts +7 -0
  27. package/types/customer.type.ts +14 -0
  28. package/types/environment.type.ts +8 -0
  29. package/types/failure-reason.type.ts +3 -0
  30. package/types/fee.type.ts +1 -0
  31. package/types/gateway-identification.type.ts +3 -0
  32. package/types/health-check-plugin.type.ts +11 -0
  33. package/types/index.ts +25 -0
  34. package/types/notification.type.ts +48 -0
  35. package/types/order.type.ts +4 -0
  36. package/types/payable.type.ts +3 -0
  37. package/types/payment-provider.type.ts +22 -0
  38. package/types/payment-service.type.ts +18 -0
  39. package/types/payment.type.ts +15 -0
  40. package/types/receipt-metadata.type.ts +16 -0
  41. package/types/receipt.type.ts +34 -0
  42. package/types/role.type.ts +9 -0
  43. package/types/service-card-vault.type.ts +26 -0
  44. package/types/tax.type.ts +93 -0
  45. package/types/user.type.ts +6 -0
@@ -0,0 +1,4 @@
1
+ export enum AccountEntryTypeEnum {
2
+ CREDIT = 'CREDIT',
3
+ DEBIT = 'DEBIT',
4
+ }
@@ -0,0 +1,7 @@
1
+ export enum AnticipationStatusEnum {
2
+ PENDING = 'PENDING',
3
+ PROCESSING = 'PROCESSING',
4
+ COMPLETED = 'COMPLETED',
5
+ FAILED = 'FAILED',
6
+ CANCELLED = 'CANCELLED',
7
+ }
@@ -0,0 +1,12 @@
1
+ export enum BankAccountTypeEnum {
2
+ CURRENT_ACCOUNT = 'CURRENT_ACCOUNT',
3
+ }
4
+
5
+ export type BankAccountType = `${BankAccountTypeEnum}`;
6
+
7
+ export enum HolderTypeEnum {
8
+ INDIVIDUAL = 'INDIVIDUAL',
9
+ COMPANY = 'COMPANY',
10
+ }
11
+
12
+ export type HolderType = `${HolderTypeEnum}`;
@@ -0,0 +1,28 @@
1
+ export enum ChargeStatusEnum {
2
+ LIQUIDATED = 'LIQUIDATED',
3
+ PENDING = 'PENDING',
4
+
5
+ CREATED = 'CREATED',
6
+ SCHEDULED = 'SCHEDULED',
7
+ PRE_AUTHORIZED = 'PRE_AUTHORIZED',
8
+ NOT_AUTHORIZED = 'NOT_AUTHORIZED',
9
+ AUTHORIZED = 'AUTHORIZED',
10
+
11
+ CONFIRMED = 'CONFIRMED',
12
+ FAILED = 'FAILED',
13
+ ERROR = 'ERROR',
14
+
15
+ CANCELLED = 'CANCELLED',
16
+ REFUNDED = 'REFUNDED',
17
+ REFUND_REQUESTED = 'REFUND_REQUESTED',
18
+ REFUND_IN_PROGRESS = 'REFUND_IN_PROGRESS',
19
+ REFUND_REJECTED = 'REFUND_REJECTED',
20
+ CHARGEBACK = 'CHARGEBACK',
21
+
22
+ MED = 'MED',
23
+ }
24
+
25
+ export enum ChargeTypeEnum {
26
+ STANDARD = 'STANDARD',
27
+ CARD_VERIFICATION = 'CARD_VERIFICATION',
28
+ }
@@ -0,0 +1,40 @@
1
+ export enum VerificationStatusEnum {
2
+ PENDING = 'PENDING',
3
+ IN_PROGRESS = 'IN_PROGRESS',
4
+ REJECTED = 'REJECTED',
5
+ APPROVED = 'APPROVED',
6
+ }
7
+
8
+ export enum DocumentRejectionReasonEnum {
9
+ FAILED_CHALLENGE = 'FAILED_CHALLENGE',
10
+ DOCUMENT_WITHOUT_PHOTO = 'DOCUMENT_WITHOUT_PHOTO',
11
+ FACE_OR_DOCUMENT_INVISIBLE = 'FACE_OR_DOCUMENT_INVISIBLE',
12
+ DOCUMENT_NOT_IN_HAND = 'DOCUMENT_NOT_IN_HAND',
13
+ UNREADABLE_PHOTOS = 'UNREADABLE_PHOTOS',
14
+ INCOMPATIBLE_DATA = 'INCOMPATIBLE_DATA',
15
+ DIFFERENT_DOCUMENTS = 'DIFFERENT_DOCUMENTS',
16
+ OTHER = 'OTHER',
17
+ }
18
+
19
+ export enum CardRejectionReasonEnum {
20
+ FAILED_CHALLENGE = 'FAILED_CHALLENGE',
21
+ FACE_OR_CARD_INVISIBLE = 'FACE_OR_CARD_INVISIBLE',
22
+ MISSING_CARD = 'MISSING_CARD',
23
+ UNREADABLE_PHOTO = 'UNREADABLE_PHOTO',
24
+ DIFFERENT_CARD = 'DIFFERENT_CARD',
25
+ PERSON_MISMATCH = 'PERSON_MISMATCH',
26
+ CARD_BACK_REQUIRED = 'CARD_BACK_REQUIRED',
27
+ OTHER = 'OTHER',
28
+ }
29
+
30
+ export enum CardChallengeEnum {
31
+ HOLD_BELOW_FACE = 'HOLD_BELOW_FACE',
32
+ HOLD_ABOVE_FACE = 'HOLD_ABOVE_FACE',
33
+ HOLD_NEXT_TO_FACE = 'HOLD_NEXT_TO_FACE',
34
+ }
35
+
36
+ export enum AccountLevelEnum {
37
+ BRONZE = 'BRONZE',
38
+ SILVER = 'SILVER',
39
+ GOLD = 'GOLD',
40
+ }
@@ -0,0 +1,11 @@
1
+ export enum Templates {
2
+ ADMINISTRATOR_CHANGE_PASSWORD = 'administrator-change-password',
3
+ ADMINISTRATOR_CREATED = 'administrator-created',
4
+ CHANGE_EMAIL = 'change-email',
5
+ CONGRATULATIONS = 'congratulations',
6
+ KYC_EMAIL = 'kyc-email',
7
+ RECOVERY_PASSWORD = 'recovery-password',
8
+ REJECTED_DOCUMENT = 'rejected-document',
9
+ VALIDATED_DOCUMENT = 'validated-document',
10
+ VERIFICATION = 'verification',
11
+ }
@@ -0,0 +1,7 @@
1
+ export enum FailureReasonEnum {
2
+ PROVIDERS_UNAVAILABLE = 'PROVIDERS_UNAVAILABLE',
3
+ TIME_EXPIRED = 'TIME_EXPIRED',
4
+ INVALID_DATA = 'INVALID_DATA',
5
+ LIMIT_EXCEEDED = 'LIMIT_EXCEEDED',
6
+ UNKNOWN = 'UNKNOWN',
7
+ }
@@ -0,0 +1,7 @@
1
+ export enum GatewayIdentificationEnum {
2
+ ASAAS = 'ASAAS',
3
+ SICOOB = 'SICOOB',
4
+ SICREDI = 'SICREDI',
5
+ RAKIM = 'RAKIM',
6
+ MOCK = 'MOCK',
7
+ }
package/enums/index.ts ADDED
@@ -0,0 +1,16 @@
1
+ export * from './account-entry.enum';
2
+ export * from './anticipation.enum';
3
+ export * from './bank-account.enum';
4
+ export * from './charge-status.enum';
5
+ export * from './customer.enum';
6
+ export * from './email.enum';
7
+ export * from './failure-reason.enum';
8
+ export * from './gateway-identification.enum';
9
+ export * from './notification.enum';
10
+ export * from './orders-status.enum';
11
+ export * from './payable-status.enum';
12
+ export * from './payment.enum';
13
+ export * from './recipient.enum';
14
+ export * from './role.enum';
15
+ export * from './tax.enum';
16
+ export * from './user-status.enum';
@@ -0,0 +1,14 @@
1
+ export enum NotificationCategoryEnum {
2
+ PAYMENT = 'PAYMENT',
3
+ PROFILE = 'PROFILE',
4
+ MARKETING = 'MARKETING',
5
+ SECURITY = 'SECURITY',
6
+ INFORMATION = 'INFORMATION',
7
+ ANNOUNCEMENT = 'ANNOUNCEMENT',
8
+ }
9
+
10
+ export enum NotificationImageTypeEnum {
11
+ STATIC = 'STATIC',
12
+ SVG = 'SVG',
13
+ ANIMATED = 'ANIMATED',
14
+ }
@@ -0,0 +1,10 @@
1
+ export enum OrderStatusEnum {
2
+ PENDING = 'PENDING',
3
+ CONFIRMED = 'CONFIRMED',
4
+ FAILED = 'FAILED',
5
+ }
6
+
7
+ export enum OrderTypeEnum {
8
+ IMMEDIATE = 'IMMEDIATE',
9
+ SCHEDULED = 'SCHEDULED',
10
+ }
@@ -0,0 +1,7 @@
1
+ export enum PayableStatusEnum {
2
+ PENDING = 'PENDING',
3
+ PROCESSING = 'PROCESSING',
4
+ TRANSFERRED = 'TRANSFERRED',
5
+ FAILED = 'FAILED',
6
+ CANCELLED = 'CANCELLED',
7
+ }
@@ -0,0 +1,11 @@
1
+ export enum PaymentMethodsEnum {
2
+ PIX = 'PIX',
3
+ CREDIT_CARD = 'CREDIT_CARD',
4
+ DEBIT_CARD = 'DEBIT_CARD',
5
+ }
6
+
7
+ export enum PaymentScheduleEnum {
8
+ CUSTOM_DATE = 'custom',
9
+ ON_DUE_DATE = 'dueAt',
10
+ IMMEDIATE = 'today',
11
+ }
@@ -0,0 +1,32 @@
1
+ export enum RecipientTypeEnum {
2
+ CUSTOMER = 'CUSTOMER',
3
+ ADMINISTRATOR = 'ADMINISTRATOR',
4
+ }
5
+
6
+ export type RecipientType = `${RecipientTypeEnum}`;
7
+
8
+ export enum RecipientLegalTypeEnum {
9
+ SA = 'SA',
10
+ LTDA = 'LTDA',
11
+ MEI = 'MEI',
12
+ ME = 'ME',
13
+ EPP = 'EPP',
14
+ EIRELI = 'EIRELI',
15
+ }
16
+
17
+ export type RecipientLegalType = `${RecipientLegalTypeEnum}`;
18
+
19
+ export enum ProviderStatusEnum {
20
+ ACTIVE = 'ACTIVE',
21
+ DELETED = 'DELETED',
22
+ INACTIVE = 'INACTIVE',
23
+ WAITING = 'WAITING',
24
+ REJECTED = 'REJECTED',
25
+ }
26
+
27
+ export type ProviderStatus = `${ProviderStatusEnum}`;
28
+
29
+ export enum ProviderAction {
30
+ UPDATE_PROVIDER = 'UPDATE_PROVIDER',
31
+ NO_ACTION = 'NO_ACTION',
32
+ }
@@ -0,0 +1,44 @@
1
+ export enum Action {
2
+ Manage = 'manage',
3
+ Create = 'create',
4
+ Read = 'read',
5
+ Update = 'update',
6
+ Delete = 'delete',
7
+ Enable = 'enable',
8
+ Disable = 'disable',
9
+ Resolve = 'resolve',
10
+ }
11
+
12
+ export enum Permission {
13
+ readDashboard = 'READ_DASHBOARD',
14
+
15
+ manageSupportTickets = 'MANAGE_SUPPORT_TICKETS',
16
+ readCustomerData = 'READ_CUSTOMER_DATA',
17
+ resolveIssues = 'RESOLVE_ISSUES',
18
+
19
+ updateInvoices = 'UPDATE_INVOICES',
20
+ managePayments = 'MANAGE_PAYMENTS',
21
+ readFinancialReports = 'READ_FINANCIAL_REPORTS',
22
+
23
+ manageCreditApplications = 'MANAGE_CREDIT_APPLICATIONS',
24
+ readCreditHistory = 'READ_CREDIT_HISTORY',
25
+ updateCreditLimits = 'UPDATE_CREDIT_LIMITS',
26
+
27
+ manageSystemSettings = 'MANAGE_SYSTEM_SETTINGS',
28
+ readAuditLogs = 'READ_AUDIT_LOGS',
29
+ manageUserAccounts = 'MANAGE_USER_ACCOUNTS',
30
+
31
+ manageReceivedPayments = 'MANAGE_RECEIVED_PAYMENTS',
32
+ updateAccounts = 'UPDATE_ACCOUNTS',
33
+ createFinancialStatements = 'CREATE_FINANCIAL_STATEMENTS',
34
+
35
+ manageTaxDocuments = 'MANAGE_TAX_DOCUMENTS',
36
+ createTaxReturns = 'CREATE_TAX_RETURNS',
37
+ createTaxReports = 'CREATE_TAX_REPORTS',
38
+
39
+ createRecipientFee = 'CREATE_RECIPIENT_FEE',
40
+ updateRecipientFee = 'UPDATE_RECIPIENT_FEE',
41
+ readRecipientFee = 'READ_RECIPIENT_FEE',
42
+ deleteRecipientFee = 'DELETE_RECIPIENT_FEE',
43
+ manageRecipientFee = 'MANAGE_RECIPIENT_FEE',
44
+ }
@@ -0,0 +1,23 @@
1
+ enum TaxTypesEnum {
2
+ IPTU = 'IPTU',
3
+ TCRS = 'TCRS',
4
+ ITBI = 'ITBI',
5
+ IPVA = 'IPVA',
6
+ LICENSING = 'LICENSING',
7
+ WASTE_COLLECTION = 'WASTE_COLLECTION',
8
+ SANITATION = 'SANITATION',
9
+ }
10
+
11
+ enum TaxStatusEnum {
12
+ PAID = 'PAID',
13
+ PROCESSING = 'PROCESSING',
14
+ PENDING = 'PENDING',
15
+ OVERDUE = 'OVERDUE',
16
+ }
17
+
18
+ enum MetaEnum {
19
+ PROPERTY = 'PROPERTY',
20
+ VEHICLE = 'VEHICLE',
21
+ }
22
+
23
+ export { TaxTypesEnum, TaxStatusEnum, MetaEnum };
@@ -0,0 +1,9 @@
1
+ enum UserStatusEnum {
2
+ ACTIVE = 'ACTIVE',
3
+ INACTIVE = 'INACTIVE',
4
+ BLOCKED = 'BLOCKED',
5
+ }
6
+
7
+ type UserStatus = `${UserStatusEnum}`;
8
+
9
+ export { UserStatusEnum, UserStatus };
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@postpaybr/contracts",
3
+ "version": "1.0.1",
4
+ "type": "module",
5
+ "main": "index.ts",
6
+ "types": "index.ts",
7
+ "files": [
8
+ "types",
9
+ "enums"
10
+ ],
11
+ "scripts": {},
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "exports": {
16
+ "./types": "./types/index.ts",
17
+ "./enums": "./enums/index.ts"
18
+ }
19
+ }
@@ -0,0 +1,3 @@
1
+ import { AccountEntryTypeEnum } from '@common/enums';
2
+
3
+ export type AccountEntryType = `${AccountEntryTypeEnum}`;
@@ -0,0 +1,11 @@
1
+ type Address = {
2
+ street: string;
3
+ complement: string;
4
+ city: string;
5
+ neighborhood: string;
6
+ number: string;
7
+ state: string;
8
+ zipCode: string;
9
+ };
10
+
11
+ export type { Address };
@@ -0,0 +1,3 @@
1
+ import { AnticipationStatusEnum } from '@common/enums';
2
+
3
+ export type AnticipationStatus = `${AnticipationStatusEnum}`;
@@ -0,0 +1,14 @@
1
+ export enum brandEnum {
2
+ VISA = 'VISA',
3
+ MASTERCARD = 'MASTERCARD',
4
+ ELO = 'ELO',
5
+ DISCOVER = 'DISCOVER',
6
+ AMERICAN_EXPRESS = 'AMERICAN_EXPRESS',
7
+ HIPERCARD = 'HIPERCARD',
8
+ MASTERCARD_MAESTRO = 'MASTERCARD_MAESTRO',
9
+ VISA_ELECTRON = 'VISA_ELECTRON',
10
+ PIX = 'PIX',
11
+ BOLETO = 'BOLETO',
12
+ }
13
+
14
+ export type brandType = `${brandEnum}`;
@@ -0,0 +1,43 @@
1
+ import { GatewayIdentificationEnum } from '@common/enums';
2
+ import { ExtractAnalyticsItemDto } from '@payment/modules/charge/consumers/dtos';
3
+ import { ReceivingCreatePayloadDto } from '@payment-processing/modules';
4
+
5
+ import {
6
+ PaymentSplitCreatePayloadDto,
7
+ PaymentCreatePayloadDto,
8
+ } from '@common/dtos/service-payment-processing/card';
9
+
10
+ import { FailureReason } from './failure-reason.type';
11
+ import { PaymentMethods } from './payment.type';
12
+
13
+ export type GatewayRequestPayload =
14
+ | PaymentSplitCreatePayloadDto
15
+ | PaymentCreatePayloadDto
16
+ | ReceivingCreatePayloadDto;
17
+
18
+ export interface GatewaySpecificMeta {
19
+ responsePayload?: {
20
+ authorization?: string | null;
21
+ nsu?: string | null;
22
+ fees?: number | null;
23
+ liquid?: number | null;
24
+ [key: string]: unknown;
25
+ };
26
+ liquidationPayload?: ExtractAnalyticsItemDto;
27
+ failureDetails?: string | null;
28
+ failureReason?: FailureReason | null;
29
+ isRetry?: boolean;
30
+ [key: string]: unknown;
31
+ }
32
+
33
+ export interface PreviousPaymentData {
34
+ amount: number;
35
+ paymentMethod: PaymentMethods;
36
+ installments?: number | null;
37
+ installmentValue?: number | null;
38
+ }
39
+
40
+ export type ChargeMetadata = {
41
+ requestPayload: GatewayRequestPayload;
42
+ previousPaymentData?: PreviousPaymentData;
43
+ } & Partial<Record<Lowercase<GatewayIdentificationEnum>, GatewaySpecificMeta>>;
@@ -0,0 +1,11 @@
1
+ type JobWithDetail = {
2
+ id: string;
3
+ createdAt: number;
4
+ jobData: string;
5
+ jobState: 'waiting' | 'active' | 'completed' | 'failed' | 'delayed';
6
+ duration: number;
7
+ jobResult: string;
8
+ queueName: string;
9
+ };
10
+
11
+ export type { JobWithDetail };
@@ -0,0 +1,11 @@
1
+ import { ChargeStatusEnum, ChargeTypeEnum } from '@common/enums';
2
+
3
+ export type ChargeStatus = `${ChargeStatusEnum}`;
4
+ export type ChargeType = `${ChargeTypeEnum}`;
5
+
6
+ export type ChargeSummaryStatus =
7
+ | 'PENDING'
8
+ | 'PROCESSING'
9
+ | 'SCHEDULED'
10
+ | 'LIQUIDATED'
11
+ | 'CANCELLED';
@@ -0,0 +1,7 @@
1
+ import { GatewayIdentification } from './gateway-identification.type';
2
+
3
+ export interface RoutingInfo {
4
+ routingKey: string;
5
+ pixKey: string;
6
+ gatewayId: GatewayIdentification;
7
+ }
@@ -0,0 +1,14 @@
1
+ import {
2
+ AccountLevelEnum,
3
+ CardChallengeEnum,
4
+ CardRejectionReasonEnum,
5
+ DocumentRejectionReasonEnum,
6
+ VerificationStatusEnum,
7
+ } from '@common/enums';
8
+
9
+ export type AccountLevel = `${AccountLevelEnum}`;
10
+ export type CardRejectionReason = `${CardRejectionReasonEnum}`;
11
+
12
+ export type DocumentRejectionReason = `${DocumentRejectionReasonEnum}`;
13
+ export type VerificationStatus = `${VerificationStatusEnum}`;
14
+ export type CardChallenge = `${CardChallengeEnum}`;
@@ -0,0 +1,8 @@
1
+ export type Environment =
2
+ | 'local'
3
+ | 'dev'
4
+ | 'sandbox'
5
+ | 'staging'
6
+ | 'live'
7
+ | 'integration'
8
+ | 'e2e';
@@ -0,0 +1,3 @@
1
+ import { FailureReasonEnum } from '@common/enums';
2
+
3
+ export type FailureReason = `${FailureReasonEnum}`;
@@ -0,0 +1 @@
1
+ export type FeeType = 'MIXED' | 'FIXED';
@@ -0,0 +1,3 @@
1
+ import { GatewayIdentificationEnum } from '@common/enums';
2
+
3
+ export type GatewayIdentification = `${GatewayIdentificationEnum}`;
@@ -0,0 +1,11 @@
1
+ type HealthCheckPlugin = {
2
+ name: string;
3
+ check: () => Promise<{
4
+ name: string;
5
+ status: string;
6
+ details?: any;
7
+ error?: string;
8
+ }>;
9
+ };
10
+
11
+ export type { HealthCheckPlugin };
package/types/index.ts ADDED
@@ -0,0 +1,25 @@
1
+ export * from './account-entry.type';
2
+ export * from './address.type';
3
+ export * from './anticipation.type';
4
+ export * from './card.type';
5
+ export * from './charge-metadata.type';
6
+ export * from './charge.type';
7
+ export * from './core.type';
8
+ export * from './customer.type';
9
+ export * from './environment.type';
10
+ export * from './failure-reason.type';
11
+ export * from './fee.type';
12
+ export * from './gateway-identification.type';
13
+ export * from './health-check-plugin.type';
14
+ export * from './notification.type';
15
+ export * from './order.type';
16
+ export * from './payable.type';
17
+ export * from './payment-provider.type';
18
+ export * from './role.type';
19
+ export * from './charge-schedule.type';
20
+ export * from './payment-service.type';
21
+ export * from './receipt.type';
22
+ export * from './payment.type';
23
+ export * from './tax.type';
24
+ export * from './receipt-metadata.type';
25
+ export * from './user.type';
@@ -0,0 +1,48 @@
1
+ import {
2
+ NotificationCategoryEnum,
3
+ NotificationImageTypeEnum,
4
+ } from '@common/enums';
5
+
6
+ export type NotificationImageType = `${NotificationImageTypeEnum}`;
7
+ export type NotificationCategory = `${NotificationCategoryEnum}`;
8
+
9
+ export type ChangesFieldType = 'FIRST_NAME' | 'LAST_NAME' | 'EMAIL' | 'PHONE';
10
+
11
+ export interface NotificationMetadata {
12
+ callToAction?: string;
13
+ actionButtonVariant?: 'default' | 'ghost';
14
+ actionLabel?: string;
15
+ url?: string;
16
+
17
+ deviceInfo?: string;
18
+ location?: string;
19
+ eventDate?: Date;
20
+ securityAction?: string;
21
+
22
+ changes?: {
23
+ field: ChangesFieldType;
24
+ oldValue: string;
25
+ newValue: string;
26
+ }[];
27
+
28
+ startDate?: Date;
29
+ endDate?: Date;
30
+ impactDescription?: string;
31
+
32
+ updateReason?: string;
33
+ changePoints?: {
34
+ title: string;
35
+ description: string;
36
+ }[];
37
+
38
+ receiptId?: string;
39
+ chargeId?: string;
40
+ taxId?: string;
41
+
42
+ userId?: string;
43
+ scheduledPaymentDate?: Date;
44
+ paymentAmount?: number;
45
+ paymentStatus?: string;
46
+ paymentMethod?: string;
47
+ params?: Record<string, any>;
48
+ }
@@ -0,0 +1,4 @@
1
+ import { OrderStatusEnum, OrderTypeEnum } from '@common/enums';
2
+
3
+ export type OrderStatus = `${OrderStatusEnum}`;
4
+ export type OrderType = `${OrderTypeEnum}`;
@@ -0,0 +1,3 @@
1
+ import { PayableStatusEnum } from '@common/enums';
2
+
3
+ export type PayableStatus = `${PayableStatusEnum}`;
@@ -0,0 +1,22 @@
1
+ import { PaymentMethods } from './payment.type';
2
+
3
+ export enum PaymentGatewayTypeEnum {
4
+ PRIMARY = 'PRIMARY',
5
+ SECONDARY = 'SECONDARY',
6
+ }
7
+
8
+ export type PaymentGatewayType = `${PaymentGatewayTypeEnum}`;
9
+
10
+ export type PaymentProviderInfo = {
11
+ id: string;
12
+ code: string;
13
+ name: string;
14
+ method: PaymentMethods;
15
+ };
16
+
17
+ export enum OperationTypeEnum {
18
+ PAYMENT = 'PAYMENT',
19
+ RECEIVING = 'RECEIVING',
20
+ }
21
+
22
+ export type OperationType = `${OperationTypeEnum}`;
@@ -0,0 +1,18 @@
1
+ import { OrderEntity } from '@order/database/entities/order.entity';
2
+ import { TaxEntity } from '@tax/database';
3
+
4
+ import { PaymentDetailsDto } from '@common/dtos/service-context';
5
+
6
+ import { RoutingInfo } from './core.type';
7
+ import { OrderType } from './order.type';
8
+
9
+ export interface PaymentContext {
10
+ customerId: string;
11
+ payment: PaymentDetailsDto;
12
+ taxes: TaxEntity[];
13
+ order: OrderEntity;
14
+ orderType?: OrderType;
15
+ pushToken: string;
16
+ routingInfo: RoutingInfo;
17
+ firstRecipientId?: string;
18
+ }
@@ -0,0 +1,15 @@
1
+ import { PaymentScheduleEnum } from '@common/enums';
2
+
3
+ type PaymentMethods = 'PIX' | 'CREDIT_CARD' | 'DEBIT_CARD';
4
+ type NonPixPaymentMethods = Exclude<PaymentMethods, 'PIX'>;
5
+
6
+ export enum PaymentVariantEnum {
7
+ SCHEDULED = 'SCHEDULED',
8
+ IMMEDIATE = 'IMMEDIATE',
9
+ }
10
+
11
+ export type PaymentScheduleType = `${PaymentScheduleEnum}`;
12
+
13
+ type PaymentVariant = `${PaymentVariantEnum}`;
14
+
15
+ export type { PaymentMethods, NonPixPaymentMethods, PaymentVariant };
@@ -0,0 +1,16 @@
1
+ import {
2
+ NfseCancelSuccessDto,
3
+ NfseCreatedSuccessDto,
4
+ } from '@payment/modules/receipt/consumers/dtos';
5
+
6
+ import { CreateNfseDto } from '@common/dtos/service-payment';
7
+
8
+ export type ReceiptMetadata = {
9
+ requestPayload?: CreateNfseDto;
10
+ responsePayload?: NfseCreatedSuccessDto;
11
+ cancelResponsePayload?: NfseCancelSuccessDto;
12
+ errorDetails?: string;
13
+ createAttempts?: number;
14
+ cancelAttempts?: number;
15
+ lastErrorAt?: string;
16
+ };
@@ -0,0 +1,34 @@
1
+ import { ChargeStatus } from './charge.type';
2
+ import { PaymentMethods } from './payment.type';
3
+ import { TaxTypes } from './tax.type';
4
+
5
+ type PaymentSummary = {
6
+ totalPaymentsMade?: number;
7
+ totalScheduledPayments?: number;
8
+ timestamp: string;
9
+ };
10
+
11
+ type IndividualPayment = {
12
+ id: string;
13
+ createdAt: Date;
14
+ status: ChargeStatus;
15
+ paymentMethod: PaymentMethods;
16
+ propertyDocument: string;
17
+ propertyDetail: string;
18
+ amount?: number;
19
+ installmentNumber: number;
20
+ installmentValue: number;
21
+ schedule?: {
22
+ executionDate: Date;
23
+ isExecuted: boolean;
24
+ };
25
+ taxType: TaxTypes;
26
+ };
27
+
28
+ type PaymentSummaryPreview = {
29
+ summary: PaymentSummary;
30
+ paymentsMade?: IndividualPayment[];
31
+ scheduledPayments?: IndividualPayment[];
32
+ };
33
+
34
+ export type { PaymentSummaryPreview, PaymentSummary, IndividualPayment };
@@ -0,0 +1,9 @@
1
+ import { Permission } from '@common/enums';
2
+
3
+ interface PermissionGroup {
4
+ group: string;
5
+ description: string;
6
+ permissions: Permission[];
7
+ }
8
+
9
+ export type { PermissionGroup };
@@ -0,0 +1,26 @@
1
+ type GetTokenizedCardEnigma = {
2
+ firstSix: string;
3
+ lastFour: string;
4
+ ccn?: string;
5
+ expMonth: number;
6
+ expYear: number;
7
+ fullName: string;
8
+ cardType: string;
9
+ token: string;
10
+ cvvTtl: number;
11
+ ttl: number;
12
+ };
13
+
14
+ type CardDetailsPayload = {
15
+ token: string;
16
+ tokenCvv: string;
17
+ };
18
+
19
+ type EnigmaToken = {
20
+ access_token: string;
21
+ token_type: string;
22
+ expires_in: number;
23
+ scope: string;
24
+ };
25
+
26
+ export { CardDetailsPayload, GetTokenizedCardEnigma, EnigmaToken };
@@ -0,0 +1,93 @@
1
+ import { TaxStatusEnum, TaxTypesEnum } from '@common/enums';
2
+
3
+ import { Address } from './address.type';
4
+
5
+ type TaxTypes = `${TaxTypesEnum}`;
6
+ type TaxStatus = `${TaxStatusEnum}`;
7
+ type MetaType = 'PROPERTY' | 'VEHICLE';
8
+
9
+ type Tax = {
10
+ id: string;
11
+ type: TaxTypes;
12
+ description: string;
13
+ year: number;
14
+ documentId: string;
15
+ };
16
+
17
+ type Payer = {
18
+ name: string;
19
+ document: string;
20
+ phone?: string;
21
+ };
22
+
23
+ type locationInfo = {
24
+ state: number;
25
+ city: number;
26
+ recipientId: string;
27
+ };
28
+
29
+ type TaxItem = {
30
+ id: string;
31
+ code: string;
32
+ quota: number;
33
+ dueAt: string;
34
+ amount: number;
35
+ isSingleQuota: boolean;
36
+ status: TaxStatus;
37
+ discountPercentage: number;
38
+ discountAmount: number;
39
+ fee: number;
40
+ fine: number;
41
+ };
42
+
43
+ type Property = {
44
+ address?: Address;
45
+ documentId?: string | undefined;
46
+ };
47
+
48
+ type Vehicle = {
49
+ licensePlate?: string;
50
+ model?: string;
51
+ yearManufacture?: number;
52
+ renavam?: string;
53
+ };
54
+
55
+ export type Meta = Property | Vehicle;
56
+
57
+ type TaxDetail = {
58
+ tax: Tax;
59
+ payer: Payer;
60
+ location: locationInfo;
61
+ metaType: MetaType;
62
+ meta: Meta | undefined;
63
+ items: TaxItem[];
64
+ };
65
+
66
+ type TaxDueDate = {
67
+ id: string;
68
+ dueDate: string;
69
+ };
70
+
71
+ type PropertyDetail = {
72
+ property: Property;
73
+ payer: Payer;
74
+ taxTypes: Set<TaxTypes> | TaxTypes[];
75
+ pendingTaxesAmount?: number;
76
+ paidTaxesAmount?: number;
77
+ overdueTaxesAmount?: number;
78
+ lastPaidTaxDate?: string | null;
79
+ nextDueDate?: string | null;
80
+ nearDueTaxesDates?: TaxDueDate[];
81
+ overdueTaxesDates?: TaxDueDate[];
82
+ receiptId: string | null;
83
+ };
84
+
85
+ export type {
86
+ TaxDetail,
87
+ PropertyDetail,
88
+ TaxTypes,
89
+ TaxStatus,
90
+ Property,
91
+ Vehicle,
92
+ MetaType,
93
+ };
@@ -0,0 +1,6 @@
1
+ export enum AccountTypeEnum {
2
+ CUSTOMER = 'CUSTOMER',
3
+ ADMINISTRATOR = 'ADMINISTRATOR',
4
+ }
5
+
6
+ export type AccountType = `${AccountTypeEnum}`;