mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 10:44:35 -04:00
php-cs-fixer & required fields check
This commit is contained in:
parent
5d3d31ddef
commit
50ae8fd608
@ -330,9 +330,9 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper method for checking if resource is good.
|
* Wrapper method for checking if resource is good.
|
||||||
*
|
*
|
||||||
* @param mixed $resource
|
* @param mixed $resource
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function checkRequiredResource($resource): bool
|
public function checkRequiredResource($resource): bool
|
||||||
{
|
{
|
||||||
@ -432,7 +432,7 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
if (Str::startsWith($field, 'billing')) {
|
if (Str::startsWith($field, 'billing')) {
|
||||||
unset($this->required_fields[$position]);
|
unset($this->required_fields[$position]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->checkRequiredResource(auth()->user('contact')->client->postal_code)) {
|
if ($this->checkRequiredResource(auth()->user('contact')->client->postal_code)) {
|
||||||
$this->required_fields[] = 'postal_code';
|
$this->required_fields[] = 'postal_code';
|
||||||
|
@ -44,8 +44,8 @@ class PayPalExpressPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize Omnipay PayPal_Express gateway.
|
* Initialize Omnipay PayPal_Express gateway.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function initializeOmnipayGateway(): void
|
private function initializeOmnipayGateway(): void
|
||||||
{
|
{
|
||||||
@ -58,7 +58,7 @@ class PayPalExpressPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
public function setPaymentMethod($payment_method_id)
|
public function setPaymentMethod($payment_method_id)
|
||||||
{
|
{
|
||||||
// PayPal doesn't have multiple ways of paying.
|
// PayPal doesn't have multiple ways of paying.
|
||||||
// There's just one, off-site redirect.
|
// There's just one, off-site redirect.
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -80,6 +80,12 @@ class PayPalExpressPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
public function processPaymentView($data)
|
public function processPaymentView($data)
|
||||||
{
|
{
|
||||||
|
if (count($this->required_fields) > 0) {
|
||||||
|
return redirect()
|
||||||
|
->route('client.profile.edit', ['client_contact' => auth()->user()->hashed_id])
|
||||||
|
->with('missing_required_fields', $this->required_fields);
|
||||||
|
}
|
||||||
|
|
||||||
$this->initializeOmnipayGateway();
|
$this->initializeOmnipayGateway();
|
||||||
|
|
||||||
$this->payment_hash->data = array_merge((array) $this->payment_hash->data, ['amount' => $data['amount_with_fee']]);
|
$this->payment_hash->data = array_merge((array) $this->payment_hash->data, ['amount' => $data['amount_with_fee']]);
|
||||||
@ -114,6 +120,12 @@ class PayPalExpressPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
public function processPaymentResponse($request)
|
public function processPaymentResponse($request)
|
||||||
{
|
{
|
||||||
|
if (count($this->required_fields) > 0) {
|
||||||
|
return redirect()
|
||||||
|
->route('client.profile.edit', ['client_contact' => auth()->user()->hashed_id])
|
||||||
|
->with('missing_required_fields', $this->required_fields);
|
||||||
|
}
|
||||||
|
|
||||||
$this->initializeOmnipayGateway();
|
$this->initializeOmnipayGateway();
|
||||||
|
|
||||||
$response = $this->omnipay_gateway
|
$response = $this->omnipay_gateway
|
||||||
|
Loading…
x
Reference in New Issue
Block a user