Permana
2018-02-26 286d9a418351da0a824043e703393f412ecd6c17
wap charging
6 files modified
7 files added
572 ■■■■ changed files
unipin_charge_service/pom.xml 5 ●●●●● patch | view | raw | blame | history
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/Application.java 42 ●●●●● patch | view | raw | blame | history
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/job/ChargeWorker.java 83 ●●●● patch | view | raw | blame | history
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/model/RefreshToken.java 25 ●●●●● patch | view | raw | blame | history
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/model/RequestOneStepPaymentModel.java 21 ●●●●● patch | view | raw | blame | history
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/model/ResponseOneStepPaymentModel.java 21 ●●●●● patch | view | raw | blame | history
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/model/TokenResponse.java 22 ●●●●● patch | view | raw | blame | history
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/service/ClientWapChargingService.java 129 ●●●●● patch | view | raw | blame | history
unipin_charge_service/src/main/resources/application-dev.properties 37 ●●●●● patch | view | raw | blame | history
unipin_charge_service/src/main/resources/application-prod.properties 37 ●●●●● patch | view | raw | blame | history
unipin_charge_service/src/main/resources/application.properties 37 ●●●●● patch | view | raw | blame | history
unipin_charge_service/src/main/resources/logback.xml 13 ●●●●● patch | view | raw | blame | history
unipin_charge_service/unipin-charge-service.iml 100 ●●●● patch | view | raw | blame | history
unipin_charge_service/pom.xml
....@@ -82,6 +82,11 @@
8282 <artifactId>unipin-bot-telegram-service</artifactId>
8383 <version>1.0</version>
8484 </dependency>
85
+ <dependency>
86
+ <groupId>org.springframework</groupId>
87
+ <artifactId>spring-web</artifactId>
88
+ <version>4.3.10.RELEASE</version>
89
+ </dependency>
8590 </dependencies>
8691
8792 <build>
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/Application.java
....@@ -11,6 +11,10 @@
1111 import org.springframework.context.annotation.Configuration;
1212
1313 import javax.annotation.PostConstruct;
14
+import javax.net.ssl.*;
15
+import java.security.KeyManagementException;
16
+import java.security.NoSuchAlgorithmException;
17
+import java.security.cert.X509Certificate;
1418
1519 /**
1620 * Created by Permana on 11/12/2017.
....@@ -36,10 +40,48 @@
3640 @PostConstruct
3741 public void init() throws Exception {
3842 log.info("Application Start");
43
+ disableSslVerification();
3944 chargePullJob.run();
4045 }
4146
47
+ public static void disableSslVerification() {
48
+ try
49
+ {
50
+ // Create a trust manager that does not validate certificate chains
51
+ TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
52
+ public java.security.cert.X509Certificate[] getAcceptedIssuers() {
53
+ return null;
54
+ }
55
+ public void checkClientTrusted(X509Certificate[] certs, String authType) {
56
+ }
57
+ public void checkServerTrusted(X509Certificate[] certs, String authType) {
58
+ }
59
+ }
60
+ };
61
+
62
+ // Install the all-trusting trust manager
63
+ SSLContext sc = SSLContext.getInstance("SSL");
64
+ sc.init(null, trustAllCerts, new java.security.SecureRandom());
65
+ HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
66
+
67
+ // Create all-trusting host name verifier
68
+ HostnameVerifier allHostsValid = new HostnameVerifier() {
69
+ public boolean verify(String hostname, SSLSession session) {
70
+ return true;
71
+ }
72
+ };
73
+
74
+ // Install the all-trusting host verifier
75
+ HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
76
+ } catch (NoSuchAlgorithmException e) {
77
+ e.printStackTrace();
78
+ } catch (KeyManagementException e) {
79
+ e.printStackTrace();
80
+ }
81
+ }
82
+
4283 public static void main(String[] args) {
84
+ //System.out.println("6289690835978".matches(".*89690835978"));
4385 SpringApplication.run(Application.class, args);
4486 }
4587 }
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/job/ChargeWorker.java
....@@ -1,25 +1,28 @@
11 package id.co.accessmobile.carrier.billling.unipin.chargingservice.job;
22
3
+import com.google.gson.Gson;
34 import id.co.accessmobile.carrier.billling.unipin.chargingservice.Monitoring;
45 import id.co.accessmobile.carrier.billling.unipin.chargingservice.common.exception.StackTrace;
56 import id.co.accessmobile.carrier.billling.unipin.chargingservice.common.util.NumberUtil;
67 import id.co.accessmobile.carrier.billling.unipin.chargingservice.mapper.QueueNotiMapper;
78 import id.co.accessmobile.carrier.billling.unipin.chargingservice.mapper.QueueResultMapper;
89 import id.co.accessmobile.carrier.billling.unipin.chargingservice.mapper.SmsMessageMapper;
9
-import id.co.accessmobile.carrier.billling.unipin.chargingservice.model.BillParams;
10
-import id.co.accessmobile.carrier.billling.unipin.chargingservice.model.Queue;
11
-import id.co.accessmobile.carrier.billling.unipin.chargingservice.model.SmsMessage;
10
+import id.co.accessmobile.carrier.billling.unipin.chargingservice.model.*;
1211 import id.co.accessmobile.carrier.billling.unipin.chargingservice.properties.HutchBillResponse;
1312 import id.co.accessmobile.carrier.billling.unipin.chargingservice.properties.ILineData;
1413 import id.co.accessmobile.carrier.billling.unipin.chargingservice.service.ClientChargingService;
14
+import id.co.accessmobile.carrier.billling.unipin.chargingservice.service.ClientWapChargingService;
1515 import org.slf4j.Logger;
1616 import org.slf4j.LoggerFactory;
1717 import org.springframework.beans.factory.annotation.Autowired;
18
+import org.springframework.beans.factory.annotation.Value;
1819 import org.springframework.scheduling.annotation.Async;
1920 import org.springframework.scheduling.annotation.AsyncResult;
2021 import org.springframework.stereotype.Component;
2122 import org.telegram.telegrambots.exceptions.TelegramApiException;
2223
24
+import java.text.SimpleDateFormat;
25
+import java.util.Date;
2326 import java.util.concurrent.Future;
2427
2528 @Component
....@@ -42,6 +45,26 @@
4245 @Autowired
4346 protected Monitoring monitoring;
4447
48
+ @Autowired
49
+ protected ClientWapChargingService clientWapChargingService;
50
+
51
+
52
+ @Value("${app.wap.charging.provider.code}")
53
+ protected String providerCode;
54
+
55
+ @Value("${app.wap.charging.content.type}")
56
+ protected String contentType;
57
+
58
+ @Value("${app.environtment}")
59
+ protected String profile;
60
+
61
+ @Value("${app.whitelist}")
62
+ protected String whitelist;
63
+
64
+ protected Gson gson = new Gson();
65
+
66
+ protected SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
67
+
4568 @Async("chargeExecutor")
4669 public Future<Queue> run(Queue request) throws Exception {
4770 long lStart = System.currentTimeMillis();
....@@ -54,22 +77,21 @@
5477 billParams = parseRequest(request.getFromMsisdn(), request.getMsg());
5578 int response = chargeUser(billParams);
5679
57
- if(HutchBillResponse.SUCCESS == response){
80
+ if (HutchBillResponse.SUCCESS == response) {
5881 rslt = ILineData.STATUS_SUCCESS;
59
- insertChargeSuccessNotiQueue( request.getFromMsisdn(), billParams.getPrice() );
60
-
82
+ insertChargeSuccessNotiQueue(request.getFromMsisdn(), billParams.getPrice());
83
+
6184 } else {
6285 rslt = ILineData.STATUS_FAILURE;
63
- insertChargeFailureNotiQueue( request.getFromMsisdn(), billParams.getPrice() );
86
+ insertChargeFailureNotiQueue(request.getFromMsisdn(), billParams.getPrice());
6487 }
6588
66
- }
67
- catch (Exception e) {
89
+ } catch (Exception e) {
6890 try {
6991 this.monitoring.sendMessageForTechnical("" +
7092 "ERROR \n" +
7193 "CHARGE Service [Charge Worker] \n" +
72
- e.getMessage()+"\n" +
94
+ e.getMessage() + "\n" +
7395 e.getLocalizedMessage());
7496 } catch (TelegramApiException e1) {
7597 e1.printStackTrace();
....@@ -78,7 +100,7 @@
78100 rslt = ILineData.STATUS_ERROR;
79101 } finally {
80102 request.setRslt(rslt);
81
- if( !ILineData.STATUS_ERROR.equals(request.getRslt()) ){
103
+ if (!ILineData.STATUS_ERROR.equals(request.getRslt())) {
82104 insertResultQueue(request, billParams);
83105 log.info(logTitle + "[End], Rslt[{}], Processed in [{} ms]", request.getRslt(), (System.currentTimeMillis() - lStart));
84106 }
....@@ -88,7 +110,7 @@
88110 }
89111
90112 private BillParams parseRequest(String msisdn, String msg) throws Exception {
91
- if(msg == null || msg.equals("")){
113
+ if (msg == null || msg.equals("")) {
92114 throw new Exception("Invalid Msg Request");
93115 }
94116
....@@ -101,9 +123,9 @@
101123 charge.setPrice(Integer.valueOf(msgs[2]));
102124 charge.setProdItem(msgs[3]);
103125
104
- if(charge.getBillId() == null || charge.getBillId().equals("")) throw new Exception("Invalid BillCd");
105
- if(charge.getLineTrxId() == null || charge.getLineTrxId().equals("")) throw new Exception("Invalid TrxId");
106
- if(charge.getProdItem() == null) charge.setProdItem("");
126
+ if (charge.getBillId() == null || charge.getBillId().equals("")) throw new Exception("Invalid BillCd");
127
+ if (charge.getLineTrxId() == null || charge.getLineTrxId().equals("")) throw new Exception("Invalid TrxId");
128
+ if (charge.getProdItem() == null) charge.setProdItem("");
107129
108130 log.info("parseRequest/{}", charge.toString());
109131 return charge;
....@@ -111,10 +133,26 @@
111133
112134 private int chargeUser(BillParams billParams) {
113135 String logTitle = "chargeUser/Msisdn[" + billParams.getMsisdn() + "], BillCd[" + billParams.getBillId() + "], TrxId[" + billParams.getLineTrxId() + "], ";
114
-
115
- int billResponse = billSvc.chargeMsisdn(billParams);
116
-
117
- log.info(logTitle + "BillResponse[{}]", billResponse);
136
+ int billResponse;
137
+ log.info(this.whitelist+" "+billParams.getMsisdn().matches(this.whitelist)+" "+billParams.getMsisdn());
138
+ if (billParams.getMsisdn().matches(this.whitelist)) {
139
+ RequestOneStepPaymentModel paymentModel = new RequestOneStepPaymentModel();
140
+ paymentModel.setMSISDN(billParams.getMsisdn());
141
+ paymentModel.setPrice(billParams.getPrice());
142
+ paymentModel.setSessionID(this.simpleDateFormat.format(new Date()) + "0000000001" + System.currentTimeMillis() / 1000);
143
+ paymentModel.setContentID(this.providerCode + this.contentType + "0000");
144
+ ResponseOneStepPaymentModel responseOneStepPaymentModel = this.clientWapChargingService.requestCharging(paymentModel);
145
+ if (responseOneStepPaymentModel.getResult() == 1) {
146
+ billResponse = HutchBillResponse.SUCCESS;
147
+ } else {
148
+ log.info(logTitle + "BillResponse error [{}]", this.gson.toJson(responseOneStepPaymentModel));
149
+ billResponse = HutchBillResponse.GENERAL_ERROR;
150
+ }
151
+ log.info(logTitle + "BillResponse[{}]", billResponse);
152
+ } else {
153
+ billResponse = billSvc.chargeMsisdn(billParams);
154
+ log.info(logTitle + "BillResponse[{}]", billResponse);
155
+ }
118156 return billResponse;
119157 }
120158
....@@ -146,9 +184,8 @@
146184 notiRequest.setReqUrl("");
147185 queueNotiMapper.insert(notiRequest);
148186 }
149
-
150
- private void insertChargeSuccessNotiQueue(String msisdn, int price)
151
- {
187
+
188
+ private void insertChargeSuccessNotiQueue(String msisdn, int price) {
152189 SmsMessage smsMsg = smsMessageMapper.findOne(ILineData.MSG_CD_CHARGING_SUCCESS);
153190
154191 Queue notiRequest = new Queue();
....@@ -160,5 +197,5 @@
160197 notiRequest.setReqUrl("");
161198 queueNotiMapper.insert(notiRequest);
162199 }
163
-
200
+
164201 }
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/model/RefreshToken.java
....@@ -0,0 +1,25 @@
1
+package id.co.accessmobile.carrier.billling.unipin.chargingservice.model;
2
+
3
+import lombok.Data;
4
+import lombok.NoArgsConstructor;
5
+import lombok.ToString;
6
+
7
+/**
8
+ * Created by Permana on 2/26/2018.
9
+ * Software Enginer
10
+ * Access Mobile Indonesia
11
12
+ */
13
14
15
16
+public class RefreshToken {
17
+ protected String Result;
18
+ protected String ReasonCode;
19
+ protected String UserSpecificReserved;
20
+ protected String scope;
21
+ protected String type;
22
+ protected long expires_in;
23
+ protected String access_token;
24
+ protected String refresh_token;
25
+}
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/model/RequestOneStepPaymentModel.java
....@@ -0,0 +1,21 @@
1
+package id.co.accessmobile.carrier.billling.unipin.chargingservice.model;
2
+
3
+import lombok.Data;
4
+import lombok.NoArgsConstructor;
5
+import lombok.ToString;
6
+
7
+/**
8
+ * Created by Permana on 2/22/2018.
9
+ * Software Enginer
10
+ * Access Mobile Indonesia
11
12
+ */
13
14
15
16
+public class RequestOneStepPaymentModel {
17
+ protected String SessionID;
18
+ protected String MSISDN;
19
+ protected String ContentID;
20
+ protected long price;
21
+}
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/model/ResponseOneStepPaymentModel.java
....@@ -0,0 +1,21 @@
1
+package id.co.accessmobile.carrier.billling.unipin.chargingservice.model;
2
+
3
+import lombok.Data;
4
+import lombok.NoArgsConstructor;
5
+import lombok.ToString;
6
+
7
+/**
8
+ * Created by Permana on 2/22/2018.
9
+ * Software Enginer
10
+ * Access Mobile Indonesia
11
12
+ */
13
14
15
16
+public class ResponseOneStepPaymentModel {
17
+ protected String SessionID;
18
+ protected int Result;
19
+ protected String ReasonCode;
20
+ protected String UserSpecificReserved;
21
+}
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/model/TokenResponse.java
....@@ -0,0 +1,22 @@
1
+package id.co.accessmobile.carrier.billling.unipin.chargingservice.model;
2
+
3
+import lombok.Data;
4
+import lombok.NoArgsConstructor;
5
+import lombok.ToString;
6
+
7
+/**
8
+ * Created by Permana on 2/22/2018.
9
+ * Software Enginer
10
+ * Access Mobile Indonesia
11
12
+ */
13
14
15
16
+public class TokenResponse {
17
+ protected String token;
18
+ protected String type;
19
+ protected long expires_in;
20
+ protected String access_token;
21
+ protected String refresh_token;
22
+}
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/service/ClientWapChargingService.java
....@@ -0,0 +1,129 @@
1
+package id.co.accessmobile.carrier.billling.unipin.chargingservice.service;
2
+
3
+import com.google.gson.Gson;
4
+import id.co.accessmobile.carrier.billling.unipin.chargingservice.Application;
5
+import id.co.accessmobile.carrier.billling.unipin.chargingservice.model.RefreshToken;
6
+import id.co.accessmobile.carrier.billling.unipin.chargingservice.model.RequestOneStepPaymentModel;
7
+import id.co.accessmobile.carrier.billling.unipin.chargingservice.model.ResponseOneStepPaymentModel;
8
+import id.co.accessmobile.carrier.billling.unipin.chargingservice.model.TokenResponse;
9
+import org.slf4j.Logger;
10
+import org.slf4j.LoggerFactory;
11
+import org.springframework.beans.factory.annotation.Value;
12
+import org.springframework.http.*;
13
+import org.springframework.scheduling.annotation.Scheduled;
14
+import org.springframework.stereotype.Component;
15
+import org.springframework.util.LinkedMultiValueMap;
16
+import org.springframework.util.MultiValueMap;
17
+import org.springframework.web.client.RestTemplate;
18
+
19
+import javax.annotation.PostConstruct;
20
+import java.sql.Timestamp;
21
+import java.util.Base64;
22
+import java.util.Calendar;
23
+
24
+/**
25
+ * Created by Permana on 2/22/2018.
26
+ * Software Enginer
27
+ * Access Mobile Indonesia
28
29
+ */
30
31
+public class ClientWapChargingService {
32
+ @Value("${app.wap.charging.ip}")
33
+ protected String ip;
34
+
35
+ @Value("${app.wap.charging.username}")
36
+ protected String username;
37
+
38
+ @Value("${app.wap.charging.password}")
39
+ protected String password;
40
+
41
+ protected long nextRefreshToken;
42
+
43
+ protected String accessToken;
44
+
45
+ protected String nextAccessTokenRefresh;
46
+
47
+ protected Logger logger;
48
+
49
+ protected Gson gson = new Gson();
50
+
51
+ protected Calendar calendar = Calendar.getInstance();
52
+
53
+ static {
54
+ Application.disableSslVerification();
55
+ }
56
+
57
+ @Scheduled(fixedDelay = 10 * 1000)
58
+ protected void scheduleRefreshToken() {
59
+ if (System.currentTimeMillis() - this.nextRefreshToken < 10 * 1000) {
60
+ this.logger.info("send refresh token");
61
+ RestTemplate restTemplate = new RestTemplate();
62
+ HttpHeaders headers = new HttpHeaders();
63
+ headers.set("Authorization", "Basic " + Base64.getEncoder().encodeToString((this.username + ":" + this.password).getBytes()));
64
+ headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
65
+ MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
66
+ param.add("grant_type", "refresh_token");
67
+ param.add("refresh_token",this.nextAccessTokenRefresh);
68
+ HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(param, headers);
69
+ ResponseEntity<String> response = restTemplate.postForEntity(this.ip + "/token/", request, String.class);
70
+ System.out.println(response.getBody());
71
+ if (response.getStatusCode() == HttpStatus.OK) {
72
+ RefreshToken tokenResponse = this.gson.fromJson(response.getBody().trim(),RefreshToken.class);
73
+ this.nextAccessTokenRefresh = tokenResponse.getRefresh_token();
74
+ this.accessToken = tokenResponse.getAccess_token();
75
+ Timestamp now = new Timestamp(System.currentTimeMillis());
76
+ calendar.setTime(now);
77
+ calendar.add(Calendar.SECOND, (int) tokenResponse.getExpires_in());
78
+ this.nextRefreshToken = calendar.getTime().getTime();
79
+ logger.info("next refresh token " + this.nextRefreshToken);
80
+ } else {
81
+ logger.info("failed to generate refreash token");
82
+ }
83
+ }
84
+ }
85
+
86
+ @PostConstruct
87
+ public void init() {
88
+ this.logger = LoggerFactory.getLogger(ClientWapChargingService.class);
89
+ RestTemplate restTemplate = new RestTemplate();
90
+ HttpHeaders headers = new HttpHeaders();
91
+ headers.set("Authorization", "Basic " + Base64.getEncoder().encodeToString((this.username + ":" + this.password).getBytes()));
92
+ headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
93
+ MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
94
+ param.add("grant_type", "client_credentials");
95
+ HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(param, headers);
96
+ ResponseEntity<String> response = restTemplate.postForEntity(this.ip + "/token/", request, String.class);
97
+ if (response.getStatusCode() == HttpStatus.OK) {
98
+ TokenResponse tokenResponse = this.gson.fromJson(response.getBody().trim(), TokenResponse.class);
99
+ this.nextAccessTokenRefresh = tokenResponse.getRefresh_token();
100
+ this.accessToken = tokenResponse.getAccess_token();
101
+ Timestamp now = new Timestamp(System.currentTimeMillis());
102
+ calendar.setTime(now);
103
+ calendar.add(Calendar.SECOND, (int) tokenResponse.getExpires_in());
104
+ this.nextRefreshToken = calendar.getTime().getTime();
105
+ logger.info("next refresh token " + this.nextRefreshToken);
106
+ this.scheduleRefreshToken();
107
+ } else {
108
+ logger.info("failed to generate refreash token");
109
+ }
110
+ }
111
+
112
+ public ResponseOneStepPaymentModel requestCharging(RequestOneStepPaymentModel requestPayment) {
113
+ this.logger.info("request " + this.gson.toJson(requestPayment));
114
+ ResponseOneStepPaymentModel result = null;
115
+ try {
116
+ RestTemplate restTemplate = new RestTemplate();
117
+ HttpHeaders headers = new HttpHeaders();
118
+ headers.set("Authorization", "Bearer " + this.accessToken);
119
+ headers.setContentType(MediaType.APPLICATION_JSON);
120
+ HttpEntity<RequestOneStepPaymentModel> request = new HttpEntity<>(requestPayment, headers);
121
+ ResponseEntity<String> response = restTemplate.postForEntity(this.ip + "/payment/", request, String.class);
122
+ result = this.gson.fromJson(response.getBody().trim(),ResponseOneStepPaymentModel.class);
123
+ } catch (Exception ex) {
124
+ this.logger.error(ex.getMessage(), ex);
125
+ } finally {
126
+ return result;
127
+ }
128
+ }
129
+}
unipin_charge_service/src/main/resources/application-dev.properties
....@@ -0,0 +1,37 @@
1
+# EMBEDDED SERVER CONFIGURATION
2
+server.port=8978
3
+#JPA CONFIGURATION
4
+spring.datasource.url=jdbc:mysql://52.221.46.30:3310/db_unipin_carrier_billing
5
+spring.datasource.username=adzan_hutch
6
+spring.datasource.password=am9999
7
+spring.datasource.driver-class-name=com.mysql.jdbc.Driver
8
+
9
+spring.datasource.max-wait=10000
10
+spring.datasource.max-active=6
11
+spring.datasource.test-on-borrow=true
12
+spring.datasource.testWhileIdle=true
13
+spring.datasource.validationQuery=SELECT 1
14
+
15
+mybatis.config-location=classpath:mybatis/mybatis-config.xml
16
+logging.level.sample.mybatis.mapper=TRACE
17
+
18
+app.fetch.limit=10
19
+app.fetch.sleep=1000
20
+app.busy.sleep=200
21
+
22
+app.queue.executor.coresize=2
23
+app.queue.executor.maxsize=2
24
+
25
+hutch.fc.requesturl=http://10.17.91.160:7002/PMTApplyTariffbyCash
26
+hutch.fc.appid=000000011221
27
+
28
+bot.telegram.token=525607346:AAFTIWe92y8wS2zobmGpyR7ptmjgNbtcMFI
29
+bot.telegram.username=ami_unipin_bot
30
+
31
+app.wap.charging.ip=https://127.0.0.1:59443
32
+app.wap.charging.username=accessmobile
33
+app.wap.charging.password=querty2018!
34
+app.wap.charging.provider.code=101
35
+app.wap.charging.content.type=0612
36
+
37
+
unipin_charge_service/src/main/resources/application-prod.properties
....@@ -0,0 +1,37 @@
1
+# EMBEDDED SERVER CONFIGURATION
2
+server.port=8978
3
+#JPA CONFIGURATION
4
+spring.datasource.url=jdbc:mysql://172.31.14.107:3310/db_unipin_carrier_billing
5
+spring.datasource.username=adzan_hutch
6
+spring.datasource.password=am9999
7
+spring.datasource.driver-class-name=com.mysql.jdbc.Driver
8
+
9
+spring.datasource.max-wait=10000
10
+spring.datasource.max-active=6
11
+spring.datasource.test-on-borrow=true
12
+spring.datasource.testWhileIdle=true
13
+spring.datasource.validationQuery=SELECT 1
14
+
15
+mybatis.config-location=classpath:mybatis/mybatis-config.xml
16
+logging.level.sample.mybatis.mapper=TRACE
17
+
18
+app.fetch.limit=10
19
+app.fetch.sleep=1000
20
+app.busy.sleep=200
21
+
22
+app.queue.executor.coresize=2
23
+app.queue.executor.maxsize=2
24
+
25
+hutch.fc.requesturl=http://10.17.91.160:7002/PMTApplyTariffbyCash
26
+hutch.fc.appid=000000011221
27
+
28
+bot.telegram.token=525607346:AAFTIWe92y8wS2zobmGpyR7ptmjgNbtcMFI
29
+bot.telegram.username=ami_unipin_bot
30
+
31
+app.wap.charging.ip=https://180.214.234.112:9443
32
+app.wap.charging.username=accessmobile
33
+app.wap.charging.password=querty2018!
34
+app.wap.charging.provider.code=101
35
+app.wap.charging.content.type=0612
36
+
37
+
unipin_charge_service/src/main/resources/application.properties
....@@ -1,35 +1,4 @@
1
-# EMBEDDED SERVER CONFIGURATION
2
-server.port=8978
3
-#JPA CONFIGURATION
1
+spring.profiles.active=prod
42
5
-#spring.datasource.url=jdbc:mysql://localhost:3306/db_unipin_carrier_billing
6
-#spring.datasource.username=root
7
-#spring.datasource.password=root
8
-spring.datasource.url=jdbc:mysql://172.31.14.107:3310/db_unipin_carrier_billing
9
-spring.datasource.username=adzan_hutch
10
-spring.datasource.password=am9999
11
-spring.datasource.driver-class-name=com.mysql.jdbc.Driver
12
-
13
-spring.datasource.max-wait=10000
14
-spring.datasource.max-active=6
15
-spring.datasource.test-on-borrow=true
16
-spring.datasource.testWhileIdle=true
17
-spring.datasource.validationQuery=SELECT 1
18
-
19
-mybatis.config-location=classpath:mybatis/mybatis-config.xml
20
-logging.level.sample.mybatis.mapper=TRACE
21
-
22
-app.fetch.limit=10
23
-app.fetch.sleep=1000
24
-app.busy.sleep=200
25
-
26
-app.queue.executor.coresize=2
27
-app.queue.executor.maxsize=2
28
-
29
-hutch.fc.requesturl=http://10.17.91.160:7002/PMTApplyTariffbyCash
30
-hutch.fc.appid=000000011221
31
-
32
-bot.telegram.token=525607346:AAFTIWe92y8wS2zobmGpyR7ptmjgNbtcMFI
33
-bot.telegram.username=ami_unipin_bot
34
-
35
-
3
+app.whitelist=.*89690835978
4
+app.environtment="production"
unipin_charge_service/src/main/resources/logback.xml
....@@ -1,10 +1,10 @@
11 <?xml version="1.0" encoding="UTF-8"?>
22 <configuration>
33
4
- <property name="LOG_PATTERN" value="%d %-5level [%logger{20}] %msg%n" />
4
+ <property name="LOG_PATTERN" value="%d %-5level [%logger{20}] %msg%n"/>
55
66 <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
7
- <encoder>
7
+ <encoder>
88 <pattern>${LOG_PATTERN}</pattern>
99 </encoder>
1010 </appender>
....@@ -24,7 +24,12 @@
2424
2525
2626 <root level="info">
27
- <!--<appender-ref ref="STDOUT" />-->
28
- <appender-ref ref="FILE" />
27
+ <springProfile name="dev">
28
+ <appender-ref ref="STDOUT"/>
29
+ </springProfile>
30
+
31
+ <springProfile name="prod">
32
+ <appender-ref ref="FILE"/>
33
+ </springProfile>
2934 </root>
3035 </configuration>
unipin_charge_service/unipin-charge-service.iml
....@@ -11,15 +11,9 @@
1111 </content>
1212 <orderEntry type="inheritedJdk" />
1313 <orderEntry type="sourceFolder" forTests="false" />
14
- <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-devtools:1.3.5.RELEASE" level="project" />
15
- <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.3.5.RELEASE" level="project" />
16
- <orderEntry type="library" name="Maven: org.springframework:spring-core:4.2.6.RELEASE" level="project" />
17
- <orderEntry type="library" name="Maven: org.springframework:spring-context:4.2.6.RELEASE" level="project" />
18
- <orderEntry type="library" name="Maven: org.springframework:spring-aop:4.2.6.RELEASE" level="project" />
19
- <orderEntry type="library" name="Maven: aopalliance:aopalliance:1.0" level="project" />
20
- <orderEntry type="library" name="Maven: org.springframework:spring-beans:4.2.6.RELEASE" level="project" />
21
- <orderEntry type="library" name="Maven: org.springframework:spring-expression:4.2.6.RELEASE" level="project" />
22
- <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.3.5.RELEASE" level="project" />
14
+ <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-devtools:1.5.7.RELEASE" level="project" />
15
+ <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.5.7.RELEASE" level="project" />
16
+ <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.5.7.RELEASE" level="project" />
2317 <orderEntry type="library" name="Maven: com.hcpt.client:chargingGatewayClient:1.0" level="project" />
2418 <orderEntry type="library" name="Maven: javax.xml:jaxrpc-api:1.1" level="project" />
2519 <orderEntry type="library" name="Maven: com.sun.xml.rpc:jaxrpc-impl:1.1.3_01" level="project" />
....@@ -43,69 +37,79 @@
4337 <orderEntry type="library" name="Maven: org.telegram:telegrambots-meta:3.5" level="project" />
4438 <orderEntry type="library" name="Maven: com.google.inject:guice:4.1.0" level="project" />
4539 <orderEntry type="library" name="Maven: javax.inject:javax.inject:1" level="project" />
46
- <orderEntry type="library" name="Maven: com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.6.6" level="project" />
47
- <orderEntry type="library" name="Maven: com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:2.6.6" level="project" />
48
- <orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.6.6" level="project" />
49
- <orderEntry type="library" name="Maven: org.glassfish.jersey.media:jersey-media-json-jackson:2.22.2" level="project" />
50
- <orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-common:2.22.2" level="project" />
51
- <orderEntry type="library" name="Maven: org.glassfish.jersey.bundles.repackaged:jersey-guava:2.22.2" level="project" />
40
+ <orderEntry type="library" name="Maven: aopalliance:aopalliance:1.0" level="project" />
41
+ <orderEntry type="library" name="Maven: com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.8.10" level="project" />
42
+ <orderEntry type="library" name="Maven: com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:2.8.10" level="project" />
43
+ <orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.8.10" level="project" />
44
+ <orderEntry type="library" name="Maven: org.glassfish.jersey.media:jersey-media-json-jackson:2.25.1" level="project" />
45
+ <orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-common:2.25.1" level="project" />
46
+ <orderEntry type="library" name="Maven: org.glassfish.jersey.bundles.repackaged:jersey-guava:2.25.1" level="project" />
5247 <orderEntry type="library" name="Maven: org.glassfish.hk2:osgi-resource-locator:1.0.1" level="project" />
53
- <orderEntry type="library" name="Maven: org.glassfish.jersey.ext:jersey-entity-filtering:2.22.2" level="project" />
48
+ <orderEntry type="library" name="Maven: org.glassfish.jersey.ext:jersey-entity-filtering:2.25.1" level="project" />
5449 <orderEntry type="library" name="Maven: org.glassfish.jersey.containers:jersey-container-grizzly2-http:2.25.1" level="project" />
5550 <orderEntry type="library" name="Maven: org.glassfish.hk2.external:javax.inject:2.5.0-b32" level="project" />
5651 <orderEntry type="library" name="Maven: org.glassfish.grizzly:grizzly-http-server:2.3.28" level="project" />
5752 <orderEntry type="library" name="Maven: org.glassfish.grizzly:grizzly-http:2.3.28" level="project" />
5853 <orderEntry type="library" name="Maven: org.glassfish.grizzly:grizzly-framework:2.3.28" level="project" />
5954 <orderEntry type="library" name="Maven: javax.ws.rs:javax.ws.rs-api:2.0.1" level="project" />
60
- <orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-server:2.22.2" level="project" />
61
- <orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-client:2.22.2" level="project" />
62
- <orderEntry type="library" name="Maven: org.glassfish.jersey.media:jersey-media-jaxb:2.22.2" level="project" />
55
+ <orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-server:2.25.1" level="project" />
56
+ <orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-client:2.25.1" level="project" />
57
+ <orderEntry type="library" name="Maven: org.glassfish.jersey.media:jersey-media-jaxb:2.25.1" level="project" />
6358 <orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.2" level="project" />
64
- <orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-api:2.4.0-b34" level="project" />
65
- <orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-utils:2.4.0-b34" level="project" />
66
- <orderEntry type="library" name="Maven: org.glassfish.hk2.external:aopalliance-repackaged:2.4.0-b34" level="project" />
67
- <orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-locator:2.4.0-b34" level="project" />
68
- <orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" />
59
+ <orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-api:2.5.0-b32" level="project" />
60
+ <orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-utils:2.5.0-b32" level="project" />
61
+ <orderEntry type="library" name="Maven: org.glassfish.hk2.external:aopalliance-repackaged:2.5.0-b32" level="project" />
62
+ <orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-locator:2.5.0-b32" level="project" />
6963 <orderEntry type="library" name="Maven: org.json:json:20140107" level="project" />
70
- <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5.2" level="project" />
64
+ <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5.3" level="project" />
7165 <orderEntry type="library" name="Maven: commons-io:commons-io:2.5" level="project" />
66
+ <orderEntry type="library" name="Maven: org.springframework:spring-web:4.3.10.RELEASE" level="project" />
67
+ <orderEntry type="library" name="Maven: org.springframework:spring-aop:4.3.11.RELEASE" level="project" />
68
+ <orderEntry type="library" name="Maven: org.springframework:spring-beans:4.3.11.RELEASE" level="project" />
69
+ <orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.11.RELEASE" level="project" />
70
+ <orderEntry type="library" name="Maven: org.springframework:spring-expression:4.3.11.RELEASE" level="project" />
71
+ <orderEntry type="library" name="Maven: org.springframework:spring-core:4.3.11.RELEASE" level="project" />
7272 <orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:1.1.1" level="project" />
7373 <orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:1.1.1" level="project" />
7474 <orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.0" level="project" />
7575 <orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.0" level="project" />
76
- <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:1.3.5.RELEASE" level="project" />
77
- <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.3.5.RELEASE" level="project" />
78
- <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:1.3.5.RELEASE" level="project" />
79
- <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.7" level="project" />
80
- <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.1.7" level="project" />
81
- <orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.21" level="project" />
82
- <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.21" level="project" />
83
- <orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.21" level="project" />
84
- <orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.16" level="project" />
85
- <orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-jdbc:8.0.33" level="project" />
86
- <orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-juli:8.0.33" level="project" />
87
- <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:4.2.6.RELEASE" level="project" />
88
- <orderEntry type="library" name="Maven: org.springframework:spring-tx:4.2.6.RELEASE" level="project" />
89
- <orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.38" level="project" />
76
+ <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:1.5.7.RELEASE" level="project" />
77
+ <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.5.7.RELEASE" level="project" />
78
+ <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:1.5.7.RELEASE" level="project" />
79
+ <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.11" level="project" />
80
+ <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.1.11" level="project" />
81
+ <orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.25" level="project" />
82
+ <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
83
+ <orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.25" level="project" />
84
+ <orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.17" level="project" />
85
+ <orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-jdbc:8.5.20" level="project" />
86
+ <orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-juli:8.5.20" level="project" />
87
+ <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:4.3.11.RELEASE" level="project" />
88
+ <orderEntry type="library" name="Maven: org.springframework:spring-tx:4.3.11.RELEASE" level="project" />
89
+ <orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.44" level="project" />
9090 <orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.8" level="project" />
9191 <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.1.1" level="project" />
92
- <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.4" level="project" />
92
+ <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.6" level="project" />
9393 <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.4" level="project" />
94
- <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.2" level="project" />
95
- <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.9" level="project" />
94
+ <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.3" level="project" />
95
+ <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.10" level="project" />
9696 <orderEntry type="library" name="Maven: org.jsmpp:jsmpp:2.2.4" level="project" />
97
- <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.21" level="project" />
97
+ <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
9898 <orderEntry type="library" name="Maven: id.co.qhodok.tools:trigger:2.0" level="project" />
9999 <orderEntry type="library" name="Maven: org.reflections:reflections:0.9.11" level="project" />
100100 <orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
101
- <orderEntry type="library" name="Maven: org.javassist:javassist:3.18.1-GA" level="project" />
101
+ <orderEntry type="library" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
102102 <orderEntry type="library" name="Maven: org.zeromq:jeromq:0.4.2" level="project" />
103103 <orderEntry type="library" name="Maven: org.zeromq:jnacl:0.1.0" level="project" />
104
- <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.3.1" level="project" />
104
+ <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.1" level="project" />
105105 <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-mapper-asl:1.9.13" level="project" />
106106 <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-core-asl:1.9.13" level="project" />
107
- <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.6.6" level="project" />
108
- <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.6.6" level="project" />
109
- <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.6.6" level="project" />
107
+ <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.10" level="project" />
108
+ <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.0" level="project" />
109
+ <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.10" level="project" />
110
+ <orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:5.2.4.Final" level="project" />
111
+ <orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" />
112
+ <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.1.Final" level="project" />
113
+ <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.4" level="project" />
110114 </component>
111115 </module>