コード例 #1
0
        public ResponsePayment PayByGateway(MerchantInfo info, RequestPayOrderBody body, bool isMobile = false)
        {
            if (info == null)
            {
                throw new ArgumentNullException(nameof(info));
            }

            if (body == null)
            {
                throw new ArgumentNullException(nameof(body));
            }

            body.Valid();

            var header = CreateHeader(info, "sandpay.trade.pay");

            header.ChannelType = isMobile ? "08" : "07";

            header.ProductId = PayMode.GetProduct(body);


            var payment = new RequestPayOrder();


            payment.Header = header;
            payment.Body   = body;

            var helper = new HttpRequestHelper(host);

            return(helper.Post <ResponsePayment, RequestPayOrder>("order/pay", info, payment));
        }
コード例 #2
0
        internal static string GetProduct(RequestPayOrderBody body)
        {
            switch (body.PayMode)
            {
            case H5:
                return("00000024");

            case BankPC:
                return("00000007");

            case WechatPublic:
                return("00000005");

            case WechatApp:
                return("00000024");

            case WechatH5:
                return("00000025");

            case SandCard:
                return("00000007");
            }

            throw new ArgumentException("无法识别" + body.PayMode + "对应德productId");
        }