Buy GiftCard - skipPaymentWorkflow (no need to pay) ...does NOT email the GiftCard Code

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 年 前
I'm using V2.3 !!

I'm trying to test the GiftCard module.

So after I add a GiftCard to the Cart, I then use either a 100% Discount or Points to pay for it.
Ideally I would assume that the system does NOT take me to PayPal (since skipPaymentWorkflow = true)
but that the system does send the email with the Coupon to the person I selected.

Nothing happens.

Any thoughts ??
11 年 前
The system does not send you to PayPal and the recipient of gift card is notified about his "gift" you purchased for him. It works this way. I haven't got what exactly is wrong?
11 年 前
I'm looking at the OrderProcessingSercvice.cs.

The condition is "skipPaymentWorkflow = true"
Let's say I paid with a 100% discount coupon.

Around line 1000, there is a:
   if (sc.ProductVariant.IsGiftCard)
   {  
      where the code creates an entry on the GiftCard table  
      "_giftCardService.InsertGiftCard(gc);"
   }

This piece of code creates an entry with
    IsGiftCardActivated = false,
    IsRecipientNotified = false,


...but I do NOT see any call to the
      _workflowMessageService.SendGiftCardNotification(gc, order.CustomerLanguageId);


So my question is WHEN does the card emails the recipient?
11 年 前
Oh, I got you now. You're absolutely right. That's an issue which will be fixed in the near time. I'll create a work item.

Thanks for reporting
11 年 前
This is my fix ...in case you like it


                                    for (int i = 0; i < opv.Quantity; i++)
                                    {
                                        var gc = new GiftCard()
                                        {
                                            GiftCardType = opv.ProductVariant.GiftCardType,
                                            PurchasedWithOrderProductVariant = newOpv,
                                            Amount = opv.UnitPriceExclTax,

                                            // SDSHARP
   >>>>>                                IsGiftCardActivated = skipPaymentWorkflow,

                                            GiftCardCouponCode = _giftCardService.GenerateGiftCardCode(),
                                            RecipientName = giftCardRecipientName,
                                            RecipientEmail = giftCardRecipientEmail,
                                            SenderName = giftCardSenderName,
                                            SenderEmail = giftCardSenderEmail,
                                            Message = giftCardMessage,

                                            // SDSHARP
   >>>>>                                IsRecipientNotified = skipPaymentWorkflow,

                                            CreatedOnUtc = DateTime.UtcNow
                                        };
                                        _giftCardService.InsertGiftCard(gc);

                                        // SDSHARP
                                        if (skipPaymentWorkflow)
                                            _workflowMessageService.SendGiftCardNotification(gc, order.CustomerLanguageId);
                                    }


I normally mark "// SDHARP" ...where I make changes so that i can update on newer versions if I need to
The same fix was done in 2 places where it says:

1)
//gift cards
if (sc.ProductVariant.IsGiftCard)


...and also
2)
//gift cards
if (opv.ProductVariant.IsGiftCard)
11 年 前
and off course, you should look also at the POST PAYMENT event
for example, on my case I use PayPal and there is NO code that sends the email and sets it as Activated
11 年 前
I've just tested it one more time. And everything works fine!

A recipient is notified about a gift and a call to the _workflowMessageService.SendGiftCardNotification() is also made (from OrderProcessingService.SetOrderStatus() method) . Just ensure that "Gift card activation order status" is set to "Complete" on the order settings page (admin area). In this case a recipient will be automatically notified about any gift card purchased for him once order status is set to "complete" (and it's set to "complete" if you order total is 0 and there's no any shippable products)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.