Skip to content
Permalink
Browse files
to test customer
  • Loading branch information
ebenezergraham committed Jun 15, 2018
1 parent eb95c41 commit 5e44714f25b138c77fe4f08df54d4f3e66414d86
Showing 3 changed files with 29 additions and 47 deletions.
@@ -54,5 +54,4 @@ public void sendSMS(String receiver, String template) {
System.out.println(message.getSid());
System.out.println(message.getStatus());
}

}
@@ -31,7 +31,7 @@
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Component;


@SuppressWarnings("unused")
@Component
public class CustomerEventListener {

@@ -40,11 +40,11 @@ public class CustomerEventListener {
private EmailSender emailSender;

@Autowired
public CustomerEventListener( final CustomerManager customerManager, SMSSender smsSender,
final EmailSender emailSender ) {
public CustomerEventListener( final CustomerManager customerManager, SMSSender smsSender, EmailSender emailSender ) {
this.customerManager = customerManager;
this.smsSender = smsSender;
this.emailSender = emailSender;
smsSender.sendSMS("+23058409206","just to be sure listen has been instantiated");
}

@JmsListener(
@@ -53,8 +53,9 @@ public CustomerEventListener( final CustomerManager customerManager, SMSSender s
)
public void customerCreatedEvent(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
final String payload) {

System.out.println(payload);
Customer customer = customerManager.findCustomer(payload);
System.out.println("This is the customer created: " + customer.getGivenName());
if (customer.getContactDetails().size() > 0) {
customer.getContactDetails().forEach(contactDetail -> {
if (contactDetail.getType().equals(ContactDetail.Type.PHONE)) {
@@ -174,27 +175,4 @@ public void customerReopenedEvent(@Header(TenantHeaderFilter.TENANT_HEADER) fina
});
}
}

/*
@JmsListener(
destination = CustomerEventConstants.DESTINATION,
selector = CustomerEventConstants.SELECTOR_PUT_ADDRESS
)
public void addressChangedEvent(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
final String payload) {
this.eventRecorder.event(tenant, CustomerEventConstants.PUT_ADDRESS, payload, String.class);
}
@JmsListener(
destination = CustomerEventConstants.DESTINATION,
selector = CustomerEventConstants.SELECTOR_PUT_IDENTIFICATION_CARD
)
public void identificationCardChangedEvent(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
final String payload) {
this.eventRecorder.event(tenant, CustomerEventConstants.PUT_IDENTIFICATION_CARD, payload, String.class);
}
*/
}
@@ -1,4 +1,4 @@
package org.apache.fineract.cn.notification.service.listener;/*
/*
* 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
@@ -16,31 +16,41 @@
* specific language governing permissions and limitations
* under the License.
*/
/*
package org.apache.fineract.cn.notification.service.listener;

import org.apache.fineract.cn.group.api.v1.EventConstants;
import org.apache.fineract.cn.individuallending.api.v1.events.IndividualLoanEventConstants;
import org.apache.fineract.cn.lang.config.TenantHeaderFilter;
import org.apache.fineract.cn.notification.service.internal.service.EmailSender;
import org.apache.fineract.cn.notification.service.internal.service.SMSSender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Component;
import org.apache.fineract.cn.portfolio.api.v1.client.PortfolioManager;

@SuppressWarnings("unused")
@Component
public class PortfolioEventListener {

private PortfolioManager portfolioManager;
private SMSSender smsSender;
private EmailSender emailSender;

@Autowired
public PortfolioEventListener() {
public PortfolioEventListener(PortfolioManager portfolioManager, SMSSender smsSender, EmailSender emailSender) {
super();
//PortfolioManager portfolioManager = new PortfolioManager();
this.portfolioManager = portfolioManager;
this.smsSender = smsSender;
this.emailSender = emailSender;
}

@JmsListener(
subscription = IndividualLoanEventConstants.DESTINATION,
destination = IndividualLoanEventConstants.DESTINATION,
selector = IndividualLoanEventConstants.SELECTOR_DENY_INDIVIDUALLOAN_CASE
)
public void onDeny(//@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
final String payload) {
public void onDeny(final String payload) {

}

@@ -49,7 +59,7 @@ public void onDeny(//@Header(TenantHeaderFilter.TENANT_HEADER) final String tena
destination = IndividualLoanEventConstants.DESTINATION,
selector = IndividualLoanEventConstants.SELECTOR_APPROVE_INDIVIDUALLOAN_CASE
)
public void onApprove(//@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
public void onApprove(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
final String payload) {

}
@@ -59,7 +69,7 @@ public void onApprove(//@Header(TenantHeaderFilter.TENANT_HEADER) final String t
destination = IndividualLoanEventConstants.DESTINATION,
selector = IndividualLoanEventConstants.SELECTOR_ACCEPT_PAYMENT_INDIVIDUALLOAN_CASE
)
public void onAcceptPayment(//@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
public void onAcceptPayment(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
final String payload) {
}

@@ -69,7 +79,7 @@ public void onAcceptPayment(//@Header(TenantHeaderFilter.TENANT_HEADER) final St
destination = IndividualLoanEventConstants.DESTINATION,
selector = IndividualLoanEventConstants.SELECTOR_DISBURSE_INDIVIDUALLOAN_CASE
)
public void onDisburse(//@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
public void onDisburse(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
final String payload) {

}
@@ -79,7 +89,7 @@ public void onDisburse(//@Header(TenantHeaderFilter.TENANT_HEADER) final String
destination = IndividualLoanEventConstants.DESTINATION,
selector = IndividualLoanEventConstants.SELECTOR_CHECK_LATE_INDIVIDUALLOAN_CASE
)
public void onCheckLate(//@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
public void onCheckLate(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
final String payload) {

}
@@ -99,7 +109,7 @@ public void onOpen(//@Header(TenantHeaderFilter.TENANT_HEADER) final String tena
destination = IndividualLoanEventConstants.DESTINATION,
selector = IndividualLoanEventConstants.SELECTOR_MARK_LATE_INDIVIDUALLOAN_CASE
)
public void onMarkLate(//@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
public void onMarkLate(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
final String payload) {

}
@@ -109,20 +119,18 @@ public void onMarkLate(//@Header(TenantHeaderFilter.TENANT_HEADER) final String
destination = IndividualLoanEventConstants.DESTINATION,
selector = IndividualLoanEventConstants.SELECTOR_CLOSE_INDIVIDUALLOAN_CASE
)
public void onClose(//@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
public void onClose(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
final String payload) {
}

@JmsListener(
@JmsListener(
subscription = EventConstants.DESTINATION,
destination = EventConstants.DESTINATION,
selector = EventConstants.SELECTOR_POST_GROUP
)
public void onGroupCreated(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
final String payload) {
this.eventRecorder.event(tenant, EventConstants.POST_GROUP, payload, String.class);

}

@JmsListener(
@@ -132,7 +140,6 @@ public void onGroupCreated(@Header(TenantHeaderFilter.TENANT_HEADER) final Strin
)
public void onGroupActivated(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
final String payload) {
this.eventRecorder.event(tenant, EventConstants.ACTIVATE_GROUP, payload, String.class);
}

@JmsListener(
@@ -142,8 +149,6 @@ public void onGroupActivated(@Header(TenantHeaderFilter.TENANT_HEADER) final Str
)
public void onGroupUpdated(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
final String payload) {
this.eventRecorder.event(tenant, EventConstants.PUT_GROUP, payload, String.class);
}

}
*/

0 comments on commit 5e44714

Please sign in to comment.