提交 0e2fdb8d authored 作者: Whispa's avatar Whispa

commit commit

上级 a10b01a8
......@@ -70,17 +70,22 @@ public class CardCharge {
return json;
}
private JSONObject getPhoneJSON() {
JSONObject json = new JSONObject();
private ApiQuery getPhoneJSON() {
String alg="3DES-24";
ApiQuery json = new ApiQuery();
try {
json.put("txRef", this.getTxRef());
json.put("amount", this.getAmount());
json.put("currency", this.getCurrency());
json.put("network", "MTN");
json.put("customer_email", this.getEmail());
json.put("customer_phone", this.getPhonenumber());
json.put("fullname", this.getFullname());
json.putParams("txRef", this.getTxRef());
json.putParams("amount", this.getAmount());
json.putParams("currency", this.getCurrency());
json.putParams("network", "MTN");
json.putParams("customer_email", this.getEmail());
json.putParams("customer_phone", this.getPhonenumber());
json.putParams("fullname", this.getFullname());
} catch (JSONException ex) {
ex.getMessage();
}
......@@ -137,10 +142,10 @@ public class CardCharge {
public JSONObject chargeMobileMoney() throws JSONException {
JSONObject json = getPhoneJSON();
json.put("PBFPubKey", RaveConstant.PUBLIC_KEY);
json.put("redirect_url", this.getRedirect_url());
json.put("payment_options", "account");
ApiQuery json = getPhoneJSON();
json.putParams("PBFPubKey", RaveConstant.PUBLIC_KEY);
json.putParams("redirect_url", this.getRedirect_url());
json.putParams("payment_options", "account");
System.out.println(json.toString());
String message = json.toString();
......@@ -150,7 +155,7 @@ public class CardCharge {
Charge ch = new Charge();
return ch.charge(client,ed.getChargeEndPoint());
return ch.charge(json,ed.getChargeEndPoint());
}
......
......@@ -42,6 +42,17 @@ public class Charge {
api.putParams("alg", alg);
return this.apiConnection.connectAndQuery(api);
}
//for all charges
public JSONObject charge(ApiQuery api,String endpoint){
this.apiConnection = new ApiConnection(endpoint);
return this.apiConnection.connectAndQuery(api);
}
/**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论