Skip to content

Commit

Permalink
paypal support for backups
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Aug 3, 2024
1 parent 43c60c6 commit f500809
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 6 deletions.
33 changes: 33 additions & 0 deletions backup/static/backup/backup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2309,6 +2309,39 @@ app.controller('backupPlanNowOneClick', function ($scope, $http, $window) {

};

//// paypal

$scope.PaypalBuyNowBackup = function (planName, monthlyPrice, yearlyPrice, months) {

const baseURL = 'https://platform.cyberpersons.com/Billing/PaypalCreateOrderforBackupPlans';
// Get the current URL
var currentURL = window.location.href;

// Find the position of the question mark
const queryStringIndex = currentURL.indexOf('?');

// Check if there is a query string
currentURL = queryStringIndex !== -1 ? currentURL.substring(0, queryStringIndex) : currentURL;

// Encode parameters to make them URL-safe
const params = new URLSearchParams({
planName: planName,
monthlyPrice: monthlyPrice,
yearlyPrice: yearlyPrice,
returnURL: currentURL, // Add the current URL as a query parameter
months: months
});


// Build the complete URL with query string
const fullURL = `${baseURL}?${params.toString()}`;

// Redirect to the constructed URL

window.location.href = fullURL;

}


});

Expand Down
21 changes: 16 additions & 5 deletions backup/templates/backup/oneClickBackups.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ <h3 class="title-hero">

<form action="/" class="form-horizontal bordered-row">

<p style="font-size: 15px;margin: 1%;">With CyberPanel's one-click backups, you can easily back up your website to our secure
<p style="font-size: 15px;margin: 1%;">With CyberPanel's one-click backups, you can easily back
up your website to our secure
servers in just 60 seconds. It's simple, fast, and reliable.</p>


Expand Down Expand Up @@ -82,7 +83,7 @@ <h3 class="title-hero">
<td>
{% if plan.state == 1 %}
<a
href="{% url 'ManageOCBackups' %}?id={{ plan.id }}">
href="{% url 'ManageOCBackups' %}?id={{ plan.id }}">
<button style="margin-bottom: 1%" type="button"
class="btn btn-primary btn-lg btn-block">{% trans "Schedule Backups" %}</button>
</a>
Expand Down Expand Up @@ -136,12 +137,22 @@ <h3 class="title-hero">
<td>${{ plan.monthlyPrice }}</td>
<td>${{ plan.yearlyPrice }}</td>
<td>
{% if plan.name != '100GB' %}
<button type="button"
ng-click="PaypalBuyNowBackup('{{ plan.name }}', '{{ plan.monthlyPrice }}', '{{ plan.yearlyPrice }}', 1)"
class="btn btn-primary btn-lg btn-block">{% trans "Buy Monthly (Paypal)" %}</button>
{% endif %}
<button type="button"
ng-click="BuyNowBackupP('{{ plan.name }}', '{{ plan.monthlyPrice }}', '{{ plan.yearlyPrice }}', 1)"
class="btn btn-primary btn-lg btn-block">{% trans "Buy Monthly" %}</button>
ng-click="PaypalBuyNowBackup('{{ plan.name }}', '{{ plan.monthlyPrice }}', '{{ plan.yearlyPrice }}', 12)"
class="btn btn-primary btn-lg btn-block">{% trans "Buy Yearly (Paypal)" %}</button>
{% if plan.name != '100GB' %}
<button type="button"
ng-click="BuyNowBackupP('{{ plan.name }}', '{{ plan.monthlyPrice }}', '{{ plan.yearlyPrice }}', 1)"
class="btn btn-primary btn-lg btn-block">{% trans "Buy Monthly via Card" %}</button>
{% endif %}
<button type="button"
ng-click="BuyNowBackupP('{{ plan.name }}', '{{ plan.monthlyPrice }}', '{{ plan.yearlyPrice }}', 12)"
class="btn btn-primary btn-lg btn-block">{% trans "Buy Yearly" %}</button>
class="btn btn-primary btn-lg btn-block">{% trans "Buy Yearly via Card" %}</button>
</td>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion baseTemplate/templates/baseTemplate/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

<!-- HELPERS -->

{% with version="2.3.5.6" %}
{% with version="2.3.5.7" %}

<link rel="stylesheet" type="text/css" href="{% static 'baseTemplate/assets/finalBase/finalBase.css' %}">

Expand Down

0 comments on commit f500809

Please sign in to comment.