/// <param name='operations'>
        /// The operations group for this extension method.
        /// </param>
        public static IList <Payment> Get(this IPaymentOperations operations,
                                          string locationId,
                                          DateTime?beginTime      = null,
                                          DateTime?endTime        = null,
                                          ListOrderType?listOrder = null,
                                          short?limit             = null,
                                          bool isContinous        = false)
        {
            //return new ActiveList<Payment>
            //{
            //    _Payments = Task
            //    .Factory
            //    .StartNew(s => ((IPaymentOperations)s).GetAsync(locationId, beginTime, endTime, listOrder, limit), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default)
            //    .Unwrap()
            //    .GetAwaiter()
            //    .GetResult(),
            //};

            var task = Task.Run(() => operations.GetWithHttpMessagesAsync(locationId, beginTime, endTime, listOrder, limit, null));

            task.Wait();

            return(new ActiveList <Payment>
            {
                InitialUri = task.Result.Request.RequestUri.AbsoluteUri,
                Collection = task.Result.Body,
                NextUri = task.Result.ToNextUri(),
                Operations = operations,
                IsContinous = isContinous,
            });
        }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <Payment> > GetAsync(this IPaymentOperations operations,
                                                      string locationId,
                                                      DateTime?beginTime                  = null,
                                                      DateTime?endTime                    = null,
                                                      ListOrderType?listOrder             = null,
                                                      short?limit                         = null,
                                                      bool isContinous                    = false,
                                                      CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var result = await operations.GetWithHttpMessagesAsync(locationId, beginTime, endTime, listOrder, limit, null, cancellationToken).ConfigureAwait(false))
     {
         return(new ActiveList <Payment>
         {
             InitialUri = result.Request.RequestUri.AbsoluteUri,
             Collection = result.Body,
             NextUri = result.ToNextUri(),
             Operations = operations,
             IsContinous = isContinous,
             CancellationToken = cancellationToken,
         });
     }
 }
예제 #3
0
 public PaymentController(IPaymentOperations <TransactionResult> payService)
 {
     _payService = payService;
 }
예제 #4
0
 public PaymentModeWorker(IPaymentOperations operations, IMapper mapper)
 {
     this.operations = operations;
     this.mapper     = mapper;
 }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// </param>
 /// <param name='value'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task PutAsync(this IPaymentOperations operations, string locationId, string paymentId, Payment value, CancellationToken cancellationToken = default(CancellationToken))
 {
     await operations.PutWithHttpMessagesAsync(locationId, value, null, cancellationToken).ConfigureAwait(false);
 }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// </param>
 /// <param name='value'>
 /// </param>
 public static void Put(this IPaymentOperations operations, string locationId, string paymentId, Payment value)
 {
     Task.Factory.StartNew(s => ((IPaymentOperations)s).PutAsync(locationId, paymentId, value), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
예제 #7
0
 public Checkouts(IProductRepository productRepository, IPaymentOperations paymentOperations, ICommunications communications)
 {
     _productRepository = productRepository;
     _paymentOperations = paymentOperations;
     _communications    = communications;
 }
 private void InitSubApis()
 {
     if (!isIntialized())
     {
         companyMetaDataOperations = new CompanyMetaDataTemplate(this.RestTemplate);
         this.companyId = this.companyMetaDataOperations.CompanyMetaData().ExternalRealmId;
         accountOperations = new AccountTemplate(this.RestTemplate, IsAuthorized, this.companyId);
         customerOperations = new CustomerTemplate(this.RestTemplate, IsAuthorized, this.companyId);
         invoiceOperations = new InvoiceTemplate(this.RestTemplate, IsAuthorized, this.companyId);
         itemOperations = new ItemTemplate(this.RestTemplate, IsAuthorized, this.companyId);
         paymentMethodOperations = new PaymentMethodTemplate(this.RestTemplate, IsAuthorized, this.companyId);
         paymentOperations = new PaymentTemplate(this.RestTemplate, IsAuthorized, this.companyId);
         userOperations = new UserTemplate(this.RestTemplate, IsAuthorized);
     }
 }