Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package in.shop2020.payment.handler;import java.util.Date;import java.util.HashMap;import java.util.Map;import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;import in.shop2020.payment.domain.Payment;import in.shop2020.payment.handler.PaymentHandler;public class TestPaymentHandler {public static void main(String[] args){ApplicationContext context = new ClassPathXmlApplicationContext("context.xml");PaymentHandler psh = (PaymentHandler) context.getBean("paymentHandler");Payment payment = new Payment();payment.setUserId(3);payment.setAmount(122.05);payment.setGatewayId(1);payment.setMerchantTxnId(899999);long id=psh.insertPayment(payment);System.out.println("Inserted Id: " + id);Map<String, String> attributes = new HashMap<String, String>();attributes.put("udf1", "VAL1");attributes.put("ATR2", "VAL2");psh.updatePayment(payment, attributes);System.out.println(psh.getPayment(id));Map<String, Float> minMaxAmounts = psh.getMinMaxPaymentAmount();for(String key: minMaxAmounts.keySet()){System.out.println(key + ":" + Double.parseDouble(Float.toString(minMaxAmounts.get(key))));}System.out.println(psh.getPayment(422));System.out.println(psh.getPaymentForTxn(899999));for(Payment pmnt: psh.getPaymentsForUser(3, 0L, new Date().getTime() + 86400000, 0, 1)){System.out.println(pmnt);}}}