diff --git a/BcnxWebService/.settings/com.springsource.sts.config.flow.prefs b/BcnxWebService/.settings/com.springsource.sts.config.flow.prefs
index 597cf1d..6b7abb0 100644
--- a/BcnxWebService/.settings/com.springsource.sts.config.flow.prefs
+++ b/BcnxWebService/.settings/com.springsource.sts.config.flow.prefs
@@ -1,5 +1,5 @@
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/BcnxWebService/batch/batchContext.xml=\r\n\r\n\r\n\r\n\r\n\r\n
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/BcnxWebService/batch/batch_configure.xml=\r\n\r\n\r\n\r\n\r\n\r\n
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/BcnxWebService/webapp/WEB-INF/quartz/batch_context.xml=\r\n
-//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/BcnxWebService/webapp/WEB-INF/quartz/batch_job_context.xml=\r\n\r\n\r\n\r\n\r\n\r\n
+//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/BcnxWebService/webapp/WEB-INF/quartz/batch_job_context.xml=\r\n\r\n\r\n\r\n\r\n\r\n
eclipse.preferences.version=1
diff --git a/BcnxWebService/.springBeans b/BcnxWebService/.springBeans
index 8776e37..2724c88 100644
--- a/BcnxWebService/.springBeans
+++ b/BcnxWebService/.springBeans
@@ -25,6 +25,8 @@
batch/batch_configure.xml
webapp/WEB-INF/quartz/batch_job_context.xml
webapp/WEB-INF/quartz/batch_job_scheduler.xml
+ webapp/WEB-INF/proccode_context.xml
+ webapp/WEB-INF/exception_context.xml
diff --git a/BcnxWebService/configure/applicationContext.xml b/BcnxWebService/configure/applicationContext.xml
index 0d3a97e..72e0bf7 100644
--- a/BcnxWebService/configure/applicationContext.xml
+++ b/BcnxWebService/configure/applicationContext.xml
@@ -23,5 +23,6 @@
+
diff --git a/BcnxWebService/configure/proccode_context.xml b/BcnxWebService/configure/proccode_context.xml
new file mode 100644
index 0000000..66d280b
--- /dev/null
+++ b/BcnxWebService/configure/proccode_context.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BcnxWebService/queries/BcnxSettle.hbm.xml b/BcnxWebService/queries/BcnxSettle.hbm.xml
index b41b70d..c9322ea 100644
--- a/BcnxWebService/queries/BcnxSettle.hbm.xml
+++ b/BcnxWebService/queries/BcnxSettle.hbm.xml
@@ -3,13 +3,32 @@
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+
+ from BcnxSettle b where b.date = :date and b.iss = :id and b.res = '00' and b.acq != '002587' and b.rrn
+ not in (select bb.rrn from BcnxSettle bb where bb.date =:date and bb.iss = :id and bb.mti = '0420' )
+ order by b.time
+
+
+ from BcnxSettle b where b.date = :date and b.acq = :id and b.res = '00' and b.iss != '002587' and b.rrn
+ not in (select bb.rrn from BcnxSettle bb where bb.date =:date and bb.acq = :id and bb.mti = '0420' )
+ order by b.time
+
+
+ from BcnxSettle b where b.date = :date and ( b.acq =:id or b.iss =:id )and b.res = '00' and b.mti = '0420' and
+ (b.iss!='002587' or b.acq!='002587') order by b.time
+
+
+ from BcnxSettle b where b.date = :date and ( b.acq =:id or b.iss =:id )and b.res !='00' and b.mti = '0200'
+ and (b.iss!='002587' or b.acq!='002587') and b.rrn not in
+ ( select bb.rrn from BcnxSettle bb where bb.date =:date and bb.acq = :id and bb.mti = '0420' ) order by b.time
+
from BcnxSettle b where b.rrn = :rrn and b.mti = :mti and b.stan = :stan and b.slot = :slot
- from BcnxSettle bs where bs.card like :card or bs.rrn like :rrn or bs.stan like :stan or bs.date between :start and :end
+ from BcnxSettle bs where bs.card like :card and bs.rrn like :rrn and bs.stan like :stan and bs.date between :start and :end
- select count(bs) from BcnxSettle bs where bs.card like :card or bs.rrn like :rrn or bs.stan like :stan or bs.date between :start and :end
+ select count(bs) from BcnxSettle bs where bs.card like :card and bs.rrn like :rrn and bs.stan like :stan and bs.date between :start and :end
\ No newline at end of file
diff --git a/BcnxWebService/queries/DisputeTxn.hbm.xml b/BcnxWebService/queries/DisputeTxn.hbm.xml
index d603ae5..7f5cd54 100644
--- a/BcnxWebService/queries/DisputeTxn.hbm.xml
+++ b/BcnxWebService/queries/DisputeTxn.hbm.xml
@@ -34,7 +34,7 @@
select d.* from disputetxn d , bcnxsetl b where d.bcnxsetl_slot = b.slot and d.bcnxsetl_stan = b.stan and d.bcnxsetl_rrn = b.rrn and d.bcnxsetl_mti = b.mti and d.bcnxsetl_procc = b.procc and d.procc = '700001' and b.issid = :id
union
select d.* from disputetxn d , bcnxsetl b where d.bcnxsetl_slot = b.slot and d.bcnxsetl_stan = b.stan and d.bcnxsetl_rrn = b.rrn and d.bcnxsetl_mti = b.mti and d.bcnxsetl_procc = b.procc and d.procc = '800001' and b.issid = :id
- ) t order by t.time, t.date desc
+ ) t order by t.date desc
]]>
@@ -57,42 +57,42 @@
@@ -109,7 +109,7 @@
union select d.* from disputetxn d , bcnxsetl b where d.bcnxsetl_slot = b.slot and d.bcnxsetl_stan = b.stan and d.bcnxsetl_rrn = b.rrn and d.bcnxsetl_mti = b.mti and d.bcnxsetl_procc = b.procc and d.procc = '600001' and b.issid = :id
union select d.* from disputetxn d , bcnxsetl b where d.bcnxsetl_slot = b.slot and d.bcnxsetl_stan = b.stan and d.bcnxsetl_rrn = b.rrn and d.bcnxsetl_mti = b.mti and d.bcnxsetl_procc = b.procc and d.procc = '700001' and b.acqid = :id
union select d.* from disputetxn d , bcnxsetl b where d.bcnxsetl_slot = b.slot and d.bcnxsetl_stan = b.stan and d.bcnxsetl_rrn = b.rrn and d.bcnxsetl_mti = b.mti and d.bcnxsetl_procc = b.procc and d.procc = '800001' and b.acqid = :id
- ) as t order by time, date desc
+ ) as t order by date desc
]]>
@@ -129,37 +129,41 @@
diff --git a/BcnxWebService/src/com/bcnx/web/app/exception/ApplicationExceptionHandler.java b/BcnxWebService/src/com/bcnx/web/app/exception/ApplicationExceptionHandler.java
new file mode 100644
index 0000000..5c1a558
--- /dev/null
+++ b/BcnxWebService/src/com/bcnx/web/app/exception/ApplicationExceptionHandler.java
@@ -0,0 +1,21 @@
+package com.bcnx.web.app.exception;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+import org.jboss.resteasy.spi.ApplicationException;
+
+import com.bcnx.web.app.service.entity.ErrMsg;
+
+@Provider
+public class ApplicationExceptionHandler implements
+ ExceptionMapper {
+ @Override
+ public Response toResponse(ApplicationException ex) {
+ ErrMsg errMsg = new ErrMsg();
+ errMsg.setCode("510");
+ errMsg.setMessage("Internal Message Error");
+ return Response.status(500).entity(errMsg).build();
+ }
+}
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/ProcCodeService.java b/BcnxWebService/src/com/bcnx/web/app/service/ProcCodeService.java
new file mode 100644
index 0000000..cb05138
--- /dev/null
+++ b/BcnxWebService/src/com/bcnx/web/app/service/ProcCodeService.java
@@ -0,0 +1,7 @@
+package com.bcnx.web.app.service;
+
+import com.bcnx.web.app.service.entity.ProcCode;
+
+public interface ProcCodeService {
+ public ProcCode getProcCode(ProcCode procCode);
+}
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/ProcCodeServiceImp.java b/BcnxWebService/src/com/bcnx/web/app/service/ProcCodeServiceImp.java
new file mode 100644
index 0000000..a853bfd
--- /dev/null
+++ b/BcnxWebService/src/com/bcnx/web/app/service/ProcCodeServiceImp.java
@@ -0,0 +1,27 @@
+package com.bcnx.web.app.service;
+
+import java.sql.SQLException;
+
+import org.apache.log4j.Logger;
+import org.hibernate.HibernateException;
+
+import com.bcnx.web.app.service.dao.ProcCodeDao;
+import com.bcnx.web.app.service.entity.ProcCode;
+
+public class ProcCodeServiceImp implements ProcCodeService {
+ private static Logger logger = Logger.getLogger(ProcCodeServiceImp.class);
+ private ProcCodeDao procCodeDao;
+ public void setProcCodeDao(ProcCodeDao procCodeDao){
+ this.procCodeDao = procCodeDao;
+ }
+ @Override
+ public ProcCode getProcCode(ProcCode procCode) {
+ try {
+ return procCodeDao.getProcCode(procCode);
+ } catch (HibernateException | SQLException e) {
+ logger.debug("Exception occured while try to get processing code",e);
+ return null;
+ }
+ }
+
+}
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/UserService.java b/BcnxWebService/src/com/bcnx/web/app/service/UserService.java
index 9135387..dd13dda 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/UserService.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/UserService.java
@@ -8,6 +8,7 @@ public interface UserService {
public void save(User user);
public void update(User user);
public void updatePasswd(User user);
+ public boolean checkComplex(String passwd);
public User getUser(User user);
public List getUsers(int first, int max);
public List getUsers(User user, int first, int max);
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/UserServiceImp.java b/BcnxWebService/src/com/bcnx/web/app/service/UserServiceImp.java
index f4bd4b6..54bbe42 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/UserServiceImp.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/UserServiceImp.java
@@ -2,6 +2,8 @@
import java.sql.SQLException;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.apache.log4j.Logger;
@@ -38,6 +40,14 @@ public void updatePasswd(User user) {
logger.debug("Exception occured while try to updat user",e);
}
}
+ private static final String REGEX = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=])(?=\\S+$).{8,}$";
+ private Pattern pattern = Pattern.compile(REGEX);
+ private Matcher matcher;
+ @Override
+ public boolean checkComplex(String passwd) {
+ matcher = pattern.matcher(passwd);
+ return matcher.find();
+ }
@Override
public User getUser(User user) {
try {
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/admin/UserController.java b/BcnxWebService/src/com/bcnx/web/app/service/admin/UserController.java
index fdd216a..fb8515b 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/admin/UserController.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/admin/UserController.java
@@ -106,11 +106,25 @@ public Response updatePasswd(@FormParam("userId") String userId,
if(!check){
return Response.status(401).entity(new ErrMsg("407","invalid current password")).build();
}
+ check = userService.checkComplex(nPasswd);
+ if (!check)
+ return Response
+ .status(501)
+ .entity(new ErrMsg(
+ "405",
+ "bad password,password is at least 8 characters and require number, character (upper and lower) and special characters"))
+ .build();
if (!nPasswd.equals(cPasswd))
- return Response.status(401).entity(new ErrMsg("406","new password and confirm password is no match")).build();
+ return Response
+ .status(401)
+ .entity(new ErrMsg("406",
+ "new password and confirm password is no match"))
+ .build();
user.setPasswd(Encryptography.encrypt(nPasswd));
userService.updatePasswd(user);
- return Response.status(200).entity(new ErrMsg("200","password change successful")).build();
+ return Response.status(200)
+ .entity(new ErrMsg("200", "password change successful"))
+ .build();
}
// log on service
@POST
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/auditor/BcnxSettleAuditorImp.java b/BcnxWebService/src/com/bcnx/web/app/service/auditor/BcnxSettleAuditorImp.java
index c8c1b50..b1c5d11 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/auditor/BcnxSettleAuditorImp.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/auditor/BcnxSettleAuditorImp.java
@@ -46,7 +46,7 @@ public List toList(File file, Date date) throws IOException {
while((line = bufferReader.readLine())!=null){
matcher = ignorPattern.matcher(line);
String[] token = line.split(" ");
- if(!matcher.find()&&(token.length==13)){
+ if(!matcher.find()&&(token.length>=13)){
matcher = slotPattern.matcher(token[0]);
String slot = null;
if(matcher.find())
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/dao/BcnxSettleDaoImp.java b/BcnxWebService/src/com/bcnx/web/app/service/dao/BcnxSettleDaoImp.java
index 8473316..4730456 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/dao/BcnxSettleDaoImp.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/dao/BcnxSettleDaoImp.java
@@ -134,44 +134,67 @@ public Date doInHibernate(Session session)
}
@Transactional
@Override
- public List getBcnxFinIss(Date date, String id)
+ public List getBcnxFinIss(final Date date, final String id)
throws SQLException, HibernateException {
- String hql = "from BcnxSettle b where b.date = :date and b.iss = :id and b.res = :res and b.rrn "
- + "not in (select bb.rrn from BcnxSettle bb where bb.date =:date and bb.iss = :id and bb.mti = :mti ) "
- + "order by b.time";
- String[] param ={"date","id", "res", "mti"};
- Object[] values = {date, id, "00", "0420"};
- return toList(hibernateTemplate.findByNamedParam(hql, param, values));
+ return hibernateTemplate.execute(new HibernateCallback>(){
+ @Override
+ public List doInHibernate(Session session)
+ throws HibernateException {
+ Query query = session.getNamedQuery("getBcnxFinIss");
+ query.setDate("date", date);
+ query.setString("id", id);
+ return toList(query.list());
+ }
+
+ });
}
@Transactional
@Override
- public List getBcnxFinAcq(Date date, String id)
+ public List getBcnxFinAcq(final Date date, final String id)
throws SQLException, HibernateException {
- String hql = "from BcnxSettle b where b.date = :date and b.acq = :id and b.res = :res and b.rrn "
- + "not in (select bb.rrn from BcnxSettle bb where bb.date =:date and bb.acq = :id and bb.mti = :mti ) "
- + "order by b.time";
- String[] param ={"date","id", "res", "mti"};
- Object[] values = {date, id, "00", "0420"};
- return toList(hibernateTemplate.findByNamedParam(hql, param, values));
+ return hibernateTemplate.execute(new HibernateCallback>(){
+ @Override
+ public List doInHibernate(Session session)
+ throws HibernateException {
+ Query query = session.getNamedQuery("getBcnxFinAcq");
+ query.setDate("date", date);
+ query.setString("id", id);
+ return toList(query.list());
+ }
+
+ });
}
@Transactional
@Override
- public List getBcnxRev(Date date, String id)
+ public List getBcnxRev(final Date date, final String id)
throws SQLException, HibernateException {
- String hql = "from BcnxSettle b where b.date = :date and ( b.acq =:id or b.iss =:id )and b.res = :res and b.mti = :mti order by b.time";
- String[] param ={"date","id", "res", "mti"};
- Object[] values = {date, id, "00", "0420"};
- return toList(hibernateTemplate.findByNamedParam(hql, param, values));
+ return hibernateTemplate.execute(new HibernateCallback>(){
+ @Override
+ public List doInHibernate(Session session)
+ throws HibernateException {
+ Query query = session.getNamedQuery("getBcnxRev");
+ query.setDate("date", date);
+ query.setString("id", id);
+ return toList(query.list());
+ }
+
+ });
}
@Transactional
@Override
- public List getBcnxErr(Date date, String id)
+ public List getBcnxErr(final Date date, final String id)
throws SQLException, HibernateException {
- String hql = "from BcnxSettle b where b.date = :date and ( b.acq =:id or b.iss =:id )and b.res !=:res and b.mti = :mti and b.rrn not in "
- + "( select bb.rrn from BcnxSettle bb where bb.date =:date and bb.acq = :id and bb.mti = :mti ) order by b.time";
- String[] param ={"date","id", "res", "mti"};
- Object[] values = {date, id, "00", "0420"};
- return toList(hibernateTemplate.findByNamedParam(hql, param, values));
+ return hibernateTemplate.execute(new HibernateCallback>(){
+ @Override
+ public List doInHibernate(Session session)
+ throws HibernateException {
+ Query query = session.getNamedQuery("getBcnxErr");
+ query.setDate("date", date);
+ query.setString("id", id);
+ return toList(query.list());
+ }
+
+ });
}
private List toDates(final List> beans){
if(beans == null ) return null;
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/entity/ProcCode.java b/BcnxWebService/src/com/bcnx/web/app/service/entity/ProcCode.java
index 99606f3..d94cd0c 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/entity/ProcCode.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/entity/ProcCode.java
@@ -23,6 +23,8 @@ public class ProcCode implements Serializable {
private String code;
@Column(name="REMARK")
private String remark;
+ @Column(name="LIMIT")
+ private int limit;
@OneToMany(mappedBy = "cardProcId.procCode", cascade=CascadeType.ALL)
private List cardProcs;
@OneToMany(mappedBy = "procCode", cascade=CascadeType.ALL)
@@ -43,6 +45,12 @@ public String getRemark() {
public void setRemark(String remark) {
this.remark = remark;
}
+ public int getLimit() {
+ return limit;
+ }
+ public void setLimit(int limit) {
+ this.limit = limit;
+ }
@JsonIgnore
public List getCardProcs() {
return cardProcs;
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/report/BcnxSettleFeeImp.java b/BcnxWebService/src/com/bcnx/web/app/service/report/BcnxSettleFeeImp.java
index c59ebab..1bceebe 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/report/BcnxSettleFeeImp.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/report/BcnxSettleFeeImp.java
@@ -40,6 +40,8 @@ public List setAcqFee(List settles) {
public List setDispIssFee(List list) {
for(int i=0;i setDispIssFee(List list) {
public List setDispAcqFee(List list) {
for(int i=0;i issTxn,
printReport(pw,"ERROR :",errTxn);
printDispReports(pw,"OUTGONG COPY REQUEST :",oCp);
printDispReports(pw,"INCOMING COPY REQUEST",iCp);
- printDispReports(pw,"INCOMING COPY REQUEST RESPONSE :", iCrs);
- printDispReports(pw,"OUTGOIN COPY REQUEST RESPONSE :", oCrs);
+ printDispReports(pw,"INCOMING FULLFILLMENT :", iCrs);
+ printDispReports(pw,"OUTGOIN FULLFILLMENT :", oCrs);
printDispReports(pw,"OUTGOING CHARGE BACK :",oChb);
printDispReports(pw,"INCOMING CHARGE BACK :",iChb);
printDispReports(pw,"OUTGOING ADJUSTMENT :",oAdj);
@@ -224,8 +224,7 @@ private void setSettleBcnx(Date date, String id, List iss,
double orFee = getDispFee(or);
double orTot = orAmt + orFee;
- double net = (acqAmt +acqFee) + (issAmt + issFee) + (ocAmt + ocFee) + (icAmt + icFee)
- + (iaAmt + iaAmt) + (oaAmt + oaFee) + (orAmt + orFee) + (irAmt + irFee);
+ double net = issTot + acqTot + icTot + ocTot + iaTot + oaTot + irTot + orTot;
settleBcnx.setMember(member);
settleBcnx.setDate(date);
@@ -348,9 +347,9 @@ private void printNetSettlement(PrintWriter pw) {
pw.printf("%23s\t%13d\t%20s\t%17s\r\n","REVERSAL",settleBcnx.getRevNum(),decimalFormat.format(settleBcnx.getRevTot()),decimalFormat.format(settleBcnx.getRevFee()));
pw.printf("%23s\t%13d\t%20s\t%17s\r\n","ERROR",settleBcnx.getErrNum(),decimalFormat.format(settleBcnx.getErrAmt()),decimalFormat.format(settleBcnx.getErrFee()));
pw.printf("%23s\t%13d\t%20s\t%17s\r\n","COPY REQUEST (OUT)",settleBcnx.getOuCprNum(),null,null);
- pw.printf("%23s\t%13d\t%20s\t%17s\r\n","COPY REQUEST RES.(OUT)",settleBcnx.getOuCrsNum(),null,null);
+ pw.printf("%23s\t%13d\t%20s\t%17s\r\n","FULLFILLMENT (OUT)",settleBcnx.getOuCrsNum(),null,null);
pw.printf("%23s\t%13d\t%20s\t%17s\r\n","COPY REQUEST (IN)",settleBcnx.getInCprNum(),null,null);
- pw.printf("%23s\t%13d\t%20s\t%17s\r\n","COPY REQUEST RES.(IN)",settleBcnx.getInCrsNum(),null,null);
+ pw.printf("%23s\t%13d\t%20s\t%17s\r\n","FULLFILLMENT (IN)",settleBcnx.getInCrsNum(),null,null);
pw.println("\r\nFINANCAIL TRANSACTION SUMMARY");
pw.println("+----------------------+---------------+----------------------+--------------------+");
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/user/AdjustmentController.java b/BcnxWebService/src/com/bcnx/web/app/service/user/AdjustmentController.java
index 7343c54..b1c1e29 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/user/AdjustmentController.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/user/AdjustmentController.java
@@ -6,6 +6,8 @@
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
+import org.jboss.resteasy.spi.ApplicationException;
+
import com.bcnx.web.app.context.BcnxApplicationContext;
import com.bcnx.web.app.service.AdjustmentService;
import com.bcnx.web.app.service.entity.BcnxSettle;
@@ -26,8 +28,8 @@ public Response save(@FormParam("mti") String mti,
@FormParam("rea") String rea, @FormParam("remark") String remark,
@FormParam("part") String part, @FormParam("amount") double amount,
@FormParam("fee") double fee, @FormParam("iss") String iss,
- @FormParam("acq") String acq, @FormParam("usrId") String userId) {
-
+ @FormParam("acq") String acq, @FormParam("usrId") String userId)
+ throws ApplicationException {
DisputeTxn disputeTxn = new DisputeTxn();
disputeTxn.setProcc(proc);
disputeTxn.setRemark(remark);
@@ -58,7 +60,7 @@ public Response save(@FormParam("mti") String mti,
.entity(new ErrMsg("410",
"User is not allowed to perform function")).build();
- boolean valid = checkValidDate(bcnxSettle.getDate());
+ boolean valid = checkValidDate(bcnxSettle.getDate(),proc);
if(!valid)
return Response.status(500)
.entity(new ErrMsg("414", "Exceed valid date request")).build();
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/user/BcnxSettleController.java b/BcnxWebService/src/com/bcnx/web/app/service/user/BcnxSettleController.java
index cb4e0ae..18d5f34 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/user/BcnxSettleController.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/user/BcnxSettleController.java
@@ -8,6 +8,8 @@
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
+import org.jboss.resteasy.spi.ApplicationException;
+
import com.bcnx.web.app.context.BcnxApplicationContext;
import com.bcnx.web.app.service.BcnxSettleService;
import com.bcnx.web.app.service.entity.BcnxSettle;
@@ -21,8 +23,9 @@ public class BcnxSettleController {
@Produces("application/json")
public Response getBcnxSettles(@QueryParam("card") String card,
@QueryParam("rrn") String rrn, @QueryParam("stan") String stan,
- @QueryParam("from") String from, @QueryParam("to") String to,
- @QueryParam("page") int page, @QueryParam("rows") int rows) {
+ @QueryParam("from") String from, @QueryParam("to") String to,
+ @QueryParam("page") int page, @QueryParam("rows") int rows)
+ throws ApplicationException {
BcnxSettle bs = new BcnxSettle();
bs.setCard(card);
bs.setRrn(rrn);
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/user/BulletinController.java b/BcnxWebService/src/com/bcnx/web/app/service/user/BulletinController.java
index 2c23ace..7f54d82 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/user/BulletinController.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/user/BulletinController.java
@@ -17,6 +17,7 @@
import javax.ws.rs.core.Response;
import org.jboss.resteasy.annotations.providers.multipart.MultipartForm;
+import org.jboss.resteasy.spi.ApplicationException;
import com.bcnx.web.app.context.BcnxApplicationContext;
import com.bcnx.web.app.service.BulletinService;
@@ -26,7 +27,7 @@ public class BulletinController {
@POST
@Path("/upload")
@Consumes("multipart/form-data")
- public Response upload(@MultipartForm Bulletin bulletin){
+ public Response upload(@MultipartForm Bulletin bulletin) throws ApplicationException {
String title = bulletin.getTitle() == null ? "Unknown" : bulletin.getTitle();
String completeFilePath = "D:/Server/Storage/" + title+"."+bulletin.getType();
try
@@ -48,14 +49,14 @@ public Response upload(@MultipartForm Bulletin bulletin){
@POST
@Path("/save")
@Produces("application/json")
- public Response save(Bulletin bulletin){
+ public Response save(Bulletin bulletin) throws ApplicationException {
BulletinService service = (BulletinService) BcnxApplicationContext.getBean("bulletinService");
service.save(bulletin);
return Response.status(200).entity(bulletin).build();
}
@GET
@Path("/get/{first}/{max}")
- public Response getBulletns(@PathParam("first")int first, @PathParam("max")int max){
+ public Response getBulletns(@PathParam("first")int first, @PathParam("max")int max) throws ApplicationException {
BulletinService service = (BulletinService) BcnxApplicationContext.getBean("bulletinService");
List bulletins = service.getBulletin(first, max);
return Response.status(200).entity(bulletins).build();
@@ -63,7 +64,7 @@ public Response getBulletns(@PathParam("first")int first, @PathParam("max")int m
@GET
@Path("/get/{date}/{first}/{max}")
public Response getBulletins(@PathParam("date") String date,
- @PathParam("first") int first, @PathParam("max") int max) {
+ @PathParam("first") int first, @PathParam("max") int max) throws ApplicationException {
BulletinService service = (BulletinService) BcnxApplicationContext
.getBean("bulletinService");
Timestamp start = toTimestamp(date.replaceAll("-", "") + "000000");
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/user/ChargebackController.java b/BcnxWebService/src/com/bcnx/web/app/service/user/ChargebackController.java
index 1a1a976..57b6259 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/user/ChargebackController.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/user/ChargebackController.java
@@ -6,6 +6,8 @@
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
+import org.jboss.resteasy.spi.ApplicationException;
+
import com.bcnx.web.app.context.BcnxApplicationContext;
import com.bcnx.web.app.service.ChargebackService;
import com.bcnx.web.app.service.entity.BcnxSettle;
@@ -26,7 +28,7 @@ public Response save(@FormParam("mti") String mti,
@FormParam("rea") String rea, @FormParam("remark") String remark,
@FormParam("part") String part, @FormParam("amount") double amount,
@FormParam("fee") double fee, @FormParam("iss") String iss,
- @FormParam("acq") String acq, @FormParam("usrId") String userId) {
+ @FormParam("acq") String acq, @FormParam("usrId") String userId) throws ApplicationException {
DisputeTxn disputeTxn = new DisputeTxn();
disputeTxn.setProcc(proc);
disputeTxn.setRemark(remark);
@@ -59,7 +61,7 @@ public Response save(@FormParam("mti") String mti,
.status(500)
.entity(new ErrMsg("410",
"User is not allowed to perform function")).build();
- boolean valid = checkValidDate(bcnxSettle.getDate());
+ boolean valid = checkValidDate(bcnxSettle.getDate(),proc);
if(!valid)
return Response.status(500)
.entity(new ErrMsg("414", "Exceed valid date request")).build();
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/user/CopyRequestController.java b/BcnxWebService/src/com/bcnx/web/app/service/user/CopyRequestController.java
index 348e1c1..9853c88 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/user/CopyRequestController.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/user/CopyRequestController.java
@@ -19,6 +19,7 @@
import org.jboss.resteasy.plugins.providers.multipart.InputPart;
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
+import org.jboss.resteasy.spi.ApplicationException;
import com.bcnx.web.app.context.BcnxApplicationContext;
import com.bcnx.web.app.service.CopyRequestService;
@@ -38,7 +39,7 @@ public Response save(@FormParam("mti") String mti,
@FormParam("stan") String stan, @FormParam("proc") String proc,
@FormParam("rea") String rea, @FormParam("remark") String remark,
@FormParam("part") String part, @FormParam("amount") double amount,
- @FormParam("fee") double fee, @FormParam("usrId") String userId) {
+ @FormParam("fee") double fee, @FormParam("usrId") String userId) throws ApplicationException {
DisputeTxn disputeTxn = new DisputeTxn();
disputeTxn.setProcc(proc);
disputeTxn.setRemark(remark);
@@ -68,7 +69,7 @@ public Response save(@FormParam("mti") String mti,
.status(500)
.entity(new ErrMsg("410",
"User is not allowed to perform function")).build();
- boolean valid = checkValidDate(settle.getDate());
+ boolean valid = checkValidDate(settle.getDate(),proc);
if(!valid)
return Response.status(500)
.entity(new ErrMsg("414", "Exceed valid date request")).build();
@@ -86,7 +87,7 @@ public Response save(@FormParam("mti") String mti,
@Path("/response")
@Produces("application/json")
@Consumes("multipart/form-data")
- public Response resCpRq(MultipartFormDataInput input, @Context ServletContext context) {
+ public Response resCpRq(MultipartFormDataInput input, @Context ServletContext context) throws ApplicationException {
String path = context.getInitParameter("uploadFolder");
Map> uploadForm = input.getFormDataMap();
String fileName = getFileData(uploadForm.get("file"),path);
@@ -146,7 +147,7 @@ public Response resCpRq(MultipartFormDataInput input, @Context ServletContext co
.status(500)
.entity(new ErrMsg("413",
"Invalid copy request")).build();
- boolean valid = checkValidDate(disp.getDate());
+ boolean valid = checkValidDate(disp.getDate(),proc);
if(valid)
return Response
.status(500)
@@ -162,7 +163,7 @@ public Response resCpRq(MultipartFormDataInput input, @Context ServletContext co
}
@Path("download/{fileName}")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
- public Response download(@PathParam("fileName")String fileName, @Context ServletContext context){
+ public Response download(@PathParam("fileName")String fileName, @Context ServletContext context) throws ApplicationException {
String path = context.getInitParameter("uploadFolder");
String target = path+"/"+fileName;
File file = new File(target);
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/user/DisputeController.java b/BcnxWebService/src/com/bcnx/web/app/service/user/DisputeController.java
index f1aa6e7..d7b2eca 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/user/DisputeController.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/user/DisputeController.java
@@ -8,6 +8,8 @@
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
+import org.jboss.resteasy.spi.ApplicationException;
+
import com.bcnx.web.app.service.entity.BcnxSettle;
import com.bcnx.web.app.service.entity.DisputeTxn;
import com.bcnx.web.app.service.entity.Wrapper;
@@ -19,7 +21,7 @@ public class DisputeController extends DisputeTemplate {
@Produces("application/json")
public Response getRelated(@QueryParam("rrn") String rrn,
@QueryParam("slot") String slot, @QueryParam("stan") String stan,
- @QueryParam("page") int page, @QueryParam("rows") int rows) {
+ @QueryParam("page") int page, @QueryParam("rows") int rows) throws ApplicationException {
BcnxSettle settle = new BcnxSettle();
settle.setRrn(rrn);
settle.setSlot(slot);
@@ -41,7 +43,7 @@ public Response getRelated(@QueryParam("rrn") String rrn,
@Path("/get/txn")
@Produces("application/json")
public Response getDisputeTxn(@QueryParam("rrn") String rrn, @QueryParam("proc") String proc,
- @QueryParam("slot") String slot, @QueryParam("stan") String stan){
+ @QueryParam("slot") String slot, @QueryParam("stan") String stan) throws ApplicationException {
BcnxSettle settle = new BcnxSettle();
settle.setRrn(rrn);
settle.setSlot(slot);
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/user/DisputeTemplate.java b/BcnxWebService/src/com/bcnx/web/app/service/user/DisputeTemplate.java
index 6916940..1250a54 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/user/DisputeTemplate.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/user/DisputeTemplate.java
@@ -18,10 +18,12 @@
import com.bcnx.web.app.context.BcnxApplicationContext;
import com.bcnx.web.app.service.BcnxSettleService;
import com.bcnx.web.app.service.DisputeTxnService;
+import com.bcnx.web.app.service.ProcCodeService;
import com.bcnx.web.app.service.ReasonCodeService;
import com.bcnx.web.app.service.UserService;
import com.bcnx.web.app.service.entity.DisputeTxn;
import com.bcnx.web.app.service.entity.Member;
+import com.bcnx.web.app.service.entity.ProcCode;
import com.bcnx.web.app.service.entity.User;
import com.bcnx.web.app.utility.UtilityService;
@@ -37,6 +39,7 @@ public class DisputeTemplate {
protected static BcnxSettleService bcnxSettleService = (BcnxSettleService) BcnxApplicationContext.getBean("bcnxSettleService");
protected static ReasonCodeService reasonCodeService = (ReasonCodeService) BcnxApplicationContext.getBean("reasonCodeService");
protected static DisputeTxnService disputeTxnService = (DisputeTxnService) BcnxApplicationContext.getBean("disputeTxnService");
+ protected static ProcCodeService procCodeService = (ProcCodeService) BcnxApplicationContext.getBean("procCodeService");
protected boolean checkIssuer(DisputeTxn txn, User user){
String iss = txn.getIss();
@@ -136,4 +139,16 @@ protected boolean checkValidDate(Date org){
return valid<30;
}
+ protected boolean checkValidDate(Date org, String code){
+ Date date = UtilityService.getCurrentDate();
+ LocalDate start = new LocalDate(org);
+ LocalDate end = new LocalDate(date);
+ int valid = Days.daysBetween(start, end).getDays();
+ ProcCode procCode = new ProcCode();
+ procCode.setCode(code);
+ procCode = procCodeService.getProcCode(procCode);
+ if(procCode == null)
+ return false;
+ return valid<=procCode.getLimit();
+ }
}
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/user/IncomingController.java b/BcnxWebService/src/com/bcnx/web/app/service/user/IncomingController.java
index b40fc96..ae13857 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/user/IncomingController.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/user/IncomingController.java
@@ -9,6 +9,8 @@
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
+import org.jboss.resteasy.spi.ApplicationException;
+
import com.bcnx.web.app.service.entity.DisputeTxn;
import com.bcnx.web.app.service.entity.User;
import com.bcnx.web.app.service.entity.Wrapper;
@@ -19,7 +21,7 @@ public class IncomingController extends DisputeTemplate {
@Path("/get")
@Produces("application/json")
public Response getIncoming(@QueryParam("usrId") String usrId,
- @QueryParam("page") int page, @QueryParam("rows") int rows) {
+ @QueryParam("page") int page, @QueryParam("rows") int rows) throws ApplicationException {
User usr = new User();
usr.setUserId(usrId);
usr = userService.getUser(usr);
@@ -42,7 +44,7 @@ public Response getIncoming(@QueryParam("usrId") String usrId,
@QueryParam("card") String card, @QueryParam("rrn") String rrn,
@QueryParam("stan") String stan, @QueryParam("proc") String proc,
@QueryParam("start") String start, @QueryParam("end") String end,
- @QueryParam("page") int page, @QueryParam("rows") int rows) {
+ @QueryParam("page") int page, @QueryParam("rows") int rows) throws ApplicationException {
User usr = new User();
usr.setUserId(usrId);
usr = userService.getUser(usr);
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/user/OutgoingController.java b/BcnxWebService/src/com/bcnx/web/app/service/user/OutgoingController.java
index 05f4c02..2841c00 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/user/OutgoingController.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/user/OutgoingController.java
@@ -9,6 +9,8 @@
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
+import org.jboss.resteasy.spi.ApplicationException;
+
import com.bcnx.web.app.service.entity.DisputeTxn;
import com.bcnx.web.app.service.entity.User;
import com.bcnx.web.app.service.entity.Wrapper;
@@ -19,7 +21,7 @@ public class OutgoingController extends DisputeTemplate {
@Path("/get")
@Produces("application/json")
public Response getOutgoing(@QueryParam("usrId") String usrId,
- @QueryParam("page") int page, @QueryParam("rows") int rows) {
+ @QueryParam("page") int page, @QueryParam("rows") int rows) throws ApplicationException {
User usr = new User();
usr.setUserId(usrId);
usr = userService.getUser(usr);
@@ -42,7 +44,7 @@ public Response getOutgoing(@QueryParam("usrId") String usrId,
@QueryParam("card") String card, @QueryParam("rrn") String rrn,
@QueryParam("stan") String stan, @QueryParam("proc") String proc,
@QueryParam("start") String start, @QueryParam("end") String end,
- @QueryParam("page") int page, @QueryParam("rows") int rows) {
+ @QueryParam("page") int page, @QueryParam("rows") int rows) throws ApplicationException {
User usr = new User();
usr.setUserId(usrId);
usr = userService.getUser(usr);
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/user/ReasonCodeController.java b/BcnxWebService/src/com/bcnx/web/app/service/user/ReasonCodeController.java
index 3bdc17d..bf6fe61 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/user/ReasonCodeController.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/user/ReasonCodeController.java
@@ -8,6 +8,8 @@
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
+import org.jboss.resteasy.spi.ApplicationException;
+
import com.bcnx.web.app.context.BcnxApplicationContext;
import com.bcnx.web.app.service.ReasonCodeService;
import com.bcnx.web.app.service.entity.ReasonCode;
@@ -17,7 +19,7 @@ public class ReasonCodeController {
@GET
@Path("/get/{proc}")
@Produces("application/json")
- public Response getReasonCode(@PathParam("proc") String proc){
+ public Response getReasonCode(@PathParam("proc") String proc) throws ApplicationException {
List list = reasonCodeService.getReasonCodes(proc);
return Response.ok(list).build();
}
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/user/RepresentController.java b/BcnxWebService/src/com/bcnx/web/app/service/user/RepresentController.java
index e87b6b8..ca67f8c 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/user/RepresentController.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/user/RepresentController.java
@@ -17,6 +17,7 @@
import org.jboss.resteasy.plugins.providers.multipart.InputPart;
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
+import org.jboss.resteasy.spi.ApplicationException;
import com.bcnx.web.app.context.BcnxApplicationContext;
import com.bcnx.web.app.service.RepresentService;
@@ -33,7 +34,7 @@ public class RepresentController extends DisputeTemplate{
@Path("/save")
@Produces("application/json")
@Consumes("multipart/form-data")
- public Response save(MultipartFormDataInput input, @Context ServletContext context) {
+ public Response save(MultipartFormDataInput input, @Context ServletContext context) throws ApplicationException {
String path = context.getInitParameter("uploadFolder");
Map> uploadForm = input.getFormDataMap();
String fileName = getFileData(uploadForm.get("file"),path);
@@ -79,7 +80,7 @@ public Response save(MultipartFormDataInput input, @Context ServletContext conte
.status(500)
.entity(new ErrMsg("413",
"Invalid Representment request")).build();
- boolean valid = checkValidDate(disp.getDate());
+ boolean valid = checkValidDate(disp.getDate(),proc);
if(!valid)
return Response
.status(500)
@@ -102,7 +103,7 @@ public Response save(MultipartFormDataInput input, @Context ServletContext conte
}
@Path("download/{fileName}")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
- public Response download(@PathParam("fileName")String fileName, @Context ServletContext context){
+ public Response download(@PathParam("fileName")String fileName, @Context ServletContext context) throws ApplicationException {
String path = context.getInitParameter("uploadFolder");
String target = path+"/"+fileName;
File file = new File(target);
diff --git a/BcnxWebService/src/com/bcnx/web/app/service/user/SettleBcnxController.java b/BcnxWebService/src/com/bcnx/web/app/service/user/SettleBcnxController.java
index 6b9f88d..a4e66e9 100644
--- a/BcnxWebService/src/com/bcnx/web/app/service/user/SettleBcnxController.java
+++ b/BcnxWebService/src/com/bcnx/web/app/service/user/SettleBcnxController.java
@@ -12,6 +12,8 @@
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
+import org.jboss.resteasy.spi.ApplicationException;
+
import com.bcnx.web.app.context.BcnxApplicationContext;
import com.bcnx.web.app.service.SettleBcnxService;
import com.bcnx.web.app.service.UserService;
@@ -25,7 +27,7 @@ public class SettleBcnxController {
@Path("/get")
@Produces("application/json")
public Response getSettleBcnx(@QueryParam("date") String date,
- @QueryParam("id") String id) {
+ @QueryParam("id") String id) throws ApplicationException {
SettleBcnxService settleBean = (SettleBcnxService) BcnxApplicationContext.getBean("settleBcnxService");
UserService userBean = (UserService) BcnxApplicationContext.getBean("userService");
User user = new User();
@@ -41,7 +43,7 @@ public Response getSettleBcnx(@QueryParam("date") String date,
@Produces("text/plain")
public Response download(@QueryParam("usrId") String usrId,
@QueryParam("date") String date, @QueryParam("file") String file,
- @Context ServletContext servletContext) {
+ @Context ServletContext servletContext) throws ApplicationException {
String path = servletContext.getInitParameter("reportPath");
UserService service = (UserService) BcnxApplicationContext.getBean("userService");
User user = new User();
diff --git a/BcnxWebService/webapp/WEB-INF/applicationContext.xml b/BcnxWebService/webapp/WEB-INF/applicationContext.xml
index 9a27164..1020764 100644
--- a/BcnxWebService/webapp/WEB-INF/applicationContext.xml
+++ b/BcnxWebService/webapp/WEB-INF/applicationContext.xml
@@ -23,6 +23,7 @@
+
-
+
diff --git a/BcnxWebService/webapp/WEB-INF/bcnxSettle_context.xml b/BcnxWebService/webapp/WEB-INF/bcnxSettle_context.xml
index 7d57d8b..3c9937c 100644
--- a/BcnxWebService/webapp/WEB-INF/bcnxSettle_context.xml
+++ b/BcnxWebService/webapp/WEB-INF/bcnxSettle_context.xml
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
-
+
diff --git a/BcnxWebService/webapp/WEB-INF/exception_context.xml b/BcnxWebService/webapp/WEB-INF/exception_context.xml
new file mode 100644
index 0000000..74bdca2
--- /dev/null
+++ b/BcnxWebService/webapp/WEB-INF/exception_context.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
diff --git a/BcnxWebService/webapp/WEB-INF/proccode_context.xml b/BcnxWebService/webapp/WEB-INF/proccode_context.xml
new file mode 100644
index 0000000..66d280b
--- /dev/null
+++ b/BcnxWebService/webapp/WEB-INF/proccode_context.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BcnxWebService/webapp/WEB-INF/quartz/batch_job_context.xml b/BcnxWebService/webapp/WEB-INF/quartz/batch_job_context.xml
index e48ec5d..fbddca4 100644
--- a/BcnxWebService/webapp/WEB-INF/quartz/batch_job_context.xml
+++ b/BcnxWebService/webapp/WEB-INF/quartz/batch_job_context.xml
@@ -29,7 +29,7 @@
-
+
diff --git a/BcnxWebService/webapp/WEB-INF/web.xml b/BcnxWebService/webapp/WEB-INF/web.xml
index db556f5..7c50c8a 100644
--- a/BcnxWebService/webapp/WEB-INF/web.xml
+++ b/BcnxWebService/webapp/WEB-INF/web.xml
@@ -43,5 +43,4 @@
resteasy-servlet
/*
-
\ No newline at end of file