Skip to content

Commit

Permalink
Updated subscription links in admin area for Jomres Trial/Subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
Vince Wooll committed Aug 19, 2019
1 parent 4317bdd commit 5dbcce4
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 584 deletions.
223 changes: 1 addition & 222 deletions assets/templates/bootstrap/administrator/stripe_subscribe.html
Original file line number Diff line number Diff line change
@@ -1,226 +1,5 @@
<patTemplate:tmpl name="pageoutput" unusedvars="strip">
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.4.4/vue.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
<script src="https://checkout.stripe.com/checkout.js"></script>

<style>
.panel{
background: rgba(255, 255, 255, 0.8);
box-shadow: rgba(0, 0, 0, 0.3) 20px 20px 20px;
}
</style>

<div id="app">
<div class="container-fluid">
<div class="panel panel-primary">
<div class="panel-heading">Free 30 day trial</div>
<div class="panel-body">
<form v-on:submit="sub" action="#" id="subs_form_1" >

<div class="form-group">
<label for="firstname" class="cols-sm-2 control-label">First name</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user fa" aria-hidden="true"></i></span>
<input type="text" class="form-control" placeholder="First name (required)" v-model="firstname" autofocus>
</div>
</div>
</div>

<div class="form-group">
<label for="surname" class="cols-sm-2 control-label">Surname</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user fa" aria-hidden="true"></i></span>
<input type="text" class="form-control" placeholder="Surname (required)" v-model="surname">
</div>
</div>
</div>
<div class="form-group">
<label for="country" class="cols-sm-2 control-label">Country</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-globe" aria-hidden="true"></i></span>
<select class="form-control" v-model="country">
<option value="" disabled selected>Country (required)</option>
<option v-for="option in countries" v-bind:value="option.country_code">
{{ option.country_name }}
</option>
</select>
</div>
</div>
</div>

<div class="form-group">
<label for="tax_number" class="cols-sm-2 control-label">Tax number</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-usd" aria-hidden="true"></i></span>
<input type="text" class="form-control" placeholder="VAT/Tax number (optional)" v-model="tax_number">
</div>
</div>
</div>

<div class="form-group">
<label for="email" class="cols-sm-2 control-label">Email</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-envelope-o" aria-hidden="true"></i></span>
<input v-model="email" class="form-control span6" type="email" placeholder="Email (required)">
</div>
</div>
</div>

<div class="row">
<div class="span12">
<div id="warning" v-bind:class="{ 'alert-success': this.isSuccessful, 'alert-danger': this.isError }">
{{log}}
</div>
</div>
</div>

<div class="row">
<div class="span12">
<button class="btn btn-primary btn-block" type="submit">Sign up - it's free</button>
</div>
</div>
</form>
</div> <!-- end of panel body-->
</div> <!-- end of panel -->
</div> <!-- end of .container -->
<button id="customButton" style="display:none">Subscribe</button> <!-- This is here to allow automatic triggering of the Stripe checkout form to make it popup once the invoice id has been received -->
</div> <!-- end of #app -->


<script>
var invoice_id = 0;
var client_email = 0;

var app = new Vue({
el: '#app',
data: {
firstname: '',
surname: '',
email: '',
country: 'ES',
countries: {COUNTRIES},
tax_number: '',
isError: false,
log: ""

},
methods: {
sub: function(event){
event.preventDefault();
if(
this.firstname == "" ||
this.surname == "" ||
this.country == "" ||
this.email == ""
){
this.log ="Please fill all required fields";
this.isError = true;
}else{
var app = this
jomresJquery.blockUI({
message: '<h3>Please wait, I am setting up your account</h3>',
baseZ: 1030,
css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .8,
color: '#fff'
} });

axios.get("{JOMRES_SITEPAGE_URL_ADMIN_AJAX}&task=stripe_subscribe_ajax&firstname="+this.firstname+'&surname='+this.surname+'&country='+this.country+'&email='+this.email+'&tax_number='+this.tax_number)
.then(function (response) {
if (response.data.success ) {
invoice_id = response.data.invoice_id;
client_email = app.email;
jomresJquery.unblockUI();
jomresJquery('#customButton').trigger('click');
}
else {
app.log = response.data.error;
app.isError = true;
jomresJquery.unblockUI();
}
})
.catch(function (error) {
app.log = response.data.error;
app.isError = true;
jomresJquery.unblockUI();
})
}
}
}
})


var handler = StripeCheckout.configure({
key: 'pk_live_LXNptgK7gnpdRxCuV05tnmrN',
image: '{LIVESITE}/jomres/assets/images/jrhouse.png',
locale: 'auto',
token: function(token) {
jomresJquery.blockUI({
message: '<h3>Hang on a moment, I\'m getting your key and will install for you</h3>',
baseZ: 1030,
css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .8,
color: '#fff'
} });

axios.get('{JOMRES_SITEPAGE_URL_ADMIN_AJAX}&task=stripe_subscribe_validate_token&stripeToken='+token.id+'&invoice_id='+invoice_id)
.then(function (response) {
if (response.data.success ) {
var newLoc = '{JOMRES_SITEPAGE_URL_ADMIN}&task=stripe_subscribe_save_key&license_key='+response.data.key
window.location = newLoc;
}
})
.catch(function (error) {
alert("Couldnt get license key");
})

},
opened: function() {
console.log("Form opened");
},
closed: function() {
console.log("Form closed");
}
});

jomresJquery('#customButton').on('click', function(e) {
// Open Checkout with further options:
handler.open({
name: "Developer Subscription",
description: "30 day free trial, then 29€ per month",
amount: 0,
email:client_email,
panelLabel:'Start my free trial',
allowRememberMe: false,
zipCode:true
});
e.preventDefault();
});

// Close Checkout on page navigation:
jomresJquery(window).on('popstate', function() {
handler.close();
});



</script>

<a href="https://www.jomres.net/pricing" target="_blank" class="btn btn-primary btn-large">Get your free trial now!</a>

</patTemplate:tmpl>
Original file line number Diff line number Diff line change
@@ -1,63 +1,32 @@
<patTemplate:tmpl name="pageoutput" unusedvars="strip">

<div class="container-fluid">
<div class="row">
<div class="span7">
<p class="lead">Hi, thanks for your interest in Jomres</p>
<p>Activate your free 30-day Jomres trial, right here, in 2 simple steps.</p>

<ul>
<li>Enter your name, email address, country and tax number (if you have one) and click the sign up button.</li>
<li>Once you have done that, you will be asked to enter your credit card details. <strong>Your card will NOT be charged!</strong></li>
</ul>

<p>Once the subscription has been confirmed we will automatically install your license key for you and you will be able to enjoy the full power of Jomres for 30 days, absolutely free.</p>
<p>If you haven't registered before then we will email you your username and password.</p>
<p>If you want to continue using Jomres after the 30 days is up then you don't need to do anything else. Your card will automatically be charged 29€ plus your local tax (if you have not supplied us with a valid tax number for your business)</p>
<p>If you don't want to use Jomres then you can cancel your subscription at any time, however be aware that you will need to uninstall any plugins that you may have installed.</p>


</div>
<div class="span5">
{SUBSCRIPTION_FORM_USER_DETAILS}
</div>
</div>

<h2>Prices start at 9.99€ per month</h2>

<p>
9.99€ per month for No Support licenses, or 14€ per month for licenses with support.
</p>

<p>
You can get a free license key for Jomres, which then gives you 30 days use of all Jomres core plugins. Take the time to see if the system is what you need. If it is, great! If it's not, no problem.
</p>

<p>
{SUBSCRIPTION_FORM_USER_DETAILS}
</p>

<p>
Not sure if you want a subscription or to pay for a one-off license? <a href="http://www.jomres.net/manual/60-jomres-manual/intro/383-jomres-licensing-explained" target="_blank">See this page</a> for a complete explanation of how I license the software, and why you have a choice.
</p>

<hr/>

<p class="small"><a href="https://www.ioncube.com/loaders.php" target="_blank">Ioncube loaders</a> required for trials/subscriptions. If in doubt, please contact your web hosts.</p>

<p class="small">To prevent abuse, we ask all free trial recipients to give valid credit card details to <a href="https://stripe.com/" target="_blank">Stripe.</a> We do NOT store these details. If you decide to keep using Jomres after your 30-day free trial, Stripe will transfer you to a monthly subscription which you can cancel at any time. Alternatively, cancel at any time during your 30-day trial and you will not be charged anything at all. You can cancel the trial either through logging into Stripe, or logging into your account on Jomres.net and viewing your <a href="https://license-server.jomres.net/index.php?cmd=invoices/index" target="_blank">invoice.</a></p>

<p class="small">If you do not cancel the trial then we will assume that you intend to continue using Jomres and that your subscription is approved.</p>

<div class="row small">
<div class="span12">
<h5>Terms and conditions</h5>
</div>
<div class="span12">
<ol type="1">
<li>The free trial shall last for a period of 30 days only. After the 30 day free trial, we will charge your credit card 29€ (plus local tax where applicable) per calendar month to continue using the service.</li>
<li>Support
<ul>
<li>Trial users. Unfortunately we can only provide installation support for trial users.</li>
<li>Subscribers. We provide full and unlimited support to subscribers. For more complete information please see our <a href="https://www.jomres.net/support-policy">Support Policy.</a></li>
</ul>
</li>

<li>All customers signing up for the free trial will be required to submit payment card details as part of the process, to allow automatic payments once the free trial period finishes.</li>
<li>Only one free trial is available per customer account.</li>
<li>Customers not wishing to continue using the service once the free trail ends can cancel the subscription using the <a href="https://license-server.jomres.net/index.php?cmd=invoices/index" target="_blank">Cancel Subscription link</a> located on the view invoice page in their account on our website.</li>
<li>Offer applies to new customers only who select the 30 Day Free Trial option when signing up to a new subscription. </li>
<li>Notice will be sent if payment fails for any reason. It is the customer's responsibility to make sure payment details are correct to allow successful subscription payments. </li>
<li>Once your subscription ends you will be able to continue using the software that you have downloaded up until that point however you will not be able to download updates or benefit from our support service.</li>
<li>We reserve the right to remove or cancel the free trial offer at any time. </li>
<li>We reserve the right to change the features of the free trial offer at any time. </li>
<li>Our General Terms and Conditions apply. </li>
<li>We review all orders and reserve the right to deny or cancel subscriptions at any time and for any reason.</li>
<li>JOMRES.NET RESERVES THE RIGHT TO CHANGE THESE TERMS AND CONDTIONS AT ANY TIME. <br />
Changes to the Terms and Conditions will be announced on the 'Jomres.net' website. Failure to receive notification of a change does not make those changes invalid.</li>
</ol>
</div>
</div>
</div>



</patTemplate:tmpl>
Loading

0 comments on commit 5dbcce4

Please sign in to comment.