<p class="instructions"> <?php foreach ($_SESSION['result'] as $code => $message) { echo $code . ' : ' . $message; } ?> </p> <?php } else { ?> <h2 class="main">Transaction completed</h2> <section id="step3"> <p class="instructions">Confirmation number : <?php echo $_SESSION['result']; ?> </p> <?php } ?> <footer></footer> </section> </div> </section> </div> </div> </div> </body> </html> <?php clean_order();
function actionConfirm() { global $configuration; $errors = array(); if ($_SESSION['Creditcard']['CardType'] == 'Paypal') { $result = sendPaypalRequest(); if (is_array($result)) { update_order('status', 'Refused'); } else { $token = $result; update_order('token', $token); clean_order(); $paypalUrl = $configuration['paypal']['paypalUrl'] . '/webscr&cmd=_express-checkout&useraction=commit&token=' . $token; header('Location: ' . $paypalUrl); exit; } } else { $guid = $_SESSION['uid']; if (!isset($_SESSION['orderWaiting'])) { $_SESSION['orderWaiting'] = true; update_order('status', 'Waiting'); $result = sendCreditRequest(); if (is_array($result)) { update_order('status', 'Refused'); } else { $transactionId = $result; $_SESSION['transaction_id'] = $transactionId; update_order('transaction_id', $transactionId); update_order('status', 'Completed'); } } else { $result[] = 'Transaction Treated'; } } if (is_array($result)) { $_SESSION['orderWaiting'] = true; } return $result; }