VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: dirkb on July 06, 2016, 12:07:12 PM

Title: anybody experience with postfinance (swiss) - new status 91
Post by: dirkb on July 06, 2016, 12:07:12 PM
Hi ... any crack experience with postfinance ? We had somebody helping us out with an old b-planet plugin (the official 3.01 version does not work 100% and those guys are not really supporting). Now, postfinance added offline processing and added an new status (91) - I tried to go through the plugin, but I´m a little lost ... below are the status codes we have in (Case ...) ... what would I have to add ? anybody experience with that ?


------------------------------------------------------

      //React depending on status of confirmation
      switch ($postfinance_status){

         case 5:
         case 9:
            //Payement is Authorized, process it !!
            $this->logInfo('plgVmOnPaymentNotification Postfinance status: ' . $postfinance_status . ' New order status :' . $order['order_status'], 'message');
            $modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, true);
            // Exit is needed or postfinance doen't return client correctly to site
            exit();

         case 51:
            //Payement is marked Authorization waiting
            if ($method->postfinance_verified_only == 1){
               //Payement is Authorized, process it !!
               $this->logInfo('plgVmOnPaymentNotification Postfinance status: ' . $postfinance_status . ' New order status :' . $order['order_status'], 'message');
               $modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, true);
               $mailsubject = "PostFinance IPN on your site with status AUTHORIZATION  WAITING (STATUS 52) was accepted";
               $mailbody .= "A PostFinance transaction for you has been made on your website! \n";
               $mailbody .= "Warning, the transaction has the status AUTHORIZATION  WAITING (STATUS 52) \n";
               $mailbody .= "If in future you do not wish to accept offline processing turn the feature off in the payement module configuration \n";
               $mailbody .= $transactioninfo;
               $this->logInfo($mailsubject . "::" . $mailbody, 'ERROR' );
               $this->sendEmailToVendorAndAdmins($mailsubject, $mailbody);
               //Exit is needed or postfinance doen't return client correctly to site
               exit();
            }else{
               $mailsubject = "PostFinance IPN on your site with status AUTHORIZATION  WAITING (STATUS 52) was refused";
               $mailbody = "A Failed PostFinance Transaction on your site requires your attention. The STATUS return by PostFinance is AUTHORIZING WAITING (STATUS 52) \n";
               $mailbody .= "even though you refuse offline processing\n";
               $mailbody .= "If in future you wish to accept offline processing, turn the feature on in the payement module configuration\n";
               $mailbody .= $transactioninfo;
               $this->logInfo($mailsubject . "::" . $mailbody, 'ERROR' );
               $this->sendEmailToVendorAndAdmins($mailsubject, $mailbody);
               exit();
            }
         default:
            // If the payment_status is canceled ( 1 ) or not recognized... do nothing but mail
            //Send notificatino to admin
            $mailsubject = "PostFinance IPN on your site did not finalise";

            If ($postfinance_status == 1) {
               $mailbody = "A PostFinance Transaction was canceled. \n";
            }else{
               $mailbody = "The STATUS return by PostFinance is not reconnised. \n";
            }
            $mailbody .= $transactioninfo;

            $this->logInfo($mailsubject . "::" . $mailbody, 'ERROR' );
            $this->sendEmailToVendorAndAdmins($mailsubject, $mailbody);
            exit();
      }
   }
Title: Re: anybody experience with postfinance (swiss) - new status 91
Post by: GJC Web Design on July 06, 2016, 12:21:16 PM
it would be just add another case

  case 91:
            //what ever this is
            $this->logInfo('plgVmOnPaymentNotification Postfinance status: ' . $postfinance_status . ' New order status :' . $order['order_status'], 'message');
            //do what ever u need here
            exit();
Title: Re: anybody experience with postfinance (swiss) - new status 91
Post by: dirkb on July 06, 2016, 12:33:28 PM
Thanks ... but here is the point where I´m not sure. Case 9 is "payment" accepted. Case 91 is "offline processing" is actually closer to Case 51 in the postfinance definition ... and here I´m lost .. damn
Title: Re: anybody experience with postfinance (swiss) - new status 91
Post by: GJC Web Design on July 06, 2016, 14:14:19 PM
but it is up to you what you want to use case 91 to do....

apart from the paid ones the others just construct and send an email