mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Added payment view for BACS
This commit is contained in:
parent
067dac5ac9
commit
bbeef5fd50
@ -100,7 +100,6 @@ class BACS
|
||||
];
|
||||
|
||||
$state = array_merge($state, $request->all());
|
||||
$state['store_card'] = boolval($state['store_card']);
|
||||
|
||||
if ($request->has('token') && ! is_null($request->token)) {
|
||||
$state['store_card'] = false;
|
||||
|
66
public/js/clients/payments/stripe-bacs.js
vendored
66
public/js/clients/payments/stripe-bacs.js
vendored
@ -1,2 +1,64 @@
|
||||
/*! For license information please see stripe-bacs.js.LICENSE.txt */
|
||||
(()=>{var e,t,n,r;function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=o((function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),c(this,"setupStripe",(function(){return r.stripeConnect?r.stripe=Stripe(r.key,{stripeAccount:r.stripeConnect}):r.stripe=Stripe(r.key),r})),c(this,"handle",(function(){document.getElementById("authorize-bacs").addEventListener("click",(function(e){document.getElementById("errors");document.getElementById("authorize-bacs").disabled=!0,document.querySelector("#authorize-bacs > svg").classList.remove("hidden"),document.querySelector("#authorize-bacs > span").classList.add("hidden"),location.href=document.querySelector("meta[name=stripe-redirect-url").content}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}));new a(null!==(e=null===(t=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"",null!==(n=null===(r=document.querySelector('meta[name="stripe-account-id"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"").setupStripe().handle()})();
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com)
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
class ProcessBACS {
|
||||
constructor(key, stripeConnect) {
|
||||
this.key = key;
|
||||
this.errors = document.getElementById('errors');
|
||||
this.stripeConnect = stripeConnect;
|
||||
}
|
||||
|
||||
setupStripe = () => {
|
||||
|
||||
if (this.stripeConnect){
|
||||
// this.stripe.stripeAccount = this.stripeConnect;
|
||||
|
||||
this.stripe = Stripe(this.key, {
|
||||
stripeAccount: this.stripeConnect,
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
this.stripe = Stripe(this.key);
|
||||
}
|
||||
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
handle = () => {
|
||||
if (this.onlyAuthorization) {
|
||||
document.getElementById('authorize-bacs').addEventListener('click', (e) => {
|
||||
document.getElementById('authorize-bacs').disabled = true;
|
||||
document.querySelector('#authorize-bacs > svg').classList.remove('hidden');
|
||||
document.querySelector('#authorize-bacs > span').classList.add('hidden');
|
||||
location.href=document.querySelector('meta[name=stripe-redirect-url').content;
|
||||
});}
|
||||
else{
|
||||
let token = document.querySelector('input[name=token]').value;
|
||||
let payNowButton = document.getElementById('pay-now');
|
||||
this.payNowButton = payNowButton;
|
||||
this.payNowButton.disabled = true;
|
||||
this.payNowButton.querySelector('svg').classList.remove('hidden');
|
||||
this.payNowButton.querySelector('span').classList.add('hidden');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const publishableKey = document.querySelector(
|
||||
'meta[name="stripe-publishable-key"]'
|
||||
)?.content ?? '';
|
||||
|
||||
const stripeConnect =
|
||||
document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
|
||||
const onlyAuthorization =
|
||||
document.querySelector('meta[name="only-authorization"]')?.content ?? '';
|
||||
|
||||
new ProcessBACS(publishableKey, stripeConnect).setupStripe().handle();
|
||||
|
15
resources/js/clients/payments/stripe-bacs.js
vendored
15
resources/js/clients/payments/stripe-bacs.js
vendored
@ -34,14 +34,21 @@ class ProcessBACS {
|
||||
};
|
||||
|
||||
handle = () => {
|
||||
if (this.onlyAuthorization) {
|
||||
document.getElementById('authorize-bacs').addEventListener('click', (e) => {
|
||||
let errors = document.getElementById('errors');
|
||||
|
||||
document.getElementById('authorize-bacs').disabled = true;
|
||||
document.querySelector('#authorize-bacs > svg').classList.remove('hidden');
|
||||
document.querySelector('#authorize-bacs > span').classList.add('hidden');
|
||||
location.href=document.querySelector('meta[name=stripe-redirect-url').content;
|
||||
});
|
||||
});}
|
||||
else{
|
||||
let token = document.querySelector('input[name=token]').value;
|
||||
let payNowButton = document.getElementById('pay-now');
|
||||
this.payNowButton = payNowButton;
|
||||
this.payNowButton.disabled = true;
|
||||
this.payNowButton.querySelector('svg').classList.remove('hidden');
|
||||
this.payNowButton.querySelector('span').classList.add('hidden');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -51,5 +58,7 @@ const publishableKey = document.querySelector(
|
||||
|
||||
const stripeConnect =
|
||||
document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
|
||||
const onlyAuthorization =
|
||||
document.querySelector('meta[name="only-authorization"]')?.content ?? '';
|
||||
|
||||
new ProcessBACS(publishableKey, stripeConnect).setupStripe().handle();
|
||||
|
@ -9,6 +9,7 @@
|
||||
<meta name="stripe-publishable-key" content="{{ $gateway->getPublishableKey() }}">
|
||||
@endif
|
||||
<meta name="stripe-redirect-url" content="{{ $session->url }}">
|
||||
<meta name="only-authorization" content="true">
|
||||
|
||||
@endsection
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
@else
|
||||
<meta name="stripe-publishable-key" content="{{ $gateway->company_gateway->getPublishableKey() }}">
|
||||
@endif
|
||||
<meta name="only-authorization" content="">
|
||||
@endsection
|
||||
|
||||
@section('gateway_content')
|
||||
|
Loading…
x
Reference in New Issue
Block a user