I'm migrating project to Commerce 14 and I'm stuck on payment configuration forms (Web Form's ascx files, implementing IGatewayControl interface). In new Commerce not only Web Forms are abandoned (ASP.NET Core requirement) but also whole Commerce Manager. How should I migrate this custom payment configuration views?
You can either create your own form views in edit mode using a standard mvc and an implementation of the MenuProvider.
Or you can move all your payment configuration to code and have it pull from a config json file, keyvault or on webserver itself as an app setting.
I need to have configuration close to provider definition (similar to "parameters" tab in Commerce Manager). Both options presented by you makes configuration more hidden and complicated for user (especially when I need diferent configuration for every language and provider).Could you suggest different approach?
What about creating a new Payment type inside Global / Commerce / Administrator / Payments
Then select your custom gateway as the class name and a custom payment object as your payment class. Then you should be able to add custom parameters via the same interface.
I was able to define custom classes and select them in new payment, but still don't know how to pre-define via code parameters in "Parameters" tab. Could you provide some simple code for me to better understand this solution?
private static void AddPaymentMethod(Guid id, string name, string systemKeyword, string description, string implementationClass, string gatewayClass,
bool isDefault, int orderIndex, IEnumerable<IMarket> markets, CultureInfo language, PaymentMethodDto paymentMethodDto)
var row = paymentMethodDto.PaymentMethod.AddPaymentMethodRow(id, name, description, language.TwoLetterISOLanguageName,
systemKeyword, true, isDefault, gatewayClass,
implementationClass, false, orderIndex, DateTime.Now, DateTime.Now);
paymentMethodDto.PaymentMethodParameter.AddPaymentMethodParameterRow(row, "Parameter Name", "Parameter Value");
var paymentMethod = new PaymentMethod(row);
paymentMethod.MarketId.AddRange(markets.Where(x => x.IsEnabled && x.Languages.Contains(language)).Select(x => x.MarketId));