Plugin Directory

Changeset 1542060


Ignore:
Timestamp:
11/28/2016 03:11:03 PM (9 years ago)
Author:
datenwerk
Message:

Bugfix: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data (WC 2.3.6 and higher)

Location:
woocommerce-mpay24-gateway/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • woocommerce-mpay24-gateway/trunk/MPay24/MDXI.xsd

    r1034503 r1542060  
    5858      <xs:enumeration value="KLARNA"/>
    5959      <xs:enumeration value="SOFORT"/>
     60      <xs:enumeration value="MASTERPASS"/>
    6061    </xs:restriction>
    6162  </xs:simpleType>
     
    8687      <xs:enumeration value="INVOICE"/>
    8788      <xs:enumeration value="HP"/>
     89      <xs:enumeration value="INTERNATIONAL"/>
     90      <xs:enumeration value="MASTERPASS"/>
     91    </xs:restriction>
     92  </xs:simpleType>
     93  <xs:simpleType name="PaymentSubBrandType">
     94    <xs:restriction base="xs:string">
     95      <xs:maxLength value="3"/>
     96      <xs:pattern value="[0-9]{1,3}"/>
    8897    </xs:restriction>
    8998  </xs:simpleType>
    9099  <xs:simpleType name="PriceType">
    91100    <xs:restriction base="xs:float">
    92       <xs:pattern value="-?\d{1,9}\.\d{2}|-?\d{1,9}"/>
     101      <xs:pattern value="\-?\d{1,9}(\.\d{2})?"/>
    93102    </xs:restriction>
    94103  </xs:simpleType>
     
    272281                  <xs:attribute name="Type" type="PaymentTypeType" use="required"/>
    273282                  <xs:attribute name="Brand" type="PaymentBrandType"/>
     283                  <xs:attribute name="SubBrand" type="PaymentSubBrandType"/>
    274284                </xs:complexType>
    275285              </xs:element>
  • woocommerce-mpay24-gateway/trunk/gateway-mpay24.php

    r1034503 r1542060  
    541541
    542542                $shop->setSuccessUrl( $this->get_return_url( $order ) ); // thank you page
    543                 $shop->setErrorUrl( $order->get_cancel_order_url() ); // failed orders will also be marked as cancelled
    544                 $shop->setCancelUrl( $order->get_cancel_order_url() );
     543                if( version_compare( $woocommerce->version, '2.3.6', '>=' ) ) {
     544                    $shop->setErrorUrl( $order->get_cancel_order_url_raw() ); // failed orders will also be marked as cancelled
     545                    $shop->setCancelUrl( $order->get_cancel_order_url_raw() );
     546                }
     547                else {
     548                    $shop->setErrorUrl( $this->get_cancel_order_url_raw($order) ); // failed orders will also be marked as cancelled
     549                    $shop->setCancelUrl( $this->get_cancel_order_url_raw($order) );
     550                }
    545551                $shop->setConfirmUrl( $this->protect_url( $this->notify_url ) );
    546552
     
    570576                    'redirect' => $result->getLocation()
    571577                );
     578            }
     579           
     580            /**
     581            * Generates a raw (unescaped) cancel-order URL for use by payment gateways.
     582            * code adapted from woocommerce version >= 2.3.6 for plugin usage with lower woocommerce versions
     583            *
     584            * @param object $order
     585            * @param string $redirect
     586            * @return string The unescaped cancel-order URL.
     587            */
     588            public function get_cancel_order_url_raw( $order, $redirect = '' ) {
     589                $cancel_endpoint = wc_get_page_permalink( 'cart' );
     590                if ( ! $cancel_endpoint ) {
     591                    $cancel_endpoint = home_url();
     592                }
     593
     594                if ( false === strpos( $cancel_endpoint, '?' ) ) {
     595                    $cancel_endpoint = trailingslashit( $cancel_endpoint );
     596                }
     597
     598                return apply_filters('woocommerce_get_cancel_order_url_raw', add_query_arg( array(
     599                    'cancel_order' => 'true',
     600                    'order'        => $order->order_key,
     601                    'order_id'     => $order->id,
     602                    'redirect'     => $redirect
     603                ), $cancel_endpoint ) );
    572604            }
    573605
  • woocommerce-mpay24-gateway/trunk/readme.txt

    r1034503 r1542060  
    55Tags: woocommerce, gateway, mpay24
    66Requires at least: 3.5
    7 Tested up to: 4.0.1
    8 Stable tag: 1.5.1
     7Tested up to: 4.6.1
     8Stable tag: 1.5.2
    99License: GNU General Public License v3.0
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    1616= Features =
    1717
    18 * Uses mPAY24 PHP files (version 2013-06-24), follows mPAY24 SOAP Specification (version 2014-09-12)
     18* Uses mPAY24 PHP files (version 2013-06-24), follows mPAY24 SOAP Specification
    1919* Using the mPAY24 payment page to integrate in website
    2020* Switching between DEV and PROD mPAY24 environment with SOAP logins
     
    2929= mPAY24 =
    3030
    31 If there are newer mPAY24 PHP Files you can replace the files in the folder `MPay24`.
     31If there are newer mPAY24 PHP Files you can replace the files in the folder `MPay24`. But don't use the current PHP SDK from Github.
    3232If you want to extend the functionality you have to edit `class-wc-mpay24-shop.php`
    3333
     
    4040* DOM (mPAY24 API)
    4141* Mcrypt (mPAY24 API)
    42 * [WooCommerce Plugin](http://www.woothemes.com/woocommerce/) v2.0 or higher
     42* [WooCommerce Plugin](http://www.woothemes.com/woocommerce/) v2.1 or higher
    4343
    4444= Manual installation =
     
    7676
    7777== Changelog ==
     78
     79= 1.5.2 - 2016-11-28 =
     80
     81* Bugfix: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data (WC 2.3.6 and higher), (thanks to [jbugella](https://profiles.wordpress.org/jbugella) for bugfix)
    7882
    7983= 1.5.1 - 2014-11-28 =
Note: See TracChangeset for help on using the changeset viewer.