Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | 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
 
25
		long id=psh.insertPayment(payment);
26
 
27
		System.out.println("Inserted Id: " + id);
28
 
29
		Map<String, String> attributes = new HashMap<String, String>();
30
		attributes.put("udf1", "VAL1");
31
		attributes.put("ATR2", "VAL2");
32
		psh.updatePayment(payment, attributes);
33
 
34
		System.out.println(psh.getPayment(id));
35
 
36
		Map<String, Float> minMaxAmounts = psh.getMinMaxPaymentAmount();
37
		for(String key: minMaxAmounts.keySet()){
38
			System.out.println(key + ":" + Double.parseDouble(Float.toString(minMaxAmounts.get(key))));
39
		}
40
 
41
		System.out.println(psh.getPayment(422));
42
 
43
		System.out.println(psh.getPaymentForTxn(899999));
44
 
45
		for(Payment pmnt: psh.getPaymentsForUser(3, 0L, new Date().getTime() + 86400000, 0, 1)){
46
			System.out.println(pmnt);
47
		}
48
	}
49
}