index.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <?php include('header.php') ?>
  2. <?php
  3. require_once 'PayfortIntegration.php';
  4. $objFort = new PayfortIntegration();
  5. $amount = $objFort->amount;
  6. $currency = $objFort->currency;
  7. $totalAmount = $amount;
  8. ?>
  9. <section class="nav">
  10. <ul>
  11. <li class="active lead"> Payment Method</li>
  12. <li class="lead"> Pay</li>
  13. <li class="lead"> Done</li>
  14. </ul>
  15. </section>
  16. <section class="order-info">
  17. <ul class="items">
  18. <span>
  19. <i class="icon icon-bag"></i>
  20. <label class="lead" for="">Your Order</label>
  21. </span>
  22. <li><?php echo $objFort->itemName ?></li>
  23. <!-- <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit. A ex magni delectus aliquam debitis</li> -->
  24. </ul>
  25. <ul>
  26. <li>
  27. <div class="v-seperator"></div>
  28. </li>
  29. </ul>
  30. <ul class="price">
  31. <span>
  32. <i class="icon icon-tag"></i>
  33. <label class="lead" for="">price</label>
  34. </span>
  35. <li><span class="curreny">$</span> <?php echo sprintf("%.2f",$totalAmount);?> </li>
  36. </ul>
  37. </section>
  38. <div class="h-seperator"></div>
  39. <section class="payment-method">
  40. <label class="lead" for="">
  41. Choose a Payment Method <small>(click one of the options below)</small>
  42. </label>
  43. <ul>
  44. <li>
  45. <input id="po_creditcard" type="radio" name="payment_option" value="creditcard" checked="checked" style="display: none">
  46. <label class="payment-option active" for="po_creditcard">
  47. <img src="assets/img/cc.png" alt="">
  48. <span class="name">Pay with credit cards (Redirection)</span>
  49. <em class="seperator hidden"></em>
  50. <div class="demo-container hidden"> <!-- Area for the iframe section -->
  51. <iframe src="" frameborder="0"></iframe>
  52. </div>
  53. </label>
  54. </li>
  55. <li>
  56. <input id="po_cc_merchantpage" type="radio" name="payment_option" value="cc_merchantpage" style="display: none">
  57. <label class="payment-option" for="po_cc_merchantpage">
  58. <img src="assets/img/cc.png" alt="">
  59. <span class="name">Pay with credit cards (Merchant Page)</span>
  60. <em class="seperator hidden"></em>
  61. <div class="demo-container hidden"> <!-- Area for the iframe section -->
  62. <iframe src="" frameborder="0"></iframe>
  63. </div>
  64. </label>
  65. </li>
  66. <li>
  67. <input id="po_cc_merchantpage2" type="radio" name="payment_option" value="cc_merchantpage2" style="display: none">
  68. <label class="payment-option" for="po_cc_merchantpage2">
  69. <img src="assets/img/cc.png" alt="">
  70. <span class="name">Pay with credit cards (Merchant Page 2.0)</span>
  71. <em class="seperator hidden"></em>
  72. </label>
  73. <div class="details well" style="display: none;">
  74. <form id="frm_payfort_payment_merchant_page2" class="form-horizontal">
  75. <div class="form-group">
  76. <label class="col-sm-3 control-label" for="payfort_fort_mp2_card_holder_name">Name on Card</label>
  77. <div class="col-sm-9">
  78. <input type="text" class="form-control" name="card_holder_name" id="payfort_fort_mp2_card_holder_name" placeholder="Card Holder's Name" maxlength="50">
  79. </div>
  80. </div>
  81. <div class="form-group">
  82. <label class="col-sm-3 control-label" for="payfort_fort_mp2_card_number">Card Number</label>
  83. <div class="col-sm-9">
  84. <input type="text" class="form-control" name="card)number" id="payfort_fort_mp2_card_number" placeholder="Debit/Credit Card Number" maxlength="16">
  85. </div>
  86. </div>
  87. <div class="form-group">
  88. <label class="col-sm-3 control-label" for="payfort_fort_mp2_expiry_month">Expiration Date</label>
  89. <div class="col-sm-9">
  90. <div class="row">
  91. <div class="col-xs-3">
  92. <select class="form-control col-sm-2" name="expiry_month" id="payfort_fort_mp2_expiry_month">
  93. <option value="01">Jan (01)</option>
  94. <option value="02">Feb (02)</option>
  95. <option value="03">Mar (03)</option>
  96. <option value="04">Apr (04)</option>
  97. <option value="05">May (05)</option>
  98. <option value="06">June (06)</option>
  99. <option value="07">July (07)</option>
  100. <option value="08">Aug (08)</option>
  101. <option value="09">Sep (09)</option>
  102. <option value="10">Oct (10)</option>
  103. <option value="11">Nov (11)</option>
  104. <option value="12">Dec (12)</option>
  105. </select>
  106. </div>
  107. <div class="col-xs-3">
  108. <select class="form-control" name="expiry_year" id="payfort_fort_mp2_expiry_year">
  109. <?php
  110. $today = getdate();
  111. $year_expire = array();
  112. for ($i = $today['year']; $i < $today['year'] + 11; $i++) {
  113. $year_expire[] = array(
  114. 'text' => strftime('%Y', mktime(0, 0, 0, 1, 1, $i)),
  115. 'value' => strftime('%y', mktime(0, 0, 0, 1, 1, $i))
  116. );
  117. }
  118. ?>
  119. <?php
  120. foreach($year_expire as $year) {
  121. echo "<option value={$year['value']}>{$year['text']}</option>";
  122. }
  123. ?>
  124. </select>
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. <div class="form-group">
  130. <label class="col-sm-3 control-label" for="payfort_fort_mp2_cvv">Card CVV</label>
  131. <div class="col-sm-3">
  132. <input type="text" class="form-control" name="cvv" id="payfort_fort_mp2_cvv" placeholder="Security Code" maxlength="4">
  133. </div>
  134. </div>
  135. </form>
  136. </div>
  137. </li>
  138. <li>
  139. <input id="po_installments" type="radio" name="payment_option" value="installments" style="display: none">
  140. <label class="payment-option" for="po_installments">
  141. <img src="assets/img/installment.png" alt="">
  142. <span class="name"> Pay with installments (Redirection)</span>
  143. <em class="seperator hidden"></em>
  144. </label>
  145. </li>
  146. <li>
  147. <input id="po_installments_merchantpage" type="radio" name="payment_option" value="installments_merchantpage" style="display: none">
  148. <label class="payment-option" for="po_installments_merchantpage">
  149. <img src="assets/img/installment.png" alt="">
  150. <span class="name"> Pay with installments (Merchant Page)</span>
  151. <em class="seperator hidden"></em>
  152. </label>
  153. </li>
  154. <li>
  155. <input id="po_naps" type="radio" name="payment_option" value="naps" style="display: none">
  156. <label class="payment-option" for="po_naps">
  157. <img src="assets/img/naps.png" alt="">
  158. <span class="name">Pay with NAPS</span>
  159. <em class="seperator hidden"></em>
  160. </label>
  161. </li>
  162. <li>
  163. <input id="po_sadad" type="radio" name="payment_option" value="sadad" style="display: none">
  164. <label class="payment-option" for="po_sadad">
  165. <img src="assets/img/sadaad.png" alt="">
  166. <span class="name">Pay with SADAD</span>
  167. <em class="seperator hidden"></em>
  168. </label>
  169. </li>
  170. </ul>
  171. </section>
  172. <div class="h-seperator"></div>
  173. <section class="actions">
  174. <a class="back" href="#">Back</a>
  175. <a class="continue" id="btn_continue" href="javascript:void(0)">Continue</a>
  176. </section>
  177. <script type="text/javascript" src="vendors/jquery.min.js"></script>
  178. <script type="text/javascript" src="assets/js/jquery.creditCardValidator.js"></script>
  179. <script type="text/javascript" src="assets/js/checkout.js"></script>
  180. <script type="text/javascript">
  181. $(document).ready(function () {
  182. $('input:radio[name=payment_option]').click(function () {
  183. $('input:radio[name=payment_option]').each(function () {
  184. if ($(this).is(':checked')) {
  185. $(this).addClass('active');
  186. $(this).parent('li').children('label').css('font-weight', 'bold');
  187. $(this).parent('li').children('div.details').show();
  188. }
  189. else {
  190. $(this).removeClass('active');
  191. $(this).parent('li').children('label').css('font-weight', 'normal');
  192. $(this).parent('li').children('div.details').hide();
  193. }
  194. });
  195. });
  196. $('#btn_continue').click(function () {
  197. var paymentMethod = $('input:radio[name=payment_option]:checked').val();
  198. if(paymentMethod == '' || paymentMethod === undefined || paymentMethod === null) {
  199. alert('Pelase Select Payment Method!');
  200. return;
  201. }
  202. if(paymentMethod == 'cc_merchantpage' || paymentMethod == 'installments_merchantpage') {
  203. window.location.href = 'confirm-order.php?payment_method='+paymentMethod;
  204. }
  205. if(paymentMethod == 'cc_merchantpage2') {
  206. var isValid = payfortFortMerchantPage2.validateCcForm();
  207. if(isValid) {
  208. getPaymentPage(paymentMethod);
  209. }
  210. }
  211. else{
  212. getPaymentPage(paymentMethod);
  213. }
  214. });
  215. });
  216. </script>
  217. <?php include('footer.php') ?>