| 1 | <?php
|
|---|
| 2 | /* -----------------------------------------------------------------------------------------
|
|---|
| 3 | $Id$
|
|---|
| 4 |
|
|---|
| 5 | modified eCommerce Shopsoftware
|
|---|
| 6 | http://www.modified-shop.org
|
|---|
| 7 |
|
|---|
| 8 | Copyright (c) 2009 - 2013 [www.modified-shop.org]
|
|---|
| 9 | -----------------------------------------------------------------------------------------
|
|---|
| 10 | Released under the GNU General Public License
|
|---|
| 11 | ---------------------------------------------------------------------------------------*/
|
|---|
| 12 |
|
|---|
| 13 | chdir('../../');
|
|---|
| 14 | include('includes/application_top.php');
|
|---|
| 15 |
|
|---|
| 16 | if (!isset($_SESSION['customer_id'])) {
|
|---|
| 17 | die('Currently not available');
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | if (isset($_GET['checkout']) && $_SESSION['payment'] == 'paypalplus') {
|
|---|
| 21 | echo '<script src="https://www.paypalobjects.com/webstatic/ppplus/ppplus.min.js" type="text/javascript"></script>'."\n";
|
|---|
| 22 | echo '<script type="application/javascript">PAYPAL.apps.PPP.doCheckout();</script>'."\n";
|
|---|
| 23 | } elseif (isset($_SESSION['paypal']['approval'])) {
|
|---|
| 24 | require_once(DIR_FS_EXTERNAL.'paypal/classes/PayPalPayment.php');
|
|---|
| 25 |
|
|---|
| 26 | $selection = get_third_party_payments();
|
|---|
| 27 | $paypal = new PayPalPayment('paypalplus');
|
|---|
| 28 |
|
|---|
| 29 | $module = array();
|
|---|
| 30 | if (ACTIVATE_GIFT_SYSTEM == 'true') {
|
|---|
| 31 | require_once (DIR_WS_CLASSES . 'order_total.php');
|
|---|
| 32 | $order_total_modules = new order_total();
|
|---|
| 33 | $credit_selection = $order_total_modules->credit_selection();
|
|---|
| 34 | }
|
|---|
| 35 | if (!isset($credit_selection) || !is_array($credit_selection) || count($credit_selection) < 1) {
|
|---|
| 36 | for ($i = 0, $n = sizeof($selection); $i < $n; $i++) {
|
|---|
| 37 | $description = $paypal->get_config(strtoupper($selection[$i]['id'].'_'.$_SESSION['language_code']));
|
|---|
| 38 | //pfister
|
|---|
| 39 | switch ($selection[$i]['id']) {
|
|---|
| 40 | case "pn_sofortueberweisung":
|
|---|
| 41 | $imageUrl = "https://images.sofort.com/de/su/logo_90x30.png";
|
|---|
| 42 | break;
|
|---|
| 43 | case "eustandardtransfer":
|
|---|
| 44 | $imageUrl = "https://www.peterpfister-schade.de/pferdeartikel/templates/pfister_schade/img/zahlartbutton_vorkasse.png";
|
|---|
| 45 | break;
|
|---|
| 46 | case "cash":
|
|---|
| 47 | $imageUrl = "https://www.peterpfister-schade.de/pferdeartikel/templates/pfister_schade/img/zahlartbutton_bar.png";
|
|---|
| 48 | break;
|
|---|
| 49 | default:
|
|---|
| 50 | $imageUrl ="";
|
|---|
| 51 | }
|
|---|
| 52 | $module[] = array(
|
|---|
| 53 | 'redirectUrl' => $paypal->encode_utf8($paypal->link_encoding(xtc_href_link('callback/paypal/paypalplus_redirect.php', 'payment='.$selection[$i]['id'], 'SSL'))),
|
|---|
| 54 | 'methodName' => $paypal->encode_utf8(strip_tags($selection[$i]['module'])),
|
|---|
| 55 | 'description' => $paypal->encode_utf8(($description != '') ? $description : strip_tags($selection[$i]['description'])),
|
|---|
| 56 | "imageUrl" => $imageUrl
|
|---|
| 57 | );
|
|---|
| 58 | }
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | $country_query = xtc_db_query("SELECT c.countries_iso_code_2
|
|---|
| 62 | FROM ".TABLE_COUNTRIES." c
|
|---|
| 63 | JOIN ".TABLE_ADDRESS_BOOK." ab
|
|---|
| 64 | ON c.countries_id = ab.entry_country_id
|
|---|
| 65 | AND address_book_id = '".$_SESSION['customer_default_address_id']."'");
|
|---|
| 66 | $country = xtc_db_fetch_array($country_query);
|
|---|
| 67 |
|
|---|
| 68 | echo '<div id="ppplus"></div>';
|
|---|
| 69 | echo '<script type="application/javascript">
|
|---|
| 70 | var ppp = PAYPAL.apps.PPP({
|
|---|
| 71 | "approvalUrl": "'.$_SESSION['paypal']['approval'].'",
|
|---|
| 72 | "placeholder": "ppplus",
|
|---|
| 73 | "mode": "'.$paypal->get_config('PAYPAL_MODE').'",
|
|---|
| 74 | "language": "'.$_SESSION['language_code'].'_'.$country['countries_iso_code_2'].'",
|
|---|
| 75 | "country": "'.$country['countries_iso_code_2'].'",
|
|---|
| 76 | "buttonLocation": "outside",
|
|---|
| 77 | "preselection": "paypal",
|
|---|
| 78 | "useraction": "continue",
|
|---|
| 79 | "showLoadingIndicator": "true",
|
|---|
| 80 | "showPuiOnSandbox": "true"';
|
|---|
| 81 |
|
|---|
| 82 | if (count($module) > 0) {
|
|---|
| 83 | echo ','."\n";
|
|---|
| 84 | echo '"onContinue": function() {
|
|---|
| 85 | var check = check_form();
|
|---|
| 86 | if (check == true) {
|
|---|
| 87 | var payment = ppp.getPaymentMethod();
|
|---|
| 88 | if (payment.substring(0, 2) != "pp") {
|
|---|
| 89 | //Pfister
|
|---|
| 90 | $.post("callback/paypal/paypalplus_comments.php", $( "#checkout_payment" ).serialize()).done(function (data) { ppp.doCheckout(); });
|
|---|
| 91 | //ppp.doCheckout();
|
|---|
| 92 | } else {
|
|---|
| 93 | setTimeout("document.checkout_payment.submit()", 10);
|
|---|
| 94 | }
|
|---|
| 95 | }
|
|---|
| 96 | }, ';
|
|---|
| 97 | echo ' "thirdPartyPaymentMethods": '.json_encode($module)."\n";
|
|---|
| 98 | }
|
|---|
| 99 |
|
|---|
| 100 | echo '});
|
|---|
| 101 | </script>'."\n";
|
|---|
| 102 | } else {
|
|---|
| 103 | die('Currently not available');
|
|---|
| 104 | }
|
|---|