Similar to Jakob and Tyler in this thread I want to decrement my product quantities when the order has been placed, rather than as the order is shipped.
My custom task does not seem to get triggered correctly, though. I expect my task to get triggered once I authorize the payment (CheckoutManager.Payment.AuthorizePayment(paymentMethodKey)), however it is only triggered when I authorize AND capture (CheckoutManager.Payment.AuthorizeCapturePayment(paymentMethodKey))
In my setup I have done the following:
removed RemoveShipmentOrderItemsFromInventoryAndPersistShipmentTask from the OrderPreparationShipmentCreate task chain
Added my custom task to the end of the OrderPreparationOrderCreate task chain
Implemented my custom task inheriting from OrderCreationAttemptChainTaskBase
Making sure AlwaysApproveOrderCreation has been set to true
Does anyone have any advice as to what I could be missing?
trigger when i do in my payment provider controller
**var order = attempt.Invoice.PrepareOrder();** right here
order.OrderStatus = MerchelloContext.Current.Services.OrderService.GetOrderStatusByKey(Merchello.Core.Constants.DefaultKeys.OrderStatus.NotFulfilled);
MerchelloContext.Current.Services.OrderService.Save(order);
I successfully trigger my task even tho only the invoice is authorize the payment.
Part of my code in my CustomPaymentProviderController
// Realizamos el autorizaciĆ³n del pago
var attempt = this.CheckoutManager.Payment.AuthorizePayment(paymentMethod.Key, args);
//Verificamos success unicamente para que se reste la cantidad en el material comprado
if (attempt.Payment.Success)
{
var order = attempt.Invoice.PrepareOrder();
order.OrderStatus = MerchelloContext.Current.Services.OrderService.GetOrderStatusByKey(Merchello.Core.Constants.DefaultKeys.OrderStatus.NotFulfilled);
MerchelloContext.Current.Services.OrderService.Save(order);
}
PD. Sorry if my english is not the best. Hopefully this info can be usefull. regards
Triggering custom task in OrderPreparationOrderCreate taskchain
Hello,
Similar to Jakob and Tyler in this thread I want to decrement my product quantities when the order has been placed, rather than as the order is shipped.
My custom task does not seem to get triggered correctly, though. I expect my task to get triggered once I authorize the payment (
CheckoutManager.Payment.AuthorizePayment(paymentMethodKey)
), however it is only triggered when I authorize AND capture (CheckoutManager.Payment.AuthorizeCapturePayment(paymentMethodKey)
)In my setup I have done the following:
RemoveShipmentOrderItemsFromInventoryAndPersistShipmentTask
from theOrderPreparationShipmentCreate
task chainOrderPreparationOrderCreate
task chainOrderCreationAttemptChainTaskBase
Does anyone have any advice as to what I could be missing?
BR Peter
Hi, this issue is because only the order are generated when the invoice is paid.
i have in my merchello.config
<setting alias="AlwaysApproveOrderCreation" value="false" />
and my tasks in here
trigger when i do in my payment provider controller
I successfully trigger my task even tho only the invoice is authorize the payment.
Part of my code in my CustomPaymentProviderController
PD. Sorry if my english is not the best. Hopefully this info can be usefull. regards
is working on a reply...