diff --git a/app/PaymentDrivers/PayPal/PayPalBasePaymentDriver.php b/app/PaymentDrivers/PayPal/PayPalBasePaymentDriver.php
index ec637548d3ae..56824c840269 100644
--- a/app/PaymentDrivers/PayPal/PayPalBasePaymentDriver.php
+++ b/app/PaymentDrivers/PayPal/PayPalBasePaymentDriver.php
@@ -525,6 +525,7 @@ class PayPalBasePaymentDriver extends BaseDriver
$this->init();
PayPalWebhook::dispatch($request->all(), $request->headers->all(), $this->access_token);
+
}
public function createNinjaPayment($request, $response)
diff --git a/app/PaymentDrivers/PayPalPPCPPaymentDriver.php b/app/PaymentDrivers/PayPalPPCPPaymentDriver.php
index 14fd0ace2dcb..4cb22ad728b7 100644
--- a/app/PaymentDrivers/PayPalPPCPPaymentDriver.php
+++ b/app/PaymentDrivers/PayPalPPCPPaymentDriver.php
@@ -306,7 +306,6 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
*
* @param mixed $request
* @param array $response
- * @return void
*/
public function processTokenPayment($request, array $response)
{
@@ -362,26 +361,32 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
}
$response = $r->json();
+
+ if(isset($response['purchase_units'][0]['payments']['captures'][0]['status']) && $response['purchase_units'][0]['payments']['captures'][0]['status'] == 'COMPLETED')
+ {
- $data = [
- 'payment_type' => $this->getPaymentMethod($request->gateway_type_id),
- 'amount' => $response['purchase_units'][0]['payments']['captures'][0]['amount']['value'],
- 'transaction_reference' => $response['purchase_units'][0]['payments']['captures'][0]['id'],
- 'gateway_type_id' => $this->gateway_type_id,
- ];
+ $data = [
+ 'payment_type' => $this->getPaymentMethod($request->gateway_type_id),
+ 'amount' => $response['purchase_units'][0]['payments']['captures'][0]['amount']['value'],
+ 'transaction_reference' => $response['purchase_units'][0]['payments']['captures'][0]['id'],
+ 'gateway_type_id' => $this->gateway_type_id,
+ ];
- $payment = $this->createPayment($data, \App\Models\Payment::STATUS_COMPLETED);
+ $payment = $this->createPayment($data, \App\Models\Payment::STATUS_COMPLETED);
- SystemLogger::dispatch(
- ['response' => $response, 'data' => $data],
- SystemLog::CATEGORY_GATEWAY_RESPONSE,
- SystemLog::EVENT_GATEWAY_SUCCESS,
- SystemLog::TYPE_PAYPAL_PPCP,
- $this->client,
- $this->client->company,
- );
+ SystemLogger::dispatch(
+ ['response' => $response, 'data' => $data],
+ SystemLog::CATEGORY_GATEWAY_RESPONSE,
+ SystemLog::EVENT_GATEWAY_SUCCESS,
+ SystemLog::TYPE_PAYPAL_PPCP,
+ $this->client,
+ $this->client->company,
+ );
- return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]);
+ return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]);
+ }
+
+ return response()->json(['message' => 'Error processing token payment'], 400);
}
@@ -431,26 +436,36 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
}
$response = $r->json();
+ if(isset($response['purchase_units'][0]['payments']['captures'][0]['status']) && $response['purchase_units'][0]['payments']['captures'][0]['status'] == 'COMPLETED')
+ {
- $data = [
- 'payment_type' => $this->getPaymentMethod((string)$cgt->gateway_type_id),
- 'amount' => $response['purchase_units'][0]['payments']['captures'][0]['amount']['value'],
- 'transaction_reference' => $response['purchase_units'][0]['payments']['captures'][0]['id'],
- 'gateway_type_id' => $this->gateway_type_id,
- ];
+ $data = [
+ 'payment_type' => $this->getPaymentMethod((string)$cgt->gateway_type_id),
+ 'amount' => $response['purchase_units'][0]['payments']['captures'][0]['amount']['value'],
+ 'transaction_reference' => $response['purchase_units'][0]['payments']['captures'][0]['id'],
+ 'gateway_type_id' => $this->gateway_type_id,
+ ];
- $payment = $this->createPayment($data, \App\Models\Payment::STATUS_COMPLETED);
+ $payment = $this->createPayment($data, \App\Models\Payment::STATUS_COMPLETED);
- SystemLogger::dispatch(
- ['response' => $response, 'data' => $data],
- SystemLog::CATEGORY_GATEWAY_RESPONSE,
- SystemLog::EVENT_GATEWAY_SUCCESS,
- SystemLog::TYPE_PAYPAL_PPCP,
- $this->client,
- $this->client->company,
- );
+ SystemLogger::dispatch(
+ ['response' => $response, 'data' => $data],
+ SystemLog::CATEGORY_GATEWAY_RESPONSE,
+ SystemLog::EVENT_GATEWAY_SUCCESS,
+ SystemLog::TYPE_PAYPAL_PPCP,
+ $this->client,
+ $this->client->company,
+ );
+ }
+
+ $this->processInternallyFailedPayment($this, new \Exception('Auto billing failed.', 400));
+
+ SystemLogger::dispatch($response, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_PAYPAL, $this->client, $this->client->company);
}
+
+
+
}
diff --git a/app/PaymentDrivers/PayPalRestPaymentDriver.php b/app/PaymentDrivers/PayPalRestPaymentDriver.php
index 524b59f8c632..ba1cbc62e7f2 100644
--- a/app/PaymentDrivers/PayPalRestPaymentDriver.php
+++ b/app/PaymentDrivers/PayPalRestPaymentDriver.php
@@ -340,9 +340,7 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
}
-
-
-
+ return response()->json(['message' => 'Error processing token payment'], 400);
}
@@ -413,11 +411,12 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
$this->client,
$this->client->company,
);
+
}
$this->processInternallyFailedPayment($this, new \Exception('Auto billing failed.', 400));
- SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_PAYPAL, $this->client, $this->client->company);
+ SystemLogger::dispatch($response, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_PAYPAL, $this->client, $this->client->company);
}
}
diff --git a/app/Services/Client/PaymentMethod.php b/app/Services/Client/PaymentMethod.php
index 8a27f3183144..de5e1622585d 100644
--- a/app/Services/Client/PaymentMethod.php
+++ b/app/Services/Client/PaymentMethod.php
@@ -169,7 +169,7 @@ class PaymentMethod
if (isset($gateway->fees_and_limits) && is_object($gateway->fees_and_limits) && property_exists($gateway->fees_and_limits, GatewayType::CREDIT_CARD)) { //@phpstan-ignore-line
if ($this->validGatewayForAmount($gateway->fees_and_limits->{GatewayType::CREDIT_CARD}, $this->amount)) {
// $this->payment_methods[] = [$gateway->id => $type];
- //@15-06-2024
+ // @15-06-2024
$this->buildUrl($gateway, $type);
}
} else {
diff --git a/lang/en/texts.php b/lang/en/texts.php
index fbfdef2e6177..e2bad2efdae3 100644
--- a/lang/en/texts.php
+++ b/lang/en/texts.php
@@ -5238,7 +5238,7 @@ $lang = array(
'local_domain_help' => 'EHLO domain (optional)',
'port_help' => 'ie. 25,587,465',
'host_help' => 'ie. smtp.gmail.com',
- 'always_show_required_fields' => 'Allows show required fields form',
+ 'always_show_required_fields' => 'Always show required fields form',
'always_show_required_fields_help' => 'Displays the required fields form always at checkout',
'advanced_cards' => 'Advanced Cards',
'activity_140' => 'Statement sent to :client',
diff --git a/resources/views/portal/ninja2020/gateways/paypal/pay.blade.php b/resources/views/portal/ninja2020/gateways/paypal/pay.blade.php
index 29137b17a426..b11b968a7f15 100644
--- a/resources/views/portal/ninja2020/gateways/paypal/pay.blade.php
+++ b/resources/views/portal/ninja2020/gateways/paypal/pay.blade.php
@@ -30,16 +30,6 @@
@push('footer')
-
-
-
-
-