示例#1
0
        public async Task <JsonResult> RefundAsync([FromServices] ICCBEBS5Contract cCBEBS5Contract, string ebsHttpEndpoint, [FromServices] CCBPayOptions options, [FromBody] CCBRefundRequest request)
        {
            CCBRefundRequest refundRequest = new CCBRefundRequest()
            {
                CUST_ID    = options.MerchantId,
                USER_ID    = "",
                PASSWORD   = "",
                REQUEST_SN = DateTime.Now.ToString("yyMMddHHmmssffff"),
                TX_INFO    = new CCBRefundRequest.Content
                {
                    ORDER = request.TX_INFO.ORDER,
                    MONEY = request.TX_INFO.MONEY,
                }
            };
            CCBRefundResponse result = await cCBEBS5Contract.Refund(ebsHttpEndpoint, new CCBEBS5HttpRequest <CCBRefundRequest>(refundRequest));

            return(Json(result));
        }
示例#2
0
        static async System.Threading.Tasks.Task Main(string[] args)
        {
            string ss = HMACSHA256Hash.HashToBase64("https://octodex.github.com/images/codercat.jpg", "secretkey");

            Console.WriteLine(ss);
            Console.ReadKey();



            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            HttpApi.Register <ICCBEBS5Contract>();
            ICCBEBS5Contract ccbPayClient = HttpApi.Resolve <ICCBEBS5Contract>();

            CCBPayOptions options = new CCBPayOptions();


            while (true)
            {
                Func <string>  y = () => { Console.WriteLine("请输入退款订单"); return(Console.ReadLine()); };
                Func <decimal> x = () => { Console.WriteLine("请输入退款金额"); return(decimal.Parse(Console.ReadLine())); };

                CCBRefundRequest refundRequest = new CCBRefundRequest()
                {
                    CUST_ID    = options.MerchantId,
                    USER_ID    = "",
                    PASSWORD   = "",
                    REQUEST_SN = DateTime.Now.ToString("yyMMddHHmmssffff"),
                    TX_INFO    = new CCBRefundRequest.Content
                    {
                        ORDER = y.Invoke(),
                        MONEY = x.Invoke(),
                    }
                };
                CCBRefundResponse result = await ccbPayClient.Refund(ebsHttpEndpoint : "http://192.168.0.205:30001", new CCBEBS5HttpRequest <CCBRefundRequest>(refundRequest));

                Console.ReadKey();
            }
        }