コード例 #1
0
        public void TestAuthReversalHandleSpecialCharacters()
        {
            var transaction = new authReversal()
            {
                id          = "1",
                litleTxnId  = 12345678000L,
                cnpTxnId    = 12345678000L,
                amount      = 106,
                payPalNotes = "<'&\">"
            };

            var test = new BaseCnpOnlineTest();

            test.SetExpectedPopulated("id", transaction.id, null, null);
            test.SetExpectedUnpopulated("customerId", null, null);
            test.SetExpectedPopulated("cnpTxnId", "12.0", null);
            test.SetExpectedPopulated("response", "000", null, "10.0");
            test.SetExpectedPopulated("response", "001", "10.0", "10.8");
            test.SetExpectedPopulated("response", "000", "11.0", null);
            test.SetExpectedPopulated("responseTime", null, null);
            test.SetExpectedPopulated("message", "Approved", null, "10.0");
            test.SetExpectedPopulated("message", "Transaction Received", "10.0", "10.8");
            test.SetExpectedPopulated("message", "Approved", "11.0", null);
            test.SetExpectedPopulated("litleTxnId", null, "12.0");
            test.RunCnpTestThreaded <authReversalResponse>(transaction);
        }
コード例 #2
0
        public void SimpleBalanceInquiry()
        {
            var transaction = new balanceInquiry
            {
                id          = "1",
                orderId     = "12344",
                orderSource = orderSourceType.ecommerce,
                card        = new giftCardCardType
                {
                    type              = methodOfPaymentTypeEnum.GC,
                    number            = "414100000000000000",
                    cardValidationNum = "123",
                    expDate           = "1215",
                }
            };

            var test = new BaseCnpOnlineTest();

            test.SetExceptionExpected(typeof(InvalidVersionException), null, "8.21");
            test.SetExpectedPopulated("id", transaction.id, null, null);
            test.SetExpectedPopulated("cnpTxnId", "12.0", null);
            test.SetExpectedPopulated("response", "000", "8.21", null);
            test.SetExpectedPopulated("responseTime", "8.21", null);
            test.SetExpectedPopulated("message", "Approved", "8.21", null);
            test.SetExpectedPopulated("balanceInquiryResponse", "8.21", null);
            test.SetExpectedPopulated("litleTxnId", "8.21", "12.0");
            test.RunCnpTestThreaded <balanceInquiryResponse>(transaction);
        }
コード例 #3
0
        public void TestVirtualGiftCardActivate()
        {
            var transaction = new activate()
            {
                id              = "1",
                orderId         = "12344",
                amount          = 1500,
                orderSource     = orderSourceType.ecommerce,
                virtualGiftCard = new virtualGiftCardType
                {
                    accountNumberLength = 123,
                    giftCardBin         = "123"
                }
            };

            var test = new BaseCnpOnlineTest();

            test.SetExceptionExpected(typeof(InvalidVersionException), null, "8.21");
            test.SetExceptionExpected(typeof(CnpOnlineException), "8.21", "8.22");
            test.SetExpectedPopulated("id", transaction.id, null, null);
            test.SetExpectedPopulated("cnpTxnId", "12.0", null);
            test.SetExpectedUnpopulated("customerId", null, null);
            test.SetExpectedPopulated("response", "000", "8.21", null);
            test.SetExpectedPopulated("responseTime", "8.21", null);
            test.SetExpectedUnpopulated("giftCardResponse", null, "11.0");
            test.SetExpectedPopulated("giftCardResponse", "11.0", null);
            test.SetExpectedPopulated("message", "Approved", "8.21", null);
            test.SetExpectedPopulated("litleTxnId", "8.21", "12.0");
            test.RunCnpTestThreaded <activateResponse>(transaction);
        }
コード例 #4
0
        public void TestVendorDebit()
        {
            var transaction = new vendorDebit
            {
                id          = "1",
                accountInfo = new echeckType()
                {
                    accType    = echeckAccountTypeEnum.Savings,
                    accNum     = "1234",
                    routingNum = "12345678"
                },
                amount = 1500,
                fundingSubmerchantId = "value for fundingSubmerchantId",
                fundsTransferId      = "value for fundsTransferId",
                vendorName           = "WorldPay"
            };

            var test = new BaseCnpOnlineTest();

            test.SetExceptionExpected(typeof(InvalidVersionException), null, "9.2");
            test.SetExpectedPopulated("id", transaction.id, null, null);
            test.SetExpectedUnpopulated("customerId", null, null);
            test.SetExpectedPopulated("cnpTxnId", "12.0", null);
            test.SetExpectedPopulated("fundsTransferId", transaction.fundsTransferId, "9.2", null);
            test.SetExpectedPopulated("response", "000", "9.2", null);
            test.SetExpectedPopulated("responseTime", "9.2", null);
            test.SetExpectedPopulated("message", "Approved", "9.2", null);
            test.SetExpectedPopulated("litleTxnId", "9.2", "12.0");
            test.RunCnpTestThreaded <vendorDebitResponse>(transaction);
        }
コード例 #5
0
        public void TestSimpleAuthWithApplePayAndSecondaryAmountAndWalletMasterPass()
        {
            var transaction = new authorization
            {
                id              = "7",
                orderId         = "10",
                amount          = 110,
                secondaryAmount = 50,
                orderSource     = orderSourceType.applepay,
                applepay        = new applepayType
                {
                    data      = "user",
                    signature = "sign",
                    version   = "12345",
                    header    = new applepayHeaderType
                    {
                        applicationData    = "454657413164",
                        ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
                        publicKeyHash      = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
                        transactionId      = "1234"
                    }
                },
                wallet = new wallet
                {
                    walletSourceTypeId = "123",
                    walletSourceType   = walletSourceType.MasterPass
                }
            };

            var test = new BaseCnpOnlineTest();

            test.SetExceptionExpected(typeof(InvalidVersionException), null, "8.28");
            test.SetExceptionExpected(typeof(CnpOnlineException), "8.28", "8.29");
            test.SetExceptionExpected(typeof(InvalidVersionException), "9.0", "9.1");
            test.SetExceptionExpected(typeof(CnpOnlineException), "9.1", "9.2");
            test.SetExpectedPopulated("id", transaction.id, null, null);
            test.SetExpectedPopulated("cnpTxnId", "12.0", null);
            test.SetExpectedPopulated("orderId", transaction.orderId, null, null);
            test.SetExpectedPopulated("response", "110", null, null);
            test.SetExpectedPopulated("responseTime", null, null);
            test.SetExpectedPopulated("message", "Insufficient Funds", null, null);
            test.SetExpectedPopulated("authCode", null, null);
            test.SetExpectedPopulated("applepayResponse", null, null);
            test.SetExpectedUnpopulated("networkTransactionId", null, null);
            test.SetExpectedPopulated("litleTxnId", "8.21", "12.0");
            test.RunCnpTestThreaded <authorizationResponse>(transaction);
        }
コード例 #6
0
        public void TestSimpleAuthWithLodgingInfo()
        {
            var transaction = new authorization
            {
                id          = "14",
                orderId     = "12344",
                amount      = 106,
                orderSource = orderSourceType.androidpay,
                card        = new cardType
                {
                    type    = methodOfPaymentTypeEnum.MC,
                    number  = "414100000000000000",
                    expDate = "1210",
                    pin     = "1234",
                },
                customBilling = new customBilling {
                    phone = "1112223333"
                },
                lodgingInfo = new lodgingInfo
                {
                    hotelFolioNumber     = "12345",
                    checkInDate          = new DateTime(2017, 1, 18),
                    customerServicePhone = "854213",
                    lodgingCharge        = new List <lodgingCharge>(),
                },
            };

            var test = new BaseCnpOnlineTest();

            test.SetExceptionExpected(typeof(InvalidVersionException), null, "9.8");
            test.SetExceptionExpected(typeof(InvalidVersionException), "10.0", "10.2");
            test.SetExceptionExpected(typeof(CnpOnlineException), "10.2", "10.6"); // Sandbox fails with Android Pay for these versions.
            test.SetExpectedPopulated("id", transaction.id, null, null);
            test.SetExpectedPopulated("cnpTxnId", "12.0", null);
            test.SetExpectedPopulated("orderId", transaction.orderId, null, null);
            test.SetExpectedPopulated("response", "000", null, null);
            test.SetExpectedPopulated("responseTime", null, null);
            test.SetExpectedPopulated("message", "Approved", null, null);
            test.SetExpectedPopulated("authCode", null, null);
            test.SetExpectedPopulated("androidpayResponse", null, null);
            test.SetExpectedUnpopulated("networkTransactionId", null, null);
            test.SetExpectedPopulated("litleTxnId", "8.21", "12.0");
            test.RunCnpTestThreaded <authorizationResponse>(transaction);
        }
コード例 #7
0
        public void TestAuthWithAmpersand()
        {
            var transaction = new authorization
            {
                id            = "4",
                orderId       = "7",
                amount        = 10010,
                orderSource   = orderSourceType.ecommerce,
                billToAddress = new contact()
                {
                    name         = "John & Jane Smith",
                    addressLine1 = "1 Main St.",
                    city         = "Burlington",
                    state        = "MA",
                    zip          = "01803-3747",
                    country      = countryTypeEnum.US
                },
                card = new cardType
                {
                    type              = methodOfPaymentTypeEnum.VI,
                    number            = "4457010000000009",
                    expDate           = "0112",
                    cardValidationNum = "349"
                }
            };

            var test = new BaseCnpOnlineTest();

            test.SetExpectedPopulated("id", transaction.id, null, null);
            test.SetExpectedPopulated("cnpTxnId", "12.0", null);
            test.SetExpectedPopulated("orderId", transaction.orderId, null, null);
            test.SetExpectedPopulated("response", "000", null, null);
            test.SetExpectedPopulated("responseTime", null, null);
            test.SetExpectedPopulated("message", "Approved", null, null);
            test.SetExpectedPopulated("authCode", null, null);
            test.SetExpectedUnpopulated("networkTransactionId", null, "8.30");
            test.SetExpectedPopulated("networkTransactionId", "8.30", "9.0");
            test.SetExpectedUnpopulated("networkTransactionId", "9.0", "9.10");
            test.SetExpectedPopulated("networkTransactionId", "9.10", "10.0");
            test.SetExpectedUnpopulated("networkTransactionId", "10.0", "10.5");
            test.SetExpectedPopulated("networkTransactionId", "10.5", null);
            test.SetExpectedPopulated("litleTxnId", "8.21", "12.0");
            test.RunCnpTestThreaded <authorizationResponse>(transaction);
        }
コード例 #8
0
        public void TestEnhancedAuthResponse()
        {
            var transaction = new authorization
            {
                id          = "12",
                reportGroup = "<'&\">",
                orderId     = "12344",
                amount      = 106,
                orderSource = orderSourceType.ecommerce,
                card        = new cardType
                {
                    type    = methodOfPaymentTypeEnum.VI,
                    number  = "4100322311199000",
                    expDate = "1210",
                },
                originalNetworkTransactionId = "123456789123456789123456789",
                originalTransactionAmount    = 12,
                processingType = processingTypeEnum.initialRecurring,
            };

            var test = new BaseCnpOnlineTest();

            test.SetExceptionExpected(typeof(InvalidVersionException), null, "8.30");
            test.SetExceptionExpected(typeof(InvalidVersionException), "9.0", "9.10");
            test.SetExceptionExpected(typeof(InvalidVersionException), "10.0", "10.5");
            test.SetExpectedPopulated("id", transaction.id, null, null);
            test.SetExpectedPopulated("reportGroup", "<'&\">", null, null);
            test.SetExpectedPopulated("cnpTxnId", "12.0", null);
            test.SetExpectedPopulated("orderId", transaction.orderId, null, null);
            test.SetExpectedPopulated("response", "000", null, null);
            test.SetExpectedPopulated("responseTime", null, null);
            test.SetExpectedPopulated("message", "Approved", null, null);
            test.SetExpectedPopulated("authCode", null, null);
            test.SetExpectedUnpopulated("networkTransactionId", null, "8.30");
            test.SetExpectedPopulated("networkTransactionId", "8.30", "9.0");
            test.SetExpectedUnpopulated("networkTransactionId", "9.0", "9.10");
            test.SetExpectedPopulated("networkTransactionId", "9.10", "10.0");
            test.SetExpectedUnpopulated("networkTransactionId", "10.0", "10.5");
            test.SetExpectedPopulated("networkTransactionId", "10.5", null);
            test.SetExpectedPopulated("enhancedAuthResponse", null, null);
            test.SetExpectedPopulated("litleTxnId", "8.21", "12.0");
            test.RunCnpTestThreaded <authorizationResponse>(transaction);
        }
コード例 #9
0
        public void TestTrackData()
        {
            var transaction = new authorization
            {
                id            = "10",
                orderId       = "13",
                amount        = 12522,
                orderSource   = orderSourceType.retail,
                billToAddress = new billToAddress {
                    zip = "95032"
                },
                card = new cardType {
                    track = "%B40000001^Doe/JohnP^06041...?;40001=0604101064200?"
                },
                pos = new pos
                {
                    capability   = posCapabilityTypeEnum.magstripe,
                    entryMode    = posEntryModeTypeEnum.completeread,
                    cardholderId = posCardholderIdTypeEnum.signature
                }
            };

            var test = new BaseCnpOnlineTest();

            test.SetExpectedPopulated("id", transaction.id, null, null);
            test.SetExpectedPopulated("cnpTxnId", "12.0", null);
            test.SetExpectedPopulated("orderId", transaction.orderId, null, null);
            test.SetExpectedPopulated("response", "000", null, null);
            test.SetExpectedPopulated("responseTime", null, null);
            test.SetExpectedPopulated("message", "Approved", null, null);
            test.SetExpectedPopulated("authCode", null, null);
            test.SetExpectedUnpopulated("networkTransactionId", null, "8.30");
            test.SetExpectedPopulated("networkTransactionId", "8.30", "9.0");
            test.SetExpectedUnpopulated("networkTransactionId", "9.0", "9.10");
            test.SetExpectedPopulated("networkTransactionId", "9.10", "10.0");
            test.SetExpectedUnpopulated("networkTransactionId", "10.0", "10.5");
            test.SetExpectedPopulated("networkTransactionId", "10.5", null);
            test.SetExpectedPopulated("litleTxnId", "8.21", "12.0");
            test.RunCnpTestThreaded <authorizationResponse>(transaction);
        }
コード例 #10
0
        public void TestSimpleAuthWithCardWithOrigTxnIdAndAmount()
        {
            var transaction = new authorization
            {
                id          = "2",
                orderId     = "5",
                amount      = 106,
                orderSource = orderSourceType.ecommerce,
                originalNetworkTransactionId = "123456789012345678901234567890",
                originalTransactionAmount    = 2500,
                card = new cardType
                {
                    type    = methodOfPaymentTypeEnum.VI,
                    number  = "410000000000000000",
                    expDate = "1210"
                },
                customBilling = new customBilling {
                    phone = "1112223333"
                }
            };

            var test = new BaseCnpOnlineTest();

            test.SetExpectedPopulated("id", transaction.id, null, null);
            test.SetExpectedPopulated("cnpTxnId", "12.0", null);
            test.SetExpectedPopulated("orderId", transaction.orderId, null, null);
            test.SetExpectedPopulated("response", "000", null, null);
            test.SetExpectedPopulated("responseTime", null, null);
            test.SetExpectedPopulated("message", "Approved", null, null);
            test.SetExpectedPopulated("authCode", null, null);
            test.SetExpectedUnpopulated("networkTransactionId", null, "8.30");
            test.SetExpectedPopulated("networkTransactionId", "8.30", "9.0");
            test.SetExpectedUnpopulated("networkTransactionId", "9.0", "9.10");
            test.SetExpectedPopulated("networkTransactionId", "9.10", "10.0");
            test.SetExpectedUnpopulated("networkTransactionId", "10.0", "10.5");
            test.SetExpectedPopulated("networkTransactionId", "10.5", null);
            test.SetExpectedPopulated("litleTxnId", "8.21", "12.0");
            test.RunCnpTestThreaded <authorizationResponse>(transaction);
        }
コード例 #11
0
        public void TestSimpleAuthWithAndroidPay()
        {
            var transaction = new authorization
            {
                id          = "6",
                orderId     = "9",
                amount      = 106,
                orderSource = orderSourceType.androidpay,
                card        = new cardType
                {
                    type    = methodOfPaymentTypeEnum.VI,
                    number  = "414100000000000000",
                    expDate = "1210"
                },
                customBilling = new customBilling {
                    phone = "1112223333"
                }
            };

            var test = new BaseCnpOnlineTest();

            test.SetExceptionExpected(typeof(InvalidVersionException), null, "9.8");
            test.SetExceptionExpected(typeof(InvalidVersionException), "10.0", "10.2");
            test.SetExceptionExpected(typeof(CnpOnlineException), "10.2", "10.6"); // Sandbox fails with Android Pay for these versions.
            test.SetExpectedPopulated("id", transaction.id, null, null);
            test.SetExpectedPopulated("cnpTxnId", "12.0", null);
            test.SetExpectedPopulated("orderId", transaction.orderId, null, null);
            test.SetExpectedPopulated("response", "000", null, null);
            test.SetExpectedPopulated("responseTime", null, null);
            test.SetExpectedPopulated("message", "Approved", null, null);
            test.SetExpectedPopulated("authCode", null, null);
            test.SetExpectedPopulated("androidpayResponse", null, null);
            test.SetExpectedUnpopulated("networkTransactionId", null, null);
            test.SetExpectedPopulated("litleTxnId", "8.21", "12.0");
            test.RunCnpTestThreaded <authorizationResponse>(transaction);
        }