mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-02 19:14:35 -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();
|
->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')) {
|
if ($request->query('hash')) {
|
||||||
$hash_data['billing_context'] = Cache::get($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);
|
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();
|
$this->braintree->payment_hash->save();
|
||||||
|
|
||||||
$result = $this->braintree->gateway->transaction()->sale([
|
$result = $this->braintree->gateway->transaction()->sale([
|
||||||
'amount' => '2000.50',
|
'amount' => $this->braintree->payment_hash->data->amount_with_fee,
|
||||||
'paymentMethodNonce' => $state['token'],
|
'paymentMethodNonce' => $state['token'],
|
||||||
'deviceData' => $state['client-data'],
|
'deviceData' => $state['client-data'],
|
||||||
'options' => [
|
'options' => [
|
||||||
@ -108,7 +108,7 @@ class CreditCard
|
|||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'payment_type' => PaymentType::parseCardType(strtolower($state->server_response->details->cardType)),
|
'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,
|
'transaction_reference' => $response->transaction->id,
|
||||||
'gateway_type_id' => GatewayType::CREDIT_CARD,
|
'gateway_type_id' => GatewayType::CREDIT_CARD,
|
||||||
];
|
];
|
||||||
@ -137,7 +137,7 @@ class CreditCard
|
|||||||
$this->braintree->client,
|
$this->braintree->client,
|
||||||
$response,
|
$response,
|
||||||
$this->braintree->client->company,
|
$this->braintree->client->company,
|
||||||
10,
|
$this->braintree->payment_hash->data->amount_with_fee,
|
||||||
);
|
);
|
||||||
|
|
||||||
$message = [
|
$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/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/client.min.js"></script>
|
||||||
<script src="https://js.braintreegateway.com/web/3.76.2/js/data-collector.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
|
@endsection
|
||||||
|
|
||||||
@section('gateway_content')
|
@section('gateway_content')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user