Skip to content

Commit

Permalink
Modified modules
Browse files Browse the repository at this point in the history
  • Loading branch information
seyiadisa committed Jan 19, 2024
1 parent ebae33c commit f884d63
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,44 +100,22 @@ public List<Object> verifyBankAccountNumber(String countryCode, String bankCode,
return jObj.getJSONArray("data").toList();
}

public List<Object> verifyBankAccountNumbers(String countryCode, String bankCode, String[] accountNumbers)
throws Exception {
JSONObject paramsJson = new JSONObject();
JSONArray ja = new JSONArray();

for (String acctNum : accountNumbers) {
JSONObject jo = new JSONObject();

jo.put("countryCode", countryCode);
jo.put("account_bank", bankCode);
jo.put("account_number", acctNum);

ja.put(jo);
}
paramsJson.put("verifyAccountNumbers", ja);

HttpResponse<String> response = handlePOSTRequest("info/verify-bank-account-number", paramsJson);
JSONObject jo = parseJSONData(response);

return jo.getJSONArray("data").toList();
}

public List<Object> verifyBankAccountNumbers(String[] countryCode, String[] bankCode, String[] accountNumbers)
throws Exception {
public List<Object> verifyBankAccountNumbers(Map<String, String[]> map) throws Exception {

if ((countryCode.length != bankCode.length) && (countryCode.length != accountNumbers.length)) {
if ((map.get("countryCode").length != map.get("bankCode").length)
&& (map.get("countryCode").length != map.get("accountNumber").length)) {
throw new IllegalArgumentException("arrays should be of the same size");
}

JSONObject paramsJson = new JSONObject();
JSONArray ja = new JSONArray();

for (int i = 0; i < countryCode.length; i++) {
for (int i = 0; i < map.get("countryCode").length; i++) {
JSONObject jo = new JSONObject();

jo.put("countryCode", countryCode[i]);
jo.put("account_bank", bankCode[i]);
jo.put("account_number", accountNumbers[i]);
jo.put("countryCode", map.get("countryCode")[i]);
jo.put("account_bank", map.get("bankCode")[i]);
jo.put("account_number", map.get("accountNumber")[i]);

ja.put(jo);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public Map<String, Object> verifyPayment(String id, String subAccount) throws Ex
return jo.getJSONObject("data").toMap();
}

public Map<String, Object> simulatePayment(String issueID, Payments.Status status) throws Exception {
public Map<String, Object> simulatePayment(String issueID, Status status) throws Exception {
JSONObject paramsJson = new JSONObject();
Map<String, Object> ret;

Expand All @@ -134,7 +134,7 @@ public Map<String, Object> simulatePayment(String issueID, Payments.Status statu
return ret;
}

public Map<String, Object> simulatePayment(String issueID, Payments.Status status, String subAccount)
public Map<String, Object> simulatePayment(String issueID, Status status, String subAccount)
throws Exception {
JSONObject paramsJson = new JSONObject();
Map<String, Object> ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.util.List;
import java.util.Map;

import org.json.JSONArray;
import org.json.JSONObject;

/**
Expand Down

0 comments on commit f884d63

Please sign in to comment.