Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "GarethWright"

.netCore

If issue related with ABP Framework

Latest

I'm trying to integrate with GoCardless to add Direct Debit Payments for memberships. They sent a webhook when payments are complete and I need to add the following to a controller to process that event.

[HttpPost]
       
        [AllowAnonymous]
        public async Task<StatusCodeResult> WebhookEvent()
        
            {
    var requestBody = HttpContext.Request.Body;
    requestBody.Seek(0, System.IO.SeekOrigin.Begin);
    var requestJson = new StreamReader(requestBody).ReadToEnd();

    // We recommend storing your webhook endpoint secret in an environment variable
    // for security
    var secret = AppConsts.GoCardlesssSandBoxToken;
    var signature = Request.Headers["Webhook-Signature"];

    try
    {
        // Webhooks can contain many events. In a real implementation, you should handle
        // the processing of each event asychronously to avoid timing out here.
        // You could check whether you've processed the event before (by recording the event
        // ID when you process it) and retrieve the associated resource to ensure that you have
        // the most up-to-date information about it.
        foreach (GoCardless.Resources.Event whevent in WebhookParser.Parse(requestJson, secret, signature))
        {
            // To keep this example simple, we're only handling Mandate events
            if (whevent.ResourceType == GoCardless.Resources.EventResourceType.Mandates)
            {
                switch (whevent.Action)
                {
                    case "created":
                        Console.WriteLine($"Mandate {whevent.Links.Mandate} has been created, yay!");
                        break;
                    case "cancelled":
                        Console.WriteLine($"Oh no, mandate {whevent.Links.Mandate} was cancelled!");
                        break;
                    default:
                        Console.WriteLine($"{whevent.Links.Mandate} has been {whevent.Action}");
                        break;
                }
            }
            else
            {
                Console.WriteLine($"No method to handle {whevent.ResourceType} events yet");
            }
        }

        return new StatusCodeResult((int)HttpStatusCode.OK);

    }
    catch (InvalidSignatureException e)
    {
        return new BadRequestResult();
    }
}

I've added to the MVC controller but I keep getting 302 redirected to login page. I can't figure out why as I've added the [AllowAnonymous] Attribute. I've also tried the [abpAllowAnonymous] attribute with no success.

  • What is your product version?
  • 9.0.2
  • What is your product type (Angular or MVC)?
  • Angular (Integrated)
  • What is product framework type (.net framework or .net core)?
  • .netCore

I've downloaded the latest 9.2.0...how does one go about updating my project?

Language is set to English UK and date set to 2020-07-13 in datepicker.

Date saved is 2020-07-12 because it is not accounting for daylight savings time.

More worrying is that on updating the entity all the date fields are changed to the previous day.

I think this is because if the language is 'en' it just returns the promise without checking any locale specifics like DST. <br>

static registerNgxBootstrapDatePickerLocales(): Promise {
if (abp.localization.currentLanguage.name === 'en') {
return Promise.resolve(true);
}

Thanks for confirming that @ismcagdas Are there any examples of this setup?

thank you

I have a requirement whereby the aspnet zero site is running on a local server in single tenent mode and the same application is also available in multitenant online.

i would like to have the tenent site online sync changes from the local install and webhooks seem to be a viable option for doing so.

Has anyone used webhooks in this way?

I downloaded with the merged project, but in hindsight could do with them seperate? The downloader does not let me do this, can you facilitate?

Showing 11 to 17 of 17 entries