Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update iin #408

Merged
merged 9 commits into from
May 7, 2024
Merged
106 changes: 106 additions & 0 deletions documents/iins.md
Original file line number Diff line number Diff line change
@@ -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**
<br>
<br>
**For reference click [here](https://razorpay.com/docs/api/payments/cards/iin-api/#iin-entity)**
7 changes: 7 additions & 0 deletions lib/resources/iins.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
}
}
14 changes: 14 additions & 0 deletions lib/types/iins.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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): {
Expand All @@ -104,6 +111,13 @@ declare function iins(api: any): {
*/
fetch(tokenIin: string): Promise<Iins.RazorpayIin>
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<Iins.RazorpayIinList>
all(params: Iins.ListType, callback: (err: INormalizeError | null, data: Iins.RazorpayIinList) => void): void;
}

export default iins
Loading