code: async function refund(ctx) {
    let order = ctx.state.order;
    let body = ctx.state.body || ctx.request.body;
    let orderId = body.order || ctx.request.body.order;
    let reason = body.reason || ctx.request.body.reason;
    let amount = body.amount || ctx.request.body.amount;
    if (!orderId && !order || ctx.method !== 'POST') _2.default.error(400);
    if (!ctx.user) _2.default.error(403);
    if (!reason) _2.default.error('Invalid refund reason');
    if (!order) {
      // $Flow
      let orderTmp = await _Order2.default.findById(orderId).where('user', ctx.user._id);
      order = orderTmp;
      if (!order) _2.default.error('Order not found');
      if (order.state !== 400 && order.state !== 500) _2.default.error('Order state error');
    }
    if (!amount) {
      amount = order.payed;
    }
    if (amount > order.payed) _2.default.error('Invalid refund amount');
    await _2.default.run('Refund', {
      ctx, order, reason, amount
    });
    ctx.body = order.data();
  }
docs: 买家申请退款
  body.order 订单ID
  body.reason 退款原因
  body.amount 退款金额