Plugin Directory

Changeset 696575


Ignore:
Timestamp:
04/12/2013 01:44:49 PM (13 years ago)
Author:
datenwerk
Message:

2013-04-12: Update to WooCommerce 2.x
plugin not backward compatible to WooCommerce version < 2.0
update mPAY24 API to current version
add some documentation for styling options of the mPAY24 payment page

Location:
woocommerce-mpay24-gateway
Files:
50 added
11 edited

Legend:

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

    r636654 r696575  
    143143                        <xs:enumeration value="PAYPAL"/>
    144144                        <xs:enumeration value="MPASS"/>
     145                        <xs:enumeration value="INVOICE"/>
     146                        <xs:enumeration value="HP"/>
     147                        <xs:enumeration value="SAFETYPAY"/>
    145148                      </xs:restriction>
    146149                    </xs:simpleType>
     
    154157                        <xs:enumeration value="VISA"/>
    155158                        <xs:enumeration value="JCB"/>
     159                        <xs:enumeration value="BANK-BGLD"/>
    156160                        <xs:enumeration value="BAWAG"/>
    157161                        <xs:enumeration value="BA"/>
     
    168172                        <xs:enumeration value="HOBEX-DE"/>
    169173                        <xs:enumeration value="HOBEX-NL"/>
     174                        <xs:enumeration value="BILLPAY"/>
    170175                      </xs:restriction>
    171176                    </xs:simpleType>
  • woocommerce-mpay24-gateway/trunk/MPay24/MPay24Api.php

    r636654 r696575  
    22    /**
    33     * @author              [email protected]
    4      * @version             $Id: MPay24Api.php 5217 2012-10-16 05:27:43Z anna $
     4     * @version             $Id: MPay24Api.php 5294 2013-01-17 11:54:45Z anna $
    55     * @filesource          MPay24Api.php
    66     * @license             http://ec.europa.eu/idabc/eupl.html EUPL, Version 1.1
     
    540540          */
    541541        private function send() {
    542             $userAgent = 'mPAY24 PHP API $Rev: 5217 $ ($Date:: 2012-10-16 #$)';
     542            $userAgent = 'mPAY24 PHP API $Rev: 5294 $ ($Date:: 2013-01-17 #$)';
    543543   
    544544            $ch = curl_init($this->etp_url);
     
    602602        function GeneralResponse($response) {
    603603            if($response != '') {
    604                 $responseAsDOM = new DOMDocument();
    605                 $responseAsDOM->loadXML($response);
     604                        $responseAsDOM = new DOMDocument();
     605              $responseAsDOM->loadXML($response);
    606606               
    607                 if(!empty($responseAsDOM) && is_object($responseAsDOM))
    608                     if(!$responseAsDOM || $responseAsDOM->getElementsByTagName('status')->length == 0){
    609                         $this->status             = "ERROR";
    610                         $this->returnCode        = urldecode($response);
    611                     } else {
    612                         $this->status             = $responseAsDOM->getElementsByTagName('status')->item(0)->nodeValue;
    613                         $this->returnCode         = $responseAsDOM->getElementsByTagName('returnCode')->item(0)->nodeValue;
    614                     }   
     607              if(!empty($responseAsDOM) && is_object($responseAsDOM))
     608                if(!$responseAsDOM || $responseAsDOM->getElementsByTagName('status')->length == 0 || $responseAsDOM->getElementsByTagName('returnCode')->length == 0){
     609                    $this->status             = "ERROR";
     610                    $this->returnCode        = urldecode($response);
     611                } else {
     612                    $this->status             = $responseAsDOM->getElementsByTagName('status')->item(0)->nodeValue;
     613                    $this->returnCode         = $responseAsDOM->getElementsByTagName('returnCode')->item(0)->nodeValue;
     614                }   
    615615            } else {
    616616                $this->status             = "ERROR";
    617                 $this->returnCode         = "The response is empty! Probably your request to mPAY24 was not sent! Please see your server log for more information!";
     617              $this->returnCode         = "The response is empty! Probably your request to mPAY24 was not sent! Please see your server log for more information!";
    618618            }       
    619619        }
     
    660660        /**
    661661         * @abstract                                    Sets the values for a payment from the response from mPAY24:
    662          *                                                 mPAY transaction ID, error number, location (URL) and external status
     662         *                                                 mPAY transaction ID, error number and location (URL)
    663663         * @param         STRING                            The SOAP response from mPAY24 (in XML form)
    664664         */
     
    666666            $this->generalResponse = new GeneralResponse($response);
    667667            if($response != '') {   
    668                 $responseAsDOM = new DOMDocument();
     668                            $responseAsDOM = new DOMDocument();
    669669                $responseAsDOM->loadXML($response);
    670670               
    671                 if(!empty($responseAsDOM) && is_object($responseAsDOM))       
     671                if(!empty($responseAsDOM) && is_object($responseAsDOM) && $responseAsDOM->getElementsByTagName('location')->length != 0)       
    672672                    $this->location            = $responseAsDOM->getElementsByTagName('location')->item(0)->nodeValue;
    673673             } else {
     
    721721                $responseAsDOM->loadXML($response);
    722722               
    723                 if($responseAsDOM) {       
     723                if($responseAsDOM && $responseAsDOM->getElementsByTagName('mpayTID')->length != 0 && $responseAsDOM->getElementsByTagName('tid')->length != 0) {       
    724724                    $this->mpayTID         = $responseAsDOM->getElementsByTagName('mpayTID')->item(0)->nodeValue;
    725725                    $this->tid             = $responseAsDOM->getElementsByTagName('tid')->item(0)->nodeValue;
     
    790790                $responseAsDOM->loadXML($response);
    791791               
    792                 if($responseAsDOM) {       
     792                if($responseAsDOM && $responseAsDOM->getElementsByTagName('all')->length != 0) {       
    793793                    $this->all             = $responseAsDOM->getElementsByTagName('all')->item(0)->nodeValue;
    794794                       
     
    893893                $responseAsDOM->loadXML($response);
    894894               
    895                 if($responseAsDOM) {       
     895                if($responseAsDOM && $responseAsDOM->getElementsByTagName('name')->length != 0) {       
    896896                    $this->paramCount = $responseAsDOM->getElementsByTagName('name')->length;
    897897                    $this->params['STATUS'] = $this->generalResponse->getStatus();
  • woocommerce-mpay24-gateway/trunk/MPay24/doc/__filesource/fsource_mPAY24API__MPay24Api.php.html

    r636654 r696575  
    44    /**
    55     * @author              [email protected]
    6      * @version             $Id: fsource_mPAY24API__MPay24Api.php.html 5218 2012-10-16 05:38:42Z anna $
     6     * @version             $Id: fsource_mPAY24API__MPay24Api.php.html 5294 2013-01-17 11:54:45Z anna $
    77     * @filesource          fsource_mPAY24API__MPay24Api.php.html
    88     * @license             http://ec.europa.eu/idabc/eupl.html EUPL, Version 1.1
     
    610610<li><div class="src-line"><a name="a617"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">var&nbsp;</span><a href="../mPAY24API/PaymentResponse.html#var$location">$location</a><span class="src-sym">;</span></div></li>
    611611<li><div class="src-line"><a name="a618"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
    612 <li><div class="src-line"><a name="a619"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@var&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-doc-type">STRING&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;external&nbsp;status&nbsp;from&nbsp;the&nbsp;request,&nbsp;which&nbsp;was&nbsp;sent&nbsp;to&nbsp;mPAY24</span></div></li>
    613612<li><div class="src-line"><a name="a620"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
    614 <li><div class="src-line"><a name="a621"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">var&nbsp;</span><a href="../mPAY24API/PaymentResponse.html#var$externalStatus">$externalStatus</a><span class="src-sym">;</span></div></li>
    615613<li><div class="src-line"><a name="a622"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
    616614<li><div class="src-line"><a name="a623"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
    617615<li><div class="src-line"><a name="a624"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
    618616<li><div class="src-line"><a name="a625"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@abstract</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets&nbsp;the&nbsp;values&nbsp;for&nbsp;a&nbsp;payment&nbsp;from&nbsp;the&nbsp;response&nbsp;from&nbsp;mPAY24:</span></div></li>
    619 <li><div class="src-line"><a name="a626"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mPAY&nbsp;transaction&nbsp;ID,&nbsp;error&nbsp;number,&nbsp;location&nbsp;(URL)&nbsp;and&nbsp;external&nbsp;status</span></div></li>
     617<li><div class="src-line"><a name="a626"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mPAY&nbsp;transaction&nbsp;ID,&nbsp;error&nbsp;number&nbsp;and&nbsp;location&nbsp;(URL)</span></div></li>
    620618<li><div class="src-line"><a name="a627"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-doc-type">STRING&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;SOAP&nbsp;response&nbsp;from&nbsp;mPAY24&nbsp;(in&nbsp;XML&nbsp;form)</span></div></li>
    621619<li><div class="src-line"><a name="a628"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
     
    629627<li><div class="src-line"><a name="a636"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../mPAY24API/PaymentResponse.html#var$errNo">errNo</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;<span class="src-var">$responseAsDOM</span><span class="src-sym">-&gt;</span><span class="src-id">getElementsByTagName</span><span class="src-sym">(</span><span class="src-str">'errNo'</span><span class="src-sym">)</span><span class="src-sym">-&gt;</span><span class="src-id">item</span><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">-&gt;</span><span class="src-id">nodeValue</span><span class="src-sym">;</span></div></li>
    630628<li><div class="src-line"><a name="a637"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../mPAY24API/PaymentResponse.html#var$location">location</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;<span class="src-var">$responseAsDOM</span><span class="src-sym">-&gt;</span><span class="src-id">getElementsByTagName</span><span class="src-sym">(</span><span class="src-str">'location'</span><span class="src-sym">)</span><span class="src-sym">-&gt;</span><span class="src-id">item</span><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">-&gt;</span><span class="src-id">nodeValue</span><span class="src-sym">;</span></div></li>
    631 <li><div class="src-line"><a name="a638"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../mPAY24API/PaymentResponse.html#var$externalStatus">externalStatus</a>&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;<span class="src-var">$responseAsDOM</span><span class="src-sym">-&gt;</span><span class="src-id">getElementsByTagName</span><span class="src-sym">(</span><span class="src-str">'externalStatus'</span><span class="src-sym">)</span><span class="src-sym">-&gt;</span><span class="src-id">item</span><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">-&gt;</span><span class="src-id">nodeValue</span><span class="src-sym">;</span></div></li>
    632629<li><div class="src-line"><a name="a639"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
    633630<li><div class="src-line"><a name="a640"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
     
    655652<li><div class="src-line"><a name="a662"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
    656653<li><div class="src-line"><a name="a663"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
    657 <li><div class="src-line"><a name="a664"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-doc-type">STRING&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;external&nbsp;status,&nbsp;returned&nbsp;from&nbsp;mPAY24</span></div></li>
    658654<li><div class="src-line"><a name="a665"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
    659 <li><div class="src-line"><a name="a666"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../mPAY24API/PaymentResponse.html#methodgetExternalStatus">getExternalStatus</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">{</span></div></li>
    660 <li><div class="src-line"><a name="a667"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../mPAY24API/PaymentResponse.html#var$externalStatus">externalStatus</a><span class="src-sym">;</span></div></li>
    661655<li><div class="src-line"><a name="a668"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
    662656<li><div class="src-line"><a name="a669"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
  • woocommerce-mpay24-gateway/trunk/MPay24/doc/blank.html

    r636654 r696575  
    22    /**
    33     * @author              [email protected]
    4      * @version             $Id: blank.html 5217 2012-10-16 05:27:43Z anna $
     4     * @version             $Id: blank.html 5294 2013-01-17 11:54:45Z anna $
    55     * @filesource          blank.html
    66     * @license             http://ec.europa.eu/idabc/eupl.html EUPL, Version 1.1
     
    166166  $result = $myShop->pay();                                                                 
    167167                                                                                           
    168   if($result->getGeneralResponse()->getStatus() == "OK") {                                 
    169     header("Location: " . $result->getLocation());                                         
    170   } else {                                                                                 
    171     echo "EXTERNALSTATUS: " . $result->getExternalStatus();                                   
    172     echo "RETURNCODE: " . $result->getGeneralResponse()->getReturnCode();                   
     168  if(isset($_POST["submit"])) {
     169    $myShop = new MyShop("MerchantID", "Password", TRUE, null, null, TRUE);
     170    $result = $myShop->pay();
     171
     172    if($result->getGeneralResponse()->getStatus() == "OK")
     173      header('Location: ' . $result->getLocation());
     174    else
     175      echo "Return Code: " . $result->getGeneralResponse()->getReturnCode();
    173176  }   
    174177}                                                                                   
  • woocommerce-mpay24-gateway/trunk/MPay24/doc/elementindex.html

    r636654 r696575  
    44    /**
    55     * @author              [email protected]
    6      * @version             $Id: elementindex.html 5217 2012-10-16 05:27:43Z anna $
     6     * @version             $Id: elementindex.html 5294 2013-01-17 11:54:45Z anna $
    77     * @filesource          elementindex.html
    88     * @license             http://ec.europa.eu/idabc/eupl.html EUPL, Version 1.1
     
    185185            <div class="index-item-details"><a href="mPAY24API/PaymentResponse.html#var$errNo">PaymentResponse::$errNo</a> in MPay24Api.php</div>
    186186                    </dd>
    187             <dt class="field">
    188                         <span class="var-title">$externalStatus</span>
    189                     </dt>
    190         <dd class="index-item-body">
    191             <div class="index-item-details"><a href="mPAY24API/PaymentResponse.html#var$externalStatus">PaymentResponse::$externalStatus</a> in MPay24Api.php</div>
     187        <dd class="index-item-body">
    192188                    </dd>
    193189            <dt class="field">
     
    297293            <div class="index-item-details"><a href="mPAY24API/MPay24Api.html#methodgetEtpURL">MPay24Api::getEtpURL()</a> in MPay24Api.php</div>
    298294                    </dd>
    299             <dt class="field">
    300                         <span class="method-title">getExternalStatus</span>
    301                     </dt>
    302         <dd class="index-item-body">
    303             <div class="index-item-details"><a href="mPAY24API/PaymentResponse.html#methodgetExternalStatus">PaymentResponse::getExternalStatus()</a> in MPay24Api.php</div>
     295        <dd class="index-item-body">
    304296                    </dd>
    305297            <dt class="field">
  • woocommerce-mpay24-gateway/trunk/MPay24/doc/elementindex_mPAY24API.html

    r636654 r696575  
    44    /**
    55     * @author              [email protected]
    6      * @version             $Id: elementindex_mPAY24API.html 5217 2012-10-16 05:27:43Z anna $
     6     * @version             $Id: elementindex_mPAY24API.html 5294 2013-01-17 11:54:45Z anna $
    77     * @filesource          elementindex_mPAY24API.html
    88     * @license             http://ec.europa.eu/idabc/eupl.html EUPL, Version 1.1
     
    221221            <div class="index-item-details"><a href="mPAY24API/PaymentResponse.html#var$errNo">PaymentResponse::$errNo</a> in MPay24Api.php</div>
    222222                    </dd>
    223             <dt class="field">
    224                         <span class="var-title">$externalStatus</span>
    225                     </dt>
    226         <dd class="index-item-body">
    227             <div class="index-item-details"><a href="mPAY24API/PaymentResponse.html#var$externalStatus">PaymentResponse::$externalStatus</a> in MPay24Api.php</div>
     223
     224        <dd class="index-item-body">
    228225                    </dd>
    229226            <dt class="field">
     
    333330            <div class="index-item-details"><a href="mPAY24API/MPay24Api.html#methodgetEtpURL">MPay24Api::getEtpURL()</a> in MPay24Api.php</div>
    334331                    </dd>
    335             <dt class="field">
    336                         <span class="method-title">getExternalStatus</span>
    337                     </dt>
    338         <dd class="index-item-body">
    339             <div class="index-item-details"><a href="mPAY24API/PaymentResponse.html#methodgetExternalStatus">PaymentResponse::getExternalStatus()</a> in MPay24Api.php</div>
     332        <dd class="index-item-body">
    340333                    </dd>
    341334            <dt class="field">
  • woocommerce-mpay24-gateway/trunk/MPay24/doc/mPAY24API/PaymentResponse.html

    r636654 r696575  
    44    /**
    55     * @author              [email protected]
    6      * @version             $Id: PaymentResponse.html 5217 2012-10-16 05:27:43Z anna $
     6     * @version             $Id: PaymentResponse.html 5294 2013-01-17 11:54:45Z anna $
    77     * @filesource          PaymentResponse.html
    88     * @license             http://ec.europa.eu/idabc/eupl.html EUPL, Version 1.1
     
    6868                </div>
    6969                                                                <div class="var-title">
    70                     <span class="var-type">STRING</span>
    71                     <a href="#$externalStatus" title="details" class="var-name">$externalStatus</a>
    72                 </div>
    73                                                                 <div class="var-title">
    7470                    <span class="var-type">GeneralResponse</span>
    7571                    <a href="#$generalResponse" title="details" class="var-name">$generalResponse</a>
     
    111107                                    </div>
    112108                                                                <div class="method-definition">
    113                                             <span class="method-result">STRING</span>
    114                                         <a href="#getExternalStatus" title="details" class="method-name">getExternalStatus</a>
    115                                         ()
    116                                     </div>
    117                                                                 <div class="method-definition">
    118109                                            <span class="method-result">GeneralResponse</span>
    119110                                        <a href="#getGeneralResponse" title="details" class="method-name">getGeneralResponse</a>
     
    168159
    169160</div>
    170 <a name="var$externalStatus" id="$externalStatus"><!-- --></A>
    171 <div class="evenrow">
    172 
    173     <div class="var-header">
    174         <span class="var-title">
    175             <span class="var-type">STRING</span>
    176             <span class="var-name">$externalStatus</span>
    177                         (line <span class="line-number"><a href="../__filesource/fsource_mPAY24API__MPay24Api.php.html#a621">621</a></span>)
    178         </span>
    179     </div>
    180 
    181     <!-- ========== Info from phpDoc block ========= -->
    182     <ul class="tags">
    183                 <li><span class="field">var:</span> The external status from the request, which was sent to mPAY24</li>
    184             </ul>
    185    
    186    
    187        
    188        
    189 
    190 </div>
     161
    191162<a name="var$generalResponse" id="$generalResponse"><!-- --></A>
    192163<div class="oddrow">
     
    288259    <!-- ========== Info from phpDoc block ========= -->
    289260    <ul class="tags">
    290                 <li><span class="field">abstract:</span> Sets the values for a payment from the response from mPAY24:                                                  mPAY transaction ID, error number, location (URL) and external status</li>
     261                <li><span class="field">abstract:</span> Sets the values for a payment from the response from mPAY24:                                                  mPAY transaction ID, error number and location (URL)</li>
    291262            </ul>
    292263   
     
    324295        <span class="method-name">
    325296            getErrNo
    326         </span>
    327                 ()
    328             </div>
    329    
    330        
    331            
    332     </div>
    333 <a name="methodgetExternalStatus" id="getExternalStatus"><!-- --></a>
    334 <div class="evenrow">
    335    
    336     <div class="method-header">
    337         <span class="method-title">getExternalStatus</span> (line <span class="line-number"><a href="../__filesource/fsource_mPAY24API__MPay24Api.php.html#a666">666</a></span>)
    338     </div>
    339    
    340     <!-- ========== Info from phpDoc block ========= -->
    341     <ul class="tags">
    342                 <li><span class="field">return:</span> The external status, returned from mPAY24</li>
    343                 <li><span class="field">access:</span> public</li>
    344             </ul>
    345    
    346     <div class="method-signature">
    347         <span class="method-result">STRING</span>
    348         <span class="method-name">
    349             getExternalStatus
    350297        </span>
    351298                ()
  • woocommerce-mpay24-gateway/trunk/MPay24/doc/mPAY24API/_MPay24Shop.php.html

    r636654 r696575  
    111111    <ul class="tags">
    112112                <li><span class="field">author:</span> [email protected]</li>
    113                 <li><span class="field">version:</span> $Id: _MPay24Shop.php.html 5173 2012-10-16 05:27:43Z anna $</li>
     113                <li><span class="field">version:</span> $Id: _MPay24Shop.php.html 5217 2012-10-16 05:27:43Z anna $</li>
    114114                <li><span class="field">license:</span> <a href="http://ec.europa.eu/idabc/eupl.html">EUPL, Version 1.1</a></li>
    115115            </ul>
  • woocommerce-mpay24-gateway/trunk/class-wc-mpay24-shop.php

    r636654 r696575  
    354354        foreach ( $pTypes as $key => $value ) {
    355355            $mdxi->Order->PaymentTypes->Payment( $key+1 )->setType( $value );
    356             if ( 'EPS' != $value ) {
     356            if ( 'CC' == $value || 'ELV' == $value ) {
    357357                $mdxi->Order->PaymentTypes->Payment( $key+1 )->setBrand( $brands[ $key ] );
    358358            }
     
    360360
    361361        $mdxi->Order->Price = $transaction->PRICE;
     362        /**
     363         * styling options
     364         *
     365         * no semicolon after last rule
     366         * example: $mdxi->Order->Price->setStyle('background-color: #DDDDDD; border: none; border-top: 1px solid #5B595D');
     367         */
     368        //$mdxi->Order->Price->setStyle('');
     369        //$mdxi->Order->Price->setHeaderStyle('');
    362370
    363371        $mdxi->Order->Customer = $this->getCustomer();
     
    370378        $mdxi->Order->URL->Cancel       = $this->getCancelUrl();
    371379
     380        /**
     381         * styling options
     382         *
     383         * no semicolon after last rule
     384         * example: $mdxi->Order->setStyle('font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;');
     385         */
     386        //$mdxi->Order->setStyle('');
     387        //$mdxi->Order->setLogoStyle('');
     388        //$mdxi->Order->setPageHeaderStyle('');
     389        //$mdxi->Order->setPageCaptionStyle('');
     390        //$mdxi->Order->setPageStyle('');
     391        //$mdxi->Order->setInputFieldsStyle('');
     392        //$mdxi->Order->setDropDownListsStyle('');
     393        //$mdxi->Order->setButtonsStyle('');
     394        //$mdxi->Order->setErrorsStyle('');
     395        //$mdxi->Order->setErrorsHeaderStyle('');
     396        //$mdxi->Order->setSuccessTitleStyle('');
     397        //$mdxi->Order->setErrorTitleStyle('');
     398        //$mdxi->Order->setFooterStyle('');
     399       
    372400        return $mdxi;
    373401    }
  • woocommerce-mpay24-gateway/trunk/gateway-mpay24.php

    r636654 r696575  
    33    Plugin Name: WooCommerce mPAY24 Gateway
    44    Plugin URI: http://www.woothemes.com/product-category/woocommerce-extensions/
    5 Description: Add mPAY24 Payment Gateway with credit card support to WooCommerce Plugin
    6     Version: 1.0
     5    Description: Add mPAY24 Payment Gateway with credit card support to WooCommerce Plugin
     6    Version: 1.1
    77    Author: datenwerk innovationsagentur GmbH
    88    Author URI: http://www.datenwerk.at
    9 Requires at least: 3.2
    10     Tested up to: 3.4
    11 
    12     */
     9    Requires at least: 3.5
     10    Tested up to: 3.5.1
     11*/
    1312
    1413// Exit if accessed directly
     
    1817
    1918/**
    20     * Check if WooCommerce is active
    21     **/
    22 if  (in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
     19 * Check if WooCommerce is active
     20 **/
     21if (in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
    2322
    2423    if ( ! defined( 'GATEWAY_MPAY24_VERSION' ) ) {
    25         define( 'GATEWAY_MPAY24_VERSION', '1.0' );
     24        define( 'GATEWAY_MPAY24_VERSION', '1.1' );
    2625    }
    2726    if ( ! defined( 'GATEWAY_MPAY24_TABLE_NAME' ) ) {
     
    3635
    3736    /**
    38         * Localisation
    39         */
     37     * Localisation
     38     */
    4039    load_plugin_textdomain( 'wc-mpay24', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
    4140
    4241    /**
    43         * Installation (create table)
    44         */
     42     * Installation (create table)
     43     */
    4544    register_activation_hook( __FILE__, 'woocommerce_install_gateway_mpay24' );
    4645
     
    5251
    5352    /**
    54         * Uninstallation (remove table and options)
    55         */
     53     * Uninstallation (remove table and options)
     54     */
    5655    register_uninstall_hook( __FILE__, 'woocommerce_uninstall_gateway_mpay24' );
    5756
     
    6261
    6362    /**
    64         * Install check (for updates)
    65         */
     63     * Install check (for updates)
     64     */
    6665    add_action( 'plugins_loaded', 'woocommerce_check_dbupdate_gateway_mpay24' );
    6766
     
    7372
    7473    /**
    75         * Welcome notices
    76         */
     74     * Welcome notices
     75     */
    7776    if ( '' == get_option( 'hide_gateway_mpay24_welcome_notice' ) ) {
    7877        add_action( 'admin_notices', 'woocommerce_welcome_notice_gateway_mpay24' );
     
    9190        </div>
    9291        <?php
    93     update_option( 'hide_gateway_mpay24_welcome_notice', 1 );
    94 }
    95 
    96 /**
    97     * Init Class
    98     */
    99 add_action( 'plugins_loaded', 'woocommerce_init_gateway_mpay24' );
    100 
    101 function woocommerce_init_gateway_mpay24() {
    102     if ( ! class_exists( 'WC_Payment_Gateway' ) ) {
    103         return;
     92        update_option( 'hide_gateway_mpay24_welcome_notice', 1 );
    10493    }
    10594
    10695    /**
    107         * mPAY24 Gateway Class
    108         */
    109     class WC_MPAY24 extends WC_Payment_Gateway {
    110 
    111         var $thankyou_text;
    112         var $email_text;
    113         var $payment_page_lang = 'DE';
    114         var $apiusertest;
    115         var $apipasstest;
    116         var $apiuserprod;
    117         var $apipassprod;
    118         var $testmode;
    119         var $debug;
    120 
     96     * Init Class
     97     */
     98    add_action( 'plugins_loaded', 'woocommerce_init_gateway_mpay24' );
     99
     100    function woocommerce_init_gateway_mpay24() {
     101        if ( ! class_exists( 'WC_Payment_Gateway' ) ) {
     102            return;
     103        }
    121104
    122105        /**
    123             * init vars, settings and hooks
    124             */
    125         public function __construct() {
    126             global $woocommerce;
    127 
    128             $this->id                 = 'mpay24';
    129             $this->icon               = apply_filters('woocommerce_mpay24_icon', GATEWAY_MPAY24_URL . 'assets/images/cards.png');
    130             $this->has_fields         = false;
    131             $this->method_title       = __( 'mPAY24', 'wc-mpay24' ); // backend title
    132             $this->method_description = __( 'Credit card payment via mPAY24 payment page', 'wc-mpay24' ); // backend description
    133 
    134             require_once( GATEWAY_MPAY24_PATH . 'class-wc-mpay24-shop.php' );
    135 
    136             // Load the form fields
    137             $this->init_form_fields();
    138 
    139             // Load the settings.
    140             $this->init_settings();
    141 
    142             // Get setting values
    143             $this->title             = $this->settings['title']; // frontend title
    144             $this->description       = $this->settings['description']; // frontend description
    145             $this->thankyou_text     = $this->settings['thankyou_text'];
    146             $this->email_text        = $this->settings['email_text'];
    147             $this->payment_page_lang = $this->settings['payment_page_lang'];
    148             $this->apiusertest       = $this->settings['apiusertest'];
    149             $this->apipasstest       = $this->settings['apipasstest'];
    150             $this->apiuserprod       = $this->settings['apiuserprod'];
    151             $this->apipassprod       = $this->settings['apipassprod'];
    152             $this->testmode          = $this->settings['testmode'];
    153             $this->debug             = $this->settings['debug'];
    154 
    155             // Logging
    156             if ( 'yes' == $this->debug ) {
    157                 $this->log = $woocommerce->logger();
    158             }
    159 
    160             // Hooks
    161             add_action( 'woocommerce_update_options_payment_gateways', array( &$this, 'process_admin_options' ) ); // inherit method
    162             add_action( 'woocommerce_thankyou_mpay24', array( &$this, 'thankyou_page_text' ) ); // woocommerce_thankyou_.$order->payment_method
    163             add_action( 'woocommerce_email_after_order_table', array( &$this, 'customer_email_text' ), 10, 2 ); // customer email
    164 
    165             add_action( 'init', array( &$this, 'check_mpay24_response' ) ); // mPAY24 transaction confirmation
    166             add_action( 'valid-mpay24-standard-request', array( &$this, 'successful_request' ) ); // order status update
    167         }
    168 
    169         /**
    170             * Initialise Settings Form Fields
    171             *
    172             * Add an array of fields to be displayed
    173             * on the gateway's settings screen.
    174             *
    175             * @access public
    176             * @return void
    177             * @see woocommerce/classes/class-wc-settings-api.php
    178             */
    179         public function init_form_fields() {
    180             $this->form_fields = array(
    181             'enabled' => array(
    182                 'title'         => __( 'Enable/Disable', 'wc-mpay24' ),
    183                 'label'         => __( 'Enable mPAY24', 'wc-mpay24' ),
    184                 'type'          => 'checkbox',
    185                 'description'   => '',
    186                 'default'       => 'no'
    187                 ),
    188             'title' => array(
    189                 'title'         => __( 'Title', 'wc-mpay24' ),
    190                 'type'          => 'text',
    191                 'description'   => __( 'This controls the title which the user sees during checkout.', 'wc-mpay24' ),
    192                 'default'       => __( 'Credit card', 'wc-mpay24' )
    193                 ),
    194             'description' => array(
    195                 'title'         => __( 'Description', 'wc-mpay24' ),
    196                 'type'          => 'textarea',
    197                 'description'   => __( 'This controls the description which the user sees during checkout.', 'wc-mpay24' ),
    198                 'default'       => __( 'Pay with your credit card via mPAY24.', 'wc-mpay24' )
    199                 ),
    200             'thankyou_text' => array(
    201                 'title'         => __( 'Thank you page text', 'wc-mpay24' ),
    202                 'type'          => 'textarea',
    203                 'description'   => __( 'This controls the text which the user sees on the order thank you page above order details.', 'wc-mpay24' )
    204                 ),
    205             'email_text' => array(
    206                 'title'         => __( 'Customer email text', 'wc-mpay24' ),
    207                 'type'          => 'textarea',
    208                 'description'   => __( 'This controls the text which the user sees in order confirmation email below order table.', 'wc-mpay24' )
    209                 ),
    210             'payment_page_lang' => array(
    211                 'title'         => __( 'mPAY24 Payment page Language', 'wc-mpay24' ),
    212                 'type'          => 'select',
    213             'options'       => array(
    214                 'BG' => __( 'Bulgarian', 'wc-mpay24' ),
    215                 'CS' => __( 'Czech', 'wc-mpay24' ),
    216                 'DE' => __( 'German', 'wc-mpay24' ), // default
    217             'EN' => __( 'English', 'wc-mpay24' ),
    218                 'ES' => __( 'Spanish', 'wc-mpay24' ),
    219                 'FR' => __( 'French', 'wc-mpay24' ),
    220                 'HU' => __( 'Hungarian', 'wc-mpay24' ),
    221                 'NL' => __( 'Dutch', 'wc-mpay24' )
    222                 ), // see mPAY24 specification Appendix B for supported languages
    223             'description'   => __( 'This controls in which langage the payment page is shown.', 'wc-mpay24' ),
    224                 'default'       => 'DE'
    225                 ),
    226             'apiusertest' => array(
    227                 'title'         => __( 'Username TEST', 'wc-mpay24' ),
    228                 'type'          => 'text',
    229                 'description'   => __( 'This is the SOAP API username (without leading u) for test environment.', 'wc-mpay24' ),
    230                 'default'       => ''
    231                 ),
    232             'apipasstest' => array(
    233                 'title'         => __( 'Password TEST', 'wc-mpay24' ),
    234                 'type'          => 'password',
    235                 'description'   => __( 'This is the SOAP API password for test environment.', 'wc-mpay24' ),
    236                 'default'       => ''
    237                 ),
    238             'apiuserprod' => array(
    239                 'title'         => __( 'Username PROD', 'wc-mpay24' ),
    240                 'type'          => 'text',
    241                 'description'   => __( 'This is the SOAP API username (without leading u) for prod environment.', 'wc-mpay24' ),
    242                 'default'       => ''
    243                 ),
    244             'apipassprod' => array(
    245                 'title'         => __( 'Password PROD', 'wc-mpay24' ),
    246                 'type'          => 'password',
    247                 'description'   => __( 'This is the SOAP API password for prod environment.', 'wc-mpay24' ),
    248                 'default'       => ''
    249                 ),
    250             'testmode' => array(
    251                 'title'         => __( 'mPAY24 Test Mode', 'wc-mpay24' ),
    252                 'label'         => __( 'Enable Test Mode', 'wc-mpay24' ),
    253                 'type'          => 'checkbox',
    254                 'description'   => __( 'Place the payment gateway in development mode.', 'wc-mpay24' ),
    255                 'default'       => 'yes'
    256                 ),
    257             'debug' => array(
    258                 'title'         => __( 'Debug Log', 'wc-mpay24' ),
    259                 'type'          => 'checkbox',
    260                 'label'         => __( 'Enable logging', 'wc-mpay24' ),
    261                 'default'       => 'no',
    262                 'description'   => __( 'Log mPAY24 events inside <code>woocommerce/logs/mpay24.txt</code>', 'wc-mpay24' ),
    263                 ),
     106         * mPAY24 Gateway Class
     107         */
     108        class WC_Gateway_MPAY24 extends WC_Payment_Gateway {
     109
     110            var $thankyou_text;
     111            var $email_text;
     112            var $payment_page_lang = 'DE';
     113            var $apiusertest;
     114            var $apipasstest;
     115            var $apiuserprod;
     116            var $apipassprod;
     117            var $testmode;
     118            var $debug;
     119            var $notify_url;
     120
     121            /**
     122             * init vars, settings and hooks
     123             */
     124            public function __construct() {
     125                global $woocommerce;
     126
     127                $this->id                 = 'mpay24';
     128                $this->icon               = apply_filters('woocommerce_mpay24_icon', GATEWAY_MPAY24_URL . 'assets/images/cards.png');
     129                $this->has_fields         = false;
     130                $this->method_title       = __( 'mPAY24', 'wc-mpay24' ); // backend title
     131                $this->method_description = __( 'Credit card payment via mPAY24 payment page', 'wc-mpay24' ); // backend description
     132                $this->notify_url         = str_replace( 'https:', 'http:', add_query_arg( 'wc-api', 'WC_Gateway_MPAY24', home_url( '/' ) ) );
     133
     134                require_once( GATEWAY_MPAY24_PATH . 'class-wc-mpay24-shop.php' );
     135
     136                // Load the form fields
     137                $this->init_form_fields();
     138
     139                // Load the settings.
     140                $this->init_settings();
     141
     142                // Get setting values
     143                $this->title             = $this->settings['title']; // frontend title
     144                $this->description       = $this->settings['description']; // frontend description
     145                $this->thankyou_text     = $this->settings['thankyou_text'];
     146                $this->email_text        = $this->settings['email_text'];
     147                $this->payment_page_lang = $this->settings['payment_page_lang'];
     148                $this->apiusertest       = $this->settings['apiusertest'];
     149                $this->apipasstest       = $this->settings['apipasstest'];
     150                $this->apiuserprod       = $this->settings['apiuserprod'];
     151                $this->apipassprod       = $this->settings['apipassprod'];
     152                $this->testmode          = $this->settings['testmode'];
     153                $this->debug             = $this->settings['debug'];
     154
     155                // Logging
     156                if ( 'yes' == $this->debug ) {
     157                    $this->log = $woocommerce->logger();
     158                }
     159
     160                // Hooks
     161                add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) ); // inherit method
     162                add_action( 'woocommerce_thankyou_mpay24', array( $this, 'thankyou_page_text' ) ); // woocommerce_thankyou_.$order->payment_method
     163                add_action( 'woocommerce_email_after_order_table', array( $this, 'customer_email_text' ), 10, 2 ); // customer email
     164
     165                // Payment listener/API hook
     166                add_action( 'woocommerce_api_wc_gateway_mpay24', array( $this, 'check_mpay24_response' ) ); // mPAY24 transaction confirmation
     167                add_action( 'valid-mpay24-standard-request', array( $this, 'successful_request' ) ); // order status update
     168            }
     169
     170            /**
     171             * Initialise Settings Form Fields
     172             *
     173             * Add an array of fields to be displayed
     174             * on the gateway's settings screen.
     175             *
     176             * @access public
     177             * @return void
     178             * @see woocommerce/classes/class-wc-settings-api.php
     179             */
     180            public function init_form_fields() {
     181                $this->form_fields = array(
     182                'enabled' => array(
     183                    'title'         => __( 'Enable/Disable', 'wc-mpay24' ),
     184                    'label'         => __( 'Enable mPAY24', 'wc-mpay24' ),
     185                    'type'          => 'checkbox',
     186                    'description'   => '',
     187                    'default'       => 'no'
     188                    ),
     189                'title' => array(
     190                    'title'         => __( 'Title', 'wc-mpay24' ),
     191                    'type'          => 'text',
     192                    'description'   => __( 'This controls the title which the user sees during checkout.', 'wc-mpay24' ),
     193                    'default'       => __( 'Credit card', 'wc-mpay24' )
     194                    ),
     195                'description' => array(
     196                    'title'         => __( 'Description', 'wc-mpay24' ),
     197                    'type'          => 'textarea',
     198                    'description'   => __( 'This controls the description which the user sees during checkout.', 'wc-mpay24' ),
     199                    'default'       => __( 'Pay with your credit card via mPAY24.', 'wc-mpay24' )
     200                    ),
     201                'thankyou_text' => array(
     202                    'title'         => __( 'Thank you page text', 'wc-mpay24' ),
     203                    'type'          => 'textarea',
     204                    'description'   => __( 'This controls the text which the user sees on the order thank you page above order details.', 'wc-mpay24' )
     205                    ),
     206                'email_text' => array(
     207                    'title'         => __( 'Customer email text', 'wc-mpay24' ),
     208                    'type'          => 'textarea',
     209                    'description'   => __( 'This controls the text which the user sees in order confirmation email below order table.', 'wc-mpay24' )
     210                    ),
     211                'payment_page_lang' => array(
     212                    'title'         => __( 'mPAY24 Payment page Language', 'wc-mpay24' ),
     213                    'type'          => 'select',
     214                'options'       => array(
     215                    'BG' => __( 'Bulgarian', 'wc-mpay24' ),
     216                    'CS' => __( 'Czech', 'wc-mpay24' ),
     217                    'DE' => __( 'German', 'wc-mpay24' ), // default
     218                'EN' => __( 'English', 'wc-mpay24' ),
     219                    'ES' => __( 'Spanish', 'wc-mpay24' ),
     220                    'FR' => __( 'French', 'wc-mpay24' ),
     221                    'HU' => __( 'Hungarian', 'wc-mpay24' ),
     222                    'NL' => __( 'Dutch', 'wc-mpay24' )
     223                    ), // see mPAY24 specification Appendix B for supported languages
     224                'description'   => __( 'This controls in which langage the payment page is shown.', 'wc-mpay24' ),
     225                    'default'       => 'DE'
     226                    ),
     227                'apiusertest' => array(
     228                    'title'         => __( 'Username TEST', 'wc-mpay24' ),
     229                    'type'          => 'text',
     230                    'description'   => __( 'This is the SOAP API username (without leading u) for test environment.', 'wc-mpay24' ),
     231                    'default'       => ''
     232                    ),
     233                'apipasstest' => array(
     234                    'title'         => __( 'Password TEST', 'wc-mpay24' ),
     235                    'type'          => 'password',
     236                    'description'   => __( 'This is the SOAP API password for test environment.', 'wc-mpay24' ),
     237                    'default'       => ''
     238                    ),
     239                'apiuserprod' => array(
     240                    'title'         => __( 'Username PROD', 'wc-mpay24' ),
     241                    'type'          => 'text',
     242                    'description'   => __( 'This is the SOAP API username (without leading u) for prod environment.', 'wc-mpay24' ),
     243                    'default'       => ''
     244                    ),
     245                'apipassprod' => array(
     246                    'title'         => __( 'Password PROD', 'wc-mpay24' ),
     247                    'type'          => 'password',
     248                    'description'   => __( 'This is the SOAP API password for prod environment.', 'wc-mpay24' ),
     249                    'default'       => ''
     250                    ),
     251                'testmode' => array(
     252                    'title'         => __( 'mPAY24 Test Mode', 'wc-mpay24' ),
     253                    'label'         => __( 'Enable Test Mode', 'wc-mpay24' ),
     254                    'type'          => 'checkbox',
     255                    'description'   => __( 'Place the payment gateway in development mode.', 'wc-mpay24' ),
     256                    'default'       => 'yes'
     257                    ),
     258                'debug' => array(
     259                    'title'         => __( 'Debug Log', 'wc-mpay24' ),
     260                    'type'          => 'checkbox',
     261                    'label'         => __( 'Enable logging', 'wc-mpay24' ),
     262                    'default'       => 'no',
     263                    'description'   => __( 'Log mPAY24 events inside <code>woocommerce/logs/mpay24.txt</code>', 'wc-mpay24' ),
     264                    ),
    264265                );
    265         }
    266 
    267         /**
    268             * Process Payment
    269             *
    270             * @access public
    271             * @return void
    272             * @see woocommerce/classes/class-wc-payment-gateway.php
    273             */
    274         public function process_payment( $order_id ) {
    275             global $woocommerce;
    276 
    277             $order = &new WC_Order( $order_id );
    278 
    279             $testmode = ( 'yes' == $this->testmode ) ? true : false;
    280             $user     = ( 'yes' == $this->testmode ) ? $this->apiusertest : $this->apiuserprod;
    281             $pass     = ( 'yes' == $this->testmode ) ? $this->apipasstest : $this->apipassprod;
    282 
    283             // start mpay24 transaction
    284             $shop = new WC_MPAY24_Shop( $user, $pass, $testmode );
    285             if ( isset( $this->log ) ) {
    286                 $shop->setLog( $this->log );
    287             }
    288 
    289             $shop->setTid( $order_id );
    290             $shop->setPrice( $order->order_total );
    291             $shop->setLanguage( $this->payment_page_lang );
    292             $customer_name = ( $order->billing_company != '' ) ? $order->billing_company : $order->billing_first_name . ' ' . $order->billing_last_name;
    293             $shop->setCustomer( $customer_name );
    294             $shop->setCustomerId( $order->user_id );
    295 
    296             $shop->setSuccessUrl( $this->get_return_url( $order ) ); // thank you page
    297             $shop->setErrorUrl ($order->get_cancel_order_url() );
    298             $shop->setCancelUrl( $order->get_cancel_order_url() );
    299             $shop->setConfirmUrl( trailingslashit (home_url() ) . '?mpay24Listener=mpay24_standard' );
    300 
    301             $result = $shop->pay();
    302 
    303             if ( $result->getGeneralResponse()->getStatus() != "OK" ) {
    304                 echo "Error: " . $result->getExternalStatus();
    305                 echo "Return Code: " . $result->getGeneralResponse()->getReturnCode();
    306             }
    307 
    308             // open payment page
    309             return array(
    310                 'result'    => 'success',
    311                 'redirect'  => $result->getLocation()
     266            }
     267
     268            /**
     269             * Admin Panel Options
     270             * - Options for bits like 'title' and availability on a country-by-country basis
     271             *
     272             * @access public
     273             * @return void
     274             */
     275            public function admin_options() {
     276                ?>
     277                <h3><?php _e( 'mPAY24', 'wc-mpay24' ); ?></h3>
     278                <p><?php _e( 'Credit card payment via mPAY24 payment page', 'wc-mpay24' ); ?></p>
     279                <table class="form-table">
     280                <?php
     281                    // Generate the HTML For the settings form.
     282                    $this->generate_settings_html();
     283                ?>
     284                </table>
     285                <?php
     286            }
     287
     288            /**
     289             * Process Payment
     290             *
     291             * @access public
     292             * @return void
     293             * @see woocommerce/classes/class-wc-payment-gateway.php
     294             */
     295            public function process_payment( $order_id ) {
     296                global $woocommerce;
     297
     298                $order = new WC_Order( $order_id );
     299
     300                $testmode = ( 'yes' == $this->testmode ) ? true : false;
     301                $user     = ( 'yes' == $this->testmode ) ? $this->apiusertest : $this->apiuserprod;
     302                $pass     = ( 'yes' == $this->testmode ) ? $this->apipasstest : $this->apipassprod;
     303
     304                // start mpay24 transaction
     305                $shop = new WC_MPAY24_Shop( $user, $pass, $testmode );
     306                if ( isset( $this->log ) ) {
     307                    $shop->setLog( $this->log );
     308                }
     309
     310                $shop->setTid( $order_id );
     311                $shop->setPrice( $order->order_total );
     312                $shop->setLanguage( $this->payment_page_lang );
     313                $customer_name = ( $order->billing_company != '' ) ? $order->billing_company : $order->billing_first_name . ' ' . $order->billing_last_name;
     314                $shop->setCustomer( $customer_name );
     315                $shop->setCustomerId( $order->user_id );
     316
     317                $shop->setSuccessUrl( $this->get_return_url( $order ) ); // thank you page
     318                $shop->setErrorUrl ($order->get_cancel_order_url() );
     319                $shop->setCancelUrl( $order->get_cancel_order_url() );
     320                $shop->setConfirmUrl( $this->notify_url );
     321
     322                $result = $shop->pay();
     323
     324                if ( $result->getGeneralResponse()->getStatus() != "OK" ) {
     325                    echo "Error: " . $result->getExternalStatus();
     326                    echo "Return Code: " . $result->getGeneralResponse()->getReturnCode();
     327                }
     328
     329                // open payment page
     330                return array(
     331                    'result'    => 'success',
     332                    'redirect'  => $result->getLocation()
    312333                );
    313334
    314             // Remove cart
    315             $woocommerce->cart->empty_cart();
    316 
    317             // Empty awaiting payment session
    318             unset( $_SESSION['order_awaiting_payment'] );
    319 
    320             // Return thankyou redirect
    321             return array(
    322                 'result'    => 'success',
    323                 'redirect'  => add_query_arg( 'key', $order->order_key, add_query_arg( 'order', $order_id, get_permalink( get_option( 'woocommerce_thanks_page_id' ) ) ) )
    324                 );
    325         }
    326 
    327         /**
    328             * There are no payment fields, so show the description if set.
    329             * Also show info if test mode is enabled.
    330             *
    331             * @access public
    332             * @return void
    333             * @see woocommerce/classes/class-wc-payment-gateway.php
    334             */
    335         public function payment_fields() {
    336             ?>
    337             <?php if ( 'yes' == $this->testmode ) : ?><p><?php _e( 'TEST MODE ENABLED', 'wc-mpay24' ); ?></p><?php endif; ?>
     335                //// Remove cart
     336                //$woocommerce->cart->empty_cart();
     337                //
     338                //// Empty awaiting payment session
     339                //unset( $_SESSION['order_awaiting_payment'] );
     340                //
     341                //// Return thankyou redirect
     342                //return array(
     343                //  'result'    => 'success',
     344                //  'redirect'  => add_query_arg( 'key', $order->order_key, add_query_arg( 'order', $order_id, get_permalink( get_option( 'woocommerce_thanks_page_id' ) ) ) )
     345                //);
     346            }
     347
     348            /**
     349             * There are no payment fields, so show the description if set.
     350             * Also show info if test mode is enabled.
     351             *
     352             * @access public
     353             * @return void
     354             * @see woocommerce/classes/class-wc-payment-gateway.php
     355             */
     356            public function payment_fields() {
     357                ?>
     358                <?php if ( 'yes' == $this->testmode ) : ?><p><?php _e( 'TEST MODE ENABLED', 'wc-mpay24' ); ?></p><?php endif; ?>
    338359                <?php if ( $description = $this->get_description() ) : ?><p><?php echo wpautop( wptexturize( $description ) ); ?></p><?php endif; ?>
    339                     <?php
    340             }
    341 
    342             /**
    343                 * Add text to thankyou page above order details
    344                 * called by 'woocommerce_thankyou_mpay24' action
    345                 *
    346                 * @access public
    347                 * @return void
    348                 */
     360                <?php
     361            }
     362
     363            /**
     364             * Add text to thankyou page above order details
     365             * called by 'woocommerce_thankyou_mpay24' action
     366             *
     367             * @access public
     368             * @return void
     369             */
    349370            public function thankyou_page_text( $order ) {
    350371                ?>
    351372                <?php if ( '' != $this->thankyou_text ) : ?><p><?php echo wpautop( wptexturize( $this->thankyou_text ) ); ?></p><?php endif; ?>
    352                     <?php
    353             }
    354 
    355             /**
    356                 * Add text to order confirmation mail to customer below order table
    357                 * called by 'woocommerce_email_after_order_table' action
    358                 *
    359                 * @access public
    360                 * @return void
    361                 */
     373                <?php
     374            }
     375
     376            /**
     377             * Add text to order confirmation mail to customer below order table
     378             * called by 'woocommerce_email_after_order_table' action
     379             *
     380             * @access public
     381             * @return void
     382             */
    362383            public function customer_email_text( $order, $sent_to_admin ) {
    363384                if ( $sent_to_admin ) {
     
    370391                ?>
    371392                <?php if ( '' != $this->email_text ) : ?><p><?php echo wpautop( wptexturize( $this->email_text ) ); ?></p><?php endif; ?>
    372                     <?php
    373             }
    374 
    375             /**
    376                 * Confirm mPAY24 transaction and write status in plugin's database table
    377                 * called by 'init' action
    378                 * call 'valid-mpay24-standard-request' action to process order
    379                 *
    380                 * @access public
    381                 * @return void
    382                 */
    383             public function check_mpay24_response() {
    384                 if ( isset( $_GET['mpay24Listener'] ) && 'mpay24_standard' == $_GET['mpay24Listener'] ) {
    385                     $get_params = $_GET;
    386                     $args      = array();
    387 
    388                     foreach ( $get_params as $key => $value ) {
    389                         if ( 'TID' !== $key ) {
    390                             $args[ $key ] = $value;
    391                         }
     393                <?php
     394            }
     395           
     396            /**
     397             * Confirm MPAY24 transaction
     398             */
     399            function check_ipn_request_is_valid() {
     400                $get_params = $_GET;
     401                $args      = array();
     402
     403                foreach ( $get_params as $key => $value ) {
     404                    if ( 'TID' !== $key ) {
     405                        $args[ $key ] = $value;
    392406                    }
    393 
    394                     $testmode = ( 'yes' == $this->testmode ) ? true : false;
    395                     $user     = ( 'yes' == $this->testmode ) ? $this->apiusertest : $this->apiuserprod;
    396                     $pass     = ( 'yes' == $this->testmode ) ? $this->apipasstest : $this->apipassprod;
    397 
    398                     $shop = new WC_MPAY24_Shop( $user, $pass, $testmode );
    399                     if ( isset( $this->log ) ) {
    400                         $shop->setLog( $this->log );
    401                     }
    402                     $shop->confirm( $_GET['TID'], $args );
    403 
     407                }
     408
     409                $testmode = ( 'yes' == $this->testmode ) ? true : false;
     410                $user     = ( 'yes' == $this->testmode ) ? $this->apiusertest : $this->apiuserprod;
     411                $pass     = ( 'yes' == $this->testmode ) ? $this->apipasstest : $this->apipassprod;
     412
     413                $shop = new WC_MPAY24_Shop( $user, $pass, $testmode );
     414                if ( isset( $this->log ) ) {
     415                    $shop->setLog( $this->log );
     416                }
     417                $shop->confirm( $_GET['TID'], $args );
     418               
     419                return true;
     420            }
     421
     422            /**
     423             * Confirm mPAY24 transaction and write status in plugin's database table
     424             * called by 'woocommerce_api_wc_gateway_mpay24' action
     425             * call 'valid-mpay24-standard-request' action to process order
     426             *
     427             * @access public
     428             * @return void
     429             */
     430            function check_mpay24_response() {
     431                @ob_clean();
     432                if ( ! empty( $_GET ) && $this->check_ipn_request_is_valid() ) {
     433                    header( 'HTTP/1.1 200 OK' );
    404434                    do_action( "valid-mpay24-standard-request", $_GET );
    405                 }
    406             }
    407 
    408             /**
    409                 * Lock up transaction status from database and update order status
    410                 * called by 'valid-mpay24-standard-request' action
    411                 *
    412                 * @param array $posted - request parameters
    413                 * @access public
    414                 * @return void
    415                 */
     435                } else {
     436                    wp_die( "mPAY24 IPN Request Failure" );
     437                }
     438            }
     439
     440            /**
     441             * Lock up transaction status from database and update order status
     442             * called by 'valid-mpay24-standard-request' action
     443             *
     444             * @param array $posted - request parameters
     445             * @access public
     446             * @return void
     447             */
    416448            public function successful_request( $posted ) {
    417449                global $wpdb;
     
    434466                    switch ( $tstatus ) {
    435467                        case 'billed':
    436                         // Check order not already completed
    437                         if ( 'completed' == $order->status ) {
     468                            // Check order not already completed
     469                            if ( 'completed' == $order->status ) {
     470                                if ( 'yes' == $this->debug ) {
     471                                    $this->log->add( 'mpay24', 'Aborting, Order #' . $order->id . ' is already complete.' );
     472                                }
     473                                exit;
     474                            }
     475
     476                            // Payment completed
     477                            $order->add_order_note( __( 'mPAY24 payment completed', 'wc-mpay24' ) );
     478                            $order->payment_complete();
     479
    438480                            if ( 'yes' == $this->debug ) {
    439                                 $this->log->add( 'mpay24', 'Aborting, Order #' . $order->id . ' is already complete.' );
     481                                $this->log->add( 'mpay24', 'Payment complete.' );
    440482                            }
    441                             exit;
    442                         }
    443 
    444                         // Payment completed
    445                         $order->add_order_note( __( 'mPAY24 payment completed', 'wc-mpay24' ) );
    446                         $order->payment_complete();
    447 
    448                         if ( 'yes' == $this->debug ) {
    449                             $this->log->add( 'mpay24', 'Payment complete.' );
    450                         }
    451483                        break;
    452484                        case 'reserved':
    453                         // Order pending
    454                         $order->update_status( 'pending', sprintf( __( 'Payment %s via mPAY24.', 'wc-mpay24' ), $tstatus ) );
     485                            // Order pending
     486                            $order->update_status( 'on-hold', sprintf( __( 'Payment %s via mPAY24.', 'wc-mpay24' ), $tstatus ) );
    455487                        break;
    456488                        case 'error':
    457489                        case 'suspended':
    458                         // Order failed
    459                         $order->update_status( 'failed', sprintf( __( 'Payment %s via mPAY24.', 'wc-mpay24' ), $tstatus ) );
     490                            // Order failed
     491                            $order->update_status( 'failed', sprintf( __( 'Payment %s via mPAY24.', 'wc-mpay24' ), $tstatus ) );
    460492                        break;
    461493                        case 'credited':
    462                         $order->update_status( 'refunded', sprintf(__('Payment %s via mPAY24.', 'wc-mpay24' ), $tstatus ) );
     494                            $order->update_status( 'refunded', sprintf(__('Payment %s via mPAY24.', 'wc-mpay24' ), $tstatus ) );
    463495                        break;
    464496                        case 'reversed':
    465                         // Order cancelled
    466                         $order->cancel_order( sprintf( __( 'Payment %s via mPAY24.', 'wc-mpay24' ), $tstatus ) );
     497                            // Order cancelled
     498                            $order->cancel_order( sprintf( __( 'Payment %s via mPAY24.', 'wc-mpay24' ), $tstatus ) );
    467499                        break;
    468500
     
    477509
    478510        /**
    479             * Add the gateway to woocommerce
    480             */
     511         * Add the gateway to woocommerce
     512         */
    481513        function woocommerce_add_gateway_mpay24( $methods ) {
    482             $methods[] = 'WC_MPAY24';
     514            $methods[] = 'WC_Gateway_MPAY24';
    483515            return $methods;
    484516        }
  • woocommerce-mpay24-gateway/trunk/readme.txt

    r667416 r696575  
    11=== WooCommerce mPAY24 Gateway ===
    22
    3 Contributors: datenwerk 
    4 Donate link: 
    5 Tags: woocommerce, gateway, mpay24 
    6 Requires at least: 3.
    7 Tested up to: 3.5.
    8 Stable tag: 1.
    9 License: GNU General Public License v3.0 
    10 License URI: http://www.gnu.org/licenses/gpl-3.0.html 
     3Contributors: datenwerk
     4Donate link:
     5Tags: woocommerce, gateway, mpay24
     6Requires at least: 3.5
     7Tested up to: 3.5.1
     8Stable tag: 1.1
     9License: GNU General Public License v3.0
     10License URI: http://www.gnu.org/licenses/gpl-3.0.html
    1111
    12 Add mPAY24 Payment Gateway with credit card support to WooCommerce Plugin. 
     12Add mPAY24 Payment Gateway to WooCommerce Plugin.
    1313
    1414== Description ==
     
    1616= Features =
    1717
    18 * Use mPAY24 PHP Files (version 2012-10-16), follow mPAY24 specification (version 2012-04-13) 
    19 * Using the mPAY24 payment page to integrate in website 
    20 * Switching between DEV and PROD mPAY24 environment with SOAP logins 
    21 * Payment methods available: credit cards 
    22 * Languages available for Wordpress Admin: EN, DE 
    23 * Languages available for payment page: BG, CS, DE, EN, ES, FR, HU, NL  
    24 * Supported currency in payment page: EUR 
    25 * no mPAY24 proSafe Support 
    26 * default styling for payment page 
     18* Uses mPAY24 PHP files (version 2013-01-17), follows mPAY24 specification (version 2013-02-22)
     19* Using the mPAY24 payment page to integrate in website
     20* Switching between DEV and PROD mPAY24 environment with SOAP logins
     21* Supports all payment methods of mPAY24
     22* Languages available for Wordpress Admin: EN, DE
     23* Languages available for payment page: BG, CS, DE, EN, ES, FR, HU, NL (no real localisation)
     24* Supported currency in payment page: EUR
     25* no mPAY24 proSafe Support
     26* default styling for payment page
    2727
    2828= mPAY24 =
    2929
    30 If there are newer mPAY24 PHP Files you can replace the files in the folder `MPay24`. 
     30If there are newer mPAY24 PHP Files you can replace the files in the folder `MPay24`.
    3131If you want to extend the functionality (e.g. add styling for payment page) you have to edit `class-wc-mpay24-shop.php`
    3232
     
    3535= Requirements =
    3636
    37 * php curl (mPAY24 API) 
    38 * [WooCommerce Plugin](http://www.woothemes.com/woocommerce/) v1.6 or higher (but not compatible to 2.0)
     37* php curl (mPAY24 API)
     38* [WooCommerce Plugin](http://www.woothemes.com/woocommerce/) v2.0 or higher
    3939
    4040= Manual installation =
    4141
    42 1. Upload `woocommerce-gateway-mpay24` to the `/wp-content/plugins/` directory 
    43 2. Activate the plugin through the `Plugins` menu in WordPress 
    44 3. Configure your mPAY24 settings under `WooCommerce Settings -> Gateways -> MPAY24` 
     421. Upload `woocommerce-gateway-mpay24` to the `/wp-content/plugins/` directory
     432. Activate the plugin through the `Plugins` menu in WordPress
     443. Configure your mPAY24 settings under `WooCommerce Settings -> Gateways -> MPAY24`
    4545
    4646== Frequently Asked Questions ==
     
    4848= Which payment methods does the plugin support? =
    4949
    50 The plugin supports credit cards (stable) and EPS Banking (experimental). It pulls the payment methods from your mPAY24 merchant account and shows all on the payment page.
     50The plugin supports all payment methods available with mPAY24. It pulls the payment methods from your mPAY24 merchant account and shows all on the payment page.
     51
     52= How can I change the styling of the payment page? =
     53
     54Unfortunatly there are no styling options via the WooCommerce Settings yet. If you need any styling you have to add styling in the function `createMDXI` in file `class-wc-mpay24-shop.php`. The specific code is commented. One rule for styling: You are not allowed to send markup with urls to external (not mPAY24 hosted files) files (e.g. background images).
     55
     56= I get an permission error for writing in MPay24 folder? =
     57
     58If you enable logging in the gateway settings then the curl operations will write a `curllog.log` in MPay24 folder. Please make this folder writable for the webserver.
    5159
    5260== Screenshots ==
     
    5765== Changelog ==
    5866
    59 = 1.0 = 
     67= 1.1 =
     68
     69* 2013-04-12: Update to WooCommerce 2.x
     70* plugin not backward compatible to WooCommerce version < 2.0
     71* update mPAY24 API to current version
     72* add some documentation for styling options of the mPAY24 payment page
     73
     74= 1.0 =
    6075
    6176* 2012-11-21: Initial Release
Note: See TracChangeset for help on using the changeset viewer.