mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
wip (#42)
This commit is contained in:
parent
ab3025dfaa
commit
8da8bb9b65
@ -1,99 +1,93 @@
|
|||||||
@extends('portal.ninja2020.layout.payments', ['gateway_title' => ctrans('texts.credit_card'), 'card_title' => ctrans('texts.credit_card')])
|
@extends('portal.ninja2020.layout.payments', ['gateway_title' => ctrans('texts.credit_card'), 'card_title' =>
|
||||||
|
ctrans('texts.credit_card')])
|
||||||
|
|
||||||
@section('gateway_head')
|
@section('gateway_head')
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('gateway_content')
|
@section('gateway_content')
|
||||||
<form action="{{ route('client.payment_methods.store', ['method' => App\Models\GatewayType::CREDIT_CARD]) }}" method="post" id="payment_form">
|
<form action="{{ route('client.payment_methods.store', ['method' => App\Models\GatewayType::CREDIT_CARD]) }}"
|
||||||
|
method="post" id="payment_form">
|
||||||
|
|
||||||
<input type="hidden" id="securefieldcode" name="SecuredCardData" value="" />
|
<input type="hidden" id="securefieldcode" name="SecuredCardData" value="" />
|
||||||
|
|
||||||
@if(!Request::isSecure())
|
@if (!Request::isSecure())
|
||||||
<p class="alert alert-failure">{{ ctrans('texts.https_required') }}</p>
|
<p class="alert alert-failure">{{ ctrans('texts.https_required') }}</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div class="alert alert-failure mb-4" hidden id="errors"></div>
|
<div class="alert alert-failure mb-4" hidden id="errors"></div>
|
||||||
|
|
||||||
<!-- This is a generic credit card component utilizing CardJS -->
|
<!-- This is a generic credit card component utilizing CardJS -->
|
||||||
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.method')])
|
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.method')])
|
||||||
{{ ctrans('texts.credit_card') }}
|
{{ ctrans('texts.credit_card') }}
|
||||||
@endcomponent
|
@endcomponent
|
||||||
|
|
||||||
@include('portal.ninja2020.gateways.eway.includes.credit_card')
|
@include('portal.ninja2020.gateways.eway.includes.credit_card')
|
||||||
|
|
||||||
<div class="bg-white px-4 py-5 flex justify-end">
|
@component('portal.ninja2020.gateways.includes.pay_now', ['id' => 'authorize-card'])
|
||||||
<button
|
{{ ctrans('texts.add_payment_method') }}
|
||||||
type="submit"
|
@endcomponent
|
||||||
id="{{ $id ?? 'pay-now' }}"
|
</form>
|
||||||
class="button button-primary bg-primary {{ $class ?? '' }}">
|
|
||||||
<span>{{ ctrans('texts.add_payment_method') }}</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('gateway_footer')
|
@section('gateway_footer')
|
||||||
<!-- Your JS includes go here -->
|
<!-- Your JS includes go here -->
|
||||||
<script src="https://secure.ewaypayments.com/scripts/eWAY.min.js" data-init="false"></script>
|
<script src="https://secure.ewaypayments.com/scripts/eWAY.min.js" data-init="false"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var publicApiKey = "{{ $public_api_key }}";
|
let publicApiKey = "{{ $public_api_key }}";
|
||||||
|
let fieldStyles = "line-height: 1; height: 28px; border: 1px solid #AAA; color: #000; padding: 2px;";
|
||||||
|
|
||||||
var fieldStyles = "line-height: 1; height: 28px; border: 1px solid #AAA; color: #000; padding: 2px;";
|
let nameFieldConfig = {
|
||||||
|
|
||||||
var nameFieldConfig = {
|
|
||||||
publicApiKey: publicApiKey,
|
publicApiKey: publicApiKey,
|
||||||
fieldDivId: "eway-secure-field-name",
|
fieldDivId: "eway-secure-field-name",
|
||||||
fieldType: "name",
|
fieldType: "name",
|
||||||
styles: fieldStyles
|
styles: fieldStyles
|
||||||
};
|
};
|
||||||
var cardFieldConfig = {
|
|
||||||
|
let cardFieldConfig = {
|
||||||
publicApiKey: publicApiKey,
|
publicApiKey: publicApiKey,
|
||||||
fieldDivId: "eway-secure-field-card",
|
fieldDivId: "eway-secure-field-card",
|
||||||
fieldType: "card",
|
fieldType: "card",
|
||||||
styles: fieldStyles
|
styles: fieldStyles
|
||||||
};
|
};
|
||||||
var expiryFieldConfig = {
|
|
||||||
|
let expiryFieldConfig = {
|
||||||
publicApiKey: publicApiKey,
|
publicApiKey: publicApiKey,
|
||||||
fieldDivId: "eway-secure-field-expiry",
|
fieldDivId: "eway-secure-field-expiry",
|
||||||
fieldType: "expiry",
|
fieldType: "expiry",
|
||||||
styles: fieldStyles
|
styles: fieldStyles
|
||||||
};
|
};
|
||||||
var cvnFieldConfig = {
|
|
||||||
|
let cvnFieldConfig = {
|
||||||
publicApiKey: publicApiKey,
|
publicApiKey: publicApiKey,
|
||||||
fieldDivId: "eway-secure-field-cvn",
|
fieldDivId: "eway-secure-field-cvn",
|
||||||
fieldType: "cvn",
|
fieldType: "cvn",
|
||||||
styles: fieldStyles
|
styles: fieldStyles
|
||||||
};
|
};
|
||||||
|
|
||||||
function secureFieldCallback(event) {
|
function secureFieldCallback(event) {
|
||||||
if (!event.fieldValid) {
|
if (!event.fieldValid) {
|
||||||
console.log(event.errors);
|
console.log(event.errors);
|
||||||
} else {
|
} else {
|
||||||
// set the hidden Secure Field Code field
|
// set the hidden Secure Field Code field
|
||||||
var s = document.getElementById("securefieldcode");
|
let s = document.getElementById("securefieldcode");
|
||||||
s.value = event.secureFieldCode
|
s.value = event.secureFieldCode
|
||||||
console.log(s.value);
|
console.log(s.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
window.onload = function () {
|
eWAY.setupSecureField(nameFieldConfig, secureFieldCallback);
|
||||||
eWAY.setupSecureField(nameFieldConfig, secureFieldCallback);
|
eWAY.setupSecureField(cardFieldConfig, secureFieldCallback);
|
||||||
eWAY.setupSecureField(cardFieldConfig, secureFieldCallback);
|
eWAY.setupSecureField(expiryFieldConfig, secureFieldCallback);
|
||||||
eWAY.setupSecureField(expiryFieldConfig, secureFieldCallback);
|
eWAY.setupSecureField(cvnFieldConfig, secureFieldCallback);
|
||||||
eWAY.setupSecureField(cvnFieldConfig, secureFieldCallback);
|
|
||||||
};
|
|
||||||
|
|
||||||
let payNow = document.getElementById('pay-now');
|
|
||||||
|
|
||||||
payNow.addEventListener('click', () => {
|
|
||||||
console.log("click");
|
|
||||||
document.getElementById('server_response').submit();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document
|
||||||
</script>
|
.getElementById('authorize-card')
|
||||||
|
.addEventListener('click', () => {
|
||||||
|
console.log('Clicked..');
|
||||||
|
// document.getElementById('server_response').submit();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
Loading…
x
Reference in New Issue
Block a user