def query_order(orderno): ''' @summary: query status of order @param orderno: order no ''' orderItemObj = OrderItem.objects.get(orderno=orderno) if orderItemObj.paied: return PayResult(orderItemObj.orderno) elif orderItemObj.lapsed: return PayResult(orderItemObj.orderno, succ=False, lapsed=True) else: payResult = _PAY_GATEWAY[orderItemObj.payway].query_order(orderItemObj.orderno) _update_order_pay_result(payResult) return payResult
def _compose_pay_result(orderNo, tradestate): result = PayResult(orderNo) result.succ = tradestate in TRADE_STATE_SUCC result.lapsed = tradestate in TRADE_STATE_LAPSED return result
def _compose_pay_result(orderNo, trade_status): result = PayResult(orderNo) result.succ = trade_status in TRADE_STATUS_SUCC result.lapsed = trade_status in TRADE_STATUS_LAPSED return result