Subversion Repositories SmartDukaan

Rev

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

Rev 2391 Rev 2689
Line 210... Line 210...
210
	public Map<String, String> captureHdfcPayment(long merchantPaymentId){
210
	public Map<String, String> captureHdfcPayment(long merchantPaymentId){
211
		in.shop2020.payment.domain.Payment payment = paymentHandler.getPayment(merchantPaymentId);
211
		in.shop2020.payment.domain.Payment payment = paymentHandler.getPayment(merchantPaymentId);
212
		return HdfcPaymentHandler.capturePayment(payment);
212
		return HdfcPaymentHandler.capturePayment(payment);
213
	}
213
	}
214
	
214
	
-
 
215
	@Override
-
 
216
    public long createRefund(long orderId, long merchantTxnId, double amount) throws PaymentException, TException{
-
 
217
		List<in.shop2020.payment.domain.Payment> payments = paymentHandler.getPaymentForTxn(merchantTxnId);
-
 
218
		in.shop2020.payment.domain.Payment payment = null;
-
 
219
		if(payments ==null || payments.isEmpty())
-
 
220
			throw new PaymentException(104, "No payments found corresponding to the merchant txn " + merchantTxnId);
-
 
221
		
-
 
222
		payment = payments.get(0);
-
 
223
		if(payment.getStatus() != PaymentStatus.SUCCESS.getValue())
-
 
224
			throw new PaymentException(104, "No successful payments found corresponding to the merchant txn " + merchantTxnId);
-
 
225
 
-
 
226
		//TODO: Create a refund and return its id.
-
 
227
    	return -1;
-
 
228
    }
-
 
229
	
215
	private boolean validatePaymentParams(double amount, Payment payment){
230
	private boolean validatePaymentParams(double amount, Payment payment){
216
		if(payment==null || payment.getAmount()!= amount){
231
		if(payment==null || payment.getAmount()!= amount){
217
			// We did not request this payment or the authorised amount is different.
232
			// We did not request this payment or the authorised amount is different.
218
			return false;
233
			return false;
219
		}
234
		}