greip.js 2.2.1 → 2.3.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/README.md CHANGED
@@ -1,236 +1,283 @@
1
- <div align="center">
2
- <h1>Greip Javascript Library</h1>
3
- <p>The official JS library of Greip API</p>
4
- <br />
5
- <a href="https://github.com/Greipio/Greip-JS/issues/new">Report Issue</a> ·
6
- <a href="https://github.com/Greipio/Greip-JS/discussions/new">Request Feature</a> ·
7
- <a href="https://greip.io" target="_BLANK">Home Page</a> ·
8
- <a href="https://docs.greip.io/tools-and-libraries/js" target="_BLANK">API Docs</a>
9
- <br />
10
- <br />
11
- <a href="https://www.npmjs.com/package/greip.js" title="NPM Package" href="_BLANK"><img src="https://img.shields.io/badge/npm-CB3837?style=for-the-badge&logo=npm&logoColor=white"></a>
12
- <a href="https://github.com/Greipio/Greip-JS" title="Github Repo" href="_BLANK"><img src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white"></a>
13
- <a href="https://www.patreon.com/gredev" title="Patreon Profile - GRE Development Ltd." href="_BLANK"><img src="https://img.shields.io/badge/Patreon-ff424e?style=for-the-badge&logo=patreon&logoColor=white"></a>
14
- <img src="https://img.shields.io/badge/JavaScript-323330?style=for-the-badge&logo=javascript&logoColor=F7DF1E" title="Javascript">
15
- </div>
16
- <br />
1
+ # Greip Javascript Package
17
2
 
18
- ---
19
- <br />
3
+ The official Javascript package of Greip API
4
+
5
+ [Report Issue](https://github.com/Greipio/javascript/issues/new)
6
+ ·
7
+ [Request Feature](https://github.com/Greipio/javascript/discussions/new)
8
+ ·
9
+ [Greip Website](https://greip.io/)
10
+ ·
11
+ [Documentation](https://docs.greip.io/)
12
+
13
+ [![NPM Package of Greip](https://img.shields.io/badge/npm-CB3837?style=for-the-badge&logo=npm&logoColor=white)](https://www.npmjs.com/package/greip.js)
14
+ [![Github Repository](https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white)](https://github.com/Greipio/javascript)
20
15
 
21
16
  [![npm version](https://badge.fury.io/js/greip.js.svg)](https://badge.fury.io/js/greip.js)
22
17
  &nbsp;&nbsp;
23
- ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/gre-dev/Greip-JS?color=green&label=Minified%20size&logo=github)
18
+ ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/gre-dev/javascript?color=green&label=Minified%20size&logo=github)
24
19
  &nbsp;&nbsp;
25
20
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
26
21
  &nbsp;&nbsp;
27
22
  ![API Status](https://img.shields.io/website?down_color=orange&down_message=down&label=API%20status&up_color=green&up_message=up&url=https%3A%2F%2Fgregeoip.com)
28
- <br /><br />
29
23
 
30
- # Requirements
31
- No requirements for using this package.
32
- <br /><br />
24
+ ---
25
+
26
+ ## Installation
33
27
 
34
- # Installation
35
28
  For Node.js, React.js & React Native:
29
+
36
30
  ```
37
31
  npm i greip.js --save
38
32
  ```
33
+
39
34
  or
35
+
40
36
  ```
41
37
  yarn add greip.js
42
38
  ```
43
- <br /><br />
44
39
 
45
- # Usage
40
+ ## Usage
41
+
46
42
  Here's how you use the API Methods:
47
- <br /><br />
48
43
 
49
- ## 1. IP Geolocation Method
44
+ ### 1. IP Geolocation Method
45
+
50
46
  ```javascript
51
- import { GeoIP } from 'greip.js';
47
+ import { GeoIP } from 'greip.js';
52
48
 
53
49
  await GeoIP({
54
- key: 'your-api-key',
55
- }).then((res: any) => {
50
+ key: 'your-api-key',
51
+ })
52
+ .then((res: any) => {
56
53
  console.log(res.data); // Log Response
57
- });
54
+ })
55
+ .catch((error: any) => {
56
+ console.log(error);
57
+ });
58
58
  ```
59
- <br />
60
59
 
61
- ## 2. IP Lookup Method
60
+ ### 2. IP Lookup Method
61
+
62
62
  ```javascript
63
- import { Lookup } from 'greip.js';
63
+ import { Lookup } from 'greip.js';
64
64
 
65
65
  await Lookup({
66
- key: 'your-api-key',
67
- ip: '1.1.1.1',
68
- }).then((res: any) => {
66
+ key: 'your-api-key',
67
+ ip: '1.1.1.1',
68
+ })
69
+ .then((res: any) => {
69
70
  console.log(res.data); // Log Response
70
- });
71
+ })
72
+ .catch((error: any) => {
73
+ console.log(error);
74
+ });
71
75
  ```
72
- <br />
73
76
 
74
- ## 3. Bulk IP Lookup Method
77
+ ### 3. Bulk IP Lookup Method
78
+
75
79
  ```javascript
76
- import { BulkLookup } from 'greip.js';
80
+ import { BulkLookup } from 'greip.js';
77
81
 
78
82
  await BulkLookup({
79
- key: 'your-api-key',
80
- ips: ['1.1.1.1', '2.2.2.2'],
81
- }).then((res: any) => {
83
+ key: 'your-api-key',
84
+ ips: ['1.1.1.1', '2.2.2.2'],
85
+ })
86
+ .then((res: any) => {
82
87
  console.log(res.data); // Log Response
83
- });
88
+ })
89
+ .catch((error: any) => {
90
+ console.log(error);
91
+ });
84
92
  ```
85
- <br />
86
93
 
87
- ## 4. ASN Lookup Method
94
+ ### 4. ASN Lookup Method
95
+
88
96
  ```javascript
89
- import { ASN } from 'greip.js';
97
+ import { ASN } from 'greip.js';
90
98
 
91
99
  await ASN({
92
- key: 'your-api-key',
93
- asn: 'AS01',
94
- }).then((res: any) => {
100
+ key: 'your-api-key',
101
+ asn: 'AS01',
102
+ })
103
+ .then((res: any) => {
95
104
  console.log(res.data); // Log Response
96
- });
105
+ })
106
+ .catch((error: any) => {
107
+ console.log(error);
108
+ });
97
109
  ```
98
- <br />
99
110
 
100
- ## 5. Profanity Detection Method
111
+ ### 5. Profanity Detection Method
112
+
101
113
  ```javascript
102
- import { BadWord } from 'greip.js';
114
+ import { BadWord } from 'greip.js';
103
115
 
104
116
  await BadWord({
105
- key: 'your-api-key',
106
- text: 'This is just normal sample text.',
107
- }).then((res: any) => {
117
+ key: 'your-api-key',
118
+ text: 'This is just normal sample text.',
119
+ })
120
+ .then((res: any) => {
108
121
  console.log(res.data); // Log Response
109
- });
122
+ })
123
+ .catch((error: any) => {
124
+ console.log(error);
125
+ });
110
126
  ```
111
- <br />
112
127
 
113
- ## 6. Country Lookup Method
128
+ ### 6. Country Lookup Method
129
+
114
130
  ```javascript
115
- import { Country } from 'greip.js';
131
+ import { Country } from 'greip.js';
116
132
 
117
133
  await Country({
118
- key: 'your-api-key',
119
- countryCode: 'SA',
120
- }).then((res: any) => {
134
+ key: 'your-api-key',
135
+ countryCode: 'SA',
136
+ })
137
+ .then((res: any) => {
121
138
  console.log(res.data); // Log Response
122
- });
139
+ })
140
+ .catch((error: any) => {
141
+ console.log(error);
142
+ });
123
143
  ```
124
- <br />
125
144
 
126
- ## 7. Email Validation Method
145
+ ### 7. Email Validation Method
146
+
127
147
  ```javascript
128
- import { EmailValidation } from 'greip.js';
148
+ import { EmailValidation } from 'greip.js';
129
149
 
130
150
  await EmailValidation({
131
- key: 'your-api-key',
132
- email: 'name@domain.com',
133
- }).then((res: any) => {
151
+ key: 'your-api-key',
152
+ email: 'name@domain.com',
153
+ })
154
+ .then((res: any) => {
134
155
  console.log(res.data); // Log Response
135
- });
156
+ })
157
+ .catch((error: any) => {
158
+ console.log(error);
159
+ });
136
160
  ```
137
- <br />
138
161
 
139
- ## 8. Phone Validation Method
162
+ ### 8. Phone Validation Method
163
+
140
164
  ```javascript
141
- import { PhoneValidation } from 'greip.js';
165
+ import { PhoneValidation } from 'greip.js';
142
166
 
143
167
  await PhoneValidation({
144
- key: 'your-api-key',
145
- phone: '123123123',
146
- countryCode: 'US',
147
- }).then((res: any) => {
168
+ key: 'your-api-key',
169
+ phone: '123123123',
170
+ countryCode: 'US',
171
+ })
172
+ .then((res: any) => {
148
173
  console.log(res.data); // Log Response
149
- });
174
+ })
175
+ .catch((error: any) => {
176
+ console.log(error);
177
+ });
150
178
  ```
151
- <br />
152
179
 
153
- ## 9. Payment Fraud Prevention Method
180
+ ### 9. Payment Fraud Prevention Method
181
+
154
182
  ```javascript
155
- import { PaymentFraud } from 'greip.js';
183
+ import { PaymentFraud } from 'greip.js';
156
184
 
157
185
  await PaymentFraud({
158
- key: 'your-api-key',
159
- data: {
160
- action: 'purchase',
161
- website_domain: '',
162
- website_name: '',
163
- merchant_id: 21,
164
- shipment_id: 1,
165
- transaction_id: 100,
166
- transaction_amount: 1000000,
167
- transaction_currency: 'GBP',
168
- cart_items: {
169
- item_id: 1,
170
- item_name: 'Product name',
171
- item_quantity: 1,
172
- item_price: '1100.55',
173
- item_category_id: 1,
174
- },
175
- isDigitalProducts: true,
176
- coupon: 'ASDF',
177
- customer_id: 1,
178
- customer_firstname: 'First',
179
- customer_lastname: 'Last',
180
- customer_pob: 'London',
181
- customer_ip: '1.1.1.1',
182
- customer_country: 'GB',
183
- customer_region: 'London',
184
- customer_city: 'London',
185
- customer_zip: 'NW10 7PQ',
186
- customer_street: '7 Coronation Road',
187
- customer_street2: '',
188
- customer_latitude: 0.123,
189
- customer_longitude: 0.123,
190
- customer_device_id: 'UNIQUE_DEVICE_ID',
191
- customer_phone: '000000000',
192
- customer_registration_date: 1677554670,
193
- customer_balance: '1000.00',
194
- customer_dob: '1997-19-05',
195
- customer_email: 'name@domain.com',
196
- customer_2fa: true,
197
- customer_useragent: 'Mozill almaden sdfwer',
198
- shipping_country: 'GB',
199
- shipping_region: 'London',
200
- shipping_city: 'London',
201
- shipping_zip: 'NW10 7PQ',
202
- shipping_street: '7 Coronation Road',
203
- shipping_street2: '',
204
- shipping_latitude: 0.123,
205
- shipping_longitude: 0.123,
206
- billing_country: 'GB',
207
- billing_region: 'London',
208
- billing_city: 'London',
209
- billing_zip: 'NW10 7PQ',
210
- billing_street: '7 Coronation Road',
211
- billing_street2: '',
212
- billing_latitude: 0.123,
213
- billing_longitude: 0.123,
214
- payment_type: 'applepay',
215
- card_name: 'First Last',
216
- card_number: '1234XXXXXXXX1234',
217
- card_expiry: '29/05',
218
- cvv_result: true,
186
+ key: 'your-api-key',
187
+ data: {
188
+ action: 'purchase',
189
+ website_domain: '',
190
+ website_name: '',
191
+ merchant_id: 21,
192
+ shipment_id: 1,
193
+ transaction_id: 100,
194
+ transaction_amount: 1000000,
195
+ transaction_currency: 'GBP',
196
+ cart_items: {
197
+ item_id: 1,
198
+ item_name: 'Product name',
199
+ item_quantity: 1,
200
+ item_price: '1100.55',
201
+ item_category_id: 1,
219
202
  },
220
- }).then((res: any) => {
203
+ isDigitalProducts: true,
204
+ coupon: 'ASDF',
205
+ customer_id: 1,
206
+ customer_firstname: 'First',
207
+ customer_lastname: 'Last',
208
+ customer_pob: 'London',
209
+ customer_ip: '1.1.1.1',
210
+ customer_country: 'GB',
211
+ customer_region: 'London',
212
+ customer_city: 'London',
213
+ customer_zip: 'NW10 7PQ',
214
+ customer_street: '7 Coronation Road',
215
+ customer_street2: '',
216
+ customer_latitude: 0.123,
217
+ customer_longitude: 0.123,
218
+ customer_device_id: 'UNIQUE_DEVICE_ID',
219
+ customer_phone: '000000000',
220
+ customer_registration_date: 1677554670,
221
+ customer_balance: '1000.00',
222
+ customer_dob: '1997-19-05',
223
+ customer_email: 'name@domain.com',
224
+ customer_2fa: true,
225
+ customer_useragent: 'Mozill almaden sdfwer',
226
+ shipping_country: 'GB',
227
+ shipping_region: 'London',
228
+ shipping_city: 'London',
229
+ shipping_zip: 'NW10 7PQ',
230
+ shipping_street: '7 Coronation Road',
231
+ shipping_street2: '',
232
+ shipping_latitude: 0.123,
233
+ shipping_longitude: 0.123,
234
+ billing_country: 'GB',
235
+ billing_region: 'London',
236
+ billing_city: 'London',
237
+ billing_zip: 'NW10 7PQ',
238
+ billing_street: '7 Coronation Road',
239
+ billing_street2: '',
240
+ billing_latitude: 0.123,
241
+ billing_longitude: 0.123,
242
+ payment_type: 'applepay',
243
+ card_name: 'First Last',
244
+ card_number: '1234XXXXXXXX1234',
245
+ card_expiry: '29/05',
246
+ cvv_result: true,
247
+ },
248
+ })
249
+ .then((res: any) => {
221
250
  console.log(res.data); // Log Response
222
- });
251
+ })
252
+ .catch((error: any) => {
253
+ console.log(error);
254
+ });
255
+ ```
256
+
257
+ ### 10. IBAN Validation Method
258
+
259
+ ```javascript
260
+ await IBANValidation({
261
+ key: 'your-api-key',
262
+ iban: 'BY86AKBB10100000002966000000',
263
+ })
264
+ .then((res: any) => {
265
+ console.log(res); // Log Response
266
+ })
267
+ .catch((error: any) => {
268
+ console.log(error);
269
+ });
223
270
  ```
224
- <br /><br />
225
271
 
226
- # Options, Methods and More
272
+ ## Options, Methods and More
273
+
227
274
  You can find the full guide of this package by visiting our [Documentation Page](https://docs.greip.io/).
228
275
 
229
- <br /><br />
230
- # Credits
231
- * [Greip Developers](https://greip.io)
232
- * [All Contributors](https://github.com/Greipio/Greip-JS/graphs/contributors)
276
+ ## Credits
277
+
278
+ - [Greip Developers](https://greip.io)
279
+ - [All Contributors](https://github.com/Greipio/javascript/graphs/contributors)
280
+
281
+ ## License
233
282
 
234
- <br /><br />
235
- # License
236
- The MIT License (MIT). Please see [License](https://github.com/Greipio/Greip-JS/blob/main/LICENSE) File for more information.
283
+ The MIT License (MIT). Please see [License](https://github.com/Greipio/javascript/blob/main/LICENSE) File for more information.
package/lib/index.d.ts CHANGED
@@ -8,3 +8,4 @@ export declare const ASN: (options: Options) => Promise<unknown>;
8
8
  export declare const EmailValidation: (options: Options) => Promise<unknown>;
9
9
  export declare const PaymentFraud: (options: Options) => Promise<unknown>;
10
10
  export declare const PhoneValidation: (options: Options) => Promise<unknown>;
11
+ export declare const IBANValidation: (options: Options) => Promise<unknown>;
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PhoneValidation = exports.PaymentFraud = exports.EmailValidation = exports.ASN = exports.BadWord = exports.Country = exports.BulkLookup = exports.Lookup = exports.GeoIP = void 0;
3
+ exports.IBANValidation = exports.PhoneValidation = exports.PaymentFraud = exports.EmailValidation = exports.ASN = exports.BadWord = exports.Country = exports.BulkLookup = exports.Lookup = exports.GeoIP = void 0;
4
4
  var util_1 = require("./util");
5
5
  var GeoIP = function (options) {
6
6
  if (typeof options !== 'object')
@@ -20,7 +20,7 @@ var GeoIP = function (options) {
20
20
  if (!util_1.availableGeoIPParams.includes(perParam)) {
21
21
  reject(new Error('The "' +
22
22
  perParam +
23
- '" module you used is unknown.\nYou can use: `location`, `security`, `timezone`, `currency` and/or `device`.\nRead more at: https://geoip-docs.gredev.io/sdks/js/geoip-method#options'));
23
+ '" module you used is unknown.\nYou can use: `location`, `security`, `timezone`, `currency` and/or `device`.\nRead more at: https://docs.greip.io/api-reference/endpoint/ip-geolocation/geoip'));
24
24
  }
25
25
  }
26
26
  });
@@ -28,19 +28,19 @@ var GeoIP = function (options) {
28
28
  if (!util_1.availableFormats.includes(format1)) {
29
29
  reject(new Error('The `format` option value "' +
30
30
  format1 +
31
- '" you specified is unknown.\nYou can use: `JSON`, `XML`, `CSV` or `Newline`.\nRead more at: https://geoip-docs.gredev.io/sdks/js/geoip-method#options'));
31
+ '" you specified is unknown.\nYou can use: `JSON`, `XML`, `CSV` or `Newline`.\nRead more at: https://docs.greip.io/api-reference/endpoint/ip-geolocation/geoip'));
32
32
  }
33
33
  // Validate the lang variable
34
34
  if (!util_1.availableLanguages.includes(lang1)) {
35
35
  reject(new Error('The `lang` option value "' +
36
36
  lang1 +
37
- '" you specified is unknown.\nYou can use: `EN`, `AR`, `DE`, `FR`, `ES`, `JA`, `ZH` or `RU`.\nRead more at: https://geoip-docs.gredev.io/sdks/js/geoip-method#options'));
37
+ '" you specified is unknown.\nYou can use: `EN`, `AR`, `DE`, `FR`, `ES`, `JA`, `ZH` or `RU`.\nRead more at: https://docs.greip.io/api-reference/endpoint/ip-geolocation/geoip'));
38
38
  }
39
39
  // Validate the mode variable
40
40
  if (mode1 !== 'live' && mode1 !== 'test') {
41
41
  reject(new Error('The `mode` option value "' +
42
42
  mode1 +
43
- '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://geoip-docs.gredev.io/sdks/js/geoip-method#options'));
43
+ '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://docs.greip.io/api-reference/endpoint/ip-geolocation/geoip'));
44
44
  }
45
45
  (0, util_1.makeHttpRquest)('GeoIP', {
46
46
  key: options.key,
@@ -79,7 +79,7 @@ var Lookup = function (options) {
79
79
  if (!util_1.availableGeoIPParams.includes(perParam)) {
80
80
  reject(new Error('The "' +
81
81
  perParam +
82
- '" module you used is unknown.\nYou can use: `location`, `security`, `timezone`, `currency` and/or `device`.\nRead more at: https://geoip-docs.gredev.io/sdks/js/lookup-method#options'));
82
+ '" module you used is unknown.\nYou can use: `location`, `security`, `timezone`, `currency` and/or `device`.\nRead more at: https://docs.greip.io/api-reference/endpoint/ip-geolocation/ip-lookup'));
83
83
  }
84
84
  }
85
85
  });
@@ -87,19 +87,19 @@ var Lookup = function (options) {
87
87
  if (!util_1.availableFormats.includes(format1)) {
88
88
  reject(new Error('The `format` option value "' +
89
89
  format1 +
90
- '" you specified is unknown.\nYou can use: `JSON`, `XML`, `CSV` or `Newline`.\nRead more at: https://geoip-docs.gredev.io/sdks/js/lookup-method#options'));
90
+ '" you specified is unknown.\nYou can use: `JSON`, `XML`, `CSV` or `Newline`.\nRead more at: https://docs.greip.io/api-reference/endpoint/ip-geolocation/ip-lookup'));
91
91
  }
92
92
  // Validate the lang variable
93
93
  if (!util_1.availableLanguages.includes(lang1)) {
94
94
  reject(new Error('The `lang` option value "' +
95
95
  lang1 +
96
- '" you specified is unknown.\nYou can use: `EN`, `AR`, `DE`, `FR`, `ES`, `JA`, `ZH` or `RU`.\nRead more at: https://geoip-docs.gredev.io/sdks/js/lookup-method#options'));
96
+ '" you specified is unknown.\nYou can use: `EN`, `AR`, `DE`, `FR`, `ES`, `JA`, `ZH` or `RU`.\nRead more at: https://docs.greip.io/api-reference/endpoint/ip-geolocation/ip-lookup'));
97
97
  }
98
98
  // Validate the mode variable
99
99
  if (mode1 !== 'live' && mode1 !== 'test') {
100
100
  reject(new Error('The `mode` option value "' +
101
101
  mode1 +
102
- '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://geoip-docs.gredev.io/sdks/js/lookup-method#options'));
102
+ '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://docs.greip.io/api-reference/endpoint/ip-geolocation/ip-lookup'));
103
103
  }
104
104
  (0, util_1.makeHttpRquest)('IPLookup', {
105
105
  ip: ip1,
@@ -146,7 +146,7 @@ var BulkLookup = function (options) {
146
146
  if (!util_1.availableGeoIPParams.includes(perParam)) {
147
147
  reject(new Error('The "' +
148
148
  perParam +
149
- '" module you used is unknown.\nYou can use: `location`, `security`, `timezone`, `currency` and/or `device`.\nRead more at: https://geoip-docs.gredev.io/sdks/js/lookup-method#options'));
149
+ '" module you used is unknown.\nYou can use: `location`, `security`, `timezone`, `currency` and/or `device`.\nRead more at: https://docs.greip.io/api-reference/endpoint/ip-geolocation/ip-lookup'));
150
150
  }
151
151
  }
152
152
  });
@@ -154,19 +154,19 @@ var BulkLookup = function (options) {
154
154
  if (!util_1.availableFormats.includes(format1)) {
155
155
  reject(new Error('The `format` option value "' +
156
156
  format1 +
157
- '" you specified is unknown.\nYou can use: `JSON`, `XML`, `CSV` or `Newline`.\nRead more at: https://geoip-docs.gredev.io/sdks/js/lookup-method#options'));
157
+ '" you specified is unknown.\nYou can use: `JSON`, `XML`, `CSV` or `Newline`.\nRead more at: https://docs.greip.io/api-reference/endpoint/ip-geolocation/ip-lookup'));
158
158
  }
159
159
  // Validate the lang variable
160
160
  if (!util_1.availableLanguages.includes(lang1)) {
161
161
  reject(new Error('The `lang` option value "' +
162
162
  lang1 +
163
- '" you specified is unknown.\nYou can use: `EN`, `AR`, `DE`, `FR`, `ES`, `JA`, `ZH` or `RU`.\nRead more at: https://geoip-docs.gredev.io/sdks/js/lookup-method#options'));
163
+ '" you specified is unknown.\nYou can use: `EN`, `AR`, `DE`, `FR`, `ES`, `JA`, `ZH` or `RU`.\nRead more at: https://docs.greip.io/api-reference/endpoint/ip-geolocation/ip-lookup'));
164
164
  }
165
165
  // Validate the mode variable
166
166
  if (mode1 !== 'live' && mode1 !== 'test') {
167
167
  reject(new Error('The `mode` option value "' +
168
168
  mode1 +
169
- '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://geoip-docs.gredev.io/sdks/js/lookup-method#options'));
169
+ '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://docs.greip.io/api-reference/endpoint/ip-geolocation/ip-lookup'));
170
170
  }
171
171
  (0, util_1.makeHttpRquest)('BulkLookup', {
172
172
  ips: ips1,
@@ -207,7 +207,7 @@ var Country = function (options) {
207
207
  if (!util_1.availableCountryParams.includes(perParam)) {
208
208
  reject(new Error('The "' +
209
209
  perParam +
210
- '" module you used is unknown.\nYou can use: `language`, `flag`, `currency` and/or `timezone`.\nRead more at: https://docs.greip.io/options/development-environment'));
210
+ '" module you used is unknown.\nYou can use: `language`, `flag`, `currency` and/or `timezone`.\nRead more at: https://docs.greip.io/api-reference/endpoint/other-services/country-data'));
211
211
  }
212
212
  }
213
213
  });
@@ -215,19 +215,19 @@ var Country = function (options) {
215
215
  if (!util_1.availableFormats.includes(format1)) {
216
216
  reject(new Error('The `format` option value "' +
217
217
  format1 +
218
- '" you specified is unknown.\nYou can use: `JSON`, `XML`, `CSV` or `Newline`.\nRead more at: https://docs.greip.io/options/development-environment'));
218
+ '" you specified is unknown.\nYou can use: `JSON`, `XML`, `CSV` or `Newline`.\nRead more at: https://docs.greip.io/api-reference/endpoint/other-services/country-data'));
219
219
  }
220
220
  // Validate the lang variable
221
221
  if (!util_1.availableLanguages.includes(lang1)) {
222
222
  reject(new Error('The `lang` option value "' +
223
223
  lang1 +
224
- '" you specified is unknown.\nYou can use: `EN`, `AR`, `DE`, `FR`, `ES`, `JA`, `ZH` or `RU`.\nRead more at: https://docs.greip.io/options/development-environment'));
224
+ '" you specified is unknown.\nYou can use: `EN`, `AR`, `DE`, `FR`, `ES`, `JA`, `ZH` or `RU`.\nRead more at: https://docs.greip.io/api-reference/endpoint/other-services/country-data'));
225
225
  }
226
226
  // Validate the mode variable
227
227
  if (mode1 !== 'live' && mode1 !== 'test') {
228
228
  reject(new Error('The `mode` option value "' +
229
229
  mode1 +
230
- '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://docs.greip.io/options/development-environment'));
230
+ '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://docs.greip.io/api-reference/endpoint/other-services/country-data'));
231
231
  }
232
232
  (0, util_1.makeHttpRquest)('Country', {
233
233
  CountryCode: countryCode,
@@ -265,19 +265,19 @@ var BadWord = function (options) {
265
265
  if (!util_1.availableFormats.includes(format1)) {
266
266
  reject(new Error('The `format` option value "' +
267
267
  format1 +
268
- '" you specified is unknown.\nYou can use: `JSON`, `XML` or `CSV`.\nRead more at: https://docs.greip.io/options/development-environment'));
268
+ '" you specified is unknown.\nYou can use: `JSON`, `XML` or `CSV`.\nRead more at: https://docs.greip.io/api-reference/endpoint/other-services/profanity-detection'));
269
269
  }
270
270
  // Validate the lang variable
271
271
  if (!util_1.availableLanguages.includes(lang1)) {
272
272
  reject(new Error('The `lang` option value "' +
273
273
  lang1 +
274
- '" you specified is unknown.\nYou can use: `EN`, `AR`, `DE`, `FR`, `ES`, `JA`, `ZH` or `RU`.\nRead more at: https://docs.greip.io/options/development-environment'));
274
+ '" you specified is unknown.\nYou can use: `EN`, `AR`, `DE`, `FR`, `ES`, `JA`, `ZH` or `RU`.\nRead more at: https://docs.greip.io/api-reference/endpoint/other-services/profanity-detection'));
275
275
  }
276
276
  // Validate the mode variable
277
277
  if (mode1 !== 'live' && mode1 !== 'test') {
278
278
  reject(new Error('The `mode` option value "' +
279
279
  mode1 +
280
- '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://docs.greip.io/options/development-environment'));
280
+ '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://docs.greip.io/api-reference/endpoint/other-services/profanity-detection'));
281
281
  }
282
282
  (0, util_1.makeHttpRquest)('badWords', {
283
283
  text: text1,
@@ -311,7 +311,7 @@ var ASN = function (options) {
311
311
  if (mode1 !== 'live' && mode1 !== 'test') {
312
312
  reject(new Error('The `mode` option value "' +
313
313
  mode1 +
314
- '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://docs.greip.io/options/development-environment'));
314
+ '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://docs.greip.io/api-reference/endpoint/ip-geolocation/asn-lookup'));
315
315
  }
316
316
  (0, util_1.makeHttpRquest)('ASNLookup', {
317
317
  asn: asn1,
@@ -342,7 +342,7 @@ var EmailValidation = function (options) {
342
342
  if (mode1 !== 'live' && mode1 !== 'test') {
343
343
  reject(new Error('The `mode` option value "' +
344
344
  mode1 +
345
- '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://docs.greip.io/options/development-environment'));
345
+ '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://docs.greip.io/api-reference/endpoint/data-validation/email-lookup'));
346
346
  }
347
347
  (0, util_1.makeHttpRquest)('validateEmail', {
348
348
  email: email1,
@@ -366,14 +366,14 @@ var PaymentFraud = function (options) {
366
366
  var data1 = options.data || [];
367
367
  var mode1 = options.mode || 'live';
368
368
  // Validate the text variable
369
- if (data1.length < 1) {
369
+ if (typeof data1 !== 'object' || Array.isArray(data1)) {
370
370
  reject(new Error('You should pass the `data` parameter.'));
371
371
  }
372
372
  // Validate the mode variable
373
373
  if (mode1 !== 'live' && mode1 !== 'test') {
374
374
  reject(new Error('The `mode` option value "' +
375
375
  mode1 +
376
- '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://docs.greip.io/options/development-environment'));
376
+ '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://docs.greip.io/api-reference/endpoint/payment-fraud/payment-fraud-prevention'));
377
377
  }
378
378
  (0, util_1.makePostRquest)('paymentFraud', {
379
379
  data: data1,
@@ -405,7 +405,7 @@ var PhoneValidation = function (options) {
405
405
  if (mode1 !== 'live' && mode1 !== 'test') {
406
406
  reject(new Error('The `mode` option value "' +
407
407
  mode1 +
408
- '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://docs.greip.io/options/development-environment'));
408
+ '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://docs.greip.io/api-reference/endpoint/data-validation/phone-lookup'));
409
409
  }
410
410
  (0, util_1.makeHttpRquest)('validatePhone', {
411
411
  phone: phone1,
@@ -420,3 +420,34 @@ var PhoneValidation = function (options) {
420
420
  });
421
421
  };
422
422
  exports.PhoneValidation = PhoneValidation;
423
+ var IBANValidation = function (options) {
424
+ if (typeof options !== 'object')
425
+ options = {};
426
+ if (!options.key || options.key.length < 1) {
427
+ throw new Error('You should pass the API Key.');
428
+ }
429
+ return new Promise(function (resolve, reject) {
430
+ var iban1 = options.iban || '';
431
+ var mode1 = options.mode || 'live';
432
+ // Validate the text variable
433
+ if (iban1.length < 1) {
434
+ reject(new Error('You should pass the `iban` parameter.'));
435
+ }
436
+ // Validate the mode variable
437
+ if (mode1 !== 'live' && mode1 !== 'test') {
438
+ reject(new Error('The `mode` option value "' +
439
+ mode1 +
440
+ '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://docs.greip.io/api-reference/endpoint/payment-fraud/iban-validation'));
441
+ }
442
+ (0, util_1.makeHttpRquest)('validateIBAN', {
443
+ iban: iban1,
444
+ key: options.key,
445
+ mode: mode1,
446
+ }, function (res) {
447
+ if (typeof res !== 'object')
448
+ res = JSON.parse(res);
449
+ resolve(res);
450
+ });
451
+ });
452
+ };
453
+ exports.IBANValidation = IBANValidation;
package/lib/types.d.ts CHANGED
@@ -12,6 +12,7 @@ export interface Options {
12
12
  asn?: string;
13
13
  email?: string;
14
14
  phone?: string;
15
+ iban?: string;
15
16
  data?: {
16
17
  [key: string]: string | number | string[] | object | boolean;
17
18
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "greip.js",
3
- "version": "2.2.1",
4
- "description": "The official JS library of Greip.",
3
+ "version": "2.3.2",
4
+ "description": "The official Javascript library of Greip.",
5
5
  "author": {
6
6
  "name": "Greip",
7
7
  "email": "info@greip.io",
@@ -15,17 +15,18 @@
15
15
  "api",
16
16
  "geolocation",
17
17
  "geoip",
18
- "fraud",
18
+ "fraud prevention",
19
19
  "abuse",
20
20
  "ai",
21
- "asn"
21
+ "asn",
22
+ "iban"
22
23
  ],
23
24
  "files": [
24
25
  "lib/**/*"
25
26
  ],
26
- "homepage": "https://github.com/Greipio/Greip-PHP#readme",
27
+ "homepage": "https://github.com/Greipio/javascript#readme",
27
28
  "bugs": {
28
- "url": "https://github.com/Greipio/Greip-PHP/issues",
29
+ "url": "https://github.com/Greipio/javascript/issues",
29
30
  "email": "info@greip.io"
30
31
  },
31
32
  "funding": {
@@ -45,7 +46,7 @@
45
46
  },
46
47
  "repository": {
47
48
  "type": "git",
48
- "url": "https://github.com/Greipio/Greip-PHP.git"
49
+ "url": "https://github.com/Greipio/javascript.git"
49
50
  },
50
51
  "dependencies": {
51
52
  "axios": "^0.25.0"