PageRenderTime 50ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/includes/forms/form_billing_authorize.php

https://gitlab.com/kinopsis/torrecentral
PHP | 252 lines | 198 code | 34 blank | 20 comment | 43 complexity | 493d05e31d5e5ce6cbfdc22107cd1aeb MD5 | raw file
Possible License(s): LGPL-3.0, MIT, Apache-2.0
  1. <?
  2. /*==================================================================*\
  3. ######################################################################
  4. # #
  5. # Copyright 2005 Arca Solutions, Inc. All Rights Reserved. #
  6. # #
  7. # This file may not be redistributed in whole or part. #
  8. # eDirectory is licensed on a per-domain basis. #
  9. # #
  10. # ---------------- eDirectory IS NOT FREE SOFTWARE ----------------- #
  11. # #
  12. # http://www.edirectory.com | http://www.edirectory.com/license.html #
  13. ######################################################################
  14. \*==================================================================*/
  15. # ----------------------------------------------------------------------------------------------------
  16. # * FILE: /includes/forms/form_billing_authorize.php
  17. # ----------------------------------------------------------------------------------------------------
  18. # ----------------------------------------------------------------------------------------------------
  19. # INCLUDE
  20. # ----------------------------------------------------------------------------------------------------
  21. include(EDIRECTORY_ROOT."/conf/payment_authorize.inc.php");
  22. if (AUTHORIZEPAYMENT_FEATURE == "on") {
  23. if (!AUTHORIZE_LOGIN || !AUTHORIZE_TXNKEY) {
  24. echo "<p class=\"errorMessage\">".system_showText(LANG_AUTHORIZE_NO_AVAILABLE)." <a href=\"".DEFAULT_URL."/".MEMBERS_ALIAS."/help.php\" class=\"billing-contact\">".system_showText(LANG_LABEL_ADMINISTRATOR)."</a>.</p>";
  25. } elseif ((AUTHORIZERECURRING_FEATURE == "on") && (!AUTHORIZE_RECURRINGLENGTH || !AUTHORIZE_RECURRINGUNIT)) {
  26. echo "<p class=\"errorMessage\">".system_showText(LANG_AUTHORIZE_NO_AVAILABLE)." <a href=\"".DEFAULT_URL."/".MEMBERS_ALIAS."/help.php\" class=\"billing-contact\">".system_showText(LANG_LABEL_ADMINISTRATOR)."</a>.</p>";
  27. } else {
  28. $block_bannerbyimpression = false;
  29. $block_custominvoice = false;
  30. if ($bill_info["listings"]) foreach ($bill_info["listings"] as $id => $info) {
  31. $listing_ids[] = $id;
  32. $listing_amounts[] = $info["total_fee"];
  33. }
  34. if ($bill_info["events"]) foreach ($bill_info["events"] as $id => $info) {
  35. $event_ids[] = $id;
  36. $event_amounts[] = $info["total_fee"];
  37. }
  38. if ($bill_info["banners"]) foreach ($bill_info["banners"] as $id => $info) {
  39. if ($info["expiration_setting"] == BANNER_EXPIRATION_IMPRESSION) {
  40. $block_bannerbyimpression = true;
  41. }
  42. $banner_ids[] = $id;
  43. $banner_amounts[] = $info["total_fee"];
  44. }
  45. if ($bill_info["classifieds"]) foreach ($bill_info["classifieds"] as $id => $info) {
  46. $classified_ids[] = $id;
  47. $classified_amounts[] = $info["total_fee"];
  48. }
  49. if ($bill_info["articles"]) foreach ($bill_info["articles"] as $id => $info) {
  50. $article_ids[] = $id;
  51. $article_amounts[] = $info["total_fee"];
  52. }
  53. if ($bill_info["custominvoices"]) foreach($bill_info["custominvoices"] as $id => $info) {
  54. $block_custominvoice = true;
  55. $custominvoice_ids[] = $id;
  56. $custominvoice_amounts[] = $info["amount"];
  57. }
  58. $stoppayment = false;
  59. if ((AUTHORIZERECURRING_FEATURE == "on") && (($block_bannerbyimpression) || ($block_custominvoice))) {
  60. echo "<p class=\"errorMessage\">";
  61. if (($block_bannerbyimpression) && ($block_custominvoice)) echo system_showText(LANG_MSG_BANNER_CUSTOM_INVOICE_PAID_ONCE);
  62. elseif ($block_bannerbyimpression) echo system_showText(LANG_MSG_BANNER_PAID_ONCE);
  63. elseif ($block_custominvoice) echo system_showText(LANG_MSG_CUSTOM_INVOICE_PAID_ONCE);
  64. echo "&nbsp;".system_showText(LANG_MSG_PLEASE_DO_NOT_USE_RECURRING_PAYMENT_SYSTEM);
  65. echo "<br /><a href=\"".DEFAULT_URL."/".MEMBERS_ALIAS."/billing/\">".system_showText(LANG_MSG_TRY_AGAIN)."</a>";
  66. echo "</p>";
  67. $stoppayment = true;
  68. }
  69. if (!$stoppayment) {
  70. $contactObj = new Contact(sess_getAccountIdFromSession());
  71. $amount = str_replace(",", ".", $bill_info["total_bill"]);
  72. if ($listing_ids) $listing_ids = implode("::",$listing_ids);
  73. if ($listing_amounts) $listing_amounts = implode("::",$listing_amounts);
  74. if ($event_ids) $event_ids = implode("::",$event_ids);
  75. if ($event_amounts) $event_amounts = implode("::",$event_amounts);
  76. if ($banner_ids) $banner_ids = implode("::",$banner_ids);
  77. if ($banner_amounts) $banner_amounts = implode("::",$banner_amounts);
  78. if ($classified_ids) $classified_ids = implode("::",$classified_ids);
  79. if ($classified_amounts) $classified_amounts = implode("::",$classified_amounts);
  80. if ($article_ids) $article_ids = implode("::",$article_ids);
  81. if ($article_amounts) $article_amounts = implode("::",$article_amounts);
  82. if ($custominvoice_ids) $custominvoice_ids = implode("::",$custominvoice_ids);
  83. if ($custominvoice_amounts) $custominvoice_amounts = implode("::",$custominvoice_amounts);
  84. $authorize_account_id = sess_getAccountIdFromSession();
  85. $authorize_x_first_name = $contactObj->getString("first_name");
  86. $authorize_x_last_name = $contactObj->getString("last_name");
  87. $authorize_x_company = $contactObj->getString("company");
  88. $authorize_x_address = $contactObj->getString("address");
  89. $authorize_x_city = $contactObj->getString("city");
  90. $authorize_x_state = $contactObj->getString("state");
  91. $authorize_x_zip = $contactObj->getString("zip");
  92. $authorize_x_country = $contactObj->getString("country");
  93. $authorize_x_phone = $contactObj->getString("phone");
  94. $authorize_x_email = $contactObj->getString("email");
  95. ?>
  96. <script type="text/javascript">
  97. <!--
  98. function submitOrder() {
  99. document.getElementById("authorizebutton").disabled = true;
  100. document.authorizeform.submit();
  101. }
  102. //-->
  103. </script>
  104. <form name="authorizeform" target="_self" action="<?=DEFAULT_URL?>/<?=MEMBERS_ALIAS?>/<?=$payment_process?>/processpayment.php?payment_method=<?=$payment_method?>" method="post">
  105. <div style="display: none;">
  106. <?
  107. setting_get("payment_tax_status", $payment_tax_status);
  108. setting_get("payment_tax_value", $payment_tax_value);
  109. $subtotal_amount = $amount;
  110. if ($payment_tax_status == "on") {
  111. $tax_amount = payment_calculateTax($subtotal_amount, $payment_tax_value, true, false);
  112. $amount = payment_calculateTax($subtotal_amount, $payment_tax_value);
  113. } else {
  114. $tax_amount = 0;
  115. $payment_tax_value = 0;
  116. }
  117. ?>
  118. <input type="hidden" name="pay" value="1" />
  119. <input type="hidden" name="x_tax_amount" value="<?=$payment_tax_value;?>" />
  120. <input type="hidden" name="x_subtotal_amount" value="<?=$subtotal_amount;?>" />
  121. <input type="hidden" name="x_amount" value="<?=$amount?>" />
  122. <input type="hidden" name="x_invoice_num" value="<?=uniqid(0);?>" />
  123. <input type="hidden" name="x_cust_id" value="<?=$authorize_account_id?>" />
  124. <input type="hidden" name="x_listing_ids" value="<?=$listing_ids?>" />
  125. <input type="hidden" name="x_listing_amounts" value="<?=$listing_amounts?>" />
  126. <input type="hidden" name="x_event_ids" value="<?=$event_ids?>" />
  127. <input type="hidden" name="x_event_amounts" value="<?=$event_amounts?>" />
  128. <input type="hidden" name="x_banner_ids" value="<?=$banner_ids?>" />
  129. <input type="hidden" name="x_banner_amounts" value="<?=$banner_amounts?>" />
  130. <input type="hidden" name="x_classified_ids" value="<?=$classified_ids?>" />
  131. <input type="hidden" name="x_classified_amounts" value="<?=$classified_amounts?>" />
  132. <input type="hidden" name="x_article_ids" value="<?=$article_ids?>" />
  133. <input type="hidden" name="x_article_amounts" value="<?=$article_amounts?>" />
  134. <input type="hidden" name="x_custominvoice_ids" value="<?=$custominvoice_ids?>" />
  135. <input type="hidden" name="x_custominvoice_amounts" value="<?=$custominvoice_amounts?>" />
  136. <input type="hidden" name="x_domain_id" value="<?=SELECTED_DOMAIN_ID?>" />
  137. <input type="hidden" name="x_package_id" value="<?=$package_id?>" />
  138. </div>
  139. <table align="center" width="95%" cellpadding="2" cellspacing="2" class="standard-table payment-authorize">
  140. <tr>
  141. <th colspan="2" class="standard-tabletitle"><?=system_showText(LANG_LABEL_BILLING_INFO);?></th>
  142. </tr>
  143. <tr>
  144. <th>* <?=system_showText(LANG_LABEL_CARD_NUMBER);?>:</th>
  145. <td><input type="text" name="x_card_num" value="" /></td>
  146. </tr>
  147. <tr>
  148. <th>* <?=system_showText(LANG_LABEL_CARD_EXPIRE_DATE);?>:</th>
  149. <td><input type="text" name="x_exp_date" value="" /><span><?=system_showText(LANG_LETTER_MONTH).system_showText(LANG_LETTER_MONTH)."/".system_showText(LANG_LETTER_YEAR).system_showText(LANG_LETTER_YEAR);?></span></td>
  150. </tr>
  151. <tr>
  152. <th><?=system_showText(LANG_LABEL_CARD_CODE);?>:</th>
  153. <td><input type="text" name="x_card_code" value="" /></td>
  154. </tr>
  155. <tr>
  156. <th colspan="2" class="standard-tabletitle"><?=system_showText(LANG_LABEL_CUSTOMER_INFO);?></td>
  157. </tr>
  158. <tr>
  159. <th><?=system_showText(LANG_LABEL_FIRST_NAME);?>:</th>
  160. <td><input type="text" name="x_first_name" value="<?=$authorize_x_first_name?>" /></td>
  161. </tr>
  162. <tr>
  163. <th><?=system_showText(LANG_LABEL_LAST_NAME);?>:</th>
  164. <td><input type="text" name="x_last_name" value="<?=$authorize_x_last_name?>" /></td>
  165. </tr>
  166. <tr>
  167. <th><?=system_showText(LANG_LABEL_COMPANY);?>:</th>
  168. <td><input type="text" name="x_company" value="<?=$authorize_x_company?>" /></td>
  169. </tr>
  170. <tr>
  171. <th><?=system_showText(LANG_LABEL_ADDRESS);?>:</th>
  172. <td><input type="text" name="x_address" value="<?=$authorize_x_address?>" /></td>
  173. </tr>
  174. <tr>
  175. <th><?=system_showText(LANG_LABEL_CITY)?>:</th>
  176. <td><input type="text" name="x_city" value="<?=$authorize_x_city?>" /></td>
  177. </tr>
  178. <tr>
  179. <th><?=system_showText(LANG_LABEL_STATE)?>:</th>
  180. <td><input type="text" name="x_state" value="<?=$authorize_x_state?>" /></td>
  181. </tr>
  182. <tr>
  183. <th><?= string_ucwords(system_showText(LANG_LABEL_ZIP))?>:</th>
  184. <td><input type="text" name="x_zip" value="<?=$authorize_x_zip?>" /></td>
  185. </tr>
  186. <tr>
  187. <th><?=system_showText(LANG_LABEL_COUNTRY)?>:</th>
  188. <td><input type="text" name="x_country" value="<?=$authorize_x_country?>" /></td>
  189. </tr>
  190. <tr>
  191. <th><?=system_showText(LANG_LABEL_PHONE)?>:</th>
  192. <td><input type="tel" name="x_phone" value="<?=$authorize_x_phone?>" /></td>
  193. </tr>
  194. <tr>
  195. <th><?=system_showText(LANG_LABEL_EMAIL);?>:</th>
  196. <td><input type="email" name="x_email" value="<?=$authorize_x_email?>" /></td>
  197. </tr>
  198. </table>
  199. <?
  200. if (AUTHORIZERECURRING_FEATURE == "on") {
  201. echo "<p class=\"informationMessage\">";
  202. echo system_showText(LANG_MSG_RECURRINGUNTILCARDEXPIRATION)." (".system_showText(LANG_MSG_RECURRINGUNTILCARDEXPIRATIONMAXOF).").";
  203. echo "</p>";
  204. }
  205. ?>
  206. <? if ($payment_process == "signup") {
  207. $buttonGateway = "<button type=\"button\" id=\"authorizebutton\" onclick=\"submitOrder();\">".system_highlightWords(system_showText(LANG_LABEL_PLACE_ORDER_CONTINUE))."</button>";
  208. } else { ?>
  209. <p class="standardButton paymentButton">
  210. <button type="button" id="authorizebutton" onclick="submitOrder();"><?=system_showText(LANG_BUTTON_PAY_BY_CREDIT_CARD);?></button>
  211. </p>
  212. <? } ?>
  213. </form>
  214. <?
  215. }
  216. }
  217. }
  218. ?>