コード例 #1
0
ファイル: PaymentController.cs プロジェクト: 1andy/plcdev
        public ActionResult Configure([Bind(Prefix = "Form")]PaymentConfigureForm form, string module)
        {
            var model = new PaymentConfigureViewModel();
            SetupConfigureViewModel(model, module);

            if (ModelState.IsValid)
            {
                var paymentModule = _paymentModuleManager.CreateModule(module);
                //// TODO: setup paymentModule from form values

                var method = new PaymentMethod
                {
                    Name = paymentModule.Name
                };

                _paymentModuleManager.SaveModuleToMethod(paymentModule, method);

                using (var transaction = _session.BeginTransaction())
                {
                    _session.Save(method);
                    transaction.Commit();
                }

                TempData["SuccessMessage"] = "Payment method has been activated";
                return RedirectToAction("Index");
            }

            return View(model);
        }
コード例 #2
0
        public void AddPaymentMethods(PaymentMethod method, SelectList list)
        {
            if (PaymentMethodsList == null)
                InitPaymentMethodsList(null);

            PaymentMethodsList.ItemsList.Add(method, list);
        }
コード例 #3
0
        public static ImportNotificationTransaction PaymentRecord(Guid notificationId, 
            DateTime date, 
            decimal amount, 
            PaymentMethod paymentMethod, 
            string receiptNumber, 
            string comments)
        {
            if (paymentMethod == Core.Shared.PaymentMethod.Cheque)
            {
                Guard.ArgumentNotNullOrEmpty(() => receiptNumber, receiptNumber);
            }
            else
            {
                receiptNumber = "NA";
            }

            return new ImportNotificationTransaction
            {
                PaymentMethod = paymentMethod,
                NotificationId = notificationId,
                Date = date,
                ReceiptNumber = receiptNumber,
                Comments = comments,
                Credit = amount
            };
        }
コード例 #4
0
        public Payment CreatePayment(string email, PaymentMethod payMethod, string orderAmount, string orderDescription)
        {
            Payment pay = null;

            Amount amount = new Amount();
            amount.currency = "USD";
            amount.total = orderAmount;

            Transaction transaction = new Transaction();
            transaction.amount = amount;
            transaction.description = orderDescription;

            List<Transaction> transactions = new List<Transaction>();
            transactions.Add(transaction);

            FundingInstrument fundingInstrument = new FundingInstrument();
            CreditCardToken creditCardToken = new CreditCardToken();
            creditCardToken.credit_card_id = GetSignedInUserCreditCardId(email);
            fundingInstrument.credit_card_token = creditCardToken;

            List<FundingInstrument> fundingInstrumentList = new List<FundingInstrument>();
            fundingInstrumentList.Add(fundingInstrument);

            Payer payr = new Payer();
            payr.funding_instruments = fundingInstrumentList;
            payr.payment_method = payMethod.ToString();

            Payment paymnt = new Payment();
            paymnt.intent = "sale";
            paymnt.payer = payr;
            paymnt.transactions = transactions;
            pay = paymnt.Create(Api);
            return pay;
        }
コード例 #5
0
        public void GivenTheFollowingTransaction(string category, string paymentMethod, Table data)
        {
            _paymentMethodService = new PaymentMethodService(new PaymentMethodRepository(context));

            switch (_transactionType)
            {
                case TransactionTypes.Income:
                    _transaction = data.CreateInstance<Income>();
                    _transactionService = new IncomeService(new IncomeRepository(context));
                    _categoryService = new IncomeCategoryService(new IncomeCategoryRepository(context));
                    break;
                case TransactionTypes.Expense:
                    _transaction = data.CreateInstance<Expense>();
                    _transactionService = new ExpenseService(new ExpenseRepository(context));
                    _categoryService = new ExpenseCategoryService(new ExpenseCategoryRepository(context));
                    break;
            }

            if (!string.IsNullOrWhiteSpace(paymentMethod))
            {
                _paymentMethod = new PaymentMethod(0, paymentMethod);
                _transaction.Method = _paymentMethod;
            }

            if (!string.IsNullOrWhiteSpace(category))
            {
                _category = new DataClasses.Category(0, category);
                _transaction.Category = _category;
            }

            if (_transaction.Date.Equals(default(DateTime)))
            {
                _transaction.Date = DateTime.Today;
            }
        }
コード例 #6
0
ファイル: Order.cs プロジェクト: marchello2000/planmart
 public Order(Customer customer, string shippingRegion, PaymentMethod paymentMethod, DateTime placed)
 {
     Customer = customer;
     ShippingRegion = shippingRegion;
     PaymentMethod = paymentMethod;
     Placed = placed;
 }
コード例 #7
0
ファイル: Order.cs プロジェクト: fcmendoza/RuleEngine
 public Order(string id, int value, State state, decimal total, PaymentMethod paymentMethod) {
     Id = id;
     Value = value;
     State = state;
     Total = total;
     PaymentMethod = paymentMethod;
 }
コード例 #8
0
        public void GivenTheFollowingTransaction(string category, string paymentMethod, Table data)
        {
            _paymentMethodService = new PaymentMethodService(new PaymentMethodRepository(context));
            switch (_transactionType)
            {
                case TransactionTypes.Income:
                    _transaction = data.CreateInstance<Income>();
                    _transactionService = new IncomeService(new IncomeRepository(context));
                    _categoryService = new IncomeCategoryService(new IncomeCategoryRepository(context));
                    break;
                case TransactionTypes.Expense:
                    _transaction = data.CreateInstance<Expense>();
                    _transactionService = new ExpenseService(new ExpenseRepository(context));
                    _categoryService = new ExpenseCategoryService(new ExpenseCategoryRepository(context));
                    break;
            }

            _paymentMethod = _paymentMethodService.Create(paymentMethod);
            _transaction.Method = _paymentMethod;
            _transaction.PaymentMethodId = _paymentMethod.Id;

            _category = _categoryService.Create(category);
            _transaction.Category = _category;
            _transaction.CategoryId = _category.Id;
            _transaction.Date = DateTime.Today;

            _transaction.Id = 1;
            _transactionService.Create(_transaction);
        }
コード例 #9
0
        public void Pay(Guid orderId, PaymentMethod methodOfPayment, decimal amount)
        {
            if (paid.Contains(orderId))
            {
                Console.WriteLine("Free money awesome");
            }

            if (methodOfPayment == PaymentMethod.Check)
            {
                throw new InvalidOperationException("[Thread {0}] We don't take checks");
            }

            if (methodOfPayment == PaymentMethod.CreditCard)
            {
                Console.WriteLine("[Thread {0}] Please enter your pin", Thread.CurrentThread.ManagedThreadId);
                Thread.Sleep(5000);
                Console.WriteLine("[Thread {0}] Hit OK", Thread.CurrentThread.ManagedThreadId);
            }

            Console.WriteLine("[Thread {0}] Thank you!", Thread.CurrentThread.ManagedThreadId);

            paid.Add(orderId);
            bus.Publish(new PaymentReceived
                            {
                                OrderId = orderId,
                                Amount = amount
                            });
        }
コード例 #10
0
 public void Equals_All_Fields_Same()
 {
     var first = new PaymentMethod(0, "name");
     var second = new PaymentMethod(0, "name");
     Assert.AreNotSame(first, second);
     Assert.IsTrue(first.Equals(second));
     Assert.IsTrue(second.Equals(first));
 }
コード例 #11
0
 public void Equals_Name_Differs()
 {
     var first = new PaymentMethod(0, "name");
     var second = new PaymentMethod(0, "other name");
     Assert.AreNotSame(first, second);
     Assert.IsFalse(first.Equals(second));
     Assert.IsFalse(second.Equals(first));
 }
コード例 #12
0
        public void Update(PaymentMethod paymentMethod)
        {
            paymentMethod = Validate(paymentMethod);

            _paymentMethods.Attach(paymentMethod);
            _repository.Entry(paymentMethod).State = EntityState.Modified;
            _repository.SaveChanges();
        }
コード例 #13
0
 public void AuthorizeCvvResponsesShouldReturnProcessorCvvResultCodeM()
 {
     defaultPaymentMethod = PaymentMethod.Create(defaultPayload.Merge(new PaymentMethodPayload() { Cvv = "111" }));
     var transaction = Processor.TheProcessor.Authorize(defaultPaymentMethod.PaymentMethodToken,
                                                        "1.00", new TransactionPayload() { BillingReference = rand });
     Assert.IsTrue( transaction.Success() );
     Assert.AreEqual( "M", transaction.ProcessorResponse.CvvResultCode );
 }
コード例 #14
0
        public static PaymentMethod ToWebModel(this VirtoCommerceCartModuleWebModelPaymentMethod paymentMethod)
        {
            var paymentMethodWebModel = new PaymentMethod();

            paymentMethodWebModel.InjectFrom(paymentMethod);

            return paymentMethodWebModel;
        }
コード例 #15
0
 protected void BtnCreate_Click( object sender, EventArgs e )
 {
     if ( Page.IsValid ) {
     PaymentMethod paymentMethod = new PaymentMethod( StoreId, TxtName.Text );
     paymentMethod.Save();
     base.Redirect( WebUtils.GetPageUrl( Constants.Pages.EditPaymentMethod ) + "?id=" + paymentMethod.Id + "&storeId=" + paymentMethod.StoreId );
       }
 }
コード例 #16
0
        public static coreModel.Store ToCoreModel(this webModel.Store store, ShippingMethod[] shippingMethods, PaymentMethod[] paymentMethods, TaxProvider[] taxProviders)
        {
            var retVal = new coreModel.Store();
            retVal.InjectFrom(store);
            retVal.SeoInfos = store.SeoInfos;
            retVal.StoreState = store.StoreState;
            retVal.DynamicProperties = store.DynamicProperties;

            if (store.ShippingMethods != null)
            {
                retVal.ShippingMethods = new List<ShippingMethod>();
                foreach (var shippingMethod in shippingMethods)
                {
                    var webShippingMethod = store.ShippingMethods.FirstOrDefault(x => x.Code == shippingMethod.Code);
                    if (webShippingMethod != null)
                    {
                        retVal.ShippingMethods.Add(webShippingMethod.ToCoreModel(shippingMethod));
                    }
                }
            }

            if (store.PaymentMethods != null)
            {
                retVal.PaymentMethods = new List<PaymentMethod>();
                foreach (var paymentMethod in paymentMethods)
                {
                    var webPaymentMethod = store.PaymentMethods.FirstOrDefault(x => x.Code == paymentMethod.Code);
                    if (webPaymentMethod != null)
                    {
                        retVal.PaymentMethods.Add(webPaymentMethod.ToCoreModel(paymentMethod));
                    }
                }
            }

            if (store.TaxProviders != null)
            {
                retVal.TaxProviders = new List<TaxProvider>();
                foreach (var taxProvider in taxProviders)
                {
                    var webTaxProvider = store.TaxProviders.FirstOrDefault(x => x.Code == taxProvider.Code);
                    if (webTaxProvider != null)
                    {
                        retVal.TaxProviders.Add(webTaxProvider.ToCoreModel(taxProvider));
                    }
                }
            }

            if (store.Languages != null)
                retVal.Languages = store.Languages;
            if (store.Currencies != null)
                retVal.Currencies = store.Currencies;
            if (store.ReturnsFulfillmentCenter != null)
                retVal.ReturnsFulfillmentCenter = store.ReturnsFulfillmentCenter.ToCoreModel();
            if (store.FulfillmentCenter != null)
                retVal.FulfillmentCenter = store.FulfillmentCenter.ToCoreModel();

            return retVal;
        }
コード例 #17
0
 public void Update(PaymentMethod paymentMethod)
 {
     var dbCat = _context.PaymentMethods.FirstOrDefault(ec => ec.Id == paymentMethod.Id);
     if (dbCat != null)
     {
         dbCat.Name = paymentMethod.Name;
     }
     _context.SaveChanges();
 }
 public void ProcessPayment(PaymentMethod paymentMethod)
 {
     Layer2Fs.CsApi.ProcessPayment(
         paymentMethod,
         () => Console.WriteLine("Paid in cash"),
         checkNo => Console.WriteLine("Paid by cheque {0}", checkNo),
         (cardType, cardNumber) => Console.WriteLine("Paid by card CardType={0}, CardNumber={1}", cardType, cardNumber)
         );
 }
コード例 #19
0
        public void Delete(PaymentMethod paymentMethod)
        {
            if (paymentMethod.Payments.Any())
                throw new BusinessLogicException(string.Format("This payment method cannot be deleted because there are {0} payment(s) using this method.", paymentMethod.Payments.Count));

            _paymentMethods.Attach(paymentMethod);
            _repository.Entry(paymentMethod).State = EntityState.Deleted;
            _repository.SaveChanges();
        }
コード例 #20
0
        private PaymentMethod Validate(PaymentMethod paymentMethod)
        {
            if (!string.IsNullOrWhiteSpace(paymentMethod.Description))
                paymentMethod.Description = paymentMethod.Description.Trim();
            else
                throw new BusinessLogicException("A name or description is required for all payment methods.");

            return paymentMethod;
        }
コード例 #21
0
		public PaymentMethod ToPaymentMethod ()
		{
			PaymentMethod paymentMethod = new PaymentMethod (bandeira);

			paymentMethod.product = produto;
			paymentMethod.installments = parcelas;

			return paymentMethod;
		}
コード例 #22
0
        public void CanRetrievePaymentMethod(PaymentMethod paymentMethod)
        {
            // If: We request a payment method from the api
            PaymentMethodResponse paymentMethodResponse = this._mollieClient.GetPaymentMethodAsync(paymentMethod).Result;

            // Then: Id should be equal to our enum
            Assert.IsNotNull(paymentMethodResponse);
            Assert.AreEqual(paymentMethod, paymentMethodResponse.Id);
        }
コード例 #23
0
 public void Create(PaymentMethod paymentMethod)
 {
     if (paymentMethod == null)
     {
         return;
     }
     _context.PaymentMethods.Add(paymentMethod);
     _context.SaveChanges();
 }
コード例 #24
0
ファイル: Expense.cs プロジェクト: stoiandan/MyHome
 public Expense(decimal amount, DateTime date, ExpenseCategory expenseCategory,
     PaymentMethod paymentMethod, string comment, int id = 0)
 {
     Amount = amount;
     Category = expenseCategory;
     Comments = comment;
     Date = date;
     Id = id;
     Method = paymentMethod;
 }
コード例 #25
0
ファイル: Income.cs プロジェクト: smwentum/MyHome
 public Income(double amount, DateTime date, IncomeCategory incomeCategory,
     PaymentMethod paymentMethod, string comment, int id = 0)
 {
     this.Amount = amount;
     this.Category = incomeCategory;
     this.Comment = comment;
     this.Date = date;
     this.ID = id;
     this.Method = paymentMethod;
 }
コード例 #26
0
ファイル: Income.cs プロジェクト: qchouleur/MyHome
 public Income(decimal amount, DateTime date, IncomeCategory incomeCategory,
     PaymentMethod paymentMethod, string comment, int id = 0)
 {
     Amount = amount;
     Category = incomeCategory;
     Comment = comment;
     Date = date;
     Id = id;
     Method = paymentMethod;
 }
コード例 #27
0
ファイル: Expense.cs プロジェクト: smwentum/MyHome
 public Expense(double amount, DateTime date, ExpenseCategory expenseCategory,
     PaymentMethod paymentMethod, string comment, int id = 0)
 {
     this.Amount = amount;
     this.Category = expenseCategory;
     this.Comment = comment;
     this.Date = date;
     this.ID = id;
     this.Method = paymentMethod;
 }
コード例 #28
0
        public void Insert(PaymentMethod paymentMethod)
        {
            paymentMethod = Validate(paymentMethod);

            if (_paymentMethods.Any(i => i.Description.Equals(paymentMethod.Description, StringComparison.InvariantCultureIgnoreCase)))
                throw new BusinessLogicException("A payment method with that name already exists.");

            _paymentMethods.Add(paymentMethod);
            _repository.SaveChanges();
        }
コード例 #29
0
 public void Save(PaymentMethod paymentMethod)
 {
     if (paymentMethod.Id != 0)
     {
         Update(paymentMethod);
     }
     else
     {
         Create(paymentMethod);
     }
 }
コード例 #30
0
 public void AuthorizeAvsResponsesShouldReturnProcessorAvsResultCodeZ()
 {
     defaultPaymentMethod = PaymentMethod.Create(defaultPayload.Merge(new PaymentMethodPayload() {
         Address1 = "",
         Address2 = "",
         Zip = "10101"
     }));
     var transaction = Processor.TheProcessor.Authorize(defaultPaymentMethod.PaymentMethodToken,
                                                        "1.00", new TransactionPayload() { BillingReference = rand });
     Assert.IsTrue( transaction.Success() );
     Assert.AreEqual( "Z", transaction.ProcessorResponse.AvsResultCode );
 }
コード例 #31
0
 Task <IPaymentMethodDetails> IPaymentMethodHandler.CreatePaymentMethodDetails(ISupportedPaymentMethod supportedPaymentMethod, PaymentMethod paymentMethod, BTCPayNetwork network)
 {
     if (supportedPaymentMethod is T method)
     {
         return(CreatePaymentMethodDetails(method, paymentMethod, network));
     }
     throw new NotSupportedException("Invalid supportedPaymentMethod");
 }
コード例 #32
0
 public PaymentMethodDisabled(PaymentMethod method)
 {
     PaymentMethodId = method.Id;
 }
コード例 #33
0
 internal static Uri PrepareRegularPaymentWithTwoRowsSpecifiedIncVatAndVatPercent(PaymentMethod paymentMethod, string createCustomerRefNo)
 {
     return(WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
            .AddOrderRow(TestingTool.CreateExVatBasedOrderRow("1"))
            .AddOrderRow(TestingTool.CreateExVatBasedOrderRow("2"))
            .AddCustomerDetails(TestingTool.CreateMiniCompanyCustomer())
            .SetCountryCode(TestingTool.DefaultTestCountryCode)
            .SetClientOrderNumber(createCustomerRefNo)
            .SetCurrency(TestingTool.DefaultTestCurrency)
            .UsePaymentMethod(paymentMethod)
            .___SetSimulatorCode_ForTestingOnly("0")
            .SetReturnUrl(
                "https://test.sveaekonomi.se/webpay/public/static/testlandingpage.html")
            .PreparePayment("127.0.0.1"));
 }
コード例 #34
0
        public virtual List <SavingEvent> Withdraw(OCurrency pAmount, DateTime pDate, string pDescription, string pReferenceNumber, User pUser, bool pIsDesactivateFees, Teller teller, PaymentMethod paymentMethod)
        {
            List <SavingEvent> events = new List <SavingEvent>();

            int?tellerId = null;

            if (teller != null)
            {
                tellerId = teller.Id;
            }

            SavingWithdrawEvent withdrawEvent = new SavingWithdrawEvent
            {
                Amount          = pAmount,
                Date            = pDate,
                Description     = pDescription,
                ReferenceNumber = pReferenceNumber,
                User            = pUser,
                Cancelable      = true,
                TellerId        = tellerId,
                ProductType     = Product.GetType(),
                PaymentMethod   = paymentMethod,
                PaymentsMethod  = paymentMethod
            };

            events.Add(withdrawEvent);
            Events.Add(withdrawEvent);

            return(events);
        }
コード例 #35
0
 public async Task <PaymentMethodResponse> GetPaymentMethodAsync(PaymentMethod paymentMethod)
 {
     return(await this.GetAsync <PaymentMethodResponse>($"methods/{paymentMethod.ToString().ToLower()}").ConfigureAwait(false));
 }
コード例 #36
0
        protected virtual void ProcessPayments(List <ARPayment> list, ProcessPaymentFilter filter, PaymentMethod paymenttype)
        {
            if (list.Count == 0)
            {
                return;
            }

            CABatch batch = CreateBatchPayment(list, filter);

            if (batch != null)
            {
                bool failed          = false;
                ARPaymentEntryExt pe = PXGraph.CreateInstance <ARPaymentEntryExt>();

                string NextCheckNbr = filter.NextCheckNbr;
                for (int i = 0; i < list.Count; i++)
                {
                    try
                    {
                        AssignNumbers(pe, list[i], ref NextCheckNbr);
                        var docExt = PXCache <ARPayment> .GetExtension <ARPaymentExt>(list[i]);

                        if (docExt.Passed == true)
                        {
                            pe.TimeStamp = list[i].tstamp;
                        }
                        pe.Save.Press();
                        list[i].tstamp = pe.TimeStamp;
                        pe.Clear();
                    }
                    catch (Exception e)
                    {
                        PXProcessing <ARPayment> .SetError(i, e);

                        failed = true;
                    }
                }
                if (failed)
                {
                    throw new PXOperationCompletedWithErrorException(Messages.ARPaymentsAreAddedToTheBatchButWasNotUpdatedCorrectly, batch.BatchNbr);
                }
                RedirectToResultWithCreateBatch(batch);
            }
        }
コード例 #37
0
 public AddPaymentMethodForm(PaymentMethod paymentMethod)
 {
     InitializeComponent();
     Initialize(paymentMethod);
 }
コード例 #38
0
        protected string CalculateMerchantSignature(IDictionary <string, string> dict, PaymentMethod paymentMethod)
        {
            string signature;

            if (paymentMethod.DynamicProperty <string>().SigningAlgorithm == "SHA256")
            {
                var signingString = BuildSigningStringForSHA256(dict);
                var calculator    = new HmacCalculatorSHA256(HttpUtility.UrlDecode(paymentMethod.DynamicProperty <string>().HmacSharedSecret));
                signature = calculator.Execute(signingString);
            }
            else
            {
                var signingString = BuildSigningString(dict);
                var calculator    = new HmacCalculator(HttpUtility.UrlDecode(paymentMethod.DynamicProperty <string>().HmacSharedSecret));
                signature = calculator.Execute(signingString);
            }


            return(signature);
        }
コード例 #39
0
 public bool AddPaymentMethodsToCart(int cartId, PaymentMethod paymentMethod)
 {
     throw new NotImplementedException();
 }
コード例 #40
0
        protected void BindPaymentInstrumentList(PaymentMethod _PaymentMethod)
        {
            PaymentInstrumentList.SelectedIndex = -1;
            PaymentInstrumentList.Items.Clear();
            // LOAD INSTRUMENT SELECT BOX
            List <ListItem> tempItems = new List <ListItem>();

            foreach (object enumItem in Enum.GetValues(typeof(PaymentInstrumentType)))
            {
                PaymentInstrumentType instrument = ((PaymentInstrumentType)enumItem);
                switch (instrument)
                {
                case PaymentInstrumentType.Check:
                case PaymentInstrumentType.Discover:
                case PaymentInstrumentType.JCB:
                case PaymentInstrumentType.Mail:
                case PaymentInstrumentType.MasterCard:
                case PaymentInstrumentType.PayPal:
                case PaymentInstrumentType.Visa:
                case PaymentInstrumentType.Amazon:
                    tempItems.Add(new ListItem(instrument.ToString(), ((short)instrument).ToString()));
                    break;

                case PaymentInstrumentType.AmericanExpress:
                    tempItems.Add(new ListItem("American Express", ((short)instrument).ToString()));
                    break;

                case PaymentInstrumentType.DinersClub:
                    if (ShowIntlPaymentMethods)
                    {
                        tempItems.Add(new ListItem("Diner's Club", ((short)instrument).ToString()));
                    }
                    break;

                case PaymentInstrumentType.PhoneCall:
                    tempItems.Add(new ListItem("Phone Call", ((short)instrument).ToString()));
                    break;

                case PaymentInstrumentType.SwitchSolo:
                    if (ShowIntlPaymentMethods)
                    {
                        tempItems.Add(new ListItem("Switch/Solo", ((short)instrument).ToString()));
                    }
                    break;

                case PaymentInstrumentType.VisaDebit:
                    if (ShowIntlPaymentMethods)
                    {
                        tempItems.Add(new ListItem("Visa Debit (Delta/Electron)", ((short)instrument).ToString()));
                    }
                    break;

                case PaymentInstrumentType.Maestro:
                    if (ShowIntlPaymentMethods)
                    {
                        tempItems.Add(new ListItem(instrument.ToString(), ((short)instrument).ToString()));
                    }
                    break;

                case PaymentInstrumentType.PurchaseOrder:
                    tempItems.Add(new ListItem("Purchase Order", ((short)instrument).ToString()));
                    break;

                case PaymentInstrumentType.CreditCard:
                    tempItems.Add(new ListItem("Credit Card", ((short)instrument).ToString()));
                    break;
                }
                tempItems.Sort(delegate(ListItem x, ListItem y) { return(x.Text.CompareTo(y.Text)); });
                PaymentInstrumentList.Items.Clear();
                PaymentInstrumentList.Items.Add(new ListItem(string.Empty));
                PaymentInstrumentList.Items.AddRange(tempItems.ToArray());
            }
            ListItem item = PaymentInstrumentList.Items.FindByValue(_PaymentMethod.PaymentInstrumentId.ToString());

            if (item != null)
            {
                PaymentInstrumentList.SelectedIndex = PaymentInstrumentList.Items.IndexOf(item);
            }
        }
コード例 #41
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="transaction"></param>
        internal static void Read(XmlReader reader, TransactionSummary transaction)
        {
            if (reader.IsEmptyElement)
            {
                XMLParserUtils.SkipNode(reader);
                return;
            }

            reader.ReadStartElement(SerializerHelper.Transaction);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (XMLParserUtils.IsEndElement(reader, SerializerHelper.Transaction))
                {
                    XMLParserUtils.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case SerializerHelper.Code:
                        transaction.Code = reader.ReadElementContentAsString();
                        break;

                    case SerializerHelper.Date:
                        transaction.Date = reader.ReadElementContentAsDateTime();
                        break;

                    case SerializerHelper.Reference:
                        transaction.Reference = reader.ReadElementContentAsString();
                        break;

                    case SerializerHelper.TransactionType:
                        transaction.TransactionType = reader.ReadElementContentAsInt();
                        break;

                    case SerializerHelper.TransactionStatus:
                        transaction.TransactionStatus = reader.ReadElementContentAsInt();
                        break;

                    case SerializerHelper.PaymentLink:
                        transaction.PaymentLink = reader.ReadElementContentAsString();
                        break;

                    case SerializerHelper.GrossAmount:
                        transaction.GrossAmount = reader.ReadElementContentAsDecimal();
                        break;

                    case SerializerHelper.DiscountAmount:
                        transaction.DiscountAmount = reader.ReadElementContentAsDecimal();
                        break;

                    case SerializerHelper.FeeAmount:
                        transaction.FeeAmount = reader.ReadElementContentAsDecimal();
                        break;

                    case SerializerHelper.NetAmount:
                        transaction.NetAmount = reader.ReadElementContentAsDecimal();
                        break;

                    case SerializerHelper.ExtraAmount:
                        transaction.ExtraAmount = reader.ReadElementContentAsDecimal();
                        break;

                    case SerializerHelper.LastEventDate:
                        transaction.LastEventDate = reader.ReadElementContentAsDateTime();
                        break;

                    case PaymentMethodSerializer.PaymentMethod:
                        PaymentMethod paymentMethod = new PaymentMethod();
                        PaymentMethodSerializer.Read(reader, paymentMethod);
                        transaction.PaymentMethod = paymentMethod;
                        break;

                    default:
                        XMLParserUtils.SkipElement(reader);
                        throw new InvalidOperationException("Unexpected value");
                    }
                }
                else
                {
                    XMLParserUtils.SkipNode(reader);
                }
            }
        }
コード例 #42
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CreditCardInfoResponse" /> class.
 /// </summary>
 /// <param name="Links">Links.</param>
 /// <param name="CurrentPaymentMethod">CurrentPaymentMethod.</param>
 /// <param name="CreditCardInfo">CreditCardInfo.</param>
 /// <param name="Info">Info.</param>
 public CreditCardInfoResponse(CreditCardInfoResponseLinks Links = default(CreditCardInfoResponseLinks), PaymentMethod CurrentPaymentMethod = default(PaymentMethod), CreditCardInfoWithCardType CreditCardInfo = default(CreditCardInfoWithCardType), BeezUPCommonInfoSummaries Info = default(BeezUPCommonInfoSummaries))
 {
     this.Links = Links;
     this.CurrentPaymentMethod = CurrentPaymentMethod;
     this.CreditCardInfo       = CreditCardInfo;
     this.Info = Info;
 }
コード例 #43
0
        public static void SeedInMemory(this OnlineStoreDbContext dbContext)
        {
            var creationUser     = "******";
            var creationDateTime = DateTime.Now;

            var country = new Country
            {
                CountryID        = 1,
                CountryName      = "USA",
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.Countries.Add(country);

            var currency = new Currency
            {
                CurrencyID       = "USD",
                CurrencyName     = "US Dollar",
                CurrencySymbol   = "$",
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.Currencies.Add(currency);

            var countryCurrency = new CountryCurrency
            {
                CountryID        = country.CountryID,
                CurrencyID       = currency.CurrencyID,
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.CountryCurrencies.Add(countryCurrency);

            dbContext.SaveChanges();

            var employee = new Employee
            {
                EmployeeID       = 1,
                FirstName        = "John",
                LastName         = "Doe",
                BirthDate        = DateTime.Now.AddYears(-25),
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.Employees.Add(employee);

            dbContext.SaveChanges();

            var productCategory = new ProductCategory
            {
                ProductCategoryID   = 1,
                ProductCategoryName = "PS4 Games",
                CreationUser        = creationUser,
                CreationDateTime    = creationDateTime
            };

            dbContext.ProductCategories.Add(productCategory);

            var product = new Product
            {
                ProductID         = 1,
                ProductName       = "The King of Fighters XIV",
                ProductCategoryID = 1,
                UnitPrice         = 29.99m,
                Description       = "KOF XIV",
                Discontinued      = false,
                Stocks            = 15000,
                CreationUser      = creationUser,
                CreationDateTime  = creationDateTime
            };

            dbContext.Products.Add(product);

            var location = new Location
            {
                LocationID       = "W0001",
                LocationName     = "Warehouse 001",
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.Warehouses.Add(location);

            var productInventory = new ProductInventory
            {
                ProductID        = product.ProductID,
                LocationID       = location.LocationID,
                OrderDetailID    = 1,
                Quantity         = 1500,
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.ProductInventories.Add(productInventory);

            dbContext.SaveChanges();

            var orderStatus = new OrderStatus
            {
                OrderStatusID    = 100,
                Description      = "Created",
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.OrderStatuses.Add(orderStatus);

            var paymentMethod = new PaymentMethod
            {
                PaymentMethodID          = Guid.NewGuid(),
                PaymentMethodDescription = "Credit Card",
                CreationUser             = creationUser,
                CreationDateTime         = creationDateTime
            };

            dbContext.PaymentMethods.Add(paymentMethod);

            var customer = new Customer
            {
                CustomerID       = 1,
                CompanyName      = "Best Buy",
                ContactName      = "Colleen Dunn",
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.Customers.Add(customer);

            var shipper = new Shipper
            {
                ShipperID        = 1,
                CompanyName      = "DHL",
                ContactName      = "Ricardo A. Bartra",
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.Shippers.Add(shipper);

            var order = new OrderHeader
            {
                OrderStatusID    = orderStatus.OrderStatusID,
                CustomerID       = customer.CustomerID,
                EmployeeID       = employee.EmployeeID,
                OrderDate        = DateTime.Now,
                Total            = 29.99m,
                CurrencyID       = "USD",
                PaymentMethodID  = paymentMethod.PaymentMethodID,
                Comments         = "Order from unit tests",
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.Orders.Add(order);

            var orderDetail = new OrderDetail
            {
                OrderHeaderID    = order.OrderHeaderID,
                ProductID        = product.ProductID,
                ProductName      = product.ProductName,
                UnitPrice        = 29.99m,
                Quantity         = 1,
                Total            = 29.99m,
                CreationUser     = creationUser,
                CreationDateTime = creationDateTime
            };

            dbContext.OrderDetails.Add(orderDetail);

            dbContext.SaveChanges();
        }
コード例 #44
0
 private static void PaymentMethodExample(Transaction transaction)
 {
     PaymentMethod paymentMethod = transaction.PaymentMethod;
     int           code          = transaction.PaymentMethod.PaymentMethodCode;
     int           type          = transaction.PaymentMethod.PaymentMethodType;
 }
コード例 #45
0
        protected virtual void ProcessPaymentFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            bool SuggestNextNumber   = false;
            ProcessPaymentFilter row = (ProcessPaymentFilter)e.Row;

            PXUIFieldAttribute.SetVisible <ProcessPaymentFilter.curyID>(sender, null, PXAccess.FeatureInstalled <FeaturesSet.multicurrency>());

            if (e.Row != null && cashaccountdetail.Current != null && (!Equals(cashaccountdetail.Current.CashAccountID, row.PayAccountID) || !Equals(cashaccountdetail.Current.PaymentMethodID, row.PayTypeID)))
            {
                cashaccountdetail.Current = null;
                SuggestNextNumber         = true;
            }

            if (e.Row != null && paymenttype.Current != null && (!Equals(paymenttype.Current.PaymentMethodID, row.PayTypeID)))
            {
                paymenttype.Current = null;
            }

            if (e.Row != null && string.IsNullOrEmpty(row.NextCheckNbr))
            {
                SuggestNextNumber = true;
            }

            PXUIFieldAttribute.SetVisible <ProcessPaymentFilter.nextCheckNbr>(sender, null, true);

            if (e.Row == null)
            {
                return;
            }

            if (cashaccountdetail.Current != null && true == cashaccountdetail.Current.ARAutoNextNbr && SuggestNextNumber)
            {
                row.NextCheckNbr = string.IsNullOrEmpty(cashaccountdetail.Current.ARLastRefNbr) == false?AutoNumberAttribute.NextNumber(cashaccountdetail.Current.ARLastRefNbr) : string.Empty;
            }

            sender.RaiseExceptionHandling <ProcessPaymentFilter.payTypeID>(e.Row, row.PayTypeID,
                                                                           paymenttype.Current != null && true != PXCache <PaymentMethod> .GetExtension <PaymentMethodExt>(paymenttype.Current).ARCreateBatchPayment
                ? new PXSetPropertyException(AP.Messages.PaymentTypeNoPrintCheck, PXErrorLevel.Warning)
                : null);

            sender.RaiseExceptionHandling <ProcessPaymentFilter.nextCheckNbr>(e.Row, row.NextCheckNbr,
                                                                              paymenttype.Current != null && paymenttype.Current.PrintOrExport == true && String.IsNullOrEmpty(row.NextCheckNbr)
                ? new PXSetPropertyException(AP.Messages.NextCheckNumberIsRequiredForProcessing, PXErrorLevel.Warning)
                : !string.IsNullOrEmpty(row.NextCheckNbr) && !AutoNumberAttribute.CanNextNumber(row.NextCheckNbr)
                    ? new PXSetPropertyException(AP.Messages.NextCheckNumberCanNotBeInc, PXErrorLevel.Warning)
                    : null);

            if (/*HttpContext.Current != null && */ Filter.Current.BranchID != PXAccess.GetBranchID())
            {
                Filter.Current.BranchID = PXAccess.GetBranchID();
            }

            ProcessPaymentFilter filter = Filter.Current;
            PaymentMethod        pt     = paymenttype.Current;

            ARPaymentList.SetProcessTooltip(AR.Messages.Process);
            ARPaymentList.SetProcessAllTooltip(AR.Messages.ProcessAll);
            ARPaymentList.SetProcessDelegate(
                delegate(List <ARPayment> list)
            {
                var graph = CreateInstance <ARProcessPayment>();
                graph.ProcessPayments(list, filter, pt);
            }
                );
        }
コード例 #46
0
        /// <summary>
        /// Places an order
        /// </summary>
        /// <param name="transactionPayment">Payment info</param>
        /// <param name="customer">Customer</param>
        /// <param name="orderGuid">Order GUID to use</param>
        /// <param name="orderId">Order identifier</param>
        /// <returns>The error status, or String.Empty if no errors</returns>
        public string PlaceTransactionPayment(TransactionPayment transactionPayment,
                                              Guid transactionPaymentGuid, out long TransactionPaymentId)
        {
            TransactionPaymentId = 0;
            string outMessage           = string.Empty;
            var    processPaymentResult = new ProcessPaymentResult();
            var    customerService      = IoC.Resolve <ICustomerService>();
            var    paymentService       = IoC.Resolve <IPaymentService>();

            try
            {
                if (!CommonHelper.IsValidEmail(transactionPayment.Customer.Email1))
                {
                    throw new Exception("Email is not valid");
                }

                if (transactionPayment == null)
                {
                    throw new ArgumentNullException("transactionPayment");
                }

                //skip payment workflow if order total equals zero
                PaymentMethod paymentMethod     = null;
                string        paymentMethodName = string.Empty;
                paymentMethod = paymentService.GetPaymentMethodById(transactionPayment.PaymentMethodId);
                if (paymentMethod == null)
                {
                    throw new Exception("Payment method couldn't be loaded");
                }
                paymentMethodName = paymentMethod.Name;

                //recurring or standard
                bool isRecurring = false;
                if (transactionPayment.TransactionPaymentType == 2)
                {
                    isRecurring = true;
                }
                //process payment
                if (!transactionPayment.IsRecurringPayment)
                {
                    if (isRecurring)
                    {
                        paymentService.ProcessRecurringPayment(transactionPayment, transactionPaymentGuid, ref processPaymentResult);
                        #region tempcode
                        //recurring cart
                        //var recurringPaymentType = paymentService.SupportRecurringPayments(transactionPayment.PaymentMethodId);
                        //switch (recurringPaymentType)
                        //{
                        //    case RecurringPaymentTypeEnum.NotSupported:
                        //        throw new Exception("Recurring payments are not supported by selected payment method");
                        //    case RecurringPaymentTypeEnum.Manual:
                        //    case RecurringPaymentTypeEnum.Automatic:
                        //        paymentService.ProcessRecurringPayment(transactionPayment, transactionPaymentGuid, ref processPaymentResult);
                        //        break;
                        //    default:
                        //        throw new Exception("Not supported recurring payment type");
                        //}
                        #endregion
                    }
                    else
                    {
                        //standard cart
                        paymentService.ProcessPayment(transactionPayment, transactionPaymentGuid, ref processPaymentResult);
                    }
                }
                else
                {
                    if (isRecurring)
                    {
                        paymentService.ProcessRecurringPayment(transactionPayment, transactionPaymentGuid, ref processPaymentResult);
                        #region tempcode
                        //var recurringPaymentType = paymentService.SupportRecurringPayments(transactionPayment.PaymentMethodId);
                        //switch (recurringPaymentType)
                        //{
                        //    case RecurringPaymentTypeEnum.NotSupported:
                        //        throw new Exception("Recurring payments are not supported by selected payment method");
                        //    case RecurringPaymentTypeEnum.Manual:
                        //paymentService.ProcessRecurringPayment(transactionPayment, transactionPaymentGuid, ref processPaymentResult);
                        //        break;
                        //    case RecurringPaymentTypeEnum.Automatic:
                        //        //payment is processed on payment gateway site
                        //        break;
                        //    default:
                        //        throw new Exception("Not supported recurring payment type");
                        //}
                        #endregion
                    }
                    else
                    {
                        throw new Exception("No recurring products");
                    }
                }


                //process transaction
                if (String.IsNullOrEmpty(processPaymentResult.Error))
                {
                    transactionPayment.TransactionIDRespone = processPaymentResult.AuthorizationTransactionCode.ToInt64();
                    InsertTransactionPayment(transactionPayment);
                    #region tempcode
                    //recurring orders
                    //if (!transactionPayment.IsRecurringPayment)
                    //{
                    //    if (isRecurring)
                    //    {
                    //        //create recurring payment
                    //        var rp = new RecurringPayment()
                    //        {
                    //            InitialTransactionPaymentId = transactionPayment.TransactionPaymentId,
                    //            CycleLength = transactionPayment.RecurringCycleLength,
                    //            CyclePeriod = transactionPayment.RecurringCyclePeriod,
                    //            TotalCycles = transactionPayment.RecurringTotalCycles,
                    //            StartDate = DateTime.UtcNow,
                    //            IsActive = true,
                    //            Deleted = false,
                    //            CreatedOn = DateTime.UtcNow
                    //        };
                    //        InsertRecurringPayment(rp);
                    //        var recurringPaymentType = paymentService.SupportRecurringPayments(transactionPayment.PaymentMethodId);
                    //        switch (recurringPaymentType)
                    //        {
                    //            case RecurringPaymentTypeEnum.NotSupported:
                    //                //not supported
                    //                break;
                    //            case RecurringPaymentTypeEnum.Manual:
                    //                //first payment
                    //                var rph = new RecurringPaymentHistory()
                    //                {
                    //                    RecurringPaymentId = rp.RecurringPaymentId,
                    //                    TransactionPaymentId = transactionPayment.TransactionPaymentId,
                    //                    CreatedOn = DateTime.UtcNow
                    //                };
                    //                InsertRecurringPaymentHistory(rph);
                    //                break;
                    //            case RecurringPaymentTypeEnum.Automatic:
                    //                //will be created later (process is automated)
                    //                break;
                    //            default:
                    //                break;
                    //        }
                    //    }
                    //}
                    #endregion
                }
            }
            catch (Exception exc)
            {
                processPaymentResult.Error     = exc.Message;
                processPaymentResult.FullError = exc.ToString();
            }
            if (!string.IsNullOrEmpty(processPaymentResult.Error))
            {
                outMessage = processPaymentResult.Error;
            }
            else
            {
                outMessage = processPaymentResult.AuthorizationTransactionCode;
            }
            return(outMessage);
        }
コード例 #47
0
ファイル: SelfPayment.cs プロジェクト: girish66/REM
        /// <summary>
        /// Initializes a new instance of the <see cref="SelfPayment"/> class.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="collectedByStaff">The collected by staff.</param>
        /// <param name="money">The money.</param>
        /// <param name="paymentMethod">The payment method.</param>
        /// <param name="collectedDate">The collected date.</param>
        protected internal SelfPayment(Patient patient, Staff collectedByStaff, Money money, PaymentMethod paymentMethod, DateTime?collectedDate)
        {
            Check.IsNotNull(patient, () => Patient);
            Check.IsNotNull(collectedByStaff, () => CollectedByStaff);
            Check.IsNotNull(money, () => Money);
            Check.IsNotNull(paymentMethod, () => PaymentMethod);
            Check.IsNotNull(collectedDate, () => CollectedDate);

            _patient          = patient;
            _collectedByStaff = collectedByStaff;
            _money            = money;
            _paymentMethod    = paymentMethod;
            _collectedDate    = collectedDate;
        }
コード例 #48
0
        private void LoadContracts()
        {
            int loans = 0;

            lvContracts.Items.Clear();

            PaymentMethod paymentMethod =
                ServicesProvider.GetInstance().GetPaymentMethodServices().GetPaymentMethodById(1);

            foreach (VillageMember member in _village.Members)
            {
                foreach (Loan loan in member.ActiveLoans)
                {
                    if (null == loan || loan.ContractStatus != OContractStatus.Active)
                    {
                        continue;
                    }
                    if (loan.NsgID != _village.Id)
                    {
                        continue;
                    }

                    var         result      = new KeyValuePair <Loan, RepaymentEvent>();
                    Installment installment = loan.GetFirstUnpaidInstallment();

                    if (null == installment)
                    {
                        continue;
                    }

                    loans++;

                    Person       person = member.Tiers as Person;
                    ListViewItem item   = new ListViewItem(person.Name)
                    {
                        Tag = loan
                    };
                    item.SubItems.Add(loan.Code);

                    OCurrency principalHasToPay = result.Value == null
                                                      ? installment.PrincipalHasToPay
                                                      : (result.Value).Principal;

                    ListViewItem.ListViewSubItem subitem = new ListViewItem.ListViewSubItem
                    {
                        Text = principalHasToPay.GetFormatedValue(
                            loan.UseCents),
                        Tag = principalHasToPay
                    };
                    item.SubItems.Add(subitem);

                    OCurrency interestHasToPay = result.Value == null
                                                      ? installment.InterestHasToPay
                                                      : (result.Value).Interests;

                    subitem = new ListViewItem.ListViewSubItem
                    {
                        Text = interestHasToPay.GetFormatedValue(loan.UseCents),
                        Tag  = interestHasToPay
                    };
                    item.SubItems.Add(subitem);

                    subitem = new ListViewItem.ListViewSubItem();
                    OCurrency penalties = loan.CalculateDuePenaltiesForInstallment(installment.Number,
                                                                                   TimeProvider.Today);
                    subitem.Text = penalties.GetFormatedValue(loan.UseCents);
                    subitem.Tag  = penalties;
                    item.SubItems.Add(subitem);

                    subitem = new ListViewItem.ListViewSubItem();
                    OCurrency total = principalHasToPay + interestHasToPay + penalties;
                    subitem.Text = total.GetFormatedValue(loan.UseCents);
                    subitem.Tag  = total;
                    item.SubItems.Add(subitem);

                    subitem = new ListViewItem.ListViewSubItem();
                    OCurrency olb = ServicesProvider.GetInstance().GetGeneralSettings().IsOlbBeforeRepayment
                                        ? installment.OLB
                                        : installment.OLBAfterRepayment;
                    subitem.Text = olb.GetFormatedValue(loan.UseCents);
                    subitem.Tag  = olb;
                    item.SubItems.Add(subitem);

                    OCurrency dueInterest = 0;
                    foreach (Installment installmentItem in loan.InstallmentList)
                    {
                        if (!installmentItem.IsRepaid)
                        {
                            dueInterest += installmentItem.InterestsRepayment - installmentItem.PaidInterests;
                        }
                    }

                    subitem = new ListViewItem.ListViewSubItem
                    {
                        Text = dueInterest.GetFormatedValue(loan.UseCents),
                        Tag  = dueInterest
                    };
                    item.SubItems.Add(subitem);

                    subitem = new ListViewItem.ListViewSubItem
                    {
                        Text = loan.Product.Currency.Code,
                        Tag  = loan.Product.Currency
                    };
                    item.SubItems.Add(subitem);

                    cbItem.SelectedIndex = 0;

                    subitem = new ListViewItem.ListViewSubItem
                    {
                        Text = cbItem.SelectedItem.ToString(),
                        Tag  = cbItem.SelectedItem
                    };
                    item.SubItems.Add(subitem);

                    subitem = new ListViewItem.ListViewSubItem();
                    item.SubItems.Add(subitem);

                    lvContracts.Items.Add(item);
                }
            }

            if (0 == loans)
            {
                btnOK.Enabled = false;
                return;
            }

            _itemTotal.SubItems.Add("");
            _itemTotal.SubItems.Add("0");
            _itemTotal.SubItems.Add("0");
            _itemTotal.SubItems.Add("0");
            _itemTotal.SubItems.Add("0");
            _itemTotal.SubItems.Add("");
            _itemTotal.SubItems.Add("");
            _itemTotal.SubItems.Add("");
            _itemTotal.SubItems.Add("");

            lvContracts.Items.Add(_itemTotal);
        }
コード例 #49
0
 public abstract Task <IPaymentMethodDetails> CreatePaymentMethodDetails(T supportedPaymentMethod, PaymentMethod paymentMethod, BTCPayNetwork network);
コード例 #50
0
 public OrderPayment(PaymentMethod paymentMethod)
     : this()
 {
     PaymentMethod = paymentMethod;
 }
コード例 #51
0
 public BuyerAndPaymentMethodVerifiedDomainEvent(Buyer buyer, PaymentMethod payment, int orderId)
 {
     Buyer   = buyer;
     Payment = payment;
     OrderId = orderId;
 }
        public static void ReleasePayments(List <APPayment> list, string Action)
        {
            APReleaseChecks graph     = CreateInstance <APReleaseChecks>();
            APPaymentEntry  pe        = CreateInstance <APPaymentEntry>();
            bool            failed    = false;
            bool            successed = false;

            List <APRegister> docs = new List <APRegister>(list.Count);

            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].Passed == true)
                {
                    graph.TimeStamp = pe.TimeStamp = list[i].tstamp;
                }

                switch (Action)
                {
                case "R":
                    list[i].Printed = true;
                    break;

                case "D":
                case "V":
                    list[i].ExtRefNbr = null;
                    list[i].Printed   = false;
                    break;

                default:
                    continue;
                }

                if ((bool)list[i].Printed)
                {
                    try
                    {
                        APPrintChecks.AssignNumbersWithNoAdditionalProcessing(pe, list[i]);
                        pe.Save.Press();

                        object[] persisted = PXTimeStampScope.GetPersisted(pe.Document.Cache, pe.Document.Current);
                        if (persisted == null || persisted.Length == 0)
                        {
                            //preserve timestamp which will be @@dbts after last record committed to db on previous Persist().
                            //otherwise another process updated APAdjust.
                            docs.Add(list[i]);
                        }
                        else
                        {
                            if (list[i].Passed == true)
                            {
                                pe.Document.Current.Passed = true;
                            }
                            docs.Add(pe.Document.Current);
                        }
                        successed = true;
                    }
                    catch (Exception e)
                    {
                        PXProcessing <APPayment> .SetError(i, e);

                        docs.Add(null);
                        failed = true;
                    }
                }
                else
                {
                    try
                    {
                        list[i].Hold = true;
                        // TODO: Need to rework. Use legal CRUD methods of caches!
                        graph.APPaymentList.Cache.PersistUpdated(list[i]);
                        graph.APPaymentList.Cache.Persisted(false);

                        graph.TimeStamp = PXDatabase.SelectTimeStamp();

                        // delete check numbers only if Reprint (not Void and Reprint)
                        PaymentMethod pm = pe.paymenttype.Select(list[i].PaymentMethodID);
                        if (pm.APPrintChecks == true && Action == "D")
                        {
                            APPayment doc = list[i];
                            new HashSet <string>(pe.Adjustments_Raw.Select(doc.DocType, doc.RefNbr, doc.LineCntr)
                                                 .RowCast <APAdjust>()
                                                 .Select(adj => adj.StubNbr))
                            .ForEach(nbr => PaymentRefAttribute.DeleteCheck((int)doc.CashAccountID, doc.PaymentMethodID, nbr));

                            // sync PaymentMethodAccount.APLastRefNbr with actual last CashAccountCheck number
                            PaymentMethodAccount det = graph.cashaccountdetail.SelectSingle(list[i].CashAccountID, list[i].PaymentMethodID);
                            PaymentRefAttribute.LastCashAccountCheckSelect.Clear(graph);
                            CashAccountCheck cacheck = PaymentRefAttribute.LastCashAccountCheckSelect.SelectSingleBound(graph, new object[] { det });
                            det.APLastRefNbr = cacheck == null ? null : cacheck.CheckNbr;
                            graph.cashaccountdetail.Cache.PersistUpdated(det);
                            graph.cashaccountdetail.Cache.Persisted(false);
                        }
                        // END TODO
                        if (string.IsNullOrEmpty(list[i].ExtRefNbr))
                        {
                            //try to get next number
                            graph.APPaymentList.Cache.SetDefaultExt <APPayment.extRefNbr>(list[i]);
                        }
                    }
                    catch (Exception e)
                    {
                        PXProcessing <APPayment> .SetError(i, e);
                    }
                    docs.Add(null);
                }
            }
            if (successed)
            {
                APDocumentRelease.ReleaseDoc(docs, true);
            }

            if (failed)
            {
                throw new PXException(GL.Messages.DocumentsNotReleased);
            }
        }
コード例 #53
0
        public virtual List <SavingEvent> Deposit(OCurrency pAmount, DateTime pDate, string pDescription, string pReferenceNumber, User pUser,
                                                  bool pIsDesactivateFees, bool isPending, bool?isLocal, OSavingsMethods savingsMethod, PaymentMethod paymentMethod, int?pendingEventId, Teller teller)
        {
            List <SavingEvent> events = new List <SavingEvent>();
            SavingEvent        savingEvent;

            int?tellerId = null;

            if (teller != null)
            {
                tellerId = teller.Id;
            }

            if (isPending)
            {
                savingEvent         = new SavingPendingDepositEvent();
                savingEvent.IsLocal = isLocal;
            }
            else
            {
                savingEvent = new SavingDepositEvent();
            }

            savingEvent.Amount          = pAmount;
            savingEvent.Date            = pDate;
            savingEvent.Description     = pDescription;
            savingEvent.ReferenceNumber = pReferenceNumber;
            savingEvent.User            = pUser;
            savingEvent.Cancelable      = true;
            savingEvent.IsPending       = isPending;
            savingEvent.SavingsMethod   = savingsMethod;
            savingEvent.PaymentsMethod  = paymentMethod;
            savingEvent.PaymentMethod   = paymentMethod;
            savingEvent.PendingEventId  = pendingEventId;
            savingEvent.TellerId        = tellerId;
            savingEvent.ProductType     = typeof(SavingsBookProduct);

            Events.Add(savingEvent);
            events.Add(savingEvent);

            return(events);
        }
コード例 #54
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Purchase" /> class.
 /// </summary>
 /// <param name="BrowserIpAddress">The IP Address of the browser that was used to make the purchase. This is the IP Address that was used to connect to your site and make the purchase. (required).</param>
 /// <param name="OrderId">A string uniquely identifying this order. (required).</param>
 /// <param name="CreatedAt">&#x60;yyyy-MM-dd&#39;T&#39;HH:mm:ssZ&#x60; The date and time when the order was placed, shown on the signifyd console. See the Dates section of these docs for more information about date formats. (required).</param>
 /// <param name="AvsResponseCode">The response code from the address verification system (AVS). Accepted codes: http://www.emsecommerce.net/avs_cvv2_response_codes.htm (required).</param>
 /// <param name="CvvResponseCode">The response code from the card verification value (CVV) check. Accepted codes listed on above link. (required).</param>
 /// <param name="TotalPrice">The total price of the order, including shipping price and taxes. (required).</param>
 /// <param name="OrderSessionId">The unique ID for the user&#39;s browsing session. This is to be used in conjunction with the Signifyd Fingerprinting Javascript..</param>
 /// <param name="DiscountCodes">Any discount codes, coupons, or promotional codes used during checkout to recieve a discount on the order..</param>
 /// <param name="Shipments">The shipments associated with this purchase..</param>
 /// <param name="Products">The products purchased in the transaction..</param>
 /// <param name="PaymentGateway">The gateway that processed the transaction..</param>
 /// <param name="PaymentMethod">PaymentMethod.</param>
 /// <param name="TransactionId">The unique identifier provided by the payment gateway for this order. If you have provided us with credentials for your payment gateway we can obtain additional details about the order, like AVS and CVV status, from your payment provider..</param>
 /// <param name="Currency">The currency type of the order, in 3 letter ISO 4217 format. Defaults to USD..</param>
 /// <param name="OrderChannel">OrderChannel.</param>
 /// <param name="ReceivedBy">If the order was was taken by a customer service or sales agent, his or her name..</param>
 public Purchase(string BrowserIpAddress = default(string), string OrderId = default(string), string CreatedAt = default(string), string AvsResponseCode = default(string), string CvvResponseCode = default(string), double?TotalPrice = default(double?), string OrderSessionId = default(string), List <DiscountCodes> DiscountCodes = default(List <DiscountCodes>), List <Shipment> Shipments = default(List <Shipment>), List <Product> Products = default(List <Product>), string PaymentGateway = default(string), PaymentMethod PaymentMethod = default(PaymentMethod), string TransactionId = default(string), string Currency = default(string), OrderChannel OrderChannel = default(OrderChannel), string ReceivedBy = default(string))
 {
     // to ensure "BrowserIpAddress" is required (not null)
     if (BrowserIpAddress == null)
     {
         throw new InvalidDataException("BrowserIpAddress is a required property for Purchase and cannot be null");
     }
     else
     {
         this.BrowserIpAddress = BrowserIpAddress;
     }
     // to ensure "OrderId" is required (not null)
     if (OrderId == null)
     {
         throw new InvalidDataException("OrderId is a required property for Purchase and cannot be null");
     }
     else
     {
         this.OrderId = OrderId;
     }
     // to ensure "CreatedAt" is required (not null)
     if (CreatedAt == null)
     {
         throw new InvalidDataException("CreatedAt is a required property for Purchase and cannot be null");
     }
     else
     {
         this.CreatedAt = CreatedAt;
     }
     // to ensure "AvsResponseCode" is required (not null)
     if (AvsResponseCode == null)
     {
         throw new InvalidDataException("AvsResponseCode is a required property for Purchase and cannot be null");
     }
     else
     {
         this.AvsResponseCode = AvsResponseCode;
     }
     // to ensure "CvvResponseCode" is required (not null)
     if (CvvResponseCode == null)
     {
         throw new InvalidDataException("CvvResponseCode is a required property for Purchase and cannot be null");
     }
     else
     {
         this.CvvResponseCode = CvvResponseCode;
     }
     // to ensure "TotalPrice" is required (not null)
     if (TotalPrice == null)
     {
         throw new InvalidDataException("TotalPrice is a required property for Purchase and cannot be null");
     }
     else
     {
         this.TotalPrice = TotalPrice;
     }
     this.OrderSessionId = OrderSessionId;
     this.DiscountCodes  = DiscountCodes;
     this.Shipments      = Shipments;
     this.Products       = Products;
     this.PaymentGateway = PaymentGateway;
     this.PaymentMethod  = PaymentMethod;
     this.TransactionId  = TransactionId;
     this.Currency       = Currency;
     this.OrderChannel   = OrderChannel;
     this.ReceivedBy     = ReceivedBy;
 }
コード例 #55
0
        private string ExchangeRate(PaymentMethod paymentMethod)
        {
            string currency = paymentMethod.ParentEntity.ProductInformation.Currency;

            return(_CurrencyNameTable.DisplayFormatCurrency(paymentMethod.Rate, currency));
        }
コード例 #56
0
        private void BtnOkClick(object sender, EventArgs e)
        {
            foreach (ListViewItem item in lvContracts.Items)
            {
                if (item == _itemTotal)
                {
                    continue;
                }
                if (!item.Checked)
                {
                    continue;
                }
                var           loan         = item.Tag as Loan;
                VillageMember activeMember = null;
                int           index        = 0;
                foreach (VillageMember member in _village.Members)
                {
                    int tIndex = member.ActiveLoans.IndexOf(loan);
                    if (tIndex > -1)
                    {
                        activeMember = member;
                        index        = tIndex;
                    }
                }

                if (activeMember != null)
                {
                    Person person = activeMember.Tiers as Person;
                    if (loan != null)
                    {
                        int       number = loan.GetFirstUnpaidInstallment().Number;
                        OCurrency total  = (OCurrency)item.SubItems[5].Tag;
                        bool      doProportionPayment = cbItem.SelectedIndex == 2;
                        OCurrency penalties           = (OCurrency)item.SubItems[4].Tag;
                        bool      disableFees         = penalties != loan.CalculateDuePenaltiesForInstallment(number, TimeProvider.Today);
                        string    comment             = item.SubItems[10].Text;

                        PaymentMethod paymentMethod = ServicesProvider.GetInstance().GetPaymentMethodServices().GetPaymentMethodById(1);

                        try
                        {
                            activeMember.ActiveLoans[index] =
                                ServicesProvider.GetInstance().GetContractServices().Repay(loan,
                                                                                           person,
                                                                                           number,
                                                                                           TimeProvider.Today,
                                                                                           total,
                                                                                           disableFees,
                                                                                           penalties,
                                                                                           0,
                                                                                           false,
                                                                                           0,
                                                                                           true,
                                                                                           doProportionPayment,
                                                                                           paymentMethod,
                                                                                           comment,
                                                                                           false);
                        }
                        catch (Exception ex)
                        {
                            new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                        }
                    }
                }

                if (loan != null)
                {
                    if (loan.Closed)
                    {
                        if (activeMember != null)
                        {
                            activeMember.ActiveLoans[index] = null;
                        }
                    }
                }
            }

            if (_AllContractsClosed())
            {
                _village.Active = false;
                ServicesProvider.GetInstance().GetContractServices().UpdateVillageStatus(_village);
            }
        }
コード例 #57
0
 public bool DeletePaymentMethod(PaymentMethod paymentMethod)
 {
     return(DeletePaymentMethod(paymentMethod.PaymentMethodID));
 }
コード例 #58
0
        protected override void Change(Employee e)
        {
            PaymentMethod method = Method;

            e.Method = method;
        }
コード例 #59
0
        public override async Task <IPaymentMethodDetails> CreatePaymentMethodDetails(DerivationStrategy supportedPaymentMethod, PaymentMethod paymentMethod, BTCPayNetwork network)
        {
            var getFeeRate = _FeeRateProviderFactory.CreateFeeProvider(network).GetFeeRateAsync();
            var getAddress = _WalletProvider.GetWallet(network).ReserveAddressAsync(supportedPaymentMethod.DerivationStrategyBase);

            Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod onchainMethod = new Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod();
            onchainMethod.FeeRate        = await getFeeRate;
            onchainMethod.TxFee          = onchainMethod.FeeRate.GetFee(100); // assume price for 100 bytes
            onchainMethod.DepositAddress = await getAddress;
            return(onchainMethod);
        }
コード例 #60
0
        public virtual async Task SeedAsync(
            bool createSuperUser,
            bool runMigrations)
        {
            if (runMigrations)
            {
                await _db.Database.MigrateAsync();
            }

            // Add administrator role if it does not exist
            string[]       roleNames = { Roles.Admin, Roles.SuperAdmin, Roles.SystemAdmin };
            IdentityResult roleResult;

            foreach (var roleName in roleNames)
            {
                var roleExist = await _roleManager.RoleExistsAsync(roleName);

                if (!roleExist)
                {
                    roleResult = await _roleManager.CreateAsync(new IdentityRole(roleName));
                }
            }

            if (createSuperUser)
            {
                // Add super-admin if none exists
                if (!_userManager.GetUsersInRoleAsync(Roles.SuperAdmin).Result.Any())
                {
                    _ = _config?.SuperAdmin?.Email ?? throw new ArgumentException("SuperAdmin email not set. Please check install documentation");
                    _ = _config?.SuperAdmin?.Password ?? throw new ArgumentException("SuperAdmin password not set. Please check install documentation");

                    var user = await _userManager.FindByEmailAsync(_config.SuperAdmin.Email);

                    if (user == null)
                    {
                        var superadmin = new ApplicationUser
                        {
                            UserName       = _config.SuperAdmin.Email,
                            Email          = _config.SuperAdmin.Email,
                            EmailConfirmed = true
                        };
                        string UserPassword     = _config.SuperAdmin.Password;
                        var    createSuperAdmin = await _userManager.CreateAsync(superadmin, UserPassword);

                        if (createSuperAdmin.Succeeded)
                        {
                            await _userManager.AddToRoleAsync(superadmin, Roles.SuperAdmin);
                        }
                    }
                }
            }

            // Seed the payment methods if none exist
            if (!_db.PaymentMethods.Any())
            {
                var methods = new PaymentMethod[] {
                    new PaymentMethod {
                        Provider = PaymentProvider.EmailInvoice,
                        Name     = "Email invoice",
                        Type     = PaymentProviderType.Invoice,
                        Active   = false,
                    },
                    new PaymentMethod {
                        Provider  = PaymentProvider.PowerOfficeEmailInvoice,
                        Name      = "Epost-faktura",
                        Type      = PaymentProviderType.Invoice,
                        Active    = true,
                        IsDefault = true
                    },
                    new PaymentMethod {
                        Provider = PaymentProvider.PowerOfficeEHFInvoice,
                        Name     = "EHF-faktura",
                        Type     = PaymentProviderType.Invoice,
                        Active   = true
                    },
                };
                _db.AddRange(methods);
                await _db.SaveChangesAsync();
            }
        }