private void btnCreditTransaction_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; string url = "https://triposcert.vantiv.com/api/v1/sale"; string data = @"{""laneId"": {{LANEID}},""transactionAmount"": ""{{AMOUNT}}"",""invokeManualEntry"": ""{{INVOKEMANUALENTRY}}"",""displayTransactionAmount"": ""{{DISPLAYTRANSACTIONAMOUNT}}"", ""configuration"" : {""allowDebit"":""true"",""isGiftSupported"":""false""}}"; data = data.Replace("{{LANEID}}", "1"); data = data.Replace("{{AMOUNT}}", "1.35"); data = data.Replace("{{INVOKEMANUALENTRY}}", "false"); data = data.Replace("{{DISPLAYTRANSACTIONAMOUNT}}", "true"); txtRequest.Text = data; var webRequest = new HttpSender(); var response = webRequest.Send(data, url, "json", "POST", GetHeaders()); txtResponse.Text = response; } catch (Exception ex) { txtResponse.Text = ex.ToString(); } finally { this.Cursor = Cursors.Arrow; } }
private void btnPairLane_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; string url = "https://triposcert.vantiv.com/cloudapi/v1/lanes/"; var activationCodeDialog = new ActivationCodeInput(); var activationCode = string.Empty; if (activationCodeDialog.ShowDialog(this) == DialogResult.OK) { activationCode = activationCodeDialog.ActivationCode; } activationCodeDialog.Dispose(); string data = @"{""laneId"": 1,""description"": ""triPOSCloud.CSharp test lane"",""terminalId"": ""123"",""activationCode"": ""{{ACTIVATION_CODE}}""}"; data = data.Replace("{{ACTIVATION_CODE}}", activationCode); txtRequest.Text = data; var webRequest = new HttpSender(); var response = webRequest.Send(data, url, "json", "POST", GetHeaders()); txtResponse.Text = response; } catch (Exception ex) { txtResponse.Text = ex.ToString(); } finally { this.Cursor = Cursors.Arrow; } }
private void btnGiftReload_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; string url = "https://triposcert.vantiv.com/api/v1/gift/reload"; var configData = new ConfigurationData(); string data = @"{""laneId"": {{LANEID}},""transactionAmount"": ""{{AMOUNT}}"", ""storeCard"" : {""Id"":""{{STORECARDID}}"",""Password"":""{{STORECARDPASSWORD}}""}}"; data = data.Replace("{{LANEID}}", "1"); data = data.Replace("{{AMOUNT}}", "500.00"); data = data.Replace("{{STORECARDID}}", configData.StoreCardID); data = data.Replace("{{STORECARDPASSWORD}}", configData.StoreCardPassword); txtRequest.Text = data; var webRequest = new HttpSender(); var response = webRequest.Send(data, url, "json", "POST", GetHeaders()); txtResponse.Text = response; } catch (Exception ex) { txtResponse.Text = ex.ToString(); } finally { this.Cursor = Cursors.Arrow; } }
private void btnDeleteLane_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; string url = "https://triposcert.vantiv.com/cloudapi/v1/lanes/1"; var webRequest = new HttpSender(); var response = webRequest.Send(string.Empty, url, "json", "DELETE", GetHeaders()); txtResponse.Text = response; } catch (Exception ex) { txtResponse.Text = ex.ToString(); } finally { this.Cursor = Cursors.Arrow; } }
private void btnGiftTransaction_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; string url = "https://triposcert.vantiv.com/api/v1/card/financial/1?isEncryptedDataNeeded=true"; var headerDict = GetHeaders(); var webRequest = new HttpSender(); var response = webRequest.Send(string.Empty, url, "json", "GET", headerDict); txtResponse.Text = response; dynamic data = JsonConvert.DeserializeObject(response); string magnePrintData = data.encryptedCardData.magneprintData; // this is populated for verifone devices string keySerial = data.encryptedCardData.cardDataKeySerialNumber; string format = data.encryptedCardData.encryptedFormat; string encryptedTrack2 = data.encryptedCardData.encryptedTrack2Data; //this is populated for ingenico devices var giftSale = GetGiftSaleXML(1.23, encryptedTrack2, keySerial, format, magnePrintData); txtRequest.Text += "\n\n"; txtRequest.Text += giftSale; var webRequest2 = new HttpSender(); var configData = new ConfigurationData(); url = configData.ExpressXMLEndpoint; var response2 = webRequest2.Send(giftSale, url, "xml", "POST", null); var giftCardSaleResponse = new GiftSaleResponse(response2); txtResponse.Text += response2; } catch (Exception ex) { txtResponse.Text = ex.ToString(); } finally { this.Cursor = Cursors.Arrow; } }