November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi Quan,
We're using Braintree so we get the transaction back from them. Along the lines of:
var paymentMethod = _paymentService.GetPaymentMethodByType(typeof(BraintreePaymentMethod)); var payment = _orderGroupFactory.CreateCardPayment(order); order.AddPayment(payment, _orderGroupFactory); // Set values after adding to collection because of limitation in implementation payment.Amount = transaction.Amount.Value; payment.CardType = transaction.CreditCard.CardType.ToString(); payment.CustomerName = transaction.CreditCard.CardholderName; payment.CreditCardNumber = transaction.CreditCard.MaskedNumber; payment.PaymentMethodId = paymentMethod.PaymentMethodId; payment.PaymentMethodName = "Braintree"; payment.ExpirationMonth = int.Parse(transaction.CreditCard.ExpirationMonth); payment.ExpirationYear = int.Parse(transaction.CreditCard.ExpirationYear); payment.Status = transaction.Status.ToString(); payment.AuthorizationCode = transaction.ProcessorAuthorizationCode; payment.BillingAddress = _mapper.Map(billingAddress, order.CreateOrderAddress("Billing")); order.OrderStatus = OrderStatus.InProgress;
And the value taken through the payment gateway matches the PO
You need to set the Payment.TransactionType.
Capture or Sale are the most appropriate if you're charging. (It depends on if you've set up handling for any of them in your IPaymentGateway)
The payment also needs to be processed.
The UpdateTotalsActivity is responsible for setting OrderForm.CapturedPaymentTotal which is what the "IsPaid" clause that Quan mentioned looks at
Depending on your payment handling flow you could alternatively set the TransactionType to Authorization. UpdateTotalsActivity will then add those values to OrderForm.AuthorizedPaymentTotal instead which is also looked at when checking if the order is considered to be paid.
I have made the suggested changed:
payment.Status = PaymentStatus.Processed.ToString(); payment.TransactionType = Mediachase.Commerce.Orders.TransactionType.Sale.ToString();
And still this doesn't make a difference on being able to release the shipment
Do you call IOrderGroup.ProcessPayments() somewhere?
order.ProcessPayments();
It processes the payments and also calls IOrderForm.UpdatePaymentTotals() which does what UpdateTotalsActivity did for the old API (which I for some reason assumed that you used above :P ).
If you don't have an IPaymentGateway/IPaymentPlugin setup for your Braintree implementation you can try calling UpdatePaymentTotals() directly:
order.GetFirstForm().UpdatePaymentTotals();
I have:
SavePaymentDetails(order, transaction, command.BillingAddress); order.ProcessPayments(); orderReference = _orderRepository.Save(order);
Where SavePaymentDetails is the above pasted method where set the status etc.
I have also tried
order.GetFirstForm().UpdatePaymentTotals();
In case there was something wring with our payment gateway but still no difference.
Alright, maybe it's not the payments. :)
Either way here's the things that I know of that sets the button as disabled:
For purposes of debugging order data I usually use these SQL queries:
DECLARE @OrderGroupId int = '12345' -- Set this to the ordergroupId of the order you want to check SELECT * FROM OrderGroup og JOIN OrderGroup_PurchaseOrder po ON og.OrderGroupId = po.ObjectId WHERE og.OrderGroupId = @OrderGroupId SELECT * FROM [dbo].[OrderForm] oform JOIN OrderFormEx ofex ON oform.OrderFormId = ofex.ObjectId WHERE oform.OrderGroupId = @OrderGroupId SELECT * FROM [dbo].Shipment sh JOIN ShipmentEx shex ON sh.ShipmentId = shex.ObjectId WHERE sh.OrderGroupId = @OrderGroupId SELECT * FROM [dbo].LineItem l JOIN LineItemEx lex ON l.LineItemId = lex.ObjectId WHERE OrderGroupId = @OrderGroupId ORDER BY LineItemOrdering ASC SELECT * FROM OrderGroupAddress oga JOIN OrderGroupAddressEx ogae ON oga.OrderGroupAddressId = ogae.ObjectId WHERE oga.OrderGroupId = @OrderGroupId SELECT * FROM [dbo].OrderFormPayment ofp WHERE ofp.OrderGroupId = @OrderGroupId
So if you can get a hold of the orders OrderGroupId you can see what the different values are, for example check OrderForm.CapturedPaymentTotal, Shipment.ShippingMethodId etc etc
That's a very good summary Jeff. I'm going to make it easier to diagnose why a shipment can't be released. I know it has been a pain in the a** for quite some time, but I haven't had time to really do anything about it. Today I can!
Thanks, this is helpful. I have run the query and this is what I found, I'm not sure how relvent.
Apart from that they all look ok
Looks like it came down to not setting the WarehouseCode on the shipment and possibly the order in which we processed the payment/saved to a PO.
In earlier versions of commerce we didn't have to explictly set the warehouse code and it just fell back to "default" has this been a change?
So yeah, there seems to be an issue assigning inventory.
Given the things that can disable the button that I listed above, the thing that most likely is stopping you from releasing is the Shipment status being NULL.
EDIT: Ah, you already found the issue. Good thing that it got resolved! :)
Commerce 11.8.2
At the moment in commerce manager we're unable to click release shipment due to the button being greyed out.
I have looked through this forum and while others have come across this issue all the solutions haven't worked for me.
All variants have inventory assigned, along with a warehouse, I have tried both tracked and untracked inventory (I'd prefer untracked but i'll take track for it to work!!)
Looking through the forum and online I need to Adjust/Update the inventory.
Thus, I have tried the following:
This doesn't make any difference at all, the button is still disabled.
I have tried to manually set the status:
And this also doesn't effect it.
Similary I have tried:
Again no luck.
Any assistance or direction would be great.