use of com.squareup.protos.tbd.pfi.CreateBankAccountRequest in project tbdex-protocol by TBD54566975.
the class PaymentProcessor method createBankAccount.
private BankAccount createBankAccount(PaymentProcessorRequest request) {
CreateBankAccountRequest createBankAccountRequest = new CreateBankAccountRequest.Builder().accountNumber(request.account_number).routingNumber(request.routing_number).billingDetails(request.billing_details).bankAddress(request.bank_address).idempotencyKey(UUID.randomUUID().toString()).build();
BankAccount bankAccount;
try {
bankAccount = circleClient.createBankAccount(createBankAccountRequest);
} catch (Exception e) {
// TODO: add more error handling here
bankAccount = null;
}
return bankAccount;
}
use of com.squareup.protos.tbd.pfi.CreateBankAccountRequest in project tbdex-protocol by TBD54566975.
the class RealCircleClient method createBankAccount.
@Override
public BankAccount createBankAccount(CreateBankAccountRequest createBankAccountRequest) throws Exception {
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, gson.toJson(createBankAccountRequest));
Request request = requestBuilder.url("https://api-sandbox.circle.com/v1/businessAccount/banks/wires").post(body).build();
Response response = client.newCall(request).execute();
JSONObject data = new JSONObject(response.body().string()).getJSONObject("data");
return new BankAccount.Builder().trackingRef(data.getString("trackingRef")).id(data.getString("id")).build();
}
Aggregations