globalpayments/dotnet-sdk

Is there a way to not use ServicesContainer.ConfigureService() statically ?

Closed this issue · 3 comments

Hi , today we are forced to use ServicesContainer.ConfigureService as static which a bit dangerous ( not a bit , it's too dangerous )

what would happen if two process started at the same time and the last one will win and the first will fail ? we are supporting multiple bank accounts and ServicesContainer.ConfigureService will never help here .

I know that I can use HostedPaymentConfig one some cases which we are but still that option is not supported via refund and recurring .

this is our current code which I'm pretty sure we should never use static call here .

var config = new GpEcomConfig
            {
                MerchantId = gatewaySettings.MerchantId,
                AccountId = gatewaySettings.AccountId,
                SharedSecret = gatewaySettings.SharedSecret,
                RebatePassword = gatewaySettings.RebatePassword ,
                RefundPassword = gatewaySettings.RefundPassword,
                ServiceUrl = gatewaySettings.LiveMode
                    ? RealexConstants.LiveUrl
                    : RealexConstants.TestUrl
            };
            ServicesContainer.ConfigureService(config); // the buggy part :) 

//then do refund or whatever . 

any help or though here please ?

I was just going through the code and I found that ConfigureService take another parameter called configName , not sure if that will help but looks good to start investigating from here .

It looks like the Execute methods have an optional parameter 'configName' that you can use to actually run the transaction. IE card.Authorize().Execute("myConfigName") (if you use the configName parameter with ConfigureService)

thanks @jadonclegg , yeh I saw that on their execution method.
sorry to say that but global payments documentation is shit like their service :)