예제 #1
0
 public HomeController(IMpesaClient mpesaClient, IConfiguration configuration, IMemoryCache memoryCache, ILogger <HomeController> logger)
 {
     _configuration = configuration;
     _mpesaClient   = mpesaClient;
     _memoryCache   = memoryCache;
     _logger        = logger;
 }
예제 #2
0
 public HomeController(IOptions <MpesaApiConfiguration> mpesaApiConfiguration, IMpesaClient mpesaClient,
                       ILogger <HomeController> logger, LinkGenerator linkGenerator, IHttpContextAccessor httpContextAccessor,
                       IMemoryCache memoryCache)
 {
     _mpesaApiConfiguration = mpesaApiConfiguration.Value;
     _mpesaClient           = mpesaClient;
     _logger              = logger;
     _linkGenerator       = linkGenerator;
     _httpContextAccessor = httpContextAccessor;
     _memoryCache         = memoryCache;
 }
        public MpesaResultsViewModel(INavigationService navigationService, IMpesaClient mpesaClient, IUserDialogs dialogs) : base(navigationService)
        {
            _navigationService = navigationService;
            _mpesaClient       = mpesaClient;
            _dialogs           = dialogs;

            MpesaStkQueryCommand = ReactiveCommand.CreateFromTask(x => ExecuteMpesaStkQueryCommand(PushStkResponse),
                                                                  this.WhenAnyValue(x => x.PushStkResponse)
                                                                  .Where(x => x != null)
                                                                  .Select(_pushResponse =>
            {
                if (string.IsNullOrEmpty(_pushResponse.CheckoutRequestID))
                {
                    return(false);
                }
                return(true);
            }));
            this.BindBusy(MpesaStkQueryCommand);
        }
 public MpesaPushStkViewModel(INavigationService navigationService, IMpesaClient mpesaClient, IUserDialogs dialogs) : base(navigationService)
 {
     Title = "Mpesa Push Stk Payment";
     _navigationService = navigationService;
     _mpesaClient       = mpesaClient;
     _dialogs           = dialogs;
     MpesaStkCommand    = ReactiveCommand.CreateFromTask(ExecuteMpesaStkCommand,
                                                         this.WhenAnyValue(
                                                             x => x.Amount,
                                                             x => x.AccountReference,
                                                             x => x.TransactionDescription,
                                                             x => x.PhoneNumber,
                                                             (amount, accountReference, transactionDescription, phoneNumber) =>
     {
         if (string.IsNullOrEmpty(amount) && string.IsNullOrEmpty(accountReference) && string.IsNullOrEmpty(transactionDescription) && string.IsNullOrEmpty(phoneNumber))
         {
             return(false);
         }
         return(true);
     }));
     this.BindBusy(MpesaStkCommand);
 }