{
  "info": {
    "name": "TurboPulsa Developer API",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://api.turbopulsa.com/sandbox/v1"
    },
    {
      "key": "api_key",
      "value": "ISI_KEY_SANDBOX_ANDA"
    },
    {
      "key": "order_id",
      "value": "ID_DARI_RESPONS_QUOTE"
    }
  ],
  "item": [
    {
      "name": "Kemampuan dan batas integrasi",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{api_key}}"
          },
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/capabilities",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "capabilities"
          ]
        },
        "description": "Scope: catalog:read"
      }
    },
    {
      "name": "Katalog prabayar terbit",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{api_key}}"
          },
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/catalog",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "catalog"
          ]
        },
        "description": "Scope: catalog:read"
      }
    },
    {
      "name": "Penyedia dan wilayah pascabayar",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{api_key}}"
          },
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/postpaid/catalog",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "postpaid",
            "catalog"
          ]
        },
        "description": "Scope: catalog:read"
      }
    },
    {
      "name": "Saldo tersedia dan dana ditahan",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{api_key}}"
          },
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/wallet",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "wallet"
          ]
        },
        "description": "Scope: wallet:read"
      }
    },
    {
      "name": "Buat penawaran prabayar",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (!pm.collectionVariables.get('createQuote_uuid')) pm.collectionVariables.set('createQuote_uuid', pm.variables.replaceIn('{{$guid}}'));"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{api_key}}"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "Idempotency-Key",
            "value": "{{createQuote_uuid}}"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/quotes",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "quotes"
          ]
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"product_code\": \"KODE_DARI_KATALOG\",\n  \"client_reference\": \"ORDER-CONTOH-1001\",\n  \"destination\": {\n    \"phone\": \"081200000000\"\n  }\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "description": "Scope: quotes:write"
      }
    },
    {
      "name": "Cek tagihan pascabayar",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (!pm.collectionVariables.get('createInquiry_uuid')) pm.collectionVariables.set('createInquiry_uuid', pm.variables.replaceIn('{{$guid}}'));"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{api_key}}"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "Idempotency-Key",
            "value": "{{createInquiry_uuid}}"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/postpaid/inquiries",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "postpaid",
            "inquiries"
          ]
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"product_code\": \"KODE_PENYEDIA_DARI_KATALOG\",\n  \"client_reference\": \"BILL-CONTOH-1001\",\n  \"customer_no\": \"001234567890\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "description": "Scope: inquiries:write"
      }
    },
    {
      "name": "Status cek tagihan",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{api_key}}"
          },
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/postpaid/inquiries/{{order_id}}",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "postpaid",
            "inquiries",
            "{{order_id}}"
          ]
        },
        "description": "Scope: orders:read"
      }
    },
    {
      "name": "Riwayat integrasi",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{api_key}}"
          },
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/orders",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "orders"
          ]
        },
        "description": "Scope: orders:read"
      }
    },
    {
      "name": "Status order yang sama",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{api_key}}"
          },
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/orders/{{order_id}}",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "orders",
            "{{order_id}}"
          ]
        },
        "description": "Scope: orders:read"
      }
    },
    {
      "name": "Konfirmasi dan bayar dari Saldo Rupiah",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (!pm.collectionVariables.get('confirmOrder_uuid')) pm.collectionVariables.set('confirmOrder_uuid', pm.variables.replaceIn('{{$guid}}'));"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{api_key}}"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "Idempotency-Key",
            "value": "{{confirmOrder_uuid}}"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/orders/{{order_id}}/confirm",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "orders",
            "{{order_id}}",
            "confirm"
          ]
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"confirmation_token\": \"{{confirmation_token}}\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "description": "Scope: orders:confirm"
      }
    },
    {
      "name": "Batalkan order yang belum diproses",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (!pm.collectionVariables.get('cancelOrder_uuid')) pm.collectionVariables.set('cancelOrder_uuid', pm.variables.replaceIn('{{$guid}}'));"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{api_key}}"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "Idempotency-Key",
            "value": "{{cancelOrder_uuid}}"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/orders/{{order_id}}/cancel",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "orders",
            "{{order_id}}",
            "cancel"
          ]
        },
        "description": "Scope: orders:cancel"
      }
    },
    {
      "name": "Hasil sukses yang privat",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{api_key}}"
          },
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/orders/{{order_id}}/result",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "orders",
            "{{order_id}}",
            "result"
          ]
        },
        "description": "Scope: results:read"
      }
    },
    {
      "name": "Selesaikan simulasi pending",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (!pm.collectionVariables.get('resolveSimulation_uuid')) pm.collectionVariables.set('resolveSimulation_uuid', pm.variables.replaceIn('{{$guid}}'));"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{api_key}}"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "Idempotency-Key",
            "value": "{{resolveSimulation_uuid}}"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/orders/{{order_id}}/resolve",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "orders",
            "{{order_id}}",
            "resolve"
          ]
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"status\": \"succeeded\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "description": "Hanya sandbox."
      }
    },
    {
      "name": "Reset saldo simulasi setelah semua hold selesai",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (!pm.collectionVariables.get('resetSimulation_uuid')) pm.collectionVariables.set('resetSimulation_uuid', pm.variables.replaceIn('{{$guid}}'));"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{api_key}}"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "Idempotency-Key",
            "value": "{{resetSimulation_uuid}}"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/scenarios/reset",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "scenarios",
            "reset"
          ]
        },
        "description": "Hanya sandbox."
      }
    }
  ]
}
