You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by my...@apache.org on 2018/06/21 16:19:17 UTC
[fineract-cn-notifications] 09/15: update
This is an automated email from the ASF dual-hosted git repository.
myrle pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-notifications.git
commit a62f69fb15d5b4d1e181e22b0fbb1f04f83b6c10
Author: Ebenezer Graham <eg...@alustudent.com>
AuthorDate: Fri Jun 15 01:09:12 2018 +0400
update
---
.../notification/api/v1/domain/Notification.java | 76 ----------------------
.../api/v1/events/NotificationEventConstants.java | 4 --
.../service/NotificationConfiguration.java | 2 +
.../service/internal/service/SMSSender.java | 20 +++---
service/src/main/resources/application.yml | 5 +-
5 files changed, 18 insertions(+), 89 deletions(-)
diff --git a/api/src/main/java/org/apache/fineract/cn/notification/api/v1/domain/Notification.java b/api/src/main/java/org/apache/fineract/cn/notification/api/v1/domain/Notification.java
deleted file mode 100644
index c685c5a..0000000
--- a/api/src/main/java/org/apache/fineract/cn/notification/api/v1/domain/Notification.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.cn.notification.api.v1.domain;
-
-import java.util.Objects;
-import org.apache.fineract.cn.lang.validation.constraints.ValidIdentifier;
-import org.hibernate.validator.constraints.Length;
-
-@SuppressWarnings({"WeakerAccess", "unused"})
-public class Notification {
- @ValidIdentifier
- private String identifier;
- @Length(max = 512)
- private String payload;
-
- private String recipient;
-
- private String message;
-
- public Notification() {
- super();
- }
-
- public static Notification create(final String identifier, final String payload) {
- final Notification notification = new Notification();
- notification.setIdentifier(identifier);
- notification.setPayload(payload);
- return notification;
- }
-
- public String getIdentifier() {
- return this.identifier;
- }
-
- public void setIdentifier(final String identifier) {
- this.identifier = identifier;
- }
-
- public String getPayload() {
- return payload;
- }
-
- public void setPayload(String payload) {
- this.payload = payload;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- Notification notification = (Notification) o;
- return Objects.equals(identifier, notification.identifier) &&
- Objects.equals(payload, notification.payload);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(identifier, payload);
- }
-}
diff --git a/api/src/main/java/org/apache/fineract/cn/notification/api/v1/events/NotificationEventConstants.java b/api/src/main/java/org/apache/fineract/cn/notification/api/v1/events/NotificationEventConstants.java
index 3f351c6..39c6eb0 100644
--- a/api/src/main/java/org/apache/fineract/cn/notification/api/v1/events/NotificationEventConstants.java
+++ b/api/src/main/java/org/apache/fineract/cn/notification/api/v1/events/NotificationEventConstants.java
@@ -28,8 +28,4 @@ public interface NotificationEventConstants {
String SELECTOR_INITIALIZE = SELECTOR_NAME + " = '" + INITIALIZE + "'";
String SELECTOR_POST_SAMPLE = SELECTOR_NAME + " = '" + POST_SAMPLE + "'";
- //Customer constants;
- String CUSTOMER_DESTINATION = "customer-v1";
- String SELECTOR_POST_CUSTOMER = SELECTOR_NAME + " = 'post-customer'";
-
}
diff --git a/service/src/main/java/org/apache/fineract/cn/notification/service/NotificationConfiguration.java b/service/src/main/java/org/apache/fineract/cn/notification/service/NotificationConfiguration.java
index 01aa6d3..c38d6bd 100644
--- a/service/src/main/java/org/apache/fineract/cn/notification/service/NotificationConfiguration.java
+++ b/service/src/main/java/org/apache/fineract/cn/notification/service/NotificationConfiguration.java
@@ -79,6 +79,8 @@ public class NotificationConfiguration extends WebMvcConfigurerAdapter {
configurer.setUseSuffixPatternMatch(Boolean.FALSE);
}
+
+
@Bean
@Qualifier("gmail")
public JavaMailSender getJavaMailSender() {
diff --git a/service/src/main/java/org/apache/fineract/cn/notification/service/internal/service/SMSSender.java b/service/src/main/java/org/apache/fineract/cn/notification/service/internal/service/SMSSender.java
index 6bf7558..d626b22 100644
--- a/service/src/main/java/org/apache/fineract/cn/notification/service/internal/service/SMSSender.java
+++ b/service/src/main/java/org/apache/fineract/cn/notification/service/internal/service/SMSSender.java
@@ -23,23 +23,27 @@ import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Message;
import com.twilio.type.PhoneNumber;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
import com.twilio.rest.api.v2010.account.MessageCreator;
import org.springframework.stereotype.Service;
@Service
+@ConfigurationProperties(prefix ="smssender")
public class SMSSender {
- @Value(value = "${smssender.accountSID}")
- public static String ACCOUNT_SID;
+ //@Value(value = "${smssender.accountSID}")
+ public String ACCOUNT_SID = "AC1fde2c6f26f367b93231c5fdb944c908";
- @Value("${smssender.authToken}")
- public static String AUTH_TOKEN;
+ //@Value("${smssender.authToken}")
+ public String AUTH_TOKEN = "bc9a53e41745b8471e0ecafc859d86aa";
- @Value("${mfi.senderNumber}")
- public static String sender;
+ //@Value("${smssender.senderNumber}")
+ public String sender = "+1 510-944-1898";
- @Value("${fineract.customer.accountcreated}")
- public String template;
+ //@Value("${fineract.customer.accountcreated}")
+
+ public String template = "Test from the demo-server";
public void sendSMS(String receiver, String template) {
diff --git a/service/src/main/resources/application.yml b/service/src/main/resources/application.yml
index 37acaaf..ec163fc 100644
--- a/service/src/main/resources/application.yml
+++ b/service/src/main/resources/application.yml
@@ -75,4 +75,7 @@ fineract:
accountclosed:
message: Dear Valued Customer, Your account has been successfully closed.
-
+smssender:
+ accountSID: AC1fde2c6f26f367b93231c5fdb944c908
+ authtoken: bc9a53e41745b8471e0ecafc859d86aa
+ senderNumber: +1 510-944-1898