1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-23 01:41:34 +02:00
invoiceninja/resources/views/portal/ninja2020/gateways/paypal/pay.blade.php

95 lines
2.9 KiB
PHP
Raw Normal View History

2023-06-19 06:25:42 +02:00
@extends('portal.ninja2020.layout.payments', ['gateway_title' => ctrans('texts.payment_type_credit_card'), 'card_title' => ctrans('texts.payment_type_credit_card')])
@section('gateway_head')
2023-06-20 06:25:42 +02:00
<link
rel="stylesheet"
type="text/css"
href="https://www.paypalobjects.com/webstatic/en_US/developer/docs/css/cardfields.css"
/>
2023-06-19 06:25:42 +02:00
@endsection
@section('gateway_content')
2023-06-21 11:22:20 +02:00
<form action="{{ route('client.payments.response') }}" method="post" id="server_response">
@csrf
<input type="hidden" name="payment_hash" value="{{ $payment_hash }}">
<input type="hidden" name="company_gateway_id" value="{{ $gateway->company_gateway->id }}">
<input type="hidden" name="gateway_response" id="gateway_response">
<input type="hidden" name="amount_with_fee" id="amount_with_fee" value="{{ $total['amount_with_fee'] }}"/>
</form>
<div class="alert alert-failure mb-4" hidden id="errors"></div>
2023-06-20 06:25:42 +02:00
<div id="paypal-button-container" class="paypal-button-container"></div>
2023-06-21 13:11:41 +02:00
2023-06-19 06:25:42 +02:00
@endsection
@section('gateway_footer')
@endsection
@push('footer')
2023-06-21 11:22:20 +02:00
<script src="https://www.paypal.com/sdk/js?components=buttons,hosted-fields&intent=capture&client-id={!! $client_id !!}" data-client-token="{!! $token !!}">
2023-06-20 06:25:42 +02:00
</script>
<script>
2023-06-21 11:22:20 +02:00
paypal.Buttons({
2023-06-21 13:11:41 +02:00
env: "{{ $gateway->company_gateway->getConfigField('testMode') ? 'sandbox' : 'production' }}",
client: {
@if($gateway->company_gateway->getConfigField('testMode'))
sandbox: "{{ $gateway->company_gateway->getConfigField('clientId') }}"
@else
production: "{{ $gateway->company_gateway->getConfigField('clientId') }}"
@endif
},
createOrder: function(data, actions) {
return "{!! $order_id !!}"
},
onApprove: function(data, actions) {
2023-06-21 11:22:20 +02:00
2023-06-21 13:11:41 +02:00
return actions.order.capture().then(function(details) {
document.getElementById("gateway_response").value =JSON.stringify( details );
document.getElementById("server_response").submit();
2023-06-21 11:22:20 +02:00
2023-06-21 13:11:41 +02:00
});
2023-06-21 11:22:20 +02:00
}
2023-06-21 13:11:41 +02:00
});
var FUNDING_SOURCES = [
2023-06-21 14:19:13 +02:00
paypal.FUNDING.PAYPAL,
paypal.FUNDING.CARD,
paypal.FUNDING.VENMO,
paypal.FUNDING.SEPA,
paypal.FUNDING.BANCONTACT,
paypal.FUNDING.EPS,
paypal.FUNDING.GIROPAY,
paypal.FUNDING.IDEAL,
paypal.FUNDING.MERCADOPAGO,
paypal.FUNDING.MYBANK,
paypal.FUNDING.PAYLATER,
paypal.FUNDING.P24,
paypal.FUNDING.SOFORT,
];
2023-06-21 13:11:41 +02:00
// Loop over each funding source
FUNDING_SOURCES.forEach(function (fundingSource) {
// Initialize the buttons
var button = paypal.Buttons({
fundingSource: fundingSource,
})
// Check if the button is eligible
if (button.isEligible()) {
// Render the standalone button for that funding source
button.render('#paypal-button-container')
}
})
2023-06-21 11:22:20 +02:00
2023-06-19 07:51:30 +02:00
</script>
2023-06-19 06:25:42 +02:00
@endpush