Permana
2018-03-27 f3d69646a3b662571dc8fe2924308e7b313da52e
wap charging
3 files modified
1 files added
20 ■■■■ changed files
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/Application.java 2 ●●●●● patch | view | raw | blame | history
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/service/ClientWapChargingService.java 4 ●●●● patch | view | raw | blame | history
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/tedt.java 7 ●●●●● patch | view | raw | blame | history
unipin_charge_service/unipin-charge-service.iml 7 ●●●● patch | view | raw | blame | history
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/Application.java
....@@ -9,6 +9,7 @@
99 import org.springframework.boot.autoconfigure.SpringBootApplication;
1010 import org.springframework.boot.context.properties.EnableConfigurationProperties;
1111 import org.springframework.context.annotation.Configuration;
12
+import org.springframework.scheduling.annotation.EnableScheduling;
1213
1314 import javax.annotation.PostConstruct;
1415 import javax.net.ssl.*;
....@@ -27,6 +28,7 @@
2728 @SpringBootApplication
2829 @EnableAutoConfiguration
2930 @EnableConfigurationProperties
31
3032 public class Application {
3133
3234 private static final Logger log = LoggerFactory.getLogger(Application.class);
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/service/ClientWapChargingService.java
....@@ -58,7 +58,7 @@
5858
5959 @Scheduled(fixedDelay = 10 * 1000)
6060 protected void scheduleRefreshToken() {
61
- if (System.currentTimeMillis() - this.nextRefreshToken < 10 * 1000) {
61
+ if (this.nextRefreshToken - System.currentTimeMillis() < 10 * 1000) {
6262 synchronized (this.accessTokenGeneratedKey) {
6363 this.logger.info("send refresh token");
6464 RestTemplate restTemplate = new RestTemplate();
....@@ -70,7 +70,6 @@
7070 param.add("refresh_token", this.nextAccessTokenRefresh);
7171 HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(param, headers);
7272 ResponseEntity<String> response = restTemplate.postForEntity(this.ip + "/token/", request, String.class);
73
- System.out.println(response.getBody());
7473 if (response.getStatusCode() == HttpStatus.OK) {
7574 RefreshToken tokenResponse = this.gson.fromJson(response.getBody().trim(), RefreshToken.class);
7675 this.nextAccessTokenRefresh = tokenResponse.getRefresh_token();
....@@ -125,6 +124,7 @@
125124 headers.setContentType(MediaType.APPLICATION_JSON);
126125 HttpEntity<String> request = new HttpEntity<>(this.gson.toJson(requestPayment), headers);
127126 ResponseEntity<String> response = restTemplate.postForEntity(this.ip + "/payment/", request, String.class);
127
+ this.logger.info("response " + response.getBody().trim());
128128 result = this.gson.fromJson(response.getBody().trim(), ResponseOneStepPaymentModel.class);
129129 } catch (Exception ex) {
130130 this.logger.error(ex.getMessage(), ex);
unipin_charge_service/src/main/java/id/co/accessmobile/carrier/billling/unipin/chargingservice/tedt.java
....@@ -0,0 +1,7 @@
1
+package id.co.accessmobile.carrier.billling.unipin.chargingservice;
2
+
3
+public class tedt {
4
+ public static void main(String[] ags){
5
+ System.out.println(System.currentTimeMillis());
6
+ }
7
+}
unipin_charge_service/unipin-charge-service.iml
....@@ -1,6 +1,11 @@
11 <?xml version="1.0" encoding="UTF-8"?>
22 <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
- <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
3
+ <component name="FacetManager">
4
+ <facet type="Spring" name="Spring">
5
+ <configuration />
6
+ </facet>
7
+ </component>
8
+ <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
49 <output url="file://$MODULE_DIR$/target/classes" />
510 <output-test url="file://$MODULE_DIR$/target/test-classes" />
611 <content url="file://$MODULE_DIR$">