Ejemplo n.º 1
0
        public void SendTest_Credit_Approved()
        {
            // Test setup.
            const string  transId            = "????";        // A settled eCheck transaction id
            const decimal creditAmount       = (decimal)1.50; // Amount to request credit for; less than the settled amount minus refund amount.
            const string  accountType        = "eCheck";      // The account type used in the transaction, such as eCheck
            const string  accountLast4Digits = "????";        // The last 4 digitals of the account number used in the transaction, such as 3456

            //check login / password
            var sError = CheckLoginPassword();

            Assert.IsTrue(sError == "", sError);

            var responseString = "1|1|1|This transaction has been approved.||P|2207741772||Credit transaction approved testing|" + creditAmount + "|CC|credit||||||||||||[email protected]||||||||||||||574B2D5282D8A2914AEB7272AECD4B71|||||||||||||XXXX" + accountLast4Digits + "|" + accountType + "||||||||||||||||";

            LocalRequestObject.ResponseString = responseString;
            IGatewayResponse expected = new GatewayResponse(responseString.Split('|'));

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

            IGatewayRequest request     = new EcheckCreditRequest(transId, creditAmount, accountLast4Digits);
            const string    description = "Credit transaction approved testing";

            var 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.Greater(long.Parse(actual.TransactionID), 0);
        }
Ejemplo n.º 2
0
        // Echeck Credit
        public async Task <EcheckCreditResponse> eCheckCredit(EcheckCreditRequest req)
        {
            string jsonRequest  = CommonService.JsonSerializer <EcheckCreditRequest>(req);
            string jsonResponse = await PostRequest(jsonRequest, "authorize");

            return(CommonService.JsonDeSerializer <EcheckCreditResponse>(jsonResponse));
        }
Ejemplo n.º 3
0
        public void SendTest_Credit_Approved()
        {
            //check login / password
            string sError = CheckLoginPassword();

            Assert.IsTrue(sError == "", sError);

            string transID = "2207700297";

            string responseString = "1|1|1|This transaction has been approved.||P|2207741772||Credit transaction approved testing|5.14|CC|credit||||||||||||[email protected]||||||||||||||574B2D5282D8A2914AEB7272AECD4B71|||||||||||||XXXX1111|Visa||||||||||||||||";

            LocalRequestObject.ResponseString = responseString;
            IGatewayResponse expected = new GatewayResponse(responseString.Split('|'));

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

            IGatewayRequest request     = new EcheckCreditRequest(transID, (decimal)5.14, "3456");
            string          description = "Credit 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);
        }
Ejemplo n.º 4
0
        public TransactionResponse RefundCheck(string reference, decimal amt, string lastDigits = "")
        {
            if (string.IsNullOrWhiteSpace(lastDigits))
            {
                throw new ArgumentException("Last four of bank account number are required for refunds against Authorize.net", "lastDigits");
            }

            var req      = new EcheckCreditRequest(reference, amt, lastDigits);
            var response = Gateway.Send(req);

            return(new TransactionResponse
            {
                Approved = response.Approved,
                AuthCode = response.AuthorizationCode,
                Message = response.Message,
                TransactionId = response.TransactionID
            });
        }