'coust', 'description'),
'bool', null)
+ ( 'credit.processor.stripe.enabled', 'credit',
+ oils_i18n_gettext('credit.processor.stripe.enabled',
+ 'Enable Stripe payments',
+ 'coust', 'label'),
+ oils_i18n_gettext('credit.processor.stripe.enabled',
+ 'Enable Stripe payments',
+ 'coust', 'description'),
+ 'bool', null)
+
+,( 'credit.processor.stripe.pubkey', 'credit',
+ oils_i18n_gettext('credit.processor.stripe.pubkey',
+ 'Stripe publishable key',
+ 'coust', 'label'),
+ oils_i18n_gettext('credit.processor.stripe.pubkey',
+ 'Stripe publishable key',
+ 'coust', 'description'),
+ 'string', null)
+
+,( 'credit.processor.stripe.privatekey', 'credit',
+ oils_i18n_gettext('credit.processor.stripe.privatekey',
+ 'Stripe secret key',
+ 'coust', 'label'),
+ oils_i18n_gettext('credit.processor.stripe.privatekey',
+ 'Stripe secret key',
+ 'coust', 'description'),
+ 'string', null)
+
,( 'format.date', 'gui',
oils_i18n_gettext('format.date',
'Format Dates with this pattern.',
</style>
[% END %]
[% INCLUDE 'opac/parts/goog_analytics.tt2' %]
- [% IF myopac_main_page == "payment_form" AND ctx.get_org_setting(ctx.user.home_ou.id, 'opac.processor.stripe.enabled')%]
- <script type="text/javascript" src="https://js.stripe.com/v2/"></script> <!-- use an ou setting for this url? -->
- <script type="text/javascript">
- // This script is only displayed when logged in, so ctx.user.home_ou is always available
- Stripe.setPublishableKey('[% ctx.get_org_setting(ctx.user.home_ou.id, 'credit.processor.stripe.pubkey') %]');
+ [% INCLUDE 'opac/parts/stripe.tt2' %]
- function stripe_onsubmit() {
- var form = document.getElementById("stripe_form");
- var button = document.getElementById("payment_submit");
-
- button.disabled = true;
-
- Stripe.card.createToken(form, stripe_callback);
-
- return false;
- }
-
- function stripe_callback(status, response) {
- var form = document.getElementById("payment_form");
- var button = document.getElementById("payment_submit");
- var stripe_token = document.getElementById("stripe_token");
-
- if(response.error) {
- alert(response.error.message);
- button.disabled = false;
- return;
- }
-
- stripe_token.value = response.id; // response.id is the token id, though there are more fields available if needed.
- form.setAttribute("onsubmit","");
- form.submit();
- }
- </script>
- [% END %]
-
- </head>
+ </head>
<body[% IF want_dojo; ' class="tundra"'; END %]>
<h1 class="sr-only">[% l('Catalog') %]</h1>
[%#Each content page needs (at minimum) an <h2> describing the content%]
--- /dev/null
+[%- PROCESS "opac/parts/header.tt2";
+ IF myopac_main_page == "payment_form" AND ctx.get_org_setting(ctx.user.home_ou.id, 'opac.processor.stripe.enabled')%]
+
+ <script type="text/javascript" src="https://js.stripe.com/v2/"></script> <!-- use an ou setting for this url? -->
+ <script type="text/javascript">
+ // This script is only displayed when logged in, so ctx.user.home_ou is always available
+ Stripe.setPublishableKey('[% ctx.get_org_setting(ctx.user.home_ou.id, 'credit.processor.stripe.pubkey') %]');
+
+ function stripe_onsubmit() {
+ var form = document.getElementById("stripe_form");
+ var button = document.getElementById("payment_submit");
+
+ button.disabled = true;
+
+ Stripe.card.createToken(form, stripe_callback);
+
+ return false;
+ }
+
+ function stripe_callback(status, response) {
+ var form = document.getElementById("payment_form");
+ var button = document.getElementById("payment_submit");
+ var stripe_token = document.getElementById("stripe_token");
+
+ if(response.error) {
+ alert(response.error.message);
+ button.disabled = false;
+ return;
+ }
+
+ stripe_token.value = response.id; // response.id is the token id, though there are more fields available if needed.
+ form.setAttribute("onsubmit","");
+ form.submit();
+ }
+ </script>
+[%- END %]