| Line 142... |
Line 142... |
| 142 |
private String refundAmountGateway;
|
142 |
private String refundAmountGateway;
|
| 143 |
private String comments;
|
143 |
private String comments;
|
| 144 |
|
144 |
|
| 145 |
private String errorMsg = "";
|
145 |
private String errorMsg = "";
|
| 146 |
private String successmsg = "";
|
146 |
private String successmsg = "";
|
| - |
|
147 |
|
| - |
|
148 |
private List<String> refundDetails;
|
| 147 |
//End:- Added by Manish Sharma for Physical Refunds
|
149 |
//End:- Added by Manish Sharma for Physical Refunds
|
| 148 |
|
150 |
|
| 149 |
public UserOrderInfoController() {
|
151 |
public UserOrderInfoController() {
|
| 150 |
super();
|
152 |
super();
|
| 151 |
setOfcancellableStates = new HashSet<OrderStatus>();
|
153 |
setOfcancellableStates = new HashSet<OrderStatus>();
|
| Line 673... |
Line 675... |
| 673 |
List<in.shop2020.model.v1.order.Attribute> attrList = new ArrayList<in.shop2020.model.v1.order.Attribute>();
|
675 |
List<in.shop2020.model.v1.order.Attribute> attrList = new ArrayList<in.shop2020.model.v1.order.Attribute>();
|
| 674 |
in.shop2020.model.v1.order.Attribute attr1 = new in.shop2020.model.v1.order.Attribute();
|
676 |
in.shop2020.model.v1.order.Attribute attr1 = new in.shop2020.model.v1.order.Attribute();
|
| 675 |
attr1.setName("Refund_Option");
|
677 |
attr1.setName("Refund_Option");
|
| 676 |
in.shop2020.model.v1.order.Attribute attr2 = new in.shop2020.model.v1.order.Attribute();
|
678 |
in.shop2020.model.v1.order.Attribute attr2 = new in.shop2020.model.v1.order.Attribute();
|
| 677 |
attr2.setName("Refund_Amount");
|
679 |
attr2.setName("Refund_Amount");
|
| - |
|
680 |
in.shop2020.model.v1.order.Attribute attr3 = new in.shop2020.model.v1.order.Attribute();
|
| - |
|
681 |
attr2.setName("Refund_TimeStamp");
|
| - |
|
682 |
SimpleDateFormat timestmapFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| 678 |
PaymentClient paymentServiceClient = new PaymentClient();
|
683 |
PaymentClient paymentServiceClient = new PaymentClient();
|
| 679 |
List<Payment> orderPayments =null;
|
684 |
List<Payment> orderPayments =null;
|
| 680 |
if(!t_order.isCod()){
|
685 |
if(!t_order.isCod()){
|
| 681 |
orderPayments =paymentServiceClient.getClient()
|
686 |
orderPayments =paymentServiceClient.getClient()
|
| 682 |
.getPaymentForTxnId(t_order.getTransactionId());
|
687 |
.getPaymentForTxnId(t_order.getTransactionId());
|
| Line 689... |
Line 694... |
| 689 |
log.info(t_order.getTotal_amount());
|
694 |
log.info(t_order.getTotal_amount());
|
| 690 |
attr1.setValue("Refund By Coupon: "+couponDetails);
|
695 |
attr1.setValue("Refund By Coupon: "+couponDetails);
|
| 691 |
attrList.add(attr1);
|
696 |
attrList.add(attr1);
|
| 692 |
attr2.setValue(refundAmountCoupon);
|
697 |
attr2.setValue(refundAmountCoupon);
|
| 693 |
attrList.add(attr2);
|
698 |
attrList.add(attr2);
|
| - |
|
699 |
attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
|
| - |
|
700 |
attrList.add(attr3);
|
| 694 |
transactionClient.setOrderAttributes(t_order.getId(), attrList);
|
701 |
transactionClient.setOrderAttributes(t_order.getId(), attrList);
|
| 695 |
successmsg = "Refund Marked Successful: Through Coupon";
|
702 |
successmsg = "Refund Marked Successful: Through Coupon";
|
| 696 |
return "physical-refund-result";
|
703 |
return "physical-refund-result";
|
| 697 |
}
|
704 |
}
|
| 698 |
}
|
705 |
}
|
| Line 707... |
Line 714... |
| 707 |
if(Double.parseDouble(refundAmountCheque) <= t_order.getTotal_amount()){
|
714 |
if(Double.parseDouble(refundAmountCheque) <= t_order.getTotal_amount()){
|
| 708 |
attr1.setValue("Refund By Cheque: "+chequeDetails);
|
715 |
attr1.setValue("Refund By Cheque: "+chequeDetails);
|
| 709 |
attrList.add(attr1);
|
716 |
attrList.add(attr1);
|
| 710 |
attr2.setValue(refundAmountCheque);
|
717 |
attr2.setValue(refundAmountCheque);
|
| 711 |
attrList.add(attr2);
|
718 |
attrList.add(attr2);
|
| - |
|
719 |
attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
|
| - |
|
720 |
attrList.add(attr3);
|
| 712 |
transactionClient.setOrderAttributes(t_order.getId(), attrList);
|
721 |
transactionClient.setOrderAttributes(t_order.getId(), attrList);
|
| 713 |
successmsg = "Refund Marked Successful: Through Cheque";
|
722 |
successmsg = "Refund Marked Successful: Through Cheque";
|
| 714 |
return "physical-refund-result";
|
723 |
return "physical-refund-result";
|
| 715 |
}
|
724 |
}
|
| 716 |
}
|
725 |
}
|
| Line 727... |
Line 736... |
| 727 |
if(refundResult){
|
736 |
if(refundResult){
|
| 728 |
attr1.setValue("Refund By Payment Gatway: "+comments);
|
737 |
attr1.setValue("Refund By Payment Gatway: "+comments);
|
| 729 |
attrList.add(attr1);
|
738 |
attrList.add(attr1);
|
| 730 |
attr2.setValue(refundAmountGateway);
|
739 |
attr2.setValue(refundAmountGateway);
|
| 731 |
attrList.add(attr2);
|
740 |
attrList.add(attr2);
|
| - |
|
741 |
attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
|
| - |
|
742 |
attrList.add(attr3);
|
| 732 |
transactionClient.setOrderAttributes(t_order.getId(), attrList);
|
743 |
transactionClient.setOrderAttributes(t_order.getId(), attrList);
|
| 733 |
successmsg = "Refund Marked Successful: Through Gateway";
|
744 |
successmsg = "Refund Marked Successful: Through Gateway";
|
| 734 |
return "physical-refund-result";
|
745 |
return "physical-refund-result";
|
| 735 |
}
|
746 |
}
|
| 736 |
else{
|
747 |
else{
|
| Line 739... |
Line 750... |
| 739 |
if(payment.getGatewayId()==13L){
|
750 |
if(payment.getGatewayId()==13L){
|
| 740 |
attr1.setValue("Refund By Innoviti Gatway: "+comments);
|
751 |
attr1.setValue("Refund By Innoviti Gatway: "+comments);
|
| 741 |
attrList.add(attr1);
|
752 |
attrList.add(attr1);
|
| 742 |
attr2.setValue(refundAmountGateway);
|
753 |
attr2.setValue(refundAmountGateway);
|
| 743 |
attrList.add(attr2);
|
754 |
attrList.add(attr2);
|
| - |
|
755 |
attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
|
| - |
|
756 |
attrList.add(attr3);
|
| 744 |
transactionClient.setOrderAttributes(t_order.getId(), attrList);
|
757 |
transactionClient.setOrderAttributes(t_order.getId(), attrList);
|
| 745 |
successmsg = "Refund Marked Successful: Through Innoviti Payment Gateway.";
|
758 |
successmsg = "Refund Marked Successful: Through Innoviti Payment Gateway.";
|
| 746 |
return "physical-refund-result";
|
759 |
return "physical-refund-result";
|
| 747 |
}
|
760 |
}
|
| 748 |
}
|
761 |
}
|
| Line 764... |
Line 777... |
| 764 |
log.error(e);
|
777 |
log.error(e);
|
| 765 |
}
|
778 |
}
|
| 766 |
return "physical-refund-result";
|
779 |
return "physical-refund-result";
|
| 767 |
}
|
780 |
}
|
| 768 |
|
781 |
|
| - |
|
782 |
public boolean canViewPhysicalRefundDetails(){
|
| - |
|
783 |
return (SecurityUtils.getSubject().hasRole("TeamLead") || SecurityUtils.getSubject().hasRole("Outbound") || SecurityUtils.getSubject().hasRole("Agent"));
|
| - |
|
784 |
}
|
| - |
|
785 |
|
| 769 |
public int getRefundEnabledStatus(){
|
786 |
public int getRefundEnabledStatus(){
|
| 770 |
try{
|
787 |
try{
|
| 771 |
TransactionClient transactionServiceClient = new TransactionClient();
|
788 |
TransactionClient transactionServiceClient = new TransactionClient();
|
| 772 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient
|
789 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient
|
| 773 |
= transactionServiceClient.getClient();
|
790 |
= transactionServiceClient.getClient();
|
| 774 |
in.shop2020.model.v1.order.Order t_order = transactionClient.getOrder(orderId);
|
791 |
in.shop2020.model.v1.order.Order t_order = transactionClient.getOrder(orderId);
|
| 775 |
String refundOption=transactionClient.getOrderAttributeValue(orderId, "Refund_Option");
|
792 |
String refundOption=transactionClient.getOrderAttributeValue(orderId, "Refund_Option");
|
| 776 |
String refundAmount=transactionClient.getOrderAttributeValue(orderId, "Refund_Amount");
|
793 |
String refundAmount=transactionClient.getOrderAttributeValue(orderId, "Refund_Amount");
|
| - |
|
794 |
String refundTimeStamp = transactionClient.getOrderAttributeValue(orderId, "Refund_TimeStamp");
|
| - |
|
795 |
List<String> details = new ArrayList<String>();
|
| - |
|
796 |
if(refundOption!=null && !("").equalsIgnoreCase(refundOption)){
|
| - |
|
797 |
details.add("Refund Option:- "+refundOption);
|
| - |
|
798 |
}
|
| - |
|
799 |
|
| - |
|
800 |
if(refundAmount!=null && !("").equalsIgnoreCase(refundAmount)){
|
| - |
|
801 |
details.add("Refund Amount:- "+refundAmount);
|
| - |
|
802 |
}
|
| - |
|
803 |
|
| - |
|
804 |
if(refundTimeStamp!=null && !("").equalsIgnoreCase(refundTimeStamp)){
|
| - |
|
805 |
details.add("Refund TimeStamp:- "+refundTimeStamp);
|
| - |
|
806 |
}
|
| - |
|
807 |
setPhysicalRefundDetails(details);
|
| - |
|
808 |
|
| 777 |
if((refundOption!=null && refundAmount!=null) && (!("").equalsIgnoreCase(refundOption)) && !("").equalsIgnoreCase(refundAmount) && SecurityUtils.getSubject().hasRole("TeamLead")){
|
809 |
if((refundOption!=null && refundAmount!=null) && (!("").equalsIgnoreCase(refundOption)) && !("").equalsIgnoreCase(refundAmount) && SecurityUtils.getSubject().hasRole("TeamLead")){
|
| 778 |
System.out.println("Into the Refund Condition");
|
810 |
System.out.println("Into the Refund Condition");
|
| 779 |
return 0;
|
811 |
return 0;
|
| 780 |
}
|
812 |
}
|
| 781 |
else if(t_order.isCod()){
|
813 |
else if(t_order.isCod()){
|
| Line 794... |
Line 826... |
| 794 |
catch(Exception e){
|
826 |
catch(Exception e){
|
| 795 |
log.error(e);
|
827 |
log.error(e);
|
| 796 |
}
|
828 |
}
|
| 797 |
return 1;
|
829 |
return 1;
|
| 798 |
}
|
830 |
}
|
| - |
|
831 |
|
| - |
|
832 |
public void setPhysicalRefundDetails(List<String> details){
|
| - |
|
833 |
this.refundDetails = details;
|
| - |
|
834 |
}
|
| - |
|
835 |
|
| - |
|
836 |
public List<String> getPhysicalRefundDetails(){
|
| - |
|
837 |
return this.refundDetails;
|
| - |
|
838 |
}
|
| 799 |
//End:- Added by Manish Sharma for Physical Refunds
|
839 |
//End:- Added by Manish Sharma for Physical Refunds
|
| 800 |
|
840 |
|
| 801 |
public void setOrderId(String orderId) {
|
841 |
public void setOrderId(String orderId) {
|
| 802 |
try {
|
842 |
try {
|
| 803 |
this.orderId = Long.parseLong(orderId);
|
843 |
this.orderId = Long.parseLong(orderId);
|