Subversion Repositories SmartDukaan

Rev

Rev 13391 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 13391 Rev 20278
Line 25... Line 25...
25
    private static int gatewayId=19;
25
    private static int gatewayId=19;
26
	
26
	
27
	private long paymentId;
27
	private long paymentId;
28
	
28
	
29
	@Override
29
	@Override
30
	public long createPayment(long userId, long txnId, String paymentOption, int gatewayId){
30
	public long createPayment(long userId, long txnId, String paymentOption, int gatewayId, String paymentType){
31
		log.info("Creating payment for the txn#: " + txnId + " for the user: " + userId + " for processing through PAYU");
31
		log.info("Creating payment for the txn#: " + txnId + " for the user: " + userId + " for processing through PAYU");
32
		CommonPaymentService cps = new CommonPaymentService();
32
		CommonPaymentService cps = new CommonPaymentService();
33
		if(!cps.createPayment(userId, txnId, PayuPaymentService.gatewayId)){
33
		if(!cps.createPayment(userId, txnId, PayuPaymentService.gatewayId)){
34
			log.error("Error while creating the basic payment");
34
			log.error("Error while creating the basic payment");
35
			return PAYMENT_NOT_CREATED;
35
			return PAYMENT_NOT_CREATED;
Line 37... Line 37...
37
		paymentId = cps.getPaymentId();
37
		paymentId = cps.getPaymentId();
38
		
38
		
39
		if(paymentOption != null){
39
		if(paymentOption != null){
40
			List<Attribute> attributes = new ArrayList<Attribute>();
40
			List<Attribute> attributes = new ArrayList<Attribute>();
41
			attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
41
			attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
-
 
42
			attributes.add(new Attribute(IPaymentService.PAYMENT_TYPE, paymentType));
42
			
43
			
43
			try {
44
			try {
44
				PaymentClient paymentServiceClient = new PaymentClient();
45
				PaymentClient paymentServiceClient = new PaymentClient();
45
				paymentServiceClient.getClient().updatePaymentDetails(paymentId, null, null, null, null, null, null, null, null, PaymentStatus.INIT, null, attributes);
46
				paymentServiceClient.getClient().updatePaymentDetails(paymentId, null, null, null, null, null, null, null, null, PaymentStatus.INIT, null, attributes);
46
			} catch (Exception e) {
47
			} catch (Exception e) {
Line 54... Line 55...
54
		}
55
		}
55
 
56
 
56
		return paymentId;
57
		return paymentId;
57
	}
58
	}
58
	
59
	
59
	public long createPayment(RechargeOrder rechargeOrder, String paymentOption) {
60
	public long createPayment(RechargeOrder rechargeOrder, String paymentOption, String paymentType) {
60
	    log.info("Creating payment for the txn#: " + rechargeOrder.getId() + " for the user: " + rechargeOrder.getUserId() + " for processing through Payu");
61
	    log.info("Creating payment for the txn#: " + rechargeOrder.getId() + " for the user: " + rechargeOrder.getUserId() + " for processing through Payu");
61
        CommonPaymentService cps = new CommonPaymentService();
62
        CommonPaymentService cps = new CommonPaymentService();
62
        if(!cps.createPayment(rechargeOrder, gatewayId)){
63
        if(!cps.createPayment(rechargeOrder, gatewayId)){
63
            log.error("Error while creating the basic payment");
64
            log.error("Error while creating the basic payment");
64
            return PAYMENT_NOT_CREATED;
65
            return PAYMENT_NOT_CREATED;
Line 66... Line 67...
66
        paymentId = cps.getPaymentId();
67
        paymentId = cps.getPaymentId();
67
        
68
        
68
        if(paymentOption != null){
69
        if(paymentOption != null){
69
            List<Attribute> attributes = new ArrayList<Attribute>();
70
            List<Attribute> attributes = new ArrayList<Attribute>();
70
            attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
71
            attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
-
 
72
            attributes.add(new Attribute(IPaymentService.PAYMENT_TYPE, paymentType));
71
            
73
            
72
            try {
74
            try {
73
                PaymentClient paymentServiceClient = new PaymentClient();
75
                PaymentClient paymentServiceClient = new PaymentClient();
74
                paymentServiceClient.getClient().updatePaymentDetails(paymentId, null, null, null, null, null, null, null, null, PaymentStatus.INIT, null, attributes);
76
                paymentServiceClient.getClient().updatePaymentDetails(paymentId, null, null, null, null, null, null, null, null, PaymentStatus.INIT, null, attributes);
75
            } catch (Exception e) {
77
            } catch (Exception e) {