Init
This commit is contained in:
parent
24e450cddd
commit
be95286690
|
|
@ -583,8 +583,9 @@ class CompanyGatewayController extends BaseController
|
|||
|
||||
public function test(TestCompanyGatewayRequest $request, CompanyGateway $company_gateway)
|
||||
{
|
||||
|
||||
return response()->json(['message' => $company_gateway->driver()->auth() ? 'true' : 'false'], 200);
|
||||
$message = $company_gateway->driver()->auth();
|
||||
$is_ok = $message === 'ok';
|
||||
return response()->json(['message' => $message], $is_ok ? 200 : 400);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -205,8 +205,8 @@ class AuthorizePaymentDriver extends BaseDriver
|
|||
return $this->import();
|
||||
}
|
||||
|
||||
public function auth(): bool
|
||||
public function auth(): string
|
||||
{
|
||||
return $this->init()->getPublicClientKey() ?? false;
|
||||
return $this->init()->getPublicClientKey() ? 'ok' : 'error';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -912,11 +912,11 @@ class BaseDriver extends AbstractPaymentDriver
|
|||
/**
|
||||
* Stub for checking authentication.
|
||||
*
|
||||
* @return bool
|
||||
* @return string
|
||||
*/
|
||||
public function auth(): bool
|
||||
public function auth(): string
|
||||
{
|
||||
return true;
|
||||
return 'ok';
|
||||
}
|
||||
|
||||
public function importCustomers()
|
||||
|
|
|
|||
|
|
@ -145,20 +145,19 @@ class BlockonomicsPaymentDriver extends BaseDriver
|
|||
return $this->payment_method->refund($payment, $amount); //this is your custom implementation from here
|
||||
}
|
||||
|
||||
public function auth(): bool
|
||||
public function auth(): string
|
||||
{
|
||||
try {
|
||||
|
||||
$api_key = $this->company_gateway->getConfigField('apiKey');
|
||||
$url = $this->NEW_ADDRESS_URL . '?reset=1';
|
||||
$response = Http::withToken($api_key)
|
||||
->post($url, []);
|
||||
if($response->successful()) {
|
||||
return true;
|
||||
return 'ok';
|
||||
}
|
||||
return false;
|
||||
return 'error';
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -333,18 +333,18 @@ class BraintreePaymentDriver extends BaseDriver
|
|||
return response()->json([], 200);
|
||||
}
|
||||
|
||||
public function auth(): bool
|
||||
public function auth(): string
|
||||
{
|
||||
|
||||
try {
|
||||
$ct = $this->init()->gateway->clientToken()->generate();
|
||||
|
||||
return true;
|
||||
return 'ok';
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
return 'error';
|
||||
}
|
||||
|
||||
private function find(string $customer_id = '')
|
||||
|
|
|
|||
|
|
@ -190,13 +190,13 @@ class CBAPowerBoardPaymentDriver extends BaseDriver
|
|||
{
|
||||
}
|
||||
|
||||
public function auth(): bool
|
||||
public function auth(): string
|
||||
{
|
||||
$this->init();
|
||||
|
||||
$this->settings()->updateSettings();
|
||||
|
||||
return true;
|
||||
return 'ok';
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -538,15 +538,15 @@ class CheckoutComPaymentDriver extends BaseDriver
|
|||
// Gateway doesn't support this feature.
|
||||
}
|
||||
|
||||
public function auth(): bool
|
||||
public function auth(): string
|
||||
{
|
||||
try {
|
||||
$this->init()->gateway->getCustomersClient('x');
|
||||
return true;
|
||||
return 'ok';
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
return false;
|
||||
return 'error';
|
||||
}
|
||||
|
||||
private function getToken(string $token, $gateway_customer_reference)
|
||||
|
|
|
|||
|
|
@ -212,12 +212,13 @@ class EwayPaymentDriver extends BaseDriver
|
|||
return $fields;
|
||||
}
|
||||
|
||||
public function auth(): bool
|
||||
public function auth(): string
|
||||
{
|
||||
|
||||
$response = $this->init()->eway->queryTransaction('xx');
|
||||
|
||||
return (bool) count($response->getErrors()) == 0;
|
||||
$message = (bool) count($response->getErrors()) == 0 ? 'ok' : 'error';
|
||||
return $message;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ class FortePaymentDriver extends BaseDriver
|
|||
////////////////////////////////////////////
|
||||
// DB
|
||||
///////////////////////////////////////////
|
||||
public function auth(): bool
|
||||
public function auth(): string
|
||||
{
|
||||
|
||||
$forte_base_uri = "https://sandbox.forte.net/api/v3/";
|
||||
|
|
@ -210,7 +210,7 @@ class FortePaymentDriver extends BaseDriver
|
|||
->withHeaders(['X-Forte-Auth-Organization-Id' => $forte_organization_id])
|
||||
->get("{$forte_base_uri}/organizations/{$forte_organization_id}/locations/{$forte_location_id}/customers/");
|
||||
|
||||
return $response->successful();
|
||||
return $response->successful() ? 'ok' : 'error';
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -568,15 +568,16 @@ class GoCardlessPaymentDriver extends BaseDriver
|
|||
return render('gateways.gocardless.verification');
|
||||
}
|
||||
|
||||
public function auth(): bool
|
||||
|
||||
public function auth(): string
|
||||
{
|
||||
try {
|
||||
$customers = $this->init()->gateway->customers()->list();
|
||||
return true;
|
||||
return 'ok';
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
return 'error';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -427,18 +427,18 @@ class MolliePaymentDriver extends BaseDriver
|
|||
return \number_format((float) $amount, 2, '.', '');
|
||||
}
|
||||
|
||||
public function auth(): bool
|
||||
public function auth(): string
|
||||
{
|
||||
$this->init();
|
||||
|
||||
try {
|
||||
$p = $this->gateway->payments->page();
|
||||
return true;
|
||||
return 'ok';
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
return 'error';
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -499,17 +499,17 @@ class PayPalBasePaymentDriver extends BaseDriver
|
|||
|
||||
}
|
||||
|
||||
public function auth(): bool
|
||||
public function auth(): string
|
||||
{
|
||||
|
||||
try {
|
||||
$this->init()->getClientToken();
|
||||
return true;
|
||||
return 'ok';
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
return 'error';
|
||||
}
|
||||
|
||||
public function importCustomers()
|
||||
|
|
|
|||
|
|
@ -307,16 +307,18 @@ class PaytracePaymentDriver extends BaseDriver
|
|||
return $fields;
|
||||
}
|
||||
|
||||
public function auth(): bool
|
||||
|
||||
|
||||
public function auth(): string
|
||||
{
|
||||
try {
|
||||
$this->init()->generateAuthHeaders() && strlen($this->company_gateway->getConfigField('integratorId')) > 2;
|
||||
return true;
|
||||
return 'ok';
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
return 'error';
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ class SquarePaymentDriver extends BaseDriver
|
|||
return $amount;
|
||||
}
|
||||
|
||||
public function auth(): bool
|
||||
public function auth(): string
|
||||
{
|
||||
|
||||
$api_response = $this->init()
|
||||
|
|
@ -444,7 +444,7 @@ class SquarePaymentDriver extends BaseDriver
|
|||
->listCustomers();
|
||||
|
||||
|
||||
return (bool) count($api_response->getErrors()) == 0;
|
||||
return (bool) count($api_response->getErrors()) == 0 ? 'ok' : 'error';
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1035,18 +1035,18 @@ class StripePaymentDriver extends BaseDriver implements SupportsHeadlessInterfac
|
|||
}, $string);
|
||||
}
|
||||
|
||||
public function auth(): bool
|
||||
public function auth(): string
|
||||
{
|
||||
$this->init();
|
||||
|
||||
try {
|
||||
$this->verifyConnect();
|
||||
return true;
|
||||
return 'ok';
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
return 'error';
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue