public function Notify(AbstractPaymentModule $PaymentModule, $status) { Log::Log("UIPaymentObserver: received notify", E_USER_NOTICE); if ($status == PAYMENT_STATUS::SUCCESS) { $GLOBALS["okmsg"] = _("Thank you for your payment!"); if (!$_SESSION["success_payment_redirect_url"]) CoreUtils::Redirect("inv_view.php"); else CoreUtils::Redirect($_SESSION["success_payment_redirect_url"]); } elseif ($status == PAYMENT_STATUS::FAILURE) { $PaymentForm = $PaymentModule->GetPaymentForm(); $smarty = Core::GetSmartyInstance("SmartyExt"); $fields = $PaymentForm->ListFields(); $smarty_fields = array(); foreach($fields as $field) { $smarty_fields[$field->Title] = array("name" => $field->Name, "required" => $field->IsRequired, "type" => $field->FieldType, "values" => $field->Options); if ($_REQUEST[$field->Name]) $attr[$field->Title] = $_REQUEST[$field->Name]; } $display["errmsg"] = "The following errors occured"; $display["err"] = explode("\n", $PaymentModule->GetFailureReason()); $display["gate"] = $PaymentModule->GetModuleName(); $display["orderid"] = $PaymentModule->GetOrderID(false); $display["fields"] = $smarty_fields; $display["post"] = $attr; $template_name = "client/paymentdata.tpl"; $smarty->assign($GLOBALS["display"]); $smarty->assign($display); $smarty->display($template_name); } else throw new Exception(sprintf(_("Undefined PaymentStatus received from %s payment module."), $PaymentModule->GetModuleName()), E_USER_ERROR); }
function Notify(AbstractPaymentModule $PaymentModule, $status) { global $PaymentModuleFactory; if ($status == PAYMENT_STATUS::SUCCESS) { UI::Redirect("payment_success.php?op=".$_SESSION['wizard']['whois']["operation"]); } else { $smarty = Core::GetSmartyInstance("SmartyExt"); $PaymentForm = $PaymentModule->GetPaymentForm(); $payment_module = $PaymentModuleFactory->GetModuleObjectByName($_SESSION['wizard']['checkout']["gate"]); $fields = $PaymentForm->ListFields(); $smarty_fields = array(); foreach($fields as $field) { $smarty_fields[$field->Title] = array("name" => $field->Name, "required" => $field->IsRequired, "type" => $field->FieldType, "values" => $field->Options); if ($_REQUEST[$field->Name]) $attr[$field->Title] = $_REQUEST[$field->Name]; } $display["errors"] = explode("\n", $PaymentModule->GetFailureReason()); $display["fields"] = $smarty_fields; $display["post"] = $attr; $display['phone_widget'] = Phone::GetInstance()->GetWidget(); $template_name = "paymentgate.tpl"; $smarty->assign($GLOBALS["display"]); $smarty->assign($display); $smarty->display($template_name); } }