@yosle/tropipayjs 0.1.9 → 0.1.10

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/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v18.16.1
package/LICENSE CHANGED
@@ -1,10 +1,10 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 Yosleivy Baez Acosta.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
6
- furnished to do so, subject to the following conditions:
7
-
8
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
-
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Yosleivy Baez Acosta.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
6
+ furnished to do so, subject to the following conditions:
7
+
8
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
+
10
10
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,138 +1,154 @@
1
- TropipayJS - Typescript/Javascript SDK for Tropipay Payments API
2
- ===========
3
- ![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white)
4
- ![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge&logo=typescript&logoColor=white)
5
- ![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E)
6
- ![Next JS](https://img.shields.io/badge/Next-black?style=for-the-badge&logo=next.js&logoColor=white)
7
- ![RollupJS](https://img.shields.io/badge/RollupJS-ef3335?style=for-the-badge&logo=rollup.js&logoColor=white)
8
-
9
- TropiPay is an electronic wallet that allows you to execute the most common financial operations of the day to day. This is SDK for Typescript and Javacript that helps you build integrations with the Tropipay platform in an easier way. Can save you a lot of time and effort implementing all the API features. You can use this library with CommonJS system (node + express) or ES6 module system (NextJS).
10
-
11
-
12
- # Table of Contents
13
- - [TropipayJS - Typescript/Javascript SDK for Tropipay Payments API](#tropipayjs---typescriptjavascript-sdk-for-tropipay-payments-api)
14
- - [Table of Contents](#table-of-contents)
15
- - [About the project](#about-the-project)
16
- - [Getting started](#getting-started)
17
- - [Setting up your app credentials](#setting-up-your-app-credentials)
18
- - [Usage](#usage)
19
- - [CommonJS](#commonjs)
20
- - [ES6](#es6)
21
- - [Initialize the Tropipay class](#initialize-the-tropipay-class)
22
- - [Generating a Payment Link](#generating-a-payment-link)
23
- - [Contributing](#contributing)
24
- - [License](#license)
25
-
26
- ## About the project
27
- This library is a community effort. Tropipay may make some changes on the API specification. Use the [test environment](https://tropipay-dev.herokuapp.com) to make sure everything is working as expected.
28
-
29
- **Note:** This library is provided as-is and serves as a client for the Tropipay API. While every effort has been made to ensure the accuracy and reliability of the library, Tropipay is solely responsible for maintaining and updating the API documentation.
30
-
31
- The library is intended to simplify the integration process with Tropipay's services, but it is essential to consult the official documentation to ensure that you are using the API correctly and taking into account any recent changes or updates made by Tropipay.
32
- # Getting started
33
- You can use npm or yarn to install this package:
34
-
35
- ```npm install @yosle/tropipayjs```
36
-
37
- or
38
-
39
- ```yarn add @yosle/tropipayjs```
40
-
41
- ## Setting up your app credentials
42
-
43
- ![alt](https://github.com/yosle/tropipayjs/blob/master/docs/images/app-credentials-menu.png?raw=true)
44
- ![alt](https://github.com/yosle/tropipayjs/blob/master/docs/images/confirmation-code-screen.png?raw=true)
45
-
46
- In order to use the Tropipay API you'll need a client ID and a client secret. Sign up with your [Tropipay](www.tropipay.com) account, go to the App Menu->Applications and credentials. You'll be asked to enter a confirmation code (use 123456 in the test enviroment). _Make sure you test everything in the [test environment](https://tropipay-dev.herokuapp.com) first before using your real account._ Create an app and configure the client id an client secret for the app.
47
-
48
- ## Usage
49
- The Tropipay instance, allows you to access all the method available in the API. This Object is meant to be used *only in server side*. Do not use the Tropipay object on the client side (browser). This would expose your app credentials (the client secret of your account). You can create an endpoint at your back-end using express and consume it in your front-end, or use SSR if you're using NextJS.
50
-
51
- ### CommonJS
52
- ```javascript
53
- const { Tropipay } = require('@yosle/tropipayjs')
54
- ```
55
- ### ES6
56
- ```javascript
57
- import { Tropipay } from '@yosle/tropipayjs'
58
- ```
59
- ### Initialize the Tropipay class
60
- You can instantiate the Tropipay class passing the client Id ,client secret and optionally the serverMode parameter, if no serverMode is provided, `Development` will be used as default. Make sure you use the [test environment](https://tropipay-dev.herokuapp.com) credentials when serverMode is on `Development`.
61
-
62
- ```javascript
63
- // test environment server tropipay-dev.herokuapp.com
64
- const config = {
65
- clientId: process.env.TROPIPAY_CLIENT_ID,
66
- clientSecret: process.env.TROPIPAY_CLIENT_SECRET
67
- serverMode: 'Development' // it will be used as default if omited
68
- }
69
- const tpp = new Tropipay(config)
70
- ```
71
-
72
- To use your live credentials (real account) you must explicity set serverMode to `Production`.
73
-
74
- ```javascript
75
- //real account credentials
76
- const config = {
77
- clientId: process.env.TROPIPAY_CLIENT_ID,
78
- clientSecret: process.env.TROPIPAY_CLIENT_SECRET,
79
- serverMode: 'Production' //live account
80
- }
81
- const tpp = new Tropipay(config)
82
- ```
83
- ### Generating a Payment Link
84
- ```javascript
85
- /*
86
- * Example Payload
87
- */
88
- const payload = {
89
- reference: "my-paylink-1",
90
- concept: "Bicycle",
91
- favorite: "true",
92
- amount: 3000,
93
- currency: "EUR",
94
- description: "Two wheels",
95
- singleUse: "true",
96
- reasonId: 4,
97
- expirationDays: 1,
98
- lang: "es",
99
- urlSuccess: "https://webhook.site/680826a5-199e-4455-babc-f47b7f26ee7e",
100
- urlFailed: "https://webhook.site/680826a5-199e-4455-babc-f47b7f26ee7e",
101
- urlNotification: "https://webhook.site/680826a5-199e-4455-babc-f47b7f26ee7e",
102
- serviceDate: "2021-08-20",
103
- client: {
104
- name: "John",
105
- lastName: "McClane",
106
- address: "Ave. Guadí 232, Barcelona, Barcelona",
107
- phone: "+34645553333",
108
- email: "client@email.com",
109
- countryId: 1,
110
- termsAndConditions: "true"
111
- },
112
- directPayment: "true"
113
- }
114
- // Use inside an async function
115
- const paylink = await tpp.createPaymentCard(payload);
116
- console.log(paylink.shortUrl);
117
- ```
118
-
119
- For more examples, please refer to the [Documentation](https://github.com/yosle/tropipayjs/blob/master/docs/)
120
-
121
- # Contributing
122
- If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
123
-
124
- 1. Fork the Project
125
- 2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
126
- 3. Commit your Changes (`git commit -m 'Add some AmazingFeature`)
127
- 4. Push to the Branch (`git push origin feature/AmazingFeature`)
128
- 5. Open a Pull Request
129
-
130
- Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
131
-
132
- You can also make a small [donation to the author](https://tppay.me/l94qaa3h) of the library.
133
- # License
134
- Distributed under the MIT License. See `LICENSE.txt` for more information.
135
-
136
-
137
-
138
-
1
+ TropipayJS - Typescript/Javascript SDK for Tropipay Payments API
2
+ ===========
3
+
4
+ ![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white)
5
+ ![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge&logo=typescript&logoColor=white)
6
+ ![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E)
7
+ ![Next JS](https://img.shields.io/badge/Next-black?style=for-the-badge&logo=next.js&logoColor=white)
8
+ ![RollupJS](https://img.shields.io/badge/RollupJS-ef3335?style=for-the-badge&logo=rollup.js&logoColor=white)
9
+
10
+ TropiPay is an electronic wallet that allows you to execute the most common financial operations of the day to day. This is SDK for Typescript and Javacript that helps you build integrations with the Tropipay platform in an easier way. Can save you a lot of time and effort implementing all the API features. You can use this library with CommonJS system (node + express) or ES6 module system (NextJS).
11
+
12
+
13
+ # Table of Contents
14
+
15
+ - [TropipayJS - Typescript/Javascript SDK for Tropipay Payments API](#tropipayjs---typescriptjavascript-sdk-for-tropipay-payments-api)
16
+ - [Table of Contents](#table-of-contents)
17
+ - [About the project](#about-the-project)
18
+ - [Getting started](#getting-started)
19
+ - [Setting up your app credentials](#setting-up-your-app-credentials)
20
+ - [Usage](#usage)
21
+ - [CommonJS](#commonjs)
22
+ - [ES6](#es6)
23
+ - [Initialize the Tropipay class](#initialize-the-tropipay-class)
24
+ - [Generating a Payment Link](#generating-a-payment-link)
25
+ - [Contributing](#contributing)
26
+ - [License](#license)
27
+
28
+ ## About the project
29
+
30
+ This library is a community effort. Tropipay may make some changes on the API specification. Use the [test environment](https://tropipay-dev.herokuapp.com) to make sure everything is working as expected.
31
+
32
+ **Note:** This library is provided as-is and serves as a client for the Tropipay API. While every effort has been made to ensure the accuracy and reliability of the library, Tropipay is solely responsible for maintaining and updating the API documentation.
33
+
34
+ The library is intended to simplify the integration process with Tropipay's services, but it is essential to consult the official documentation to ensure that you are using the API correctly and taking into account any recent changes or updates made by Tropipay.
35
+
36
+ # Getting started
37
+
38
+ You can use npm or yarn to install this package:
39
+
40
+ ```npm install @yosle/tropipayjs```
41
+
42
+ or
43
+
44
+ ```yarn add @yosle/tropipayjs```
45
+
46
+ ## Setting up your app credentials
47
+
48
+ ![alt](https://github.com/yosle/tropipayjs/blob/master/docs/images/app-credentials-menu.png?raw=true)
49
+ ![alt](https://github.com/yosle/tropipayjs/blob/master/docs/images/confirmation-code-screen.png?raw=true)
50
+
51
+ In order to use the Tropipay API you'll need a client ID and a client secret. Sign up with your [Tropipay](www.tropipay.com) account, go to the App Menu->Applications and credentials. You'll be asked to enter a confirmation code (use 123456 in the test enviroment). _Make sure you test everything in the [test environment](https://tropipay-dev.herokuapp.com) first before using your real account._ Create an app and configure the client id an client secret for the app.
52
+
53
+ ## Usage
54
+
55
+ The Tropipay instance, allows you to access all the method available in the API. This Object is meant to be used *only in server side*. Do not use the Tropipay object on the client side (browser). This would expose your app credentials (the client secret of your account). You can create an endpoint at your back-end using express and consume it in your front-end, or use SSR if you're using NextJS.
56
+
57
+ ### CommonJS
58
+
59
+ ```javascript
60
+ const { Tropipay } = require('@yosle/tropipayjs')
61
+ ```
62
+
63
+ ### ES6
64
+
65
+ ```javascript
66
+ import { Tropipay } from '@yosle/tropipayjs'
67
+ ```
68
+
69
+ ### Initialize the Tropipay class
70
+
71
+ You can instantiate the Tropipay class passing the client Id ,client secret and optionally the serverMode parameter, if no serverMode is provided, `Development` will be used as default. Make sure you use the [test environment](https://tropipay-dev.herokuapp.com) credentials when serverMode is on `Development`.
72
+
73
+ ```javascript
74
+ // test environment server tropipay-dev.herokuapp.com
75
+ const config = {
76
+ clientId: process.env.TROPIPAY_CLIENT_ID,
77
+ clientSecret: process.env.TROPIPAY_CLIENT_SECRET
78
+ serverMode: 'Development' // it will be used as default if omited
79
+ }
80
+ const tpp = new Tropipay(config)
81
+ ```
82
+
83
+ To use your live credentials (real account) you must explicity set serverMode to `Production`.
84
+
85
+ ```javascript
86
+ //real account credentials
87
+ const config = {
88
+ clientId: process.env.TROPIPAY_CLIENT_ID,
89
+ clientSecret: process.env.TROPIPAY_CLIENT_SECRET,
90
+ serverMode: 'Production' //live account
91
+ }
92
+ const tpp = new Tropipay(config)
93
+ ```
94
+
95
+ ### Generating a Payment Link
96
+
97
+ ```javascript
98
+ /*
99
+ * Example Payload
100
+ */
101
+ const payload = {
102
+ reference: "my-paylink-1",
103
+ concept: "Bicycle",
104
+ favorite: "true",
105
+ amount: 3000,
106
+ currency: "EUR",
107
+ description: "Two wheels",
108
+ singleUse: "true",
109
+ reasonId: 4,
110
+ expirationDays: 1,
111
+ lang: "es",
112
+ urlSuccess: "https://webhook.site/680826a5-199e-4455-babc-f47b7f26ee7e",
113
+ urlFailed: "https://webhook.site/680826a5-199e-4455-babc-f47b7f26ee7e",
114
+ urlNotification: "https://webhook.site/680826a5-199e-4455-babc-f47b7f26ee7e",
115
+ serviceDate: "2021-08-20",
116
+ client: {
117
+ name: "John",
118
+ lastName: "McClane",
119
+ address: "Ave. Guadí 232, Barcelona, Barcelona",
120
+ phone: "+34645553333",
121
+ email: "client@email.com",
122
+ countryId: 1,
123
+ termsAndConditions: "true"
124
+ },
125
+ directPayment: "true"
126
+ }
127
+ // Use inside an async function
128
+ const paylink = await tpp.createPaymentCard(payload);
129
+ console.log(paylink.shortUrl);
130
+ ```
131
+
132
+ For more examples, please refer to the [Documentation](https://github.com/yosle/tropipayjs/blob/master/docs/)
133
+
134
+ # Contributing
135
+
136
+ If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
137
+
138
+ 1. Fork the Project
139
+ 2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
140
+ 3. Commit your Changes (`git commit -m 'Add some AmazingFeature`)
141
+ 4. Push to the Branch (`git push origin feature/AmazingFeature`)
142
+ 5. Open a Pull Request
143
+
144
+ Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
145
+
146
+ You can also make a small [donation to the author](https://tppay.me/l94qaa3h) of the library.
147
+
148
+ # License
149
+
150
+ Distributed under the MIT License. See `LICENSE.txt` for more information.
151
+
152
+
153
+
154
+
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Tropipayjs is a Typescript/Javascript library for the Tropipay API.
3
+ *
4
+ * @author Yosleivy Baez Acosta
5
+ *
6
+ */
7
+ import { Axios } from "axios";
8
+ import { TropipayConfig, AccountBalance, Country, PaymentLinkPayload, PaymentLink, mediationPaymentCardConfig, LoginResponse, AccountDeposits } from "../interfaces";
9
+ type ServerMode = "Development" | "Production";
10
+ import { TropipayHooks } from "../hooks/TropipayHooks";
11
+ export declare class Tropipay {
12
+ readonly clientId: string;
13
+ readonly clientSecret: string;
14
+ request: Axios;
15
+ static accessToken: string | undefined;
16
+ static refreshToken: string | undefined;
17
+ serverMode: ServerMode;
18
+ hooks: TropipayHooks;
19
+ constructor(config: TropipayConfig);
20
+ login(): Promise<LoginResponse>;
21
+ /**
22
+ * Create a paymentLink with the specified options.
23
+ * @param payload PaymentLinkPayload Object.
24
+ * @returns Promise<PaymentLink> or throws an Exception.
25
+ * @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6ODgyNTM3OQ-create-a-new-pay-link-charge
26
+ */
27
+ createPaymentCard(payload: PaymentLinkPayload): Promise<PaymentLink>;
28
+ /**
29
+ * Get all deposits in this account.
30
+ * @returns A Promise of an Array of AccountDeposits or throws an Exception
31
+ * @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6OTgyOTQ1Mg-get-deposit-accounts-list
32
+ */
33
+ getDepositAccounts(): Promise<AccountDeposits[] | Error>;
34
+ /**
35
+ * Get the list of all supported countries by Tropipay.
36
+ * @returns Array of Countries Data
37
+ * @see https://tpp.stoplight.io/docs/tropipay-api-doc/bfac21259e2ff-getting-users-countries-list
38
+ */
39
+ countries(): Promise<Country[]>;
40
+ /**
41
+ * Get user balance
42
+ * @returns balance Object { balance: number, pendingIn: number, pendingOut: number }
43
+ */
44
+ getBalance(): Promise<AccountBalance>;
45
+ /**
46
+ * Get the list of all detination countries supported by Tropipay.
47
+ * Obtaining the list of valid countries to send funds to. Useful
48
+ * when adding new beneficiaries to some user.
49
+ *
50
+ * @returns Array of Country Objects
51
+ * @see https://tpp.stoplight.io/docs/tropipay-api-doc/3cfe5504f0524-getting-list-of-beneficiary-countries
52
+ */
53
+ destinations(): Promise<Country[]>;
54
+ /**
55
+ * Get list of all the favorites payment links.
56
+ * @returns Array of account Object or throws an error
57
+ */
58
+ favorites(): Promise<any>;
59
+ /**
60
+ * List all account movements. You can optionaly specify
61
+ * offset and limit params for pagination.
62
+ * @returns
63
+ */
64
+ movements(offset?: number, limit?: number): Promise<any>;
65
+ /**
66
+ * Return profile data for this account.
67
+ * @returns
68
+ */
69
+ profile(): Promise<any>;
70
+ /**
71
+ * Obtain current Tropipay conversion rate. For example USD to EUR
72
+ * targetCurrency must be 'EUR'
73
+ * @param originCurrency Target currency code supported by Tropipay.
74
+ * @param targetCurrency Must be 'EUR'? (not documented by Tropipay)
75
+ * @returns Conversion rate (number)
76
+ * @see https://tpp.stoplight.io/docs/tropipay-api-doc/85163f6f28b23-get-rate
77
+ */
78
+ rates(originCurrency: string, targetCurrency?: string): Promise<number | Error>;
79
+ /**
80
+ * (ONLY in Bussiness Accounts)
81
+ * An escrow payment link. This allows a payment to be made to persons
82
+ * belonging or not to the TropiPay platform with the particularity
83
+ * that the payment will be held in custody or retained until it is
84
+ * released with the approval of the payer.
85
+ * @see https://tpp.stoplight.io/docs/tropipay-api-doc/12a128ff971e4-creating-a-mediation-payment-card
86
+ * @param config Payload with the payment details
87
+ */
88
+ createMediationPaymentCard(config: mediationPaymentCardConfig): Promise<PaymentLink>;
89
+ }
90
+ export declare class ClientSideUtils {
91
+ constructor(tropipayInstance: Tropipay);
92
+ }
93
+ export {};
@@ -0,0 +1,2 @@
1
+ import { ServerMode } from "../constants/TropipayConstants";
2
+ export declare const SERVER_MODE: ServerMode;
@@ -0,0 +1 @@
1
+ export type ServerMode = "Development" | "Production";
package/docs/index.MD CHANGED
@@ -1,19 +1,19 @@
1
- # Tropipayjs
2
-
3
- Tropipayjs is a TypeScript/JavaScript library for the Tropipay API.
4
-
5
- ## Table of Contents
6
-
7
- - [Installation](#installation)
8
- - [Usage](#usage)
9
- - [API Reference](#api-reference)
10
- - [Contributing](#contributing)
11
- - [License](#license)
12
-
13
- ## Installation
14
-
15
- To use Tropipayjs in your project, you need to install it via npm. Run the following command:
16
-
17
- ```npm install tropipayjs```
18
- or
1
+ # Tropipayjs
2
+
3
+ Tropipayjs is a TypeScript/JavaScript library for the Tropipay API.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Installation](#installation)
8
+ - [Usage](#usage)
9
+ - [API Reference](#api-reference)
10
+ - [Contributing](#contributing)
11
+ - [License](#license)
12
+
13
+ ## Installation
14
+
15
+ To use Tropipayjs in your project, you need to install it via npm. Run the following command:
16
+
17
+ ```npm install tropipayjs```
18
+ or
19
19
  ```yarn add tropipayjs```
package/globals.d.ts CHANGED
@@ -1,75 +1,75 @@
1
- type LoginResponse = {
2
- access_token: string,
3
- refresh_token: string
4
- token_type: "Bearer",
5
- expires_in: number,
6
- scope: string
7
- }
8
-
9
- type LoginError = {
10
- error: string
11
- }
12
-
13
- type Country = {
14
- id: number,
15
- name: string,
16
- sepaZone: boolean,
17
- state: number,
18
- slug: string,
19
- slugn: number,
20
- callingCode: number,
21
- isDestination: boolean,
22
- isRisky: boolean,
23
- currentCurrency: string | null,
24
- createdAt: string,
25
- updatedAt: string,
26
- isFavorite: boolean,
27
- position: any
28
-
29
- }
30
-
31
- type Deposit = {
32
- id: number,
33
- accountNumber: string,
34
- alias: string,
35
- swift: string,
36
- type: number,
37
- country: number | null,
38
- firstName: string,
39
- default: null,
40
- state: number,
41
- userId: string,
42
- countryDestinationId: number,
43
- lastName: string,
44
- documentNumber: number,
45
- userRelationTypeId: number,
46
- city: string,
47
- postalCode: string,
48
- address: string,
49
- phone: string,
50
- checked: boolean,
51
- province: string,
52
- beneficiaryType: number,
53
- relatedUserId: null | string,
54
- currency: string,
55
- correspondent?: any,
56
- location: any,
57
- office: any,
58
- officeValue: any,
59
- paymentType: number,
60
- paymentEntityBeneficiaryId: number,
61
- paymentEntityAccountId: number,
62
- verified: any,
63
- paymentEntityInfo: any,
64
- documentTypeId: any,
65
- documentExpirationDate: Date,
66
- createdAt: Date<string>,
67
- updatedAt: Date<string>,
68
- countryDestination: Country
69
- }
70
-
71
- type AccountDeposits = {
72
- count: number,
73
- rows: Deposit[]
74
- }
75
-
1
+ type LoginResponse = {
2
+ access_token: string,
3
+ refresh_token: string
4
+ token_type: "Bearer",
5
+ expires_in: number,
6
+ scope: string
7
+ }
8
+
9
+ type LoginError = {
10
+ error: string
11
+ }
12
+
13
+ type Country = {
14
+ id: number,
15
+ name: string,
16
+ sepaZone: boolean,
17
+ state: number,
18
+ slug: string,
19
+ slugn: number,
20
+ callingCode: number,
21
+ isDestination: boolean,
22
+ isRisky: boolean,
23
+ currentCurrency: string | null,
24
+ createdAt: string,
25
+ updatedAt: string,
26
+ isFavorite: boolean,
27
+ position: any
28
+
29
+ }
30
+
31
+ type Deposit = {
32
+ id: number,
33
+ accountNumber: string,
34
+ alias: string,
35
+ swift: string,
36
+ type: number,
37
+ country: number | null,
38
+ firstName: string,
39
+ default: null,
40
+ state: number,
41
+ userId: string,
42
+ countryDestinationId: number,
43
+ lastName: string,
44
+ documentNumber: number,
45
+ userRelationTypeId: number,
46
+ city: string,
47
+ postalCode: string,
48
+ address: string,
49
+ phone: string,
50
+ checked: boolean,
51
+ province: string,
52
+ beneficiaryType: number,
53
+ relatedUserId: null | string,
54
+ currency: string,
55
+ correspondent?: any,
56
+ location: any,
57
+ office: any,
58
+ officeValue: any,
59
+ paymentType: number,
60
+ paymentEntityBeneficiaryId: number,
61
+ paymentEntityAccountId: number,
62
+ verified: any,
63
+ paymentEntityInfo: any,
64
+ documentTypeId: any,
65
+ documentExpirationDate: Date,
66
+ createdAt: Date<string>,
67
+ updatedAt: Date<string>,
68
+ countryDestination: Country
69
+ }
70
+
71
+ type AccountDeposits = {
72
+ count: number,
73
+ rows: Deposit[]
74
+ }
75
+
@@ -0,0 +1,17 @@
1
+ import { HookEventType, UserHookSubscribed } from "../interfaces";
2
+ import { Tropipay } from "../api/TropipayAPI";
3
+ export declare class TropipayHooks {
4
+ private tropipay;
5
+ constructor(tropipayInstance: Tropipay);
6
+ static subscribeHook(eventType: HookEventType, target: string, value: string): Promise<void>;
7
+ /**
8
+ * Get hook the sucbcribed hook info by his eventType.
9
+ * If no eventType is passed it will return
10
+ * all subscribed hooks or empty Array if none hooks exist.
11
+ * @param eventType or no params for retrieving all hooks
12
+ * @returns
13
+ */
14
+ getSubscribedHook(eventType?: HookEventType): Promise<UserHookSubscribed[]>;
15
+ updateSubscribedHook(eventType?: string): Promise<void>;
16
+ deleteSubscribedHook(eventType?: string): Promise<void>;
17
+ }