Пример #1
0
        private string SendAuthOnly(decimal amount)
        {
            string responseString = "1|1|1|This transaction has been approved.||P|2207740049||Auth transaction approved testing|15.13|ECHECK|auth_only||||||||||||||||||||||||||C1C4BF36B72CD3D6671063648096D7B7|||||||||||||XXXX3456|Bank Account||||||||||||||||";
            LocalRequestObject.ResponseString = responseString;

            Gateway target = new Gateway(ApiLogin, TransactionKey, true);

            IGatewayRequest request = new EcheckAuthorizationRequest(EcheckType.WEB, amount, "125000024", "123456", BankAccountType.Checking, "Bank of Seattle", "Sue Zhu", "1234");
            string description = "Auth transaction approved testing";

            IGatewayResponse response = target.Send(request, description);

            if (response.Approved)
            {
                return response.TransactionID;
            }
            else
            {
                return "";
            }
        }
Пример #2
0
        public void SendTest_Auth_Approved()
        {
            //check ApiLoginid / TransactionKey
            string sError = CheckApiLoginTransactionKey();
            Assert.IsTrue(sError == "", sError);

            string responseString = "1|1|1|This transaction has been approved.||P|2207740049||Auth transaction approved testing|15.11|ECHECK|auth_only||||||||||||||||||||||||||C1C4BF36B72CD3D6671063648096D7B7|||||||||||||XXXX3456|Bank Account||||||||||||||||";
            LocalRequestObject.ResponseString = responseString;
            IGatewayResponse expected = new GatewayResponse(responseString.Split('|'));

            Gateway target = new Gateway(ApiLogin, TransactionKey, true);

            IGatewayRequest request = new EcheckAuthorizationRequest(EcheckType.WEB, (decimal)15.11, "125000024", "123456", BankAccountType.Checking, "Bank of Seattle", "Sue Zhu", "1234");
            string description = "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.TransactionID.Trim().Length > 0);
            Assert.IsTrue(long.Parse(actual.TransactionID) > 0);
        }