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.github.theresasogunle; |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
import org.json.JSONObject; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* |
13
|
|
|
* @author Theresa |
14
|
|
|
*/ |
15
|
|
|
public class Transaction { |
16
|
|
|
ApiConnection apiConnection; |
17
|
|
|
|
18
|
|
|
Endpoints end= new Endpoints(); |
19
|
|
|
private String flwref, txRef; |
|
|
|
|
20
|
|
|
|
21
|
|
|
//requery all failed transactions |
22
|
|
|
/** |
23
|
|
|
* @return JSONObject |
24
|
|
|
* |
25
|
|
|
*/ |
26
|
|
|
public JSONObject verifyTransactionRequery(){ |
27
|
|
|
|
28
|
|
|
this.apiConnection = new ApiConnection(end.getVerifyEndPoint()); |
29
|
|
|
ApiQuery api= new ApiQuery(); |
30
|
|
|
api.putParams("txref", this.getTxRef()); |
31
|
|
|
api.putParams("flw_ref", this.getFlwref()); |
32
|
|
|
api.putParams("SECKEY", RaveConstant.SECRET_KEY ); |
33
|
|
|
|
34
|
|
|
return this.apiConnection.connectAndQuery(api); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @return JSONObject |
39
|
|
|
* |
40
|
|
|
*/ |
41
|
|
|
public JSONObject verifyTransactionXrequery(){ |
42
|
|
|
|
43
|
|
|
this.apiConnection = new ApiConnection(end.getVerifyXrequeryEndPoint()); |
44
|
|
|
|
45
|
|
|
ApiQuery api= new ApiQuery(); |
46
|
|
|
|
47
|
|
|
api.putParams("txref", this.getTxRef()); |
48
|
|
|
api.putParams("txref", this.getTxRef()); |
49
|
|
|
api.putParams("SECKEY", RaveConstant.SECRET_KEY); |
50
|
|
|
api.putParams("last_attempt", 1); |
51
|
|
|
api.putParams("only_successful", 1); |
52
|
|
|
|
53
|
|
|
return this.apiConnection.connectAndQuery(api); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @return the flwref |
58
|
|
|
*/ |
59
|
|
|
public String getFlwref() { |
60
|
|
|
return flwref; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @param flwref the flwref to set |
65
|
|
|
* @return Transaction |
66
|
|
|
*/ |
67
|
|
|
public Transaction setFlwref(String flwref) { |
68
|
|
|
this.flwref = flwref; |
69
|
|
|
return this; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @return the txRef |
74
|
|
|
*/ |
75
|
|
|
public String getTxRef() { |
76
|
|
|
return txRef; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @param txRef the txRef to set |
81
|
|
|
* @return Transaction |
82
|
|
|
*/ |
83
|
|
|
public Transaction setTxRef(String txRef) { |
84
|
|
|
this.txRef = txRef; |
85
|
|
|
return this; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
|
89
|
|
|
|
90
|
|
|
} |
91
|
|
|
|