Exemple #1
0
        public void BuildCreditCardDebitTests()
        {
            // Lifted from https://www.bluepay.com/developers/api-documentation/csharp/transactions/cancel-transaction/
            const string accountId = "Merchant's Account ID Here";
            const string secretKey = "Merchant's Secret Key Here";
            const string mode      = "TEST";

            var payment = new BluePay
                          (
                accountId,
                secretKey,
                mode
                          );

            payment.SetCustomerInformation
            (
                firstName: _firstName,
                lastName: _lastName,
                address1: _address1,
                address2: _address2,
                city: _city,
                state: _state,
                zip: _zip,
                country: _country,
                phone: _phone,
                email: _email
            );

            payment.SetCCInformation
            (
                ccNumber: _ccNumber,
                ccExpiration: _ccExpiration,
                cvv2: _cvv2
            );

            // Sale Amount: $3.00
            payment.Sale(amount: "3.00");

            var legacyPostData = payment.Process();


            var bpFactory             = new BluePayTransactionFactory(accountId, secretKey, mode);
            var threadSafeReplacement = bpFactory.BuildCreditCardDebit(
                _firstName,
                _lastName,
                _address1,
                _address2,
                _city,
                _state,
                _zip,
                _country,
                _phone,
                _email,
                _ccNumber,
                _ccExpiration,
                _cvv2,
                _amount);

            Assert.AreEqual(legacyPostData, threadSafeReplacement.PostData);
        }
Exemple #2
0
        public void BuildAchDebitTests()
        {
            // Lifted from https://www.bluepay.com/developers/api-documentation/csharp/transactions/charge-customer/
            const string accountId = "Merchant's Account ID Here";
            const string secretKey = "Merchant's Secret Key Here";
            const string mode      = "TEST";

            var payment = new BluePay
                          (
                accountId,
                secretKey,
                mode
                          );

            payment.SetCustomerInformation
            (
                firstName: _firstName,
                lastName: _lastName,
                address1: _address1,
                address2: _address2,
                city: _city,
                state: _state,
                zip: _zip,
                country: _country,
                phone: _phone,
                email: _email
            );

            const string routingNumber = "123123123";
            const string accountNumber = "123456789";
            const string accountType   = "C";
            const string docType       = "WEB";

            payment.SetACHInformation
            (
                routingNum: routingNumber,
                accountNum: accountNumber,
                accountType: accountType,
                docType: docType
            );
            payment.Sale(amount: "3.00");
            var legacyPostData = payment.Process();

            var bpFactory             = new BluePayTransactionFactory(accountId, secretKey, mode);
            var threadSafeReplacement = bpFactory.BuildAchDebit(
                _firstName,
                _lastName,
                _address1,
                _address2,
                _city,
                _state,
                _zip,
                _country,
                _phone,
                _email,
                _amount,
                routingNumber,
                accountNumber);

            Assert.AreEqual(legacyPostData, threadSafeReplacement.PostData);
        }