Exemplo n.º 1
0
             $user->user['balance'] += $credit;
             $user->persist();
         }
     }
     if ($_POST['payment_status'] == 'Pending') {
         $reason = $_POST['pending_reason'];
         //for notification
     }
     $fields = array("amount" => $_POST['mc_gross'], "timestamp" => time(), "method" => "paypal", "status" => $paymentStatus, "txn_id" => $_POST['txn_id'], "users_LOGIN" => $_POST['custom'], "charset" => $_POST['charset'], "comments" => $responseText, "lessons" => $lessonIds, "courses" => $courseIds);
     if (!isset($processedPayments[$_POST['txn_id']])) {
         $payment = payments::create($fields);
         if ($couponIds) {
             $coupon = new coupons($couponIds);
             is_array($lessonIds) or $lessonIds = array();
             is_array($courseIds) or $courseIds = array();
             $coupon->useCoupon($user, $payment, array('lessons' => $lessonIds, 'courses' => $courseIds));
         }
     } else {
         $result = eF_getTableData("payments", "id", "txn_id='" . $_POST['txn_id'] . "'");
         $payment = new payments($result[0]['id']);
         $payment->payments = array_merge($payment->payments, $fields);
         $payment->persist();
     }
 } else {
     if (strcmp($res, "INVALID") == 0) {
         $responseText = '';
         foreach ($_POST as $key => $value) {
             $responseText .= $key . " = " . $value . "\n";
         }
         file_put_contents($logFile, "Live-INVALID IPN\n" . $logText . "\n\n" . $req, FILE_APPEND);
     }
Exemplo n.º 2
0
                     $fields = array("amount" => $totalPrice, "timestamp" => time(), "method" => "free", "status" => "completed", "users_LOGIN" => $currentUser->user['login'], "lessons" => $nonFreeLessons, "courses" => $nonFreeCourses);
                     $payment = payments::create($fields);
                 } else {
                     //Assign new lessons as inactive
                     if (sizeof($nonFreeLessons) > 0) {
                         $currentUser->addLessons($nonFreeLessons, array_fill(0, sizeof($nonFreeLessons), 'student'), false);
                     }
                     if (sizeof($nonFreeCourses) > 0) {
                         $currentUser->addCourses($nonFreeCourses, array_fill(0, sizeof($nonFreeCourses), 'student'), false);
                     }
                     $message = _ADMINISTRATORCONFIRMENROLLED;
                     $fields = array("amount" => $totalPrice, "timestamp" => time(), "method" => "manual", "status" => "completed", "users_LOGIN" => $currentUser->user['login'], "lessons" => $nonFreeLessons, "courses" => $nonFreeCourses);
                     $payment = payments::create($fields);
                 }
                 if ($coupon) {
                     $coupon->useCoupon($currentUser, $payment, array('lessons' => $nonFreeLessons, 'courses' => $nonFreeCourses));
                 }
             }
         }
         cart::storeCart($cart);
         if (basename($_SERVER['PHP_SELF']) == 'index.php') {
             eF_redirect($_SESSION['s_type'] . "page.php?ctg=lessons&message=" . rawurlencode($message) . "&message_type=success");
         } else {
             eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=lessons&message=" . rawurlencode($message) . "&message_type=success");
         }
     } catch (Exception $e) {
         handleNormalFlowExceptions($e);
     }
 }
 $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
 $form->accept($renderer);