listAllTokens(JSONObject devToken);
diff --git a/src/main/java/au/com/royalpay/payment/manage/pushMessage/APNSMessageHelper.java b/src/main/java/au/com/royalpay/payment/manage/pushMessage/APNSMessageHelper.java
index 781fc0776..fd8e7e733 100644
--- a/src/main/java/au/com/royalpay/payment/manage/pushMessage/APNSMessageHelper.java
+++ b/src/main/java/au/com/royalpay/payment/manage/pushMessage/APNSMessageHelper.java
@@ -3,14 +3,12 @@ package au.com.royalpay.payment.manage.pushMessage;
import com.alibaba.fastjson.JSONObject;
import com.notnoop.apns.APNS;
import com.notnoop.apns.ApnsService;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
-import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -21,28 +19,28 @@ import java.io.InputStream;
public class APNSMessageHelper {
private Logger logger = LoggerFactory.getLogger(getClass());
- @Value("classpath:apple_message_cert_dev.p12")
- private org.springframework.core.io.Resource appleMessageFileDev;
- @Value("${apple.message.apns.file}")
- private String appleApnsFile;
+ @Value("${apple.message.apns.file:classpath:apple_message_cert_dev.p12}")
+ private Resource appleApnsFile;
@Value("${apple.message.apns.password}")
private String appleMessagePassword;
public void sendAppleMessage(String title, String body, String token, JSONObject data, JSONObject type) throws IOException {
/**设置参数,发送数据**/
- InputStream keyIns = new FileInputStream(new File(appleApnsFile));
- ApnsService service = APNS.newService().withCert(keyIns, appleMessagePassword).withProductionDestination().build();
- String payload = APNS.newPayload().alertTitle(title).alertBody(body).badge(1).sound("default").customField("data", data).customField("type", type).build();
- service.push(token, payload);
- logger.debug("推送信息已发送!");
+ try (InputStream keyIns = appleApnsFile.getInputStream()) {
+ ApnsService service = APNS.newService().withCert(keyIns, appleMessagePassword).withProductionDestination().build();
+ String payload = APNS.newPayload().alertTitle(title).alertBody(body).badge(1).sound("default").customField("data", data).customField("type", type).build();
+ service.push(token, payload);
+ logger.debug("推送信息已发送!");
+ }
}
public void sendAppleMessageDetail(String title, String body, String token, JSONObject data, JSONObject type) throws IOException {
/**设置参数,发送数据**/
- InputStream keyIns = new FileInputStream(new File(appleApnsFile));
- ApnsService service = APNS.newService().withCert(keyIns, appleMessagePassword).withProductionDestination().build();
- String payload = APNS.newPayload().alertTitle(title).alertBody(body).category("myNotificationCategory").badge(1).sound("default").customField("data", data).customField("type", type).build();
- service.push(token, payload);
- logger.debug("推送信息已发送!");
+ try (InputStream keyIns = appleApnsFile.getInputStream()) {
+ ApnsService service = APNS.newService().withCert(keyIns, appleMessagePassword).withProductionDestination().build();
+ String payload = APNS.newPayload().alertTitle(title).alertBody(body).category("myNotificationCategory").badge(1).sound("default").customField("data", data).customField("type", type).build();
+ service.push(token, payload);
+ logger.debug("推送信息已发送!");
+ }
}
}
diff --git a/src/main/resources/apple_message_cert_dev.p12 b/src/main/resources/apple_message_cert_dev.p12
index 905e2cc1f..922b88d93 100644
Binary files a/src/main/resources/apple_message_cert_dev.p12 and b/src/main/resources/apple_message_cert_dev.p12 differ
diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientDeviceTokenMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientDeviceTokenMapper.xml
index 7ffa9c3b2..75354ab53 100644
--- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientDeviceTokenMapper.xml
+++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientDeviceTokenMapper.xml
@@ -20,7 +20,6 @@
FROM sys_clients_devices_token t
INNER JOIN sys_clients_devices d ON t.dev_id = d.dev_id and d.account_id=#{account_id} and d.is_offline=0
WHERE t.is_valid = 1
- GROUP BY token
diff --git a/src/main/ui/static/payment/kyc/templates/bd_help_client_progress.html b/src/main/ui/static/payment/kyc/templates/bd_help_client_progress.html
index 6f595729e..658c733da 100644
--- a/src/main/ui/static/payment/kyc/templates/bd_help_client_progress.html
+++ b/src/main/ui/static/payment/kyc/templates/bd_help_client_progress.html
@@ -92,12 +92,12 @@
Please Choose
Passport
- Driver's license
+ Driver license
Please select the file type for uploading the ID.
Uploading your passport file requires you to upload your utility bill file.
- You can upload your driver's license and leave the utility bill file blank.
+ You can upload your driver license and leave the utility bill file blank.
请选择上传ID的文件类型.
上传护照文件需要您上传水电煤账单文件.
上传驾照,水电煤账单文件可以不填.
diff --git a/src/main/ui/static/payment/kyc/templates/client_kyc_files_progress.html b/src/main/ui/static/payment/kyc/templates/client_kyc_files_progress.html
index 14508f1b8..34d84fc6e 100644
--- a/src/main/ui/static/payment/kyc/templates/client_kyc_files_progress.html
+++ b/src/main/ui/static/payment/kyc/templates/client_kyc_files_progress.html
@@ -62,16 +62,16 @@
ng-model="file.id_type" style="width: 250px" ng-change="setSession(file.id_type)">
Please Choose
Passport
- Driver's license
+ Driver license
Passport
-
Driver's license
+
Driver license
Please select the file type for uploading the ID.
Uploading your passport file requires you to upload your utility bill file.
- You can upload your driver's license and leave the utility bill file blank.
+ You can upload your driver license and leave the utility bill file blank.
请选择上传ID的文件类型.
上传护照文件需要您上传水电煤账单文件.
上传驾照,水电煤账单文件可以不填.
diff --git a/src/main/ui/static/payment/kyc/templates/partner_kyc_files.html b/src/main/ui/static/payment/kyc/templates/partner_kyc_files.html
index 319bd889b..2b83f323c 100644
--- a/src/main/ui/static/payment/kyc/templates/partner_kyc_files.html
+++ b/src/main/ui/static/payment/kyc/templates/partner_kyc_files.html
@@ -59,7 +59,7 @@
diff --git a/src/main/ui/static/payment/partner/templates/client_compliance_files.html b/src/main/ui/static/payment/partner/templates/client_compliance_files.html
index e8dd8a539..7dfb73822 100644
--- a/src/main/ui/static/payment/partner/templates/client_compliance_files.html
+++ b/src/main/ui/static/payment/partner/templates/client_compliance_files.html
@@ -70,7 +70,7 @@
ng-model="file.id_type" style="width: 250px" ng-change="setSession(file.id_type)">
Please Choose
Passport
- Driver's license
+ Driver license
If client have already attached surcharge in their own system, ignore this choice.
diff --git a/src/main/ui/static/payment/partner/templates/client_kyc_files_to_auth.html b/src/main/ui/static/payment/partner/templates/client_kyc_files_to_auth.html
index bca089e7c..cc34ada65 100644
--- a/src/main/ui/static/payment/partner/templates/client_kyc_files_to_auth.html
+++ b/src/main/ui/static/payment/partner/templates/client_kyc_files_to_auth.html
@@ -79,7 +79,7 @@
diff --git a/src/test/java/au/com/royalpay/payment/manage/valid/APNSTest.java b/src/test/java/au/com/royalpay/payment/manage/valid/APNSTest.java
new file mode 100644
index 000000000..df0dea049
--- /dev/null
+++ b/src/test/java/au/com/royalpay/payment/manage/valid/APNSTest.java
@@ -0,0 +1,46 @@
+package au.com.royalpay.payment.manage.valid;
+
+import au.com.royalpay.payment.tools.device.message.AppMessage;
+import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.notnoop.apns.APNS;
+import com.notnoop.apns.ApnsService;
+import org.apache.commons.lang3.StringUtils;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.UUID;
+
+/**
+ * Create by davep at 2020-01-06 16:04
+ */
+public class APNSTest {
+ @Test
+ public void test() throws IOException {
+ String appleMessagePassword = "BSNMNkxPq0AT";
+ AppMessage msg = new AppMessage("MESSAGE","test","test content");
+ JSONObject data = new JSONObject();
+ data.put("send_type","rloan_creditFinished");
+ msg.setData(data);
+ JSONObject typeData = new JSONObject();
+ typeData.put("send_type","MESSAGE");
+ typeData.put("id", UUID.randomUUID().toString());
+ msg.setTypeData(typeData);
+ URL cert = getClass().getClassLoader().getResource("rloan_dev_apns.p12");
+ try(InputStream keyIns = cert.openStream()) {
+ ApnsService service = APNS.newService().withCert(keyIns, appleMessagePassword)
+ .withSandboxDestination().build();
+ String payload = APNS.newPayload().alertTitle("test").alertBody("test")
+ .badge(1).sound("default").customField("data", msg.getData()).customField("type", msg.getTypeData()).build();
+ JSONObject p = JSON.parseObject(payload);
+ JSONObject aps = p.getJSONObject("aps");
+ aps.put("mutable-content", "1");
+ service.push("486A623E9A5AC2EB28DFBF3C827979293E9E9F9E1252603E7E1F8C878695FA57", p.toJSONString());
+ }
+ }
+}
diff --git a/src/test/resources/apple_message_cert_dev.p12 b/src/test/resources/apple_message_cert_dev.p12
new file mode 100644
index 000000000..922b88d93
Binary files /dev/null and b/src/test/resources/apple_message_cert_dev.p12 differ