medusa icon indicating copy to clipboard operation
medusa copied to clipboard

PaymentService not available for import in the event subscriber

Open dmiric opened this issue 10 months ago • 3 comments

I'm trying to use PaymentService.event.UPDATE in a subscriber. However I can't import it same way I can ProductService or OrderService. I'm not sure if that's a bug or documentation is wrong? PayementService: https://github.com/medusajs/medusa/blob/276278cbe7b3bb0367b8276589bc10f587240870/packages/medusa/src/services/payment.ts#L32

dmiric avatar Apr 10 '24 14:04 dmiric

I am not sure I understand what you mean. Can I get you to elaborate?

You can reference these events in two ways 1) as a raw string or 2) using the static property (as you allude to).

.subscribe("payment.updated", ....)
.subscribe(PaymentService.Events.UPDATED, ....)

olivermrbl avatar Apr 16 '24 16:04 olivermrbl

I tried using this example to make a subscriber: https://github.com/medusajs/medusa-starter-default/tree/master/src/subscribers for some reason when I try to replace ProductService with PaymentService it can not be done.

dmiric avatar Apr 21 '24 10:04 dmiric