Ejemplo n.º 1
0
        private void BuyAService(UserService servicoToHire, HireServiceModel payer)
        {
            var customer   = CreateOrRetrieveAccountCustomer(payer);
            var finalPrice = PriceManager.FinalPrice(servicoToHire);
            var valueToPay = Int32.Parse(finalPrice.ToString()
                                         .Replace(",", string.Empty)
                                         .Replace(".", string.Empty));

            // Recebendo o dinheiro.
            var chargeOptions = new StripeChargeCreateOptions()
            {
                Amount        = valueToPay,
                Currency      = "brl",
                Description   = servicoToHire.Name,
                CustomerId    = customer.Id,
                TransferGroup = "{ORDER10}",
            };
            var chargeService = new StripeChargeService();

            PaymentsCustomer payment = new PaymentsCustomer
            {
                Customer = customer,
                Amount   = valueToPay,
                PayDay   = DateTime.Now
            };

            IlevusDBContext db = IlevusDBContext.Create();

            db.GetPaymentsCustomerCollection().InsertOne(payment);
        }