diff --git a/app/PaymentDrivers/BraintreePaymentDriver.php b/app/PaymentDrivers/BraintreePaymentDriver.php index 6f90f0cd1482..ec64d62f9a5f 100644 --- a/app/PaymentDrivers/BraintreePaymentDriver.php +++ b/app/PaymentDrivers/BraintreePaymentDriver.php @@ -157,34 +157,6 @@ class BraintreePaymentDriver extends BaseDriver } } - // public function updateCustomer() - // { - // $customer = $this->findOrCreateCustomer(); - - // $result = $this->gateway->customer()->update( - // $customer->id, - // [ - // 'firstName' => $this->client->present()->name(), - // 'email' => $this->client->present()->email(), - // 'phone' => $this->client->present()->phone(), - // 'creditCard' => [ - // 'billingAddress' => [ - // 'options' => [ - // 'updateExisting' => true - // ], - // 'firstName' => $this->client->present()->first_name() ?: $this->client->present()->name(), - // 'lastName' => $this->client->present()->last_name() ?: '', - // 'streetAddress' => $this->client->address1 ?: '', - // 'extendedAddress' =>$this->client->address2 ?: '', - // 'locality' => $this->client->city ?: '', - // 'postalCode' => $this->client->postal_code ?: '', - // 'countryCodeAlpha2' => $this->client->country ? $this->client->country->iso_3166_2 : 'US', - // ], - // ], - // ] - // ); - // } - public function refund(Payment $payment, $amount, $return_client_response = false) { $this->init(); @@ -324,13 +296,21 @@ class BraintreePaymentDriver extends BaseDriver nlog('braintree webhook'); - // if($webhookNotification) - // nlog($webhookNotification->kind); - - // // Example values for webhook notification properties - // $message = $webhookNotification->kind; // "subscription_went_past_due" - // $message = $webhookNotification->timestamp->format('D M j G:i:s T Y'); // "Sun Jan 1 00:00:00 UTC 2012" - return response()->json([], 200); } + + public function auth(): bool + { + + try { + $ct =$this->init()->gateway->clientToken()->generate(); + nlog($ct); + return true; + } + catch(\Exception $e) { + + } + + return false; + } } diff --git a/app/PaymentDrivers/CheckoutComPaymentDriver.php b/app/PaymentDrivers/CheckoutComPaymentDriver.php index 176a763507b9..65b51718b8c4 100644 --- a/app/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/PaymentDrivers/CheckoutComPaymentDriver.php @@ -534,4 +534,16 @@ class CheckoutComPaymentDriver extends BaseDriver { // Gateway doesn't support this feature. } + + public function auth(): bool + { + try{ + $this->init()->gateway->getCustomersClient('x'); + return true; + } + catch(\Exception $e){ + + } + return false; + } } diff --git a/app/PaymentDrivers/EwayPaymentDriver.php b/app/PaymentDrivers/EwayPaymentDriver.php index 92459d460d32..2ce3deb8b986 100644 --- a/app/PaymentDrivers/EwayPaymentDriver.php +++ b/app/PaymentDrivers/EwayPaymentDriver.php @@ -211,4 +211,13 @@ class EwayPaymentDriver extends BaseDriver return $fields; } + + public function auth(): bool + { + + $response =$this->init()->eway->queryTransaction('xx'); + + return (bool) count($response->getErrors()) == 0; + + } } diff --git a/app/PaymentDrivers/FortePaymentDriver.php b/app/PaymentDrivers/FortePaymentDriver.php index 2a9ebb440ad3..16054c031e5d 100644 --- a/app/PaymentDrivers/FortePaymentDriver.php +++ b/app/PaymentDrivers/FortePaymentDriver.php @@ -11,13 +11,14 @@ namespace App\PaymentDrivers; -use App\Jobs\Util\SystemLogger; -use App\Models\GatewayType; use App\Models\Payment; use App\Models\SystemLog; -use App\PaymentDrivers\Forte\ACH; -use App\PaymentDrivers\Forte\CreditCard; +use App\Models\GatewayType; +use App\Jobs\Util\SystemLogger; use App\Utils\Traits\MakesHash; +use App\PaymentDrivers\Forte\ACH; +use Illuminate\Support\Facades\Http; +use App\PaymentDrivers\Forte\CreditCard; class FortePaymentDriver extends BaseDriver { @@ -183,6 +184,29 @@ class FortePaymentDriver extends BaseDriver ]; } + public function auth(): bool + { + + $forte_base_uri = "https://sandbox.forte.net/api/v3/"; + if ($this->company_gateway->getConfigField('testMode') == false) { + $forte_base_uri = "https://api.forte.net/v3/"; + } + $forte_api_access_id = $this->company_gateway->getConfigField('apiAccessId'); + $forte_secure_key = $this->company_gateway->getConfigField('secureKey'); + $forte_auth_organization_id = $this->company_gateway->getConfigField('authOrganizationId'); + $forte_organization_id = $this->company_gateway->getConfigField('organizationId'); + $forte_location_id = $this->company_gateway->getConfigField('locationId'); + + $response = Http::withBasicAuth($forte_api_access_id, $forte_secure_key) + ->withHeaders(['X-Forte-Auth-Organization-Id' => $forte_organization_id]) + ->get("{$forte_base_uri}/organizations/{$forte_organization_id}/locations/{$forte_location_id}/customers/"); + + // nlog("{$forte_base_uri}/organizations/org_{$forte_organization_id}/customers/"); + // {{baseURI}}/organizations/org_{{organizationID}}/locations/loc_{{locationID}}/customers + + return $response->successful(); + + } // public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash) // { // return $this->payment_method->yourTokenBillingImplmentation();