public Payment PayForTicket(Guid orderID, Guid payingCustomerID, double amount, PaymentType methodOfPayment, Currencies? currency, string creditCard) { ITicketingServiceOneWay prox = null; Guid callId = Guid.NewGuid(); try { // Find a proxy to the ticketing service (one way) prox = TicketingServiceOneWayProxyFactory.GetProxy(false); AutoResetEvent arrived = new AutoResetEvent(false); // Create a ResultPackage with a wait handle to wait on until a response arrives (on another channel) ResultPackage pack = new ResultPackage() { ResultArrived = arrived }; ResultsCache.Current.SetPackage(callId, pack); // Call the ticketing service via MSMQ channel on another thread. Action<ITicketingServiceOneWay> del = (p => p.PayForTicket(orderID, payingCustomerID, amount, methodOfPayment, currency, callId, creditCard)); del.BeginInvoke(prox, null, null); //Wait until result arrives arrived.WaitOne(timeout); Payment result = (Payment)ResultsCache.Current.GetResult(callId); ResultsCache.Current.ClearResult(callId); return result; } catch (Exception ex) { LoggingManager.Logger.Log(LoggingCategory.Error, StringsResource.FailedToContactTicketing + " " + ex.Message); throw new TicketingException(StringsResource.TicketingFailed + " " + ex.Message, ex); } finally { if ((prox != null) && ((prox as ICommunicationObject).State == CommunicationState.Opened)) (prox as ICommunicationObject).Close(); } }
public static string GetPaymentIcon(PaymentType type, string iconName, string name) { string folderPath = FoldersHelper.GetPath(FolderType.PaymentLogo, string.Empty, false); if (!string.IsNullOrWhiteSpace(iconName) && File.Exists(FoldersHelper.GetPathAbsolut(FolderType.PaymentLogo, iconName))) { return FoldersHelper.GetPath(FolderType.PaymentLogo, iconName, false); } if (name.Contains(Resources.Resource.Install_UserContols_PaymentView_CreditCard)) { return folderPath + "plasticcard.gif"; } if (name.Contains(Resources.Resource.Install_UserContols_PaymentView_ElectronMoney)) { return folderPath + "emoney.gif"; } if (name.Contains(Resources.Resource.Install_UserContols_PaymentView_Qiwi)) { return folderPath + "qiwi.gif"; } if (name.Contains(Resources.Resource.Install_UserContols_PaymentView_Euroset)) { return folderPath + "euroset.gif"; } return string.Format("{0}{1}_default.gif", folderPath, (int)type); }
public IPayment CreatePayment(DateTime dueDate, decimal dueAmount, IParty payer, IParty payee, PaymentType type, string sale, int booking) { //Calls the paymentCollection class for create return paymentCollection.Create(dueDate, dueAmount, payer, payee, type, sale, booking); }
public void GetRecurringFromPayment_Endless(PaymentRecurrence recurrence, PaymentType type) { var startDate = new DateTime(2015, 03, 12); var enddate = Convert.ToDateTime("7.8.2016"); var payment = new PaymentViewModel { ChargedAccount = new AccountViewModel {Id = 3}, TargetAccount = new AccountViewModel {Id = 8}, Category = new CategoryViewModel {Id = 16}, Date = startDate, Amount = 2135, IsCleared = false, Type = type, IsRecurring = true }; var recurring = RecurringPaymentHelper.GetRecurringFromPayment(payment, true, recurrence, enddate); recurring.ChargedAccount.Id.ShouldBe(3); recurring.TargetAccount.Id.ShouldBe(8); recurring.StartDate.ShouldBe(startDate); recurring.EndDate.ShouldBe(enddate); recurring.IsEndless.ShouldBe(true); recurring.Amount.ShouldBe(payment.Amount); recurring.Category.Id.ShouldBe(payment.Category.Id); recurring.Type.ShouldBe(type); recurring.Recurrence.ShouldBe(recurrence); recurring.Note.ShouldBe(payment.Note); }
// constructor public PaymentInfo(string paymentId, PaymentType paymentType, DateTime startDate, DateTime endDate) { this.paymentId = paymentId; this.paymentType = paymentType; this.startDate = startDate; this.endDate = endDate; }
public void PayForTicket(Guid orderID, Guid payingCustomerID, double amount, PaymentType methodOfPayment, Currencies? currency, Guid callID, string creditCard) { try { callback_prox = CallBackChannelFactory.GetProxy(false); Payment payment = null; // Do the job and call back the ticketing bridge payment = generalTicketing.PayForTicket(orderID, payingCustomerID, amount, methodOfPayment, currency, creditCard); callback_prox.PaymentArrived(payment, callID); } catch (TicketingException tex) { LoggingManager.Logger.Log(LoggingCategory.Error, StringsResource.TicketingFailed + " " + tex.Message); throw new TicketingException(StringsResource.TicketingFailed + " " + tex.Message, tex); } catch (Exception ex) { LoggingManager.Logger.Log(LoggingCategory.Error, StringsResource.FailedToContactTicketingBridge + " " + ex.Message); throw new TicketingException(StringsResource.TicketingFailed + " " + ex.Message, ex); } finally { if ((callback_prox != null) && ((callback_prox as ICommunicationObject).State == CommunicationState.Opened)) (callback_prox as ICommunicationObject).Close(); } }
private int GetPaymentId(PaymentType paymentType) { if (paymentType == PaymentType.GiftAid) return TestContext.KnownGiftAidPaymentId; return TestContext.KnownDonationPaymentId; }
public static PaymentType GetPaymentTypeByPymnentTypeID(int PymnentTypeID) { PaymentType paymentType = new PaymentType(); SqlPaymentTypeProvider sqlPaymentTypeProvider = new SqlPaymentTypeProvider(); paymentType = sqlPaymentTypeProvider.GetPaymentTypeByPymnentTypeID(PymnentTypeID); return paymentType; }
public void Init_IncomeNotEditing_PropertiesSetupCorrectly(PaymentType type) { var accountRepoMock = new Mock<IAccountRepository>(); accountRepoMock.Setup(x => x.GetList(null)).Returns(new List<AccountViewModel>()); var paymentManager = new PaymentManager(new Mock<IPaymentRepository>().Object, accountRepoMock.Object, new Mock<IRecurringPaymentRepository>().Object, new Mock<IDialogService>().Object); var settingsManagerMock = new Mock<ISettingsManager>(); settingsManagerMock.SetupAllProperties(); var viewmodel = new ModifyPaymentViewModel(new Mock<IPaymentRepository>().Object, accountRepoMock.Object, new Mock<IDialogService>().Object, paymentManager, settingsManagerMock.Object, new Mock<IMvxMessenger>().Object, new Mock<IBackupManager>().Object); viewmodel.Init(type); //Execute and Assert viewmodel.SelectedPayment.ShouldNotBeNull(); viewmodel.SelectedPayment.Type.ShouldBe(type); viewmodel.SelectedPayment.IsTransfer.ShouldBeFalse(); viewmodel.SelectedPayment.IsRecurring.ShouldBeFalse(); }
public OperationResult Create(PaymentType paymentType, long referenceUserId, decimal amount, string description) { try { using (YomContainer container = GetYomContainer()) { Item item = container.Items.Add(new Item { Type = (short)paymentType, UserId = UserService.UserGetCurrent().Id, PayItem = new PayItem { Amount = amount, ReferenceUser = referenceUserId, Description = description, } }); container.SaveChanges(); } return OperationResult.Success; } catch (Exception e) { return OperationResult.Error(e.Message); } }
public SagePayController(IDomain domainService, IECommerce ecommerceService, IUser userService, IWebContent webContentService) : base(domainService, ecommerceService, userService, webContentService) { this.DomainService = domainService; this.ECommerceService = ecommerceService; this.UserService = userService; switch (this.DomainService.GetSettingsValue(BL.SettingsKey.sagePayMode, this.DomainID).ToLowerInvariant()) { case "test": ServerMode = VspServerMode.Test; break; case "live": ServerMode = VspServerMode.Live; break; default: ServerMode = VspServerMode.Simulator; break; } switch (this.DomainService.GetSettingsValue(BL.SettingsKey.sagePayMethod, this.DomainID).ToLowerInvariant()) { case "direct": PaymentType = PaymentType.Direct; break; default: PaymentType = PaymentType.Server; break; } }
public Payment(Purchase parameter, PaymentType type) { this.purchase = parameter; this.paymentDate = DateTime.Now; this.amount = parameter.totalAmount; this.status = PaymentStatus.Waiting; this.type = type; }
public void AddPaymentRule(ISupplier supplier, ICustomer customer, BookingType bookingType, decimal percentage, int daysOffset, BaseDate baseDate, PaymentType paymentType) { Supplier supp = (Supplier)supplier; Customer cust = (Customer)customer; supp.AddPaymentRule(cust, bookingType, percentage, daysOffset, baseDate, paymentType); }
public PurchaseItemRequest(int itemId, int buyAmount, PaymentType paymentOption, int saveLocation, List<int> accessLocation, ConsumeUponPurchase consume = null) { ItemId = itemId; BuyAmount = buyAmount; PaymentOption = paymentOption; SaveLocation = saveLocation; Consume = consume; }
public IPayment CreatePayment(DateTime dueDate, decimal dueAmount, IParty payer, IParty payee, PaymentType type, string sale, int booking) { PaymentEntity entity = new PaymentEntity(dueDate, dueAmount, payer, payee, type, sale, booking); payments.Add(entity); return entity; }
/// <summary> /// Gets the payment type string. /// </summary> /// <param name="paymentTypeID">The payment type ID.</param> /// <returns></returns> public static string GetPaymentTypeString(int paymentTypeID) { PaymentType pType = new PaymentType(); pType.LoadByPrimaryKey(paymentTypeID); if (pType.RowCount > 0) return pType.Name; return null; }
void CalcPoint(System.Data.DataRow rowData, decimal dSum, PaymentType pType) { //decimal dPointSum = 0,dInPointSum = 0,dOutPointSum=0,dPointSum_Set = 0; //decimal dInPointSum_In = 0,dOutPointSum_In= 0; //decimal dInPointSUm_Out = 0, dOutPointSum_Out = 0; // <asp:ListItem Text="消费赠送" Value="1"></asp:ListItem> //<asp:ListItem Text="充值赠送" Value="3"></asp:ListItem> //<asp:ListItem Text="抵扣" Value="2"></asp:ListItem> //<asp:ListItem Text="结算" Value="5"></asp:ListItem> int isOwner = Utilities.ToInt(rowData[CompanyBLL.IS_OWNER]); dPointSum += dSum; if (pType == PaymentType.CompanyItem) { dItemSum += Math.Abs(dSum); if (isOwner == 1) dItemSum_Owner += Math.Abs(dSum); else dItemSum_Outer += Math.Abs(dSum); } if (pType == PaymentType.AdvsGive) { dAdsSum += Math.Abs(dSum); if (isOwner == 1) dAdsSum_Owner += Math.Abs(dSum); else dAdsSum_Outer += Math.Abs(dSum); } if (pType == PaymentType.ConsumeGive) dOutPointSum_1 += Math.Abs(dSum); else if (pType == PaymentType.PrepaidGive || pType == PaymentType.AdvsGive || pType == PaymentType.Reward) dOutPointSum_3 += Math.Abs(dSum); else if (pType == PaymentType.Mortgage || pType == PaymentType.CompanyItem) dInPointSum += Math.Abs(dSum); else if (pType == PaymentType.SetMethod) dPointSum_Set += dSum; if (isOwner == 1) { if (pType == PaymentType.ConsumeGive || pType == PaymentType.PrepaidGive || pType == PaymentType.AdvsGive || pType == PaymentType.Reward) dOutPointSum_Owner += Math.Abs(dSum); else if (pType == PaymentType.Mortgage || pType == PaymentType.CompanyItem) dInPointSum_Owner += Math.Abs(dSum); } else { if (pType == PaymentType.ConsumeGive || pType == PaymentType.PrepaidGive || pType == PaymentType.AdvsGive || pType == PaymentType.Reward) dOutPointSum_Outer += Math.Abs(dSum); else if (pType == PaymentType.Mortgage || pType == PaymentType.CompanyItem) dInPointSum_Outer += Math.Abs(dSum); } }
internal PaymentRuleEntity(ISupplier supplierEntity, ICustomer customerEntity, BookingType bookingType, decimal percentage, int daysOffset, BaseDate baseDate, PaymentType paymentType) { Supplier = supplierEntity; Customer = customerEntity; BookingType = bookingType; Percentage = percentage; DaysOffset = daysOffset; BaseDate = baseDate; PaymentType = paymentType; }
public IPaymentRule CreatePaymentRule(ISupplier supplierEntity, ICustomer customerEntity, BookingType bookingType, decimal percentage, int daysOffset, BaseDate baseDate, PaymentType paymentType) { PaymentRuleEntity paymentRule = new PaymentRuleEntity(supplierEntity, customerEntity, bookingType, percentage, daysOffset, baseDate, paymentType); SupplierEntity supplier = (SupplierEntity)supplierEntity; supplier.AddPaymentRule(paymentRule); return paymentRule; }
public void SetValidData() { dataAccessFacadeStub = new DataAccessFacadeStub(); validDueDate = new DateTime(2010, 10, 10); validDueAmount = 1m; validPayer = new Customer(CustomerType.Bureau, "", "Lonely Tree", dataAccessFacadeStub); validPayee = new Supplier("Galasam", "", SupplierType.Cruise, dataAccessFacadeStub); validType = PaymentType.Balance; validSale = "VF Jan"; validBooking = 2; }
public Billing(string legalEntityName, string accountContactName, string companyRegistration, DateTime? debitOrderDate, string pastelId, string vatNumber, PaymentType paymentType, Guid id = new Guid()) : base(id) { LegalEntityName = legalEntityName; AccountContactName = accountContactName; CompanyRegistration = companyRegistration; DebitOrderDate = debitOrderDate; PastelId = pastelId; VatNumber = vatNumber; PaymentType = paymentType; }
public PaymentInfo getPaymentInfo(string paymentId,PaymentType paymentType,DateTime startDate,DateTime endDate) { PaymentInfo paymentInfo = new PaymentInfo(paymentId, paymentType, startDate, endDate); foreach (PaymentInfo p in this.paymentsInfoList) if (p.Equals(paymentInfo)) return p; this.paymentsInfoList.Add(paymentInfo); return paymentInfo; }
public decimal GetInterestPerMonths(PaymentType paymentType) { decimal interestPerMonth = 0; switch (paymentType) { case PaymentType.EASY: interestPerMonth = 8; break; case PaymentType.MEDIUM: interestPerMonth = 4; break; case PaymentType.HARD: interestPerMonth = 2; break; case PaymentType.BRUTAL: interestPerMonth = 1; break; } return interestPerMonth; }
public void When_GettingPaymentReportForKnownPaymentId_DataIsReturned(PaymentType paymentType, DataFileFormat fileFormat) { var clientConfiguration = GetDefaultDataClientConfiguration() .With((clientConfig) => clientConfig.WireDataFormat = WireDataFormat.Other); var client = new JustGivingDataClient(clientConfiguration); CreatePaymentsClient(client); var payment = PaymentsClient.RetrieveReport(GetPaymentId(paymentType), fileFormat); AssertResponseDoesNotHaveAnError(payment); Assert.IsNotNull(payment); }
public void Setup() { dbConnStr = buildConnectionString(CustomerManagementTest.Properties.Settings.Default.TestDb, () => DateTimeOffset.UtcNow.ToString("yyyy-MM-dd_hh:mm:ssZ")); using (var db = new CustomerContext(dbConnStr)) { var paymenttype = new PaymentType {Source="creditcard", SourceId=1}; db.Save(paymenttype); db.SaveChanges(); id = paymenttype.Id; } }
public static AccountType PaymentTypeToAccountType(PaymentType paymentType) { AccountType accountType = AccountType.Free; switch (paymentType) { case PaymentType.VIP: accountType = AccountType.VIP; break; default: accountType = AccountType.Paid; break; } return accountType; }
// POST api/PaymentTypeApi public async Task PostAsync(PaymentType paymentTypePosted) { MongoHelper<PaymentType> paymentTypeHelper = new MongoHelper<PaymentType>(); try { await paymentTypeHelper.Collection.InsertOneAsync(paymentTypePosted); } catch (Exception e) { Trace.TraceError("PaymentTypeApi PostAsync error : " + e.Message); throw; } }
public void TypeIntToEnum_CorrectlyParsed(int enumInt, PaymentType type) { var cb = new ContainerBuilder(); cb.RegisterModule<DataAccessModule>(); cb.Build(); var payment = new RecurringPayment() { Id = 9, Type = enumInt }; var mappedPayment = Mapper.Map<RecurringPaymentViewModel>(payment); mappedPayment.Type.ShouldBe(type); }
public void EnumToTypeInt_CorrectlyParsed(PaymentType type, int enumInt) { var cb = new ContainerBuilder(); cb.RegisterModule<DataAccessModule>(); cb.Build(); var paymentViewModel = new RecurringPaymentViewModel() { Id = 9, Type = type }; var mappedPayment = Mapper.Map<RecurringPayment>(paymentViewModel); mappedPayment.Type.ShouldBe(enumInt); }
internal PaymentRule(Supplier supplier, Customer customer, BookingType bookingType, decimal percentage, int daysOffset, BaseDate baseDate, PaymentType paymentType, IDataAccessFacade dataAccessFacade) { // validate validateCustomer(customer); validateSupplier(supplier); // Get entities for DataAccess ISupplier supplierEntity = supplier._supplierEntity; ICustomer customerEntity = customer._customerEntity; this.dataAccessFacade = dataAccessFacade; _paymentRuleEntity = dataAccessFacade.CreatePaymentRule(supplierEntity, customerEntity, bookingType, percentage, daysOffset, baseDate, paymentType); }
public int Insert(PaymentType paymentType) { this.context.PaymentTypes.Add(paymentType); return(this.context.SaveChanges()); }
/// <summary> /// This function loads the elements of the MyOrders.xml file. /// </summary> /// <param name="OrderList">This parameter is a list of ShoppingCard class.</param> /// <returns> This function does not return a value </returns> public static void LoadOrder(List <ShoppingCard> OrderList) { if (!File.Exists(@"data/MyOrders.xml")) { XmlTextWriter writer = new XmlTextWriter(@"data/MyOrders.xml", System.Text.Encoding.UTF8); writer.WriteStartDocument(true); writer.Formatting = Formatting.Indented; writer.Indentation = 2; writer.WriteStartElement("Orders"); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Close(); return; } XDocument xDoc = XDocument.Load(@"data/MyOrders.xml"); XElement OrderRootElement = xDoc.Root; NumberFormatInfo info = new NumberFormatInfo(); info.NumberDecimalSeparator = "."; foreach (XElement order in OrderRootElement.Elements()) { string customerID = order.FirstAttribute.Value; double amount = Convert.ToDouble(order.Element("PaymentAmount").Value, info); PaymentType type = PaymentType.cash; if (order.Element("PaymentType").Value == "creditcard") { type = PaymentType.creditcard; } else if (order.Element("PaymentType").Value == "transfer") { type = PaymentType.transfer; } OrderStatus orderStatus = OrderStatus.canceled; if (order.Element("OrderStatus").Value == "received") { orderStatus = OrderStatus.received; } else if (order.Element("OrderStatus").Value == "shipped") { orderStatus = OrderStatus.shipped; } else if (order.Element("OrderStatus").Value == "waitForShip") { orderStatus = OrderStatus.waitForShip; } int cargoamount = Convert.ToInt32(order.Element("CargoAmount").Value); int oid = Convert.ToInt32(order.LastAttribute.Value); List <ItemToPurchase> tempitemsToPurchase = new List <ItemToPurchase>(); XElement itemToPurchaseRootElement = order.Element("ItemToPurchaseList"); foreach (XElement item in itemToPurchaseRootElement.Elements()) { ItemToPurchase itemToPurchase = new ItemToPurchase(); string id = item.Element("id").Value; string name = item.Element("name").Value; double price = Convert.ToDouble(item.Element("price").Value, info); int quantity = Convert.ToInt32(item.Element("quantity").Value); Image image = UtilConvert.Base64ToImage(item.Element("image").Value); Creator c; if (item.FirstAttribute.Value == "Book") { c = new BookFactory(name, id, price, "", "", "", 0, image); itemToPurchase.Product = c.FactoryMethod(); itemToPurchase.Quantity = quantity; tempitemsToPurchase.Add(itemToPurchase); } else if (item.FirstAttribute.Value == "Magazine") { c = new MagazineFactory(name, id, price, "", Magazine_Type.Actual, image); itemToPurchase.Product = c.FactoryMethod(); itemToPurchase.Quantity = quantity; tempitemsToPurchase.Add(itemToPurchase); } else { c = new MusicCdFactory(name, id, price, "", MusicCD_Type.Country, image); itemToPurchase.Product = c.FactoryMethod(); itemToPurchase.Quantity = quantity; tempitemsToPurchase.Add(itemToPurchase); } } ShoppingCard _order = new ShoppingCard(); _order.itemsToPurchase = tempitemsToPurchase; _order.PaymentAmount = amount; _order.CustomerID = customerID; _order.Type = type; _order.Status = orderStatus; _order.CargoAmount = cargoamount; _order.OID = oid; OrderList.Add(_order); } }
public bool IsCashlessPayment(PaymentType payment) => GetPaymentTypesForCashless().Contains(payment);
public DailySubscription(Money amount, PaymentType type = PaymentType.subtracting) : base(amount, new TimeSpan(1, 0, 0, 0, 0), type) { }
public int GetClientNumber(PaymentType type, CountryCode country) { switch (country) { case CountryCode.SE: if (type == PaymentType.INVOICE) { return(79021); } if (type == PaymentType.PAYMENTPLAN) { return(59999); } break; case CountryCode.NO: if (type == PaymentType.INVOICE) { return(33308); } if (type == PaymentType.PAYMENTPLAN) { return(32503); } break; case CountryCode.FI: if (type == PaymentType.INVOICE) { return(26136); } if (type == PaymentType.PAYMENTPLAN) { return(27136); } break; case CountryCode.DK: if (type == PaymentType.INVOICE) { return(62008); } if (type == PaymentType.PAYMENTPLAN) { return(64008); } break; case CountryCode.NL: if (type == PaymentType.INVOICE) { return(85997); } if (type == PaymentType.PAYMENTPLAN) { return(86997); } break; case CountryCode.DE: if (type == PaymentType.INVOICE) { return(14997); } if (type == PaymentType.PAYMENTPLAN) { return(16997); } break; } return(0); }
/// <summary> /// Handles the FocusedRowChanged event of the gridViewReferences control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs" /> instance containing the event data.</param> private void gridViewReferences_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { if (e != null && e.PrevFocusedRowHandle < -1) { return; } dtDate.Value = DateTimeHelper.ServerDateTime; _reprintId = null; DataRow dr = gridViewReferences.GetFocusedDataRow(); if (dr == null) { return; } string[] referenceNo = new string[2]; referenceNo[0] = dr["RefNo"].ToString(); if (Convert.ToBoolean(dr["isConvertedDN"])) { _isConvertedDn = true; _stvLogIdChosen = (int?)dr["IsReprintOf"]; } else if (dr != null && dr["ID"] != DBNull.Value) { _isConvertedDn = false; _stvLogIdChosen = (int?)dr["ID"]; } UpdateReprintedNumbers(dr); // Enable and disable STV reprint // STV SHouldn't be reprinted off a reprint. if (dr["IsReprintOf"] != DBNull.Value && !Convert.ToBoolean(dr["isConvertedDN"])) { btnExport.Enabled = btnReprint.Enabled = false; var permission = (BLL.Settings.UseNewUserManagement) ? this.HasPermission("Print") : true; btnPrint.Enabled = permission; _reprintId = _stvLogIdChosen; _stvLogIdChosen = Convert.ToInt32(dr["IsReprintOf"]); } else if (dr["IsDeliveryNote"] != DBNull.Value && Convert.ToBoolean(dr["IsDeliveryNote"])) { btnExport.Enabled = false; btnReprint.Enabled = (BLL.Settings.UseNewUserManagement) ? this.HasPermission("Re-Print") : true; btnPrint.Enabled = false; } else { btnPrint.Enabled = this.HasPermission("Print"); btnReprint.Enabled = this.HasPermission("Re-Print"); btnExport.Enabled = this.HasPermission("Export"); } if (_stvLogIdChosen != null) { Issue log = new Issue(); log.LoadByPrimaryKey(_stvLogIdChosen.Value); Institution rus = new Institution(); IssueDoc iss = new IssueDoc(); if (!log.IsColumnNull("ReceivingUnitID")) { rus.LoadByPrimaryKey(log.ReceivingUnitID); //FacilityName.Text = rus.Name; HeaderSection.Text = rus.Name; var activity = new Activity(); activity.LoadByPrimaryKey(log.StoreID); lblActivity.Text = activity.Name; lblSubAccount.Text = activity.SubAccountName; lblMode.Text = activity.ModeName; lblAccount.Text = activity.AccountName; lblRegion.Text = rus.RegionName; lblWoreda.Text = rus.WoredaName; lblZone.Text = rus.ZoneName; lblInstType.Text = rus.InstitutionTypeName; var ownership = new OwnershipType(); ownership.LoadByPrimaryKey(rus.Ownership); lblOwnership.Text = ownership.Name; lblVoidConDate.Text = (dr["approvalDate"]) != DBNull.Value ? Convert.ToDateTime(dr["approvalDate"]).ToShortDateString(): "-"; lblIssueType.Text = (string)dr["OrderType"]; User user = new User(); if (dr["approvedBy"] != DBNull.Value) { user.LoadByPrimaryKey(Convert.ToInt32(dr["approvedBy"])); lblConfirmedBy.Text = user.FullName; } else { lblConfirmedBy.Text = "-"; } var doc = new DocumentType(); doc.LoadByPrimaryKey(log.DocumentTypeID); lblDocType.Text = doc.Name; lblPrintedDate.Text = log.PrintedDate.ToShortDateString(); var pt = new PaymentType(); if (!rus.IsColumnNull("PaymentTypeID")) { pt.LoadByPrimaryKey(rus.PaymentTypeID); lblPaymentType.Text = pt.Name; } else { lblPaymentType.Text = "-"; } // Show user name user.LoadByPrimaryKey(log.UserID); lblPrintedBy.Text = (user.FullName == "") ? user.UserName : user.FullName; // show contact person PickList pl = new PickList(); pl.LoadByPrimaryKey(log.PickListID); Order order = new Order(); order.LoadByPrimaryKey(pl.OrderID); var os = new OrderStatus(); os.LoadByPrimaryKey(order.OrderStatusID); lblIssueStatus.Text = os.OrderStatus; if (!order.IsColumnNull("ContactPerson")) { lblRecivedBy.Text = order.ContactPerson; } else { lblRecivedBy.Text = @"-"; } lblReceivedDate.Text = order.EurDate.ToShortDateString(); } dtDate.Value = log.PrintedDate; //PrintedDate.Text = dtDate.Text; lblPrintedDate.Text = dtDate.Text; gridTransactions.DataSource = iss.GetIssueBySTV(_stvLogIdChosen.Value); layoutUnconfirmedSTVs.Visibility = LayoutVisibility.Never; if (BLL.Settings.ShowMissingSTVsOnIssueLog) { DataView view = iss.GetPossibleUnconfirmedIssues(_stvLogIdChosen.Value); if (view.Count > 0) { gridUnconfirmed.DataSource = view; layoutUnconfirmedSTVs.Visibility = LayoutVisibility.Always; } else { layoutUnconfirmedSTVs.Visibility = LayoutVisibility.Never; } } } }
public void SaveView() { if (IsViewValid()) { ChangeControlsEnabled(false); var id = _employeeBusiness.GetAll() .Where(x => x.SocialSecurity == SocialSecurity.Text.ToSocialSecurity()) .DefaultIfEmpty(new Employee() { Id = string.Empty }) .FirstOrDefault() .Id; PaymentType paymentMethod = PaymentType.NA; Enum.TryParse(((ComboBoxItem)PaymentMethod.SelectedItem).Content.ToString(), out paymentMethod); TaxType taxForm = TaxType.NA; Enum.TryParse(((ComboBoxItem)TaxForm.SelectedItem).Content.ToString(), out taxForm); Employee employee = new Employee() { Address = Address.Text, Birthdate = Birthdate.SelectedDate.HasValue?Birthdate.SelectedDate.Value:DateTime.MinValue, Id = id, LastName = LastName.Text, License = new DriverLicense() { Expiration = ExpirationDate.SelectedDate.Value, Number = DriverLicense.Text, State = StateDriverLicense.Text }, Name = Name.Text, PaymentMethod = paymentMethod, PhoneNumber = PhoneNumber.Text, Rate = 0.0, SocialSecurity = SocialSecurity.Text.ToSocialSecurity(), State = State.Text, TaxForm = taxForm, City = City.Text, ZipCode = ZipCode.Text, Email = Email.Text, Job = JobDescription.Text, IsWeeklyPayment = CheckWeeklyPayment.IsChecked.Value }; if (CheckRate.IsChecked.Value) { employee.Rate = double.Parse(Rate.Text.Replace("$", string.Empty)); } else if (CheckWeeklyPayment.IsChecked.Value) { employee.Rate = double.Parse(WeeklyPayment.Text.Replace("$", string.Empty)); } _employeeBusiness.Update(employee); MessageBox.Show("The information was correctly saved!", "Save", MessageBoxButton.OK, MessageBoxImage.Information); ClearView(); FillGrid(); } else { MessageBox.Show(ValidationMessage, "Validations", MessageBoxButton.OK, MessageBoxImage.Error); } }
public PaymentTypeNotSupportedException(PaymentType type) : base($"Invalid payment type: {type.ToString()}") { }
private bool CanMakeFastPayment(PaymentType arg) { return(SelectedTicket != Ticket.Empty && SelectedTicket.GetRemainingAmount() > 0); }
private Order Generate(MerchantAccount account, Cryptocurrency coin, string unifiedFiatCurrency, string fiatCurrency, decimal amount, PaymentType paymentType, string merchantClientIP = null) { var order = new Order { Id = Guid.NewGuid(), OrderNo = NumberGenerator.GenerateUnixOrderNo(), MerchantAccountId = account.Id, CryptoId = coin.Id, CryptoCode = coin.Code, FiatAmount = amount, PaymentType = paymentType, FiatCurrency = fiatCurrency, Status = OrderStatus.Pending, Timestamp = DateTime.UtcNow, ExpiredTime = DateTime.UtcNow.AddMinutes(30), Markup = account.Markup, ExchangeRate = GetExchangeRate(account.CountryId, fiatCurrency, coin), UnifiedExchangeRate = GetExchangeRate(account.CountryId, unifiedFiatCurrency, coin), UnifiedFiatCurrency = unifiedFiatCurrency, MerchantIP = merchantClientIP }; var calcModel = CalculateAmount(amount, account.Markup, account.Receivables_Tier, order.ExchangeRate, coin); order.ActualFiatAmount = calcModel.FiatTotalAmount; order.CryptoAmount = calcModel.CryptoAmount; order.TransactionFee = calcModel.TransactionFee; order.ActualCryptoAmount = calcModel.ActualCryptoAmount; var model = CalculateUnifiedAmount(order.CryptoAmount, order.ActualCryptoAmount, order.UnifiedExchangeRate); order.UnifiedFiatAmount = model.UnifiedFiatAmount; order.UnifiedActualFiatAmount = model.UnifiedActualFiatAmount; return(order); }
public void GivenAValidPaymentTypeShouldReturnOk() { var fine = new PaymentType(Guid.NewGuid(), new Description("Cheque")); Assert.IsTrue(fine.Valid); }
private Order Generate(MerchantAccount account, Cryptocurrency coin, string unifiedFiatCurrency, decimal amount, PaymentType paymentType, string merchantClientIP = null) { return(Generate(account, coin, unifiedFiatCurrency, account.FiatCurrency, amount, paymentType, merchantClientIP)); }
public SummaryDocumentsLineType[] getSummaryDocumentsLine() { SummaryDocumentsLineType HILT = new SummaryDocumentsLineType(); SummaryDocumentsLineType[] MILT = new SummaryDocumentsLineType[RBD.Count]; for (int i = 0; i < RBD.Count; ++i) { MILT[i] = new SummaryDocumentsLineType(); LineIDType LIT = new LineIDType(); LIT.Value = (i + 1).ToString(); MILT[i].LineID = LIT; DocumentTypeCodeType DTCT = new DocumentTypeCodeType(); DTCT.Value = RBD[i].TPO_CPE; MILT[i].DocumentTypeCode = DTCT; IdentifierType IT = new IdentifierType(); IT.Value = RBD[i].DOC_SER; MILT[i].DocumentSerialID = IT; IT = null; IT = new IdentifierType(); IT.Value = RBD[i].NUM_INI.ToString(); MILT[i].StartDocumentNumberID = IT; IT = null; IT = new IdentifierType(); IT.Value = RBD[i].NUM_FIN.ToString(); MILT[i].EndDocumentNumberID = IT; AmountType1 AT1 = new AmountType1(); AT1.Value = RBD[i].MTO_TOT; AT1.currencyID = CurrencyCodeContentType.PEN; MILT[i].TotalAmount = AT1; // START - IMPORTES PaymentType[] PT = { null, null, null }; PaidAmountType PAT; InstructionIDType IIT; // IMPORTES - GRAVADOS var ImpGravados = Convert.ToDecimal(RBD[i].MTO_GRA, CultureInfo.CreateSpecificCulture("es-PE")); if (ImpGravados > 0) { PAT = new PaidAmountType(); IIT = new InstructionIDType(); PT[0] = new PaymentType(); PAT.Value = Convert.ToDecimal(RBD[i].MTO_GRA, CultureInfo.CreateSpecificCulture("es-PE")); PAT.currencyID = CurrencyCodeContentType.PEN; IIT.Value = "01"; PT[0].PaidAmount = PAT; PT[0].InstructionID = IIT; PAT = null; IIT = null; } // IMPORTES - EXONERADOS var ImpExonerado = Convert.ToDecimal(RBD[i].MTO_EXO, CultureInfo.CreateSpecificCulture("es-PE")); if (ImpExonerado > 0) { PAT = new PaidAmountType(); IIT = new InstructionIDType(); PT[1] = new PaymentType(); PAT.Value = Convert.ToDecimal(RBD[i].MTO_EXO, CultureInfo.CreateSpecificCulture("es-PE")); PAT.currencyID = CurrencyCodeContentType.PEN; IIT.Value = "02"; PT[1].PaidAmount = PAT; PT[1].InstructionID = IIT; PAT = null; IIT = null; } // IMPORTES - INAFECTO var ImpInafecto = Convert.ToDecimal(RBD[i].MTO_INA, CultureInfo.CreateSpecificCulture("es-PE")); if (ImpInafecto > 0) { PAT = new PaidAmountType(); IIT = new InstructionIDType(); PT[2] = new PaymentType(); PAT.Value = Convert.ToDecimal(RBD[i].MTO_INA, CultureInfo.CreateSpecificCulture("es-PE")); PAT.currencyID = CurrencyCodeContentType.PEN; IIT.Value = "03"; PT[2].PaidAmount = PAT; PT[2].InstructionID = IIT; PAT = null; IIT = null; MILT[i].BillingPayment = PT; } // IMPORTES - OTROS CARGOS var ImpOtroCargos = Convert.ToDecimal(RBD[i].MTO_OCA, CultureInfo.CreateSpecificCulture("es-PE")); if (ImpOtroCargos > 0) { AllowanceChargeType[] ACT = { null }; ACT[0] = new AllowanceChargeType(); ChargeIndicatorType CIT = new ChargeIndicatorType(); CIT.Value = true; ACT[0].ChargeIndicator = CIT; AT1 = null; AT1 = new AmountType1(); AT1.Value = Convert.ToDecimal(RBD[i].MTO_OCA, CultureInfo.CreateSpecificCulture("es-PE")); AT1.currencyID = CurrencyCodeContentType.PEN; ACT[0].Amount = AT1; MILT[i].AllowanceCharge = ACT; } // END - IMPORTES // START - TAXTOTAL TaxTotalType[] TTP = { null, null, null }; TaxAmountType TAT = null; TaxSubtotalType[] TST = { null }; TaxSubtotalType[] TST2 = { null }; TaxSubtotalType[] TST3 = { null }; TaxCategoryType TCT = null; TaxSchemeType THT = null; IDType IDT = null; NameType1 TNT1 = null; TaxTypeCodeType TTCT = null; // TOTAL IGV IDT = new IDType(); IDT.Value = "1000"; TNT1 = new NameType1(); TNT1.Value = "IGV"; TTCT = new TaxTypeCodeType(); TTCT.Value = "VAT"; THT = new TaxSchemeType(); THT.ID = IDT; THT.Name = TNT1; THT.TaxTypeCode = TTCT; TCT = new TaxCategoryType(); TCT.TaxScheme = THT; TAT = new TaxAmountType(); TAT.currencyID = CurrencyCodeContentType.PEN; TAT.Value = Convert.ToDecimal(RBD[i].IMP_IGV, CultureInfo.CreateSpecificCulture("es-PE")); TST[0] = new TaxSubtotalType(); TST[0].TaxAmount = TAT; TST[0].TaxCategory = TCT; TTP[0] = new TaxTotalType(); TTP[0].TaxAmount = TAT; TTP[0].TaxSubtotal = TST; TAT = null; TST = null; TCT = null; THT = null; IDT = null; TNT1 = null; TTCT = null; // TOTAL ISC IDT = new IDType(); IDT.Value = "2000"; TNT1 = new NameType1(); TNT1.Value = "ISC"; TTCT = new TaxTypeCodeType(); TTCT.Value = "EXC"; THT = new TaxSchemeType(); THT.ID = IDT; THT.Name = TNT1; THT.TaxTypeCode = TTCT; TCT = new TaxCategoryType(); TCT.TaxScheme = THT; TAT = new TaxAmountType(); TAT.currencyID = CurrencyCodeContentType.PEN; TAT.Value = Convert.ToDecimal(RBD[i].IMP_ISC, CultureInfo.CreateSpecificCulture("es-PE")); TST2[0] = new TaxSubtotalType(); TST2[0].TaxAmount = TAT; TST2[0].TaxCategory = TCT; TTP[1] = new TaxTotalType(); TTP[1].TaxAmount = TAT; TTP[1].TaxSubtotal = TST2; TAT = null; TST = null; TCT = null; THT = null; IDT = null; TNT1 = null; TTCT = null; // TOTAL OTH IDT = new IDType(); IDT.Value = "9999"; TNT1 = new NameType1(); TNT1.Value = "OTROS"; TTCT = new TaxTypeCodeType(); TTCT.Value = "OTH"; THT = new TaxSchemeType(); THT.ID = IDT; THT.Name = TNT1; THT.TaxTypeCode = TTCT; TCT = new TaxCategoryType(); TCT.TaxScheme = THT; TAT = new TaxAmountType(); TAT.currencyID = CurrencyCodeContentType.PEN; TAT.Value = Convert.ToDecimal(RBD[i].IMP_OTH, CultureInfo.CreateSpecificCulture("es-PE")); TST3[0] = new TaxSubtotalType(); TST3[0].TaxAmount = TAT; TST3[0].TaxCategory = TCT; TTP[2] = new TaxTotalType(); TTP[2].TaxAmount = TAT; TTP[2].TaxSubtotal = TST3; TAT = null; TST = null; TCT = null; THT = null; IDT = null; TNT1 = null; TTCT = null; MILT[i].TaxTotal = TTP; // END - TAXTOTAL } return(MILT); }
private IGatewayResponse SendUpdateSubscriptionRequest(AuthorizeDotNetRequest request) { var result = string.Empty; IGatewayResponse gatewayResponse = null; long id = long.Parse(request.KeyValues[AuthorizeDotNetApi.SubscriptionID]); var authentication = new MerchantAuthenticationType(); authentication.name = request.KeyValues[AuthorizeDotNetApi.ApiLogin]; authentication.transactionKey = request.KeyValues[AuthorizeDotNetApi.TransactionKey]; //do required first ARBSubscriptionType subscription = new ARBSubscriptionType(); subscription.amount = decimal.Parse(request.KeyValues[AuthorizeDotNetApi.Amount]); subscription.amountSpecified = true; subscription.name = request.KeyValues[AuthorizeDotNetApi.SubscriptionName]; PaymentType payment = new PaymentType(); var creditCard = new CreditCardType(); creditCard.cardCode = request.KeyValues[AuthorizeDotNetApi.CreditCardCode]; creditCard.cardNumber = request.KeyValues[AuthorizeDotNetApi.CreditCardNumber]; creditCard.expirationDate = request.KeyValues[AuthorizeDotNetApi.CreditCardExpiration]; payment.Item = creditCard; subscription.payment = payment; CustomerType customer = new CustomerType(); customer.id = request.KeyValues[AuthorizeDotNetApi.CustomerId]; if (request.KeyValues.ContainsKey(AuthorizeDotNetApi.Fax)) { customer.email = request.KeyValues[AuthorizeDotNetApi.Email]; } if (request.KeyValues.ContainsKey(AuthorizeDotNetApi.Fax)) { customer.faxNumber = request.KeyValues[AuthorizeDotNetApi.Fax]; } if (request.KeyValues.ContainsKey(AuthorizeDotNetApi.Phone)) { customer.phoneNumber = request.KeyValues[AuthorizeDotNetApi.Phone]; } //customer.type = CustomerTypeEnum.individual; customer.typeSpecified = false; //customer.taxId = request.KeyValues[AuthorizeDotNetApi.t]; //customer.driversLicense = request.KeyValues[AuthorizeDotNetApi.]; subscription.customer = customer; if (request.KeyValues.ContainsKey(AuthorizeDotNetApi.Address)) { NameAndAddressType customerBilling = new NameAndAddressType(); customerBilling.address = request.KeyValues[AuthorizeDotNetApi.Address]; customerBilling.city = request.KeyValues[AuthorizeDotNetApi.City]; if (request.KeyValues.ContainsKey(AuthorizeDotNetApi.Company)) { customerBilling.company = request.KeyValues[AuthorizeDotNetApi.Company]; } if (request.KeyValues.ContainsKey(AuthorizeDotNetApi.Country)) { customerBilling.country = request.KeyValues[AuthorizeDotNetApi.Country]; } customerBilling.firstName = request.KeyValues[AuthorizeDotNetApi.FirstName]; customerBilling.lastName = request.KeyValues[AuthorizeDotNetApi.LastName]; customerBilling.state = request.KeyValues[AuthorizeDotNetApi.State]; customerBilling.zip = request.KeyValues[AuthorizeDotNetApi.Zip]; subscription.billTo = customerBilling; } if (request.KeyValues.ContainsKey(AuthorizeDotNetApi.ShipAddress)) { NameAndAddressType shipping = new NameAndAddressType(); shipping.address = request.KeyValues[AuthorizeDotNetApi.ShipAddress]; shipping.city = request.KeyValues[AuthorizeDotNetApi.ShipCity]; if (request.KeyValues.ContainsKey(AuthorizeDotNetApi.ShipCompany)) { shipping.company = request.KeyValues[AuthorizeDotNetApi.ShipCompany]; } if (request.KeyValues.ContainsKey(AuthorizeDotNetApi.ShipCountry)) { shipping.country = request.KeyValues[AuthorizeDotNetApi.ShipCountry]; } shipping.firstName = request.KeyValues[AuthorizeDotNetApi.ShipFirstName]; shipping.lastName = request.KeyValues[AuthorizeDotNetApi.ShipLastName]; shipping.state = request.KeyValues[AuthorizeDotNetApi.ShipState]; shipping.zip = request.KeyValues[AuthorizeDotNetApi.ShipZip]; subscription.shipTo = shipping; } if (request.KeyValues.ContainsKey(AuthorizeDotNetApi.InvoiceNumber)) { OrderType order = new OrderType(); order.invoiceNumber = request.KeyValues[AuthorizeDotNetApi.InvoiceNumber]; subscription.order = order; } //PaymentScheduleType paymentSchedule = new PaymentScheduleType(); //PaymentScheduleTypeInterval paymentScheduleTypeInterval = new PaymentScheduleTypeInterval(); //paymentScheduleTypeInterval.length = short.Parse(request.KeyValues[AuthorizeDotNetApi.BillingCycles]); //paymentScheduleTypeInterval.unit = (ARBSubscriptionUnitEnum)Enum.Parse(typeof(ARBSubscriptionUnitEnum), request.KeyValues[AuthorizeDotNetApi.BillingInterval], true); //paymentSchedule.interval = paymentScheduleTypeInterval; //paymentSchedule.startDate = DateTime.Parse(request.KeyValues[AuthorizeDotNetApi.StartsOn].ToString()); //paymentSchedule.startDateSpecified = true; //paymentSchedule.totalOccurrencesSpecified = true; //paymentSchedule.totalOccurrences = short.Parse(request.KeyValues[AuthorizeDotNetApi.TotalOccurences].ToString()); //paymentSchedule.trialOccurrencesSpecified = false; subscription.trialAmountSpecified = false; if (request.KeyValues.ContainsKey(AuthorizeDotNetApi.TrialAmount)) { subscription.trialAmount = decimal.Parse(request.KeyValues[AuthorizeDotNetApi.TrialAmount]); subscription.trialAmountSpecified = true; //paymentSchedule.trialOccurrences = short.Parse(request.KeyValues[AuthorizeDotNetApi.TrialBillingCycles]); //paymentSchedule.trialOccurrencesSpecified = true; } //authorize does not allow us to update intervals... //subscription.paymentSchedule = paymentSchedule; using (var webService = new RevStack.AuthorizeDotNet.net.authorize.api.Service()) { webService.Url = request.PostUrl; var response = webService.ARBUpdateSubscription(authentication, id, subscription, null); if (response.resultCode != MessageTypeEnum.Ok) { char del = request.KeyValues[AuthorizeDotNetApi.DelimitCharacter].ToCharArray()[0]; IList <string> list = new List <string>(); for (int i = 0; i < response.messages.Length; i++) { result += response.messages[i].text + del; list.Add(response.messages[i].text); } result = result.TrimEnd(del); gatewayResponse = new GatewayResponse(result, del); gatewayResponse.SubscriptionResponse = list; } else { IList <string> list = new List <string>(); for (int i = 0; i < response.messages.Length; i++) { list.Add(response.messages[i].text); } gatewayResponse = new GatewayResponse(id.ToString()); gatewayResponse.SubscriptionResponse = list; } //if (response.resultCode == MessageTypeEnum.Ok) //{ // char del = request.KeyValues[AuthorizeDotNetApi.DelimitCharacter].ToCharArray()[0]; // for (int i = 0; i < response.messages.Length; i++) // { // result = response.messages[i].text + del; // } // result = result.TrimEnd(del); // gatewayResponse = new AuthorizeDotNetResponse(result, del); // gatewayResponse.SubscriptionId = id.ToString(); //} } return(gatewayResponse); }
public void ProcessRecurringGiftDecline(string subscriptionId) { var recurringGift = GetRecurringGiftForSubscription(subscriptionId); UpdateRecurringGiftFailureCount(recurringGift.RecurringGiftId.Value, recurringGift.ConsecutiveFailureCount + 1); var acctType = GetDonorAccountPymtType(recurringGift.DonorAccountId.Value); var paymentType = PaymentType.GetPaymentType(acctType).name; var templateId = recurringGift.ConsecutiveFailureCount >= 2 ? PaymentType.GetPaymentType(acctType).recurringGiftCancelEmailTemplateId : PaymentType.GetPaymentType(acctType).recurringGiftDeclineEmailTemplateId; var frequency = recurringGift.Frequency == 1 ? "Weekly" : "Monthly"; var program = _programService.GetProgramById(Convert.ToInt32(recurringGift.ProgramId)); var amt = decimal.Round(recurringGift.Amount, 2, MidpointRounding.AwayFromZero); SendEmail(templateId, recurringGift.DonorId, amt, paymentType, DateTime.Now, program.Name, "fail", frequency); }
public void GetPaymentInfo(PaymentType paymentType) { }
public int CreateDonationAndDistributionRecord(MpDonationAndDistributionRecord donationAndDistribution, bool sendConfirmationEmail = true) { var pymtId = PaymentType.GetPaymentType(donationAndDistribution.PymtType).id; var fee = donationAndDistribution.FeeAmt.HasValue ? donationAndDistribution.FeeAmt / Constants.StripeDecimalConversionValue : null; var apiToken = ApiLogin(); var donationValues = new Dictionary <string, object> { { "Donor_ID", donationAndDistribution.DonorId }, { "Donation_Amount", donationAndDistribution.DonationAmt }, { "Processor_Fee_Amount", fee }, { "Payment_Type_ID", pymtId }, { "Donation_Date", donationAndDistribution.SetupDate }, { "Transaction_code", donationAndDistribution.ChargeId }, { "Registered_Donor", donationAndDistribution.RegisteredDonor }, { "Anonymous", donationAndDistribution.Anonymous }, { "Processor_ID", donationAndDistribution.ProcessorId }, { "Donation_Status_Date", donationAndDistribution.SetupDate }, { "Donation_Status_ID", donationAndDistribution.DonationStatus ?? 1 }, //hardcoded to pending if no status specified { "Recurring_Gift_ID", donationAndDistribution.RecurringGiftId }, { "Is_Recurring_Gift", donationAndDistribution.RecurringGift }, { "Donor_Account_ID", donationAndDistribution.DonorAcctId }, { "Source_Url", donationAndDistribution.SourceUrl }, { "Predefined_Amount", donationAndDistribution.PredefinedAmount }, }; if (!string.IsNullOrWhiteSpace(donationAndDistribution.CheckScannerBatchName)) { donationValues["Check_Scanner_Batch"] = donationAndDistribution.CheckScannerBatchName; } if (!string.IsNullOrWhiteSpace(donationAndDistribution.CheckNumber)) { donationValues["Item_Number"] = donationAndDistribution.CheckNumber; } if (!string.IsNullOrWhiteSpace(donationAndDistribution.Notes)) { donationValues["Notes"] = donationAndDistribution.Notes; } int donationId; try { donationId = _ministryPlatformService.CreateRecord(_donationPageId, donationValues, apiToken, true); } catch (Exception e) { throw new ApplicationException(string.Format("CreateDonationRecord failed. Donor Id: {0}", donationAndDistribution.DonorId), e); } if (donationAndDistribution.HasDistributions) { foreach (var distribution in donationAndDistribution.Distributions) { CreateDistributionRecord(donationId, distribution.donationDistributionAmt / Constants.StripeDecimalConversionValue, distribution.donationDistributionProgram, distribution.PledgeId, apiToken); } } else if (string.IsNullOrWhiteSpace(donationAndDistribution.ProgramId)) { return(donationId); } else { CreateDistributionRecord(donationId, donationAndDistribution.DonationAmt, donationAndDistribution.ProgramId, donationAndDistribution.PledgeId, apiToken); } if (!sendConfirmationEmail) { return(donationId); } if (sendConfirmationEmail) { try { SetupConfirmationEmail(Convert.ToInt32(donationAndDistribution.ProgramId), donationAndDistribution.DonorId, donationAndDistribution.DonationAmt, donationAndDistribution.SetupDate, donationAndDistribution.PymtType, donationAndDistribution.PledgeId ?? 0); } catch (Exception e) { _logger.Error(string.Format("Failed when processing the template for Donation Id: {0}", donationId), e); } } return(donationId); }
public void insertPayment(PaymentType paymentTypes) { db.PaymentTypes.Add(paymentTypes); db.SaveChanges(); }
//Get all customers with Include products public async Task <IActionResult> GetAllCustomersWithProducts(string include) { using (SqlConnection conn = Connection) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) { if (include.ToLower() == "product") { cmd.CommandText = @"SELECT c.Id as CustomerId, c.FirstName, c.LastName, c.CreationDate, c.LastActiveDate, c.IsActive, p.Id as ProductId, p.ProductName, p.ProductTypeId as ProductTypeId, p.Price, p.Quantity, p.Description FROM Customer c LEFT JOIN Product p ON c.Id = p.CustomerId"; SqlDataReader reader = cmd.ExecuteReader(); Dictionary <int, Customer> customers = new Dictionary <int, Customer>(); while (reader.Read()) { int customerId = reader.GetInt32(reader.GetOrdinal("CustomerId")); if (!customers.ContainsKey(customerId)) { Customer customer = new Customer { Id = reader.GetInt32(reader.GetOrdinal("CustomerId")), FirstName = reader.GetString(reader.GetOrdinal("FirstName")), LastName = reader.GetString(reader.GetOrdinal("LastName")), CreationDate = reader.GetDateTime(reader.GetOrdinal("CreationDate")), LastActiveDate = reader.GetDateTime(reader.GetOrdinal("LastActiveDate")), IsActive = reader.GetBoolean(reader.GetOrdinal("IsActive")), ProductsToSell = new List <Product>(), PaymentTypes = new List <PaymentType>(), Orders = new List <Order>() }; customers.Add(customerId, customer); } Customer fromDictionary = customers[customerId]; if (!reader.IsDBNull(reader.GetOrdinal("ProductId"))) { Product product = new Product { Id = reader.GetInt32(reader.GetOrdinal("ProductId")), ProductName = reader.GetString(reader.GetOrdinal("ProductName")), Price = reader.GetDecimal(reader.GetOrdinal("Price")), Description = reader.GetString(reader.GetOrdinal("Description")), Quantity = reader.GetInt32(reader.GetOrdinal("Quantity")), ProductTypeId = reader.GetInt32(reader.GetOrdinal("ProductTypeId")), }; fromDictionary.ProductsToSell.Add(product); } } reader.Close(); return(Ok(customers.Values)); } if (include.ToLower() == "payment") { cmd.CommandText = @"SELECT c.Id as CustomerId, c.FirstName, c.LastName, c.CreationDate, c.LastActiveDate, c.IsActive, pt.Id as PaymentTypeId, pt.CustomerId as CustomerId, pt.Type as PaymentType, pt.AcctNumber as AccountNumber FROM Customer c LEFT JOIN PaymentType pt ON c.Id = pt.CustomerId"; SqlDataReader reader = cmd.ExecuteReader(); Dictionary <int, Customer> customers = new Dictionary <int, Customer>(); while (reader.Read()) { int customerId = reader.GetInt32(reader.GetOrdinal("CustomerId")); if (!customers.ContainsKey(customerId)) { Customer customer = new Customer { Id = reader.GetInt32(reader.GetOrdinal("CustomerId")), FirstName = reader.GetString(reader.GetOrdinal("FirstName")), LastName = reader.GetString(reader.GetOrdinal("LastName")), CreationDate = reader.GetDateTime(reader.GetOrdinal("CreationDate")), LastActiveDate = reader.GetDateTime(reader.GetOrdinal("LastActiveDate")), IsActive = reader.GetBoolean(reader.GetOrdinal("IsActive")), ProductsToSell = new List <Product>(), PaymentTypes = new List <PaymentType>(), Orders = new List <Order>() }; customers.Add(customerId, customer); } Customer fromDictionary = customers[customerId]; if (!reader.IsDBNull(reader.GetOrdinal("PaymentTypeId"))) { PaymentType paymentType = new PaymentType { Id = reader.GetInt32(reader.GetOrdinal("PaymentTypeId")), Type = reader.GetString(reader.GetOrdinal("PaymentType")), AcctNumber = reader.GetString(reader.GetOrdinal("AccountNumber")) }; fromDictionary.PaymentTypes.Add(paymentType); } } reader.Close(); return(Ok(customers.Values)); } return(null); } } }
public async Task <IActionResult> Get([FromQuery] string q, string _include, string active) { string SqlCommandText = @" SELECT c.Id as CustomerId, c.FirstName, c.LastName, o.Id as OrderId, o.CustomerId, o.PaymentTypeId FROM Customer c LEFT JOIN [Order] o on o.CustomerId = c.Id"; if (_include == "products") { SqlCommandText = @" SELECT c.Id as CustomerId, c.FirstName, c.LastName, p.Id as ProductId, p.[Title] as ProductTitle, p.Description, p.Price, p.Quantity, p.CustomerId, p.ProductTypeId, o.Id as OrderId FROM Customer c LEFT JOIN Product p ON c.Id = p.CustomerId LEFT JOIN [Order] o ON o.CustomerId = c.Id"; } else if (_include == "payments") { SqlCommandText = @" SELECT c.Id as CustomerId, c.FirstName, c.LastName, p.Id as PaymentTypeId, p.[Name] as PaymentTypeName, p.AcctNumber, p.CustomerId, o.Id as OrderId FROM Customer c LEFT JOIN PaymentType p ON c.Id = p.CustomerId LEFT JOIN [Order] o ON o.CustomerId = c.Id"; } else if (active == "false") { SqlCommandText = @" SELECT c.Id as CustomerId, c.FirstName, c.LastName, o.Id as OrderId FROM [Customer] c LEFT JOIN [Order] o on o.CustomerId = c.Id WHERE o.Id IS NULL"; } if (q != null) { SqlCommandText = $@"{SqlCommandText} WHERE ( c.FirstName LIKE @q OR c.LastName LIKE @q ) "; } using (SqlConnection conn = Connection) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandText = SqlCommandText; if (q != null) { cmd.Parameters.Add(new SqlParameter("@q", $"%{q}%")); } SqlDataReader reader = cmd.ExecuteReader(); List <Customer> customers = new List <Customer>(); while (reader.Read()) { Customer customer = new Customer { Id = reader.GetInt32(reader.GetOrdinal("CustomerId")), FirstName = reader.GetString(reader.GetOrdinal("FirstName")), LastName = reader.GetString(reader.GetOrdinal("LastName")), Products = new List <Product>(), PaymentTypes = new List <PaymentType>(), IsActive = false }; if (!reader.IsDBNull(reader.GetOrdinal("OrderId"))) { customer.IsActive = true; } if (_include == "products") { Product product = new Product(); if (!reader.IsDBNull(reader.GetOrdinal("ProductId"))) { product.Id = reader.GetInt32(reader.GetOrdinal("ProductId")); product.Title = reader.GetString(reader.GetOrdinal("ProductTitle")); product.Description = reader.GetString(reader.GetOrdinal("Description")); product.Price = reader.GetDecimal(reader.GetOrdinal("Price")); product.ProductTypeId = reader.GetInt32(reader.GetOrdinal("ProductTypeId")); product.CustomerId = reader.GetInt32(reader.GetOrdinal("CustomerId")); product.Quantity = reader.GetInt32(reader.GetOrdinal("Quantity")); } else { product = null; }; if (customers.Any(c => c.Id == customer.Id)) { Customer existingCustomer = customers.Find(c => c.Id == customer.Id); existingCustomer.Products.Add(product); } else { customer.Products.Add(product); customers.Add(customer); } } else if (_include == "payments") { PaymentType paymentType = new PaymentType(); if (!reader.IsDBNull(reader.GetOrdinal("PaymentTypeId"))) { paymentType.Id = reader.GetInt32(reader.GetOrdinal("PaymentTypeId")); paymentType.Name = reader.GetString(reader.GetOrdinal("PaymentTypeName")); paymentType.AcctNumber = reader.GetInt32(reader.GetOrdinal("AcctNumber")); paymentType.CustomerId = reader.GetInt32(reader.GetOrdinal("CustomerId")); } else { paymentType = null; }; if (customers.Any(c => c.Id == customer.Id)) { Customer existingCustomer = customers.Find(c => c.Id == customer.Id); existingCustomer.PaymentTypes.Add(paymentType); } else { customer.PaymentTypes.Add(paymentType); customers.Add(customer); } } else if (active == "false") { if (customers.Any(c => c.Id == customer.Id)) { Customer existingCustomer = customers.Find(c => c.Id == customer.Id); } else { customers.Add(customer); } } else { if (customers.Any(c => c.Id == customer.Id)) { Customer existingCustomer = customers.Find(c => c.Id == customer.Id); } else { customers.Add(customer); } } } reader.Close(); return(Ok(customers)); } } }
public void CreateData() { CreateDefaultCurrenciesIfNeeded(); if (!ShouldCreateData()) { return; } var saleAccountType = new AccountType { Name = string.Format(Resources.Accounts_f, Resources.Sales) }; var receivableAccountType = new AccountType { Name = string.Format(Resources.Accounts_f, Resources.Receiveable) }; var paymentAccountType = new AccountType { Name = string.Format(Resources.Accounts_f, Resources.Payment) }; var discountAccountType = new AccountType { Name = string.Format(Resources.Accounts_f, Resources.Discount) }; var customerAccountType = new AccountType { Name = string.Format(Resources.Accounts_f, Resources.Customer) }; _workspace.Add(receivableAccountType); _workspace.Add(saleAccountType); _workspace.Add(paymentAccountType); _workspace.Add(discountAccountType); _workspace.Add(customerAccountType); _workspace.CommitChanges(); var customerEntityType = new EntityType { Name = Resources.Customers, EntityName = Resources.Customer, AccountTypeId = customerAccountType.Id, PrimaryFieldName = Resources.Name }; customerEntityType.EntityCustomFields.Add(new EntityCustomField { EditingFormat = "(###) ### ####", FieldType = 0, Name = Resources.Phone }); customerEntityType.AccountNameTemplate = "[Name]-[" + Resources.Phone + "]"; var tableEntityType = new EntityType { Name = Resources.Tables, EntityName = Resources.Table, PrimaryFieldName = Resources.Name }; _workspace.Add(customerEntityType); _workspace.Add(tableEntityType); _workspace.CommitChanges(); var accountScreen = new AccountScreen { Name = Resources.General }; accountScreen.AccountScreenValues.Add(new AccountScreenValue { AccountTypeName = saleAccountType.Name, AccountTypeId = saleAccountType.Id, DisplayDetails = true, SortOrder = 10 }); accountScreen.AccountScreenValues.Add(new AccountScreenValue { AccountTypeName = receivableAccountType.Name, AccountTypeId = receivableAccountType.Id, DisplayDetails = true, SortOrder = 20 }); accountScreen.AccountScreenValues.Add(new AccountScreenValue { AccountTypeName = discountAccountType.Name, AccountTypeId = discountAccountType.Id, DisplayDetails = true, SortOrder = 30 }); accountScreen.AccountScreenValues.Add(new AccountScreenValue { AccountTypeName = paymentAccountType.Name, AccountTypeId = paymentAccountType.Id, DisplayDetails = true, SortOrder = 40 }); _workspace.Add(accountScreen); var defaultSaleAccount = new Account { AccountTypeId = saleAccountType.Id, Name = Resources.Sales }; var defaultReceivableAccount = new Account { AccountTypeId = receivableAccountType.Id, Name = Resources.Receivables }; var cashAccount = new Account { AccountTypeId = paymentAccountType.Id, Name = Resources.Cash }; var creditCardAccount = new Account { AccountTypeId = paymentAccountType.Id, Name = Resources.CreditCard }; var voucherAccount = new Account { AccountTypeId = paymentAccountType.Id, Name = Resources.Voucher }; var defaultDiscountAccount = new Account { AccountTypeId = discountAccountType.Id, Name = Resources.Discount }; var defaultRoundingAccount = new Account { AccountTypeId = discountAccountType.Id, Name = Resources.Rounding }; _workspace.Add(defaultSaleAccount); _workspace.Add(defaultReceivableAccount); _workspace.Add(defaultDiscountAccount); _workspace.Add(defaultRoundingAccount); _workspace.Add(cashAccount); _workspace.Add(creditCardAccount); _workspace.Add(voucherAccount); _workspace.CommitChanges(); var discountTransactionType = new AccountTransactionType { Name = string.Format(Resources.Transaction_f, Resources.Discount), SourceAccountTypeId = receivableAccountType.Id, TargetAccountTypeId = discountAccountType.Id, DefaultSourceAccountId = defaultReceivableAccount.Id, DefaultTargetAccountId = defaultDiscountAccount.Id }; var roundingTransactionType = new AccountTransactionType { Name = string.Format(Resources.Transaction_f, Resources.Rounding), SourceAccountTypeId = receivableAccountType.Id, TargetAccountTypeId = discountAccountType.Id, DefaultSourceAccountId = defaultReceivableAccount.Id, DefaultTargetAccountId = defaultRoundingAccount.Id }; var saleTransactionType = new AccountTransactionType { Name = string.Format(Resources.Transaction_f, Resources.Sale), SourceAccountTypeId = saleAccountType.Id, TargetAccountTypeId = receivableAccountType.Id, DefaultSourceAccountId = defaultSaleAccount.Id, DefaultTargetAccountId = defaultReceivableAccount.Id }; var paymentTransactionType = new AccountTransactionType { Name = string.Format(Resources.Transaction_f, Resources.Payment), SourceAccountTypeId = receivableAccountType.Id, TargetAccountTypeId = paymentAccountType.Id, DefaultSourceAccountId = defaultReceivableAccount.Id, DefaultTargetAccountId = cashAccount.Id }; var customerAccountTransactionType = new AccountTransactionType { Name = string.Format(Resources.Customer_f, Resources.AccountTransaction), SourceAccountTypeId = receivableAccountType.Id, TargetAccountTypeId = customerAccountType.Id, DefaultSourceAccountId = defaultReceivableAccount.Id }; var customerCashPaymentType = new AccountTransactionType { Name = string.Format(Resources.Customer_f, Resources.CashPayment), SourceAccountTypeId = customerAccountType.Id, TargetAccountTypeId = paymentAccountType.Id, DefaultTargetAccountId = cashAccount.Id }; var customerCreditCardPaymentType = new AccountTransactionType { Name = string.Format(Resources.Customer_f, Resources.CreditCardPayment), SourceAccountTypeId = customerAccountType.Id, TargetAccountTypeId = paymentAccountType.Id, DefaultTargetAccountId = creditCardAccount.Id }; _workspace.Add(saleTransactionType); _workspace.Add(paymentTransactionType); _workspace.Add(discountTransactionType); _workspace.Add(roundingTransactionType); _workspace.Add(customerAccountTransactionType); _workspace.Add(customerCashPaymentType); _workspace.Add(customerCreditCardPaymentType); var discountService = new CalculationType { AccountTransactionType = discountTransactionType, CalculationMethod = 0, DecreaseAmount = true, Name = Resources.Discount }; var roundingService = new CalculationType { AccountTransactionType = roundingTransactionType, CalculationMethod = 2, DecreaseAmount = true, IncludeTax = true, Name = Resources.Round }; var discountSelector = new CalculationSelector { Name = Resources.Discount, ButtonHeader = Resources.DiscountPercentSign }; discountSelector.CalculationTypes.Add(discountService); discountSelector.AddCalculationSelectorMap(); var roundingSelector = new CalculationSelector { Name = Resources.Round, ButtonHeader = Resources.Round }; roundingSelector.CalculationTypes.Add(roundingService); roundingSelector.AddCalculationSelectorMap(); _workspace.Add(discountService); _workspace.Add(roundingService); _workspace.Add(discountSelector); _workspace.Add(roundingSelector); var screen = new ScreenMenu(); _workspace.Add(screen); var ticketNumerator = new Numerator { Name = Resources.TicketNumerator }; _workspace.Add(ticketNumerator); var orderNumerator = new Numerator { Name = Resources.OrderNumerator }; _workspace.Add(orderNumerator); _workspace.CommitChanges(); var ticketType = new TicketType { Name = Resources.Ticket, TicketNumerator = ticketNumerator, OrderNumerator = orderNumerator, SaleTransactionType = saleTransactionType, ScreenMenuId = screen.Id, }; ticketType.EntityTypeAssignments.Add(new EntityTypeAssignment { EntityTypeId = tableEntityType.Id, EntityTypeName = tableEntityType.Name, SortOrder = 10 }); ticketType.EntityTypeAssignments.Add(new EntityTypeAssignment { EntityTypeId = customerEntityType.Id, EntityTypeName = customerEntityType.Name, SortOrder = 20 }); var cashPayment = new PaymentType { AccountTransactionType = paymentTransactionType, Account = cashAccount, Name = cashAccount.Name }; cashPayment.PaymentTypeMaps.Add(new PaymentTypeMap()); var creditCardPayment = new PaymentType { AccountTransactionType = paymentTransactionType, Account = creditCardAccount, Name = creditCardAccount.Name }; creditCardPayment.PaymentTypeMaps.Add(new PaymentTypeMap()); var voucherPayment = new PaymentType { AccountTransactionType = paymentTransactionType, Account = voucherAccount, Name = voucherAccount.Name }; voucherPayment.PaymentTypeMaps.Add(new PaymentTypeMap()); var accountPayment = new PaymentType { AccountTransactionType = customerAccountTransactionType, Name = Resources.CustomerAccount }; accountPayment.PaymentTypeMaps.Add(new PaymentTypeMap()); _workspace.Add(cashPayment); _workspace.Add(creditCardPayment); _workspace.Add(voucherPayment); _workspace.Add(accountPayment); _workspace.Add(ticketType); var warehouseType = new WarehouseType { Name = Resources.Warehouses }; _workspace.Add(warehouseType); _workspace.CommitChanges(); var localWarehouse = new Warehouse { Name = Resources.LocalWarehouse, WarehouseTypeId = warehouseType.Id }; _workspace.Add(localWarehouse); _workspace.CommitChanges(); var department = new Department { Name = Resources.Restaurant, TicketTypeId = ticketType.Id, WarehouseId = localWarehouse.Id }; _workspace.Add(department); var transactionType = new InventoryTransactionType { Name = Resources.PurchaseTransactionType, TargetWarehouseTypeId = warehouseType.Id, DefaultTargetWarehouseId = localWarehouse.Id }; _workspace.Add(transactionType); var transactionDocumentType = new InventoryTransactionDocumentType { Name = Resources.PurchaseTransaction, InventoryTransactionType = transactionType }; _workspace.Add(transactionDocumentType); var role = new UserRole("Admin") { IsAdmin = true, DepartmentId = 1 }; _workspace.Add(role); var u = new User("Administrator", "1234") { UserRole = role }; _workspace.Add(u); var ticketPrinterTemplate = new PrinterTemplate { Name = Resources.TicketTemplate, Template = GetDefaultTicketPrintTemplate() }; var kitchenPrinterTemplate = new PrinterTemplate { Name = Resources.KitchenOrderTemplate, Template = GetDefaultKitchenPrintTemplate() }; var customerReceiptTemplate = new PrinterTemplate { Name = Resources.CustomerReceiptTemplate, Template = GetDefaultCustomerReceiptTemplate() }; _workspace.Add(ticketPrinterTemplate); _workspace.Add(kitchenPrinterTemplate); _workspace.Add(customerReceiptTemplate); var printer1 = new Printer { Name = Resources.TicketPrinter }; var printer2 = new Printer { Name = Resources.KitchenPrinter }; var printer3 = new Printer { Name = Resources.InvoicePrinter }; _workspace.Add(printer1); _workspace.Add(printer2); _workspace.Add(printer3); _workspace.CommitChanges(); var t = new Terminal { IsDefault = true, Name = Resources.Server, ReportPrinterId = printer1.Id, TransactionPrinterId = printer1.Id, }; var pm1 = new PrinterMap { PrinterId = printer1.Id, PrinterTemplateId = ticketPrinterTemplate.Id }; _workspace.Add(pm1); var pj1 = new PrintJob { Name = Resources.PrintBill, WhatToPrint = (int)WhatToPrintTypes.Everything, }; pj1.PrinterMaps.Add(pm1); _workspace.Add(pj1); var pm2 = new PrinterMap { PrinterId = printer2.Id, PrinterTemplateId = kitchenPrinterTemplate.Id }; var pj2 = new PrintJob { Name = Resources.PrintOrdersToKitchenPrinter, WhatToPrint = (int)WhatToPrintTypes.Everything, }; pj2.PrinterMaps.Add(pm2); _workspace.Add(pj2); _workspace.Add(t); new RuleGenerator().GenerateSystemRules(_workspace); ImportMenus(screen); ImportTableResources(tableEntityType, ticketType); var customerScreen = new EntityScreen { Name = string.Format(Resources.Customer_f, Resources.Search), DisplayMode = 1, EntityTypeId = customerEntityType.Id, TicketTypeId = ticketType.Id }; customerScreen.EntityScreenMaps.Add(new EntityScreenMap()); _workspace.Add(customerScreen); var customerTicketScreen = new EntityScreen { Name = Resources.CustomerTickets, DisplayMode = 0, EntityTypeId = customerEntityType.Id, StateFilter = Resources.NewOrders, ColumnCount = 6, RowCount = 6, TicketTypeId = ticketType.Id }; customerTicketScreen.EntityScreenMaps.Add(new EntityScreenMap()); _workspace.Add(customerTicketScreen); var customerCashDocument = new AccountTransactionDocumentType { Name = string.Format(Resources.Customer_f, Resources.Cash), ButtonHeader = Resources.Cash, DefaultAmount = string.Format("[{0}]", Resources.Balance), DescriptionTemplate = string.Format(Resources.Payment_f, Resources.Cash), MasterAccountTypeId = customerAccountType.Id, PrinterTemplateId = customerReceiptTemplate.Id }; customerCashDocument.AddAccountTransactionDocumentTypeMap(); customerCashDocument.TransactionTypes.Add(customerCashPaymentType); var customerCreditCardDocument = new AccountTransactionDocumentType { Name = string.Format(Resources.Customer_f, Resources.CreditCard), ButtonHeader = Resources.CreditCard, DefaultAmount = string.Format("[{0}]", Resources.Balance), DescriptionTemplate = string.Format(Resources.Payment_f, Resources.CreditCard), MasterAccountTypeId = customerAccountType.Id, PrinterTemplateId = customerReceiptTemplate.Id }; customerCreditCardDocument.AddAccountTransactionDocumentTypeMap(); customerCreditCardDocument.TransactionTypes.Add(customerCreditCardPaymentType); _workspace.Add(customerCashDocument); _workspace.Add(customerCreditCardDocument); ImportItems(BatchCreateEntities); ImportItems(BatchCreateTransactionTypes); ImportItems(BatchCreateTransactionTypeDocuments); _workspace.CommitChanges(); _workspace.Dispose(); }
public async Task <ActionResult> Index(OrderModel model) { List <ItemType> items = new List <ItemType>(); ItemType type = new ItemType { SKU = "32861", Brand = "Safe-T", Category = 1829, Description = "Safe-T Helmet", Model = "Bicycle helmet", Quantity = 1, UnitPrice = 60.72 }; ItemType type1 = new ItemType { SKU = "32779", Brand = "Slaker", Category = 2008, Description = "Slaker Water Bottle", Model = "Water bottle", Quantity = 5, UnitPrice = 4.72 }; ItemType type2 = new ItemType { SKU = "30421", Brand = "Grand Prix", Category = 2005, Description = "Grand Prix Bicycle Tires", Model = "Bicycle Tires", Quantity = 2, UnitPrice = 10.72 }; items.Add(type); items.Add(type1); items.Add(type2); ItemType[] itemListClone = items.ToArray(); List <string> adresgui = new List <string>(); adresgui.Add(model.AddressLine); string[] adressclone = adresgui.ToArray(); AddressType addressType = new AddressType { City = model.City, AddressLine = adressclone, FirstName = model.Firstname, LastName = model.Lastname, PhoneNumber = model.Phonenumber, State = model.State, ZipCode = model.ZipCode }; ShippingProviderType shippingProviderType = new ShippingProviderType { Name = "USPS" }; ShippingType shippingType = new ShippingType { Address = addressType, ShipMethod = 1, ShippingSpeed = ShippingSpeedType.Oneday, ShipMethodSpecified = true, ShippingSpeedSpecified = true, ShippingProvider = shippingProviderType }; PaymentType paymentType = new PaymentType { AuthorizationAmount = 12.12, AuthorizationAmountSpecified = true, AuthorizationDate = DateTime.Now, AuthorizationDateSpecified = true, BillingAddress = addressType, CardName = "AMEX", CardNum = "1234123412341234", CardPaymentType = 1, ExpireDate = "0316" }; OrderType order = new OrderType { Email = model.Email, OrderDate = new DateTime().ToUniversalTime(), Shipping = shippingType, Billing = paymentType, Items = itemListClone, OrderDateSpecified = true }; processOrderPortTypeClient client = new processOrderPortTypeClient(); processResponse response = await client.processAsync(order); order.OrderNumber = response.OrderAck.OrderNumber; //Random rnd = new Random(); //order.OrderNumber = rnd.Next(1000, 5000).ToString(); return(View("OrderSuccess", order)); }
public PaymentMethod GetPaymentMethod(BTCPayNetworkBase network, PaymentType paymentType) { return(GetPaymentMethod(new PaymentMethodId(network.CryptoCode, paymentType))); }
public IActionResult UpdatePaymentType(int id, PaymentType paymentType) { var result = _storage.Update(id, paymentType); return(Ok(result)); }
public static StartPaymentOperationResult StartPayment(BarionClient barionClient, BarionSettings settings, PaymentType paymentType, TimeSpan?reservationPeriod = null, bool initiateRecurrence = false, string recurrenceId = null) { var startPaymentOperation = new StartPaymentOperation { GuestCheckOut = true, PaymentType = paymentType, ReservationPeriod = reservationPeriod, FundingSources = new[] { FundingSourceType.All }, PaymentRequestId = "P1", OrderNumber = "1_0", Currency = Currency.HUF, CallbackUrl = "http://index.hu", Locale = CultureInfo.CurrentCulture, RedirectUrl = "http://index.hu", InitiateRecurrence = initiateRecurrence, RecurrenceId = recurrenceId }; var transaction = new PaymentTransaction { Payee = settings.Payee, POSTransactionId = POSTransactionId, Total = new decimal(1000), Comment = "comment" }; var item = new Item { Name = "Test", Description = "Test", ItemTotal = new decimal(1000), Quantity = 1, Unit = "piece", UnitPrice = new decimal(1000), SKU = "SKU" }; transaction.Items = new[] { item }; startPaymentOperation.Transactions = new[] { transaction }; Console.WriteLine("Sending StartPayment..."); var result = barionClient.ExecuteAsync <StartPaymentOperationResult>(startPaymentOperation).Result; if (!result.IsOperationSuccessful) { throw new Exception("Start payment operation was not successful."); } return(result); }
public String GetPaymentTypeEnumName(int intPaymentType) { PaymentType paymentType = (PaymentType)intPaymentType; return(paymentType.ToString()); }
public async void EndofMonthManager_AccountIsOverdrawnCorrectSet(PaymentType paymentType, bool expectedResult) { // Arrange var account1 = new Account { Data = { Id = 1, CurrentBalance = 100 } }; var accounts = new List <Account> { new Account { Data = { Id = 2, CurrentBalance = 100 } }, account1 }; var paymentRepoSetup = new Mock <IPaymentService>(); paymentRepoSetup.Setup(x => x.GetUnclearedPayments(It.IsAny <DateTime>(), It.IsAny <int>())) .Returns(Task.FromResult <IEnumerable <Payment> >(new List <Payment> { new Payment { Data = { Id = 10, ChargedAccountId = 1, TargetAccountId = 2, Amount = 100, Date = DateTime.Now, Type = paymentType } }, new Payment { Data = { Id = 15, ChargedAccountId = 1, TargetAccountId = 2, Amount = 100, Date = DateTime.Now, Type = paymentType } } })); var accountServiceMock = new Mock <IAccountService>(); accountServiceMock.Setup(x => x.GetAllAccounts()) .ReturnsAsync(accounts); // Act await new BalanceCalculationManager(paymentRepoSetup.Object, accountServiceMock.Object).CheckIfAccountsAreOverdrawn(); // Assert Assert.Equal(expectedResult, account1.Data.IsOverdrawn); }
public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) { iprot.IncrementRecursionDepth(); try { TField field; await iprot.ReadStructBeginAsync(cancellationToken); while (true) { field = await iprot.ReadFieldBeginAsync(cancellationToken); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.I64) { Start = await iprot.ReadI64Async(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 2: if (field.Type == TType.I32) { Size = await iprot.ReadI32Async(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 3: if (field.Type == TType.String) { Language = await iprot.ReadStringAsync(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 4: if (field.Type == TType.String) { Eddt = await iprot.ReadStringAsync(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 5: if (field.Type == TType.I32) { AppStoreCode = (PaymentType)await iprot.ReadI32Async(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; default: await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); break; } await iprot.ReadFieldEndAsync(cancellationToken); } await iprot.ReadStructEndAsync(cancellationToken); } finally { iprot.DecrementRecursionDepth(); } }
/// <summary> /// This function loads the elements of the ShoppingCard.xml file. /// </summary> /// <param name="shoppingCardList">This parameter is a list of ShoppingCard class.</param> /// <returns> This function does not return a value </returns> public static void Load(List <ShoppingCard> shoppingCardList) { if (!File.Exists(@"data/ShoppingCard.xml")) { XmlTextWriter writer = new XmlTextWriter(@"data/ShoppingCard.xml", System.Text.Encoding.UTF8); writer.WriteStartDocument(true); writer.Formatting = Formatting.Indented; writer.Indentation = 2; writer.WriteStartElement("ShoppingCards"); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Close(); return; } XDocument xDoc = XDocument.Load(@"data/ShoppingCard.xml"); XElement shoppingCardRootElement = xDoc.Root; NumberFormatInfo info = new NumberFormatInfo(); info.NumberDecimalSeparator = "."; foreach (XElement shoppingCard in shoppingCardRootElement.Elements()) { string customerID = shoppingCard.FirstAttribute.Value; double amount = Convert.ToDouble(shoppingCard.Element("PaymentAmount").Value, info); PaymentType type = PaymentType.cash; if (shoppingCard.Element("PaymentType").Value == "creditcard") { type = PaymentType.creditcard; } List <ItemToPurchase> tempitemsToPurchase = new List <ItemToPurchase>(); XElement itemToPurchaseRootElement = shoppingCard.Element("ItemToPurchaseList"); foreach (XElement item in itemToPurchaseRootElement.Elements()) { ItemToPurchase itemToPurchase = new ItemToPurchase(); string classType = item.FirstAttribute.Value; string ID = item.Element("id").Value; string name = item.Element("name").Value; double price = Convert.ToDouble(item.Element("price").Value, info); Image image = UtilConvert.Base64ToImage(item.Element("image").Value); Creator c; if (classType == "Book") { c = new BookFactory(name, ID, price, "", "", "", 0, image); itemToPurchase.Product = c.FactoryMethod(); } else if (classType == "Magazine") { c = new MagazineFactory(name, ID, price, "", Magazine_Type.Actual, image); itemToPurchase.Product = c.FactoryMethod(); } else { c = new MusicCdFactory(name, ID, price, "", MusicCD_Type.Country, image); itemToPurchase.Product = c.FactoryMethod(); } itemToPurchase.Quantity = Int32.Parse(item.Element("quantity").Value); tempitemsToPurchase.Add(itemToPurchase); } ShoppingCard shoppCard = new ShoppingCard(); shoppCard.itemsToPurchase = tempitemsToPurchase; shoppCard.PaymentAmount = amount; shoppCard.CustomerID = customerID; shoppCard.Type = type; shoppingCardList.Add(shoppCard); } }
public void AddPaymentType(PaymentType paymentType) { _storage.Add(paymentType); }