import okhttp3.*;

public class IbanInfoFetcher {

    public static void getIbanInfo(String iban, String apiKey, Callback callback) {
        OkHttpClient client = new OkHttpClient();

        String url = "https://shabanic.ir/api/v1/iban_info?iban=" + iban;

        Request request = new Request.Builder()
                .url(url)
                .post(RequestBody.create("", null)) // بدون بادی
                .addHeader("SHABANIC-API-KEY", apiKey)
                .build();

        client.newCall(request).enqueue(callback);
    }
}


// کد هایی که باید در Activity برنامه خود قرار دهید

IbanInfoFetcher.getIbanInfo("شماره شبا", "کلید", new Callback() {
    @Override
    public void onFailure(Call call, IOException e) {
        e.printStackTrace();
    }

    @Override
    public void onResponse(Call call, Response response) throws IOException {
        if (response.isSuccessful()) {
            String responseData = response.body().string();
            Log.d("IBAN_INFO", responseData);
        } else {
            Log.e("IBAN_INFO", "Error: " + response.code());
        }
    }
});
