@crm-rocketlink/crm-model 1.0.0 → 1.0.2
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/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/model/subscription.model.d.ts +1 -0
- package/dist/model/subscription.model.d.ts.map +1 -1
- package/dist/model/transaction.model.d.ts.map +1 -1
- package/dist/util/dateUtils.d.ts +21 -0
- package/dist/util/dateUtils.d.ts.map +1 -0
- package/dist/util/dateUtils.js +85 -0
- package/package.json +4 -2
- package/src/dtos/campaign.request.dto.ts +5 -0
- package/src/dtos/category.request.dto.ts +8 -0
- package/src/dtos/common/base.request.dto.ts +4 -0
- package/src/dtos/common/paginated.request.dto.ts +7 -0
- package/src/dtos/common/paginated.response.dto.ts +11 -0
- package/src/dtos/csv.request.dto.ts +9 -0
- package/src/dtos/csv.response.dto.ts +10 -0
- package/src/dtos/csvRow.request.dto.ts +14 -0
- package/src/dtos/emailTemplate.request.dto.ts +0 -0
- package/src/dtos/empTransactions.request.dto.ts +5 -0
- package/src/dtos/event.request.dto.ts +9 -0
- package/src/dtos/fastify.d.ts +19 -0
- package/src/dtos/field.request.dto.ts +4 -0
- package/src/dtos/hook.request.dto.ts +9 -0
- package/src/dtos/hookProfile.request.dto.ts +7 -0
- package/src/dtos/lead.request.dto.ts +12 -0
- package/src/dtos/offer.request.dto.ts +15 -0
- package/src/dtos/order.request.dto.ts +22 -0
- package/src/dtos/product.request.dto.ts +9 -0
- package/src/dtos/subscription.request.dto.ts +20 -0
- package/src/dtos/transaction.request.dto.ts +13 -0
- package/src/dtos/transactionError.request.dto.ts +10 -0
- package/src/gateways/adapters/dtos/transaction-emp.request.dto.ts +21 -0
- package/src/gateways/adapters/dtos/transaction-finxp.request.dto.ts +9 -0
- package/src/gateways/adapters/dtos/transaction-novalnet.request.dto.ts +21 -0
- package/src/gateways/adapters/model/transactionEmp.model.ts +223 -0
- package/src/gateways/adapters/model/transactionFinXP.model.ts +193 -0
- package/src/gateways/adapters/model/transactionNovalNet.model.ts +224 -0
- package/src/gateways/providers/model/genesis.constants.ts +30 -0
- package/src/gateways/providers/model/genesis.model.ts +89 -0
- package/src/gateways/providers/model/novalNetManual.model.ts +119 -0
- package/src/index.ts +64 -0
- package/src/model/campaign.model.ts +16 -0
- package/src/model/category.model.ts +7 -0
- package/src/model/csv.model.ts +77 -0
- package/src/model/emailTemplate.model.ts +0 -0
- package/src/model/empTransactions.model.ts +9 -0
- package/src/model/event.model.ts +6 -0
- package/src/model/fastify.d.ts +19 -0
- package/src/model/field.model.ts +17 -0
- package/src/model/gateway.model.ts +50 -0
- package/src/model/hook.model.ts +13 -0
- package/src/model/hookOutbox.model.ts +12 -0
- package/src/model/hookProfile.model.ts +19 -0
- package/src/model/lead.model.ts +28 -0
- package/src/model/mid.model.ts +26 -0
- package/src/model/offer.model.ts +26 -0
- package/src/model/order.model.ts +41 -0
- package/src/model/paymentData.model.ts +59 -0
- package/src/model/product.model.ts +11 -0
- package/src/model/subscription.model.ts +29 -0
- package/src/model/transaction.model.ts +32 -0
- package/src/model/transactionError.model.ts +17 -0
- package/src/util/constants.ts +104 -0
- package/src/util/dateUtils.ts +71 -0
- package/tsconfig.json +27 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { GENESIS_TRANSACTION_TYPE } from "./genesis.constants";
|
|
2
|
+
import { GENESIS_TRANSACTION_STATUS } from "./genesis.constants";
|
|
3
|
+
import { GENESIS_TRANSACTION_MODE } from "./genesis.constants";
|
|
4
|
+
|
|
5
|
+
export interface GenesisConfig {
|
|
6
|
+
customer: {
|
|
7
|
+
username?: string;
|
|
8
|
+
password?: string;
|
|
9
|
+
token?: string;
|
|
10
|
+
force_smart_routing?: boolean;
|
|
11
|
+
};
|
|
12
|
+
gateway: {
|
|
13
|
+
protocol?: string;
|
|
14
|
+
hostname?: string; //endpoint-you-want e-comprocessing.net or emerchantpay.net
|
|
15
|
+
timeout?: string;
|
|
16
|
+
testing: boolean;
|
|
17
|
+
};
|
|
18
|
+
notifications?: {
|
|
19
|
+
host: string;
|
|
20
|
+
port: string;
|
|
21
|
+
path: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface GenesisSddSaleParams {
|
|
26
|
+
transaction_id: string; //orderId
|
|
27
|
+
usage: string;
|
|
28
|
+
remote_ip: string;
|
|
29
|
+
amount: string;
|
|
30
|
+
currency: string;
|
|
31
|
+
iban: string;
|
|
32
|
+
bic: string;
|
|
33
|
+
billing_address: {
|
|
34
|
+
first_name: string;
|
|
35
|
+
last_name: string;
|
|
36
|
+
city: string;
|
|
37
|
+
address1: string;
|
|
38
|
+
country: string;
|
|
39
|
+
zip_code: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface GenesisResponse {
|
|
44
|
+
transaction_type?: GENESIS_TRANSACTION_TYPE;
|
|
45
|
+
status: GENESIS_TRANSACTION_STATUS;
|
|
46
|
+
unique_id: string; //EMP transactionId
|
|
47
|
+
transaction_id?: string; //orderId. When we download CSV from the bank, this value is present in "Merchant Transaction ID"
|
|
48
|
+
bank_account_number?: string;
|
|
49
|
+
bank_identifier_code?: string;
|
|
50
|
+
technical_message?: string;
|
|
51
|
+
code?: string;
|
|
52
|
+
message?: string;
|
|
53
|
+
mode?: GENESIS_TRANSACTION_MODE,
|
|
54
|
+
timestamp?: string; //"2025-10-27T14:42:27Z"
|
|
55
|
+
descriptor?: string;
|
|
56
|
+
amount?: string;
|
|
57
|
+
currency?: string;
|
|
58
|
+
sent_to_acquirer?: boolean;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface GenesisRiconcileByDateResponse {
|
|
62
|
+
page: number
|
|
63
|
+
per_page: number
|
|
64
|
+
total_count: number;
|
|
65
|
+
pages_count: number;
|
|
66
|
+
payment_response: GenesisResponse[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface GenesisRefundParams {
|
|
70
|
+
transactionId: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface GenesisChargebackParams {
|
|
74
|
+
transactionId: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface GenesisError {
|
|
78
|
+
status: string;
|
|
79
|
+
code?: string;
|
|
80
|
+
message?: string;
|
|
81
|
+
technical_message?: string;
|
|
82
|
+
response?: GenesisFieldError[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface GenesisFieldError {
|
|
86
|
+
type: string;
|
|
87
|
+
property: string;
|
|
88
|
+
message: string;
|
|
89
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
export interface NovalNetSddSaleParams {
|
|
2
|
+
vendorId: string;
|
|
3
|
+
vendorAuthcode: string;
|
|
4
|
+
productId: string;
|
|
5
|
+
tariffId: string;
|
|
6
|
+
testMode: string;
|
|
7
|
+
amount: string;
|
|
8
|
+
currency: string;
|
|
9
|
+
tariffPeriod: string;
|
|
10
|
+
tariffPeriod2: string;
|
|
11
|
+
tariffPeriod2Amount: string;
|
|
12
|
+
utf8: string;
|
|
13
|
+
lang: string;
|
|
14
|
+
orderNo: string;
|
|
15
|
+
customerNo: string;
|
|
16
|
+
gender: string;
|
|
17
|
+
title: string;
|
|
18
|
+
firstName: string;
|
|
19
|
+
lastName: string;
|
|
20
|
+
street: string;
|
|
21
|
+
searchInStreet: string;
|
|
22
|
+
zip: string;
|
|
23
|
+
city: string;
|
|
24
|
+
countryCode: string;
|
|
25
|
+
birthDate: string;
|
|
26
|
+
tel: string;
|
|
27
|
+
mobile: string;
|
|
28
|
+
email: string;
|
|
29
|
+
paymentType: string;
|
|
30
|
+
invoiceType: string;
|
|
31
|
+
dueDate: string;
|
|
32
|
+
invoiceRef: string;
|
|
33
|
+
paymentRef: string;
|
|
34
|
+
tid: string;
|
|
35
|
+
sepaDueDate: string;
|
|
36
|
+
mandatePresent: string;
|
|
37
|
+
mandateSignatureDate: string;
|
|
38
|
+
mandateId: string;
|
|
39
|
+
iban: string;
|
|
40
|
+
bic: string;
|
|
41
|
+
debitAccountHolder: string;
|
|
42
|
+
debitReason1: string;
|
|
43
|
+
debitReason2: string;
|
|
44
|
+
debitReason3: string;
|
|
45
|
+
debitReason4: string;
|
|
46
|
+
debitReason5: string;
|
|
47
|
+
input1: string;
|
|
48
|
+
input2: string;
|
|
49
|
+
input3: string;
|
|
50
|
+
input4: string;
|
|
51
|
+
input5: string;
|
|
52
|
+
input6: string;
|
|
53
|
+
input7: string;
|
|
54
|
+
discount: string;
|
|
55
|
+
mref: string;
|
|
56
|
+
createPaymentRef: string;
|
|
57
|
+
noRc: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const novalNetSDDRequestColumnMapper: Partial<Record<keyof NovalNetSddSaleParams, string>> = {
|
|
61
|
+
vendorId: "vendor_id",
|
|
62
|
+
vendorAuthcode: "vendor_authcode",
|
|
63
|
+
productId: "product_id",
|
|
64
|
+
tariffId: "tariff_id",
|
|
65
|
+
testMode: "test_mode",
|
|
66
|
+
amount: "amount",
|
|
67
|
+
currency: "currency",
|
|
68
|
+
tariffPeriod: "tariff_period",
|
|
69
|
+
tariffPeriod2: "tariff_period2",
|
|
70
|
+
tariffPeriod2Amount: "tariff_period2_amount",
|
|
71
|
+
utf8: "utf8",
|
|
72
|
+
lang: "lang",
|
|
73
|
+
orderNo: "order_no",
|
|
74
|
+
customerNo: "customer_no",
|
|
75
|
+
gender: "gender",
|
|
76
|
+
title: "title",
|
|
77
|
+
firstName: "first_name",
|
|
78
|
+
lastName: "last_name",
|
|
79
|
+
street: "street",
|
|
80
|
+
searchInStreet: "search_in_street",
|
|
81
|
+
zip: "zip",
|
|
82
|
+
city: "city",
|
|
83
|
+
countryCode: "country_code",
|
|
84
|
+
birthDate: "birth_date",
|
|
85
|
+
tel: "tel",
|
|
86
|
+
mobile: "mobile",
|
|
87
|
+
email: "email",
|
|
88
|
+
paymentType: "payment_type",
|
|
89
|
+
invoiceType: "invoice_type",
|
|
90
|
+
dueDate: "due_date",
|
|
91
|
+
invoiceRef: "invoice_ref",
|
|
92
|
+
paymentRef: "payment_ref",
|
|
93
|
+
tid: "tid",
|
|
94
|
+
sepaDueDate: "sepa_due_date",
|
|
95
|
+
mandatePresent: "mandate_present",
|
|
96
|
+
mandateSignatureDate: "mandate_signature_date",
|
|
97
|
+
mandateId: "mandate_id",
|
|
98
|
+
iban: "iban",
|
|
99
|
+
bic: "bic",
|
|
100
|
+
debitAccountHolder: "debit_account_holder",
|
|
101
|
+
debitReason1: "debit_reason_1",
|
|
102
|
+
debitReason2: "debit_reason_2",
|
|
103
|
+
debitReason3: "debit_reason_3",
|
|
104
|
+
debitReason4: "debit_reason_4",
|
|
105
|
+
debitReason5: "debit_reason_5",
|
|
106
|
+
input1: "input1",
|
|
107
|
+
input2: "input2",
|
|
108
|
+
input3: "input3",
|
|
109
|
+
input4: "input4",
|
|
110
|
+
input5: "input5",
|
|
111
|
+
input6: "input6",
|
|
112
|
+
input7: "input7",
|
|
113
|
+
discount: "discount",
|
|
114
|
+
mref: "mref",
|
|
115
|
+
createPaymentRef: "create_payment_ref",
|
|
116
|
+
noRc: "no_rc",
|
|
117
|
+
};
|
|
118
|
+
export const novalNetSDDRequestColumnMapperKeys = Object.keys(novalNetSDDRequestColumnMapper);
|
|
119
|
+
export const novalNetSDDRequestColumnMapperValues = Object.values(novalNetSDDRequestColumnMapper);
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Export constants
|
|
2
|
+
export * from './util/constants';
|
|
3
|
+
export * from './util/dateUtils';
|
|
4
|
+
export { isDateString, dateToString, stringToDate, getCurrentDateCompacted, FORMATS } from './util/dateUtils';
|
|
5
|
+
|
|
6
|
+
// Export all DTOs
|
|
7
|
+
export * from './dtos/common/base.request.dto';
|
|
8
|
+
export * from './dtos/common/paginated.request.dto';
|
|
9
|
+
export * from './dtos/common/paginated.response.dto';
|
|
10
|
+
export * from './dtos/campaign.request.dto';
|
|
11
|
+
export * from './dtos/category.request.dto';
|
|
12
|
+
export * from './dtos/csv.request.dto';
|
|
13
|
+
export * from './dtos/csv.response.dto';
|
|
14
|
+
export * from './dtos/csvRow.request.dto';
|
|
15
|
+
// export * from './dtos/emailTemplate.request.dto'; // Empty file
|
|
16
|
+
export * from './dtos/empTransactions.request.dto';
|
|
17
|
+
export * from './dtos/event.request.dto';
|
|
18
|
+
export * from './dtos/field.request.dto';
|
|
19
|
+
export * from './dtos/hook.request.dto';
|
|
20
|
+
export * from './dtos/hookProfile.request.dto';
|
|
21
|
+
export * from './dtos/lead.request.dto';
|
|
22
|
+
export * from './dtos/offer.request.dto';
|
|
23
|
+
export * from './dtos/order.request.dto';
|
|
24
|
+
export * from './dtos/product.request.dto';
|
|
25
|
+
export * from './dtos/subscription.request.dto';
|
|
26
|
+
export * from './dtos/transaction.request.dto';
|
|
27
|
+
export * from './dtos/transactionError.request.dto';
|
|
28
|
+
|
|
29
|
+
// Export all Models
|
|
30
|
+
export * from './model/campaign.model';
|
|
31
|
+
export * from './model/category.model';
|
|
32
|
+
export * from './model/csv.model';
|
|
33
|
+
// export * from './model/emailTemplate.model'; // Empty file
|
|
34
|
+
export * from './model/empTransactions.model';
|
|
35
|
+
export * from './model/event.model';
|
|
36
|
+
export * from './model/field.model';
|
|
37
|
+
export * from './model/gateway.model';
|
|
38
|
+
export * from './model/hook.model';
|
|
39
|
+
export * from './model/hookOutbox.model';
|
|
40
|
+
export * from './model/hookProfile.model';
|
|
41
|
+
export * from './model/lead.model';
|
|
42
|
+
export * from './model/mid.model';
|
|
43
|
+
export * from './model/offer.model';
|
|
44
|
+
export * from './model/order.model';
|
|
45
|
+
export * from './model/paymentData.model';
|
|
46
|
+
export * from './model/product.model';
|
|
47
|
+
export * from './model/subscription.model';
|
|
48
|
+
export * from './model/transaction.model';
|
|
49
|
+
export * from './model/transactionError.model';
|
|
50
|
+
|
|
51
|
+
// Export Gateway Adapters Models
|
|
52
|
+
export * from './gateways/adapters/model/transactionEmp.model';
|
|
53
|
+
export * from './gateways/adapters/model/transactionNovalNet.model';
|
|
54
|
+
export * from './gateways/adapters/model/transactionFinXP.model';
|
|
55
|
+
|
|
56
|
+
// Export Gateway Adapters DTOs
|
|
57
|
+
export * from './gateways/adapters/dtos/transaction-emp.request.dto';
|
|
58
|
+
export * from './gateways/adapters/dtos/transaction-novalnet.request.dto';
|
|
59
|
+
export * from './gateways/adapters/dtos/transaction-finxp.request.dto';
|
|
60
|
+
|
|
61
|
+
// Export Gateway Providers Models
|
|
62
|
+
export * from './gateways/providers/model/genesis.constants';
|
|
63
|
+
export * from './gateways/providers/model/genesis.model';
|
|
64
|
+
export * from './gateways/providers/model/novalNetManual.model';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PaymentMethodType } from "./paymentData.model";
|
|
2
|
+
import type { HookProfile } from "./hookProfile.model";
|
|
3
|
+
import type { Offer } from "./offer.model";
|
|
4
|
+
|
|
5
|
+
export interface Campaign {
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
categoryId?: number;
|
|
10
|
+
paymentMethod?: PaymentMethodType;
|
|
11
|
+
trafficSourceId?: number;
|
|
12
|
+
offers?: Offer[];
|
|
13
|
+
hookProfiles?: HookProfile[];
|
|
14
|
+
createdAt: Date;
|
|
15
|
+
updatedAt?: Date;
|
|
16
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { CSV_TYPES, CSVRowStatusTypes, CSVStatusTypes } from "../util/constants";
|
|
2
|
+
|
|
3
|
+
export interface CSV {
|
|
4
|
+
id?: number;
|
|
5
|
+
fileName: string;
|
|
6
|
+
uploadedFileUrl: string;
|
|
7
|
+
fileRows?: number;
|
|
8
|
+
doneRows?: number;
|
|
9
|
+
failedRows?: number;
|
|
10
|
+
status: CSVStatusTypes; // UPLOADED | PROCESSING | DONE
|
|
11
|
+
type?: CSV_TYPES;
|
|
12
|
+
csvRows?: CSVRow[];
|
|
13
|
+
createdAt?: Date;
|
|
14
|
+
updatedAt?: Date;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface CSVRow {
|
|
18
|
+
id?: number;
|
|
19
|
+
csvId?: number;
|
|
20
|
+
csv?: CSV;
|
|
21
|
+
rowIndex?: number; // 1..N (data row index)
|
|
22
|
+
payload?: Record<string, any>; // the row content (firstName, email, etc)
|
|
23
|
+
status?: CSVRowStatusTypes; // -- QUEUED | DONE | FAILED
|
|
24
|
+
errorMessage?: string;
|
|
25
|
+
createdAt?: Date;
|
|
26
|
+
updatedAt?: Date;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// firstName,lastName,address1,address2,city,state,country,zipCode,phone,email,iban,bic,offerId
|
|
30
|
+
export interface SubscriptionCSVRow {
|
|
31
|
+
csvId?: number;
|
|
32
|
+
id?: number;
|
|
33
|
+
firstName?: string;
|
|
34
|
+
lastName?: string;
|
|
35
|
+
address1?: string;
|
|
36
|
+
address2?: string;
|
|
37
|
+
city?: string;
|
|
38
|
+
state?: string;
|
|
39
|
+
country?: string;
|
|
40
|
+
zipCode?: string;
|
|
41
|
+
phone?: string;
|
|
42
|
+
email?: string;
|
|
43
|
+
iban?: string;
|
|
44
|
+
bic?: string;
|
|
45
|
+
offerId?: number;
|
|
46
|
+
campaignId?: number;
|
|
47
|
+
createdAt?: Date;
|
|
48
|
+
updatedAt?: Date;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const subscriptionsCSVColumnsMapper: Partial<Record<keyof SubscriptionCSVRow, string>> = {
|
|
52
|
+
firstName: "first Name",
|
|
53
|
+
lastName: "last Name",
|
|
54
|
+
address1: "address1",
|
|
55
|
+
address2: "address2",
|
|
56
|
+
city: "city",
|
|
57
|
+
state: "state",
|
|
58
|
+
country: "country",
|
|
59
|
+
zipCode: "zipCode",
|
|
60
|
+
phone: "phone",
|
|
61
|
+
email: "email",
|
|
62
|
+
iban: "iban",
|
|
63
|
+
bic: "bic",
|
|
64
|
+
offerId: "offer Id",
|
|
65
|
+
campaignId: "campaignId",
|
|
66
|
+
};
|
|
67
|
+
export const subscriptionsCSVColumnKeys = Object.keys(subscriptionsCSVColumnsMapper);
|
|
68
|
+
export const subscriptionsCSVColumnValues = Object.values(subscriptionsCSVColumnsMapper);
|
|
69
|
+
|
|
70
|
+
export interface SubscriptionIdCSVRow {
|
|
71
|
+
subscriptionId: number;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const subscriptionIdCSVColumnMapper: Partial<Record<keyof SubscriptionIdCSVRow, string>> = {
|
|
75
|
+
subscriptionId: "subscriptionId"
|
|
76
|
+
};
|
|
77
|
+
export const subscriptionIdCSVColumnKeys = Object.keys(subscriptionIdCSVColumnMapper);
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FastifyReply, FastifyRequest, RouteGenericInterface } from "fastify";
|
|
2
|
+
import "@fastify/jwt";
|
|
3
|
+
import "@fastify/mysql";
|
|
4
|
+
|
|
5
|
+
declare module '@fastify/jwt' {
|
|
6
|
+
interface FastifyJWT {
|
|
7
|
+
payload: { id: number; email: string };
|
|
8
|
+
user: { id: number; email: string };
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare module "fastify" {
|
|
13
|
+
interface FastifyInstance {
|
|
14
|
+
authenticate: <T extends RouteGenericInterface = RouteGenericInterface>(
|
|
15
|
+
request: FastifyRequest<T>,
|
|
16
|
+
reply: FastifyReply
|
|
17
|
+
) => Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Field {
|
|
2
|
+
id?: number;
|
|
3
|
+
name: string;
|
|
4
|
+
dbTable: string;
|
|
5
|
+
dbColumn: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
createdAt: Date;
|
|
8
|
+
updatedAt?: Date;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface HookField {
|
|
12
|
+
id?: number;
|
|
13
|
+
hookId?: number;
|
|
14
|
+
fieldId?: number;
|
|
15
|
+
createdAt: Date;
|
|
16
|
+
updatedAt?: Date;
|
|
17
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export const BANKS = {
|
|
2
|
+
EMP: "emp", // status pending
|
|
3
|
+
finXP: "finxp", // manual. status pending.
|
|
4
|
+
Paynt: "paynt",
|
|
5
|
+
Paystrax: "paystrax",
|
|
6
|
+
PayBank2Bank: "paybank2bank",
|
|
7
|
+
Novalnet: "novalnet", //manual. all in un place CB
|
|
8
|
+
UNKNOWN: "unknown",
|
|
9
|
+
ALL: "all",
|
|
10
|
+
};
|
|
11
|
+
export const BANK_NAME_VALUES = Object.values(BANKS);
|
|
12
|
+
export type BANKS = (typeof BANKS)[keyof typeof BANKS];
|
|
13
|
+
|
|
14
|
+
export interface Adapter {
|
|
15
|
+
id?: number;
|
|
16
|
+
name?: BANKS;
|
|
17
|
+
description?: string;
|
|
18
|
+
apiIntegrated?: boolean;
|
|
19
|
+
createdAt?: Date;
|
|
20
|
+
updatedAt?: Date;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const PROVIDERS = {
|
|
24
|
+
ACI: "aci",
|
|
25
|
+
IXOPAY: "ixopay",
|
|
26
|
+
PayBank2Bank: "paybank2bank",
|
|
27
|
+
Genesis: "genesis",
|
|
28
|
+
};
|
|
29
|
+
export type PROVIDERS = (typeof BANKS)[keyof typeof BANKS];
|
|
30
|
+
|
|
31
|
+
export interface Provider {
|
|
32
|
+
id: number;
|
|
33
|
+
name: PROVIDERS;
|
|
34
|
+
description: string;
|
|
35
|
+
webhookUrl?: string;
|
|
36
|
+
webhookMethod?: string;
|
|
37
|
+
webhookToken?: string;
|
|
38
|
+
createdAt?: Date;
|
|
39
|
+
updatedAt?: Date;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ProviderAdapter {
|
|
43
|
+
id?: number;
|
|
44
|
+
adapterId?: number;
|
|
45
|
+
adapter?: Adapter;
|
|
46
|
+
providerId?: number;
|
|
47
|
+
provider?: Provider;
|
|
48
|
+
createdAt?: Date;
|
|
49
|
+
updatedAt?: Date;
|
|
50
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Event } from "./event.model";
|
|
2
|
+
import { Field } from "./field.model";
|
|
3
|
+
|
|
4
|
+
export interface Hook {
|
|
5
|
+
id?: number;
|
|
6
|
+
name?: string;
|
|
7
|
+
eventId?: string;
|
|
8
|
+
url?: string;
|
|
9
|
+
event?: Event;
|
|
10
|
+
fields?: Field[];
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
updatedAt?: Date;
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Hook } from "./hook.model";
|
|
2
|
+
|
|
3
|
+
export interface HookProfile {
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
hooks: Hook[];
|
|
8
|
+
createdAt: Date;
|
|
9
|
+
updatedAt?: Date;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface HookProfilesHooks {
|
|
13
|
+
id?: number;
|
|
14
|
+
hookProfileId?: number;
|
|
15
|
+
hookId?: number;
|
|
16
|
+
hook?: Hook;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt?: Date;
|
|
19
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { REGISTRATION_MODE } from "../util/constants";
|
|
2
|
+
import { PaymentDataType } from "./paymentData.model";
|
|
3
|
+
import { CSVRow } from "./csv.model";
|
|
4
|
+
|
|
5
|
+
export interface Lead {
|
|
6
|
+
id?: number;
|
|
7
|
+
isCustomer?: boolean;
|
|
8
|
+
visitId?: number;
|
|
9
|
+
csvRowId?: number;
|
|
10
|
+
csvId?: number;
|
|
11
|
+
firstName?: string;
|
|
12
|
+
lastName?: string;
|
|
13
|
+
email?: string;
|
|
14
|
+
phoneNumber?: string;
|
|
15
|
+
address1?: string;
|
|
16
|
+
address2?: string;
|
|
17
|
+
street?: string;
|
|
18
|
+
city?: string;
|
|
19
|
+
state?: string;
|
|
20
|
+
country?: string;
|
|
21
|
+
zipCode?: string;
|
|
22
|
+
registrationMode?: REGISTRATION_MODE;
|
|
23
|
+
// customerId?: number;
|
|
24
|
+
paymentData?: PaymentDataType;
|
|
25
|
+
csvRow?: CSVRow;
|
|
26
|
+
createdAt?: Date;
|
|
27
|
+
updatedAt?: Date;
|
|
28
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ProviderAdapter } from "./gateway.model";
|
|
2
|
+
|
|
3
|
+
export const MID_STATE = {
|
|
4
|
+
ACTIVE: 'ACTIVE',
|
|
5
|
+
TERMINATED: 'TERMINATED'
|
|
6
|
+
};
|
|
7
|
+
export type MID_STATE = (typeof MID_STATE)[keyof typeof MID_STATE];
|
|
8
|
+
|
|
9
|
+
export interface Mid {
|
|
10
|
+
id?: number;
|
|
11
|
+
name?: string;
|
|
12
|
+
providerAdapterId?: number;
|
|
13
|
+
providerAdapter?: ProviderAdapter;
|
|
14
|
+
currency?: string;
|
|
15
|
+
state?: MID_STATE;
|
|
16
|
+
descriptor?: string;
|
|
17
|
+
midAuth?: MidAuth;
|
|
18
|
+
createdAt?: Date;
|
|
19
|
+
updatedAt?: Date;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface MidAuth {
|
|
23
|
+
username: string;
|
|
24
|
+
password: string;
|
|
25
|
+
token: string;
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { OFFER_TYPE } from '../util/constants';
|
|
2
|
+
import { Campaign } from './campaign.model';
|
|
3
|
+
import { Mid } from './mid.model';
|
|
4
|
+
import { Product } from './product.model';
|
|
5
|
+
|
|
6
|
+
export interface Offer {
|
|
7
|
+
id?: number;
|
|
8
|
+
name?: string;
|
|
9
|
+
type?: OFFER_TYPE;
|
|
10
|
+
productId?: number;
|
|
11
|
+
product?: Product;
|
|
12
|
+
oneTimePayment?: boolean;
|
|
13
|
+
price?: number;
|
|
14
|
+
currency?: string;
|
|
15
|
+
trialPrice?: number;
|
|
16
|
+
trialIntervalUnit?: string;
|
|
17
|
+
trialPeriod?: string;
|
|
18
|
+
midId?: number;
|
|
19
|
+
mid?: Mid;
|
|
20
|
+
midRouterId?: string;
|
|
21
|
+
campaignId?: number;
|
|
22
|
+
campaign?: Campaign;
|
|
23
|
+
recurringSettingId?: string;
|
|
24
|
+
createdAt?: Date;
|
|
25
|
+
updatedAt?: Date;
|
|
26
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ORDER_STATUS } from '../util/constants';
|
|
2
|
+
import { Offer } from "./offer.model";
|
|
3
|
+
import { PaymentDataType } from "./paymentData.model";
|
|
4
|
+
import { Mid } from "./mid.model";
|
|
5
|
+
import { Campaign } from "./campaign.model";
|
|
6
|
+
import { Transaction } from "./transaction.model";
|
|
7
|
+
|
|
8
|
+
export interface Order {
|
|
9
|
+
id?: number;
|
|
10
|
+
// leadId?: number;
|
|
11
|
+
// lead?: Lead;
|
|
12
|
+
campaign?: Campaign;
|
|
13
|
+
paymentId?: number;
|
|
14
|
+
paymentData?: PaymentDataType;
|
|
15
|
+
amount?: number;
|
|
16
|
+
currency?: string;
|
|
17
|
+
status?: ORDER_STATUS;
|
|
18
|
+
notes?: string;
|
|
19
|
+
orderItems?: OrderItem[];
|
|
20
|
+
createdAt?: Date;
|
|
21
|
+
updatedAt?: Date;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface OrderItem {
|
|
25
|
+
id?: number;
|
|
26
|
+
quantity?: number;
|
|
27
|
+
trialPrice?: number;
|
|
28
|
+
price?: number;
|
|
29
|
+
currency?: string;
|
|
30
|
+
oneTimePayment?: boolean;
|
|
31
|
+
orderId?: number;
|
|
32
|
+
order?: Order;
|
|
33
|
+
offerId?: number;
|
|
34
|
+
offer?: Offer;
|
|
35
|
+
midId?: number;
|
|
36
|
+
mid?: Mid;
|
|
37
|
+
transactionId?: number; // we do not have a direct FK. Populate from Order.
|
|
38
|
+
transaction?: Transaction;
|
|
39
|
+
createdAt?: Date;
|
|
40
|
+
updatedAt?: Date;
|
|
41
|
+
}
|