Example #1
0
        public async Task <ReceiptDetails> GetPaymentGatewayAsyncResponse(BillingDetails billingDetails)
        {
            ReceiptDetails details = null;

            try
            {
                string json = string.Empty;
                var    gatewayIndetificator = billingDetails.PaymentGateway;
                var    url = GetProperGatewayUrl(gatewayIndetificator);

                var request = new HttpRequestMessage(HttpMethod.Get, url);
                request.Headers.Add("ApiKey", _configuration[gatewayIndetificator.ToString()]);
                request.Content = new StringContent(JsonSerializer.Serialize(billingDetails), Encoding.UTF8, "application/json");

                var httpClient = HttpClientFactory.Create();
                var response   = await httpClient.SendAsync(request);

                if (response.IsSuccessStatusCode)
                {
                    json    = response.Content.ReadAsStringAsync().Result;
                    details = JsonSerializer.Deserialize <ReceiptDetails>(json);
                }
            }
            catch (HttpRequestException e)
            {
            }

            return(details);
        }
Example #2
0
 public EditBillingDetailsForm(BillingDetails details)
     : this()
 {
     _details = details;
     // Display
     if(_details != null)
         editOwnerName.Text = _details.OwnerName;
         //editOwnerName.DataBindings.Add("Text", details, "OwnerName");
     if(_details is BankAccount)
     {
         label3.Text = "Bank name";
         BankAccount account = details as BankAccount;
         editNumber.Text = account.Number;
         editBankOrExpYear.Text = account.BankName;
     }
     else
     {
         label3.Text = "Exp year";
         if(_details != null) // Convention for new credit cards
         {
             CreditCard card = details as CreditCard;
             editNumber.Text = card.Number;
             editBankOrExpYear.Text = card.ExpYear.ToString();
             editNumber.ReadOnly = editBankOrExpYear.ReadOnly = true;
         }
     }
 }
Example #3
0
 public BillingDetails GetBillingDetails(int queueId, string casePapaerNo)
 {
     try
     {
         SqlParameter[] sqlparam;
         sqlparam    = new SqlParameter[3];
         sqlparam[0] = new SqlParameter("@flag", 8);
         sqlparam[1] = new SqlParameter("@QueueId", queueId);
         sqlparam[2] = new SqlParameter("@CPno", casePapaerNo);
         DataTable             ds  = CommonFunction.GetDataTable("USP_Get_Precription", sqlparam, "");
         BillingDetails        Ob  = new BillingDetails();
         List <BillingDetails> lst = new List <BillingDetails>();
         if (ds != null && ds.Rows.Count > 0)
         {
             DataTable dt = ds;
             foreach (DataRow dr in dt.Rows)
             {
                 BillingDetails Model = new BillingDetails();
                 CommonFunction.ReflectSingleData(Model, dr);
                 lst.Add(Model);
             }
         }
         Ob.lst = lst;
         return(Ob);
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
 }
Example #4
0
        public List <BillingDetails> DeleteBilling(int Id, int QueueId)
        {
            try
            {
                SqlParameter[] sqlparam;
                sqlparam    = new SqlParameter[2];
                sqlparam[0] = new SqlParameter("@flag", 4);
                sqlparam[1] = new SqlParameter("@Id", Id);
                sqlparam[2] = new SqlParameter("@QueueId", QueueId);
                DataTable             ds   = CommonFunction.GetDataTable("USP_delete_Precription", sqlparam, "");
                List <BillingDetails> olst = new List <BillingDetails>();
                if (ds != null && ds.Rows.Count > 0)
                {
                    DataTable dt = ds;
                    foreach (DataRow dr in dt.Rows)
                    {
                        BillingDetails Model = new BillingDetails();
                        CommonFunction.ReflectSingleData(Model, dr);
                        olst.Add(Model);
                    }
                }


                return(olst);
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
Example #5
0
        /// <summary>
        /// Create Company
        /// <param name="BillingDetails"></param>
        /// </summary>
        public int BillingDetails_crud(BillingDetails BillingDetails)
        {
            int result = 0;

            try
            {
                conn.Open();
                MySqlCommand cmd = new MySqlCommand("SP_BillingDetails_crud", conn);
                cmd.Connection = conn;
                cmd.Parameters.AddWithValue("@Billing_ID", BillingDetails.Billing_ID);
                cmd.Parameters.AddWithValue("@InvoiceBilling_ID", BillingDetails.InvoiceBilling_ID);
                cmd.Parameters.AddWithValue("@Tennant_ID", BillingDetails.Tennant_ID);
                cmd.Parameters.AddWithValue("@CompanyRegistration_Number", BillingDetails.CompanyRegistration_Number);
                cmd.Parameters.AddWithValue("@GSTTIN_Number", BillingDetails.GSTTIN_Number);
                cmd.Parameters.AddWithValue("@Pan_No", BillingDetails.Pan_No);
                cmd.Parameters.AddWithValue("@Tan_No", BillingDetails.Tan_No);
                cmd.Parameters.AddWithValue("@Created_By", BillingDetails.Created_By);
                cmd.Parameters.AddWithValue("@Modified_By", BillingDetails.Modified_By);
                cmd.CommandType = CommandType.StoredProcedure;
                result          = Convert.ToInt32(cmd.ExecuteNonQuery());
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }

            return(result);
        }
 public EditBillingDetailsForm(BillingDetails details)
     : this()
 {
     _details = details;
     // Display
     if (_details != null)
     {
         editOwnerName.Text = _details.OwnerName;
     }
     //editOwnerName.DataBindings.Add("Text", details, "OwnerName");
     if (_details is BankAccount)
     {
         label3.Text = "Bank name";
         BankAccount account = details as BankAccount;
         editNumber.Text        = account.Number;
         editBankOrExpYear.Text = account.BankName;
     }
     else
     {
         label3.Text = "Exp year";
         if (_details != null)                // Convention for new credit cards
         {
             CreditCard card = details as CreditCard;
             editNumber.Text        = card.Number;
             editBankOrExpYear.Text = card.ExpYear.ToString();
             editNumber.ReadOnly    = editBankOrExpYear.ReadOnly = true;
         }
     }
 }
Example #7
0
        public async Task <TransactionResult> ProcessPayment(Card card, BillingDetails billingDetails, double amount, string currencyCode)
        {
            var endpoint = "/process/payment";

            var bankPaymentDto = new BankPaymentDto
            {
                Amount         = amount,
                Currency       = currencyCode,
                CardDetails    = mapper.Map <BankPaymentCardDto>(card),
                BillingDetails = mapper.Map <BankPaymentBillingDetailsDto>(billingDetails)
            };

            var body = JsonSerializer.Serialize(bankPaymentDto);

            var response = await httpClient.PostAsync(endpoint, new StringContent(body, Encoding.UTF8, "application/json"));

            if (response.IsSuccessStatusCode)
            {
                var content = await response.Content.ReadAsStringAsync();

                return(JsonSerializer.Deserialize <TransactionResult>(content));
            }
            else
            {
                throw new System.Exception("Bank API is experiencing issues");
            }
        }
Example #8
0
        //billing DAl
        //public BillingDetails GetBillDetails(int QueueId, string CPno)
        //{
        //    try
        //    {
        //        SqlParameter[] sqlparam;
        //        sqlparam = new SqlParameter[3];
        //        sqlparam[0] = new SqlParameter("@flag", 8);
        //        sqlparam[1] = new SqlParameter("@QueueId", QueueId);
        //        sqlparam[2] = new SqlParameter("@CPno", CPno);

        //        DataTable ds = CommonFunction.GetDataTable("USP_Get_Precription", sqlparam, "");
        //        BillingDetails Ob = new BillingDetails();
        //        List<BillingDetails> lst = new List<BillingDetails>();
        //        if (ds != null && ds.Rows.Count > 0)
        //        {
        //            DataTable dt = ds;
        //            foreach (DataRow dr in dt.Rows)
        //            {
        //                BillingDetails Model = new BillingDetails();
        //                CommonFunction.ReflectSingleData(Model, dr);
        //                //Ob = Model;
        //                lst.Add(Model);
        //            }
        //        }
        //        Ob.lst = lst;
        //        return Ob;
        //    }
        //    catch (Exception Ex)
        //    {

        //        throw Ex;
        //    }
        //}
        public int ManageBilling(BillingDetails Ob)
        {
            try
            {
                SqlParameter[] sqlparam;
                sqlparam    = new SqlParameter[11];
                sqlparam[0] = new SqlParameter("@Id", Ob.Id);
                sqlparam[1] = new SqlParameter("@ServiceName", Ob.ServiceName);
                sqlparam[2] = new SqlParameter("@Qty", Ob.Qty);
                sqlparam[3] = new SqlParameter("@UnitPrize", Ob.UnitPrize);
                sqlparam[4] = new SqlParameter("@Bill", Ob.Bill);
                sqlparam[5] = new SqlParameter("@Paid", Ob.Paid);
                //sqlparam[4] = new SqlParameter("@Balance", ob.Balance);
                sqlparam[6]  = new SqlParameter("@CasePaperNo", Ob.CasePaperNo);
                sqlparam[7]  = new SqlParameter("@HospitalId", Ob.HospitalId);
                sqlparam[8]  = new SqlParameter("@PatientId", Ob.PatientId);
                sqlparam[9]  = new SqlParameter("@CreatedBy", Ob.CreatedBy);
                sqlparam[10] = new SqlParameter("@QueueId", Ob.QueueId);
                return(CommonFunction.Save("USP_ManageBillingForPatient", sqlparam, ""));
            }
            catch (Exception)
            {
                throw;
            }
        }
        public static OrderVariables AssignBillingToOrderVariable(OrderVariables oVariables, BillingDetails billingDetails)
        {
            //Assigning Billing Address details to OVariable

            //if (billingDetails.isBillingSameToShipping)
            //{
            //    oVariables.bill_to_fname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_fname;
            //    oVariables.bill_to_lname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname;
            //    oVariables.bill_to_address1 = oVariables.ShipVars[oVariables.default_shp_id].ship_to_address1;
            //    oVariables.bill_to_apt = oVariables.ShipVars[oVariables.default_shp_id].ship_to_apt;
            //    oVariables.bill_to_city = oVariables.ShipVars[oVariables.default_shp_id].ship_to_city;
            //    oVariables.bill_to_state = oVariables.ShipVars[oVariables.default_shp_id].ship_to_state;
            //    oVariables.bill_to_zipcode = oVariables.ShipVars[oVariables.default_shp_id].ship_to_zipcode;
            //}
            //else

            //As we are setting billing and shipping address same on landing page
            if (billingDetails.isBillingSameToShipping == false)
            {
                oVariables.bill_to_fname = billingDetails.BillingFirstName.Trim();
                oVariables.bill_to_lname = billingDetails.BillingLastName.Trim();
                oVariables.bill_to_address1 = billingDetails.BillingAddress1.Trim();
                oVariables.bill_to_apt = (!string.IsNullOrEmpty(billingDetails.BillingAddress2)) ? billingDetails.BillingAddress2.Trim() : "";
                oVariables.bill_to_city = billingDetails.BillingCity.Trim();
                oVariables.bill_to_state = billingDetails.BillingState.Trim();
                oVariables.bill_to_zipcode = billingDetails.BillingZipCode.Trim();
            }

            //Assigning Payment details to OVariable
            oVariables.credit_rule = "CCC";
            oVariables.err = "";

            if (oVariables.CCVars.Count > 0)
            {
                oVariables.CCVars[0].number = billingDetails.CreditCardNumber.Trim();
                oVariables.CCVars[0].type = "";
                oVariables.CCVars[0].expdate = billingDetails.CardExpiryMonth.Trim() + billingDetails.CardExpiryYear.Trim();
                oVariables.CCVars[0].cvv = billingDetails.SecurityCode.Trim();
                oVariables.CCVars[0].zipcode = billingDetails.CCBillZipCode;// billingDetails.BillingZipCode.Trim();
                oVariables.total_amt = 0.0;
                oVariables.total_sah = 0.0;
            }
            else
            {
                CCProperties oCCVars = new OrderEngine.CCProperties();
                oVariables.payment_type = "CC";
                oCCVars.number = billingDetails.CreditCardNumber.Trim();
                oCCVars.type = "";
                oCCVars.expdate = billingDetails.CardExpiryMonth.Trim() + billingDetails.CardExpiryYear.Trim();
                oCCVars.cvv = billingDetails.SecurityCode.Trim();
                oCCVars.zipcode = billingDetails.CCBillZipCode;// (billingDetails.BillingZipCode != null && billingDetails.BillingZipCode != "") ? billingDetails.BillingZipCode.Trim() : oVariables.bill_to_zipcode; // billingDetails.BillingZipCode.Trim();
                oVariables.credit_rule = "CCC";
                oVariables.CCVars.Add(oCCVars);
                oVariables.total_amt = 0.0;
                oVariables.total_sah = 0.0;
            }

            return oVariables;
        }
Example #10
0
        public void AddBillingActivity(string subscriptionPlanName, BillingActivityVerb actionVerbPastTense, BillingPeriod billingPeriod, decimal amount = 0)
        {
            var details  = new BillingDetails(UserFullName(), subscriptionPlanName, actionVerbPastTense, billingPeriod, DateTime.Now, amount);
            var activity = new BillingActivity(Id, details);

            BillingActivities.Add(activity);
            CreateOrUpdateUpdateEvent("BillingActivities");
        }
Example #11
0
        private static (Payment, PaymentResponse) CreateSuccessfulPaymentAndPaymentResponse()
        {
            var id                = Guid.NewGuid().ToString();
            var bankPaymentId     = Guid.NewGuid().ToString();
            var merchantPaymentId = Guid.NewGuid().ToString();
            var billingDetails    = new BillingDetails
            {
                Name           = "Test User",
                CardType       = "visa",
                CardNumber     = "4000100020003000",
                ExpiryMonth    = 12,
                ExpiryYear     = 2022,
                Cvv            = "155",
                BillingAddress = new BillingAddress()
                {
                    Title     = "Mr",
                    FirstName = "Test",
                    LastName  = "User",
                    Country   = "United Kingdom",
                    Address1  = "Test Address Line 1",
                    Address2  = "Test Address Line 2",
                    Postcode  = "ABC DEF"
                }
            };
            var currency         = "GBP";
            var amount           = 100;
            var status           = "success";
            var validationErrors = new List <ValidationError>();
            var reason           = "Payment fetched successfully";

            var payment = new Payment
            {
                Id                = id,
                BankPaymentId     = bankPaymentId,
                MerchantPaymentId = merchantPaymentId,
                BillingDetails    = billingDetails,
                Currency          = currency,
                Amount            = amount,
                Status            = status,
                ValidationErrors  = validationErrors,
                Reason            = reason
            };

            var paymentResponse = new PaymentResponse
            {
                Id                = id,
                BankPaymentId     = bankPaymentId,
                MerchantPaymentId = merchantPaymentId,
                BillingDetails    = billingDetails,
                Currency          = currency,
                Amount            = amount,
                Status            = status,
                ValidationErrors  = validationErrors,
                Reason            = reason
            };

            return(payment, paymentResponse);
        }
    public void ReturnsCorrectMessageGivenEndedAction()
    {
        BillingDetails details = new BillingDetails(_memberName, _subscriptionPlanName, BillingActivityVerb.Ended, BillingPeriod.Month, _testDate);

        string expectedMessage = $"Member ID: {_memberId}. {_memberName}'s {_subscriptionPlanName} Ended on {_testDate.ToLongDateString()}.";
        var    message         = details.GetMessageForAdminView(_memberId);

        Assert.Equal(expectedMessage, message);
    }
        public void ReturnsCorrectMessageGivenSubscribedAction()
        {
            BillingDetails details = new BillingDetails(_memberName, _subscriptionPlanName, BillingActivityVerb.Subscribed, BillingPeriod.Month, _testDate, _amount);

            string expectedMessage = $"You Subscribed to {_subscriptionPlanName} for ${_amount} on {_testDate.ToLongDateString()}.";
            var    message         = details.GetMessageForMemberView();

            Assert.Equal(expectedMessage, message);
        }
        public IActionResult PaymentOption(PaymentFirstVM model)
        {
            if (HttpContext.GetLoggedUser() != null)
            {
                TempData["logged"] = "True";
            }

            var user = HttpContext.GetLoggedUser();

            var            details = con.BillingDetails.Where(x => x.UserId == user.Id).FirstOrDefault();
            BillingDetails billing = new BillingDetails();

            if (model.CustomerInfo != null && details != null)
            {
                details.Email         = model.CustomerInfo.Email;
                details.Fullname      = model.CustomerInfo.FullName;
                details.Zip           = model.CustomerInfo.Zip;
                details.Country       = model.CustomerInfo.Country;
                details.City          = model.CustomerInfo.City;
                details.StreetAddress = model.CustomerInfo.StreetAddress;
                details.UserId        = user.Id;
                details.PhoneNumber   = model.CustomerInfo.PhoneNumber;

                con.SaveChanges();
            }
            else
            {
                billing.Email         = model.CustomerInfo.Email;
                billing.Fullname      = model.CustomerInfo.FullName;
                billing.Zip           = model.CustomerInfo.Zip;
                billing.Country       = model.CustomerInfo.Country;
                billing.City          = model.CustomerInfo.City;
                billing.StreetAddress = model.CustomerInfo.StreetAddress;
                billing.UserId        = user.Id;
                billing.PhoneNumber   = model.CustomerInfo.PhoneNumber;

                con.Add(billing);
            }

            con.SaveChanges();
            int product = con.Products.Find(model.ProductId).Id;

            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Index", "HomePage"));
            }

            PaymentOptionVM pay = new PaymentOptionVM
            {
                Price       = model.Price,
                ProductName = model.ProductName,
                PaypalRoute = "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick&amount=" + model.Price.ToString() + "&[email protected]&item_name="
                              + model.ProductName + "&return=https://localhost:44342/Payment/PaymentSuccess?ProductId=" + product
            };

            return(View(pay));
        }
Example #15
0
 public Bill(BillingDetails billingDetails)
 {
     this.BillingDetails = billingDetails;
     discounts           = new Discounts();
     IdentifyDiscountRate();
     CalculateBillingAmount();
     CalculatePercentageDiscount();
     CalculateAmountBasedDiscount();
     CalculateNetPayableAmount();
 }
Example #16
0
 public IActionResult Get(BillingDetails billingDetails)
 {
     return(Ok(new ReceiptDetails()
     {
         PayableAmount = billingDetails.PayableAmount,
         ReceiptNumber = new Random().Next(1, 10),
         UserId = billingDetails.UserId,
         PaymentStatus = (int)PaymentStatus.Success
     }));
 }
Example #17
0
 internal static string Format(BillingDetails billingDetails)
 {
     return("*******************************************\n" +
            "Billing Details for '" + billingDetails.Item.Name + "':\n" +
            "*******************************************\n" +
            "Quantity: " + billingDetails.Item.Quantity +
            "\nPrice per unit: " + billingDetails.Item.InitialPrice +
            "\nFinal rate: " + billingDetails.ItemsFinalPrice +
            "\n*********************************\n");
 }
Example #18
0
        internal static BillingDetails GetBillingDetails(Item scannedItem)
        {
            var itemFinalPrice = CalculateFinalPrice(scannedItem);
            var billingDetails = new BillingDetails(scannedItem)
            {
                ItemsFinalPrice = itemFinalPrice
            };

            return(billingDetails);
        }
        public ActionResult AddBillingAddress(Guid id)
        {
            var billingAddress = new BillingDetails
            {
                CompanyId = id,
                Address   = "Any Address"
            };

            return(View(billingAddress));
        }
        public IHttpActionResult PostBillingDetails(string id, string creditCardNumber)
        {
            if (_random.Next(4) == 0)
            {
                return InternalServerError(new BillingException("No funding."));
            }

            var d = new BillingDetails { OrderId = id, CreditCardNumber = creditCardNumber };
            _detailsStore.Add(d);
            return Created("/billing/orders/" + id, d);
        }
Example #21
0
        public IActionResult Get(BillingDetails billingDetails)
        {
            var receipt = _billingService.ProcessPayment(billingDetails);

            if (receipt != null && receipt.PaymentStatus != 1)
            {
                return(Ok(receipt));
            }

            return(Ok("Did not processed payment. Pyment status: FAIL"));
        }
Example #22
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (CustomerId != null)
         {
             hashCode = hashCode * 59 + CustomerId.GetHashCode();
         }
         if (ExpiryMonth != null)
         {
             hashCode = hashCode * 59 + ExpiryMonth.GetHashCode();
         }
         if (ExpiryYear != null)
         {
             hashCode = hashCode * 59 + ExpiryYear.GetHashCode();
         }
         if (BillingDetails != null)
         {
             hashCode = hashCode * 59 + BillingDetails.GetHashCode();
         }
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Last4 != null)
         {
             hashCode = hashCode * 59 + Last4.GetHashCode();
         }
         if (PaymentMethod != null)
         {
             hashCode = hashCode * 59 + PaymentMethod.GetHashCode();
         }
         if (Fingerprint != null)
         {
             hashCode = hashCode * 59 + Fingerprint.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (CvvCheck != null)
         {
             hashCode = hashCode * 59 + CvvCheck.GetHashCode();
         }
         if (AvsCheck != null)
         {
             hashCode = hashCode * 59 + AvsCheck.GetHashCode();
         }
         return(hashCode);
     }
 }
        public ActionResult AddBillingAddress(BillingDetails billingAddress)
        {
            if (ModelState.IsValid)
            {
                if (BillingDataService.Insert(billingAddress).IsSuccessFull)
                {
                    return(RedirectToAction("index", "Company"));
                }
            }

            return(View(billingAddress));
        }
Example #24
0
 public void UpdateBillingInfo(BillingDetails billingDetails)
 {
     using (UnitOfWork unitOfWork = new UnitOfWork())
     {
         UserDetailRepository = unitOfWork.GetRepoInstance <UserDetail>();
         UserDetail userDetail = UserDetailRepository.GetByID(CurrentUserPID);
         userDetail.ProductCreationPer = Convert.ToDecimal(billingDetails.CreationPer);
         userDetail.ProductAssignPer   = billingDetails.AssignPer;
         userDetail.ProductConvertPer  = billingDetails.ConvertPer;
         UserDetailRepository.Update(userDetail);
         unitOfWork.SaveChanges();
     }
 }
Example #25
0
 public BillingDetails GetMyBillingDetails()
 {
     if (_details == null) // Convention for new credit cards
         _details = new CreditCard(editOwnerName.Text, editNumber.Text, int.Parse(editBankOrExpYear.Text));
     _details.OwnerName = editOwnerName.Text;
     if(_details is BankAccount)
     {
         BankAccount account = _details as BankAccount;
         account.Number = editNumber.Text;
         account.BankName = editBankOrExpYear.Text;
     }
     return _details;
 }
        public JsonResult AddBillingDetails(BillingDetails billingDetails)
        {
            tbl_BillingDetails bill = new tbl_BillingDetails();

            bill.Amount_Paid     = billingDetails.Amount_Paid;
            bill.Cheque_No       = billingDetails.Cheque_No;
            bill.Transaction_No  = billingDetails.BankName;
            bill.Mode_Of_Payment = billingDetails.Mode_Of_Payment;
            bill.UserStay_ID     = billingDetails.UserStay_ID;
            bill.UserID          = billingDetails.UserID;
            context.tbl_BillingDetails.Add(bill);
            context.SaveChanges();
            return(Json("Saved"));
        }
 public ActionResult ManageBilling1(List <BillingDetails> item)
 {
     try
     {
         ModelState.Clear();
         BillingDetails b              = new BillingDetails();
         AdminDetails   admObj         = (AdminDetails)Session["UserDetails"];
         PatientDetails patientDETAILS = (PatientDetails)Session["patientDetails"];
         DataTable      custDT         = new DataTable();
         DataColumn     col            = null;
         col = new DataColumn("Id");
         custDT.Columns.Add(col);
         col = new DataColumn("ServiceName");
         custDT.Columns.Add(col);
         col = new DataColumn("Bill");
         custDT.Columns.Add(col);
         col = new DataColumn("Paid");
         custDT.Columns.Add(col);
         col = new DataColumn("Balance");
         custDT.Columns.Add(col);
         col = new DataColumn("CasePaperNo");
         custDT.Columns.Add(col);
         col = new DataColumn("HospitalId");
         custDT.Columns.Add(col);
         col = new DataColumn("PatientId");
         custDT.Columns.Add(col);
         col = new DataColumn("CreatedBy");
         custDT.Columns.Add(col);
         col = new DataColumn("QueueId");
         custDT.Columns.Add(col);
         foreach (var Details in item)
         {
             BillingDetails Bill = new BillingDetails();
             Details.CasePaperNo = patientDETAILS.CasePapaerNo;
             Details.HospitalId  = patientDETAILS.HospitalId;
             Details.PatientId   = patientDETAILS.Id;
             Details.CreatedBy   = patientDETAILS.Id;
             Details.QueueId     = patientDETAILS.QueueId;
             custDT.Rows.Add(0, Details.ServiceName, Details.Bill, Details.Paid, Details.Balance, Details.CasePaperNo, Details.HospitalId, Details.PatientId, Details.CreatedBy, Details.QueueId);
         }
         int Flag = 1;//BL.ManageBilling(custDT);
         ModelState.Clear();
         return(RedirectToAction("OpdBilling", "MyOPD"));
         //return Json("1",JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Example #28
0
        private Customer UpdateStripeCustomer(string customerId, BillingDetails billingDetails)
        {
            StripeConfiguration.ApiKey = _appKeys.StripeApiKey;

            var options = new CustomerUpdateOptions
            {
                Name  = billingDetails.Name,
                Email = billingDetails.Email,
            };
            var service  = new CustomerService();
            var customer = service.Update(customerId, options);

            return(customer);
        }
Example #29
0
        public IHttpActionResult PostBillingDetails(string id, string creditCardNumber)
        {
            if (_random.Next(4) == 0)
            {
                return(InternalServerError(new BillingException("No funding.")));
            }

            var d = new BillingDetails {
                OrderId = id, CreditCardNumber = creditCardNumber
            };

            _detailsStore.Add(d);
            return(Created("/billing/orders/" + id, d));
        }
 public BillingDetails GetMyBillingDetails()
 {
     if (_details == null)             // Convention for new credit cards
     {
         _details = new CreditCard(editOwnerName.Text, editNumber.Text, int.Parse(editBankOrExpYear.Text));
     }
     _details.OwnerName = editOwnerName.Text;
     if (_details is BankAccount)
     {
         BankAccount account = _details as BankAccount;
         account.Number   = editNumber.Text;
         account.BankName = editBankOrExpYear.Text;
     }
     return(_details);
 }
        //[ProductionRequireHttps]
        public ActionResult TestCheckout()
        {
            var billingDetails = new BillingDetails
            {
                UserId          = UserContext.UserId,
                CountryId       = 226,
                BillingOverview = new BillingOverview
                {
                    States = _orderService.States()
                },
                PaymentRequest =
                    new PaymentRequest(5.0M, AuthorizeNetConfig.ApiLogin, AuthorizeNetConfig.TransactionKey,
                                       AuthorizeNetConfig.TestMode)
            };

            SetBillingAddressFromLastOrder(billingDetails, _userService.Find(UserContext.UserId));
            return(View(billingDetails));
        }
        public ActionResult ManageBilling(BillingDetails BD)
        {
            BAL_MyOPD         BM             = new BAL_MyOPD();
            AdminDetails      admObj         = (AdminDetails)Session["UserDetails"];
            PatientAllDetails patientDETAILS = (PatientAllDetails)Session["patientDetails"];

            BD.CasePaperNo = patientDETAILS.CasePapaerNo;
            BD.HospitalId  = patientDETAILS.HospitalId;
            BD.PatientId   = patientDETAILS.Id;
            BD.CreatedBy   = patientDETAILS.Id;
            BD.QueueId     = patientDETAILS.QueueId;
            int                   i   = BL.ManageBilling(BD);
            BillingDetails        bd  = new BillingDetails();
            List <BillingDetails> lst = new List <BillingDetails>();

            bd  = BM.GetBillingDetails(patientDETAILS.QueueId, patientDETAILS.CasePapaerNo);
            lst = bd.lst;
            return(Json(lst, JsonRequestBehavior.AllowGet));
        }
        private static (MakePaymentCommandDto, MakePaymentCommand) CreateFakeMakePaymentCommandAndDto()
        {
            var merchantPaymentId = "15359b7d-4e92-4a02-b303-f7529277fe05";
            var billingDetails    = new BillingDetails
            {
                Name           = "Test User",
                CardType       = "visa",
                CardNumber     = "4000100020003000",
                ExpiryMonth    = 12,
                ExpiryYear     = 2022,
                Cvv            = "155",
                BillingAddress = new BillingAddress()
                {
                    Title     = "Mr",
                    FirstName = "Test",
                    LastName  = "User",
                    Country   = "United Kingdom",
                    Address1  = "Test Address Line 1",
                    Address2  = "Test Address Line 2",
                    Postcode  = "ABC DEF"
                }
            };
            var currency = "GBP";
            var amount   = 100;

            var makePaymentCommandDto = new MakePaymentCommandDto
            {
                MerchantPaymentId = merchantPaymentId,
                BillingDetails    = billingDetails,
                Currency          = currency,
                Amount            = amount
            };

            var makePaymentCommand = new MakePaymentCommand
            {
                MerchantPaymentId = merchantPaymentId,
                BillingDetails    = billingDetails,
                Currency          = currency,
                Amount            = amount
            };

            return(makePaymentCommandDto, makePaymentCommand);
        }
Example #34
0
        public void TestRegularCustomerDiscount()
        {
            BillingDetails billingDetails = new BillingDetails();
            CartItem       cartItem;

            billingDetails.UserDetails.UserName         = "******";
            billingDetails.UserDetails.RegistrationDate = DateTime.Parse("01/01/2017");
            billingDetails.UserDetails.Type             = UserType.RegularCutomer;
            cartItem           = new CartItem();
            cartItem.Item.Name = "Item 1";
            cartItem.Item.Rate = 99;
            cartItem.Quantity  = 10;
            billingDetails.ItemList.Add(cartItem);
            Bill bill = new Bill(billingDetails);

            Assert.AreEqual(bill.BillingDetails.DiscountRate, 0);
            Assert.AreEqual(bill.BillingDetails.NetDiscount, 45);
            Assert.AreEqual(bill.BillingDetails.NetPayableAmount, 945);
        }
        public BillingDetails BuildBillingDetails(GiftOrder order, User user = null)
        {
            var billingOverview = BuildBillingOverview(order);

              var billingDetails = new BillingDetails
              {
              GiftOrderId = order.Id,
              GiftOrderNumber = order.OrderNumber,
              UserId = order.UserId,
              CountryId = 226, // TODO: hardcoded country for now
              BillingOverview = billingOverview
              };

              if (user != null)
              {
              billingDetails.FirstName = user.FirstName;
              billingDetails.LastName = user.LastName;
              billingDetails.Email = user.Email;

              var lastOrder = LastOrderForUser(user);
              if (lastOrder != null)
              {
                  var billingAddress = lastOrder.BillingAddress;
                  if (billingAddress != null)
                  {
                      billingDetails.Address1 = billingAddress.Address1;
                      billingDetails.Address2 = billingAddress.Address2;
                      billingDetails.City = billingAddress.City;
                      billingDetails.StateOrProvince = billingAddress.StateOrProvince;
                      billingDetails.ZipCode = billingAddress.ZipCode;
                  }
              }
              }

              return billingDetails;
        }
Example #36
0
        public BillingInfo GetBillingInfo(string id)
        {
            try
            {
                BillingInfo billinfo = new BillingInfo();
                using (OracleConnection con = new OracleConnection(KENANDB))
                {
                    DataSet ds = new DataSet();

                    // Initialize Command and DataAdapter.
                    OracleCommand cmd;
                    OracleDataAdapter da;

                    // Open Connection and call stored procedure.
                    con.Open();
                    cmd = new OracleCommand("ARBOR.HT_ONE_PKG.GET_BILLING_INFO", con);
                    cmd.CommandType = CommandType.StoredProcedure;

                    // Stored procedure parameters.
                    cmd.Parameters.Add("iAccountNo", OracleType.VarChar, 256).Value = id;
                    cmd.Parameters["iAccountNo"].Direction = ParameterDirection.Input;
                    cmd.Parameters.Add("oBillingOverview", OracleType.Cursor).Direction = ParameterDirection.Output;
                    cmd.Parameters.Add("oBillingDetails", OracleType.Cursor).Direction = ParameterDirection.Output;

                    // Fill Dataset using DataAdapter
                    da = new OracleDataAdapter(cmd);
                    da.Fill(ds);

                    // Fill the overview list from first resultset
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        BillingOverview overview = new BillingOverview();
                        overview.Balance_Due = row["BALANCE_DUE"].ToString();
                        overview.Payment_Due_Date = (row["PAYMENT_DUE_DATE"].ToString() != "") ? Convert.ToDateTime(row["PAYMENT_DUE_DATE"].ToString()).ToString("d") : "";
                        overview.Bill_Cycle = row["BILL_CYCLE"].ToString();
                        billinfo.overview.Add(overview);
                    }

                    // Fill the details list from second resultset
                    foreach (DataRow row in ds.Tables[1].Rows)
                    {
                        BillingDetails details = new BillingDetails();
                        details.Service = row["SERVICE"].ToString();
                        details.Contact_Desc = row["CONTRACT_DESCR"].ToString();
                        details.Start_Date = (row["START_DT"].ToString() != "") ? Convert.ToDateTime(row["START_DT"].ToString()).ToString("d") : "";
                        details.End_Date = (row["END_DT"].ToString() != "") ? Convert.ToDateTime(row["END_DT"].ToString()).ToString("d") : "";
                        details.Status = row["STATUS"].ToString();
                        details.Month = row["MONTHS"].ToString();
                         details.ExternalID = row["EXTERNAL_ID"].ToString();
                        billinfo.details.Add(details);
                    }

                    // Explicitly close connection
                    con.Close();
                }
                return billinfo;
            }
            catch (Exception)
            {
                throw;
            }
        }
        //public Tour FindByCode(string code)
        //{
        //    return _giftCardRepository.FindBy(t => t.Code == code).SingleOrDefault();
        //}
        public GiftOrder UpdateBillingDetails(BillingDetails billingDetails)
        {
            var order = FindOrder(billingDetails.GiftOrderId, billingDetails.UserId);
              var billingAddress = order.BillingAddress ?? new Address();
              billingAddress.InjectFrom(billingDetails);
              order.BillingAddress = billingAddress;
              order.SpecialInstructions = billingDetails.SpecialInstructions;

              _giftCardOrderRepository.Update(order);

              var user = order.User;
              if (string.IsNullOrEmpty(user.FirstName))
              user.FirstName = billingDetails.FirstName;
              if (string.IsNullOrEmpty(user.LastName))
              user.LastName = billingDetails.LastName;
              _userService.UpdateUser(user);

              return order;
        }