KonaKart Community Forum

Installation / Configuration => Programming of KonaKart => Topic started by: lrkwz on December 07, 2009, 05:58:06 pm

Title: no mail from gateway callback
Post by: lrkwz on December 07, 2009, 05:58:06 pm
Hello,
    I've realized a payment gateway for Banca sella (Gestpay) starting from the WorldPay sources ... everything works fine but I canno send emails.

The sendOrderConfirmationMail(kkAppEng, orderId, /* success */false) function call does not receive any exception bue the local sendmail isn't called at all.

Other mail (Welcome, changepassword etc) have no prblems.

Any hint? How ca I diagnose the problem?

Thank you.
Title: Re: no mail from gateway callback
Post by: julie on December 07, 2009, 06:08:40 pm
Try adding   kkAppEng.setSessionId(sessionId); after getting the session id in the action class as shown below:           

// We log into the engine to get a session.
sessionId = kkAppEng.getEng().login(username, password);
kkAppEng.setSessionId(sessionId);

Maybe you would be so kind as to contribute the payment gateway to the community ?
Title: Re: no mail from gateway callback
Post by: lrkwz on December 07, 2009, 08:36:44 pm
Unfortunately I've already setted the instance ... no success :-(

Of course I'll contribute the gateway as soon all problems are resolved.
Title: Re: no mail from gateway callback
Post by: heidi on December 07, 2009, 08:41:52 pm
Have you checked the configuration settings are as you need in the KonaKart Admin App?

You can enable/disable the sending of order confirmation emails for example.

Another thing you can try is to enable the debug of email sessions.. Maybe that might give you some clues?
Title: Re: no mail from gateway callback
Post by: lrkwz on December 07, 2009, 09:04:42 pm
Debug Email Sessions = true
but  .. nothing in catalina.out where should I look for it?

I've also added

log4j.logger.com.konakart.bl.Emailer = DEBUG

with no output at all :-( :-(
Title: Re: no mail from gateway callback
Post by: lrkwz on December 08, 2009, 03:54:32 pm
I've realized that the OrderConfPaymentSuccess/Failure mail is sent only if you send the OrderConfirmation.

I wish to dsable the OrderConfirmation and send only the OrderConfPaymentSuccess/Failure ... is it possible?
Title: Re: no mail from gateway callback
Post by: julie on December 09, 2009, 11:00:09 am
I don't understand what you mean.
Title: Re: no mail from gateway callback
Post by: lrkwz on December 09, 2009, 09:08:26 pm
I I set in the admin send OrderConfirmation = false no mail is sent, if I set it true OrderConfirmation mail is sent and OrderConfPaymenrSuccess is also sent.

My code is:

public class GestpayAction extends BaseGatewayAction {
...
   public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
...
         // See if we need to send an email, by looking at the configuration
         String sendEmailsConfig = kkAppEng.getConfig(ConfigConstants.SEND_EMAILS);
         boolean sendEmail = false;
         if (sendEmailsConfig != null && sendEmailsConfig.equalsIgnoreCase("true")) {
            log.debug("will send email");
            sendEmail = true;
         }

...
            if (GestpayConstants.SUCCESSFUL_TRANSACTION_VALUE.equalsIgnoreCase(gestpayCrypt.getTransactionResult())) {
               comment = GestpayConstants.ORDER_HISTORY_COMMENT_OK + gestpayCrypt.getAuthorizationCode();
               kkAppEng.getEng().changeOrderStatus(sessionId, orderId, com.konakart.bl.OrderMgr.PAYMENT_RECEIVED_STATUS,
                     sendEmail, comment);

               // If the order payment was approved we update the inventory
               kkAppEng.getEng().updateInventory(sessionId, orderId);
               // If we expect no more communication from GestPay for this order we can
               // delete the SecretKey
               kkAppEng.getEng().deleteOrderIdForSecretKey(secretKey);
               if (sendEmail) {
                  log.debug("Sending payment received mail for order id " + orderId);
                  sendOrderConfirmationMail(kkAppEng, orderId, /* success */true);
               }
            } else {
               comment = GestpayConstants.ORDER_HISTORY_COMMENT_KO + gestpayCrypt.getTransactionResult();
               kkAppEng.getEng().changeOrderStatus(sessionId, orderId, com.konakart.bl.OrderMgr.PAYMENT_DECLINED_STATUS,
                     sendEmail, comment);
               if (sendEmail) {
                  log.debug("Sending payment declined mail for order id " + orderId);
                  sendOrderConfirmationMail(kkAppEng, orderId, /* success */false);
               }
            }

            ipnHistory.setKonakartResultDescription(GestpayConstants.RET0_DESC + " Auth code:"
                  + gestpayCrypt.getAuthorizationCode() + " Bank trans id:" + gestpayCrypt.getBankTransactionID());
            ipnHistory.setKonakartResultId(GestpayConstants.RET0);
            kkAppEng.getEng().saveIpnHistory(sessionId, ipnHistory);
         }

         return null;

      } catch (Exception e) {
...
    }
}

Title: Re: no mail from gateway callback
Post by: julie on December 10, 2009, 08:13:43 am
In CheckoutConfirmationSubmitAction wheresaveOrder() is called, set sendEmail to false.
Title: Re: no mail from gateway callback
Post by: lrkwz on December 10, 2009, 09:55:44 am
ok thanks!