From 40bed7f6e256fdcba5376ff0bebefafd4b48f051 Mon Sep 17 00:00:00 2001 From: Ankit Das <89454448+ankitdas13@users.noreply.github.com> Date: Tue, 7 May 2024 18:48:56 +0530 Subject: [PATCH] Update iin (#408) --- documents/iins.md | 106 ++++++++++++++++++++++++++++++++++++++++++ lib/resources/iins.js | 7 +++ lib/types/iins.d.ts | 14 ++++++ 3 files changed, 127 insertions(+) create mode 100644 documents/iins.md diff --git a/documents/iins.md b/documents/iins.md new file mode 100644 index 0000000..5f6e9f9 --- /dev/null +++ b/documents/iins.md @@ -0,0 +1,106 @@ +### Iin + +### Token IIN API + +```js +var tokenIin = "412345"; +instance.iins.fetch(tokenIin) +``` + +**Parameters:** + +| Name | Type | Description | +|------------|--------|-----------------------------------| +| tokenIin* | string | The token IIN. | + +**Response:** +```json +{ + "iin": "412345", + "entity": "iin", + "network": "Visa", + "type": "credit", + "sub_type": "business", + "issuer_code": "HDFC", + "issuer_name": "HDFC Bank Ltd", + "international": false, + "is_tokenized": true, + "card_iin": "411111", + "emi":{ + "available": true + }, + "recurring": { + "available": true + }, + "authentication_types": [ + { + "type":"3ds" + }, + { + "type":"otp" + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch All IINs Supporting Native OTP + +```js +var param = {"flow": "otp"} +instance.iins.all(param) +``` + +**Response:** +```json +{ + "count": 24, + "iins": [ + "512967", + "180005", + "401704", + "401806", + "123456", + "411111", + "123512967", + "180012305", + "401123704" + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch All IINs with Business Sub-type + +```js +var param = {"sub_type": "business"} +instance.iins.all(param) +``` + +**Response:** +```json +{ + "count": 24, + "iins": [ + "512967", + "180005", + "401704", + "401806", + "607389", + "652203", + "414367", + "787878", + "123456", + "411111", + "123512967", + "180012305", + "401123704" + ] +} +``` +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/payments/cards/iin-api/#iin-entity)** \ No newline at end of file diff --git a/lib/resources/iins.js b/lib/resources/iins.js index a6dc7a9..add028c 100644 --- a/lib/resources/iins.js +++ b/lib/resources/iins.js @@ -10,5 +10,12 @@ module.exports = function (api) { url: `${BASE_URL}/${tokenIin}`, }, callback); }, + + all(params = {}, callback) { + return api.get({ + url: `${BASE_URL}/list`, + data: params + }, callback) + }, } } \ No newline at end of file diff --git a/lib/types/iins.d.ts b/lib/types/iins.d.ts index f19cae9..0c8f970 100644 --- a/lib/types/iins.d.ts +++ b/lib/types/iins.d.ts @@ -93,6 +93,13 @@ export declare namespace Iins { | 'consumer' | 'business' | 'unknown' + + type ListType = {flow: string;} | {sub_type: string;} + + interface RazorpayIinList { + count: number; + iins : string[]; + } } declare function iins(api: any): { @@ -104,6 +111,13 @@ declare function iins(api: any): { */ fetch(tokenIin: string): Promise fetch(tokenIin: string, callback: (err: INormalizeError | null, data: Iins.RazorpayIin) => void): void; + /** + * Fetch all IINs supporting `native otp` or `business sub-type` + * + * @param params - Check [doc](https://razorpay.com/docs/api/payments/cards/iin-api/#fetch-all-iins-supporting-native-otp) for required params + */ + all(params: Iins.ListType): Promise + all(params: Iins.ListType, callback: (err: INormalizeError | null, data: Iins.RazorpayIinList) => void): void; } export default iins \ No newline at end of file