public void SendTest_Auth_Approved() { //check login / password string sError = CheckLoginPassword(); Assert.IsTrue(sError == "", sError); string responseString = "1.0|1|1|This transaction has been approved.|N8IV1Z|Y||2207395117|4BA6F435F8046E347710457856F3BAD1||||||||||||XXXX1111|Visa"; LocalRequestObject.ResponseString = responseString; IGatewayResponse expected = new CardPresentResponse(responseString.Split('|')); CardPresentGateway target = new CardPresentGateway(ApiLogin, TransactionKey, true); IGatewayRequest request = new CardPresentAuthorizationRequest((decimal)30.11, "4111111111111111", "02", "16"); string description = "CP Auth transaction approved testing"; IGatewayResponse actual = target.Send(request, description); Assert.AreEqual(expected.Amount, actual.Amount); Assert.AreEqual(expected.Approved, actual.Approved); Assert.AreEqual(expected.CardNumber, actual.CardNumber); Assert.AreEqual(expected.Message, actual.Message); Assert.AreEqual(expected.ResponseCode, actual.ResponseCode); Assert.IsTrue(actual.AuthorizationCode.Trim().Length > 0); Assert.IsTrue(actual.TransactionID.Trim().Length > 0); Assert.IsTrue(long.Parse(actual.TransactionID) > 0); }
public CardPresentResponse cardPresent(decimal amount, string track1, string track2) { //Step 1 Create the request var request = new CardPresentAuthorizationRequest(amount, track1, track2); //step 2 - create the gateway, sending in your credentials var gate = new CardPresentGateway(apiKey, transactionKey, developerTesting); //step 3 - make some money var response = (CardPresentResponse)gate.Send(request); return(response); }
public CardPresentResponse cardPresent(decimal amount, string track1, string track2) { //Step 1 Create the request var request = new CardPresentAuthorizationRequest(amount, track1, track2); //step 2 - create the gateway, sending in your credentials var gate = new CardPresentGateway(apiKey, transactionKey, developerTesting); //step 3 - make some money var response = (CardPresentResponse)gate.Send(request); return response; }
private string SendAuthOnly(decimal amount, bool returnTransID) { string responseString = "1.0|1|1|This transaction has been approved.|N8IV1Z|Y||2207395117|4BA6F435F8046E347710457856F3BAD1||||||||||||XXXX1111|Visa"; LocalRequestObject.ResponseString = responseString; CardPresentGateway target = new CardPresentGateway(ApiLogin, TransactionKey, true); IGatewayRequest request = new CardPresentAuthorizationRequest(amount, "4111111111111111", "02", "16"); string description = "CP Auth transaction approved testing"; IGatewayResponse response = target.Send(request, description); if (response.Approved) { if (returnTransID) { return response.TransactionID; } else { return response.AuthorizationCode; } } else { return ""; } }