mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
- Update Braintree credit card to use amount_with_fee
- Add amount_with_fee to payment hash
This commit is contained in:
parent
7d8c135ba7
commit
d4c51871ef
@ -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'));
|
||||
|
@ -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 = [
|
||||
|
@ -6,6 +6,12 @@
|
||||
<script src="https://js.braintreegateway.com/web/dropin/1.27.0/js/dropin.min.js"></script>
|
||||
<script src="https://js.braintreegateway.com/web/3.76.2/js/client.min.js"></script>
|
||||
<script src="https://js.braintreegateway.com/web/3.76.2/js/data-collector.min.js"></script>
|
||||
|
||||
<style>
|
||||
[data-braintree-id="toggle"] {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('gateway_content')
|
||||
|
Loading…
x
Reference in New Issue
Block a user