I have a big problem dealing with new payment gateway creation. I followed a tutorial but I think I did something wrong because it doesn't work well.
I would like to create a "devis" (sorry I don't know the word in english... It looks like that.
When the customer buys something, he could choose this kind of payment which does nothing but provide the "devis". It would be perfect if the status of the order could be "on hold" directly in order to unhold it when the "real payment" is done.
I hope you have understand what I try to do but if you have not be free to ask me questions.
Here is what I've done:
I created a new class in the
VirtoCommerce.PaymentGateways
namespace calledDevisPaymentGateway
which inherits from thePaymentGatewayBase
class. In this class there is just one method:ProcessPayment
where I do:payment.status = PaymentStatus.Completed.ToString();
in the
SqlOrderDatabaseInitializer.cs
I created a private
SetupDevisGateway
method:private void SetupPaypalGateway(List<PaymentGateway> gateways)
which is called in the
CreatePaymentGateways
method just after the paypal gateway.I deployed the database thanks to your powershell script, the gateway is created as expected.
- I enabled the gateway payment via VirtoCommerce Manager Then I bought something on the website and I chose the new Payment which is available so it seems to work.
- When I click on proceed to checkout I have a new order line which is created with the "Pending" status so it's perfect...
When I bought something with paypal for example, there was the same reaction BUUUT when the new order line was created there was the onBeforeUpdate
method which detected that new line and some work was done asynchronously. With the new gateway it seems that the onBeforeUpdate
method doesn't work anymore...
I think that I've forgot something which is done with Paypal and not with my gateway but what and where?
I already know that it's not a good idea to write something in the SqlOrderDatabaseInitializer.cs
but I don't think that it's the problem... Does anybody have a solution?
Thanks
Edit: Explanation on what I try to achieve: Products which are sold are in fact a couple: "images treatments" + "images" Each customer can manage album and put photos into it, and when he clicks on a product (which is a treatment) he can choose an album. So it's why I need this event, when the payment is done and the status change from pending to in progress, I send relevant information (about the treatment, the album...) to a queue and I have worker roles (one for each treatment) which read these messages and do some work.
I hope you understand the idea but if you don't, do not hesitate to ask me questions