mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-12 22:22:32 +01:00
Adapt js files and views
This commit is contained in:
parent
92816c1714
commit
3af5af74ef
2
public/js/clients/payments/stripe-ideal.js
vendored
2
public/js/clients/payments/stripe-ideal.js
vendored
@ -1 +1 @@
|
||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=6)}({6:function(e,t,n){e.exports=n("RFiP")},RFiP:function(e,t){var n,r,o,i;function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=null!==(n=null===(r=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",l=null!==(o=null===(i=document.querySelector('meta[name="stripe-account-id"]'))||void 0===i?void 0:i.content)&&void 0!==o?o:"";new 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),u(this,"setupStripe",function(){return r.stripe=Stripe(r.key),r.stripeConnect&&(r.stripe.stripeAccount=l),r}),u(this,"handle",function(){document.getElementById("pay-now").addEventListener("click",function(e){let t=document.getElementById("errors");if(!document.getElementById("giropay-mandate-acceptance").checked)return t.textContent="Accept Terms",t.hidden=!1,void console.log("Terms");document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),r.stripe.confirmGiropayPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{billing_details:{name:document.getElementById("giropay-name").value}},return_url:document.querySelector('meta[name="return-url"]').content})})}),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}(c,l).setupStripe().handle()}});
|
||||
!function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/",o(o.s=6)}({6:function(e,t,n){e.exports=n("RFiP")},RFiP:function(e,t){var n;function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var r=null!==(n=null===(r=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",i=null!==(n=null===(n=document.querySelector('meta[name="stripe-account-id"]'))||void 0===n?void 0:n.content)&&void 0!==n?n:"";new function t(e,n){var r=this;!function(e){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),o(this,"setupStripe",function(){return r.stripe=Stripe(r.key),r.stripeConnect&&(r.stripe.stripeAccount=i),r}),o(this,"handle",function(){document.getElementById("pay-now").addEventListener("click",e=>{let t=document.getElementById("errors");if(""!==document.getElementById("ideal-name").value)return t.textContent="Enter name",t.hidden=!1,void console.log("name");document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.stripe.confirmIdealPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{ideal:this.ideal,billing_details:{name:document.getElementById("ideal-name").value}},return_url:document.querySelector('meta[name="return-url"]').content})})}),this.key=e,this.errors=document.getElementById("errors"),this.stripeConnect=n}(r,i).setupStripe().handle()}});
|
||||
|
31
resources/js/clients/payments/stripe-ideal.js
vendored
31
resources/js/clients/payments/stripe-ideal.js
vendored
@ -8,7 +8,7 @@
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
class ProcessGiroPay {
|
||||
class ProcessIDEALPay {
|
||||
constructor(key, stripeConnect) {
|
||||
this.key = key;
|
||||
this.errors = document.getElementById('errors');
|
||||
@ -20,7 +20,21 @@ class ProcessGiroPay {
|
||||
|
||||
if(this.stripeConnect)
|
||||
this.stripe.stripeAccount = stripeConnect;
|
||||
|
||||
let elements = this.stripe.elements();
|
||||
var options = {
|
||||
style: {
|
||||
base: {
|
||||
padding: '10px 12px',
|
||||
color: '#32325d',
|
||||
fontSize: '16px',
|
||||
'::placeholder': {
|
||||
color: '#aab7c4'
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
this.ideal = elements.create('idealBank', options);
|
||||
this.ideal.mount("#ideal-bank-element");
|
||||
return this;
|
||||
};
|
||||
|
||||
@ -28,22 +42,23 @@ class ProcessGiroPay {
|
||||
document.getElementById('pay-now').addEventListener('click', (e) => {
|
||||
let errors = document.getElementById('errors');
|
||||
|
||||
if (!document.getElementById('giropay-mandate-acceptance').checked) {
|
||||
errors.textContent = "Accept Terms";
|
||||
if (document.getElementById('ideal-name').value !== '') {
|
||||
errors.textContent = "Enter name";
|
||||
errors.hidden = false;
|
||||
console.log("Terms");
|
||||
console.log("name");
|
||||
return ;
|
||||
}
|
||||
document.getElementById('pay-now').disabled = true;
|
||||
document.querySelector('#pay-now > svg').classList.remove('hidden');
|
||||
document.querySelector('#pay-now > span').classList.add('hidden');
|
||||
|
||||
this.stripe.confirmGiropayPayment(
|
||||
this.stripe.confirmIdealPayment(
|
||||
document.querySelector('meta[name=pi-client-secret').content,
|
||||
{
|
||||
payment_method: {
|
||||
ideal: this.ideal,
|
||||
billing_details: {
|
||||
name: document.getElementById("giropay-name").value,
|
||||
name: document.getElementById("ideal-name").value,
|
||||
},
|
||||
},
|
||||
return_url: document.querySelector(
|
||||
@ -62,4 +77,4 @@ const publishableKey = document.querySelector(
|
||||
const stripeConnect =
|
||||
document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
|
||||
|
||||
new ProcessGiroPay(publishableKey, stripeConnect).setupStripe().handle();
|
||||
new ProcessIDEALPay(publishableKey, stripeConnect).setupStripe().handle();
|
||||
|
@ -1,11 +1,11 @@
|
||||
<div id="stripe--payment-container">
|
||||
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.name')])
|
||||
<label for="giropay-name">
|
||||
<input class="input w-full" id="giropay-name" type="text" placeholder="{{ ctrans('texts.bank_account_holder') }}">
|
||||
<input class="input w-full" id="ideal-name" type="text" placeholder="{{ ctrans('texts.bank_account_holder') }}">
|
||||
</label>
|
||||
<div id="mandate-acceptance">
|
||||
<input type="checkbox" id="giropay-mandate-acceptance" class="input mr-4">
|
||||
<label for="giropay-mandate-acceptance">{{ctrans('texts.giropay_law')}}</label>
|
||||
<label for="ideal-bank-element"></label>
|
||||
<div class="border p-4 rounded">
|
||||
<div id="ideal-bank-element"></div>
|
||||
</div>
|
||||
@endcomponent
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
@extends('portal.ninja2020.layout.payments', ['gateway_title' => 'GiroPay', 'card_title' => 'GiroPay'])
|
||||
@extends('portal.ninja2020.layout.payments', ['gateway_title' => 'iDeal', 'card_title' => 'iDeal'])
|
||||
|
||||
@section('gateway_head')
|
||||
<meta name="stripe-publishable-key" content="{{ $gateway->getPublishableKey() }}">
|
||||
@ -18,11 +18,11 @@
|
||||
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.payment_type')])
|
||||
{{ ctrans('texts.giropay') }} ({{ ctrans('texts.bank_transfer') }})
|
||||
@endcomponent
|
||||
@include('portal.ninja2020.gateways.stripe.giropay.giropay')
|
||||
@include('portal.ninja2020.gateways.stripe.ideal.ideal')
|
||||
@include('portal.ninja2020.gateways.includes.pay_now')
|
||||
@endsection
|
||||
|
||||
@push('footer')
|
||||
<script src="https://js.stripe.com/v3/"></script>
|
||||
<script src="{{ asset('js/clients/payments/stripe-giropay.js') }}"></script>
|
||||
<script src="{{ asset('js/clients/payments/stripe-ideal.js') }}"></script>
|
||||
@endpush
|
||||
|
Loading…
Reference in New Issue
Block a user