diff --git a/app/Http/Controllers/ClientPortal/PaymentController.php b/app/Http/Controllers/ClientPortal/PaymentController.php
index 0cd74d6d6..784564828 100644
--- a/app/Http/Controllers/ClientPortal/PaymentController.php
+++ b/app/Http/Controllers/ClientPortal/PaymentController.php
@@ -239,7 +239,7 @@ class PaymentController extends Controller
->get();
}
- $hash_data = ['invoices' => $payable_invoices->toArray(), 'credits' => $credit_totals];
+ $hash_data = ['invoices' => $payable_invoices->toArray(), 'credits' => $credit_totals, 'amount_with_fee' => max(0, (($invoice_totals + $fee_totals) - $credit_totals))];
if ($request->query('hash')) {
$hash_data['billing_context'] = Cache::get($request->query('hash'));
diff --git a/app/PaymentDrivers/Braintree/CreditCard.php b/app/PaymentDrivers/Braintree/CreditCard.php
index 1ccaac3b7..0e79aa692 100644
--- a/app/PaymentDrivers/Braintree/CreditCard.php
+++ b/app/PaymentDrivers/Braintree/CreditCard.php
@@ -45,9 +45,9 @@ class CreditCard
return render('gateways.braintree.credit_card.authorize', $data);
}
- public function authorizeResponse($data)
+ public function authorizeResponse($data): \Illuminate\Http\RedirectResponse
{
-
+ return back();
}
/**
@@ -85,7 +85,7 @@ class CreditCard
$this->braintree->payment_hash->save();
$result = $this->braintree->gateway->transaction()->sale([
- 'amount' => '2000.50',
+ 'amount' => $this->braintree->payment_hash->data->amount_with_fee,
'paymentMethodNonce' => $state['token'],
'deviceData' => $state['client-data'],
'options' => [
@@ -108,7 +108,7 @@ class CreditCard
$data = [
'payment_type' => PaymentType::parseCardType(strtolower($state->server_response->details->cardType)),
- 'amount' => 10,
+ 'amount' => $this->braintree->payment_hash->data->amount_with_fee,
'transaction_reference' => $response->transaction->id,
'gateway_type_id' => GatewayType::CREDIT_CARD,
];
@@ -137,7 +137,7 @@ class CreditCard
$this->braintree->client,
$response,
$this->braintree->client->company,
- 10,
+ $this->braintree->payment_hash->data->amount_with_fee,
);
$message = [
diff --git a/resources/views/portal/ninja2020/gateways/braintree/credit_card/pay.blade.php b/resources/views/portal/ninja2020/gateways/braintree/credit_card/pay.blade.php
index 25c109c69..5dc59263a 100644
--- a/resources/views/portal/ninja2020/gateways/braintree/credit_card/pay.blade.php
+++ b/resources/views/portal/ninja2020/gateways/braintree/credit_card/pay.blade.php
@@ -6,6 +6,12 @@
+
+
@endsection
@section('gateway_content')