Subversion Repositories SmartDukaan

Rev

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

Rev 6390 Rev 8942
Line 24... Line 24...
24
        CommonPaymentService cps = new CommonPaymentService();
24
        CommonPaymentService cps = new CommonPaymentService();
25
        if(!cps.createPayment(userId, txnId, gatewayId)){
25
        if(!cps.createPayment(userId, txnId, gatewayId)){
26
            log.error("Error while creating the basic payment");
26
            log.error("Error while creating the basic payment");
27
            return PAYMENT_NOT_CREATED;
27
            return PAYMENT_NOT_CREATED;
28
        }else{
28
        }else{
29
            return initializePayment(cps.getPaymentId(), paymentOption);
29
            return initializePayment(cps.getPaymentId(), paymentOption, cps.getAmount());
30
        }
30
        }
31
    }
31
    }
32
    
32
    
33
    private long initializePayment(long merchantPaymentId, String paymentOption){
33
    private long initializePayment(long merchantPaymentId, String paymentOption, double amount){
34
        List<Attribute> attributes = new ArrayList<Attribute>();
34
        List<Attribute> attributes = new ArrayList<Attribute>();
35
        attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
35
        attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
-
 
36
        double emiAmount = CommonPaymentService.calculateEmiAmount(paymentOption, amount);
-
 
37
        if(emiAmount > 0){
-
 
38
        	attributes.add(new Attribute(IPaymentService.EMI_AMOUNT, ""+emiAmount));
-
 
39
        }
36
        PaymentClient paymentServiceClient = null;
40
        PaymentClient paymentServiceClient = null;
37
        try {
41
        try {
38
            paymentServiceClient = new PaymentClient();
42
            paymentServiceClient = new PaymentClient();
39
        } catch (Exception e) {
43
        } catch (Exception e) {
40
            log.error("Error while getting payment client", e);
44
            log.error("Error while getting payment client", e);