Esempio n. 1
0
        public void AddCustomerCreditAsync()
        {
            var customerCredit = new customerCredit {
                id          = "11",
                reportGroup = "Default Report Group",

                fundingCustomerId = "value for fundingCustomerId",
                customerName      = "value for customerName",
                fundsTransferId   = "value for fundsTransferId",
                amount            = 1512l,
                customIdentifier  = "WorldPay",
                accountInfo       = new echeckType()
                {
                    accType    = echeckAccountTypeEnum.Checking,
                    accNum     = "1092969901",
                    routingNum = "011075150",
                    checkNum   = "123455",
                }
            };

            CancellationToken cancellationToken = new CancellationToken(false);
            var response = _cnp.CustomerCreditAsync(customerCredit, cancellationToken);

            Assert.AreEqual("000", response.Result.response);
        }
Esempio n. 2
0
        public void TestAddCustomerCredit()
        {
            var customerCredit = new customerCredit();

            customerCredit.fundingCustomerId = "123456";
            customerCredit.customerName      = "John Doe";
            customerCredit.fundsTransferId   = "123467";
            customerCredit.amount            = 107L;
            customerCredit.customIdentifier  = "12345678";

            var echeck = new echeckType();

            echeck.accType             = echeckAccountTypeEnum.Checking;
            echeck.accNum              = "12345657890";
            echeck.routingNum          = "123456789";
            echeck.checkNum            = "123455";
            customerCredit.accountInfo = echeck;

            batchRequest.addCustomerCredit(customerCredit);

            Assert.AreEqual(1, batchRequest.getNumCustomerCredit());
            Assert.AreEqual(107L, batchRequest.getCustomerCreditAmount());
            Assert.AreEqual("\r\n<customerCredit reportGroup=\"Default Report Group\">\r\n<fundingCustomerId>123456</fundingCustomerId>\r\n<customerName>John Doe</customerName>\r\n<fundsTransferId>123467</fundsTransferId>\r\n<amount>107</amount>\r\n<accountInfo>\r\n<accType>Checking</accType>\r\n<accNum>12345657890</accNum>\r\n<routingNum>123456789</routingNum>\r\n<checkNum>123455</checkNum></accountInfo>\r\n<customIdentifier>12345678</customIdentifier>\r\n</customerCredit>",
                            customerCredit.Serialize());

            mockCnpFile.Verify(cnpFile => cnpFile.createRandomFile(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), mockCnpTime.Object));
            mockCnpFile.Verify(cnpFile => cnpFile.AppendLineToFile(mockFilePath, customerCredit.Serialize()));
        }
Esempio n. 3
0
        public void AddCustomerCreditNullName()
        {
            var customerCredit = new customerCredit {
                id          = "11",
                reportGroup = "Default Report Group",

                fundingCustomerId = "value for fundingCustomerId",
                fundsTransferId   = "value for fundsTransferId",
                amount            = 1512l,
                customIdentifier  = "WorldPay",
                accountInfo       = new echeckType()
                {
                    accType    = echeckAccountTypeEnum.Checking,
                    accNum     = "1092969901",
                    routingNum = "011075150",
                    checkNum   = "123455",
                }
            };

            Assert.Throws <CnpOnlineException>(() => { _cnp.CustomerCredit(customerCredit); });
        }
Esempio n. 4
0
        public void AddCustomerCreditAsyncNullName()
        {
            var customerCredit = new customerCredit {
                id          = "11",
                reportGroup = "Default Report Group",

                fundingCustomerId = "value for fundingCustomerId",
                fundsTransferId   = "value for fundsTransferId",
                amount            = 1512l,
                customIdentifier  = "WorldPay",
                accountInfo       = new echeckType()
                {
                    accType    = echeckAccountTypeEnum.Checking,
                    accNum     = "1092969901",
                    routingNum = "011075150",
                    checkNum   = "123455",
                }
            };

            CancellationToken cancellationToken = new CancellationToken(false);

            Assert.Throws <AggregateException>(() => { var _ = _cnp.CustomerCreditAsync(customerCredit, cancellationToken).Result; });
        }
Esempio n. 5
0
 public Task <customerCreditResponse> CustomerCreditAsync(customerCredit customerCredit, CancellationToken cancellationToken)
 {
     return(SendRequestAsync(response => response.customerCreditResponse, customerCredit, cancellationToken));
 }
Esempio n. 6
0
 public customerCreditResponse CustomerCredit(customerCredit customerCredit)
 {
     return(SendRequest(response => response.customerCreditResponse, customerCredit));
 }