Subversion Repositories SmartDukaan

Rev

Rev 8893 | Rev 8929 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8893 Rev 8896
Line 700... Line 700...
700
						attrList.add(attr3);
700
						attrList.add(attr3);
701
						transactionClient.setOrderAttributes(t_order.getId(), attrList);
701
						transactionClient.setOrderAttributes(t_order.getId(), attrList);
702
						successmsg = "Refund Marked Successful: Through Coupon";
702
						successmsg = "Refund Marked Successful: Through Coupon";
703
						return "physical-refund-result";
703
						return "physical-refund-result";
704
					}
704
					}
-
 
705
					else if(orderPayments !=null && !orderPayments.isEmpty()){
-
 
706
						Payment payment = orderPayments.get(0);
-
 
707
						if(Double.parseDouble(refundAmountCoupon) <= payment.getAmount()){
-
 
708
							log.info(Double.parseDouble(refundAmountCoupon));
-
 
709
							log.info(payment.getAmount());
-
 
710
							attr1.setValue("Refund By Coupon: "+couponDetails);
-
 
711
							attrList.add(attr1);
-
 
712
							attr2.setValue(refundAmountCoupon);
-
 
713
							attrList.add(attr2);
-
 
714
							attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
-
 
715
							attrList.add(attr3);
-
 
716
							transactionClient.setOrderAttributes(t_order.getId(), attrList);
-
 
717
							successmsg = "Refund Marked Successful: Through Coupon";
-
 
718
							return "physical-refund-result";
-
 
719
						}
-
 
720
						else{
-
 
721
							errorMsg ="Refund Unsuccessful: Due to coupon amount greater than Payment Gateway Amount ";
-
 
722
							return "physical-refund-result";
-
 
723
						}
-
 
724
					}
-
 
725
					errorMsg ="Refund Unsuccessful: Due to coupon amount greater than Order Total Amount ";
705
				}
726
				}
706
				else{
727
				else{
707
					errorMsg ="Refund Unsuccessful: Due to either coupon details or refund amount is blank ";
728
					errorMsg ="Refund Unsuccessful: Due to either coupon details or refund amount is blank ";
708
					return "physical-refund-result";
729
					return "physical-refund-result";
709
				}
730
				}
Line 728... Line 749...
728
					return "physical-refund-result";
749
					return "physical-refund-result";
729
				}
750
				}
730
				errorMsg ="Refund Unsuccessful: Due to cheque amount greater than order total amount ";
751
				errorMsg ="Refund Unsuccessful: Due to cheque amount greater than order total amount ";
731
			}
752
			}
732
			if(rfdRadio.equalsIgnoreCase("rfdGateway")){
753
			if(rfdRadio.equalsIgnoreCase("rfdGateway")){
-
 
754
				if((comments!=null && !("").equalsIgnoreCase(comments)) 
733
				if((comments!=null && !("").equalsIgnoreCase(comments)) || (refundAmountGateway!=null &&!("").equalsIgnoreCase(refundAmountGateway))){
755
						|| (refundAmountGateway!=null &&!("").equalsIgnoreCase(refundAmountGateway))){
-
 
756
					if(orderPayments !=null && !orderPayments.isEmpty()){
-
 
757
						Payment payment = orderPayments.get(0);
734
					if(Double.parseDouble(refundAmountGateway) <= t_order.getTotal_amount()){
758
						if(Double.parseDouble(refundAmountGateway) <= payment.getAmount()){
735
						boolean refundResult = paymentServiceClient.getClient().refundPayment(t_order.getTransactionId(), Double.parseDouble(refundAmountGateway), false);
759
							boolean refundResult = paymentServiceClient.getClient().refundPayment(t_order.getTransactionId(), Double.parseDouble(refundAmountGateway), false);
736
						if(refundResult){
760
							if(refundResult){
737
							attr1.setValue("Refund By Payment Gatway: "+comments);
761
								attr1.setValue("Refund By Payment Gatway: "+comments);
738
							attrList.add(attr1);
762
								attrList.add(attr1);
739
							attr2.setValue(refundAmountGateway);
763
								attr2.setValue(refundAmountGateway);
740
							attrList.add(attr2);
764
								attrList.add(attr2);
741
							attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
765
								attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
742
							attrList.add(attr3);
766
								attrList.add(attr3);
743
							transactionClient.setOrderAttributes(t_order.getId(), attrList);
767
								transactionClient.setOrderAttributes(t_order.getId(), attrList);
744
							successmsg = "Refund Marked Successful: Through Gateway";
768
								successmsg = "Refund Marked Successful: Through Gateway";
745
							return "physical-refund-result";
769
								return "physical-refund-result";
746
						}
770
							}
747
						else{
771
							else{
748
							if(orderPayments !=null && !orderPayments.isEmpty()){
-
 
749
								Payment payment = orderPayments.get(0);
-
 
750
								if(payment.getGatewayId()==13L){
772
								if(payment.getGatewayId()==13L){
751
									attr1.setValue("Refund By Innoviti Gatway: "+comments);
773
									attr1.setValue("Refund By Innoviti Gatway: "+comments);
752
									attrList.add(attr1);
774
									attrList.add(attr1);
753
									attr2.setValue(refundAmountGateway);
775
									attr2.setValue(refundAmountGateway);
754
									attrList.add(attr2);
776
									attrList.add(attr2);
Line 756... Line 778...
756
									attrList.add(attr3);
778
									attrList.add(attr3);
757
									transactionClient.setOrderAttributes(t_order.getId(), attrList);
779
									transactionClient.setOrderAttributes(t_order.getId(), attrList);
758
									successmsg = "Refund Marked Successful: Through Innoviti Payment Gateway.";
780
									successmsg = "Refund Marked Successful: Through Innoviti Payment Gateway.";
759
									return "physical-refund-result";
781
									return "physical-refund-result";
760
								}
782
								}
-
 
783
								errorMsg ="Refund Unsuccessful: at Payment Gateway ";
-
 
784
								return "physical-refund-result";
761
							}
785
							}
-
 
786
						}
-
 
787
						else{
762
							errorMsg ="Refund Unsuccessful: at Payment Gateway ";
788
							errorMsg ="Refund Unsuccessful: Due to refund Amount is greater than Payment Gateway Amount ";
763
							return "physical-refund-result";
789
							return "physical-refund-result";
764
						}
790
						}
765
						
-
 
766
					}
791
					}
-
 
792
					errorMsg ="Refund Unsuccessful: There is no Payment to be refunded ";
767
				}
793
				}
768
				else{
794
				else{
769
					errorMsg ="Refund Unsuccessful: Due to either comments or refund amount is blank ";
795
					errorMsg ="Refund Unsuccessful: Due to either comments or refund amount is blank ";
770
					return "physical-refund-result";
796
					return "physical-refund-result";
771
				}
797
				}
772
				errorMsg ="Refund Unsuccessful: Due to refund amount greater than order total amount ";
-
 
-
 
798
				
773
			}
799
			}
774
			
800
			
775
		}
801
		}
776
		catch(Exception e){
802
		catch(Exception e){
777
			log.error(e);
803
			log.error(e);