1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00

More fixes

This commit is contained in:
Lars Kusch 2022-12-22 11:06:00 +01:00
parent 87fcdfd90b
commit 1aa854d4b5
3 changed files with 6 additions and 32 deletions

View File

@ -85,9 +85,9 @@ class BACS
'payment_hash' => $this->stripe->payment_hash->hash,
'gateway_type_id' => GatewayType::BACS,
],
'confirm' => true,
];
$data['intent'] = $this->stripe->createPaymentIntent($payment_intent_data);
$data['intent'] = $payment_intent_data;
$data['gateway'] = $this->stripe;
return render('gateways.stripe.bacs.pay', $data);
@ -96,6 +96,7 @@ class BACS
{
$this->stripe->init();
nlog($request);
$state = [
'server_response' => json_decode($request->gateway_response),
'payment_hash' => $request->payment_hash,

View File

@ -59,39 +59,14 @@ class ProcessBACS {
this.payNowButton.disabled = true;
this.payNowButton.querySelector('svg').classList.remove('hidden');
this.payNowButton.querySelector('span').classList.add('hidden');
this.stripe
.confirmBacsDebitPayment(
document.querySelector('meta[name=pi-client-secret')
.content, {
payment_method: document.querySelector('input[name=token]').value
}
)
.then((result) => {
if (result.error) {
return this.handleFailure(result.error.message);
}
return this.handleSuccess(result);
});
this.handleResult();
});
}
};
handleFailure(message) {
let errors = document.getElementById('errors');
errors.textContent = '';
errors.textContent = message;
errors.hidden = false;
document.getElementById('pay-now').disabled = false;
document.querySelector('#pay-now > svg').classList.add('hidden');
document.querySelector('#pay-now > span').classList.remove('hidden');
}
handleSuccess(result) {
handleResult() {
document.querySelector(
'input[name="gateway_response"]'
).value = JSON.stringify(result.paymentIntent);
).value = ocument.querySelector('input[name=token]').value;
document.getElementById('server-response').submit();
}

View File

@ -14,9 +14,7 @@
@section('gateway_content')
<form action="{{ route('client.payments.response') }}" method="post" id="server-response">
@csrf
<input type="hidden" name="gateway_response">
<input type="hidden" name="company_gateway_id" value="{{ $gateway->getCompanyGatewayId() }}">
<input type="hidden" name="payment_method_id" value="{{ $payment_method_id }}">
<input type="hidden" name="payment_hash" value="{{ $payment_hash }}">
<input type="hidden" name="token">
</form>