Changeset 696575
- Timestamp:
- 04/12/2013 01:44:49 PM (13 years ago)
- Location:
- woocommerce-mpay24-gateway
- Files:
-
- 50 added
- 11 edited
-
tags/1.1 (added)
-
tags/1.1/MPay24 (added)
-
tags/1.1/MPay24/MDXI.xsd (added)
-
tags/1.1/MPay24/MPay24Api.php (added)
-
tags/1.1/MPay24/MPay24Shop.php (added)
-
tags/1.1/MPay24/cacert.pem (added)
-
tags/1.1/MPay24/doc (added)
-
tags/1.1/MPay24/doc/__filesource (added)
-
tags/1.1/MPay24/doc/__filesource/fsource_mPAY24API__MPay24Api.php.html (added)
-
tags/1.1/MPay24/doc/__filesource/fsource_mPAY24API__MPay24Shop.php.html (added)
-
tags/1.1/MPay24/doc/__filesource/fsource_mPAY24API__orderXML.php.html (added)
-
tags/1.1/MPay24/doc/blank.html (added)
-
tags/1.1/MPay24/doc/classtrees_mPAY24API.html (added)
-
tags/1.1/MPay24/doc/elementindex.html (added)
-
tags/1.1/MPay24/doc/elementindex_mPAY24API.html (added)
-
tags/1.1/MPay24/doc/errors.html (added)
-
tags/1.1/MPay24/doc/how_to_confirm.html (added)
-
tags/1.1/MPay24/doc/how_to_order.html (added)
-
tags/1.1/MPay24/doc/index.html (added)
-
tags/1.1/MPay24/doc/li_mPAY24API.html (added)
-
tags/1.1/MPay24/doc/mPAY24API (added)
-
tags/1.1/MPay24/doc/mPAY24API/GeneralResponse.html (added)
-
tags/1.1/MPay24/doc/mPAY24API/ListPaymentMethodsResponse.html (added)
-
tags/1.1/MPay24/doc/mPAY24API/MPay24Api.html (added)
-
tags/1.1/MPay24/doc/mPAY24API/MPay24Shop.html (added)
-
tags/1.1/MPay24/doc/mPAY24API/ManagePaymentResponse.html (added)
-
tags/1.1/MPay24/doc/mPAY24API/ORDER.html (added)
-
tags/1.1/MPay24/doc/mPAY24API/PaymentResponse.html (added)
-
tags/1.1/MPay24/doc/mPAY24API/Transaction.html (added)
-
tags/1.1/MPay24/doc/mPAY24API/TransactionStatusResponse.html (added)
-
tags/1.1/MPay24/doc/mPAY24API/_MPay24Api.php.html (added)
-
tags/1.1/MPay24/doc/mPAY24API/_MPay24Shop.php.html (added)
-
tags/1.1/MPay24/doc/mPAY24API/_orderXML.php.html (added)
-
tags/1.1/MPay24/doc/media (added)
-
tags/1.1/MPay24/doc/media/banner.css (added)
-
tags/1.1/MPay24/doc/media/stylesheet.css (added)
-
tags/1.1/MPay24/doc/mpay24.png (added)
-
tags/1.1/MPay24/doc/packages.html (added)
-
tags/1.1/MPay24/orderXML.php (added)
-
tags/1.1/admin (added)
-
tags/1.1/admin/gateway-mpay24-install.php (added)
-
tags/1.1/assets (added)
-
tags/1.1/assets/images (added)
-
tags/1.1/assets/images/cards.png (added)
-
tags/1.1/class-wc-mpay24-shop.php (added)
-
tags/1.1/gateway-mpay24.php (added)
-
tags/1.1/languages (added)
-
tags/1.1/languages/wc-mpay24-de_DE.mo (added)
-
tags/1.1/languages/wc-mpay24-de_DE.po (added)
-
tags/1.1/readme.txt (added)
-
trunk/MPay24/MDXI.xsd (modified) (3 diffs)
-
trunk/MPay24/MPay24Api.php (modified) (8 diffs)
-
trunk/MPay24/doc/__filesource/fsource_mPAY24API__MPay24Api.php.html (modified) (4 diffs)
-
trunk/MPay24/doc/blank.html (modified) (2 diffs)
-
trunk/MPay24/doc/elementindex.html (modified) (3 diffs)
-
trunk/MPay24/doc/elementindex_mPAY24API.html (modified) (3 diffs)
-
trunk/MPay24/doc/mPAY24API/PaymentResponse.html (modified) (6 diffs)
-
trunk/MPay24/doc/mPAY24API/_MPay24Shop.php.html (modified) (1 diff)
-
trunk/class-wc-mpay24-shop.php (modified) (3 diffs)
-
trunk/gateway-mpay24.php (modified) (10 diffs)
-
trunk/readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woocommerce-mpay24-gateway/trunk/MPay24/MDXI.xsd
r636654 r696575 143 143 <xs:enumeration value="PAYPAL"/> 144 144 <xs:enumeration value="MPASS"/> 145 <xs:enumeration value="INVOICE"/> 146 <xs:enumeration value="HP"/> 147 <xs:enumeration value="SAFETYPAY"/> 145 148 </xs:restriction> 146 149 </xs:simpleType> … … 154 157 <xs:enumeration value="VISA"/> 155 158 <xs:enumeration value="JCB"/> 159 <xs:enumeration value="BANK-BGLD"/> 156 160 <xs:enumeration value="BAWAG"/> 157 161 <xs:enumeration value="BA"/> … … 168 172 <xs:enumeration value="HOBEX-DE"/> 169 173 <xs:enumeration value="HOBEX-NL"/> 174 <xs:enumeration value="BILLPAY"/> 170 175 </xs:restriction> 171 176 </xs:simpleType> -
woocommerce-mpay24-gateway/trunk/MPay24/MPay24Api.php
r636654 r696575 2 2 /** 3 3 * @author [email protected] 4 * @version $Id: MPay24Api.php 52 17 2012-10-16 05:27:43Z anna $4 * @version $Id: MPay24Api.php 5294 2013-01-17 11:54:45Z anna $ 5 5 * @filesource MPay24Api.php 6 6 * @license http://ec.europa.eu/idabc/eupl.html EUPL, Version 1.1 … … 540 540 */ 541 541 private function send() { 542 $userAgent = 'mPAY24 PHP API $Rev: 52 17 $ ($Date:: 2012-10-16#$)';542 $userAgent = 'mPAY24 PHP API $Rev: 5294 $ ($Date:: 2013-01-17 #$)'; 543 543 544 544 $ch = curl_init($this->etp_url); … … 602 602 function GeneralResponse($response) { 603 603 if($response != '') { 604 $responseAsDOM = new DOMDocument();605 $responseAsDOM->loadXML($response);604 $responseAsDOM = new DOMDocument(); 605 $responseAsDOM->loadXML($response); 606 606 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 } 615 615 } else { 616 616 $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!"; 618 618 } 619 619 } … … 660 660 /** 661 661 * @abstract Sets the values for a payment from the response from mPAY24: 662 * mPAY transaction ID, error number , location (URL) and external status662 * mPAY transaction ID, error number and location (URL) 663 663 * @param STRING The SOAP response from mPAY24 (in XML form) 664 664 */ … … 666 666 $this->generalResponse = new GeneralResponse($response); 667 667 if($response != '') { 668 $responseAsDOM = new DOMDocument();668 $responseAsDOM = new DOMDocument(); 669 669 $responseAsDOM->loadXML($response); 670 670 671 if(!empty($responseAsDOM) && is_object($responseAsDOM) )671 if(!empty($responseAsDOM) && is_object($responseAsDOM) && $responseAsDOM->getElementsByTagName('location')->length != 0) 672 672 $this->location = $responseAsDOM->getElementsByTagName('location')->item(0)->nodeValue; 673 673 } else { … … 721 721 $responseAsDOM->loadXML($response); 722 722 723 if($responseAsDOM ) {723 if($responseAsDOM && $responseAsDOM->getElementsByTagName('mpayTID')->length != 0 && $responseAsDOM->getElementsByTagName('tid')->length != 0) { 724 724 $this->mpayTID = $responseAsDOM->getElementsByTagName('mpayTID')->item(0)->nodeValue; 725 725 $this->tid = $responseAsDOM->getElementsByTagName('tid')->item(0)->nodeValue; … … 790 790 $responseAsDOM->loadXML($response); 791 791 792 if($responseAsDOM ) {792 if($responseAsDOM && $responseAsDOM->getElementsByTagName('all')->length != 0) { 793 793 $this->all = $responseAsDOM->getElementsByTagName('all')->item(0)->nodeValue; 794 794 … … 893 893 $responseAsDOM->loadXML($response); 894 894 895 if($responseAsDOM ) {895 if($responseAsDOM && $responseAsDOM->getElementsByTagName('name')->length != 0) { 896 896 $this->paramCount = $responseAsDOM->getElementsByTagName('name')->length; 897 897 $this->params['STATUS'] = $this->generalResponse->getStatus(); -
woocommerce-mpay24-gateway/trunk/MPay24/doc/__filesource/fsource_mPAY24API__MPay24Api.php.html
r636654 r696575 4 4 /** 5 5 * @author [email protected] 6 * @version $Id: fsource_mPAY24API__MPay24Api.php.html 52 18 2012-10-16 05:38:42Z anna $6 * @version $Id: fsource_mPAY24API__MPay24Api.php.html 5294 2013-01-17 11:54:45Z anna $ 7 7 * @filesource fsource_mPAY24API__MPay24Api.php.html 8 8 * @license http://ec.europa.eu/idabc/eupl.html EUPL, Version 1.1 … … 610 610 <li><div class="src-line"><a name="a617"></a> <span class="src-key">var </span><a href="../mPAY24API/PaymentResponse.html#var$location">$location</a><span class="src-sym">;</span></div></li> 611 611 <li><div class="src-line"><a name="a618"></a> <span class="src-doc">/**</span></div></li> 612 <li><div class="src-line"><a name="a619"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@var </span><span class="src-doc"> </span><span class="src-doc-type">STRING </span><span class="src-doc"> The external status from the request, which was sent to mPAY24</span></div></li>613 612 <li><div class="src-line"><a name="a620"></a><span class="src-doc"> */</span></div></li> 614 <li><div class="src-line"><a name="a621"></a> <span class="src-key">var </span><a href="../mPAY24API/PaymentResponse.html#var$externalStatus">$externalStatus</a><span class="src-sym">;</span></div></li>615 613 <li><div class="src-line"><a name="a622"></a> </div></li> 616 614 <li><div class="src-line"><a name="a623"></a> </div></li> 617 615 <li><div class="src-line"><a name="a624"></a> <span class="src-doc">/**</span></div></li> 618 616 <li><div class="src-line"><a name="a625"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@abstract</span><span class="src-doc"> Sets the values for a payment from the response from mPAY24:</span></div></li> 619 <li><div class="src-line"><a name="a626"></a><span class="src-doc"> * mPAY transaction ID, error number , location (URL) and external status</span></div></li>617 <li><div class="src-line"><a name="a626"></a><span class="src-doc"> * mPAY transaction ID, error number and location (URL)</span></div></li> 620 618 <li><div class="src-line"><a name="a627"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc"> </span><span class="src-doc-type">STRING </span><span class="src-doc"> The SOAP response from mPAY24 (in XML form)</span></div></li> 621 619 <li><div class="src-line"><a name="a628"></a><span class="src-doc"> */</span></div></li> … … 629 627 <li><div class="src-line"><a name="a636"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="../mPAY24API/PaymentResponse.html#var$errNo">errNo</a> = <span class="src-var">$responseAsDOM</span><span class="src-sym">-></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">-></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">-></span><span class="src-id">nodeValue</span><span class="src-sym">;</span></div></li> 630 628 <li><div class="src-line"><a name="a637"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="../mPAY24API/PaymentResponse.html#var$location">location</a> = <span class="src-var">$responseAsDOM</span><span class="src-sym">-></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">-></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">-></span><span class="src-id">nodeValue</span><span class="src-sym">;</span></div></li> 631 <li><div class="src-line"><a name="a638"></a> <span class="src-var">$this</span><span class="src-sym">-></span><a href="../mPAY24API/PaymentResponse.html#var$externalStatus">externalStatus</a> = <span class="src-var">$responseAsDOM</span><span class="src-sym">-></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">-></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">-></span><span class="src-id">nodeValue</span><span class="src-sym">;</span></div></li>632 629 <li><div class="src-line"><a name="a639"></a> <span class="src-sym">}</span></div></li> 633 630 <li><div class="src-line"><a name="a640"></a> <span class="src-sym">}</span></div></li> … … 655 652 <li><div class="src-line"><a name="a662"></a> </div></li> 656 653 <li><div class="src-line"><a name="a663"></a> <span class="src-doc">/**</span></div></li> 657 <li><div class="src-line"><a name="a664"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@return </span><span class="src-doc"> </span><span class="src-doc-type">STRING </span><span class="src-doc"> The external status, returned from mPAY24</span></div></li>658 654 <li><div class="src-line"><a name="a665"></a><span class="src-doc"> */</span></div></li> 659 <li><div class="src-line"><a name="a666"></a> <span class="src-key">public </span><span class="src-key">function </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> <span class="src-key">return </span><span class="src-var">$this</span><span class="src-sym">-></span><a href="../mPAY24API/PaymentResponse.html#var$externalStatus">externalStatus</a><span class="src-sym">;</span></div></li>661 655 <li><div class="src-line"><a name="a668"></a> <span class="src-sym">}</span></div></li> 662 656 <li><div class="src-line"><a name="a669"></a> </div></li> -
woocommerce-mpay24-gateway/trunk/MPay24/doc/blank.html
r636654 r696575 2 2 /** 3 3 * @author [email protected] 4 * @version $Id: blank.html 52 17 2012-10-16 05:27:43Z anna $4 * @version $Id: blank.html 5294 2013-01-17 11:54:45Z anna $ 5 5 * @filesource blank.html 6 6 * @license http://ec.europa.eu/idabc/eupl.html EUPL, Version 1.1 … … 166 166 $result = $myShop->pay(); 167 167 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(); 173 176 } 174 177 } -
woocommerce-mpay24-gateway/trunk/MPay24/doc/elementindex.html
r636654 r696575 4 4 /** 5 5 * @author [email protected] 6 * @version $Id: elementindex.html 52 17 2012-10-16 05:27:43Z anna $6 * @version $Id: elementindex.html 5294 2013-01-17 11:54:45Z anna $ 7 7 * @filesource elementindex.html 8 8 * @license http://ec.europa.eu/idabc/eupl.html EUPL, Version 1.1 … … 185 185 <div class="index-item-details"><a href="mPAY24API/PaymentResponse.html#var$errNo">PaymentResponse::$errNo</a> in MPay24Api.php</div> 186 186 </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"> 192 188 </dd> 193 189 <dt class="field"> … … 297 293 <div class="index-item-details"><a href="mPAY24API/MPay24Api.html#methodgetEtpURL">MPay24Api::getEtpURL()</a> in MPay24Api.php</div> 298 294 </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"> 304 296 </dd> 305 297 <dt class="field"> -
woocommerce-mpay24-gateway/trunk/MPay24/doc/elementindex_mPAY24API.html
r636654 r696575 4 4 /** 5 5 * @author [email protected] 6 * @version $Id: elementindex_mPAY24API.html 52 17 2012-10-16 05:27:43Z anna $6 * @version $Id: elementindex_mPAY24API.html 5294 2013-01-17 11:54:45Z anna $ 7 7 * @filesource elementindex_mPAY24API.html 8 8 * @license http://ec.europa.eu/idabc/eupl.html EUPL, Version 1.1 … … 221 221 <div class="index-item-details"><a href="mPAY24API/PaymentResponse.html#var$errNo">PaymentResponse::$errNo</a> in MPay24Api.php</div> 222 222 </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"> 228 225 </dd> 229 226 <dt class="field"> … … 333 330 <div class="index-item-details"><a href="mPAY24API/MPay24Api.html#methodgetEtpURL">MPay24Api::getEtpURL()</a> in MPay24Api.php</div> 334 331 </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"> 340 333 </dd> 341 334 <dt class="field"> -
woocommerce-mpay24-gateway/trunk/MPay24/doc/mPAY24API/PaymentResponse.html
r636654 r696575 4 4 /** 5 5 * @author [email protected] 6 * @version $Id: PaymentResponse.html 52 17 2012-10-16 05:27:43Z anna $6 * @version $Id: PaymentResponse.html 5294 2013-01-17 11:54:45Z anna $ 7 7 * @filesource PaymentResponse.html 8 8 * @license http://ec.europa.eu/idabc/eupl.html EUPL, Version 1.1 … … 68 68 </div> 69 69 <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">74 70 <span class="var-type">GeneralResponse</span> 75 71 <a href="#$generalResponse" title="details" class="var-name">$generalResponse</a> … … 111 107 </div> 112 108 <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">118 109 <span class="method-result">GeneralResponse</span> 119 110 <a href="#getGeneralResponse" title="details" class="method-name">getGeneralResponse</a> … … 168 159 169 160 </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 191 162 <a name="var$generalResponse" id="$generalResponse"><!-- --></A> 192 163 <div class="oddrow"> … … 288 259 <!-- ========== Info from phpDoc block ========= --> 289 260 <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> 291 262 </ul> 292 263 … … 324 295 <span class="method-name"> 325 296 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 getExternalStatus350 297 </span> 351 298 () -
woocommerce-mpay24-gateway/trunk/MPay24/doc/mPAY24API/_MPay24Shop.php.html
r636654 r696575 111 111 <ul class="tags"> 112 112 <li><span class="field">author:</span> [email protected]</li> 113 <li><span class="field">version:</span> $Id: _MPay24Shop.php.html 5 1732012-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> 114 114 <li><span class="field">license:</span> <a href="http://ec.europa.eu/idabc/eupl.html">EUPL, Version 1.1</a></li> 115 115 </ul> -
woocommerce-mpay24-gateway/trunk/class-wc-mpay24-shop.php
r636654 r696575 354 354 foreach ( $pTypes as $key => $value ) { 355 355 $mdxi->Order->PaymentTypes->Payment( $key+1 )->setType( $value ); 356 if ( ' EPS' != $value ) {356 if ( 'CC' == $value || 'ELV' == $value ) { 357 357 $mdxi->Order->PaymentTypes->Payment( $key+1 )->setBrand( $brands[ $key ] ); 358 358 } … … 360 360 361 361 $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(''); 362 370 363 371 $mdxi->Order->Customer = $this->getCustomer(); … … 370 378 $mdxi->Order->URL->Cancel = $this->getCancelUrl(); 371 379 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 372 400 return $mdxi; 373 401 } -
woocommerce-mpay24-gateway/trunk/gateway-mpay24.php
r636654 r696575 3 3 Plugin Name: WooCommerce mPAY24 Gateway 4 4 Plugin URI: http://www.woothemes.com/product-category/woocommerce-extensions/ 5 Description: Add mPAY24 Payment Gateway with credit card support to WooCommerce Plugin6 Version: 1. 05 Description: Add mPAY24 Payment Gateway with credit card support to WooCommerce Plugin 6 Version: 1.1 7 7 Author: datenwerk innovationsagentur GmbH 8 8 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 */ 13 12 14 13 // Exit if accessed directly … … 18 17 19 18 /** 20 * Check if WooCommerce is active21 **/22 if (in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {19 * Check if WooCommerce is active 20 **/ 21 if (in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { 23 22 24 23 if ( ! defined( 'GATEWAY_MPAY24_VERSION' ) ) { 25 define( 'GATEWAY_MPAY24_VERSION', '1. 0' );24 define( 'GATEWAY_MPAY24_VERSION', '1.1' ); 26 25 } 27 26 if ( ! defined( 'GATEWAY_MPAY24_TABLE_NAME' ) ) { … … 36 35 37 36 /** 38 * Localisation39 */37 * Localisation 38 */ 40 39 load_plugin_textdomain( 'wc-mpay24', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); 41 40 42 41 /** 43 * Installation (create table)44 */42 * Installation (create table) 43 */ 45 44 register_activation_hook( __FILE__, 'woocommerce_install_gateway_mpay24' ); 46 45 … … 52 51 53 52 /** 54 * Uninstallation (remove table and options)55 */53 * Uninstallation (remove table and options) 54 */ 56 55 register_uninstall_hook( __FILE__, 'woocommerce_uninstall_gateway_mpay24' ); 57 56 … … 62 61 63 62 /** 64 * Install check (for updates)65 */63 * Install check (for updates) 64 */ 66 65 add_action( 'plugins_loaded', 'woocommerce_check_dbupdate_gateway_mpay24' ); 67 66 … … 73 72 74 73 /** 75 * Welcome notices76 */74 * Welcome notices 75 */ 77 76 if ( '' == get_option( 'hide_gateway_mpay24_welcome_notice' ) ) { 78 77 add_action( 'admin_notices', 'woocommerce_welcome_notice_gateway_mpay24' ); … … 91 90 </div> 92 91 <?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 ); 104 93 } 105 94 106 95 /** 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 } 121 104 122 105 /** 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 ), 264 265 ); 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() 312 333 ); 313 334 314 // Remove cart315 $woocommerce->cart->empty_cart();316 317 // Empty awaiting payment session318 unset( $_SESSION['order_awaiting_payment'] );319 320 // Return thankyou redirect321 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 public332 * @return void333 * @see woocommerce/classes/class-wc-payment-gateway.php334 */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; ?> 338 359 <?php if ( $description = $this->get_description() ) : ?><p><?php echo wpautop( wptexturize( $description ) ); ?></p><?php endif; ?> 339 <?php340 } 341 342 /** 343 * Add text to thankyou page above order details344 * called by 'woocommerce_thankyou_mpay24' action345 *346 * @access public347 * @return void348 */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 */ 349 370 public function thankyou_page_text( $order ) { 350 371 ?> 351 372 <?php if ( '' != $this->thankyou_text ) : ?><p><?php echo wpautop( wptexturize( $this->thankyou_text ) ); ?></p><?php endif; ?> 352 <?php353 } 354 355 /** 356 * Add text to order confirmation mail to customer below order table357 * called by 'woocommerce_email_after_order_table' action358 *359 * @access public360 * @return void361 */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 */ 362 383 public function customer_email_text( $order, $sent_to_admin ) { 363 384 if ( $sent_to_admin ) { … … 370 391 ?> 371 392 <?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; 392 406 } 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' ); 404 434 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 */ 416 448 public function successful_request( $posted ) { 417 449 global $wpdb; … … 434 466 switch ( $tstatus ) { 435 467 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 438 480 if ( 'yes' == $this->debug ) { 439 $this->log->add( 'mpay24', ' Aborting, Order #' . $order->id . ' is alreadycomplete.' );481 $this->log->add( 'mpay24', 'Payment complete.' ); 440 482 } 441 exit;442 }443 444 // Payment completed445 $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 }451 483 break; 452 484 case 'reserved': 453 // Order pending454 $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 ) ); 455 487 break; 456 488 case 'error': 457 489 case 'suspended': 458 // Order failed459 $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 ) ); 460 492 break; 461 493 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 ) ); 463 495 break; 464 496 case 'reversed': 465 // Order cancelled466 $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 ) ); 467 499 break; 468 500 … … 477 509 478 510 /** 479 * Add the gateway to woocommerce480 */511 * Add the gateway to woocommerce 512 */ 481 513 function woocommerce_add_gateway_mpay24( $methods ) { 482 $methods[] = 'WC_ MPAY24';514 $methods[] = 'WC_Gateway_MPAY24'; 483 515 return $methods; 484 516 } -
woocommerce-mpay24-gateway/trunk/readme.txt
r667416 r696575 1 1 === WooCommerce mPAY24 Gateway === 2 2 3 Contributors: datenwerk 4 Donate link: 5 Tags: woocommerce, gateway, mpay24 6 Requires at least: 3. 47 Tested up to: 3.5. x8 Stable tag: 1. 09 License: GNU General Public License v3.0 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html 3 Contributors: datenwerk 4 Donate link: 5 Tags: woocommerce, gateway, mpay24 6 Requires at least: 3.5 7 Tested up to: 3.5.1 8 Stable tag: 1.1 9 License: GNU General Public License v3.0 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html 11 11 12 Add mPAY24 Payment Gateway with credit card support to WooCommerce Plugin.12 Add mPAY24 Payment Gateway to WooCommerce Plugin. 13 13 14 14 == Description == … … 16 16 = Features = 17 17 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 cards22 * 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 27 27 28 28 = mPAY24 = 29 29 30 If there are newer mPAY24 PHP Files you can replace the files in the folder `MPay24`. 30 If there are newer mPAY24 PHP Files you can replace the files in the folder `MPay24`. 31 31 If you want to extend the functionality (e.g. add styling for payment page) you have to edit `class-wc-mpay24-shop.php` 32 32 … … 35 35 = Requirements = 36 36 37 * php curl (mPAY24 API) 38 * [WooCommerce Plugin](http://www.woothemes.com/woocommerce/) v 1.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 39 39 40 40 = Manual installation = 41 41 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` 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` 45 45 46 46 == Frequently Asked Questions == … … 48 48 = Which payment methods does the plugin support? = 49 49 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. 50 The 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 54 Unfortunatly 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 58 If 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. 51 59 52 60 == Screenshots == … … 57 65 == Changelog == 58 66 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 = 60 75 61 76 * 2012-11-21: Initial Release
Note: See TracChangeset
for help on using the changeset viewer.