File indexing completed on 2024-12-29 05:24:49

0001 <?php
0002 /**
0003  *  ocs-webserver
0004  *
0005  *  Copyright 2016 by pling GmbH.
0006  *
0007  *    This file is part of ocs-webserver.
0008  *
0009  *    This program is free software: you can redistribute it and/or modify
0010  *    it under the terms of the GNU Affero General Public License as
0011  *    published by the Free Software Foundation, either version 3 of the
0012  *    License, or (at your option) any later version.
0013  *
0014  *    This program is distributed in the hope that it will be useful,
0015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *    GNU Affero General Public License for more details.
0018  *
0019  *    You should have received a copy of the GNU Affero General Public License
0020  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021  **/
0022 
0023 if ($this->error) {
0024     echo $this->error_text;
0025 } else {
0026     ?>
0027     <div style="text-align: center;">
0028         <h3>Please wait. We will redirect you to PayPal. </h3>
0029         <p>Or press the Subscribe button:</p>
0030         
0031         <form action="<?= $this->form_endpoint ?>" method="post" target="_top" id="payform">
0032             <input type="hidden" name="cmd" value="_xclick-subscriptions">
0033             <input type="hidden" name="business" value="<?= $this->form_merchant ?>">
0034             <input type="hidden" name="lc" value="US">
0035             <input type="hidden" name="item_name" value="Thank you for supporting opendesktop.org">
0036             <input type="hidden" name="item_number" value="S1">
0037             <input type="hidden" name="no_note" value="1">
0038             <input type="hidden" name="no_shipping" value="1">
0039             <input type="hidden" name="rm" value="1">
0040             <input type="hidden" name="return" value="<?= $this->form_return_url_ok ?>">
0041             <input type="hidden" name="cancel_return" value="<?= $this->form_return_url_cancel ?>">
0042             <input type="hidden" name="notify_url" value="<?= $this->form_ipn_endpoint ?>">
0043             <input type="hidden" name="src" value="1">
0044             <input type="hidden" name="currency_code" value="USD">
0045             <input type="hidden" name="bn" value="PP-SubscriptionsBF:btn_subscribeCC_LG.gif:NonHosted">
0046             <input type="hidden" name="custom" value="<?= $this->transaction_id ?>">
0047             
0048             <?php 
0049                 $amount = $this->amount;
0050                 if($this->payment_option == "Option7") {
0051                     $amount = $this->amount; 
0052                 } else {
0053                     if($this->payment_options[$this->payment_option]['period_short'] == 'M') {
0054                         $amount = $this->calcDonation($this->payment_options[$this->payment_option]['amount']); 
0055                     } else if($this->payment_options[$this->payment_option]['period_short'] == 'Y') {
0056                         $amount = $this->calcDonation($this->payment_options[$this->payment_option]['amount']*12); 
0057                     }
0058                 }
0059             ?>
0060             
0061             <input type="hidden" name="a3" value="<?= $amount ?>">
0062             <input type="hidden" name="p3" value="<?= $this->payment_options[$this->payment_option]['period_frequency'] ?>">
0063             <input type="hidden" name="t3" value="<?= $this->payment_options[$this->payment_option]['period_short'] ?>">
0064             
0065             <p>You choose: $<?= $amount ?> <?= $this->payment_options[$this->payment_option]['period'] ?></p>
0066             <?php if($this->payment_option != "Option7") {?>
0067             <p>
0068                 <?php 
0069                     if($this->payment_options[$this->payment_option]['period_short'] == 'M') {
0070                 ?>
0071                         <span class="extrasmall"><?=$this->calcDonationText($this->payment_options[$this->payment_option]['amount'])?></span>
0072                 <?php 
0073                     } else if($this->payment_options[$this->payment_option]['period_short'] == 'Y') {
0074                 ?>
0075                         <span class="extrasmall"><?=$this->calcDonationYearlyText($this->payment_options[$this->payment_option]['amount'])?></span>
0076                 <?php 
0077                     }
0078                 ?>
0079             </p>
0080             <?php } ?>
0081             
0082             <input type="hidden" name="option_index" value="0">
0083             <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
0084             <img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
0085         </form>
0086 
0087         
0088         
0089     </div>
0090     <script>
0091         //var dgFlow = new PAYPAL.apps.DGFlow({trigger: 'submitBtn'});
0092         
0093        //document.getElementById("payform").submit();
0094        
0095         setTimeout(function () {
0096             document.getElementById("payform").submit();
0097         }, 5000);
0098         
0099         //document.location.href = "<?= $this->checkoutEndpoint ?>?cmd=_ap-payment&paykey=<?= $this->paymentKey ?>";
0100     </script>
0101 <?php } ?>