Ejemplo n.º 1
0
        public async Task CreateAsync(WebHook webHook)
        {
            MongoWebHook m = webHook.ToMongo();

            await WebHooks.InsertOneAsync(m);

            webHook.Id = m.Id;
        }
Ejemplo n.º 2
0
 public HMACAuthAttribute(WebHooks webHooks)
 {
     WebHooks = webHooks;
     if (allowedApps.Count == 0)
     {
         allowedApps.Add(webHooks.AppId, webHooks.SharedKey);
     }
 }
Ejemplo n.º 3
0
 public SearchApiOptions AddWebHook(string name, string uri)
 {
     WebHooks.Add(new WebHookNotification()
     {
         Name = name,
         Uri  = uri,
     });
     return(this);
 }
Ejemplo n.º 4
0
 public static void DisplayItems(WebHooks webHooks)
 {
     if (webHooks != null && webHooks.Any())
     {
         foreach (var item in webHooks)
         {
             DisplayItem(item);
         }
     }
 }
Ejemplo n.º 5
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (_webhooks == null || _webhooks.IsStopped)
     {
         StartProcess(_webhooks = new WebHooks(), sender as Button);
     }
     else
     {
         StopProcess(_webhooks, sender as Button);
     }
 }
Ejemplo n.º 6
0
        public async Task <WebHook> GetAsync(Guid id)
        {
            MongoWebHook?result = WebHooks.AsQueryable().FirstOrDefault(x => x.Id == id);

            if (result == null)
            {
                throw new Exception();
            }

            return(result.ToModel());
        }
Ejemplo n.º 7
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();
            services.AddAuthorization();

            // binding configuration from appsettings.json
            var webhooks = new WebHooks();

            configuration.Bind("WebHooks", webhooks);
            services.AddSingleton(webhooks);
            services.AddScoped <AesHelper>();
        }
Ejemplo n.º 8
0
        /// <param name="apiKey">Apikey assigned to your commerce. You can find it in Panel.banzilla.com</param>
        /// <param name="secretKey">Secret Key assigned to your commerce. You can find it in Panel.banzilla.com</param>
        /// <param name="sandBox">true if you want simulate the charge.</param>
        public APIRequest(string apiKey, string secretKey, bool sandBox)
        {
            _apiKey    = apiKey;
            _secretKey = secretKey;
            _sandBox   = sandBox;

            Charge        = new Charge(apiKey, secretKey, sandBox);
            Cards         = new Cards(apiKey, secretKey, sandBox);
            BlackList     = new BlackList(apiKey, secretKey, sandBox);
            Plans         = new Plans(apiKey, secretKey, sandBox);
            Subscriptions = new Subscriptions(apiKey, secretKey, sandBox);
            WebHooks      = new WebHooks(apiKey, secretKey, sandBox);
        }
Ejemplo n.º 9
0
        public async Task <QueryResult <WebHook> > QueryAsync(WebHookQuery query)
        {
            IQueryable <MongoWebHook> q = WebHooks.AsQueryable();

            if (query.Event != null)
            {
                q = q.Where(x => x.EventName == query.Event);
            }

            var items = q.ToList().Select(x => x.ToModel()).ToList();

            return(new QueryResult <WebHook>()
            {
                Items = items
            });
        }
        public void ListMyWebHooks()
        {
            // List all the WebHooks defined in my Authorize.Net account
            var webHook = InitWebHook();

            WebHooks webhooks = null;

            try
            {
                webhooks = webHook.List();
            }
            catch (Exception err)
            {
                common.DisplayError(err);
                common.DisplayResponse(webHook);
                Assert.Fail("Exception from WebHook; Please see the output window for more information.");
                return;
            }

            if (webhooks != null && webhooks.Any())
            {
                // see if we got any errors back from Authorize.Net that were not exceptions
                if (webhooks.AnyError())
                {
                    foreach (var webHookEx in webhooks.AllErrors())
                    {
                        common.DisplayError(webHookEx.Exception);
                    }
                }
                else
                {
                    // no errors, we are good:  Display the eventTypes and set the test as successful.
                    common.DisplayItems(webhooks);
                    Assert.IsTrue(true);
                }
            }
            else
            {
                Debug.WriteLine("No webhooks found in account.");
            }

            common.DisplayResponse(webHook);
        }
Ejemplo n.º 11
0
 public AesHelper(WebHooks webHooks)
 {
     this.webHooks = webHooks;
     keyValue      = Guid.Parse(this.webHooks.AppId).ToString("N");
 }
Ejemplo n.º 12
0
 public async Task DeleteAsync(WebHook webHook)
 {
     await WebHooks.DeleteOneAsync(Builders <MongoWebHook> .Filter.Eq(x => x.Id, webHook.Id));
 }
Ejemplo n.º 13
0
 public async Task UpdateAsync(WebHook webHook)
 {
     await WebHooks.ReplaceOneAsync(Builders <MongoWebHook> .Filter.Eq(x => x.Id, webHook.Id), webHook.ToMongo());
 }