@csrf_exempt
def notify_url_handler(request):
 logger1.info('>>notify url handler start...')
 if (request.method == 'POST'):
  if notify_verify(request.POST):
   logger1.info('pass verification...')
   tn = request.POST.get('out_trade_no')
   logger1.info(('Change the status of bill %s' % tn))
   bill = Bill.objects.get(pk=tn)
   trade_status = request.POST.get('trade_status')
   logger1.info(('the status of bill %s changed to %s' % (tn, trade_status)))
   bill.trade_status = trade_status
   bill.save()
   trade_no = request.POST.get('trade_no')
   if (trade_status == 'WAIT_SELLER_SEND_GOODS'):
    logger1.info('It is WAIT_SELLER_SEND_GOODS, so upgrade bill')
    upgrade_bill(bill, ((6 * 30) + 7))
    url = send_goods_confirm_by_platform(trade_no)
    logger1.info(('send goods confirmation. %s' % url))
    req = urllib.urlopen(url)
    return HttpResponse('success')
   else:
    logger1.info(('##info: Status of %s' % trade_status))
    return HttpResponse('success')
 return HttpResponse('fail')

@ csrf_exempt def notify_url_handler ( request ) : logger1 . info ( '>>notify url handler start...' ) if ( request . method == 'POST' ) : if notify_verify ( request . POST ) : logger1 . info ( 'pass verification...' ) tn = request . POST . get ( 'out_trade_no' ) logger1 . info ( ( 'Change the status of bill %s' % tn ) ) bill = Bill . objects . get ( pk = tn ) trade_status = request . POST . get ( 'trade_status' ) logger1 . info ( ( 'the status of bill %s changed to %s' % ( tn , trade_status ) ) ) bill . trade_status = trade_status bill . save ( ) trade_no = request . POST . get ( 'trade_no' ) if ( trade_status == 'WAIT_SELLER_SEND_GOODS' ) : logger1 . info ( 'It is WAIT_SELLER_SEND_GOODS, so upgrade bill' ) upgrade_bill ( bill , ( ( 6 * 30 ) + 7 ) ) url = send_goods_confirm_by_platform ( trade_no ) logger1 . info ( ( 'send goods confirmation. %s' % url ) ) req = urllib . urlopen ( url ) return HttpResponse ( 'success' ) else : logger1 . info ( ( '##info: Status of %s' % trade_status ) ) return HttpResponse ( 'success' ) return HttpResponse ( 'fail' )
handler for notify_url for asynchronous updating billing information .