Esempio n. 1
0
 public void CancelPayment(string transactionId)
 {
     using (var command = new CancelPayCommand(_settingService.GetServerIP(),
                                               SettingService.WorkingPort,
                                               _currentUser,
                                               new List <Payment>()
     {
         new Payment {
             TransactionId = transactionId
         }
     }))
     {
         command.Execute();
         if (!command.Success)
         {
             throw new CancelPayException(command.ErrorMessage);
         }
         else
         {
             if (command.CancelPayCommandResults.Count == 0)
             {
                 throw new CancelPayException("Сервер не вернул результатов");
             }
             if (!command.CancelPayCommandResults.First().Success)
             {
                 throw new CancelPayException(String.Format("{0}:{1}", command.CancelPayCommandResults.First().ErrorCode, command.CancelPayCommandResults.First().ErrorMessage));
             }
         }
     }
 }
Esempio n. 2
0
        public InvoiceViewModel(Invoice invoice)
        {
            _invoice = invoice;
            _amount  = _invoice.Amount;
            _isPaid  = _invoice.IsPaid;

            PayCommand       = new PayCommand(() => IsPaid = true, () => !IsPaid);
            CancelPayCommand = new CancelPayCommand(() => IsPaid = false, () => IsPaid);
        }