Selaa lähdekoodia

Merge pull request #1365 from Oldiesmann/release-2.1

+ Add new setting for Paypal Sandbox email (fixes #1168)
Michael Eshom 10 vuotta sitten
vanhempi
commit
deb62f42b8

+ 10 - 3
Sources/Subscriptions-PayPal.php

@@ -38,9 +38,13 @@ class paypal_display
 
 		$setting_data = array(
 			array(
-				'text', 'paypal_email',
+				'email', 'paypal_email',
 				'subtext' => $txt['paypal_email_desc']
 			),
+			array(
+				'email', 'paypal_sandbox_email',
+				'subtext' => $txt['paypal_sandbox_email_desc']
+			),
 		);
 
 		return $setting_data;
@@ -149,7 +153,7 @@ class paypal_payment
 		global $modSettings;
 
 		// Has the user set up an email address?
-		if (empty($modSettings['paypal_email']))
+		if ((empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_email'])) || empty($modSettings['paypal_sandbox_email']))
 			return false;
 		// Check the correct transaction types are even here.
 		if ((!isset($_POST['txn_type']) && !isset($_POST['payment_status'])) || (!isset($_POST['business']) && !isset($_POST['receiver_email'])))
@@ -158,7 +162,10 @@ class paypal_payment
 		if (!isset($_POST['business']))
 			$_POST['business'] = $_POST['receiver_email'];
 
-		if ($modSettings['paypal_email'] !== $_POST['business'] && (empty($modSettings['paypal_additional_emails']) || !in_array($_POST['business'], explode(',', $modSettings['paypal_additional_emails']))))
+		// Are we testing?
+		if (!empty($modSettings['paidsubs_test']) && $modSettings['paypal_sandbox_email'] !== $_POST['business'] && (empty($modSettings['paypal_additional_emails']) || !in_array($_POST['business'], explode(',', $modSettings['paypal_additional_emails']))))
+			return false;
+		elseif ($modSettings['paypal_email'] !== $_POST['business'] && (empty($modSettings['paypal_additional_emails']) || !in_array($_POST['business'], explode(',', $modSettings['paypal_additional_emails']))))
 			return false;
 		return true;
 	}

+ 2 - 0
Themes/default/languages/ManagePaid.english.php

@@ -48,6 +48,8 @@ $txt['paid_currency_symbol'] = 'Symbol used by payment method';
 $txt['paid_currency_symbol_desc'] = 'Use \'%1.2f\' to specify where number goes, for example $%1.2f, %1.2fDM etc';
 $txt['paypal_email'] = 'Paypal email address';
 $txt['paypal_email_desc'] = 'Leave blank if you do not wish to use paypal.';
+$txt['paypal_sandbox_email'] = 'Paypal sandbox email address';
+$txt['paypal_sandbox_email_desc'] = 'Can be left blank if test mode is disabled or not using PayPal.'; 
 $txt['worldpay_id'] = 'WorldPay Install ID';
 $txt['worldpay_id_desc'] = 'The Install ID generated by WorldPay. Leave blank if you are not using WorldPay';
 $txt['worldpay_password'] = 'WorldPay Callback Password';