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

commit commit

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