예제 #1
0
        public void TestEncryption()
        {
            Rave3DesEncryption a    = new Rave3DesEncryption();
            string             key  = a.GetEncryptionKey("FLWSECK-4127f15e63c9098402dcc7891798fb0f-X");
            string             data = "{" +
                                      "\"PBFPubKey\":\"FLWPUBK-1cf610974690c2560cb4c36f4921244a-X\"," +
                                      "\"amount\":1000," +
                                      "\"device_fingerprint\":\"e42afa649d16fb67416186c6a3c942e9\"," +
                                      "\"txRef\":\"PAT-0.06208890843489279\"," +
                                      "\"IP\":\"197.210.173.93\"," +
                                      "\"email\":\"[email protected]\"," +
                                      "\"pin\":\"3310\"," +
                                      "\"suggested_auth\":\"PIN\"," +
                                      "\"expirymonth\":\"09\"," +
                                      "\"expiryyear\":\"19\"," +
                                      "\"cvv\":\"789\"," +
                                      "\"cardno\":\"5438898014560229\"" +
                                      "}";

            string cipher = a.EncryptData(key, data);

            string plaintext = a.DecryptData(cipher, key);

            Console.WriteLine(key);
            Console.ReadLine();
        }
예제 #2
0
        /// <summary>
        /// Charge a card
        /// </summary>
        /// <param name="card">Card details of customer</param>
        /// <param name="alg">Algorithm to use for validation</param>
        /// <returns>Details of the outcome of the card charge</returns>
        public async Task <CardChargeResponse> ChargeCardAsync(Card card, Algorithm alg)
        {
            var body = new {
                PBFPubKey = PrivateKey,
                client    = encryption.EncryptData(PrivateKey, card.ToJson()),
                alg       = alg.ToString()
            };

            var response = await _client.SendRequest(Request.RequestMethod.Post, "flwv3-pug/getpaidx/api/charge", body.ToJson());

            return(CardChargeResponse.FromJson(response));
        }