From 21dc46b8da294c8c237f2321ced89afe6de575da Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 3 Sep 2017 10:35:28 +0300 Subject: [PATCH] Check Braintree credentials when adding gateway --- app/Ninja/PaymentDrivers/BraintreePaymentDriver.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/Ninja/PaymentDrivers/BraintreePaymentDriver.php b/app/Ninja/PaymentDrivers/BraintreePaymentDriver.php index ca9486514c62..980ad8003005 100644 --- a/app/Ninja/PaymentDrivers/BraintreePaymentDriver.php +++ b/app/Ninja/PaymentDrivers/BraintreePaymentDriver.php @@ -212,4 +212,15 @@ class BraintreePaymentDriver extends BasePaymentDriver ->send() ->getToken(); } + + public function isValid() + { + try { + $this->createTransactionToken(); + return true; + } catch (Exception $exception) { + return get_class($exception); + } + } + }