@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils ;
import org.slf4j.Logger ;
import org.slf4j.LoggerFactory ;
import org.springframework.beans.factory.annotation.Value ;
import org.springframework.stereotype.Service ;
import java.net.URLDecoder ;
@ -28,6 +29,10 @@ public class MailGunServiceImpl implements MailGunService {
@Resource
private MailGunClient mailGunClient ;
@Value ( "${mail.mailgun.default.merchantlist}" )
private String mailListDefault ;
@Override
public void dealNotify ( String nofityString ) throws Exception {
String dd = URLDecoder . decode ( nofityString , "UTF-8" ) ;
@ -59,7 +64,7 @@ public class MailGunServiceImpl implements MailGunService {
JSONObject var = new JSONObject ( ) ;
var . put ( "client_moniker" , client . getString ( "client_moniker" ) ) ;
var . put ( "short_name" , client . getString ( "short_name" ) ) ;
result = mailGunClient . addListMember ( client . getString ( "contact_email" ) , "merchants" , client . getString ( "contact_person" ) , var ) ;
result = mailGunClient . addListMember ( client . getString ( "contact_email" ) , mailListDefault , client . getString ( "contact_person" ) , var ) ;
} catch ( Exception ignore ) {
logger . info ( "add Mail List Failed email:" + client . getString ( "contact_email" ) + " client_moniker:" + client . getString ( "client_moniker" ) ) ;
}
@ -73,7 +78,7 @@ public class MailGunServiceImpl implements MailGunService {
JSONObject var = new JSONObject ( ) ;
var . put ( "client_moniker" , newClient . getString ( "client_moniker" ) ) ;
var . put ( "short_name" , newClient . getString ( "short_name" ) ) ;
result = mailGunClient . updateClientOfMailList ( newClient . getString ( "contact_email" ) , "merchants" , newClient . getString ( "contact_person" ) , oldClient . getString ( "contact_email" ) , var ) ;
result = mailGunClient . updateClientOfMailList ( newClient . getString ( "contact_email" ) , mailListDefault , newClient . getString ( "contact_person" ) , oldClient . getString ( "contact_email" ) , var ) ;
} catch ( Exception ignore ) {
logger . info ( "Modify Mail List Failed oldEmail:" + oldClient . getString ( "contact_email" ) + " client_moniker:" + newClient . getString ( "client_moniker" ) + " newEmail:" + newClient . getString ( "contact_email" ) ) ;
}