Subversion Repositories SmartDukaan

Rev

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

Rev 16287 Rev 20278
Line 5... Line 5...
5
import in.shop2020.model.v1.order.RechargeOrder;
5
import in.shop2020.model.v1.order.RechargeOrder;
6
import in.shop2020.model.v1.order.Transaction;
6
import in.shop2020.model.v1.order.Transaction;
7
import in.shop2020.payments.Attribute;
7
import in.shop2020.payments.Attribute;
8
import in.shop2020.payments.Payment;
8
import in.shop2020.payments.Payment;
9
import in.shop2020.serving.services.IPaymentService;
9
import in.shop2020.serving.services.IPaymentService;
-
 
10
import in.shop2020.serving.utils.PaymentUtils;
10
import in.shop2020.serving.utils.Utils;
11
import in.shop2020.serving.utils.Utils;
11
import in.shop2020.thrift.clients.PaymentClient;
12
import in.shop2020.thrift.clients.PaymentClient;
12
import in.shop2020.thrift.clients.TransactionClient;
13
import in.shop2020.thrift.clients.TransactionClient;
13
import in.shop2020.thrift.clients.UserClient;
14
import in.shop2020.thrift.clients.UserClient;
14
import in.shop2020.thrift.clients.config.ConfigClient;
15
import in.shop2020.thrift.clients.config.ConfigClient;
Line 79... Line 80...
79
	}
80
	}
80
	
81
	
81
	private String id;
82
	private String id;
82
	
83
	
83
	private String paymentOption = null;
84
	private String paymentOption = null;
-
 
85
	private String paymentType = null;
84
	
86
	
85
	private StringBuilder description;
87
	private StringBuilder description;
86
	
88
	
87
	private double amount;
89
	private double amount;
88
	
90
	
Line 127... Line 129...
127
		ppp.setAddress2(order.getCustomer_address2());
129
		ppp.setAddress2(order.getCustomer_address2());
128
		ppp.setCity(order.getCustomer_city());
130
		ppp.setCity(order.getCustomer_city());
129
		ppp.setState(order.getCustomer_state());
131
		ppp.setState(order.getCustomer_state());
130
		ppp.setProductinfo(this.getDescription());
132
		ppp.setProductinfo(this.getDescription());
131
		ppp.setZipcode(order.getCustomer_pincode());
133
		ppp.setZipcode(order.getCustomer_pincode());
132
		if (this.paymentOption.equals(IPaymentService.PAYU_CC)){
134
/*		if (this.paymentOption.equals(IPaymentService.PAYU_CC)){
133
			ppp.setPg("Wallet");
135
			ppp.setPg("Wallet");
134
			ppp.setBankcode("payuw");
136
			ppp.setBankcode("payuw");
135
		} else {
137
		} else {
136
			ppp.setPg("NB");
138
			ppp.setPg("NB");
137
			ppp.setBankcode(Utils.NET_BANKING_CODES_MAP.get(this.paymentOption));
139
			ppp.setBankcode(PaymentUtils.PAYU_NET_BANKING_CODES_MAP.get(this.paymentOption));
138
		}
140
		}*/
139
 
141
 
-
 
142
		log.info("paymentOption "+this.paymentOption+" gw " +PaymentUtils.getPayugatewayCode(this.paymentOption));
-
 
143
		ppp.setPg(PaymentUtils.getPayugatewayCode(this.paymentOption));
-
 
144
		ppp.setBankcode(PaymentUtils.getPayubankCode(this.paymentOption));
140
		ppp.setSurl(returnUrl);
145
		ppp.setSurl(returnUrl);
141
		ppp.setFurl(returnUrl);
146
		ppp.setFurl(returnUrl);
142
		ppp.setCurl(cancelUrl);
147
		ppp.setCurl(cancelUrl);
143
		String[] name = order.getCustomer_name().split(" ");
148
		String[] name = order.getCustomer_name().split(" ");
144
		ppp.setFirstname(name[0]);
149
		ppp.setFirstname(name[0]);
Line 230... Line 235...
230
        }
235
        }
231
        log.info("Billing details of recharge order " + rechargeOrder.getDisplayId() + " : " + billingDetails);
236
        log.info("Billing details of recharge order " + rechargeOrder.getDisplayId() + " : " + billingDetails);
232
        ppp = new PayuPayPojo();
237
        ppp = new PayuPayPojo();
233
		ppp.setKey(getAccountId());
238
		ppp.setKey(getAccountId());
234
		ppp.setTxnid(getId());
239
		ppp.setTxnid(getId());
235
		if (this.paymentOption.equals(IPaymentService.PAYU_CC)){
240
		log.info("paymentOption "+this.paymentOption+" gw " +PaymentUtils.getPayugatewayCode(this.paymentOption));
236
			ppp.setPg("Wallet");
-
 
237
			ppp.setBankcode("payuw");
241
		ppp.setPg(PaymentUtils.getPayugatewayCode(this.paymentOption));
238
		} else {
-
 
239
			ppp.setPg("NB");
-
 
240
			ppp.setBankcode(Utils.NET_BANKING_CODES_MAP.get(this.paymentOption));
242
		ppp.setBankcode(PaymentUtils.getPayubankCode(this.paymentOption));
241
		}
243
 
242
		String[] name = billingDetails.getName().split(" ");
244
		String[] name = billingDetails.getName().split(" ");
243
		ppp.setFirstname(name[0]);
245
		ppp.setFirstname(name[0]);
244
		ppp.setEmail(billingDetails.getEmail());
246
		ppp.setEmail(billingDetails.getEmail());
245
		ppp.setPhone(billingDetails.getPhone());
247
		ppp.setPhone(billingDetails.getPhone());
246
		
248
		
Line 307... Line 309...
307
		return amount;
309
		return amount;
308
	}
310
	}
309
 
311
 
310
	public void setPaymentOption(Payment payment) {
312
	public void setPaymentOption(Payment payment) {
311
		this.paymentOption = null;
313
		this.paymentOption = null;
-
 
314
		String paymentType="";
-
 
315
		String paymentOpt="";
312
		List<Attribute> attributes = payment.getAttributes();
316
		List<Attribute> attributes = payment.getAttributes();
313
		if(attributes == null)
317
		if(attributes == null)
314
			return;
318
			return;
315
		for(Attribute attr : attributes){
319
		for(Attribute attr : attributes){
316
			if(attr.getName().equals(IPaymentService.PAYMENT_METHOD))
320
			if(attr.getName().equals(IPaymentService.PAYMENT_METHOD))
317
				this.paymentOption = attr.getValue();
321
				paymentOpt = attr.getValue();
-
 
322
			if(attr.getName().equals(IPaymentService.PAYMENT_TYPE))
-
 
323
				paymentType = attr.getValue();
318
		}
324
		}
-
 
325
		this.paymentOption = paymentType+paymentOpt;
319
	}
326
	}
320
	
327
	
321
	
328
	
322
	public String getPaymentOption(){
329
	public String getPaymentOption(){
323
		return paymentOption;
330
		return paymentOption;