-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathKeys.java
More file actions
105 lines (88 loc) · 2.4 KB
/
Keys.java
File metadata and controls
105 lines (88 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package me.iyanuadelekan.paystackjava.core;
import org.json.JSONObject;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
/**
* @author Iyanu Adelekan on 18/07/2016.
*/
class Keys {
String TEST_SECRET_KEY;
String TEST_PUBLIC_KEY;
String LIVE_SECRET_KEY;
String LIVE_PUBLIC_KEY;
String KEY_IN_USE;
/**
* Used to initialise all necessary API keys
* @throws FileNotFoundException
*/
public void initKeys() throws FileNotFoundException {
JSONObject keyObject;
String fileContent = "";
File file = new File("Keys.json");
Scanner scanner = new Scanner(file);
while(scanner.hasNext()) {
fileContent.concat(scanner.nextLine()) ;
}
keyObject = new JSONObject(fileContent).getJSONObject("API_KEYS");
this.KEY_IN_USE = keyObject.getString("KEY_IN_USE");
this.TEST_SECRET_KEY = keyObject.getString("TEST_SECRET_KEY");
this.TEST_PUBLIC_KEY = keyObject.getString("TEST_PUBLIC_KEY");
this.LIVE_SECRET_KEY = keyObject.getString("LIVE_SECRET_KEY");
this.LIVE_PUBLIC_KEY = keyObject.getString("LIVE_PUBLIC_KEY");
}
/**
* Used to set test secret key
* @param key
*/
protected void setTest_SECRET_KEY(String key){
this.TEST_SECRET_KEY = key;
}
/**
* Used to get test secret key
* @return
*/
protected String getTEST_SECRET_KEY() { return this.TEST_SECRET_KEY; }
/**
* Used to set test public key
* @param key
*/
protected void setTEST_PUBLIC_KEY(String key){
this.TEST_PUBLIC_KEY = key;
}
/**
* Used to get test public key
* @return
*/
protected String getTEST_PUBLIC_KEY(){
return this.TEST_PUBLIC_KEY;
}
/**
* Used to set live secret key
* @param key
*/
protected void setLIVE_SECRET_KEY(String key){
this.LIVE_SECRET_KEY = key;
}
/**
* Used to get live secret key
* @return
*/
protected String getLIVE_SECRET_KEY(){
return this.LIVE_SECRET_KEY;
}
/**
* Used to set live public key
* @param key
*/
protected void setLIVE_PUBLIC_KEY(String key){
this.LIVE_PUBLIC_KEY = key;
}
/**
* Used to get live public key
* @return
*/
protected String getLIVE_PUBLIC_KEY(){
return this.LIVE_PUBLIC_KEY;
}
}