public ActionResult <RzJsonResultModel> CadastraPagamentoBoleto(TransacaoBoleto pagamentoBoleto) { if (Convert.ToInt32(pagamentoBoleto.versaoAPI) >= Constants.VersaoMinimaSuportada) { TransacaoBoletoBLL transacaoBoletoBLL = new TransacaoBoletoBLL(); return(Ok(transacaoBoletoBLL.CadastraPagamentoBoleto(pagamentoBoleto))); } else { return(Ok(RzJsonResultModel.ReturnError("Versão informada menor que a esperada!"))); } }
public RzJsonResultModel CadastraPagamentoBoleto(TransacaoBoleto pagamentoBoleto) { try { pagamentoBoleto.api_key = LocalConfig.Values["PagarMeAPIDefaultApiKey"]; pagamentoBoleto.defaultEncryptionKey = LocalConfig.Values["PagarMeAPIDefaultEncryptionKey"]; string content = JsonSerializer.Serialize(pagamentoBoleto); string responseText = CurlRequest.SendRequest("https://api.pagar.me/1/transactions", content, "POST"); return(RzJsonResultModel.ReturnSuccess("OK", responseText)); //return RzJsonResultModel.ReturnSuccess("OK", ""); } catch (Exception ex) { return(RzJsonResultModel.ReturnError(ex.Message)); } }