<commit_before>package br.com.aspotato.pagarme.services;

import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.request.HttpRequestWithBody;
import br.com.aspotato.pagarme.models.Card;
import br.com.aspotato.pagarme.models.Key;
import br.com.aspotato.pagarme.utils.PagarMeProvider;
import br.com.aspotato.pagarme.utils.PagarMeUtil;
import org.json.JSONObject;

public class CardService extends BasicService {


	private PagarMeProvider instance = PagarMeProvider.getInstance();

	public HttpResponse<JsonNode> save(Card card) throws Exception {
		HttpResponse<JsonNode> jsonResponse = null;
		if(validateFiels(card)){
			
			HttpRequestWithBody request =  Unirest.post(instance.getUrl() + "1/cards")
					.header("accept", "application/json")
					.queryString("api_key", instance.getApi_key());	

			jsonResponse = request.asJson();
		}

		return jsonResponse;
	}
        
        
        public Key generateCardHash() throws Exception {
            HttpResponse<JsonNode> jsonResponse = Unirest.get(instance.getUrl() + "1/transactions/card_hash_key")
                            .header("accept", "application/json")
                            .queryString("encryption_key", instance.getEncryptionKey())
                            .asJson();
            JSONObject resultObject = jsonResponse.getBody().getObject();
            
            this.checkErrors(resultObject);
            return (Key) PagarMeUtil.convertJsonToObject(Key.class, resultObject);
            
        }

}<commit_msg>Pequenos ajustes na URL de captura do Hash para criptografar o cartao<commit_after>package br.com.aspotato.pagarme.services;

import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.request.HttpRequestWithBody;
import br.com.aspotato.pagarme.models.Card;
import br.com.aspotato.pagarme.models.Key;
import br.com.aspotato.pagarme.utils.PagarMeProvider;
import br.com.aspotato.pagarme.utils.PagarMeUtil;
import org.json.JSONObject;

public class CardService extends BasicService {


	private PagarMeProvider instance = PagarMeProvider.getInstance();

	public HttpResponse<JsonNode> save(Card card) throws Exception {
		HttpResponse<JsonNode> jsonResponse = null;
		if(validateFiels(card)){
			
			HttpRequestWithBody request =  Unirest.post(instance.getUrl() + "1/cards")
					.header("accept", "application/json")
					.queryString("api_key", instance.getApi_key());	

			jsonResponse = request.asJson();
		}

		return jsonResponse;
	}
        
        
        public Key generateCardHash() throws Exception {
            HttpResponse<JsonNode> jsonResponse = Unirest.get(instance.getBaseUrl() + "transactions/card_hash_key")
                            .header("accept", "application/json")
                            .queryString("encryption_key", instance.getEncryptionKey())
                            .asJson();
            JSONObject resultObject = jsonResponse.getBody().getObject();
            
            this.checkErrors(resultObject);
            return (Key) PagarMeUtil.convertJsonToObject(Key.class, resultObject);
            
        }

}
{'fraction_non_alphanumeric': 0.10650705954573358, 'fraction_numerical': 0.0009208103130755065, 'mean_word_length': 3.172855313700384, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1919823', 'n_tokens_mistral': 1025, 'n_tokens_neox': 968, 'n_words': 157}