コード例 #1
0
        public async Task TestShouldGetInvoiceId()
        {
            // create an invoice and make sure we receive an id - which means it has been successfully submitted
            var invoice      = new Invoice(50.0, "USD");
            var basicInvoice = await _bitpay.CreateInvoice(invoice);

            Assert.IsNotNull(basicInvoice.Id, "Invoice created with id=NULL");
        }
コード例 #2
0
        public async Task TestShouldGetInvoiceId()
        {
            // create an invoice and make sure we receive an id - which means it has been successfully submitted
            var invoice      = new Invoice(30.0, Currency.USD);
            var basicInvoice = await _bitpay.CreateInvoice(invoice);

            Assert.NotNull(basicInvoice.Id);
        }
コード例 #3
0
        // GET: BitPay
        public async Task <ActionResult> BitCoinPay(string orderId, string userEmail)
        {
            OrderEntity _orderinfo = new OrderEntity();

            //get order information
            _orderinfo = userRepository.GetCustomerOrderInfo(userEmail, orderId);
            var baseUrl = Request.Url.Scheme + "://" + Request.Url.Authority;
            var invoice = await bitPay.CreateInvoice(new Invoice
            {
                Price       = Convert.ToDouble(_orderinfo.TotalCost),
                Currency    = "USD",
                PosData     = Convert.ToString(_orderinfo.UserId),
                OrderId     = _orderinfo.OrderId,
                RedirectUrl = $"{baseUrl}/Success/PaymentSuccessPage"
                              //RedirectUrl = $"{baseUrl}/Home/CheckOutPage" //return back url
            });

            CommonFunction.SetCookie("BitPayInvoiceId", invoice.Id);

            return(Json(new { Status = true, ReturnUrl = invoice.Url, InvoiceId = invoice.Id }, JsonRequestBehavior.AllowGet));
        }