1
|
|
|
/* |
2
|
|
|
* To change this license header, choose License Headers in Project Properties. |
3
|
|
|
* To change this template file, choose Tools | Templates |
4
|
|
|
* and open the template in the editor. |
5
|
|
|
*/ |
6
|
|
|
package com.rave; |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
import org.json.JSONObject; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* |
15
|
|
|
* @author Theresa |
16
|
|
|
*/ |
17
|
|
|
public class Charge { |
18
|
|
|
|
19
|
|
|
ApiConnection apiConnection; |
20
|
|
|
Endpoints ed= new Endpoints(); |
21
|
|
|
|
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* |
25
|
|
|
* @param client |
26
|
|
|
* @return JSONObject |
27
|
|
|
*/ |
28
|
|
|
|
29
|
|
|
|
30
|
|
|
//for all charges |
31
|
|
|
public JSONObject charge(String client){ |
32
|
|
|
this.apiConnection = new ApiConnection(ed.getChargeEndPoint()); |
33
|
|
|
|
34
|
|
|
String alg="3DES-24"; |
35
|
|
|
|
36
|
|
|
|
37
|
|
|
ApiQuery api=new ApiQuery(); |
38
|
|
|
|
39
|
|
|
api.putParams("PBFPubKey", RaveConstant.PUBLIC_KEY); |
40
|
|
|
|
41
|
|
|
api.putParams("client", client); |
42
|
|
|
|
43
|
|
|
api.putParams("alg", alg); |
44
|
|
|
|
45
|
|
|
|
46
|
|
|
return this.apiConnection.connectAndQuery(api); |
47
|
|
|
} |
48
|
|
|
/** |
49
|
|
|
* |
50
|
|
|
* |
51
|
|
|
* @return JSONObject |
52
|
|
|
* @param transaction_reference |
53
|
|
|
* @param otp |
54
|
|
|
* |
55
|
|
|
*/ |
56
|
|
|
|
57
|
|
|
public JSONObject validateAccountCharge(String transaction_reference, String otp){ |
58
|
|
|
|
59
|
|
|
this.apiConnection = new ApiConnection(ed.getValidateAccountChargeEndPoint()); |
60
|
|
|
|
61
|
|
|
ApiQuery api=new ApiQuery(); |
62
|
|
|
|
63
|
|
|
api.putParams("PBFPubKey",RaveConstant.PUBLIC_KEY); |
64
|
|
|
api.putParams("transactionreference", transaction_reference); |
65
|
|
|
|
66
|
|
|
api.putParams("otp", otp); |
67
|
|
|
|
68
|
|
|
return this.apiConnection.connectAndQuery(api); |
69
|
|
|
} |
70
|
|
|
/** |
71
|
|
|
* |
72
|
|
|
* |
73
|
|
|
* @return JSONObject |
74
|
|
|
* @param transaction_reference |
75
|
|
|
* @param otp |
76
|
|
|
* |
77
|
|
|
*/ |
78
|
|
|
|
79
|
|
|
public JSONObject validateCardCharge(String transaction_reference, String otp){ |
80
|
|
|
|
81
|
|
|
this.apiConnection = new ApiConnection(ed.getValidateCardChargeEndPoint()); |
82
|
|
|
|
83
|
|
|
ApiQuery api=new ApiQuery(); |
84
|
|
|
|
85
|
|
|
api.putParams("PBFPubKey",RaveConstant.PUBLIC_KEY); |
86
|
|
|
api.putParams("transaction_reference", transaction_reference); |
87
|
|
|
|
88
|
|
|
api.putParams("otp", otp); |
89
|
|
|
|
90
|
|
|
return this.apiConnection.connectAndQuery(api); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
|
94
|
|
|
|
95
|
|
|
|
96
|
|
|
|
97
|
|
|
} |
98
|
|
|
|