Skip to content

Instantly share code, notes, and snippets.

@dipu-bd
Created October 31, 2020 12:47
Show Gist options
  • Save dipu-bd/f383c90a91be5e4c8f7437687722513d to your computer and use it in GitHub Desktop.
Save dipu-bd/f383c90a91be5e4c8f7437687722513d to your computer and use it in GitHub Desktop.
OkWallet Test api
package com.infinity.kyc.api.face;
import org.springframework.util.StreamUtils;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
public class OkWalletTest {
public static void main(String[] args) throws Exception {
// Request Data
String url = "https://okwallet.onebank.com.bd/eKYC_api_UAT/api.php";
String data = "{\n" +
" \"updateSeq\":\"1:\",\n" +
" \"call\":\"init\",\n" +
" \"appid\":\"oKeKycCall\",\n" +
" \"appchk\":\"e698f21862f12ff98f26713b879c8cfc\"\n" +
"}";
String content = Base64.getEncoder().encodeToString(data.getBytes(StandardCharsets.UTF_8));
// Run a system command
String[] commands = new String[]{"curl", "-X", "POST", url, "-d", content};
Process process = Runtime.getRuntime().exec(commands);
String response = StreamUtils.copyToString(process.getInputStream(), StandardCharsets.UTF_8);
// Process response
String jsonData = new String(Base64.getDecoder().decode(response), StandardCharsets.UTF_8);
System.out.println(jsonData);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment