Subversion Repositories SmartDukaan

Rev

Rev 1946 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1946 chandransh 1
package in.shop2020.payment.handler;
2
 
3
import java.util.Date;
4
import java.util.HashMap;
5
import java.util.Map;
6
 
7
import org.springframework.context.ApplicationContext;
8
import org.springframework.context.support.ClassPathXmlApplicationContext;
9
 
10
import in.shop2020.payment.domain.Payment;
11
import in.shop2020.payment.handler.PaymentHandler;
12
 
13
public class TestPaymentHandler {
14
	public static void main(String[] args){
15
 
16
		ApplicationContext context = new ClassPathXmlApplicationContext("context.xml");
17
		PaymentHandler psh = (PaymentHandler) context.getBean("paymentHandler");
18
 
19
		Payment payment = new Payment();
20
		payment.setUserId(3);
21
		payment.setAmount(122.05);
22
		payment.setGatewayId(1);
23
		payment.setMerchantTxnId(899999);
24
		long id=psh.insertPayment(payment);
25
 
26
		System.out.println("Inserted Id: " + id);
27
 
28
		Map<String, String> attributes = new HashMap<String, String>();
29
		attributes.put("udf1", "VAL1");
30
		attributes.put("ATR2", "VAL2");
2391 chandransh 31
		payment.setGatewayPaymentId("XXXXYYYYYTTTTSSSS");
1946 chandransh 32
		psh.updatePayment(payment, attributes);
33
 
2391 chandransh 34
		payment.setGatewayPaymentId(null); //This test is to check that the if clause is working in the payment mapper
35
		psh.updatePayment(payment, attributes);
1946 chandransh 36
 
2391 chandransh 37
		payment.setGatewayPaymentId("YYYZZZZ");
38
		psh.updatePayment(payment, attributes);
39
//		System.out.println(psh.getPayment(id));
40
//		
41
//		Map<String, Float> minMaxAmounts = psh.getMinMaxPaymentAmount();
42
//		for(String key: minMaxAmounts.keySet()){
43
//			System.out.println(key + ":" + Double.parseDouble(Float.toString(minMaxAmounts.get(key))));
44
//		}
45
//		
46
//		System.out.println(psh.getPayment(422));
47
//		
48
//		System.out.println(psh.getPaymentForTxn(899999));
49
//		
50
//		for(Payment pmnt: psh.getPaymentsForUser(3, 0L, new Date().getTime() + 86400000, 0, 1)){
51
//			System.out.println(pmnt);
52
//		}
1946 chandransh 53
	}
54
}