Esempio n. 1
0
 public function init()
 {
     if (isset($_POST['payNewBillPayment'])) {
         $payment = new Payment();
         $payment->cancelSessions();
         unset($_POST['payNewBillPayment']);
     }
     $accounts = new Accounts();
     $accounts->userID = $_SESSION['userID'];
     $_SESSION['accounts'] = $accounts->getAccounts();
     $billers = new Billers();
     $billers->userID = $_SESSION['userID'];
     $_SESSION['billers'] = $billers->getBillers();
 }
Esempio n. 2
0
 public function init()
 {
     $payment = new Payment();
     $payment->cancelSessions();
     if (isset($_SESSION['billPayee']) || isset($_SESSION['billPayeeList'])) {
         $billers = new BillerPayees();
         $billers->userID = $_SESSION['userID'];
         $_SESSION['payeeList'] = $billers->getBillersList();
     } elseif (isset($_SESSION['fundsTransferPayee']) || isset($_SESSION['fundsTransferPayeeList'])) {
         $payees = new BillerPayees();
         $payees->userID = $_SESSION['userID'];
         $_SESSION['payeeList'] = $payees->getPayeesList();
     } elseif (isset($_SESSION['allPayeeList'])) {
         $both = new BillerPayees();
         $both->userID = $_SESSION['userID'];
         $_SESSION['payeeList'] = $both->getBothList();
     }
 }
Esempio n. 3
0
 public function searchResults($search)
 {
     $payment = new Payment();
     $payment->cancelSessions();
     $billerPayees = new BillerPayees();
     $billerPayees->userID = $_SESSION['userID'];
     switch ($search['paymentType']) {
         case 'All Payment Types':
             $_SESSION['allPaymentList'] = 'selected="selected"';
             $_SESSION['payees'] = $billerPayees->getBoth();
             unset($_SESSION['billPaymentList']);
             unset($_SESSION['fundsTransferPaymentList']);
             break;
         case 'Bill Payment':
             unset($_SESSION['allPaymentList']);
             $_SESSION['billPaymentList'] = 'selected="selected"';
             $_SESSION['payees'] = $billerPayees->getBillers();
             unset($_SESSION['fundsTransferPaymentList']);
             break;
         case 'Funds Transfer':
             unset($_SESSION['allPaymentList']);
             unset($_SESSION['billPaymentList']);
             $_SESSION['fundsTransferPaymentList'] = 'selected="selected"';
             $_SESSION['payees'] = $billerPayees->getPayees();
             break;
     }
     $accounts = new Accounts();
     $accounts->userID = $_SESSION['userID'];
     $_SESSION['accounts'] = $accounts->getAccounts();
     $_SESSION['accountID'] = $search['accountID'];
     $this->setAccountSelected($_SESSION['accountID']);
     $_SESSION['payListName'] = $search['payListName'];
     $_SESSION['payListStatus'] = $search['payListStatus'];
     $_SESSION['payListFromAmount'] = $search['payListFromAmount'];
     $_SESSION['payListToAmount'] = $search['payListToAmount'];
     $_SESSION['payListFromDate'] = $search['payListFromDate'];
     $_SESSION['payListToDate'] = $search['payListToDate'];
     $this->getPayments();
 }
 public function display()
 {
     if (isset($_POST['next'])) {
         unset($_POST['next']);
         // To prevent unwarranted use of browser back button.
         if (!isset($_SESSION['payAccountID'])) {
             header('Location: New-Bill-Payment');
         }
         // Process on submission of password.
         if (isset($_POST['password'])) {
             $validate = new Validation();
             // Validate the password.
             try {
                 $validate->password($_POST['password']);
             } catch (ValidationException $e) {
                 $_SESSION['error'] = $e->getError();
             }
             if (isset($_SESSION['error'])) {
                 unset($_POST['password']);
                 header('Location: Bill-Payment-Amount');
             } else {
                 $user = new Users();
                 $user->userID = $_SESSION['userID'];
                 $user->password = $_POST['password'];
                 unset($_POST['password']);
                 // Check for a password match.
                 try {
                     $user->confirmPassword();
                 } catch (ValidationException $e) {
                     $_SESSION['error'] = $e->getError();
                 }
                 if (isset($_SESSION['error'])) {
                     header('Location: Bill-Payment-Amount');
                 } else {
                     // Process the payment.
                     $account = new Account();
                     $account->accountID = $_SESSION['payAccountID'];
                     if ($account->processPayment()) {
                         // Display the Acknowledgement Page.
                         $paymentack = new Paymentack();
                         $paymentack->init();
                         include 'view/layout/paymentack.php';
                         unset($_SESSION['payCreated']);
                         unset($_SESSION['payDate']);
                         unset($_SESSION['payAccountID']);
                         unset($_SESSION['payAmount']);
                         unset($_SESSION['payStatus']);
                         unset($_SESSION['payConf']);
                         unset($_SESSION['payAccount']);
                         unset($_SESSION['payBillerCode']);
                         unset($_SESSION['payBillerName']);
                         unset($_SESSION['payBillerNickname']);
                         unset($_SESSION['payCustomerRef']);
                     } else {
                         // Display the Payment Confirmation Page.
                         $paymentconf = new Paymentconf();
                         $paymentconf->init();
                         include 'view/layout/paymentconf.php';
                     }
                 }
             }
         }
         // Cancel the Payment
     } else {
         if (isset($_POST['cancel'])) {
             unset($_POST['cancel']);
             $payment = new Payment();
             $payment->cancelSessions();
             // Return to the Payment Page.
             $payment->init();
             include 'view/layout/payment.php';
         } else {
             // For any other reason, return to the Payment page.
             $payment = new Payment();
             $payment->init();
             include 'view/layout/payment.php';
         }
     }
 }
 public function display()
 {
     // Process if posted to from the Payment Amount Page.
     if (isset($_POST['next'])) {
         unset($_POST['next']);
         // In the event the back button is hit on the browser
         // after the transaction has been processed.
         if (!isset($_SESSION['payBillerCode']) || !isset($_SESSION['payBillerName']) || !isset($_SESSION['payBillerNickname'])) {
             header("Location: New-Bill-Payment");
         }
         if (isset($_POST['account'])) {
             $_SESSION['payAccountID'] = $_POST['account'];
             unset($_POST['account']);
         }
         $validate = new Validation();
         if (isset($_POST['custref'])) {
             // Validate the customer reference.
             try {
                 $custref = $_POST['custref'];
                 unset($_POST['custref']);
                 $validate->custref($custref);
             } catch (ValidationException $e) {
                 $_SESSION['error'] = $e->getError();
             }
             if (isset($_SESSION['error'])) {
                 $custref = null;
                 unset($_POST['next']);
                 header('Location: Bill-Payment-Amount');
             } else {
                 $_SESSION['payCustomerRef'] = $custref;
                 if (isset($_POST['amount'])) {
                     // Validate the amount.
                     try {
                         $amount = $_POST['amount'];
                         unset($_POST['amount']);
                         $validate->payAmount($amount);
                     } catch (ValidationException $e) {
                         $_SESSION['error'] = $e->getError();
                     }
                     if (isset($_SESSION['error'])) {
                         $amount = null;
                         unset($_POST['next']);
                         header('Location: Bill-Payment-Amount');
                     } else {
                         $_SESSION['payAmount'] = $amount;
                         if (isset($_POST['paymentDate'])) {
                             // Validate the date.
                             try {
                                 $paymentDate = $_POST['paymentDate'];
                                 unset($_POST['paymentDate']);
                                 $validate->payDate($paymentDate);
                             } catch (ValidationException $e) {
                                 $_SESSION['error'] = $e->getError();
                             }
                             if (isset($_SESSION['error'])) {
                                 $paymentDate = null;
                                 unset($_POST['next']);
                                 header('Location: Bill-Payment-Amount');
                             } else {
                                 // If all is OK, display the Payment Confirmation Page.
                                 $_SESSION['payDate'] = $paymentDate;
                                 $paymentconf = new Paymentconf();
                                 $paymentconf->init();
                                 include 'view/layout/paymentconf.php';
                             }
                         }
                     }
                 }
             }
         }
         // Cancel the Payment
     } else {
         if (isset($_POST['cancel'])) {
             unset($_POST['cancel']);
             $payment = new Payment();
             $payment->cancelSessions();
             $payment->init();
             include 'view/layout/payment.php';
         } else {
             // For any other reason, display the Payment Page.
             $payment = new Payment();
             $payment->cancelSessions();
             $payment->init();
         }
     }
 }