Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Cancel an Order

Vote:
 

Hi 

i'm working on a Payment Provider and particularly PaymentGateway class. My Question is when we click on "Cancel Order" on Commerce Manager Which method it (Workflow) trigger in PaymentGateway Class?  Like when we do refunds it trigger ProcessPayment method with Payment TransactionType as Credit.

 

Thanks you

#122895
Jun 17, 2015 13:00
Vote:
 

sdk.episerver.com/commerce/1.1.2/Content/User%20Guide/OrderManagement/OrderProcessReturnExchange.htm
Using Commerec Manager you can create a return and can develop a PamentGateway to ProcessRefunds. You can add a tab with your order details also and can add process refunds from commerce Mannager.

You will need a new Payment Gateway to process refunds.

Regards
/K

#122900
Edited, Jun 17, 2015 13:30
Vote:
 

When you press that button, a magic thing happens, and the payment gateway will be called with method ProcessPayment(Mediachase.Commerce.Orders.Payment payment, ref string message), and payment.TransactionType will be TransactionType.Credit.ToString() (so you can credit money back to customer's account)

Regards.

/Q

#122902
Jun 17, 2015 13:36
Vote:
 

I want to Cancel Order and void payments (not refund process - So it is before complete shipment & creating refund  - Order is in "InProcess" state). You are saying when "Cancel Order" button Clicked Payment Gateway will be called with method ProcessPayment(Mediachase.Commerce.Orders.Payment payment, ref string message), and payment.TransactionType will be TransactionType.Credit.ToString()??

Note: I'm Developing Custom PaymentGateway. Refunds are working fine but trying to hook functionality around "Cancel Order" Button.

#122904
Edited, Jun 17, 2015 13:44
Vote:
 

Yes,

At that point you can refend or void - depends on how your payment gateway works.

/Q

#122905
Jun 17, 2015 14:03
Vote:
 

On cancelling Order It will call Payment Gateway

Create and a new Payment gate for VOID

#122906
Edited, Jun 17, 2015 14:04
Vote:
 

Just an update

I have contacted with EpiServer Support and according to them cancel order button does not call Payment Gateway. Below is what they said;

In PurchaseOrder-ObjectView.xml under the directory \wwwroot\Apps\Order\Config\View\Forms\ of your commerce manager site you can find the configuration for this button.

See the Button element at View/Form/ButtonSets/add/ButtonSet/Button with id of "CancelOrderButton".
You can see the commandName attribute set to "btn_CancelOrderBtn".
If you search further down the file, you can find the configuration for this command in Commands/add/Command; see the matching Command element with id set to "btn_CancelOrderBtn".

There is a type specified here that implements the command handling logic:
Mediachase.Commerce.Manager.Order.CommandHandlers.PurchaseOrderHandlers.CancelPurchaseOrderHandler, Mediachase.ConsoleManager

I decompiled this type in my local install, Mediachase.ConsoleManager.dll assembly version 8.6.1.431.
Here you can see the IsCommandEnable() and DoCommand() methods.
The underlying classes doing the work are OrderStatusManager and PurchaseOrderManager. These are in the Mediachase.Commerce.dll assembly.

I checked further down the line from OrderStatusManager's CancelOrder() to RecalculatePurchaseOrder() to the proper overload. There I could see the calls down to the workflow manager.

The workflow being called in this case has the string key of "RecalculatePurchaseOrderWorkflow".
In ecf.workflow.config under the directory \wwwroot\Configs\ you can find this string key maps to the following element:

<add name="RecalculatePurchaseOrderWorkflow" displayname="Recalculate Purchase Order" description="Recalculate Purchase Order" type="Mediachase.Commerce.Workflow.PurchaseOrderRecalculateWorkflow, Mediachase.Commerce.Workflow" xomlpath="" rulespath="" />

Checking the definition for this workflow there's evidence that shows that the payment gateway is not engaged.

I discussed this with my colleagues and the consensus is that this appears to make sense.
At the point that a purchase order is cancellable in this UI, the shipment has not yet been released, so it is likely that there is only an authorization.

Hope this information helps you find what you're looking for.

#122993
Jun 22, 2015 16:23
Vote:
 

Any updates on this? I also need to void a payment reservation on order cancel.

#149277
May 27, 2016 14:01
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.