Subversion Repositories SmartDukaan

Rev

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

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