Beispiel #1
0
        public string Generate()
        {
            var request = new PagarMeRequest(_service, "GET", "/transactions/card_hash_key");

            request.UseEncryptionKey = true;

            var response = request.Execute();
            var key      = JsonHelper.Deserialize <CardHashKey>(_service, response.Body);

            return(Encrypt(key));
        }
Beispiel #2
0
        public string Generate()
        {
            var request = new PagarMeRequest(_service, "GET", "/transactions/card_hash_key");

            request.UseEncryptionKey = true;

            var response = request.Execute();
            var key = JsonHelper.Deserialize<CardHashKey>(_service, response.Body);

            return Encrypt(key);
        }
Beispiel #3
0
        private string Encrypt(CardHashKey key)
        {
            var args = new List <Tuple <string, string> >();

            args.Add(new Tuple <string, string>("card_number", CardNumber));
            args.Add(new Tuple <string, string>("card_expiration_date", CardExpirationDate));
            args.Add(new Tuple <string, string>("card_holder_name", CardHolderName));
            args.Add(new Tuple <string, string>("card_cvv", CardCvv));

            var encrypted = EncryptRsa(key.PublicKey, Encoding.UTF8.GetBytes(PagarMeRequest.BuildQueryString(args)));

            return(key.Id + "_" + Convert.ToBase64String(encrypted));
        }
Beispiel #4
0
        public async Task <string> GenerateAsync()
        {
            var request = new PagarMeRequest(_service, "GET", "/transactions/card_hash_key")
            {
                UseEncryptionKey = true
            };

            var response = await request.ExecuteAsync();

            var key = JsonHelper.Deserialize <CardHashKey>(_service, response.Body);

            return(Encrypt(key));
        }