{
  "info": {
    "_postman_id": "iimmpact-api-collection",
    "name": "IIMMPACT API v2",
    "description": "Complete IIMMPACT API Collection with all endpoints",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "1. Authentication",
      "item": [
        {
          "name": "User Authentication",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "if (pm.response.code === 200) {",
                  "    var jsonData = pm.response.json();",
                  "    ",
                  "    if (jsonData.AuthenticationResult) {",
                  "        if (jsonData.AuthenticationResult.AccessToken) {",
                  "            pm.environment.set('accessToken', jsonData.AuthenticationResult.AccessToken);",
                  "            console.log('✅ Access token saved successfully');",
                  "        }",
                  "        if (jsonData.AuthenticationResult.RefreshToken) {",
                  "            pm.environment.set('refreshToken', jsonData.AuthenticationResult.RefreshToken);",
                  "            console.log('✅ Refresh token saved successfully');",
                  "        }",
                  "        if (jsonData.AuthenticationResult.IdToken) {",
                  "            pm.environment.set('idToken', jsonData.AuthenticationResult.IdToken);",
                  "            console.log('✅ ID token saved successfully (Use this for API calls)');",
                  "        }",
                  "    }",
                  "    ",
                  "    pm.test('Status code is 200', function () {",
                  "        pm.response.to.have.status(200);",
                  "    });",
                  "    ",
                  "    pm.test('ID token is present', function () {",
                  "        pm.expect(jsonData.AuthenticationResult.IdToken).to.exist;",
                  "    });",
                  "} else {",
                  "    console.log('❌ Authentication failed with status:', pm.response.code);",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"username\": \"{{username}}\",\n  \"password\": \"{{password}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/token",
              "host": ["{{baseUrl}}"],
              "path": ["token"]
            },
            "description": "Authenticate user and get tokens. Uses IdToken for subsequent API calls."
          },
          "response": []
        },
        {
          "name": "Refresh Token",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "if (pm.response.code === 200) {",
                  "    var jsonData = pm.response.json();",
                  "    ",
                  "    if (jsonData.AuthenticationResult) {",
                  "        if (jsonData.AuthenticationResult.AccessToken) {",
                  "            pm.environment.set('accessToken', jsonData.AuthenticationResult.AccessToken);",
                  "            console.log('✅ Access token refreshed successfully');",
                  "        }",
                  "        if (jsonData.AuthenticationResult.IdToken) {",
                  "            pm.environment.set('idToken', jsonData.AuthenticationResult.IdToken);",
                  "            console.log('✅ ID token refreshed successfully (Use this for API calls)');",
                  "        }",
                  "    }",
                  "    ",
                  "    pm.test('Status code is 200', function () {",
                  "        pm.response.to.have.status(200);",
                  "    });",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"refresh_token\": \"{{refreshToken}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/token/refresh",
              "host": ["{{baseUrl}}"],
              "path": ["token", "refresh"]
            },
            "description": "Refresh access token and ID token using refresh token"
          },
          "response": []
        }
      ]
    },
    {
      "name": "2. Balance",
      "item": [
        {
          "name": "Get Balance",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{idToken}}",
                "description": "Uses ID Token for authorization"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/balance",
              "host": ["{{baseUrl}}"],
              "path": ["balance"]
            },
            "description": "Get current account balance"
          },
          "response": []
        }
      ]
    },
    {
      "name": "3. Products",
      "item": [
        {
          "name": "Get Product List",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{idToken}}",
                "description": "Uses ID Token for authorization"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/product-list",
              "host": ["{{baseUrl}}"],
              "path": ["product-list"]
            },
            "description": "Get list of available products"
          },
          "response": []
        }
      ]
    },
    {
      "name": "4. Sub Products",
      "item": [
        {
          "name": "JomPay Full Biller List",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{idToken}}",
                "description": "Uses ID Token for authorization"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/subproducts?product_code=JOMPAY&limit=100",
              "host": ["{{baseUrl}}"],
              "path": ["subproducts"],
              "query": [
                {
                  "key": "product_code",
                  "value": "JOMPAY",
                  "description": "Product code for JomPay"
                },
                {
                  "key": "limit",
                  "value": "100",
                  "description": "Number of records to return"
                }
              ]
            },
            "description": "Get JomPay biller list with pagination"
          },
          "response": []
        },
        {
          "name": "Mobile Data Plan",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{idToken}}",
                "description": "Uses ID Token for authorization"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/subproducts?product_code=HI&account_number=0123456789",
              "host": ["{{baseUrl}}"],
              "path": ["subproducts"],
              "query": [
                {
                  "key": "product_code",
                  "value": "HI",
                  "description": "Product code for mobile (HI, D, M, U, etc.)"
                },
                {
                  "key": "account_number",
                  "value": "0123456789",
                  "description": "Mobile phone number"
                }
              ]
            },
            "description": "Get mobile data plans for specific phone number"
          },
          "response": []
        },
        {
          "name": "PTPTN / SSPN",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{idToken}}",
                "description": "Uses ID Token for authorization"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/subproducts?product_code=PTPTN&account_number=89120000000",
              "host": ["{{baseUrl}}"],
              "path": ["subproducts"],
              "query": [
                {
                  "key": "product_code",
                  "value": "PTPTN",
                  "description": "PTPTN or SSPN"
                },
                {
                  "key": "account_number",
                  "value": "89120000000",
                  "description": "Account number"
                }
              ]
            },
            "description": "Get PTPTN/SSPN payment options"
          },
          "response": []
        }
      ]
    },
    {
      "name": "5. Network Status",
      "item": [
        {
          "name": "Get Network Status",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{idToken}}",
                "description": "Uses ID Token for authorization"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/networkstatus?product=C",
              "host": ["{{baseUrl}}"],
              "path": ["networkstatus"],
              "query": [
                {
                  "key": "product",
                  "value": "C",
                  "description": "Product code to check status"
                }
              ]
            },
            "description": "Check network status for specific product"
          },
          "response": []
        }
      ]
    },
    {
      "name": "6. Bill Presentment",
      "item": [
        {
          "name": "Bill Presentment (Beta)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{idToken}}",
                "description": "Uses ID Token for authorization"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/bill-presentment?account=21000200000&product=TNB&biller_code=5454&ref2=123456&amount=100",
              "host": ["{{baseUrl}}"],
              "path": ["bill-presentment"],
              "query": [
                {
                  "key": "account",
                  "value": "21000200000",
                  "description": "Account number"
                },
                {
                  "key": "product",
                  "value": "TNB",
                  "description": "Product code (TNB, etc.)"
                },
                {
                  "key": "biller_code",
                  "value": "5454",
                  "description": "Biller code"
                },
                {
                  "key": "ref2",
                  "value": "123456",
                  "description": "Reference 2"
                },
                {
                  "key": "amount",
                  "value": "100",
                  "description": "Amount"
                }
              ]
            },
            "description": "Get bill details before payment (Beta)"
          },
          "response": []
        }
      ]
    },
    {
      "name": "7. Payment",
      "item": [
        {
          "name": "Make Payment (Topup)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{idToken}}",
                "description": "Uses ID Token for authorization"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"refid\": \"12345678\",\n  \"product\": \"GC\",\n  \"remarks\": \"\",\n  \"account\": \"12345678\",\n  \"amount\": \"10\",\n  \"extras\": {\n    \"subproduct_code\": \"\",\n    \"ic_number\": \"91234567890\",\n    \"biller_code\": \"5454\",\n    \"ref2\": \"\"\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/topup",
              "host": ["{{baseUrl}}"],
              "path": ["topup"]
            },
            "description": "Process payment/topup transaction"
          },
          "response": []
        }
      ]
    },
    {
      "name": "8. Reconciliation",
      "item": [
        {
          "name": "Transaction History",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{idToken}}",
                "description": "Uses ID Token for authorization"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/transactions?limit=50&date=2025-05-01 - 2025-05-31&status=SUCCESSFUL&offset=0",
              "host": ["{{baseUrl}}"],
              "path": ["transactions"],
              "query": [
                {
                  "key": "limit",
                  "value": "50",
                  "description": "Number of records"
                },
                {
                  "key": "date",
                  "value": "2025-05-01 - 2025-05-31",
                  "description": "Date range (YYYY-MM-DD - YYYY-MM-DD)"
                },
                {
                  "key": "status",
                  "value": "SUCCESSFUL",
                  "description": "SUCCESSFUL, FAILED, PENDING"
                },
                {
                  "key": "offset",
                  "value": "0",
                  "description": "Pagination offset"
                }
              ]
            },
            "description": "Get transaction history with filters"
          },
          "response": []
        },
        {
          "name": "Balance Statement",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{idToken}}",
                "description": "Uses ID Token for authorization"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/balance-statement?date=2023-09-26 - 2023-09-26&type=DEPOSIT&page=1&limit=20",
              "host": ["{{baseUrl}}"],
              "path": ["balance-statement"],
              "query": [
                {
                  "key": "date",
                  "value": "2023-09-26 - 2023-09-26",
                  "description": "Date range (YYYY-MM-DD - YYYY-MM-DD)"
                },
                {
                  "key": "type",
                  "value": "DEPOSIT",
                  "description": "DEPOSIT, WITHDRAWAL, etc."
                },
                {
                  "key": "page",
                  "value": "1",
                  "description": "Page number"
                },
                {
                  "key": "limit",
                  "value": "20",
                  "description": "Records per page"
                }
              ]
            },
            "description": "Get balance statement with date range"
          },
          "response": []
        }
      ]
    }
  ]
}
