Ejemplo n.º 1
0
 public string GetCreate(string vaultid = "")
 {
     SEVD.Configuration config = new SEVD.Configuration(Credentials.MID, Credentials.MKEY, Credentials.APPID);
     Client sevdClient = new Client(config);
     string req = sevdClient.Vault.GetRequestToken(Vault.RequestType.CREATE, vaultid);
     return req;
 }
Ejemplo n.º 2
0
 public string GetUpdate(string guid)
 {
     SEVD.Configuration config = new SEVD.Configuration(Credentials.MID, Credentials.MKEY, Credentials.APPID);
     Client sevdClient = new Client(config);
     string req = sevdClient.Vault.GetRequestToken(Vault.RequestType.UPDATE, String.Empty, guid);
     return req;
 }
 public HttpResponseMessage ParseTransactionResponse(string response)
 {
     // get response packet
     string respString = GetValueFromResponseString(Request.Content, "response");
     // decrypt
     SEVD.Configuration config = new SEVD.Configuration(Credentials.MID, Credentials.MKEY, Credentials.APPID);
     TransactionResult result = Envelope.GetTransactionResult(config, respString);
     // record
     DataAccess.WriteToDataBase(result);
     // redirect
     return Redirect();
 }
        public HttpResponseMessage VaultTransaction(string guid)
        {
            HttpContent hc = Request.Content;
            Task<NameValueCollection> ReadTask = hc.ReadAsFormDataAsync();
            NameValueCollection formData = ReadTask.Result;
            string amount = formData.Get("amount");

            SEVD.Configuration config = new SEVD.Configuration(Credentials.MID, Credentials.MKEY, Credentials.APPID);
            Client sevdClient = new Client(config);

            Models.TransactionBase tb = new Models.TransactionBase(Models.TransactionBase.RequestType.Sale, false, amount);
            Models.Customer cust = new Models.Customer();

            string response = sevdClient.Transaction.DoVaultTransaction(tb, guid, cust);
            Models.TransactionResult tr = new Models.TransactionResult(response);
            SEVD.API.Configuration.DataAccess.WriteToDataBase(tr);

            HttpResponseMessage resp = Request.CreateResponse(HttpStatusCode.Redirect);
            resp.Headers.Location = new Uri(Settings.ReturnPage);
            return resp;
        }