Hi -
I've written a custom billing app that successfully creates and saves orders. When the order is saved, the payment status is paid and shows up as paid on the admin order manager list as paid, but when I view the details of the order in the admin order manager, the payment status automatically switches to unpaid.
I looked in the database and find no entry in table payments even though I am doing this:
Payment recentPayment = new Payment();
recentPayment.OrderId = 7600;
recentPayment.PaymentId = 8;
recentPayment.PaymentMethodName = "Credit Card";
recentPayment.Amount = 21.00M;
recentPayment.CurrencyCode = "USD";
recentPayment.PaymentDate = DateTime.Now;
recentPayment.PaymentStatusId = 5;
recentPayment.ReCrypt = false;
//recentPayment.UpdateStatus(PaymentStatus.Completed);
recentPayment.CompletedDate = DateTime.Now;
SaveResult result = new SaveResult();
result = recentPayment.Save();
and I receive the result of: RecordUpdated
Am I forgetting to set or save something??
Thanks for your help...
Harry
payments not saving
-
- Lieutenant, Jr. Grade (LT JG)
- Posts: 34
- Joined: Wed Feb 29, 2012 4:45 pm
Re: payments not saving
We do a lot of this type of stuff.
The reason is your just adjusting the order to be "paid". But it's not really paid.
You need to attach a true payment. It must be a "processed" payment also. Then the order will not be marked unpaid when viewing the details.
The reason is your just adjusting the order to be "paid". But it's not really paid.
You need to attach a true payment. It must be a "processed" payment also. Then the order will not be marked unpaid when viewing the details.
-
- Ensign (ENS)
- Posts: 14
- Joined: Fri Oct 15, 2010 2:05 pm
Re: payments not saving
Thanks for your reply - I've really been racking my brain here. So, is the order then
Create an Order
Create a Payment
Create a Transaction
Are there any other items that need to be created in order for the paid status to stick?
Create an Order
Create a Payment
Create a Transaction
Are there any other items that need to be created in order for the paid status to stick?
-
- Lieutenant, Jr. Grade (LT JG)
- Posts: 34
- Joined: Wed Feb 29, 2012 4:45 pm
Re: payments not saving
I don't think so. After we attached a successful *fake* payment the order status wouldn't change.
Re: payments not saving
Easiest way is to add the Payment object to the Payments collection on the Order object.
So:
Add items to the _Basket object
Call _Basket.Checkout()
Get the OrderId value from the CheckoutResponse object
Load up an Order object
Now you can create a new Payment object. Then add the Payment object to the Order object.
_Order.Payments.Add(_Payment);
Finally, save the Order object.
_Order.Save();
Works the same way with OrderNotes, LineItems etc. Essentially all the Able primary classes will check if any child collections are dirty in the base .Save() routine. If so, those child classes are written first and any trigger events fire automatically.
So:
Add items to the _Basket object
Call _Basket.Checkout()
Get the OrderId value from the CheckoutResponse object
Load up an Order object
Now you can create a new Payment object. Then add the Payment object to the Order object.
_Order.Payments.Add(_Payment);
Finally, save the Order object.
_Order.Save();
Works the same way with OrderNotes, LineItems etc. Essentially all the Able primary classes will check if any child collections are dirty in the base .Save() routine. If so, those child classes are written first and any trigger events fire automatically.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com