public void AddCustomerDebitAsync() { var customerDebit = new customerDebit { 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.CustomerDebitAsync(customerDebit, cancellationToken); Assert.AreEqual("000", response.Result.response); }
public void TestAddCustomerDebit() { var customerDebit = new customerDebit(); customerDebit.fundingCustomerId = "123456"; customerDebit.customerName = "John Doe"; customerDebit.fundsTransferId = "123467"; customerDebit.amount = 107L; customerDebit.customIdentifier = "12345678"; var echeck = new echeckType(); echeck.accType = echeckAccountTypeEnum.Checking; echeck.accNum = "12345657890"; echeck.routingNum = "123456789"; echeck.checkNum = "123455"; customerDebit.accountInfo = echeck; batchRequest.addCustomerDebit(customerDebit); Assert.AreEqual(1, batchRequest.getNumCustomerDebit()); Assert.AreEqual(107L, batchRequest.getCustomerDebitAmount()); Assert.AreEqual("\r\n<customerDebit 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</customerDebit>", customerDebit.Serialize()); mockCnpFile.Verify(cnpFile => cnpFile.createRandomFile(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), mockCnpTime.Object)); mockCnpFile.Verify(cnpFile => cnpFile.AppendLineToFile(mockFilePath, customerDebit.Serialize())); }
public void AddCustomerDebitNullName() { var customerDebit = new customerDebit { 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.CustomerDebit(customerDebit); }); }
public void AddCustomerDebitAsyncNullName() { var customerDebit = new customerDebit { 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.CustomerDebitAsync(customerDebit, cancellationToken).Result; }); }
public void AddCustomerDebitNegativeAmount() { var customerDebit = new customerDebit { 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", } }; var response = _cnp.CustomerDebit(customerDebit); Assert.AreEqual("340", response.response); }
public Task <customerDebitResponse> CustomerDebitAsync(customerDebit customerDebit, CancellationToken cancellationToken) { return(SendRequestAsync(response => response.customerDebitResponse, customerDebit, cancellationToken)); }
public customerDebitResponse CustomerDebit(customerDebit customerDebit) { return(SendRequest(response => response.customerDebitResponse, customerDebit)); }