EventContext

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 年 前
kingboyk wrote:
Why aren't we updating the Order.PaymentStatus property every time there is a change? Then all we need to do is raise the event from there (being careful not to raise it before the object is properly hydrated, e.g. set that value last when constructing).


If I'm wrong and that property is always set then indeed the setter would be the perfect place to do it.

The point, though, is that *I* don't want to be raising events anywhere. I shouldn't have to touch the Nop code. The EventContext is there to provide simple API access to key events and the point of the thread is to encourage Andrei to add a suitable event :)
13 年 前
You should add a new OrderPaid event to EventContext and just raise it into the following methods:
1. OrderManager.MarkOrderAsPaid()
2. OrderManager.Capture() (check whether processPaymentResult.PaymentStatus==PaymentStatusEnum.Paid before raising the event)
3. and OrderManager.PlaceOrder() (check whether processPaymentResult.PaymentStatus==PaymentStatusEnum.Paid before raising the event)
13 年 前
Thanks Andrei. I'll add that in our copy, will you add to the trunk copy?

Also what is the value of the enum if unpaid? 0?
13 年 前
kingboyk wrote:
I'll add that in our copy, will you add to the trunk copy?

Yes

kingboyk wrote:
Also what is the value of the enum if unpaid? 0?

It can be any other value except 30 (PaymentStatusEnum.Paid). By default it's 10 (PaymentStatusEnum.Pending)
13 年 前
Thanks Andrei, you're a star.
13 年 前
nopCommerce team | a.m. wrote:
It can be any other value except 30 (PaymentStatusEnum.Paid). By default it's 10 (PaymentStatusEnum.Pending)

I'm wrong. It can be any other value (see PaymentStatusEnum enum)
13 年 前
Righto.
13 年 前
See changeset 57552
13 年 前
I'm wondering if it might be better to raise the event (or probably better still raise an additional event) whenever the payment status changes, so that plugins can also be informed when a payment has been rejected? Yes, I think keep OrderPaid as that's nice and easy and will suit most folks but consider adding an event which informs us of any change in payment status?

I'm going to have a scenario soon where I will not be turning features ON when paid, but turning them OFF if payment fails. (That's if I can do recurring payments at varying rates - may have to write my own solution for this).

Thoughts Andrei and/or anyone else?
13 年 前
There's already a work item on CodePlex to add more events to EventContext.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.