Cdentinger has uploaded a new change for review. https://gerrit.wikimedia.org/r/234579
Change subject: WIP optional address fields for mustache ...................................................................... WIP optional address fields for mustache This is a very basic example of my approach. l10n seems like it will be the biggest challenge, determining what fields to show where and how to map them in the DB. Wondering if we already have an example of that in RapidHTML? Change-Id: Ie22af578ad5190c350a02fa0a649e877f8331aef --- M gateway_forms/mustache/personal_info.html.mustache M worldpay_gateway/worldpay.adapter.php 2 files changed, 27 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface refs/changes/79/234579/1 diff --git a/gateway_forms/mustache/personal_info.html.mustache b/gateway_forms/mustache/personal_info.html.mustache index 4622774..184c39f 100644 --- a/gateway_forms/mustache/personal_info.html.mustache +++ b/gateway_forms/mustache/personal_info.html.mustache @@ -8,6 +8,18 @@ <input class="fullwidth" name="email" value="{{ email }}" type="email" title="{{ l10n "donate_interface-donor-email" }}" placeholder="{{ l10n "donate_interface-donor-email" }}" id="email" required> </td> </tr> +{{# address_required }} + <tr> + <td> + <input class="fullwidth" name="street" value="{{ street }}" type="text" title="{{ l10n "donate_interface-donor-street" }}" placeholder="{{ l10n "donate_interface-donor-street" }}" id="street" required> + </td> + </tr> + <tr> + <td> + <input class="halfwidth" name="city" value="{{ city }}" type="text" placeholder="{{ l10n "donate_interface-donor-city" }}" id="city" required><input class="halfwidth" name="state" value="{{ state }}" type="text" placeholder="{{ l10n "donate_interface-donor-state" }}" id="state" required> + </td> + </tr> +{{/ address_required }} {{# fiscal_number_required }} <tr> <td> diff --git a/worldpay_gateway/worldpay.adapter.php b/worldpay_gateway/worldpay.adapter.php index 84481d1..927f270 100644 --- a/worldpay_gateway/worldpay.adapter.php +++ b/worldpay_gateway/worldpay.adapter.php @@ -182,6 +182,13 @@ parent::__construct( $options ); } + public function getFormClass() { + if ( $this->dataObj->getVal_Escaped( 'ffname' ) === 'wp-if' ) { + return 'Gateway_Form_Mustache'; + } + return parent::getFormClass(); + } + public function getCommunicationType() { return 'xml'; } @@ -951,6 +958,14 @@ return 'StringIn=' . str_replace( "\n", '', $xml ); } + public function getRequiredFields() { + $fields = parent::getRequiredFields(); + if ( $this->dataObj->getVal_Escaped( 'ffname' ) === 'wp-if' ) { + $fields[] = 'address'; + } + return $fields; + } + // override the charset from the parent function protected function getTransactionSpecificValue( $gateway_field_name, $token = false ) { $original = parent::getTransactionSpecificValue( $gateway_field_name, $token ); -- To view, visit https://gerrit.wikimedia.org/r/234579 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie22af578ad5190c350a02fa0a649e877f8331aef Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DonationInterface Gerrit-Branch: master Gerrit-Owner: Cdentinger <cdentin...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits