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