0
I am implementing the payment with Pagseguro, however I am having problem in the execution of the following line:
const bool isSandbox = true;
EnvironmentConfiguration.ChangeEnvironment(isSandbox);
While doing some research I found that I had not added the folder with .xml calling for Configuration/Pagseguroconfig.xml so I included them in the main project. But I’m still getting the message that I couldn’t find the xml.
I think it is necessary to do a validation of the read path located in Uol.Pagseguro/Resources/Pagseguroconfiguration.Cs, where right at the beginning I have:
private static string urlXmlConfiguration = ".../.../Configuration/PagSeguroConfig.xml";
In some were found that this was necessary to change so that it was directed to the root of the project leaving so:
private static string urlXmlConfiguration = HttpRuntime.AppDomainAppPath + "PagSeguroConfig.xml";
But I’m unable to use Httpruntime within the . aspnet Core Standard project. How can I be working around this problem?
Eluander in the Pagseguro documentation is specified where the path should be?
– Leonardo Bonetti
@Leonardobonetti, According to the documentation may be on my way, but I am not able to make this path be found in the core... https://pagseguro.uol.com.br/v2/guia-de-integracao/documentaca-da-biblioteca-pagseguro-network.html#Pagseguroconfiguration
– Eluander J. F. Lopes
Can you do that? private Static string urlXmlConfiguration = System.IO.Path.Combine(Appcontext.Basedirectory, "Pagseguroconfig.xml");
– Rafael
@Rafael I tried to use the one you gave me, but there is no reference to Appcontext
– Eluander J. F. Lopes
Look, I don’t think there’s any support for the. NET Core, however, a person performed a pull request with this support: https://github.com/pagseguro/pagseguro-sdk-dotnet/pull/18/files#, if this is the case you may "embed" the xml inside the Assembly and modify the code you load inside that class, maybe resolve partially, I’ll try to download the sdk and take a test here later.
– Rafael
@Rafael I was able to find out why there was no reference to Appcontext, it was because the library I imported was in 4.5 and the rest is in . core 2.1. I modified the class library for the core so Appcontext was found... after doing some tests. The Url that is now returning is "C: Users Eluander Documents Developer Pagsupera src Pag.Core.Api bin Debug netcoreapp2.1 Pagseguroconfig.xml" and so continues the xml error...
– Eluander J. F. Lopes
Browse that folder and find where it is and fix the Path.
– Rafael