Mwalker has submitted this change and it was merged.

Change subject: WIP: WorldPay * Slightly improved stub - can now load the 
special page without firing up the warn machine
......................................................................


WIP: WorldPay
* Slightly improved stub - can now load the special page without
firing up the warn machine

Change-Id: Ifb0b4546ff18226d78fb64195a6a6ccc06c783ee
---
M DonationInterface.php
A worldpay_gateway/forms/worldpay.html
A worldpay_gateway/worldpay.adapter.php
A worldpay_gateway/worldpay_gateway.alias.php
A worldpay_gateway/worldpay_gateway.body.php
A worldpay_gateway/worldpay_gateway.i18n.php
6 files changed, 327 insertions(+), 0 deletions(-)

Approvals:
  Mwalker: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/DonationInterface.php b/DonationInterface.php
index ca46ef7..c808333 100644
--- a/DonationInterface.php
+++ b/DonationInterface.php
@@ -50,6 +50,7 @@
        'Amazon' => true,
        'Adyen' => true,
        'Paypal' => true,
+       'WorldPay' => true,
        'FormChooser' => true,
        'ReferrerFilter' => false, //extra
        'SourceFilter' => false, //extra
@@ -146,6 +147,12 @@
        $wgAutoloadClasses['PaypalGateway'] = $donationinterface_dir . 
'paypal_gateway/paypal_gateway.body.php';
        $wgAutoloadClasses['PaypalGatewayResult'] = $donationinterface_dir . 
'paypal_gateway/paypal_resultswitcher.body.php';
        $wgAutoloadClasses['PaypalAdapter'] = $donationinterface_dir . 
'paypal_gateway/paypal.adapter.php';
+}
+
+if ( $optionalParts['WorldPay'] === true ){
+       $wgDonationInterfaceClassMap['worldpay'] = 'WorldPayAdapter';
+       $wgAutoloadClasses['WorldPayGateway'] = $donationinterface_dir . 
'worldpay_gateway/worldpay_gateway.body.php';
+       $wgAutoloadClasses['WorldPayAdapter'] = $donationinterface_dir . 
'worldpay_gateway/worldpay.adapter.php';
 }
 
 
@@ -468,6 +475,20 @@
 #      );
 }
 
+if ( $optionalParts['WorldPay'] === true ) {
+       $wgDonationInterfaceEnabledGateways[] = 'worldpay';
+
+       $wgAdyenGatewayHtmlFormDir = $donationinterface_dir . 
'worldpay_gateway/forms/html';
+
+       $wgWorldPayGatewayURL = 'https://live.adyen.com';
+
+#      $wgWorldPayGatewayAccountInfo['example'] = array(
+#              'AccountName' => ''; // account identifier, not login name
+#              'SharedSecret' => ''; // entered in the skin editor
+#              'SkinCode' => '';
+#      );
+}
+
 //Stomp globals
 if ($optionalParts['Stomp'] === true){
        $wgStompServer = "";
@@ -759,6 +780,10 @@
        $wgSpecialPages['PaypalGateway'] = 'PaypalGateway';
        $wgSpecialPages['PaypalGatewayResult'] = 'PaypalGatewayResult';
 }
+//WorldPay
+if ( $optionalParts['WorldPay'] === true ){
+       $wgSpecialPages['WorldPayGateway'] = 'WorldPayGateway';
+}
 
 /**
  * HOOKS
@@ -1003,6 +1028,11 @@
        $wgExtensionMessagesFiles['PaypalGatewayAlias'] = 
$donationinterface_dir . 'paypal_gateway/paypal_gateway.alias.php';
 }
 
+if ( $optionalParts['WorldPay'] === true ){
+       $wgExtensionMessagesFiles['WorldPayGateway'] = $donationinterface_dir . 
'worldpay_gateway/worldpay_gateway.i18n.php';
+       $wgExtensionMessagesFiles['WorldPayGatewayAlias'] = 
$donationinterface_dir . 'worldpay_gateway/worldpay_gateway.alias.php';
+}
+
 /**
  * FUNCTIONS
  */
diff --git a/worldpay_gateway/forms/worldpay.html 
b/worldpay_gateway/forms/worldpay.html
new file mode 100644
index 0000000..c992207
--- /dev/null
+++ b/worldpay_gateway/forms/worldpay.html
@@ -0,0 +1,174 @@
+<script type="text/javascript">
+       mw.loader.using(
+               [ 'jquery.payment' ],
+               function() {
+                       //$( '#adyen-encrypted-form-number' ).payment( 
'formatCardNumber' );
+                       //$( '#expiry' ).payment( 'formatCardExpiry' );
+                       //$( '#adyen-encrypted-form-cvc' ).payment( 
'formatCardCVC' );
+               }
+       );
+
+       // these must go through RapidHTML and thus are inline
+       var amountErrors = ['#general|escape', '#retryMsg|escape', 
'#amount|escape'];
+       var billingErrors = [
+               '#fname|escape', '#lname|escape', '#city|escape', 
'#country|escape', '#street|escape',
+               '#state|escape', '#zip|escape', '#emailAdd|escape'
+       ];
+       var paymentErrors = ['#card_num|escape', '#card_type|escape', 
'#cvv|escape'];
+       var actionURL = "@action";
+       var scriptPath = "@script_path";
+</script>
+
+<table width="100%" cellspacing="0" cellpadding="0" border="0">
+       <tbody>
+       <tr>
+               <td id="appeal" valign="top">
+                       {{LanguageSwitch|2011FR/@appeal/text|@language}}
+               </td>
+               <td id="donate" valign="top">
+                       <div id="greenBackground" class="">
+                               <noscript>
+                                       <div id="noscript">
+                                               <p 
id="noscript-msg">%donate_interface-noscript-msg%</p>
+
+                                               <p 
id="noscript-redirect-msg">%donate_interface-noscript-redirect-msg%</p>
+
+                                               <p id="noscript-redirect-link">
+                                                       <a 
href="https://wikimediafoundation.org/wiki/Special:LandingCheck?basic=true&landing_page=DonateNonJS&language=@language&uselang=@language&country=@country";>https://wikimediafoundation.org/wiki/Special:LandingCheck?basic=true&landing_page=DonateNonJS&language=@language&uselang=@language&country=@country</a>
+                                               </p>
+                                       </div>
+                               </noscript>
+                               <p id="topError" 
class="creditcard-error-msg"></p>
+
+                               <form name="payment" method="post" 
action="@action" novalidate>
+                                       <div 
id="payflowpro_gateway-personal-info">
+                                               <table id="payflow-table-donor">
+                                                       <tbody>
+                                                       <tr>
+                                                               <td colspan="2">
+                                                                       <div 
id="step1header">
+                                                                               
<h3 class="amount_header">%donate_interface-amount-legend%: <span
+                                                                               
        id="selected-amount">{% block donation-amount currency_code 
%}</span></h3>
+                                                                       </div>
+                                                               </td>
+                                                       </tr>
+                                                       {% block 
personal-information country %}
+                                                       <tr>
+                                                               <td>
+                                                                       
<h3>%donate_interface-card-legend%</h3>
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       <input 
type="text" id="adyen-encrypted-form-holder-name" size="20"
+                                                                               
   autocomplete="off" data-encrypted-name="holderName"
+                                                                               
   placeholder="%donate_interface-donor-name%"/>
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       <input 
type="text" id="adyen-encrypted-form-number" size="20" pattern="\d*"
+                                                                               
   autocomplete="off" data-encrypted-name="number"
+                                                                               
   placeholder="%donate_interface-donor-card-num%"/>
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       <input 
type="text" id="adyen-encrypted-form-cvc" size="4" pattern="\d*"
+                                                                               
   autocomplete="off" data-encrypted-name="cvc"
+                                                                               
   placeholder="%donate_interface-card-security-code%"/>
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       <input 
type="text" id="expiry" size="9" pattern="\d*" autocomplete="off"
+                                                                               
   data-encrypted-name="expiryMonth"
+                                                                               
   placeholder="%donate_interface-card-expiration%"/>
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       <dl 
class="">
+                                                                               
<dd class="field" style="margin-bottom: 0; margin-left: 0;">
+                                                                               
        <div id="paymentSubmit" style="margin-top: 10px;"><input class="btn"
+                                                                               
                                                                                
                                         id="paymentSubmitBtn"
+                                                                               
                                                                                
                                         type="button"
+                                                                               
                                                                                
                                         value="%donate_interface-continue%"/>
+                                                                               
        </div>
+                                                                               
</dd>
+                                                                       </dl>
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       <div 
id="payment" class="gainlayout" style="height: 0;text-align: center;"></div>
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       <div 
class="mw-donate-submessage" id="payflowpro_gateway-donate-submessage">
+                                                                               
<img
+                                                                               
        
src="@script_path/extensions/DonationInterface/gateway_forms/includes/padlock.gif"
+                                                                               
        style="vertical-align:baseline;margin-right:4px;">
+                                                                               
%donate_interface-donate-click%
+                                                                       </div>
+                                                               </td>
+                                                       </tr>
+                                                       </tbody>
+                                               </table>
+                                       </div>
+
+                                       <input type="hidden" 
id="adyen-encrypted-form-expiry-generationtime" value="@timestamp"
+                                                  
data-encrypted-name="generationtime"/>
+
+                                       <input type="hidden" name="returnto" 
value="Thank_You/en"/>
+                                       <input type="hidden" value="0" 
name="PaypalRedirect" id="PaypalRedirect">
+                                       <input type="hidden" value="@amount" 
name="amount">
+                                       <!-- This should be included in the 
personal_information templates -->
+                                       <!--<input type="hidden" 
value="@country" name="country" id="country" />-->
+                                       <input type="hidden" 
value="@expiration" name="expiration" id="expiration"/>
+                                       <input type="hidden" 
value="@currency_code" name="currency_code"/>
+                                       <input type="hidden" 
value="@utm_source" name="utm_source"/>
+                                       <input type="hidden" 
value="@utm_medium" name="utm_medium"/>
+                                       <input type="hidden" 
value="@utm_campaign" name="utm_campaign"/>
+                                       <input type="hidden" value="@language" 
name="language"/>
+                                       <input type="hidden" value="@referrer" 
name="referrer"/>
+                                       <input type="hidden" value="@comment" 
name="comment"/>
+                                       <input type="hidden" 
value="@comment-option" name="comment-option"/>
+                                       <input type="hidden" value="1" 
name="email-opt"/>
+                                       <input type="hidden" value="@token" 
name="token"/>
+                                       <input type="hidden" value="@order_id" 
name="order_id"/>
+                                       <input type="hidden" 
value="@contribution_tracking_id" name="contribution_tracking_id"/>
+                                       <input type="hidden" value="@data_hash" 
name="data_hash"/>
+                                       <input type="hidden" 
value="@owa_session" name="owa_session"/>
+                                       <input type="hidden" value="@owa_ref" 
name="owa_ref"/>
+                                       <input type="hidden" value="@gateway" 
name="gateway"/>
+                                       <input type="hidden" value="cc" 
name="payment_method"/>
+                               </form>
+                       </div>
+                       <p 
id="informationsharing">%donate_interface-informationsharing|url%</p>
+                       <table>
+                               <tr>
+                                       <td>
+                                               <ul id="moreinfolinks">
+                                                       <li><a
+                                                               
href="https://wikimediafoundation.org/wiki/Special:LandingCheck?landing_page=Problems_donating&basic=true&country=@country&language=@language&uselang=@language}}";>%donate_interface-problemsdonating%</a>
+                                                       </li>
+                                                       <li><a
+                                                               
href="https://wikimediafoundation.org/wiki/Special:LandingCheck?basic=true&landing_page=Ways_to_Give&language=@language&uselang=@language&country=@country";>%donate_interface-otherways-short%</a>
+                                                       </li>
+                                                       <li><a
+                                                               
href="https://wikimediafoundation.org/wiki/Special:LandingCheck?basic=true&landing_page=FAQ&language=@language&uselang=@language&country=@country";>%donate_interface-faqs%</a>
+                                                       </li>
+                                                       <li><a
+                                                               
href="https://wikimediafoundation.org/wiki/Special:LandingCheck?basic=true&landing_page=Tax_Deductibility&language=@language&uselang=@language&country=@country";>%donate_interface-tax-info%</a>
+                                                       </li>
+                                               </ul>
+                                       </td>
+                                       <td>@verisign_logo</td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+       </tbody>
+</table>
\ No newline at end of file
diff --git a/worldpay_gateway/worldpay.adapter.php 
b/worldpay_gateway/worldpay.adapter.php
new file mode 100644
index 0000000..d0f3ac6
--- /dev/null
+++ b/worldpay_gateway/worldpay.adapter.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Wikimedia Foundation
+ *
+ * LICENSE
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+/**
+ * WorldPayAdapter
+ *
+ */
+class WorldPayAdapter extends GatewayAdapter {
+
+       const GATEWAY_NAME = 'WorldPay Gateway';
+       const IDENTIFIER = 'worldpay';
+       const GLOBAL_PREFIX = 'wgWorldPayGateway'; //...for example.
+
+       public $communication_type = 'xml'; //this needs to be either 'xml' or 
'namevalue'
+       public $redirect = FALSE;
+
+       function getResponseStatus( $response ) {}
+       function getResponseErrors( $response ) {}
+       function getResponseData( $response ) {}
+       public function processResponse( $response, &$retryVars = null ) {}
+       function defineStagedVars() {}
+       function defineTransactions() {}
+       function defineErrorMap() {}
+       function defineVarMap() {}
+       function defineDataConstraints() {}
+       function defineAccountInfo() {}
+       function defineReturnValueMap() {}
+       function definePaymentMethods() {}
+       function defineOrderIDMeta() {
+               $this->order_id_meta = array (
+                       'generate' => TRUE,
+               );
+       }
+
+       function setGatewayDefaults() {}
+       static function getCurrencies() {}
+
+}
diff --git a/worldpay_gateway/worldpay_gateway.alias.php 
b/worldpay_gateway/worldpay_gateway.alias.php
new file mode 100644
index 0000000..c5cd9ab
--- /dev/null
+++ b/worldpay_gateway/worldpay_gateway.alias.php
@@ -0,0 +1,8 @@
+<?php
+
+$specialPageAliases = array();
+
+/** English */
+$specialPageAliases['en'] = array(
+       'WorldPayGateway' => array( 'WorldPayGateway' ),
+);
\ No newline at end of file
diff --git a/worldpay_gateway/worldpay_gateway.body.php 
b/worldpay_gateway/worldpay_gateway.body.php
new file mode 100644
index 0000000..1265e02
--- /dev/null
+++ b/worldpay_gateway/worldpay_gateway.body.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Wikimedia Foundation
+ *
+ * LICENSE
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+/**
+ * WorldPayGateway
+ *
+ */
+class WorldPayGateway extends GatewayForm {
+
+       /**
+        * Constructor - set up the new special page
+        */
+       public function __construct() {
+               $this->adapter = new WorldPayAdapter();
+               parent::__construct(); //the next layer up will know who we are.
+       }
+
+       /**
+        * Show the special page
+        *
+        * @todo
+        * - Finish error handling
+        *
+        * @param $par Mixed: parameter passed to the page or null
+        */
+       public function execute( $par ) {
+               $this->getOutput()->addModules( 'jquery.payment' );
+               $this->setHeaders();
+
+       }
+}
diff --git a/worldpay_gateway/worldpay_gateway.i18n.php 
b/worldpay_gateway/worldpay_gateway.i18n.php
new file mode 100644
index 0000000..ef5fc77
--- /dev/null
+++ b/worldpay_gateway/worldpay_gateway.i18n.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Internationalization file for the Donation Interface - WorldPay - extension
+ *
+ * @file
+ * @ingroup Extensions
+ */
+
+$messages = array();
+
+/** English */
+$messages['en'] = array(
+);
+
+$messages['qqq'] = array(
+);
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/118056
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifb0b4546ff18226d78fb64195a6a6ccc06c783ee
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Mwalker <mwal...@wikimedia.org>
Gerrit-Reviewer: Adamw <awi...@wikimedia.org>
Gerrit-Reviewer: Katie Horn <kh...@wikimedia.org>
Gerrit-Reviewer: Mwalker <mwal...@wikimedia.org>
Gerrit-Reviewer: Ssmith <ssm...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to