Migrating payment configuration forms

Vote:
 

Hello,

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?

#282840
Edited, Jul 01, 2022 12:37
Vote:
 

Hi Szymon

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.

#282860
Jul 01, 2022 13:54
Vote:
 

Hi,

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?  

#282864
Jul 01, 2022 14:24
Vote:
 

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.

#282866
Edited, Jul 01, 2022 14:35
Vote:
 

Hello,

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?

#283334
Jul 07, 2022 10:44
Vote:
 
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));
            paymentMethod.SaveChanges();
        }
#283494
Jul 11, 2022 4:45
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.