Ejemplo n.º 1
0
        public void Precreate()
        {
            DateTime dtime = DateTime.Now;

            PayUtil.Precreate(new TradePreCreateDto {
                //discountable_amount="0",
                //undiscountable_amount="10",
                total_amount = "10",
                channel      = PayChannel.Wxpay.GetHashCode().ToString(),
                terminal_id  = "153254",
                operatore_id = "5731",
                out_trade_no = dtime.ToString("yyyyMMddHHmmss") + dtime.Millisecond.ToString().PadLeft(4, '0'),
                subject      = HttpUtility.UrlEncode("测试商品").ToUpper()
            });
        }
Ejemplo n.º 2
0
        public TradePreCreateResponse Precreate(int totalamount, int paychannel, string operid, string subject, string terminalid, string out_tradeNo)
        {
            TradePreCreateDto dto = new TradePreCreateDto
            {
                total_amount = totalamount.ToString(),
                channel      = paychannel.ToString(),
                terminal_id  = terminalid,
                operatore_id = operid,
                out_trade_no = out_tradeNo,
                subject      = HttpUtility.UrlEncode(subject).ToUpper()
            };

            if (paychannel == PayChannel.Alipay.GetHashCode())
            {
                dto.discountable_amount   = "0";
                dto.undiscountable_amount = totalamount.ToString();
            }
            return(PayUtil.Precreate(dto));
        }