mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 16:31:33 +02:00
More fixes
This commit is contained in:
parent
87fcdfd90b
commit
1aa854d4b5
@ -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,
|
||||
|
31
resources/js/clients/payments/stripe-bacs.js
vendored
31
resources/js/clients/payments/stripe-bacs.js
vendored
@ -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();
|
||||
}
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user