Ejegg has uploaded a new change for review. https://gerrit.wikimedia.org/r/238661
Change subject: Bring Amazon branch in line with WP templating ...................................................................... Bring Amazon branch in line with WP templating Remove method-specific partial, stop using nested properties for required fields, remove profile_provided. Bug: T111424 Change-Id: Ib9c423d6155485760719c2ffcded806e6ff31d00 --- M amazon_gateway/amazon.adapter.php M amazon_gateway/amazon.js M gateway_common/gateway.adapter.php M gateway_forms/Mustache.php D gateway_forms/mustache/amazon_payment.html.mustache M gateway_forms/mustache/index.html.mustache M gateway_forms/mustache/payment_method.html.mustache M gateway_forms/mustache/personal_info.html.mustache 8 files changed, 20 insertions(+), 20 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface refs/changes/61/238661/1 diff --git a/amazon_gateway/amazon.adapter.php b/amazon_gateway/amazon.adapter.php index 49b2e88..e6f5062 100644 --- a/amazon_gateway/amazon.adapter.php +++ b/amazon_gateway/amazon.adapter.php @@ -130,9 +130,7 @@ public function definePaymentMethods() { $this->payment_methods = array( - 'amazon' => array( - 'profile_provided' => true, // Donor needn't enter name/email - ), + 'amazon' => array(), ); $this->payment_submethods = array( diff --git a/amazon_gateway/amazon.js b/amazon_gateway/amazon.js index 6f2cc1e..4759df2 100644 --- a/amazon_gateway/amazon.js +++ b/amazon_gateway/amazon.js @@ -13,6 +13,13 @@ billingAgreementId, orderReferenceId; + $( function() { + // Add a couple divs to hold the widgets + var container = $( '.submethods' ).parent(); + container.prepend( '<div id="walletWidget" />' ); + container.prepend( '<div id="amazonLogin" />' ); + }); + // Adapted from Amazon documentation, will get parameters from fragment as // well as querystring and accepts Amazon's custom delimiters function getURLParameter( name, source ) { diff --git a/gateway_common/gateway.adapter.php b/gateway_common/gateway.adapter.php index 59f6bf8..ff53add 100644 --- a/gateway_common/gateway.adapter.php +++ b/gateway_common/gateway.adapter.php @@ -93,7 +93,6 @@ * Values = metadata about the method * 'validation' should be an array whose keys are field names and * whose values indicate whether the field is required - * 'profile_provided' means we don't need to collect donor name / email * FIXME: 'label' is often set (untranslated) but never used */ function definePaymentMethods(); diff --git a/gateway_forms/Mustache.php b/gateway_forms/Mustache.php index 3091baf..4251104 100644 --- a/gateway_forms/Mustache.php +++ b/gateway_forms/Mustache.php @@ -90,12 +90,6 @@ $appealWikiTemplate = str_replace( '$language', $data['language'], $appealWikiTemplate ); $data['appeal_text'] = $output->parse( '{{' . $appealWikiTemplate . '}}' ); - $method = $this->gateway->getPaymentMethod(); - if ( $method ) { - $data["is_$method"] = true; - $data['method_metadata'] = $this->gateway->getPaymentMethodMeta(); - } - $availableSubmethods = $this->gateway->getAvailableSubmethods(); // Need to add submethod key to its array 'cause mustache doesn't get keys $data['submethods'] = array(); @@ -109,6 +103,12 @@ $data['button_class'] = count( $data['submethods'] ) % 4 === 0 ? 'four-per-line' : 'three-per-line'; + $data['is_cc'] = ( $this->gateway->getPaymentMethod() === 'cc' ); + + $required_fields = $this->gateway->getRequiredFields(); + foreach( $required_fields as $field ) { + $data["{$field}_required"] = true; + } foreach( $this->gateway->getCurrencies() as $currency ) { $data['currencies'][] = array( diff --git a/gateway_forms/mustache/amazon_payment.html.mustache b/gateway_forms/mustache/amazon_payment.html.mustache deleted file mode 100644 index 95d22c7..0000000 --- a/gateway_forms/mustache/amazon_payment.html.mustache +++ /dev/null @@ -1,3 +0,0 @@ - <div id="amazonLogin"></div> - <div id="walletWidget"></div> - <div id="consentWidget"></div> diff --git a/gateway_forms/mustache/index.html.mustache b/gateway_forms/mustache/index.html.mustache index 471a74f..f410555 100644 --- a/gateway_forms/mustache/index.html.mustache +++ b/gateway_forms/mustache/index.html.mustache @@ -26,9 +26,7 @@ <h3 class="cc_header">{{ l10n "donate_interface-cc-form-header-personal" }}<img src="{{ script_path }}/extensions/DonationInterface/gateway_forms/includes/padlock.gif" style="vertical-align:baseline;margin-left:8px;"></h3> </td> </tr> -{{^ method_metadata.profile_provided }} {{> personal_info }} -{{/ method_metadata.profile_provided }} {{> payment_method }} </tbody> </table> diff --git a/gateway_forms/mustache/payment_method.html.mustache b/gateway_forms/mustache/payment_method.html.mustache index 8a47b78..970b77c 100644 --- a/gateway_forms/mustache/payment_method.html.mustache +++ b/gateway_forms/mustache/payment_method.html.mustache @@ -1,8 +1,5 @@ <tr> <td> -{{# is_amazon }} -{{> amazon_payment }} -{{/ is_amazon }} <dl class="submethods"> <dd class="field" style="margin-bottom: 0; margin-left: 0;"> <ul class="options-h enabled {{ button_class }}" id="cards" style="margin: 0;"> diff --git a/gateway_forms/mustache/personal_info.html.mustache b/gateway_forms/mustache/personal_info.html.mustache index 7d2474a..83a7ad5 100644 --- a/gateway_forms/mustache/personal_info.html.mustache +++ b/gateway_forms/mustache/personal_info.html.mustache @@ -1,17 +1,21 @@ +{{# fname_required }}{{! if we don't need the fname, hide the whole name cell }} <tr> <td> <input class="halfwidth" name="fname" value="{{ fname }}" type="text" placeholder="{{ l10n "donate_interface-donor-fname" }}" id="fname" required><input class="halfwidth" name="lname" value="{{ lname }}" type="text" placeholder="{{ l10n "donate_interface-donor-lname" }}" id="lname" required> </td> </tr> +{{/ fname_required }} +{{# email_required }} <tr> <td> <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> -{{# method_metadata.validation.fiscal_number }} +{{/ email_required }} +{{# fiscal_number_required }} <tr> <td> <input class="fullwidth" name="fiscal_number" value="{{ fiscal_number }}" type="text" title="{{ l10n "donate_interface-donor-fiscal_number" }}" placeholder="{{ l10n "donate_interface-donor-fiscal_number" }}" id="fiscal_number" required > </td> </tr> -{{/ method_metadata.validation.fiscal_number }} +{{/ fiscal_number_required }} -- To view, visit https://gerrit.wikimedia.org/r/238661 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib9c423d6155485760719c2ffcded806e6ff31d00 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DonationInterface Gerrit-Branch: amazon Gerrit-Owner: Ejegg <eeggles...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits