Recurring products not appearing under the order

9 meses atrás
You could call either one which is appropriate to the test with the data supplied in the request

var processPaymentRequest = new ProcessPaymentRequest()
// Setup the request
var paymentMethod = await _paymentPluginManager.LoadPluginBySystemNameAsync(PaymentMethod.SystemName);
if (paymentMethod != null)
{
    order.PaymentMethodSystemName = PaymentMethod.SystemName;  
    await _orderService.UpdateOrderAsync(order);
    var result = await paymentMethod.ProcessPaymentAsync(processPaymentRequest);
}
or    

var postProcessPaymentRequest = new PostProcessPaymentRequest()
// Setup the request
var result = await paymentMethod.PostProcessPaymentAsync(postProcessPaymentRequest);
9 meses atrás
Yidna wrote:
You could call either one which is appropriate to the test with the data supplied in the request

var processPaymentRequest = new ProcessPaymentRequest()
// Setup the request
var paymentMethod = await _paymentPluginManager.LoadPluginBySystemNameAsync(PaymentMethod.SystemName);
if (paymentMethod != null)
{
    order.PaymentMethodSystemName = PaymentMethod.SystemName;  
    await _orderService.UpdateOrderAsync(order);
    var result = await paymentMethod.ProcessPaymentAsync(processPaymentRequest);
}
or    

var postProcessPaymentRequest = new PostProcessPaymentRequest()
// Setup the request
var result = await paymentMethod.PostProcessPaymentAsync(postProcessPaymentRequest);


Yeah but still, where would I put the code you supplied. Sorry I kinda don't get this part... What is called, when the new "sub" order is created
9 meses atrás
aglasencnik wrote:
If I click on the first one it creates a new order and it sets to pending

Maybe get inside this routine and atfer the order is created call the Payment Method with the code above
Otherwise you could create a task that runs say every 5 minutes to check subscriptions and make payments
9 meses atrás
Ok so I found something out. I created an event handler, and implemented this:
IConsumer<OrderPlacedEvent>
... I got a result both times, so that's good. But there is a problem... In the order I get here:

    public Task HandleEventAsync(OrderPlacedEvent eventMessage)
    {
        return Task.CompletedTask;
    }

I can't see from which "original" order this came from.... Also how do I find out when the subscription expires on this order that was created or in other words when would the  next payment date be, even if the order gets canceled in the meantime.
Also,... should I then when I create the first order create the second one as well, but not get money from the user??
Below is also the image about what I was talking about, so how it is, when I make the first order... Under order -> Recurring payments there is this (the date is the date and time of original purchase, but if I click on process next payment, it goes forward by one month like it should in the first place):
https://imgur.com/a/NT03NRd
9 meses atrás
From the Event Order Id search the RecurringPaymentHistory table which tells you the RecurringPaymentId then you can search the RecurringPayment table to get the original Order Id

See src\Libraries\Nop.Services\Orders\OrderService for the RecurringPayment routines
9 meses atrás
Yidna wrote:
From the Event Order Id search the RecurringPaymentHistory table which tells you the RecurringPaymentId then you can search the RecurringPayment table to get the original Order Id

See src\Libraries\Nop.Services\Orders\OrderService for the RecurringPayment routines


Where do I get the event order id?
Also how do I access the RecurringPaymentHistory table? Which service do I use??
9 meses atrás
Ok update.... after looking at the OrderProcessingService I found out that for the recurring product I had to change the recurring type to manual. Then it immediately went through and created the recurring payment like it should.
SO my main question now is, because the date is now correct in nopcommerce. Will it automatically add another recurring order on that date or no???
I was thinking I will then check in the EventConsumer if the subscription is active in my payment gateway and set the payment status to complete... Do you think this would work???