| Line 123... |
Line 123... |
| 123 |
}
|
123 |
}
|
| 124 |
|
124 |
|
| 125 |
|
125 |
|
| 126 |
def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl):
|
126 |
def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl):
|
| 127 |
resp = {}
|
127 |
resp = {}
|
| 128 |
paymentId = int(re.findall(r'=(.*)?','http://www.saholic.com/pay-success?paymentId=1528903')[0])
|
128 |
paymentId = int(re.findall(r'=(.*)?',orderSuccessUrl)[0])
|
| 129 |
orderRequest = urllib2.Request(SAHOLIC_ORDER_URL %(paymentId), headers=headers)
|
129 |
orderRequest = urllib2.Request(SAHOLIC_ORDER_URL %(paymentId), headers=headers)
|
| 130 |
try:
|
130 |
try:
|
| 131 |
response = urllib2.urlopen(orderRequest).read()
|
131 |
response = urllib2.urlopen(orderRequest).read()
|
| 132 |
response = json.loads(response)['response']
|
132 |
response = json.loads(response)['response']
|
| 133 |
payment = response['payment']
|
133 |
payment = response['payment']
|
| Line 149... |
Line 149... |
| 149 |
modelName = lineitem.get('model_name')
|
149 |
modelName = lineitem.get('model_name')
|
| 150 |
color = lineitem.get('color')
|
150 |
color = lineitem.get('color')
|
| 151 |
productTitle = brand + (" " + modelName if modelName else "") + (" " + modelNumber if modelNumber is not None else "") + ("(" + color +")" if color else "")
|
151 |
productTitle = brand + (" " + modelName if modelName else "") + (" " + modelNumber if modelNumber is not None else "") + ("(" + color +")" if color else "")
|
| 152 |
amountPaid = o['total_amount']- o['gvAmount']
|
152 |
amountPaid = o['total_amount']- o['gvAmount']
|
| 153 |
subOrder = SubOrder(productTitle, None, merchantOrder.createdOn, amountPaid)
|
153 |
subOrder = SubOrder(productTitle, None, merchantOrder.createdOn, amountPaid)
|
| - |
|
154 |
subOrder.merchantSubOrderId = str(o['id'])
|
| - |
|
155 |
subOrder.orderDetailUrl = "http://m.saholic.com/order/" + subOrder.merchantSubOrderId
|
| 154 |
|
156 |
|
| 155 |
subOrder.merchantSubOrderId = o['id']
|
- |
|
| 156 |
subOrder.estimatedDeliveryDate = datetime.strftime(datetime.fromtimestamp(o['promised_delivery_time']/1000),"%d %B %Y")
|
157 |
subOrder.estimatedDeliveryDate = datetime.strftime(datetime.fromtimestamp(o['promised_delivery_time']/1000),"%d %B %Y")
|
| 157 |
subOrder.imgUrl = item['imgUrl']
|
158 |
subOrder.imgUrl = item['imgUrl']
|
| 158 |
subOrder.productUrl = "http://m.saholic.com/" + item['url']
|
159 |
subOrder.productUrl = "http://m.saholic.com/" + item['url']
|
| 159 |
subOrder.detailedStatus = o['statusDescription']
|
160 |
subOrder.detailedStatus = o['statusDescription']
|
| 160 |
(cashbackAmount, percentage) = self.getCashbackAmount(subOrder.productCode, amountPaid)
|
161 |
(cashbackAmount, percentage) = self.getCashbackAmount(subOrder.productCode, amountPaid)
|