@yosle/tropipayjs 0.2.2 → 0.3.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/README.md +69 -9
- package/index.d.ts +358 -75
- package/index.js +427 -355
- package/index.js.map +1 -0
- package/package.json +18 -11
- package/.nvmrc +0 -1
- package/.vscode/launch.json +0 -18
- package/api/TropipayAPI.d.ts +0 -133
- package/config/TropipayConfig.d.ts +0 -2
- package/constants/TropipayConstants.d.ts +0 -2
- package/depositAccount/depositAccounts.d.ts +0 -36
- package/docs/readme.md +0 -3
- package/globals.d.ts +0 -75
- package/hooks/TropipayHooks.d.ts +0 -38
- package/interfaces/countries/index.d.ts +0 -1
- package/interfaces/depositaccounts/index.d.ts +0 -68
- package/interfaces/index.d.ts +0 -176
- package/interfaces/mediation/index.d.ts +0 -22
- package/interfaces/paymentlink/index.d.ts +0 -87
- package/jest.config.js +0 -5
- package/mediationPaymentCard/MediationPaymentCard.d.ts +0 -17
- package/paymentcard/PaymentCard.d.ts +0 -37
- package/paymentcard/paymentcard.spec.d.ts +0 -1
- package/rollup.config.js +0 -24
- package/src/api/TropipayAPI.ts +0 -459
- package/src/config/TropipayConfig.ts +0 -2
- package/src/constants/TropipayConstants.ts +0 -2
- package/src/depositAccount/depositAccounts.ts +0 -139
- package/src/hooks/TropipayHooks.ts +0 -154
- package/src/index.ts +0 -29
- package/src/interfaces/depositaccounts/index.ts +0 -70
- package/src/interfaces/index.js +0 -2
- package/src/interfaces/index.ts +0 -212
- package/src/interfaces/mediation/index.ts +0 -23
- package/src/interfaces/paymentlink/index.d.ts +0 -36
- package/src/interfaces/paymentlink/index.js +0 -3
- package/src/interfaces/paymentlink/index.ts +0 -91
- package/src/mediationPaymentCard/MediationPaymentCard.ts +0 -42
- package/src/mocks/tropipay.ts +0 -0
- package/src/paymentcard/PaymentCard.ts +0 -123
- package/src/paymentcard/paymentcard.spec.ts +0 -79
- package/src/utils/TropipayUtils.ts +0 -126
- package/src/utils/errors.ts +0 -92
- package/tsconfig.json +0 -96
- package/utils/TropipayUtils.d.ts +0 -45
- package/utils/errors.d.ts +0 -16
package/interfaces/index.d.ts
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { ServerMode } from "../constants/TropipayConstants";
|
|
2
|
-
export type AccountBalance = {
|
|
3
|
-
balance: number;
|
|
4
|
-
pendingIn: number;
|
|
5
|
-
pendingOut: number;
|
|
6
|
-
};
|
|
7
|
-
export interface TropipayConfig {
|
|
8
|
-
clientId: string;
|
|
9
|
-
clientSecret: string;
|
|
10
|
-
scopes?: string[];
|
|
11
|
-
serverMode?: ServerMode;
|
|
12
|
-
customTropipayUrl?: string;
|
|
13
|
-
}
|
|
14
|
-
export type TropipayCredentials = {
|
|
15
|
-
clientId: string;
|
|
16
|
-
clientSecret: string;
|
|
17
|
-
};
|
|
18
|
-
export type HookEventType = "transaction_completed" | "transaction_charged" | "transaction_guarded" | "user_signup" | "user_kyc" | "payment_in_state_change" | "payment_out_state_change" | "beneficiary_added" | "beneficiary_updated" | "beneficiary_deleted" | "transaction_new" | "transaction_preauthorized" | "transaction_pendingin" | "transaction_processing" | "transaction_error" | "transaction_bloqued" | "transaction_guarded_send" | "transaction_guarded_mediation" | "user_after_update" | "user_after_create" | "userDetail_after_create" | "userDetail_after_update" | "tpv_callback_ok" | "fraud_state_on_change";
|
|
19
|
-
export type HookTargetType = "web" | "email";
|
|
20
|
-
export interface UserHook {
|
|
21
|
-
event: HookEventType;
|
|
22
|
-
target: string;
|
|
23
|
-
value: string;
|
|
24
|
-
}
|
|
25
|
-
export interface UserHookSubscribed extends UserHook {
|
|
26
|
-
createdAt: string;
|
|
27
|
-
updatedAt: string;
|
|
28
|
-
}
|
|
29
|
-
export interface UserHook {
|
|
30
|
-
event: HookEventType;
|
|
31
|
-
target: string;
|
|
32
|
-
value: string;
|
|
33
|
-
}
|
|
34
|
-
export interface UserHookSubscribed extends UserHook {
|
|
35
|
-
createdAt: string;
|
|
36
|
-
updatedAt: string;
|
|
37
|
-
}
|
|
38
|
-
export interface PaymentLinkPayload {
|
|
39
|
-
reference: string;
|
|
40
|
-
concept: string;
|
|
41
|
-
favorite: boolean;
|
|
42
|
-
amount: number;
|
|
43
|
-
currency: string;
|
|
44
|
-
description: string;
|
|
45
|
-
singleUse: boolean;
|
|
46
|
-
reasonId: number;
|
|
47
|
-
expirationDays: number;
|
|
48
|
-
lang: string;
|
|
49
|
-
urlSuccess: string;
|
|
50
|
-
urlFailed: string;
|
|
51
|
-
urlNotification: string;
|
|
52
|
-
serviceDate: string;
|
|
53
|
-
client?: {
|
|
54
|
-
name?: string;
|
|
55
|
-
lastName?: string;
|
|
56
|
-
address?: string;
|
|
57
|
-
phone?: string;
|
|
58
|
-
email?: string;
|
|
59
|
-
countryId?: number;
|
|
60
|
-
countryIso?: string;
|
|
61
|
-
city: string;
|
|
62
|
-
postCode: string;
|
|
63
|
-
termsAndConditions: boolean;
|
|
64
|
-
} | null;
|
|
65
|
-
directPayment: boolean;
|
|
66
|
-
paymentMethods?: string[];
|
|
67
|
-
imageBase?: string;
|
|
68
|
-
saveToken?: boolean;
|
|
69
|
-
}
|
|
70
|
-
export interface PaymentLink extends PaymentLinkPayload {
|
|
71
|
-
expirationDate: string;
|
|
72
|
-
hasClient: boolean;
|
|
73
|
-
updatedAt: string;
|
|
74
|
-
createdAt: string;
|
|
75
|
-
qrImage: string;
|
|
76
|
-
shortUrl: string;
|
|
77
|
-
paymentUrl: string;
|
|
78
|
-
}
|
|
79
|
-
export interface MediationPaymentCardConfig {
|
|
80
|
-
amount: number;
|
|
81
|
-
currency: "EUR" | "USD";
|
|
82
|
-
concept: string;
|
|
83
|
-
description: string;
|
|
84
|
-
reference: string;
|
|
85
|
-
singleUse: boolean;
|
|
86
|
-
lang: string;
|
|
87
|
-
productUrl?: string;
|
|
88
|
-
buyer: null | any;
|
|
89
|
-
seller: {
|
|
90
|
-
sellerId?: number;
|
|
91
|
-
type?: number;
|
|
92
|
-
email?: string;
|
|
93
|
-
};
|
|
94
|
-
feePercent?: number;
|
|
95
|
-
feeFixed?: number;
|
|
96
|
-
sendMail: boolean;
|
|
97
|
-
}
|
|
98
|
-
export type LoginResponse = {
|
|
99
|
-
access_token: string;
|
|
100
|
-
refresh_token: string;
|
|
101
|
-
token_type: "Bearer";
|
|
102
|
-
expires_in: number;
|
|
103
|
-
scope: string;
|
|
104
|
-
};
|
|
105
|
-
export type LoginError = {
|
|
106
|
-
error: string;
|
|
107
|
-
};
|
|
108
|
-
export type Country = {
|
|
109
|
-
id: number;
|
|
110
|
-
name: string;
|
|
111
|
-
sepaZone: boolean;
|
|
112
|
-
state: number;
|
|
113
|
-
slug: string;
|
|
114
|
-
slugn: number;
|
|
115
|
-
callingCode: number;
|
|
116
|
-
isDestination: boolean;
|
|
117
|
-
isRisky: boolean;
|
|
118
|
-
currentCurrency: string | null;
|
|
119
|
-
createdAt: string;
|
|
120
|
-
updatedAt: string;
|
|
121
|
-
isFavorite: boolean;
|
|
122
|
-
position: any;
|
|
123
|
-
};
|
|
124
|
-
export type Deposit = {
|
|
125
|
-
id: number;
|
|
126
|
-
accountNumber: string;
|
|
127
|
-
alias: string;
|
|
128
|
-
swift: string;
|
|
129
|
-
type: number;
|
|
130
|
-
country: number | null;
|
|
131
|
-
firstName: string;
|
|
132
|
-
default: null;
|
|
133
|
-
state: number;
|
|
134
|
-
userId: string;
|
|
135
|
-
countryDestinationId: number;
|
|
136
|
-
lastName: string;
|
|
137
|
-
documentNumber: number;
|
|
138
|
-
userRelationTypeId: number;
|
|
139
|
-
city: string;
|
|
140
|
-
postalCode: string;
|
|
141
|
-
address: string;
|
|
142
|
-
phone: string;
|
|
143
|
-
checked: boolean;
|
|
144
|
-
province: string;
|
|
145
|
-
beneficiaryType: number;
|
|
146
|
-
relatedUserId: null | string;
|
|
147
|
-
currency: string;
|
|
148
|
-
correspondent?: any;
|
|
149
|
-
location: any;
|
|
150
|
-
office: any;
|
|
151
|
-
officeValue: any;
|
|
152
|
-
paymentType: number;
|
|
153
|
-
paymentEntityBeneficiaryId: number;
|
|
154
|
-
paymentEntityAccountId: number;
|
|
155
|
-
verified: any;
|
|
156
|
-
paymentEntityInfo: any;
|
|
157
|
-
documentTypeId: any;
|
|
158
|
-
documentExpirationDate: Date;
|
|
159
|
-
createdAt: Date;
|
|
160
|
-
updatedAt: Date;
|
|
161
|
-
countryDestination: Country;
|
|
162
|
-
};
|
|
163
|
-
export type AccountDeposits = {
|
|
164
|
-
count: number;
|
|
165
|
-
rows: Deposit[];
|
|
166
|
-
};
|
|
167
|
-
export type RefundResponse = {
|
|
168
|
-
id: number;
|
|
169
|
-
orderCode: string;
|
|
170
|
-
amount: number;
|
|
171
|
-
currency: string;
|
|
172
|
-
state: string;
|
|
173
|
-
type: string;
|
|
174
|
-
createdAt: string;
|
|
175
|
-
completedAt: string;
|
|
176
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*/
|
|
4
|
-
export interface mediationPaymentCardConfig {
|
|
5
|
-
amount: number;
|
|
6
|
-
currency: "EUR" | "USD";
|
|
7
|
-
concept: string;
|
|
8
|
-
description: string;
|
|
9
|
-
reference: string;
|
|
10
|
-
singleUse: boolean;
|
|
11
|
-
lang: string;
|
|
12
|
-
productUrl?: string;
|
|
13
|
-
buyer: null | any;
|
|
14
|
-
seller: {
|
|
15
|
-
sellerId?: number;
|
|
16
|
-
type?: number;
|
|
17
|
-
email?: string;
|
|
18
|
-
};
|
|
19
|
-
feePercent?: number;
|
|
20
|
-
feeFixed?: number;
|
|
21
|
-
sendMail: boolean;
|
|
22
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
type PaymentMethodElement = "EXT" | "TPP";
|
|
2
|
-
export type PaymentMethods = Element | [PaymentMethodElement, PaymentMethodElement];
|
|
3
|
-
declare enum Reasons {
|
|
4
|
-
HOUSING_ARRANGEMENT = 1,
|
|
5
|
-
FINANCIAL_AID = 2,
|
|
6
|
-
FAMILY_SUPPORT = 3,
|
|
7
|
-
TRAVEL_FUND = 4,
|
|
8
|
-
REAL_ESTATE_PURCHASE = 5,
|
|
9
|
-
FURNITURE_PURCHASE = 6,
|
|
10
|
-
EDUCATION = 7,
|
|
11
|
-
MEDICAL_EXPENSES = 8,
|
|
12
|
-
OTHER = 9,
|
|
13
|
-
DEBT_PAYMENT = 10,
|
|
14
|
-
TOURISM = 11,
|
|
15
|
-
SELF_SHIPPING = 12,
|
|
16
|
-
ACCOUNT_ACTIVATION = 13,
|
|
17
|
-
SPORTS_ACTIVITIES = 14,
|
|
18
|
-
DONATION = 15,
|
|
19
|
-
AFFILIATE_COMMISSION = 16,
|
|
20
|
-
SALARY = 17,
|
|
21
|
-
SAVINGS = 18,
|
|
22
|
-
RENT_AND_LEASING = 19,
|
|
23
|
-
SHARED_EXPENSES = 20,
|
|
24
|
-
SERVICE_PAYMENT = 21,
|
|
25
|
-
GIFT = 22,
|
|
26
|
-
CRYPTOCURRENCY_PURCHASE = 23,
|
|
27
|
-
OPERATING_EXPENSES = 24,
|
|
28
|
-
CURRENCY_EXCHANGE = 25,
|
|
29
|
-
ACCOMMODATION = 26,
|
|
30
|
-
EQUIPMENT_PURCHASE = 27,
|
|
31
|
-
CONSULTING = 28,
|
|
32
|
-
SOFTWARE_DEVELOPMENT = 29,
|
|
33
|
-
REFUND = 30,
|
|
34
|
-
PACKAGE_DELIVERY = 31,
|
|
35
|
-
PERSONAL_EXPENSES = 32,
|
|
36
|
-
INVESTMENT = 33,
|
|
37
|
-
BILL_PAYMENT = 34,
|
|
38
|
-
HOST_PAYMENT = 35,
|
|
39
|
-
TRANSPORTATION = 36,
|
|
40
|
-
LOAN = 37,
|
|
41
|
-
BONUS = 38,
|
|
42
|
-
HALLOWEEN_REMITTANCE = 39,
|
|
43
|
-
PLINK_REMITTANCE = 41,
|
|
44
|
-
R1_2023 = 78,
|
|
45
|
-
HAPPYWEEK = 79,
|
|
46
|
-
SENDING_YOU_A_KISS = 80
|
|
47
|
-
}
|
|
48
|
-
export interface PaymentLinkPayload {
|
|
49
|
-
reference: string;
|
|
50
|
-
concept: string;
|
|
51
|
-
favorite: boolean;
|
|
52
|
-
amount: number;
|
|
53
|
-
currency: string;
|
|
54
|
-
description: string;
|
|
55
|
-
singleUse: boolean;
|
|
56
|
-
reasonId: Reasons;
|
|
57
|
-
expirationDays: number;
|
|
58
|
-
lang: string;
|
|
59
|
-
urlSuccess: string;
|
|
60
|
-
urlFailed: string;
|
|
61
|
-
urlNotification: string;
|
|
62
|
-
serviceDate: string;
|
|
63
|
-
/**
|
|
64
|
-
* fgfsgdfgdfgd
|
|
65
|
-
*/
|
|
66
|
-
client?: {
|
|
67
|
-
name: string;
|
|
68
|
-
lastName: string;
|
|
69
|
-
address: string;
|
|
70
|
-
phone: string;
|
|
71
|
-
email: string;
|
|
72
|
-
countryId: number;
|
|
73
|
-
termsAndConditions: boolean;
|
|
74
|
-
} | null;
|
|
75
|
-
directPayment?: boolean;
|
|
76
|
-
paymentMethods?: PaymentMethods;
|
|
77
|
-
}
|
|
78
|
-
export interface PaymentLink extends PaymentLinkPayload {
|
|
79
|
-
expirationDate: string;
|
|
80
|
-
hasClient: boolean;
|
|
81
|
-
updatedAt: string;
|
|
82
|
-
createdAt: string;
|
|
83
|
-
qrImage: string;
|
|
84
|
-
shortUrl: string;
|
|
85
|
-
paymentUrl: string;
|
|
86
|
-
}
|
|
87
|
-
export {};
|
package/jest.config.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Tropipay } from "../api/TropipayAPI";
|
|
2
|
-
import { PaymentLink } from "../interfaces";
|
|
3
|
-
import { MediationPaymentCardConfig } from "../interfaces";
|
|
4
|
-
export default class MediationPaymentCard {
|
|
5
|
-
private tropipay;
|
|
6
|
-
constructor(tropipayInstance: Tropipay);
|
|
7
|
-
/**
|
|
8
|
-
* (ONLY FOR BUSINESS ACCOUNTS) Create a mediation paymentcard (an escrow payment link) with the specified options.
|
|
9
|
-
* This allows a payment to be made to persons belonging or not to the TropiPay platform with the
|
|
10
|
-
* particularity that the payment will be held in custody or retained until it is released with
|
|
11
|
-
* the approval of the payer.
|
|
12
|
-
* @param payload PaymentLinkPayload Object.
|
|
13
|
-
* @returns Promise<PaymentLink> or throws an Exception.
|
|
14
|
-
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/12a128ff971e4-creating-a-mediation-payment-card
|
|
15
|
-
*/
|
|
16
|
-
create(payload: MediationPaymentCardConfig): Promise<PaymentLink>;
|
|
17
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Tropipay } from "../api/TropipayAPI";
|
|
2
|
-
import { PaymentLink } from "../interfaces";
|
|
3
|
-
import { PaymentLinkPayload } from "../interfaces";
|
|
4
|
-
export default class PaymentCard {
|
|
5
|
-
private tropipay;
|
|
6
|
-
constructor(tropipayInstance: Tropipay);
|
|
7
|
-
/**
|
|
8
|
-
* Create a paymentLink with the specified options.
|
|
9
|
-
* @param payload PaymentLinkPayload Object.
|
|
10
|
-
* @returns Promise<PaymentLink> or throws an Exception.
|
|
11
|
-
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6ODgyNTM3OQ-create-a-new-pay-link-charge
|
|
12
|
-
*/
|
|
13
|
-
create(payload: PaymentLinkPayload): Promise<PaymentLink>;
|
|
14
|
-
/**
|
|
15
|
-
* Shows a list of stored paymentcards created by user.
|
|
16
|
-
* This list includes active and closed paylinks
|
|
17
|
-
* @returns Array of paymentlinks
|
|
18
|
-
*/
|
|
19
|
-
list(): Promise<any>;
|
|
20
|
-
/**
|
|
21
|
-
* Retrieves a payment card with the specified ID.
|
|
22
|
-
*
|
|
23
|
-
* @param {string} id - The ID of the payment card to retrieve.
|
|
24
|
-
* @return {Promise<any>} A Promise that resolves to the payment card data.
|
|
25
|
-
* @throws {Error} If an error occurs while retrieving the payment card.
|
|
26
|
-
*/
|
|
27
|
-
get(id: string): Promise<any>;
|
|
28
|
-
/**
|
|
29
|
-
* Deletes a payment card with the specified ID. Its a LOGIC delete
|
|
30
|
-
* so this will delete the paymentcard from paymentcard list and
|
|
31
|
-
* disable shortUrl but not paymentUrl
|
|
32
|
-
* @param {string} id - The ID of the payment card to delete.
|
|
33
|
-
* @return {Promise<any>} A Promise that resolves to the deleted payment card data.
|
|
34
|
-
* @throws {Error} If an error occurs while deleting the payment card.
|
|
35
|
-
*/
|
|
36
|
-
delete(id: string): Promise<any>;
|
|
37
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
declare function sum(a: number, b: number): number;
|
package/rollup.config.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// Contents of the file /rollup.config.js
|
|
2
|
-
import typescript from "@rollup/plugin-typescript";
|
|
3
|
-
import dts from "rollup-plugin-dts";
|
|
4
|
-
const config = [
|
|
5
|
-
{
|
|
6
|
-
input: "dist/index.js",
|
|
7
|
-
output: {
|
|
8
|
-
file: "index.js",
|
|
9
|
-
format: "cjs",
|
|
10
|
-
sourcemap: true,
|
|
11
|
-
},
|
|
12
|
-
external: ["axios", "crypto", "fs/promises"],
|
|
13
|
-
plugins: [typescript()],
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
input: "dist/index.d.ts",
|
|
17
|
-
output: {
|
|
18
|
-
file: "index.d.ts",
|
|
19
|
-
format: "es",
|
|
20
|
-
},
|
|
21
|
-
plugins: [dts()],
|
|
22
|
-
},
|
|
23
|
-
];
|
|
24
|
-
export default config;
|