@yosle/tropipayjs 0.1.2 → 0.1.5
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 +53 -13
- package/docs/images/app-credentials-menu.png +0 -0
- package/docs/images/confirmation-code-screen.png +0 -0
- package/index.d.ts +73 -25
- package/index.js +170 -168
- package/index.ts +65 -49
- package/interfaces/countries/index.d.ts +0 -0
- package/interfaces/countries/index.js +1 -0
- package/interfaces/index.d.ts +0 -0
- package/interfaces/index.js +1 -0
- package/interfaces/paymentlink/index.js +1 -0
- package/package.json +19 -4
- package/rollup.config.js +23 -0
- package/tsconfig.json +13 -21
package/README.md
CHANGED
|
@@ -1,28 +1,68 @@
|
|
|
1
|
-
TropipayJS -
|
|
1
|
+
TropipayJS -Typescript/Javascript SDK for Tropipay Payments API
|
|
2
2
|
===========
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
3
7
|
|
|
4
|
-
TropiPay is an electronic wallet that allows you to execute the most common financial operations of the day to day. This is
|
|
8
|
+
TropiPay is an electronic wallet that allows you to execute the most common financial operations of the day to day. This is an 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 (like node + express) or ES6 module system (NextJS).
|
|
5
9
|
|
|
6
|
-
|
|
10
|
+
## Project status
|
|
11
|
+
This library is still under development so using it in the live (real account) isn't recommended yet.
|
|
12
|
+
|
|
13
|
+
# Table of Contents
|
|
14
|
+
* [Getting started](#getting-started)
|
|
15
|
+
* [Setting up your credentials](#setting-up-your-app-credentials)
|
|
16
|
+
* [Documentation](#documentation)
|
|
17
|
+
* [Examples](#examples)
|
|
18
|
+
* [Contribute and Help](#contributing-and-help)
|
|
19
|
+
|
|
20
|
+
# Getting started
|
|
7
21
|
You can use npm or yarn to install this package:
|
|
8
22
|
|
|
9
|
-
|
|
10
|
-
`yarn add tropipayjs`
|
|
23
|
+
```npm install @yosle/tropipayjs```
|
|
11
24
|
|
|
12
|
-
|
|
13
|
-
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.
|
|
25
|
+
or
|
|
14
26
|
|
|
15
|
-
|
|
16
|
-
|
|
27
|
+
```yarn add @yosle/tropipayjs```
|
|
28
|
+
|
|
29
|
+
## Setting up your app credentials
|
|
30
|
+

|
|
31
|
+

|
|
32
|
+
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 enviroment](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.
|
|
33
|
+
|
|
34
|
+
## How to use
|
|
35
|
+
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.
|
|
17
36
|
|
|
18
|
-
|
|
37
|
+
### CommonJS
|
|
38
|
+
```javascript
|
|
39
|
+
const { Tropipay } = require('@yosle/tropipayjs')
|
|
40
|
+
```
|
|
41
|
+
### ES6
|
|
42
|
+
```javascript
|
|
43
|
+
import { Tropipay } from '@yosle/tropipayjs'
|
|
44
|
+
```
|
|
45
|
+
### Initialize the Tropipay class
|
|
46
|
+
```javascript
|
|
47
|
+
const tpp = new Tropipay("yourclientidhere",
|
|
48
|
+
"yourclientsecrethere")
|
|
49
|
+
```
|
|
50
|
+
## Generating a Payment Link
|
|
51
|
+
```javascript
|
|
52
|
+
const paylink = await tpp.createPayLink(payload)
|
|
53
|
+
```
|
|
19
54
|
|
|
20
|
-
#
|
|
55
|
+
# Documentation
|
|
56
|
+
Examples using express + nodejs and NextJS will be added soon.
|
|
21
57
|
|
|
22
|
-
# Contributing
|
|
23
|
-
|
|
58
|
+
# Contributing
|
|
59
|
+
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
|
|
24
60
|
|
|
61
|
+
Please make sure to update tests as appropriate.
|
|
25
62
|
|
|
63
|
+
You can also make a small [donation to the author](https://tppay.me/l94qaa3h).
|
|
64
|
+
## License
|
|
65
|
+
[MIT License](https://choosealicense.com/licenses/mit/)
|
|
26
66
|
|
|
27
67
|
|
|
28
68
|
|
|
Binary file
|
|
Binary file
|
package/index.d.ts
CHANGED
|
@@ -1,54 +1,101 @@
|
|
|
1
|
+
import { Axios } from 'axios';
|
|
2
|
+
|
|
3
|
+
interface PaymentLinkPayload {
|
|
4
|
+
reference: string;
|
|
5
|
+
concept: string;
|
|
6
|
+
favorite: boolean;
|
|
7
|
+
amount: number;
|
|
8
|
+
currency: string;
|
|
9
|
+
description: string;
|
|
10
|
+
singleUse: boolean;
|
|
11
|
+
reasonId: number;
|
|
12
|
+
expirationDays: number;
|
|
13
|
+
lang: string;
|
|
14
|
+
urlSuccess: string;
|
|
15
|
+
urlFailed: string;
|
|
16
|
+
urlNotification: string;
|
|
17
|
+
serviceDate: string;
|
|
18
|
+
client: {
|
|
19
|
+
name: string;
|
|
20
|
+
lastName: string;
|
|
21
|
+
address: string;
|
|
22
|
+
phone: string;
|
|
23
|
+
email: string;
|
|
24
|
+
countryId: number;
|
|
25
|
+
termsAndConditions: boolean;
|
|
26
|
+
};
|
|
27
|
+
directPayment: boolean;
|
|
28
|
+
paymentMethods?: string[];
|
|
29
|
+
}
|
|
30
|
+
interface PaymentLink extends PaymentLinkPayload {
|
|
31
|
+
expirationDate: string;
|
|
32
|
+
hasClient: boolean;
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
createdAt: string;
|
|
35
|
+
qrImage: string;
|
|
36
|
+
shortUrl: string;
|
|
37
|
+
paymentUrl: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
1
40
|
/**
|
|
2
|
-
* Tropipayjs is a
|
|
3
|
-
*
|
|
4
|
-
* @author Yosleivy
|
|
41
|
+
* Tropipayjs is a Typescript/Javascript library for the Tropipay API. CommonJs and
|
|
42
|
+
* ES6 modules are supported.
|
|
43
|
+
* @author Yosleivy Baez Acosta
|
|
5
44
|
*
|
|
6
45
|
*/
|
|
7
|
-
|
|
8
|
-
import { PaymentLink, PaymentLinkPayload } from './interfaces/paymentlink';
|
|
46
|
+
|
|
9
47
|
declare type ServerMode = 'Development' | 'Production';
|
|
10
48
|
declare class Tropipay {
|
|
11
|
-
readonly
|
|
12
|
-
readonly
|
|
13
|
-
request: Axios;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
49
|
+
readonly clientId: string;
|
|
50
|
+
readonly clientSecret: string;
|
|
51
|
+
protected request: Axios;
|
|
52
|
+
protected accessToken: string | undefined;
|
|
53
|
+
protected refreshToken: string | undefined;
|
|
54
|
+
protected serverMode: ServerMode;
|
|
17
55
|
constructor(client_id: string, client_secret: string, server_mode?: ServerMode);
|
|
18
56
|
login(): Promise<LoginResponse>;
|
|
19
57
|
/**
|
|
20
|
-
* Create a paymentLink
|
|
21
|
-
* @param payload
|
|
22
|
-
* @returns Promise<PaymentLink> or
|
|
23
|
-
* @see
|
|
58
|
+
* Create a paymentLink with the specified options.
|
|
59
|
+
* @param payload PaymentLinkPayload Object.
|
|
60
|
+
* @returns Promise<PaymentLink> or throws an Exception.
|
|
61
|
+
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6ODgyNTM3OQ-create-a-new-pay-link-charge
|
|
24
62
|
*/
|
|
25
63
|
createPayLink(payload: PaymentLinkPayload): Promise<PaymentLink>;
|
|
26
64
|
/**
|
|
27
65
|
* Get all deposits in this account.
|
|
28
|
-
* @returns
|
|
66
|
+
* @returns A Promise of an Array of AccountDeposits or throws an Exception
|
|
29
67
|
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6OTgyOTQ1Mg-get-deposit-accounts-list
|
|
30
68
|
*/
|
|
31
69
|
getDepositAccounts(): Promise<AccountDeposits[] | Error>;
|
|
32
70
|
/**
|
|
33
|
-
* Get the list of all supported countries.
|
|
34
|
-
* @returns
|
|
35
|
-
* @see
|
|
71
|
+
* Get the list of all supported countries by Tropipay.
|
|
72
|
+
* @returns Array of Countries Data
|
|
73
|
+
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/bfac21259e2ff-getting-users-countries-list
|
|
36
74
|
*/
|
|
37
|
-
countries(): Promise<Country[]
|
|
75
|
+
countries(): Promise<Country[]>;
|
|
38
76
|
/**
|
|
77
|
+
* Get the list of all detination countries supported by Tropipay.
|
|
78
|
+
* Obtaining the list of valid countries to send funds to. Useful
|
|
79
|
+
* when adding new beneficiaries to some user.
|
|
39
80
|
*
|
|
81
|
+
* @returns Array of Country Objects
|
|
82
|
+
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/3cfe5504f0524-getting-list-of-beneficiary-countries
|
|
83
|
+
*/
|
|
84
|
+
destinations(): Promise<Country[]>;
|
|
85
|
+
/**
|
|
86
|
+
* Get list of all the favorites accounts. This endpoint is not documented
|
|
87
|
+
* in the official Tropipay documentation.
|
|
40
88
|
* @returns
|
|
41
|
-
* @see
|
|
42
89
|
*/
|
|
43
90
|
favorites(): Promise<any>;
|
|
44
91
|
/**
|
|
45
|
-
* List all movements
|
|
46
|
-
*
|
|
92
|
+
* List all account movements. You can optionaly specify
|
|
93
|
+
* offset and limit params for pagination.
|
|
47
94
|
* @returns
|
|
48
95
|
*/
|
|
49
96
|
movements(offset?: number, limit?: number): Promise<any>;
|
|
50
97
|
/**
|
|
51
|
-
* Return
|
|
98
|
+
* Return profile data for this account.
|
|
52
99
|
* @returns
|
|
53
100
|
*/
|
|
54
101
|
profile(): Promise<any>;
|
|
@@ -56,4 +103,5 @@ declare class Tropipay {
|
|
|
56
103
|
currencyFrom: string;
|
|
57
104
|
}): Promise<any>;
|
|
58
105
|
}
|
|
59
|
-
|
|
106
|
+
|
|
107
|
+
export { Tropipay };
|
package/index.js
CHANGED
|
@@ -1,211 +1,213 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var axios = require('axios');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
10
|
+
|
|
2
11
|
/**
|
|
3
|
-
* Tropipayjs is a
|
|
4
|
-
*
|
|
5
|
-
* @author Yosleivy
|
|
12
|
+
* Tropipayjs is a Typescript/Javascript library for the Tropipay API. CommonJs and
|
|
13
|
+
* ES6 modules are supported.
|
|
14
|
+
* @author Yosleivy Baez Acosta
|
|
6
15
|
*
|
|
7
16
|
*/
|
|
8
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
const axios_1 = __importDefault(require("axios"));
|
|
22
17
|
class Tropipay {
|
|
18
|
+
clientId;
|
|
19
|
+
clientSecret;
|
|
20
|
+
request;
|
|
21
|
+
accessToken;
|
|
22
|
+
refreshToken;
|
|
23
|
+
serverMode;
|
|
23
24
|
constructor(client_id, client_secret, server_mode = 'Development') {
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
27
|
-
this.request =
|
|
28
|
-
baseURL: this.
|
|
25
|
+
this.clientId = client_id;
|
|
26
|
+
this.clientSecret = client_secret;
|
|
27
|
+
this.serverMode = server_mode;
|
|
28
|
+
this.request = axios__default["default"].create({
|
|
29
|
+
baseURL: this.serverMode === 'Production'
|
|
29
30
|
? 'https://www.tropipay.com'
|
|
30
31
|
: 'https://tropipay-dev.herokuapp.com',
|
|
31
32
|
headers: {
|
|
32
33
|
'Content-Type': 'application/json',
|
|
33
34
|
Accept: 'application/json',
|
|
34
|
-
Authorization: `Bearer ${this.
|
|
35
|
+
Authorization: `Bearer ${this.accessToken}`,
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
|
-
login() {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
});
|
|
39
|
+
async login() {
|
|
40
|
+
try {
|
|
41
|
+
const { data } = await this.request.post('/api/v2/access/token', {
|
|
42
|
+
client_id: this.clientId,
|
|
43
|
+
client_secret: this.clientSecret,
|
|
44
|
+
grant_type: "client_credentials",
|
|
45
|
+
scope: "ALLOW_GET_PROFILE_DATA ALLOW_PAYMENT_IN ALLOW_EXTERNAL_CHARGE KYC3_FULL_ALLOW ALLOW_PAYMENT_OUT ALLOW_MARKET_PURCHASES ALLOW_GET_BALANCE ALLOW_GET_MOVEMENT_LIST ALLOW_GET_CREDENTIAL "
|
|
46
|
+
}, {
|
|
47
|
+
// headers: {
|
|
48
|
+
// 'Content-Type': 'application/json',
|
|
49
|
+
// Accept: 'application/json',
|
|
50
|
+
// }
|
|
51
|
+
});
|
|
52
|
+
this.accessToken = data.access_token;
|
|
53
|
+
this.refreshToken = data.refresh_token;
|
|
54
|
+
return data;
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
if (axios__default["default"].isAxiosError(error)) {
|
|
58
|
+
// 👇️ error: AxiosError<any, any>
|
|
59
|
+
throw new Error("Conection error: " + error.message);
|
|
60
|
+
}
|
|
61
|
+
throw new Error("Could not obtain the access token from credentials ");
|
|
62
|
+
}
|
|
64
63
|
}
|
|
65
64
|
/**
|
|
66
|
-
* Create a paymentLink
|
|
67
|
-
* @param payload
|
|
68
|
-
* @returns Promise<PaymentLink> or
|
|
65
|
+
* Create a paymentLink with the specified options.
|
|
66
|
+
* @param payload PaymentLinkPayload Object.
|
|
67
|
+
* @returns Promise<PaymentLink> or throws an Exception.
|
|
69
68
|
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6ODgyNTM3OQ-create-a-new-pay-link-charge
|
|
70
69
|
*/
|
|
71
|
-
createPayLink(payload) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
});
|
|
70
|
+
async createPayLink(payload) {
|
|
71
|
+
if (!this.accessToken) {
|
|
72
|
+
await this.login();
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
const paylink = await this.request.post('/api/v2/paymentcards', payload, {
|
|
76
|
+
headers: {
|
|
77
|
+
// 'Content-Type': 'application/json',
|
|
78
|
+
Authorization: `Bearer ${this.accessToken}`,
|
|
79
|
+
// Accept: 'application/json'
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
return paylink.data;
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
throw new Error(`Could not obtain the access tokemn with the given credentials.`);
|
|
86
|
+
}
|
|
90
87
|
}
|
|
91
88
|
/**
|
|
92
89
|
* Get all deposits in this account.
|
|
93
90
|
* @returns A Promise of an Array of AccountDeposits or throws an Exception
|
|
94
91
|
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6OTgyOTQ1Mg-get-deposit-accounts-list
|
|
95
92
|
*/
|
|
96
|
-
getDepositAccounts() {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
});
|
|
93
|
+
async getDepositAccounts() {
|
|
94
|
+
if (!this.accessToken) {
|
|
95
|
+
await this.login();
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
const deposits = await this.request.get('/api/v2/deposit_accounts', {});
|
|
99
|
+
return deposits.data;
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
throw new Error(`Could not retrieve the account deposits ${error}`);
|
|
103
|
+
}
|
|
109
104
|
}
|
|
110
105
|
/**
|
|
111
106
|
* Get the list of all supported countries by Tropipay.
|
|
112
|
-
* @returns Array of Countries
|
|
113
|
-
* @see
|
|
107
|
+
* @returns Array of Countries Data
|
|
108
|
+
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/bfac21259e2ff-getting-users-countries-list
|
|
114
109
|
*/
|
|
115
|
-
countries() {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
110
|
+
async countries() {
|
|
111
|
+
try {
|
|
112
|
+
const countries = await this.request.get('/api/v2/countries');
|
|
113
|
+
return countries.data;
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
throw new Error(`Could not retrieve the countries list`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Get the list of all detination countries supported by Tropipay.
|
|
121
|
+
* Obtaining the list of valid countries to send funds to. Useful
|
|
122
|
+
* when adding new beneficiaries to some user.
|
|
123
|
+
*
|
|
124
|
+
* @returns Array of Country Objects
|
|
125
|
+
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/3cfe5504f0524-getting-list-of-beneficiary-countries
|
|
126
|
+
*/
|
|
127
|
+
async destinations() {
|
|
128
|
+
try {
|
|
129
|
+
const countries = await this.request.get('/api/v2/countries/destinations');
|
|
130
|
+
return countries.data;
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
throw new Error(`Could not retrieve the destination countries list`);
|
|
134
|
+
}
|
|
128
135
|
}
|
|
129
136
|
/**
|
|
130
|
-
* Get list of all the favorites accounts.
|
|
137
|
+
* Get list of all the favorites accounts. This endpoint is not documented
|
|
138
|
+
* in the official Tropipay documentation.
|
|
131
139
|
* @returns
|
|
132
|
-
* @see
|
|
133
140
|
*/
|
|
134
|
-
favorites() {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
});
|
|
141
|
+
async favorites() {
|
|
142
|
+
if (!this.accessToken) {
|
|
143
|
+
await this.login();
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
const favoritesList = await this.request.get('/api/v2/paymentcards/favorites');
|
|
147
|
+
console.log(favoritesList);
|
|
148
|
+
return favoritesList.data;
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
throw new Error(`Could not retrieve favorites list ${error}`);
|
|
152
|
+
}
|
|
147
153
|
}
|
|
148
154
|
/**
|
|
149
|
-
* List all movements
|
|
150
|
-
*
|
|
155
|
+
* List all account movements. You can optionaly specify
|
|
156
|
+
* offset and limit params for pagination.
|
|
151
157
|
* @returns
|
|
152
158
|
*/
|
|
153
|
-
movements(offset = 0, limit = 10) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
});
|
|
159
|
+
async movements(offset = 0, limit = 10) {
|
|
160
|
+
if (!this.accessToken) {
|
|
161
|
+
await this.login();
|
|
162
|
+
}
|
|
163
|
+
try {
|
|
164
|
+
const movements = await this.request.get('/api/v2/movements', { params: { limit: limit, offset: offset },
|
|
165
|
+
headers: {
|
|
166
|
+
'Content-Type': 'application/json',
|
|
167
|
+
Accept: 'application/json',
|
|
168
|
+
Authorization: `Bearer ${this.accessToken}`,
|
|
169
|
+
} });
|
|
170
|
+
return movements.data;
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
throw new Error(`Could not retrieve movements list`);
|
|
174
|
+
}
|
|
171
175
|
}
|
|
172
176
|
/**
|
|
173
177
|
* Return profile data for this account.
|
|
174
178
|
* @returns
|
|
175
179
|
*/
|
|
176
|
-
profile() {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
});
|
|
180
|
+
async profile() {
|
|
181
|
+
if (!this.accessToken) {
|
|
182
|
+
await this.login();
|
|
183
|
+
}
|
|
184
|
+
try {
|
|
185
|
+
const profile = await this.request.get('/api/users/profile');
|
|
186
|
+
return profile.data;
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
throw new Error(`Could not retrieve movements list ${error}`);
|
|
190
|
+
}
|
|
189
191
|
}
|
|
190
|
-
getRates(payload = { currencyFrom: "EUR" }) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
});
|
|
192
|
+
async getRates(payload = { currencyFrom: "EUR" }) {
|
|
193
|
+
console.log(payload);
|
|
194
|
+
if (!this.accessToken) {
|
|
195
|
+
await this.login();
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
const rates = await this.request.post('/api/v2/movements/get_rate', { payload,
|
|
199
|
+
headers: {
|
|
200
|
+
'Content-Type': 'application/json',
|
|
201
|
+
Accept: 'application/json',
|
|
202
|
+
Authorization: `Bearer ${this.accessToken}`,
|
|
203
|
+
} });
|
|
204
|
+
return rates.data;
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
throw new Error(`Could not retrieve rates ${error}`);
|
|
208
|
+
}
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
|
|
211
|
+
|
|
212
|
+
exports.Tropipay = Tropipay;
|
|
213
|
+
//# sourceMappingURL=index.js.map
|
package/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tropipayjs is a
|
|
3
|
-
*
|
|
4
|
-
* @author Yosleivy
|
|
2
|
+
* Tropipayjs is a Typescript/Javascript library for the Tropipay API. CommonJs and
|
|
3
|
+
* ES6 modules are supported.
|
|
4
|
+
* @author Yosleivy Baez Acosta
|
|
5
5
|
*
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -12,30 +12,30 @@ import { PaymentLink, PaymentLinkPayload } from './interfaces/paymentlink'
|
|
|
12
12
|
type ServerMode = 'Development' | 'Production'
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
class Tropipay {
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
export class Tropipay {
|
|
16
|
+
readonly clientId: string;
|
|
17
|
+
readonly clientSecret: string;
|
|
18
|
+
protected request: Axios;
|
|
19
|
+
protected accessToken: string | undefined;
|
|
20
|
+
protected refreshToken: string | undefined;
|
|
21
|
+
protected serverMode: ServerMode;
|
|
22
22
|
|
|
23
23
|
constructor(
|
|
24
24
|
client_id: string,
|
|
25
25
|
client_secret: string,
|
|
26
26
|
server_mode: ServerMode = 'Development') {
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
27
|
+
this.clientId = client_id;
|
|
28
|
+
this.clientSecret = client_secret
|
|
29
|
+
this.serverMode = server_mode
|
|
30
30
|
|
|
31
31
|
this.request = axios.create({
|
|
32
|
-
baseURL: this.
|
|
32
|
+
baseURL: this.serverMode === 'Production'
|
|
33
33
|
? 'https://www.tropipay.com'
|
|
34
34
|
: 'https://tropipay-dev.herokuapp.com',
|
|
35
35
|
headers: {
|
|
36
36
|
'Content-Type': 'application/json',
|
|
37
37
|
Accept: 'application/json',
|
|
38
|
-
Authorization: `Bearer ${this.
|
|
38
|
+
Authorization: `Bearer ${this.accessToken}`,
|
|
39
39
|
|
|
40
40
|
}
|
|
41
41
|
})
|
|
@@ -45,8 +45,8 @@ class Tropipay {
|
|
|
45
45
|
async login() {
|
|
46
46
|
try {
|
|
47
47
|
const { data } = await this.request.post<LoginResponse>('/api/v2/access/token', {
|
|
48
|
-
client_id: this.
|
|
49
|
-
client_secret: this.
|
|
48
|
+
client_id: this.clientId,
|
|
49
|
+
client_secret: this.clientSecret,
|
|
50
50
|
grant_type: "client_credentials",
|
|
51
51
|
scope: "ALLOW_GET_PROFILE_DATA ALLOW_PAYMENT_IN ALLOW_EXTERNAL_CHARGE KYC3_FULL_ALLOW ALLOW_PAYMENT_OUT ALLOW_MARKET_PURCHASES ALLOW_GET_BALANCE ALLOW_GET_MOVEMENT_LIST ALLOW_GET_CREDENTIAL "
|
|
52
52
|
}, {
|
|
@@ -56,8 +56,8 @@ class Tropipay {
|
|
|
56
56
|
// }
|
|
57
57
|
})
|
|
58
58
|
|
|
59
|
-
this.
|
|
60
|
-
this.
|
|
59
|
+
this.accessToken = data.access_token
|
|
60
|
+
this.refreshToken = data.refresh_token
|
|
61
61
|
return data
|
|
62
62
|
} catch (error) {
|
|
63
63
|
if (axios.isAxiosError(error)) {
|
|
@@ -70,26 +70,26 @@ class Tropipay {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
* Create a paymentLink
|
|
74
|
-
* @param payload
|
|
75
|
-
* @returns Promise<PaymentLink> or
|
|
73
|
+
* Create a paymentLink with the specified options.
|
|
74
|
+
* @param payload PaymentLinkPayload Object.
|
|
75
|
+
* @returns Promise<PaymentLink> or throws an Exception.
|
|
76
76
|
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6ODgyNTM3OQ-create-a-new-pay-link-charge
|
|
77
77
|
*/
|
|
78
78
|
async createPayLink(payload: PaymentLinkPayload): Promise<PaymentLink> {
|
|
79
|
-
if (!this.
|
|
79
|
+
if (!this.accessToken) {
|
|
80
80
|
await this.login()
|
|
81
81
|
}
|
|
82
82
|
try {
|
|
83
83
|
const paylink = await this.request.post('/api/v2/paymentcards', payload, {
|
|
84
84
|
headers: {
|
|
85
85
|
// 'Content-Type': 'application/json',
|
|
86
|
-
Authorization: `Bearer ${this.
|
|
86
|
+
Authorization: `Bearer ${this.accessToken}`,
|
|
87
87
|
// Accept: 'application/json'
|
|
88
88
|
}
|
|
89
89
|
})
|
|
90
90
|
return paylink.data as PaymentLink
|
|
91
91
|
} catch (error) {
|
|
92
|
-
throw new Error(`
|
|
92
|
+
throw new Error(`Could not obtain the access tokemn with the given credentials.`);
|
|
93
93
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -100,7 +100,7 @@ class Tropipay {
|
|
|
100
100
|
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6OTgyOTQ1Mg-get-deposit-accounts-list
|
|
101
101
|
*/
|
|
102
102
|
async getDepositAccounts(): Promise<AccountDeposits[] | Error>{
|
|
103
|
-
if (!this.
|
|
103
|
+
if (!this.accessToken) {
|
|
104
104
|
await this.login()
|
|
105
105
|
}
|
|
106
106
|
try {
|
|
@@ -113,45 +113,62 @@ class Tropipay {
|
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
115
|
* Get the list of all supported countries by Tropipay.
|
|
116
|
-
* @returns Array of Countries
|
|
117
|
-
* @see
|
|
116
|
+
* @returns Array of Countries Data
|
|
117
|
+
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/bfac21259e2ff-getting-users-countries-list
|
|
118
118
|
*/
|
|
119
|
-
async countries(): Promise<Country[]
|
|
120
|
-
|
|
121
|
-
await this.login()
|
|
122
|
-
}
|
|
119
|
+
async countries(): Promise<Country[] > {
|
|
120
|
+
|
|
123
121
|
try {
|
|
124
|
-
const countries = await this.request.get('/api/countries')
|
|
125
|
-
return countries.data
|
|
122
|
+
const countries = await this.request.get('/api/v2/countries')
|
|
123
|
+
return countries.data
|
|
126
124
|
} catch (error) {
|
|
127
125
|
throw new Error(`Could not retrieve the countries list`);
|
|
128
126
|
}
|
|
129
127
|
}
|
|
130
128
|
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Get the list of all detination countries supported by Tropipay.
|
|
132
|
+
* Obtaining the list of valid countries to send funds to. Useful
|
|
133
|
+
* when adding new beneficiaries to some user.
|
|
134
|
+
*
|
|
135
|
+
* @returns Array of Country Objects
|
|
136
|
+
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/3cfe5504f0524-getting-list-of-beneficiary-countries
|
|
137
|
+
*/
|
|
138
|
+
async destinations(): Promise<Country[]> {
|
|
139
|
+
try {
|
|
140
|
+
const countries = await this.request.get('/api/v2/countries/destinations')
|
|
141
|
+
return countries.data
|
|
142
|
+
} catch (error) {
|
|
143
|
+
throw new Error(`Could not retrieve the destination countries list`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
131
147
|
/**
|
|
132
|
-
* Get list of all the favorites accounts.
|
|
148
|
+
* Get list of all the favorites accounts. This endpoint is not documented
|
|
149
|
+
* in the official Tropipay documentation.
|
|
133
150
|
* @returns
|
|
134
|
-
* @see
|
|
135
151
|
*/
|
|
136
152
|
async favorites(){
|
|
137
|
-
if (!this.
|
|
153
|
+
if (!this.accessToken) {
|
|
138
154
|
await this.login()
|
|
139
155
|
}
|
|
140
156
|
try {
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
157
|
+
const favoritesList = await this.request.get('/api/v2/paymentcards/favorites')
|
|
158
|
+
console.log(favoritesList)
|
|
159
|
+
return favoritesList.data
|
|
160
|
+
} catch (error) {
|
|
161
|
+
throw new Error(`Could not retrieve favorites list ${error}`);
|
|
145
162
|
}
|
|
146
163
|
}
|
|
147
164
|
|
|
148
165
|
/**
|
|
149
|
-
* List all movements
|
|
150
|
-
*
|
|
166
|
+
* List all account movements. You can optionaly specify
|
|
167
|
+
* offset and limit params for pagination.
|
|
151
168
|
* @returns
|
|
152
169
|
*/
|
|
153
170
|
async movements(offset = 0 , limit = 10){
|
|
154
|
-
if (!this.
|
|
171
|
+
if (!this.accessToken) {
|
|
155
172
|
await this.login()
|
|
156
173
|
}
|
|
157
174
|
try {
|
|
@@ -160,7 +177,7 @@ class Tropipay {
|
|
|
160
177
|
headers: {
|
|
161
178
|
'Content-Type': 'application/json',
|
|
162
179
|
Accept: 'application/json',
|
|
163
|
-
Authorization: `Bearer ${this.
|
|
180
|
+
Authorization: `Bearer ${this.accessToken}`,
|
|
164
181
|
|
|
165
182
|
} })
|
|
166
183
|
return movements.data
|
|
@@ -175,7 +192,7 @@ class Tropipay {
|
|
|
175
192
|
* @returns
|
|
176
193
|
*/
|
|
177
194
|
async profile(){
|
|
178
|
-
if (!this.
|
|
195
|
+
if (!this.accessToken) {
|
|
179
196
|
await this.login()
|
|
180
197
|
}
|
|
181
198
|
try {
|
|
@@ -188,7 +205,7 @@ class Tropipay {
|
|
|
188
205
|
|
|
189
206
|
async getRates(payload = {currencyFrom: "EUR"}) {
|
|
190
207
|
console.log(payload)
|
|
191
|
-
if (!this.
|
|
208
|
+
if (!this.accessToken) {
|
|
192
209
|
await this.login()
|
|
193
210
|
}
|
|
194
211
|
try {
|
|
@@ -196,7 +213,7 @@ class Tropipay {
|
|
|
196
213
|
headers: {
|
|
197
214
|
'Content-Type': 'application/json',
|
|
198
215
|
Accept: 'application/json',
|
|
199
|
-
Authorization: `Bearer ${this.
|
|
216
|
+
Authorization: `Bearer ${this.accessToken}`,
|
|
200
217
|
|
|
201
218
|
} })
|
|
202
219
|
return rates.data
|
|
@@ -209,6 +226,5 @@ class Tropipay {
|
|
|
209
226
|
}
|
|
210
227
|
|
|
211
228
|
|
|
212
|
-
export default Tropipay
|
|
213
229
|
|
|
214
230
|
|
|
File without changes
|
|
File without changes
|
package/interfaces/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yosle/tropipayjs",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "Javascript / Typescript SDK for the Tropipay API",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
-
"
|
|
8
|
+
"_clear": "rimraf build/compiled/*",
|
|
9
|
+
"_tsc": "tsc",
|
|
10
|
+
"_make-bundle": "rollup --config",
|
|
11
|
+
"build": "run-s _clear _tsc _make-bundle"
|
|
9
12
|
},
|
|
10
13
|
"repository": {
|
|
11
14
|
"type": "git",
|
|
@@ -22,6 +25,18 @@
|
|
|
22
25
|
"author": "Yosleivy Baez Acosta <yosle007@gmail.com>",
|
|
23
26
|
"license": "MIT",
|
|
24
27
|
"dependencies": {
|
|
25
|
-
"axios": "^0.27.2"
|
|
28
|
+
"axios": "^0.27.2",
|
|
29
|
+
"tslib": "^2.4.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@rollup/plugin-typescript": "^8.5.0",
|
|
33
|
+
"rimraf": "^3.0.2",
|
|
34
|
+
"rollup": "^2.79.1",
|
|
35
|
+
"rollup-plugin-dts": "^4.2.2",
|
|
36
|
+
"run-s": "^0.0.0"
|
|
37
|
+
},
|
|
38
|
+
"funding": {
|
|
39
|
+
"type": "individual",
|
|
40
|
+
"url": "https://tppay.me/l94qaa3h"
|
|
26
41
|
}
|
|
27
42
|
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
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'],
|
|
13
|
+
plugins: [typescript()]
|
|
14
|
+
}, {
|
|
15
|
+
input: 'dist/index.d.ts',
|
|
16
|
+
output: {
|
|
17
|
+
file: 'index.d.ts',
|
|
18
|
+
format: 'es'
|
|
19
|
+
},
|
|
20
|
+
plugins: [dts()]
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
export default config;
|
package/tsconfig.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
-
|
|
5
4
|
/* Projects */
|
|
6
5
|
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
6
|
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
@@ -9,9 +8,8 @@
|
|
|
9
8
|
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
9
|
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
10
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
-
|
|
13
11
|
/* Language and Environment */
|
|
14
|
-
"target": "
|
|
12
|
+
"target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
13
|
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
14
|
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
15
|
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
@@ -23,11 +21,10 @@
|
|
|
23
21
|
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
22
|
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
23
|
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
-
|
|
27
24
|
/* Modules */
|
|
28
|
-
"module": "
|
|
25
|
+
"module": "esnext", /* Specify what module code is generated. */
|
|
29
26
|
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
30
|
-
|
|
27
|
+
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
28
|
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
29
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
30
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
@@ -37,20 +34,18 @@
|
|
|
37
34
|
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
35
|
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
39
36
|
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
40
|
-
|
|
41
37
|
/* JavaScript Support */
|
|
42
38
|
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
43
39
|
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
44
40
|
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
45
|
-
|
|
46
41
|
/* Emit */
|
|
47
|
-
|
|
42
|
+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
48
43
|
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
49
44
|
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
50
|
-
|
|
45
|
+
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
51
46
|
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
"outDir": "dist/", /* Specify an output folder for all emitted files. */
|
|
48
|
+
"removeComments": false, /* Disable emitting comments. */
|
|
54
49
|
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
55
50
|
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
56
51
|
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
@@ -67,16 +62,14 @@
|
|
|
67
62
|
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
68
63
|
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
69
64
|
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
70
|
-
|
|
71
65
|
/* Interop Constraints */
|
|
72
66
|
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
73
67
|
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
74
|
-
"esModuleInterop": true,
|
|
68
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
75
69
|
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
76
|
-
"forceConsistentCasingInFileNames": true,
|
|
77
|
-
|
|
70
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
78
71
|
/* Type Checking */
|
|
79
|
-
"strict": true,
|
|
72
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
80
73
|
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
81
74
|
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
82
75
|
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
@@ -94,10 +87,9 @@
|
|
|
94
87
|
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
95
88
|
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
96
89
|
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
"allowUnreachableCode": false, /* Disable error reporting for unreachable code. */
|
|
99
91
|
/* Completeness */
|
|
100
92
|
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
101
|
-
"skipLibCheck": true
|
|
93
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
102
94
|
}
|
|
103
|
-
}
|
|
95
|
+
}
|