Subversion Repositories SmartDukaan

Rev

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

Rev 6432 Rev 6442
Line 1... Line 1...
1
package in.shop2020.serving.controllers;
1
package in.shop2020.serving.controllers;
2
import java.security.MessageDigest;
2
import java.security.MessageDigest;
3
import java.security.NoSuchAlgorithmException;
3
import java.security.NoSuchAlgorithmException;
4
import java.util.List;
4
import java.util.List;
-
 
5
import java.util.Map;
5
 
6
 
6
import org.apache.log4j.Logger;
7
import org.apache.log4j.Logger;
7
import org.apache.struts2.convention.annotation.InterceptorRef;
8
import org.apache.struts2.convention.annotation.InterceptorRef;
8
import org.apache.struts2.convention.annotation.InterceptorRefs;
9
import org.apache.struts2.convention.annotation.InterceptorRefs;
9
import org.apache.struts2.convention.annotation.Result;
10
import org.apache.struts2.convention.annotation.Result;
Line 57... Line 58...
57
	
58
	
58
	private StringBuilder description;
59
	private StringBuilder description;
59
	
60
	
60
	private double amount;
61
	private double amount;
61
	
62
	
-
 
63
	private double emiAmount = 0;
-
 
64
	
62
	private ContactDetails billingDetails;
65
	private ContactDetails billingDetails;
63
	
66
	
64
	public String show(){
67
	public String show(){
65
		PaymentClient paymentServiceClient = null;
68
		PaymentClient paymentServiceClient = null;
66
		Payment payment = null;
69
		Payment payment = null;
Line 79... Line 82...
79
			long txnId = payment.getMerchantTxnId();
82
			long txnId = payment.getMerchantTxnId();
80
			TransactionClient transactionServiceClient = new TransactionClient();
83
			TransactionClient transactionServiceClient = new TransactionClient();
81
			in.shop2020.model.v1.order.TransactionService.Client txnClient = transactionServiceClient.getClient();
84
			in.shop2020.model.v1.order.TransactionService.Client txnClient = transactionServiceClient.getClient();
82
			Transaction transaction = txnClient.getTransaction(txnId);
85
			Transaction transaction = txnClient.getTransaction(txnId);
83
			order = transaction.getOrders().get(0);
86
			order = transaction.getOrders().get(0);
-
 
87
			Map<Long, Double> miscCharges = txnClient.getMiscCharges(txnId);
-
 
88
			System.out.println(miscCharges);
-
 
89
			if(miscCharges != null & !miscCharges.isEmpty()){
-
 
90
				emiAmount = miscCharges.get(1L);
-
 
91
			}
84
		} catch (Exception e) {
92
		} catch (Exception e) {
85
			log.error("Error while getting transaction information", e);
93
			log.error("Error while getting transaction information", e);
86
			addActionError("We are experiencing some problems. Please try later.");
94
			addActionError("We are experiencing some problems. Please try later.");
87
			return "shipping-redirect";
95
			return "shipping-redirect";
88
		}
96
		}
Line 165... Line 173...
165
	public String getPaymentOption(){
173
	public String getPaymentOption(){
166
		return paymentOption;
174
		return paymentOption;
167
	}
175
	}
168
 
176
 
169
	public String getProcessingCode(){
177
	public String getProcessingCode(){
170
		return "000000";
178
		return paymentOption;
171
	}
179
	}
172
		
180
		
-
 
181
	public String isCtx(){
-
 
182
		return "YES";
-
 
183
	}
-
 
184
	
-
 
185
	public double getCtxProcessingFee(){
-
 
186
		return emiAmount;
-
 
187
	}
-
 
188
	
-
 
189
	public double getCtxInterest(){
-
 
190
		return ProceedToPayController.getInterestRate(Long.parseLong(paymentOption));
-
 
191
	}
-
 
192
	
173
	public String getSecureHash() throws NoSuchAlgorithmException{
193
	public String getSecureHash() throws NoSuchAlgorithmException{
174
//		MD5(orderId "|" merchantId "|" subMerchantId "|" amt "|" cur "|" proSku "|" Cname "|" mobile "|" emailId "|" redirUrl "|" 123^~abc%) (Salt Value Decide by Merchant and uniPAY-Net))
194
//		MD5(orderId "|" merchantId "|" subMerchantId "|" amt "|" cur "|" proSku "|" Cname "|" mobile "|" emailId "|" redirUrl "|" 123^~abc%) (Salt Value Decide by Merchant and uniPAY-Net))
175
		String pass = id + "|" + accountId + "|" +  "3001"  + "|" + amount  + "|" +  "INR" + "|" + getDescription() + "|" +  billingDetails.getName() + "|" + billingDetails.getPhone() + "|" + billingDetails.getEmail() + "|" + returnUrl + "|" + salt;
195
		String pass = id + "|" + accountId + "|" +  "3001"  + "|" + amount  + "|" +  "INR" + "|" + getDescription() + "|" +  billingDetails.getName() + "|" + billingDetails.getPhone() + "|" + billingDetails.getEmail() + "|" + returnUrl + "|" + salt;
176
		System.out.println(pass);
196
		System.out.println(pass);
177
		MessageDigest md = MessageDigest.getInstance("MD5");
197
		MessageDigest md = MessageDigest.getInstance("MD5");