1
The code below is the PUSH created for Pagseguro to send me the notification of the status of my payment. But the error returned is 500, and in their forum no answers so far. Someone who has been through this problem can help me?
@PostMapping(value="/pagseguro-notificacao")
public @ResponseBody
String resgistrarNotificacao(
@RequestParam(value = "notificationCode") String nCode,
@RequestParam(value = "notificationType") String nType) {
try {
final PagSeguro pagSeguro = PagSeguro.instance(Credential.sellerCredential(sellerEmail,
sellerToken), PagSeguroEnv.PRODUCTION);
TransactionDetail transaction = pagSeguro.transactions().search().byNotificationCode(nCode);
if (transaction != null) {
atualizarStatusDoAnuncio(transaction);
}
} catch (Exception e) {
Logger.getLogger(e.getLocalizedMessage());
}
return null;
}
Save a poorly implemented API, error 500 is problem on their side. Googlando Pagseguro API and error 500, we get a rain of links from unstable sandbox environment, which should be your case. At first, nothing you can do, apparently.
– StatelessDev
Could you put the error log on your machine here? This error is on your machine side.
– Aristofanio Garcia
@Aristofanyogarcy debugging the server saw that the error happens at that time Transactiondetail transaction = pagseguro.transactions(). search(). byNotificationCode(nCode); I will continue debugging and inform the log, because until now I had not been able to debug in production.
– Gabriela Mendonça
If the problem is here
TransactionDetail transaction = pagSeguro.transactions().search().byNotificationCode(nCode);
. Probably your problem is that it’s not in the nCode’s location. Check if the notification for dev is enabled, if the token data is right, etc... it is usually a simple thing!!– Aristofanio Garcia
@Aristofanyogarcy worked, it was a notation that had to put in this line of credentials: final Pagseguro pagseguro = Pagseguro . instance(new CommonsLoggerFactory(), new JSEHttpClient(),
 Credential.sellerCredential(sellerEmail, sellerToken), PagSeguroEnv.PRODUCTION); estava sem esse new CommonsLoggerFactory e new JSEHttpClient Obrigada pelas dicas de qualquer forma.
– Gabriela Mendonça