I am having an issue with an order payment process. I am sending the payment through iMIS and it is being charged in our PayPal account, but the payment is not being recorded in iMIS. The batch is generated, but keeps a $0 total and no product sale info is created. I have been researching it for many hours and cannot pinpoint the cause of my problem. If you have any ideas please share. Thank you. - JK
//create order
CStandardOrder stdOrder = new CStandardOrder(user);
//gets current days open batch or creates new one
CBatch batch = getBatch(user);
CStandardOrderLine line = stdOrder.NewLineItem("CORRECT_PRODUCT_CODE", 1);
//set stdOrder attributes
stdOrder.BatchNumber = batch.BatchNumber;
stdOrder.BillToContactId = contact.ContactId;
stdOrder.CashAccountCode = "XXXX";
//get order payment
CPayment payment = stdOrder.Payment;
//set payment info
payment.Amount = Settings.SESSION_TRAINING_PRICE;
payment.PaymentType = EnumPaymentType.CreditCard;
payment.CreditDebitCardHoldersName = TBcardName.Text.Trim();
payment.CreditCardNumber = TBcardNumber.Text.Trim();
payment.CreditCardSecurityCode = TBcardSecurity.Text.Trim();
payment.CreditCardExpiration = DDLexpMonth.SelectedValue + DDLexpYear.SelectedValue;
payment.CashAccountCode = "XXXX";
//get cashAccount code
Asi.iBO.SystemConfig.CCashAccount cashAccount = Asi.iBO.iboAdmin.ReferenceData.GetCashAccount(stdOrder.Payment.CashAccountCode);
//set billing address
CAddressBasic billAddr = new CAddressBasic(user);
billAddr.Address1 = txtAddress.Text.Trim();
billAddr.Address2 = txtAddress2.Text.Trim();
billAddr.City = txtCity.Text.Trim();
billAddr.StateProvince = txtState.Text.Trim();
billAddr.PostalCode = txtZipCode.Text.Trim();
billAddr.Validate();
//use payment gateway
PaymentGatewayResponse response = stdOrder.Payment.ProcessPayment(billAddr);
//save the order
stdOrder.Validate();
stdOrder.Save();
Add this
payment.Validate();
stdOrder.Validate();
bool successFlag = stdOrder.Save();
if (successFlag)
{
CAccountingEvent newTrans = new CAccountingEvent(user);
DataServer server = new DataServer(user);
newTrans.StandardOrderEvent(server, Asi.iBO.Financials.AccountingEventType.ProFormaFullPurchase, stdOrder, Batch, payment);
Asi.Bae.Business.Cart.CartOrder.ClearCachedCartOrders(_imisID);
foreach (Asi.Bae.Business.Cart.CartOrder _item in Asi.Bae.Business.Cart.CartOrder.GetAll(_imisID, Cart))
{
_item.Dispose();
_item.Cart.Delete();
}
Session.Abandon();
}
Bruce M Walker
BSCI
Chicago IL