Update .env vars for wepay

This commit is contained in:
David Bomba 2021-06-14 08:33:56 +10:00
parent 0bc3ec111d
commit dc7f4507cd
2 changed files with 8 additions and 3 deletions

View File

@ -149,7 +149,7 @@ return [
'invoiceninja_hosted_pdf_generation' => env('NINJA_HOSTED_PDF', false),
'ninja_stripe_key' => env('NINJA_STRIPE_KEY', null),
'wepay' => [
'environment' => env('WEPAY_ENVIRONMENT', 'staging'),
'environment' => env('WEPAY_ENVIRONMENT', 'stage'),
'client_id' => env('WEPAY_CLIENT_ID', ''),
'client_secret' => env('WEPAY_CLIENT_SECRET',''),
]

View File

@ -44,7 +44,7 @@
<script type="text/javascript" src="https://static.wepay.com/min/js/tokenization.4.latest.js"></script>
<script type="text/javascript">
(function() {
WePay.set_endpoint("stage"); // change to "production" when live
WePay.set_endpoint({{ config('ninja.wepay.environment') }}); // change to "production" when live
// Shortcuts
var d = document;
@ -63,7 +63,7 @@
addEvent(d.id('card_button'), 'click', function() {
var userName = [valueById('cardholder_name')].join(' ');
response = WePay.credit_card.create({
"client_id": valueById('client_id'),
"client_id": {{ config('ninja.wepay.client_id') }},
"user_name": valueById('cardholder_name'),
"email": valueById('email'),
"cc_number": valueById('card-number'),
@ -80,6 +80,11 @@
} else {
// call your own app's API to save the token inside the data;
// show a success page
var token = response.credit_card_id;
// Insert the token into the form so it gets submitted to the server
$form.append($('<input type="hidden" name="source_token"/>').val(token));
// and submit
$form.get(0).submit();
}
});
});