mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Apply php-cs-fixer
This commit is contained in:
parent
2c6f7dfa6f
commit
f63869d423
@ -12,19 +12,12 @@
|
|||||||
|
|
||||||
namespace App\PaymentDrivers\Square;
|
namespace App\PaymentDrivers\Square;
|
||||||
|
|
||||||
use App\Exceptions\PaymentFailed;
|
|
||||||
use App\Jobs\Mail\PaymentFailureMailer;
|
|
||||||
use App\Jobs\Util\SystemLogger;
|
|
||||||
use App\Models\ClientGatewayToken;
|
|
||||||
use App\Models\GatewayType;
|
use App\Models\GatewayType;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentHash;
|
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
|
||||||
use App\PaymentDrivers\SquarePaymentDriver;
|
use App\PaymentDrivers\SquarePaymentDriver;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Cache;
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class CreditCard
|
class CreditCard
|
||||||
@ -41,11 +34,9 @@ class CreditCard
|
|||||||
|
|
||||||
public function authorizeView($data)
|
public function authorizeView($data)
|
||||||
{
|
{
|
||||||
|
|
||||||
$data['gateway'] = $this->square_driver;
|
$data['gateway'] = $this->square_driver;
|
||||||
|
|
||||||
return render('gateways.square.credit_card.authorize', $data);
|
return render('gateways.square.credit_card.authorize', $data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function authorizeResponse($request)
|
public function authorizeResponse($request)
|
||||||
@ -128,12 +119,10 @@ class CreditCard
|
|||||||
|
|
||||||
public function paymentView($data)
|
public function paymentView($data)
|
||||||
{
|
{
|
||||||
|
|
||||||
$data['gateway'] = $this->square_driver;
|
$data['gateway'] = $this->square_driver;
|
||||||
|
|
||||||
|
|
||||||
return render('gateways.square.credit_card.pay', $data);
|
return render('gateways.square.credit_card.pay', $data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function paymentResponse($request)
|
public function paymentResponse($request)
|
||||||
@ -155,20 +144,19 @@ class CreditCard
|
|||||||
$payment = $this->square_driver->createPayment($payment_record, Payment::STATUS_COMPLETED);
|
$payment = $this->square_driver->createPayment($payment_record, Payment::STATUS_COMPLETED);
|
||||||
|
|
||||||
return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]);
|
return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function processUnsuccessfulPayment($response)
|
private function processUnsuccessfulPayment($response)
|
||||||
{
|
{
|
||||||
// array (
|
// array (
|
||||||
// 0 =>
|
// 0 =>
|
||||||
// Square\Models\Error::__set_state(array(
|
// Square\Models\Error::__set_state(array(
|
||||||
// 'category' => 'INVALID_REQUEST_ERROR',
|
// 'category' => 'INVALID_REQUEST_ERROR',
|
||||||
// 'code' => 'INVALID_CARD_DATA',
|
// 'code' => 'INVALID_CARD_DATA',
|
||||||
// 'detail' => 'Invalid card data.',
|
// 'detail' => 'Invalid card data.',
|
||||||
// 'field' => 'source_id',
|
// 'field' => 'source_id',
|
||||||
// )),
|
// )),
|
||||||
// )
|
// )
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'response' => $response,
|
'response' => $response,
|
||||||
@ -177,7 +165,6 @@ class CreditCard
|
|||||||
];
|
];
|
||||||
|
|
||||||
return $this->square_driver->processUnsuccessfulTransaction($data);
|
return $this->square_driver->processUnsuccessfulTransaction($data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -186,7 +173,6 @@ class CreditCard
|
|||||||
|
|
||||||
private function findOrCreateClient()
|
private function findOrCreateClient()
|
||||||
{
|
{
|
||||||
|
|
||||||
$email_address = new \Square\Models\CustomerTextFilter();
|
$email_address = new \Square\Models\CustomerTextFilter();
|
||||||
$email_address->setExact($this->square_driver->client->present()->email());
|
$email_address->setExact($this->square_driver->client->present()->email());
|
||||||
|
|
||||||
@ -214,8 +200,9 @@ class CreditCard
|
|||||||
$errors = $api_response->getErrors();
|
$errors = $api_response->getErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($customers)
|
if ($customers) {
|
||||||
return $customers->customers[0]->id;
|
return $customers->customers[0]->id;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->createClient();
|
return $this->createClient();
|
||||||
}
|
}
|
||||||
@ -250,11 +237,9 @@ class CreditCard
|
|||||||
if ($api_response->isSuccess()) {
|
if ($api_response->isSuccess()) {
|
||||||
$result = $api_response->getResult();
|
$result = $api_response->getResult();
|
||||||
return $result->getCustomer()->getId();
|
return $result->getCustomer()->getId();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$errors = $api_response->getErrors();
|
$errors = $api_response->getErrors();
|
||||||
return $this->processUnsuccessfulPayment($errors);
|
return $this->processUnsuccessfulPayment($errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user