public async Task Rollback(ProviderApiFactory providerApiFactory, AppDbContext context) { IsRollback = true; InProcess = true; var api = providerApiFactory.Create(Account.Provider.RollbackEndpoint); await api.Rollback(new RollbackMessage(OperationId)); InProcess = false; context.Movements.Update(this); }
// todo: hacer async public bool Start(ProviderApiFactory providerApiFactory, AppDbContext context, string responseEndpoint) { InProcess = true; Started = true; var couldTriggerPayment = false; var api = providerApiFactory.Create(Account.Provider.PaymentEndpoint); try { api.Pay(StartPaymentMessage.Build(Account, OperationType, Amount, responseEndpoint, OperationId)).Wait(); couldTriggerPayment = true; } catch (Exception e) { Debug.Print(e.ToString()); IsSuccesfull = false; InProcess = false; } context.Movements.Update(this); return(couldTriggerPayment); }