Good question. I've just looked and we do have a DefaultSettings property on payment providers, but it looks like I may not actually be using it anywhere 🤦♂️
I guess it must have got missed when we set this up but nobody has used it till now, which is pretty impressive.
I'll add it to our issue tracker, but I think I'm going to have to say it's currently unsupported.
Thanks for bringing this up, but appologies this isn't the ideal answer
OK, well at least asking the question saved me time trying to figure out why it didn't work ;-)
Could I add code to my payment provider "settings" class (in the "Get")? The defaults will be in our app settings JSON file, so would want to retrieve them from there.
Ok, so if you don't mind running on an unreleased build, I think I've just implemented this.
I've made it so that you can define default values on your settings POCO and Vendr will automatically apply these when a payment providers is being created (if you deleted the value then save it, it won't try to set the default value again).
public class InvoicingSettings
{
[PaymentProviderSetting(Name = "Continue URL", Description = "The URL to continue to after this provider has done processing. eg: /continue/")]
public string ContinueUrl { get; set; } = "/continue";
}
or if you want to do it within your constructor
public class InvoicingSettings
{
[PaymentProviderSetting(Name = "Continue URL", Description = "The URL to continue to after this provider has done processing. eg: /continue/")]
public string ContinueUrl { get; set; }
public InvoicingSettings()
{
ContinueUrl = "/continue";
}
}
There is no launch date for this version yet as this also the version that supports v10 so we need to wait till that is launched, but that shouldn't stop it being used on v9 for now.
Default values for a PaymentProvider
Just looking at creating a custom PaymentProvider and want to provide default values for some of the settings.
In the TeaCommerce system, I did it using
Is this still the correct / best way to do it?
Hey Gordon,
Good question. I've just looked and we do have a
DefaultSettings
property on payment providers, but it looks like I may not actually be using it anywhere 🤦♂️I guess it must have got missed when we set this up but nobody has used it till now, which is pretty impressive.
I'll add it to our issue tracker, but I think I'm going to have to say it's currently unsupported.
Thanks for bringing this up, but appologies this isn't the ideal answer
OK, well at least asking the question saved me time trying to figure out why it didn't work ;-)
Could I add code to my payment provider "settings" class (in the "Get")? The defaults will be in our app settings JSON file, so would want to retrieve them from there.
Ok, so if you don't mind running on an unreleased build, I think I've just implemented this.
I've made it so that you can define default values on your settings POCO and Vendr will automatically apply these when a payment providers is being created (if you deleted the value then save it, it won't try to set the default value again).
or if you want to do it within your constructor
If you want to try this, there will be a 2.3.0-beta00041 available on our unstable NuGet feed at https://nuget.outfield.digital/unstable/vendr/v3/index.json shortly.
There is no launch date for this version yet as this also the version that supports v10 so we need to wait till that is launched, but that shouldn't stop it being used on v9 for now.
OK, thanks Matt.
I'll take a look at that later. We are still at an early stage in development, so I suspect v10 will be out before we are finished!
is working on a reply...