Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public PaymentController(AppDbContext context, IConfiguration configuration,
                          ProviderApiFactory providerApiFactory,
                          ClaimExtractorFactory extractorFactory) : base(extractorFactory)
 {
     Context            = context;
     Config             = configuration;
     AmountOfRetries    = int.Parse(Config["PaymentRetryAmount"]);
     ProviderApiFactory = providerApiFactory;
     Saga = new MovementSaga {
         Factory          = providerApiFactory, Context = context,
         ResponseEndpoint = Config["ResponseEndpoint"]
     };
     TransactionBuilder = new TransactionBuilder(context);
 }
Ejemplo n.º 3
0
        // 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);
        }
Ejemplo n.º 4
0
 public PaymentMethodsController(AppDbContext context, ProviderApiFactory factory,
                                 ClaimExtractorFactory extractorFactory) : base(extractorFactory)
 {
     Context            = context;
     ProviderApiFactory = factory;
 }
Ejemplo n.º 5
0
 public WebHookController(AppDbContext context, ProviderApiFactory providerApiFactory)
 {
     Context            = context;
     ProviderApiFactory = providerApiFactory;
 }