3

We will be in a process of migrating solution made with Sitecore Commerce 8.2.1 to Sitecore Commerce 9 Update 1 soon.

One of the requirements was to handle all orders without payment using Commerce server basically as "ordering" system. After order was created, we called external webservice that notified financial systems on company side and invoice was generated outside of Sitecore Commerce. This was more B2B commerce system.

We were doing this by creating "fake" federated payment with same amount of money (for products and shipping) to even it and be able to order. Without this we couldn't create order. This was a temporary fix to this problem.

During upgrade, we would like to optimize this to be more transparent to all parties. So if no payment is made in Sitecore Commerce we also won't do any "fake" payment with federated payment.

Would it be possible to achieve this by turning off payment policy or how can we achieve this ordering scenario without payments?

5

As of 9.0.1, CreateOrderBlock (the first OOTB block in ICreateOrderPipeline) validates that the payment total equals the grand total of the order and aborts the pipeline if it does not.

However, since the validation is not on the payment objects but on Order.Totals.PaymentsTotal it should be pretty easy to work around.

I would recommend adding a block before (AddTemporaryPaymentsTotal) and after (RemoveTemporaryPaymentsTotal) the CreateOrderBlock:

// AddTemporaryPaymentsTotal
cart.Totals.PaymentsTotal = order.Totals.GrandTotal;

// RemoveTemporaryPaymentsTotal
order.Totals.PaymentsTotal = new Money(order.Totals.GrandTotal.CurrencyCode, 0M);

CreateOrderBlock doesn't actually persist anything, so the temporary value won't be made available to anything else.

You could also replace CreateOrderBlock and patch out the validation check but I would advise against it. The existing block has a fair bit of logic which may cause problems when you upgrade again.

| improve this answer | |
1

I'm not sure if this is what you mean, but if you just want to be able to order without payment: I think that with the default SXC9 setup its already possible to place an order without payment. There is no out of the box validation for this (On the commerce engine side of things). We had to implement this ourselves to stop the order from ending up being completed. Not sure about the SXA / storefront side though

| improve this answer | |
  • 1
    In Sitecore Commerce 8.2.1, payment was mandatory. Without payment you couldn't complete order. We always received error. When we even the amount of money on order with "fake" federated payment everything was fine and order was completed. If in Commerce 9 this is not the case, then that's awesome. Thanks – Peter Procházka Jun 1 '18 at 13:28
  • Can we get a confirmation on this? – Mark Cassidy Jun 1 '18 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.