The following NUnit-driven demos demonstrate that setting CPayment's CashAccountCode before setting the CreditCardNumber will lead to unexpected errors:
[TestFixture, Explicit("demos")]
public class UnexpectedExceptions
{
[TestFixtureSetUp]
public void TestFixtureSetUp()
{
iboAdmin.InitializeSystem(ConfigurationManager.ConnectionStrings["DataSource.iMIS.Connection"].ConnectionString);
}
[Test]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
public void Demo_Setting_CreditCardNumber_After_CashAccountCode_CausesUnhandledException_1()
{
var payment = new CPayment(CStaffUser.GetDefaultStaffUser())
{
CashAccountCode = cashAccountCode,
CreditCardNumber = "4007000000027" // VISA test number, eh?
};
}
[ExpectedException(typeof(Asi.iBO.InvalidCardNumberException))]
public void Demo_Setting_CreditCardNumber_After_CashAccountCode_CausesUnhandledException_2()
{
var payment = new CPayment(CStaffUser.GetDefaultStaffUser())
{
CashAccountCode = cashAccountCode,
CreditCardNumber = "011201539123" // it's irrelevant how I came up with this number.
};
}
}
This happens with Asi.iBO version 15.1.0.2782. Setting CashAccountCode _after_ setting CreditCardNumber seems to resolve the issue.
Has anyone else encountered anything similar or contradictory, or found more info on this elsewhere?
I'm seeing somethign similar
I'm seeing somethign similar but can't get around it - when I set the credit card number it always gives a null expception regardless of where I set the CashAccountCode :
CPayment payment = myOrder.Payment;
payment.PaymentType = EnumPaymentType.CreditCard;
payment.CashAccountCode = "VISA";
payment.CreditCardSecurityCode = "123";
payment.CreditDebitCardHoldersName = "Test Person";
payment.CreditCardExpiration = "1212";
payment.Amount = 101;
payment.CreditCardNumber = "4111111111111111";
It wil hit that last line and crash : "Object reference not set to an instance of an object". This is with iBO 15.1.3.6699.