def createICICIPaymentReq(params): components = ['*', '*', '*', '*', '*', '*', \ '*', '*', '*', '*', '*', '*', '*', '*', '*'] data = {'action':'create_icici_request'} data['ip'] = params['ip'] data['detectFraud'] = False data['storeBillingShipping'] = False data['useragent'] = params['useragent'] data['acceptHeader'] = params['acceptheader'] data['returnUrl'] = params['returnUrl'] data['paymentAction'] = params['paymentAction'] data['paymentParam'] = params['paymentParam'] data['payableAmount'] = params['payableAmount'] data['reqType'] = 'req.Preauthorization' data['userId'] = params['userId'] encoder = simplejson.JSONEncoder() jsonStr =encoder.encode(data) url = makeAPIUrl(components, None) req = APIRequest(url, jsonStr) res = getApiResponse(req) payment_req = Payment() if res.getStatus() == 200: payment_req.fromJSONObj(res.getJSONData()['payment']) return dict(payment=payment_req, redirect_url=res.getJSONData()['redirectUrl'])
def getPayment(order_id, channel): '''gets the payment with given order_id and channel''' components = ['*', '*', '*', '*', '*', '*', \ '*', '*', '*', '*', '*', '*', '*', '*', '*'] url = makeAPIUrl(components, dict(orderid=order_id,channel=channel)) req = APIRequest(url, None) res = getApiResponse(req) if res.getStatus() == 200: payment_req = Payment() payment_req.fromJSONObj(res.getJSONData()['items'][0]) return payment_req