Mwalker has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/73381


Change subject: Log & Show an Error if There is No Form
......................................................................

Log & Show an Error if There is No Form

Whoo

Change-Id: Ibbab619ea8fd71da9cb8a10e07d02650d37cbc28
---
M gateway_common/interface.i18n.php
M special/GatewayFormChooser.php
2 files changed, 11 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/81/73381/1

diff --git a/gateway_common/interface.i18n.php 
b/gateway_common/interface.i18n.php
index 2bd0bd3..6758fd1 100644
--- a/gateway_common/interface.i18n.php
+++ b/gateway_common/interface.i18n.php
@@ -216,6 +216,7 @@
        'donate_interface-error-msg-fiscal_number' => 'fiscal number',
        'donate_interface-donate-error-try-a-different-card' => 'Please [$1 try 
a different card] or one of our [$2 other ways to give] or contact us at $3',
        'donate_interface-donate-error-thank-you-for-your-support' => 'Thank 
you for your support!',
+       'donate_interface-error-no-form' => 'We were unable to find a donation 
form matching your parameters. Please contact [mailto:[email protected] our 
help team] for more information.',
        'php-response-declined' => 'Your transaction could not be accepted.',
        'donate_interface-thankyou' => 'Thank you for your donation!',
        'donate_interface-post-transaction' => 'Transaction details',
@@ -783,6 +784,7 @@
 * $3 - an e-mail address link such as: mailto:[email protected]',
        'donate_interface-donate-error-thank-you-for-your-support' => 'Thank 
you for your support!',
        'php-response-declined' => 'Error message if the translaction was 
declined.',
+       'donate_interface-error-no-form' => 'Error message given if no form or 
payment method is available in this language/country/currency.',
        'donate_interface-thankyou' => 'A thank you for donating.',
        'donate_interface-post-transaction' => 'Header for transaction details 
after the transaction is fulfilled (receipt).',
        'donate_interface-cvv-explain' => 'Explanation of what CVV is.',
diff --git a/special/GatewayFormChooser.php b/special/GatewayFormChooser.php
index 61db9f3..8ffb6a1 100644
--- a/special/GatewayFormChooser.php
+++ b/special/GatewayFormChooser.php
@@ -39,6 +39,15 @@
                $forms = self::getAllValidForms( $country, $currency, 
$paymentMethod, $paymentSubMethod, $recurring, $gateway );
                $form = self::pickOneForm( $forms, $currency, $country );
 
+               if ( $form === null ) {
+                       GatewayAdapter::log(
+                               "Not able to find a valid form for country 
'$country', currency '$currency', method '$paymentMethod', submethod 
'$paymentSubMethod', recurring: '$recurring', gateway '$gateway'",
+                               LOG_ERR
+                       );
+                       $this->getOutput()->showErrorPage( 
'donate_interface-error-msg-general', 'donate_interface-error-no-form' );
+                       return;
+               }
+
                // And... construct the URL
                $params = array(
                        'form_name' => "RapidHtml",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibbab619ea8fd71da9cb8a10e07d02650d37cbc28
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Mwalker <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to