1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

More fixes

This commit is contained in:
Lars Kusch 2022-12-22 11:34:17 +01:00
parent 5a54a368ba
commit 2b7893aad9
2 changed files with 15 additions and 18 deletions

View File

@ -70,13 +70,19 @@ class BACS
}
public function paymentView(array $data)
{
$data['gateway'] = $this->stripe;
$data['amount'] = $data['total']['amount_with_fee'];
// $description = $this->stripe->decodeUnicodeString(ctrans('texts.invoices') . ': ' . collect($data['invoices'])->pluck('invoice_number')) . " for client {$this->stripe->client->present()->name()}";
$invoice_numbers = collect($data['invoices'])->pluck('invoice_number')->implode(',');
$description = ctrans('texts.stripe_payment_text', ['invoicenumber' => $invoice_numbers, 'amount' => Number::formatMoney($data['total']['amount_with_fee'], $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
return render('gateways.stripe.bacs.pay', $data);
}
public function paymentResponse(PaymentResponseRequest $request)
{
$this->stripe->init();
nlog($request);
$invoice_numbers = collect($this->stripe->payment_hash->invoices())->pluck('invoice_number')->implode(',');
$description = ctrans('texts.stripe_payment_text', ['invoicenumber' => $invoice_numbers, 'amount' => Number::formatMoney($request->amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
$payment_intent_data = [
'amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
'amount' => $this->stripe->convertToStripeAmount($request->amount, $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
'currency' => $this->stripe->client->getCurrencyCode(),
'customer' => $this->stripe->findOrCreateCustomer(),
'description' => $description,
@ -85,21 +91,12 @@ class BACS
'payment_hash' => $this->stripe->payment_hash->hash,
'gateway_type_id' => GatewayType::BACS,
],
'payment_method' => $request->token,
'confirm' => true,
];
$data['intent'] = $payment_intent_data;
$data['gateway'] = $this->stripe;
return render('gateways.stripe.bacs.pay', $data);
}
public function paymentResponse(PaymentResponseRequest $request)
{
$this->stripe->init();
nlog($request);
$this->stripe->createPaymentIntent($payment_intent_data);
$state = [
'server_response' => json_decode($request->gateway_response),
'payment_hash' => $request->payment_hash,
'payment_hash' => $this->stripe->payment_hash->hash,
];
$state = array_merge($state, $request->all());

View File

@ -14,8 +14,8 @@
<form action="{{ route('client.payments.response') }}" method="post" id="server-response">
@csrf
<input type="hidden" name="company_gateway_id" value="{{ $gateway->getCompanyGatewayId() }}">
<input type="hidden" name="payment_hash" value="{{ $payment_hash }}">
<input type="hidden" name="token">
<input type="hidden" name="amount" value={{ $amount }}>
</form>
<div class="alert alert-failure mb-4" hidden id="errors"></div>