public MembershipController(YogaAshramContext db, UserManager <Employee> userManager, PaymentsService paymentsService, ClientServices clientServices)
 {
     _db              = db;
     _userManager     = userManager;
     _paymentsService = paymentsService;
     _clientServices  = clientServices;
 }
        public IActionResult Info(string SKU, string Reference)
        {
            //    int service = 0;

            //    switch (SKU.Split('-')[0].ToString())
            //    {
            //        case "DT":
            //            service = 1;
            //            break;
            //        case "TN":
            //            service = 2;
            //            break;
            //    }

            //    if (service == 0)
            //    {
            //        return NotFound();
            //    }

            var cnx = _context.conexion_Configs.Find(1);

            var Payments = new PaymentsService(cnx.Url, cnx.Usr, cnx.Pwd, cnx.CrypKey);

            Payments.Config(7, 1, 1, 1);

            var fields = Payments.PaymentInfo(SKU.Split('-')[1].ToString(), Reference);


            return(Ok(fields));
        }
示例#3
0
        private PaymentsService GetPaymentsService(EfDeletableEntityRepository <Payment> paymentRepository)
        {
            var paymentsService = new PaymentsService(
                paymentRepository);

            return(paymentsService);
        }
示例#4
0
        public IActionResult Put(string SKU, string Reference)
        {
            int id_credentials = 0;

            switch (SKU.Split("-")[0].ToString())
            {
            case "DT":
                id_credentials = 1;
                break;

            case "TN":
                id_credentials = 2;
                break;
            }

            if (id_credentials == 0)
            {
                return(NotFound(""));
            }
            var             cnx     = _context.conexion_Configs.Find(id_credentials);
            PaymentsService Payment = new PaymentsService(cnx.Url, cnx.Usr, cnx.Pwd, cnx.CrypKey);

            Payment.Config(7, 1, 1, 1);

            var fields = Payment.PaymentInfo(SKU.Split("-")[1].ToString(), Reference);

            return(Ok(fields));
        }
        public PaymentsServiceTests()
        {
            var loggerMock = new Mock <ILogger <PaymentsService> >();

            _paymentsRepositoryMock = new Mock <IPaymentsRepository>();
            _paymentsService        = new PaymentsService(_paymentsRepositoryMock.Object, loggerMock.Object);
        }
示例#6
0
 private async Task DeleteItemsAsync(IEnumerable <PaymentModel> models)
 {
     foreach (var model in models)
     {
         await PaymentsService.DeletePaymentAsync(model);
     }
 }
示例#7
0
        public CoinbaseProClient(
            IAuthenticator authenticator,
            IHttpClient httpClient,
            bool sandBox = false)
        {
            var clock = new Clock();
            var httpRequestMessageService = new HttpRequestMessageService(authenticator, clock, sandBox);
            var createWebSocketFeed       = (Func <IWebSocketFeed>)(() => new WebSocketFeed(sandBox));
            var queryBuilder = new QueryBuilder();

            AccountsService              = new AccountsService(httpClient, httpRequestMessageService);
            CoinbaseAccountsService      = new CoinbaseAccountsService(httpClient, httpRequestMessageService);
            OrdersService                = new OrdersService(httpClient, httpRequestMessageService, queryBuilder);
            PaymentsService              = new PaymentsService(httpClient, httpRequestMessageService);
            WithdrawalsService           = new WithdrawalsService(httpClient, httpRequestMessageService);
            DepositsService              = new DepositsService(httpClient, httpRequestMessageService);
            ProductsService              = new ProductsService(httpClient, httpRequestMessageService, queryBuilder);
            CurrenciesService            = new CurrenciesService(httpClient, httpRequestMessageService);
            FillsService                 = new FillsService(httpClient, httpRequestMessageService);
            FundingsService              = new FundingsService(httpClient, httpRequestMessageService, queryBuilder);
            ReportsService               = new ReportsService(httpClient, httpRequestMessageService);
            UserAccountService           = new UserAccountService(httpClient, httpRequestMessageService);
            StablecoinConversionsService = new StablecoinConversionsService(httpClient, httpRequestMessageService);
            FeesService     = new FeesService(httpClient, httpRequestMessageService);
            ProfilesService = new ProfilesService(httpClient, httpRequestMessageService);
            WebSocket       = new WebSocket.WebSocket(createWebSocketFeed, authenticator, clock);

            Log.Information("CoinbaseProClient constructed");
        }
示例#8
0
        public async Task MakePaymentAsync_ShouldReturn_Null_WhenInputIsCorrectButNextMonthPaymentFails()
        {
            var db     = GetDatabase();
            var mapper = GetMapper();

            var firstMonthRent = new MonthlyPaymentRent
            {
                Id           = 1,
                TotalPayment = 2000
            };
            await db.MonthlyPaymentRents.AddRangeAsync(firstMonthRent);

            var firstPayment = new Payment {
                Id = 20, Amount = 500, MonthlyPaymentRentId = 1
            };
            var secndPayment = new Payment {
                Id = 21, Amount = 500, MonthlyPaymentRentId = 1
            };
            await db.Payments.AddRangeAsync(firstPayment, secndPayment);

            var user = new User
            {
                Id = "007"
            };
            await db.Users.AddAsync(user);

            await db.SaveChangesAsync();


            var monthlyRentMock = new Mock <IMonthlyRentsService>();

            monthlyRentMock
            .Setup(mr => mr.CreateNextMonthPayment(It.IsAny <int>()))
            .ReturnsAsync(false);

            var paymentService = new PaymentsService(mapper, db, monthlyRentMock.Object);

            //Act
            var paymentModel = new BindingMonthlyRentModel
            {
                CashPayment   = true,
                MonthlyRentId = 1,
                Payment       = 1000,
                PaidOn        = new DateTime(2018, 12, 12)
            };
            var result = await paymentService.MakePaymentAsync(paymentModel, "007");

            var payment = await db.Payments
                          .FirstOrDefaultAsync(x => x.MonthlyPaymentRentId == 1 && x.Amount == 1000);

            //Assert
            result
            .Should()
            .BeNull();
            payment
            .Should()
            .Match <Payment>(x => x.CashPayment == true &&
                             x.UserId == "007" &&
                             x.Amount == 1000);
        }
        public async Task PaymentAllTest()
        {
            var optionBuilder = new DbContextOptionsBuilder <ApplicationDbContext>()
                                .UseInMemoryDatabase("testDb");
            var dbContext = new ApplicationDbContext(optionBuilder.Options);

            var service = new PaymentsService(dbContext);

            var payment = new Payment
            {
                Date          = DateTime.UtcNow.Date,
                PaymentSource = Enum.Parse <PaymentSource>("каса"),
                Value         = 100
            };

            await dbContext.Payments.AddAsync(payment);

            await dbContext.SaveChangesAsync();


            // Act
            var result = service.AllAsync();

            // Assert
            Assert.NotNull(result);
            //Assert.Equal(1, result.Id);
        }
示例#10
0
        public async Task PaymentEditTest()
        {
            var optionBuilder = new DbContextOptionsBuilder <ApplicationDbContext>()
                                .UseInMemoryDatabase("testDb");
            var dbContext = new ApplicationDbContext(optionBuilder.Options);

            var payment = new PaymentsInputViewModel
            {
                Date          = DateTime.UtcNow.Date,
                PaymentSource = "каса",
                Value         = 100
            };

            var service = new PaymentsService(dbContext);

            var paymentEdited = new PaymentsEditViewModel
            {
                Date          = DateTime.UtcNow.Date.AddDays(10),
                PaymentSource = "каса",
                Value         = 1000
            };

            await service.CreateAsync(payment);

            var result = service.EditAsync(paymentEdited);

            Assert.True(result.IsCompletedSuccessfully);
            Assert.NotNull(result);
        }
示例#11
0
 private async Task <IList <PaymentModel> > GetItemsAsync()
 {
     if (!ViewModelArgs.IsEmpty)
     {
         DataRequest <Data.Payment> request = BuildDataRequest();
         return(await PaymentsService.GetPaymentsAsync(request));
     }
     return(new List <PaymentModel>());
 }
        public CardPaymentRequestStatus ProcessCardPaymentRequest(CardPayment cardPayment, int retryCount)
        {
            var result = CardPaymentRequestStatus.NotRequest;
            // SZXResult szxResult = PaymentsService.YeepayCardPayments(cardPayment); //卡内金额全部充值
            SZXResult szxResult = PaymentsService.YeepayCardPartialPayments(cardPayment); //部分充值


            LogHelper.WriteInfo(string.Format("Processing card payment with OrderNo : {0}, request result : {1}", cardPayment.OrderNo, szxResult == null ? "null" : szxResult.R1_Code));
            if (szxResult == null || string.IsNullOrEmpty(szxResult.R1_Code)) // retry
            {
                if (retryCount == -1)
                {
                    result = CardPaymentRequestStatus.RequestFailed;
                }
                else
                {
                    cardPayment.RequestDateTime = DateTime.Now;
                    retryCount++;
                    result = CardPaymentRequestStatus.RequestFailed;

                    if (retryCount <= retryTimesLimitation)
                    {
                        RedisService.AddItemToQueue <CardPayment>(BillingConsts.KEY_CARD_PAYMENT_REQUEST_RETRY_QUEUE + retryCount, cardPayment);
                    }
                    else // final failed
                    {
                        Order currentOrder = oracleRepo.Single <Order>(cardPayment.OrderID);
                        SetFailedOrderStatus(CardPaymentRequestStatus.RequestFailed, currentOrder);
                        //record the info for retry manually
                        var cardPaymentInfoForRetry = EntityMapping.Auto <CardPayment, CardPaymentRetry>(cardPayment);
                        var AddRes = oracleRepo.Add <CardPaymentRetry>(cardPaymentInfoForRetry);
                    }
                }
            }
            else
            {
                CardPaymentRequestStatus requestStatus = (CardPaymentRequestStatus)szxResult.R1_Code.ToInt32();
                Order currentOrder = oracleRepo.Single <Order>(cardPayment.OrderID);

                if (currentOrder != null)
                {
                    switch (requestStatus)
                    {
                    case CardPaymentRequestStatus.Success:
                        SetSuccessOrderStatus(currentOrder);
                        result = requestStatus;
                        break;

                    default:
                        SetFailedOrderStatus(requestStatus, currentOrder);
                        result = requestStatus;
                        break;
                    }
                }
            }
            return(result);
        }
 public PaymentsController(UserManager <IdentityUser> userManager,
                           CustomerService customerService,
                           PaymentsService paymentsService,
                           ILogger <PaymentsController> logger)
 {
     this.userManager     = userManager;
     this.customerService = customerService;
     this.paymentsService = paymentsService;
     this.logger          = logger;
 }
示例#14
0
 public AccountsController(AccountsService customerServices,
                           CustomerService customerService,
                           PaymentsService paymentsService,
                           UserManager <IdentityUser> userManager)
 {
     this.accountsService = customerServices;
     this.userManager     = userManager;
     this.customerService = customerService;
     this.paymentsService = paymentsService;
 }
示例#15
0
        public void PaymentAllLawCasesIdTest()
        {
            var optionBuilder = new DbContextOptionsBuilder <ApplicationDbContext>()
                                .UseInMemoryDatabase("testDb");
            var dbContext = new ApplicationDbContext(optionBuilder.Options);
            var service   = new PaymentsService(dbContext);

            var result = service.AllLawCasesId();

            Assert.NotNull(result);
        }
示例#16
0
 public IHttpActionResult MakeCardPayment(PaypalPaymentPostObj data)
 {
     try
     {
         return(Ok(PaymentsService.MakeCreditCardPayment(data)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
 public PaymentsController(
     IUserService userService,
     IPriceListService priceListService,
     ITicketTypeService ticketTypeService,
     ITransactionService transactionAppService,
     ITicketService ticketService,
     IMerchant merchant
     )
 {
     paymentsService = new PaymentsService(
         transactionAppService, priceListService, ticketTypeService, ticketService, userService, merchant);
 }
示例#18
0
 public IHttpActionResult ExecutePayment(ExecutePaymentPostObj data)
 {
     try
     {
         var result = PaymentsService.ExecutePayment(data);
         return(Ok(PaymentsService.GetPaymentsList()));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
示例#19
0
        public async Task MakeConsumablesPaymentAsync_ShouldReturn_True_WhenInputIsCorrect()
        {
            var db     = GetDatabase();
            var mapper = GetMapper();

            var firstMonthConsumable = new MonthlyPaymentConsumable
            {
                Id = 1,
                PaymentForWater       = 100,
                PaymentForElectricity = 200
            };
            var secondMonthConsumable = new MonthlyPaymentConsumable
            {
                Id = 2,
                PaymentForWater       = 200,
                PaymentForElectricity = 300
            };
            var thirdMonthConsumable = new MonthlyPaymentConsumable
            {
                Id = 3,
                PaymentForWater       = 400,
                PaymentForElectricity = 500
            };

            await db.MonthlyPaymentConsumables.AddRangeAsync(firstMonthConsumable, secondMonthConsumable, thirdMonthConsumable);

            var user = new User
            {
                Id = "007"
            };
            await db.Users.AddAsync(user);

            await db.SaveChangesAsync();


            var paymentService = new PaymentsService(mapper, db, null);
            //Act
            var result = await paymentService.MakeConsumablesPaymentAsync(2, true, new DateTime(2018, 12, 12), "007");

            var payment = await db.Payments
                          .FirstOrDefaultAsync(x => x.MonthlyPaymentConsumableId == 2);

            //Assert
            result
            .Should()
            .BeTrue();
            payment
            .Should()
            .Match <Payment>(x => x.CashPayment == true &&
                             x.UserId == "007" &&
                             x.Amount == 500);
        }
 public AccountsController(AccountsService customerServices,
                           MetaDataService metaDataService,
                           CustomerService customerService,
                           PaymentsService paymentsService,
                           UserManager <IdentityUser> userManager,
                           RazorPagesReportingEngine reportingEngine)
 {
     this.accountsService = customerServices;
     this.userManager     = userManager;
     this.metaDataService = metaDataService;
     this.reportingEngine = reportingEngine;
     this.customerService = customerService;
     this.paymentsService = paymentsService;
 }
示例#21
0
        public async Task MakeConsumablesPaymentAsync_ShouldReturn_False_IfUsrerDoNotExist()
        {
            var db     = GetDatabase();
            var mapper = GetMapper();

            var firstMonthConsumable = new MonthlyPaymentConsumable
            {
                Id = 1,
                PaymentForWater       = 100,
                PaymentForElectricity = 200
            };
            var secondMonthConsumable = new MonthlyPaymentConsumable
            {
                Id = 2,
                PaymentForWater       = 200,
                PaymentForElectricity = 300
            };
            var thirdMonthConsumable = new MonthlyPaymentConsumable
            {
                Id = 3,
                PaymentForWater       = 400,
                PaymentForElectricity = 500
            };

            await db.MonthlyPaymentConsumables.AddRangeAsync(firstMonthConsumable, secondMonthConsumable, thirdMonthConsumable);

            var user = new User
            {
                Id = "007"
            };
            await db.Users.AddAsync(user);

            await db.SaveChangesAsync();


            var paymentService = new PaymentsService(mapper, db, null);
            //Act
            var result = await paymentService.MakeConsumablesPaymentAsync(2, true, new DateTime(2018, 12, 12), "069");

            var payment = await db.Payments
                          .FirstOrDefaultAsync(x => x.MonthlyPaymentConsumableId == 2);

            //Assert
            result
            .Should()
            .BeFalse();
            payment
            .Should()
            .BeNull();
        }
示例#22
0
        public async Task AddPaymentShouldAddCorrectCount()
        {
            var repository = new EfDeletableEntityRepository <Payment>(new ApplicationDbContext(this.options.Options));
            var service    = new PaymentsService(repository);

            var payment = new PaymentTypeInputModel
            {
                PaymentType   = "Cash",
                ReservationId = Guid.NewGuid().ToString(),
            };

            await service.AddAsync(payment);

            Assert.Equal(1, repository.All().Count());
        }
 public AdminManagementController(GardenLinkContext db,
                                  GardensService gardensService,
                                  LeasingsService leasingsService,
                                  PaymentsService paymentsService,
                                  ScoresService scoresService,
                                  UsersService usersService,
                                  WalletsService walletsService)
 {
     this.db              = db;
     this.gardensService  = gardensService;
     this.leasingsService = leasingsService;
     this.paymentsService = paymentsService;
     this.scoresService   = scoresService;
     this.usersService    = usersService;
     this.walletsService  = walletsService;
 }
示例#24
0
        public GDAXClient(Authenticator authenticator, bool sandBox = false)
        {
            this.authenticator = authenticator;

            var httpClient = new HttpClient.HttpClient();
            var clock      = new Clock();
            var httpRequestMessageService = new Services.HttpRequest.HttpRequestMessageService(clock, sandBox);

            AccountsService         = new AccountsService(httpClient, httpRequestMessageService, authenticator);
            CoinbaseAccountsService = new CoinbaseAccountsService(httpClient, httpRequestMessageService, authenticator);
            OrdersService           = new OrdersService(httpClient, httpRequestMessageService, authenticator);
            PaymentsService         = new PaymentsService(httpClient, httpRequestMessageService, authenticator);
            WithdrawalsService      = new WithdrawalsService(httpClient, httpRequestMessageService, authenticator);
            DepositsService         = new DepositsService(httpClient, httpRequestMessageService, authenticator);
            ProductsService         = new ProductsService(httpClient, httpRequestMessageService, authenticator);
            CurrenciesService       = new CurrenciesService(httpClient, httpRequestMessageService, authenticator);
        }
示例#25
0
        public CardsController(CustomerService customerService,
                               AccountsService accountsService,
                               CardServices cardService,
                               PaymentsService transactionService,
                               //MetaDataService metaDataService,
                               UserManager <IdentityUser> userManager,
                               ILogger <CardsController> logger)

        {
            this.transactionService = transactionService;
            this.userManager        = userManager;
            this.cardService        = cardService;
            this.customerService    = customerService;
            this.accountsService    = accountsService;
            // this.metaDataService = metaDataService;
            this.logger = logger;
        }
示例#26
0
        public async void CreatePaymentTestShouldReturnNullWhenBankFailsToProcessPayment()
        {
            //update mockBankRepository to return failed payments
            MockBankRepository mockBankRepositoryFailProcess = new MockBankRepository(processPaymentSuccess: false);

            paymentsService = new PaymentsService(mockBankRepositoryFailProcess, paymentRepository);
            Payment paymentResult = await paymentsService.CreatePayment(new Payment
            {
                Amount         = 449.99F,
                CustomerEmail  = "*****@*****.**",
                CustomerName   = "John Doe",
                CardExpiryDate = new DateTime(2019, 12, 1),
                CardNumber     = "123456789101112",
                Currency       = "GBP",
                CVV            = "333"
            });

            Assert.Null(paymentResult);
        }
示例#27
0
        public GDAXClient(
            IAuthenticator authenticator,
            bool sandBox = false)
        {
            var httpClient = new HttpClient.HttpClient();
            var clock      = new Clock();
            var httpRequestMessageService = new HttpRequestMessageService(clock, sandBox);
            var queryBuilder = new QueryBuilder();

            AccountsService         = new AccountsService(httpClient, httpRequestMessageService, authenticator);
            CoinbaseAccountsService = new CoinbaseAccountsService(httpClient, httpRequestMessageService, authenticator);
            OrdersService           = new OrdersService(httpClient, httpRequestMessageService, authenticator);
            PaymentsService         = new PaymentsService(httpClient, httpRequestMessageService, authenticator);
            WithdrawalsService      = new WithdrawalsService(httpClient, httpRequestMessageService, authenticator);
            DepositsService         = new DepositsService(httpClient, httpRequestMessageService, authenticator);
            ProductsService         = new ProductsService(httpClient, httpRequestMessageService, authenticator, queryBuilder);
            CurrenciesService       = new CurrenciesService(httpClient, httpRequestMessageService, authenticator);
            FillsService            = new FillsService(httpClient, httpRequestMessageService, authenticator);
            FundingsService         = new FundingsService(httpClient, httpRequestMessageService, authenticator, queryBuilder);
        }
示例#28
0
        public IActionResult CheckService()
        {
            var    reader      = new StreamReader(Request.Body);
            var    body        = reader.ReadToEnd();
            string jsonContent = body;

            var root       = JArray.Parse(jsonContent);
            var firstChild = JArray.Parse(root[0].ToString());
            var fields     = root[1].ToString();

            dynamic jdata = JObject.Parse(firstChild[0].ToString());

            string jSKU = jdata.SKU;

            string[] SKU = ExtensionMethods.ExtSKU.SeparateSku(jSKU);

            Conexion_Config cnx      = null;
            ResponseService response = null;

            var lsFields = JsonConvert.DeserializeObject <List <Field> >(fields);


            int id_credentials = 0;

            switch (SKU[0])
            {
            case "DT":
                id_credentials = 1;
                break;

            case "TN":
                id_credentials = 2;
                break;
            }
            cnx = _context.conexion_Configs.Find(id_credentials);
            var credentials = new PaymentsService(cnx.Url, cnx.Usr, cnx.Pwd, cnx.CrypKey);

            credentials.Config(7, 1, 1, 1);
            response = credentials.Check(lsFields);
            return(Ok(response));
        }
        public void CreatePaypalPayment()
        {
            //// Arrange
            //var controller = new PaymentsController();


            var data = new PaypalPaymentPostObj
            {
                invoice_number = "123456",
                total          = "7",
                description    = "This is the description",
                return_url     = "www.abc.com",
                cancel_url     = "www.abc.com/cancel"
            };

            // Act
            var result = PaymentsService.CreatePaypalPayment(data);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("123456", result.transactions[0].invoice_number);
        }
        public IActionResult Ejecuta()
        {
            var dt     = new Class_DT();
            var reader = new StreamReader(Request.Body);
            var body   = reader.ReadToEnd();

            body = dt.ReplaceFrom(body);
            var root = JArray.Parse(body);

            var          cnx    = _context.conexion_Configs.Find(1);
            List <Field> fields = null;

            fields = JsonConvert.DeserializeObject <List <Field> >(root[0].ToString());

            var payments = new PaymentsService(cnx.Url, cnx.Usr, cnx.Pwd, cnx.CrypKey);

            payments.Config(7, 1, 1, 1, 1);

            var response = payments.Request(fields);

            return(Ok(response));
        }